text stringlengths 6.04k 39.5k |
|---|
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
"""Courseware API functions"""
import logging
from datetime import timedelta
from urllib.parse import urljoin, urlparse, parse_qs
import requests
from requests.exceptions import HTTPError
from rest_framework import status
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from dja... |
import numpy as np
try:
np.random.bit_generator = np.random._bit_generator
print("rename numpy.random._bit_generator")
except:
print("numpy.random.bit_generator exists")
import cv2
import pandas as pd
import os
import imgaug as ia
import imgaug.augmenters as iaa
from utils.utils import to_categorical
from... |
# Copyright [2018-2022] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#!/usr/bin/env python3
from contextlib import closing
import argparse
import multiprocessing
import os
import os.path
import re
import socket
import subprocess
import sys
import urllib.parse
import urllib3
import bs4
import dulwich.index
import dulwich.objects
import dulwich.pack
import requests
import socks
def pri... |
import hashlib
import json
import os
import random
import threading
import sys
import time
import uuid
import functools
import pandas as pd
import numpy as np
from fate_test._config import Config
from fate_test._io import echo, LOGGER
def import_fate():
from fate_arch import storage
from fate_flow.utils impo... |
#!/usr/bin/python3
#coding=utf-8
"""
Copyright © 2021 - 2023 | Latip176
Semua codingan dibuat oleh Latip176.
"""
import json, os, re, time
from concurrent.futures import ThreadPoolExecutor as Bool
P = "\x1b[0;97m"
M = "\x1b[0;91m"
H = "\x1b[0;92m"
K = "\x1b[0;93m"
B = "\x1b[0;94m"
BM = "\x1b[0;96m"
try:
impor... |
import argparse
import multiprocessing
from functools import partial
from io import BytesIO
import lmdb
from PIL import Image
from tqdm import tqdm
import torch
import numpy as np
import pandas as pd
import cv2
import sys
import json
import os
from glob import glob
from utils.CUB_data_utils import square_bbox, pertur... |
#!/usr/bin/env python
"""
TODOS:
* docs
* better code documentation
* add a readme
* describe csv/tsv file(s) directory
* describe copy
* describe auth
* Add boto copy functionality
* Use an ACL rather than two copy operations
"""
import concurrent.futures as futures
import csv
import os
import sys
im... |
# Author: <NAME> <<EMAIL>>
"""Connect Experiment and Serve
Notes
=====
Experiment:
.locate_trf: return filename & whether it exists or instruction
(func, kwargs) to make it
.make_trf: makes trf-file based on filename and kwargs or sends to
dispatcher
.locate_trfs: f... |
import checksumdir
import glob
import os
import requests
import time
import json
from utils import hash_file, get_rand_str, parse_train_info, parse_train_list, \
run_cmd, run_cmd_error_check, parse_serve_list, serve_and_assert, pretty_print
from PyPDF2 import PdfFileReader
TIMEOUT_S = 600
class TrainJob:
... |
import copy
from typing import Optional
import numpy as np
from tqdm import tqdm
import os
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel
import torch.multiprocessing as mp
from cogdl.wrappers.data_wrapper.base_data_wrapper import DataWrapper
from cogdl.wrappers.mo... |
"""Optimizer Wrapper for ElasticDL"""
import numpy as np
import tensorflow as tf
from tensorflow.keras.optimizers import (
SGD,
Adadelta,
Adagrad,
Adam,
Adamax,
Ftrl,
Nadam,
RMSprop,
)
from elasticdl.python.common.log_util import default_logger as logger
from elasticdl.python.elasticd... |
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
from netCDF4 import Dataset as netcdf_dataset
import numpy as np
import numpy.ma as ma
import xarray as xr
import glob
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as cols
import matpl... |
"""
Python Vim plugin for Filepirate.<ESC>
:arrr
E492: Not an editor command: arrr
:q!
File Pirate by <NAME>. BSD license.
The Vim incantations contained herein were heavily based upon, and in several cases directly copied from, Wincent Colaiuta's excellent Command-T plugin, available here: https://wincent.com/produ... |
# Copyright 2015, 2017 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import numpy as np
from .builder import IOU_CALCULATORS
def cast_tensor_type(x, scale=1., dtype=None):
if dtype == 'fp16':
# scale is for preventing overflows
x = (x / scale).half()
return x
def fp16_clamp(x, min=None, max=None):
... |
"""
A collection of objects that may come to interaction with the user.
"""
from typing import Any, Callable, Dict, List, Optional
from preql import settings
from preql.utils import SafeDict, X, dataclass, listgen
from . import pql_ast as ast
from . import pql_types, sql
from .exceptions import Signal, pql_Attribute... |
from model import QModel
import pygame
import random
from pygame import *
import numpy as np
import cv2
import os
__author__ = "<NAME>"
__copyright__ = "Copyright 2018, RSoft"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Develo... |
# -*- coding: utf8 -*-
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2019 AT&T Intellectual Property. All rights reserved.
# ===========================================... |
# -*- coding: utf-8 -*-
#############################################################################
# @package ad_hmi
# @brief GNSS node of python package ad_hmi.
#############################################################################
# @author <NAME>
# @copyright (c) All rights reserved.
######################... |
import typing
import os
import sys
import select
import io
import warnings
import logging
from collections import namedtuple
import functools
import shlex
import subprocess
import google.auth
import paramiko
import shutil
import time
import numpy as np
import pandas as pd
import requests
import hashlib
def isatty(*str... |
import random
import math
import collections
import os
import base64
import secrets
import time
import unittest
import aiohttp
import requests
from hailtop.config import get_deploy_config
from hailtop.auth import service_auth_headers
from hailtop.utils import retry_response_returning_functions
from hailtop.batch_clien... |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
"""jc - JSON CLI output utility
JC cli module
"""
import sys
import os
import os.path
import re
import importlib
import textwrap
import signal
import shlex
import subprocess
import json
import jc
import jc.appdirs as appdirs
import jc.utils
import jc.tracebackplus
from jc.exceptions import LibraryNotInstalled, ParseEr... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import scipy.stats as st
import pandas as pd
# related to processing splitseq
def get_bc1_matches():
# from spclass.py - barcodes and their well/primer type identity
bc_file = '/Users/fairliereese/mortazavi_lab/bin/pacbio-splitpipe/barcodes/bc_8nt_v2.csv'
bc_df = pd.read_csv(bc_file, index_col=0, names=['bc'])
b... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from builtins import str
from builtins import *
from past.utils import old_... |
""" Module implementing GAN which will be trained using the Progressive growing
technique -> https://arxiv.org/abs/1710.10196
"""
import datetime
import os
import time
import timeit
import copy
import numpy as np
import torch as th
class Generator(th.nn.Module):
""" Generator of the GAN network """
def _... |
# Criação do mapa e do carro autônomo
# Importação das bibliotecas
import numpy as np
from random import random, randint
import matplotlib.pyplot as plt
import time
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.graphics import Color, Ellipse, Line
from kivy.co... |
import json
import functools
import urllib
from collections import OrderedDict
from os import path
from copy import deepcopy
from typing import List, Union
from mitmproxy import ctx, flow
from mitmproxy.http import HTTPRequest
from mitmproxy.script import concurrent
from mitmproxy.addons.serverplayback import ServerPla... |
import itertools
import glob
import os
import re
import warnings
import numpy as np
import pandas as pd
from pathlib import Path
from disease_spread_model.names import TRANSLATE
def get_list_of_tuples_from_dir(directory):
fnames = all_fnames_from_dir(directory=directory)
for i, fname in enumerate(fnames... |
# coding: utf-8
# YYeTsBot - bot.py
# 2019/8/15 18:27
__author__ = 'Benny <<EMAIL>>'
import io
import time
import re
import logging
import json
import tempfile
from urllib.parse import quote_plus
import telebot
from telebot import types, apihelper
from tgbot_ping import get_runtime
from apscheduler.schedulers.backg... |
import tensorflow as tf
import numpy as np
import logging
def crop_and_concat(net1, net2):
"""
the size(net1) <= size(net2)
"""
net1_shape = net1.get_shape().as_list()
net2_shape = net2.get_shape().as_list()
# print(net1_shape)
# print(net2_shape)
# if net2_shape[1] >= net1_shape[1] an... |
"""Main module containing the Plot class
"""
import pathlib
import warnings
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import nibabel as nib
from brainspace.mesh.mesh_io import read_surface
from brainspace.plotting.utils import PTuple
from brainspace.mesh.array_operations import get_lab... |
# by amounra 0613 : http://www.aumhaa.com
import Live
import os, __builtin__, __main__, _ast, _codecs, _functools, _md5, _random, _sha, _sha256, _sha512, _socket, _sre, _ssl, _struct, _symtable, _weakref, binascii, cStringIO, collections, datetime, errno, exceptions, gc, imp, itertools, marshal, math, sys, time #_typ... |
import arcade
from arcade.gui import Theme
from buttons import PlayButton, ExitButton, ValueButton, SubmitButton, HitButton, StandButton
class GameView(arcade.View):
"""Class to create GameView instance"""
def __init__(self, view, WIDTH, HEIGHT):
super().__init__()
self.view = view
self.WIDTH = WIDTH
... |
import logging
from sortedcontainers import SortedDict
from PySide2.QtWidgets import QGraphicsScene, QGraphicsItem, QAbstractSlider, QHBoxLayout, QAbstractScrollArea
from PySide2.QtGui import QPainter
from PySide2.QtCore import Qt, QRectF, QRect, QEvent
from angr.block import Block
from angr.analyses.cfg.cfb import U... |
import numpy as np
import matplotlib.pyplot as plt
import time
from IPython import display
# Implemented methods
methods = ['DynProg', 'ValIter'];
# Some colours
LIGHT_RED = '#FFC4CC';
LIGHT_GREEN = '#95FD99';
BLACK = '#000000';
WHITE = '#FFFFFF';
LIGHT_PURPLE = '#E8D0FF';
LIGHT_ORANGE = '#FAE0C3';
... |
# -*- coding: utf-8 -*-
# @Time : 2021/12/26 22:22
# @Author : <NAME>
import argparse
import random
import numpy as np
import os
import torch
import torch.nn as nn
from torch.autograd import Variable
from torchvision import datasets, transforms
import wandb
# from models import *
import models
# os.environ['CUDA... |
"""
Copyright (c) 2019 NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, su... |
# -*- coding: utf-8 -*-
"""The source code classes."""
import collections
from yaldevtools import definitions
class EnumDeclaration(object):
"""Enumeration type declaration.
Attributes:
name (str): name.
constants (dict[str, str]): constant values per name.
"""
def __init__(self, name):
"""Ini... |
'''
HDFS cluster creation wizard with a console UI.
'''
from __future__ import print_function
import sys
import re
import math
import os
from os import path
import simplejson as json
import collections
from linodecommon import logger
from linodecommon import linode_api
from terminaltables import AsciiTable, SingleTa... |
"""GraphTensor adjacency types."""
from typing import Dict, Mapping, Optional, Tuple, Union
import tensorflow as tf
from tensorflow_gnn.graph import graph_constants as const
from tensorflow_gnn.graph import graph_piece as gp
from tensorflow_gnn.graph import tensor_utils as utils
# pylint: disable=g-direct-tensorflow... |
import unittest
from decimal import Decimal
import pytest
from app.questionnaire.placeholder_transforms import PlaceholderTransforms
class TestPlaceholderParser(unittest.TestCase):
def setUp(self):
self.transforms = PlaceholderTransforms(language="en")
def test_format_currency(self):
assert... |
import json
import argparse
import copy
import traceback
from datetime import datetime
import os
from rdflib import Graph
import zipfile
import io
from contextlib import closing
from bs4 import BeautifulSoup, SoupStrainer
import re
import requests
import sys
# from scheduled
from scheduled_bots import PROPS, ITEMS, get... |
# -*- coding: utf-8 -*-
"""
Module containing utilities regarding low level vector operations.
"""
import enum
import logging
import math
from typing import Any, List, Optional, Union
import geopandas as gpd
import numpy as np
import pygeos
import shapely.wkb as sh_wkb
import shapely.geometry as sh_geom
import shapel... |
import numpy as np
import torch
from det3d import torchie
from det3d.datasets.kitti import kitti_common as kitti
from det3d.core.evaluation.bbox_overlaps import bbox_overlaps
from det3d.core.bbox import box_np_ops
from det3d.core.sampler import preprocess as prep
from det3d.builder import (
build_dbsampler,
bu... |
#!/usr/bin/env python
# Edit this script to add your team's training code.
from helper_code import *
import numpy as np, os, sys, joblib
from sklearn.impute import SimpleImputer
from sklearn.ensemble import RandomForestClassifier
from keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.layers.ex... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
#-*- coding:utf-8 -*-
#Author:Jackzhangqf
#Date:2017-09-18 Create this file
#功能描述:根据解析得到的.CFG文件,解析数据文件
#BugFixed:
#(1)2021.02.02 [BUG001]不能减1,2021.02.02日修复,不然在提取数字通道39的时候会提取到31的数值,刚好错开了一个字节
#(2)2021.02.03 [BUG002]
#(3)2021.03.20 [BUG003]
#-----------------------------
#问题1:数据的二进制格式:(4个字节描述采样点序号,低字节在前)+(4个字节描述时间标记)+
# ... |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
'''This module is used to manage the track related data'''
from collections import OrderedDict, deque
from enum import Enum, unique
import math
import os
import threading
import numpy as np
import rospkg
import rospy
from geometry_msgs.msg import Pose
from shapely.geometry import Point, Polygon
from shapely.geometry.p... |
# 潮流计算结果
import sys
sys.path.append('..')
import csv
import numpy as np
from math import cos, sin, pi, sqrt, acos
import apis
from apis import apis_system
from apis import apis_basic
def get_powerflow_result():
'''
Get power flow result in list
Args: None
Rets: None
'''
bus_... |
import re
from typing import Iterable, List
from pyglet import gl
from .buffer import Buffer
_float_base_format = (0, gl.GL_RED, gl.GL_RG, gl.GL_RGB, gl.GL_RGBA)
_int_base_format = (
0,
gl.GL_RED_INTEGER,
gl.GL_RG_INTEGER,
gl.GL_RGB_INTEGER,
gl.GL_RGBA_INTEGER,
)
# format: (base_format, internal... |
import numpy as np
import torch
import torch.nn.functional as F
from torch.autograd import Variable
epsilon=1e-6
import os
manoPath='/home/csc/MANO-hand-model-toolkit/mano/models/MANO_RIGHT.pkl'
if not os.path.exists(manoPath):
manoPath = '/home/shicheng/MANO-hand-model-toolkit/mano/models/MANO_RIGHT.pkl'
if not o... |
#!/usr/bin/env python3
#
# Copyright (c) 2020-2021 Couchbase, Inc All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
#!/usr/bin/env python3
import argparse
import functools
import os
import os.path
import re
import socket
import sys
def make_green(b):
return b'\033[0;32m' + b + b'\033[0m'
def make_yellow(b):
return b'\033[0;33m' + b + b'\033[0m'
def make_red(b):
return b'\033[0;31m' + b + b'\033[0m'
class CommandFailure(... |
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
from scipy.sparse.linalg import norm as sparsenorm
from scipy.linalg import qr
# from sklearn.metrics import f1_score
def parse_index_file(filename):
"""Parse index... |
r"""
Backrefs for the 'regex' module.
Add the ability to use the following backrefs with re:
- `\Q` and `\Q...\E` - Escape/quote chars (search)
- `\c` and `\C...\E` - Uppercase char or chars (replace)
- `\l` and `\L...\E` ... |
from cgi import print_directory
from contextlib import nullcontext
from typing import final
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.models import User
from django.conf import settings
import csv
from django.http import HttpResponse
import re
import os... |
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Optional, List
import os
import torch
import torch.nn as nn
from torch.optim.optimizer import Optimizer
from torch.optim.adamw import AdamW
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.data import Dataset, DataLoader
f... |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... |
#!/usr/bin/env python
from mps_database.mps_config import MPSConfig, models
from mps_database.tools.mps_names import MpsName
from sqlalchemy import func, exc
from .mps_app_reader import MpsAppReader
import argparse
import os
import errno
import re
import shutil
import datetime
import ipaddress
def format_path(path):
... |
# Copyright 2020 DeepMind Technologies Limited.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the right... |
###############################################################################################################################
# This script implements a simplification of the evolutionary process proposed by Real et al.: https://arxiv.org/abs/1802.01548v7#
#############################################################... |
import sys
import os
import argparse
from pathlib import Path
import logging
import torch
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import numpy as np
from tqdm import tqdm
import imageio
import lpips as lpips_lib
sys.path.append(os.path.join(sys.path[0], '../..'))
from datalo... |
# Copyright 2018 The TensorFlow Ranking Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2020 PyMeasure Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limit... |
# Leo colorizer control file for dart mode.
# This file is in the public domain.
# Properties for dart mode.
properties = {
"commentEnd": "*/",
"commentStart": "/*",
"electricKeys": ":",
"indentCloseBrackets": "]}",
"indentNextLine": "\\s*(((if|while)\\s*\\(|else\\s*|else\\s+if\\s*\\(|for\\s*\\(.*\... |
# MIT License
#
# Copyright (c) 2022 Quandela
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... |
"""
AVL Tree.
Balanced Binary Search Tree. Gurantee for balance.
Convention:
- "key" and "val" are almost the same in this implementation. use term "key" for search and delete a particular node. use term "val" for other cases
API:
- insert(self, val)
- delete(self, key)
- search(self, key)
- getDepth(self)
- pr... |
"""
Utilities for running commands on hosts
"""
import datetime
import inspect
import logging
import os
import sys
from collections import MutableMapping
from enum import Enum
from functools import partial
import structlog
from dateutil import tz
import common.atlas_setup as atlas_setup
from common.config import Conf... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
import os
import copy
import torch
import itertools
import numpy as np
from tqdm import tqdm
from collections import Counter
from torch.utils.data.dataset import Dataset
from sklearn.datasets import fetch_20newsgroups
from transformers import RobertaTokenizer
from src.models.sentencebert import SentenceBERT
class Bas... |
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import Polygon as plg
import mmocr.utils as utils
def ignore_pred(pred_boxes, gt_ignored_index, gt_polys, precision_thr):
"""Ignore the predicted box if it hits any ignored ground truth.
Args:
pred_boxes (list[ndarray or list]): The ... |
import os
import shutil
from pyfiglet import Figlet
from update_check import isUpToDate, update
dir_path = os.path.dirname(os.path.realpath("main.py"))
enabled = False
if enabled:
if isUpToDate(f"{dir_path}/main.py", "https://raw.githubusercontent.com/pjotr07740/PjFileExplorer/master/src/main.py") == False:
... |
"""Makes flattened views of volumetric data on the cortical surface.
"""
from six import string_types
from functools import reduce
import os
import glob
import numpy as np
import string
from .. import utils
from .. import dataset
from ..database import db
from ..options import config
def make_flatmap_image(braindata... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
"""
Pocman environment first introduced in Monte-Carlo Planning in Large POMDPs by
Silver and Veness, 2010:
https://papers.nips.cc/paper/4031-monte-carlo-planning-in-large-pomdps.pdf
"""
import logging
from typing import Name... |
"""
CPSC 5520, Seattle University
:Authors: <NAME>
:Version: f19-02
:Assignment: Lab4 - DHT-CHORD
"""
"""
Start the chord_node by giving the port no. 0 to start the network
The node will print it's finger table, its address and predecessor.
When the next node joins the network, it can take the port no. from th... |
#!/usr/bin/env python
import argparse
import os
import pickle
import random
import shutil
import sys
import time
from collections import OrderedDict
from sklearn.metrics import confusion_matrix
import csv
import numpy as np
import glob
# torch
import torch
import torch.nn as nn
import torch.optim as optim
from torch.ut... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# -*- coding: utf-8 -*-
"""
Dynamic programming algorithm to solve nonograms (using recursion)
See details:
https://www.cs.bgu.ac.il/~benr/nonograms/
"""
from __future__ import unicode_literals
import logging
from collections import defaultdict
from functools import reduce
from itertools import product
from six.mov... |
# -*- coding: utf-8 -*-
"""
sample form:
x center, y center, angle, len, wid, speed, ang vel, flattened 7x7 cov of all
msmt form:
mean and cov of observables [x,y,a,l,w]
(H mtx implicitly [I 0])
"""
import numpy as np
from math import hypot, atan2
stdpersecond = np.array((.4, .4, .1, .2, .15, 1.7, .3))
dt = .... |
import os
import re
import sys
import gzip
import math
import random
import pyfastx
import argparse
def fastx_format_check(infile):
if pyfastx.gzip_check(infile):
fp = gzip.open(infile, 'rt')
else:
fp = open(infile)
for line in fp:
if line.strip():
break
fp.close()
if line[0] == '>':
return 'fasta'
... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This module defines the two default GLM passes of fmristat
The results of both passes of the GLM get pushed around by generators, which
know how to get out the (probably 3D) data for each slice, or par... |
#....................................................#
#.
#.pgkylUtil.py
#.<NAME>.
#.September 2018.
#.
#.This file contains functions and operators used by
#.other scripts for post-processing Gkeyll data.
#.
#.
#....................................................#
#.Import libraries.
import postgkyl as pg
import nu... |
import argparse
import os
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import time
from datasets import find_data... |
import math
import os
import itertools
from tqdm import tqdm
import IPython
import numpy as np
import sklearn.cluster
import cv2
from ..models import basnet
from ..utils.downloads import *
from ..utils.console import *
from ..utils import EasyDict
from ..image import *
from .canvas import *
default_color_labels = [
... |
import time
import pytest
from common import ( # NOQA
get_longhorn_api_client, get_self_host_id,
get_core_api_client, get_apps_api_client,
create_and_check_volume, cleanup_volume,
wait_for_volume_healthy, wait_for_volume_detached,
write_volume_random_data, check_volume_data,
get_default_engine... |
# coding: utf-8
from __future__ import unicode_literals
import random
import re
import time
from .common import InfoExtractor
from ..utils import (
clean_html,
ExtractorError,
strip_jsonp,
unescapeHTML,
)
class QQMusicIE(InfoExtractor):
IE_NAME = "qqmusic"
IE_DESC = "QQ音乐"
_VALID_URL = r... |
''' Class to hold a model of a full system
'''
import starry
import astropy.units as u
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
import string
from datetime import datetime
import pandas as pd
import sys
import os
import pickle
from scipy.optimize import minimize
from .star import ... |
#!/usr/bin/env python
""" Replication of CoordConv Paper.
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.modules.conv as conv
import torch.utils.data as utils
import torch.nn.functional as F
from torch.autograd import Variable
from sklearn.model_sel... |
# -*- coding: utf8 -*-
# torch is a file named torch.py
import torch
# torch here is a folder named torch
from torch.autograd import Variable
from torchnet import meter
# this is filename, once imported, you can use the classes in it
from models import topicalWordEmbedding
# equal to from models.topicalAttentionGRU ... |
################################################################################
# @file reaction.py
# @author <NAME>
# @brief
# @version 1.0.0
# @date 2022-02-22
# @copyright Copyright (c) 2022 by <NAME>.
# This work is licensed under terms of the MIT license (<LICENSE>).
#############################################... |
#!/usr/bin/env python
"""Given a set of Etsy shops, determine each shop's top 5 terms.
To set up environment: `pip install -r requirements.txt`
To build documentation: `cd docs; make html`
`./terms.py -h` provides usage information with options.
The full pipeline consists of the following steps:
1. Download data v... |
#!/usr/bin/env python
# Copyright (c) 2011 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... |
from __future__ import print_function
import collections, gzip, time
import numpy as np
import tensorflow as tf
import sys, os
sys.path.append("../tuner_utils")
from yellowfin import YFOptimizer
import inspect
class MediumConfig(object):
"""Medium config."""
init_scale = 0.05
learning_rate = 0.25
max_grad_no... |
'''
Reduced basis methods...
'''
import numpy as np
import scipy as sp
from scipy import linalg
from .solver import solve_sparse, SpSolve
__all__ = ['krylov_subspace',
'compute_modes_pardiso',
'vibration_modes',
'craig_bampton',
'pod',
'modal_derivatives',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.