code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Script to generate BIDS-compliant events files from the original logfiles Author: <NAME> Mail: <EMAIL> """ import argparse import glob import os import numpy as np import pandas as pd parser = argparse.ArgumentParser(description='Parameters for the logfiles') parser.add_argument('-t', '--type', metavar='Subject...
[ "argparse.ArgumentParser", "os.path.basename", "os.getcwd", "pandas.read_csv", "numpy.where", "numpy.logical_or", "os.path.join" ]
[((201, 267), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parameters for the logfiles"""'}), "(description='Parameters for the logfiles')\n", (224, 267), False, 'import argparse\n'), ((8805, 8816), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (8814, 8816), False, 'import os\n'), ((8830...
# Copyright 2016 Google 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 # # Unless required by applicable law or a...
[ "numpy.concatenate", "tensorflow_serving.apis.predict_pb2.PredictRequest", "numpy.float32", "time.time", "numpy.argsort", "tensorflow_serving.apis.prediction_service_pb2.beta_create_PredictionService_stub", "skimage.transform.resize", "tensorflow.app.flags.DEFINE_string", "tensorflow.app.run", "sk...
[((1140, 1229), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""server"""', '"""localhost:9000"""', '"""PredictionService host:port"""'], {}), "('server', 'localhost:9000',\n 'PredictionService host:port')\n", (1166, 1229), True, 'import tensorflow as tf\n'), ((1253, 1324), 'tensorflow.app....
""" File: eval_npy.py Created by: <NAME> Email: <EMAIL><at>gmail<dot>com """ import sys import os from optparse import OptionParser import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.optim import lr_scheduler f...
[ "os.mkdir", "optparse.OptionParser", "os.path.isfile", "torch.nn.Softmax", "torch.ones", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "torch.FloatTensor", "hednet.HNNNet", "torch.zeros", "tqdm.tqdm", "torch.cuda.is_available", "torch.max", "torch.set_grad_enabled", "s...
[((800, 814), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (812, 814), False, 'from optparse import OptionParser\n'), ((1516, 1545), 'logger.Logger', 'Logger', (['"""./logs"""', 'args.logdir'], {}), "('./logs', args.logdir)\n", (1522, 1545), False, 'from logger import Logger\n'), ((1750, 1763), 'torch.nn....
import torch import numpy as np import schnetpack as spk class MeanSquaredError(spk.metrics.MeanSquaredError): def __init__(self, target, model_output=None, bias_correction=None, name=None, element_wise=False): name = 'MSE_' + target if name is None else name super(MeanSquaredEr...
[ "torch.mean", "torch.abs", "torch.min", "numpy.sqrt" ]
[((569, 584), 'torch.abs', 'torch.abs', (['diff'], {}), '(diff)\n', (578, 584), False, 'import torch\n'), ((1196, 1233), 'numpy.sqrt', 'np.sqrt', (['(self.l2loss / self.n_entries)'], {}), '(self.l2loss / self.n_entries)\n', (1203, 1233), True, 'import numpy as np\n'), ((1749, 1764), 'torch.abs', 'torch.abs', (['diff'],...
from ._common import * from sklearn.metrics import roc_curve import numpy as np def _inner_roc_optimal_threshold(curve): dsts = curve[0] ** 2 + (1 - curve[1]) ** 2 argmin = np.argmin(dsts) val = curve[2][argmin] return curve[0][argmin], curve[1][argmin], val def roc_optimal_threshold(y_true, y_pred):...
[ "sklearn.metrics.roc_curve", "numpy.argmin" ]
[((183, 198), 'numpy.argmin', 'np.argmin', (['dsts'], {}), '(dsts)\n', (192, 198), True, 'import numpy as np\n'), ((333, 358), 'sklearn.metrics.roc_curve', 'roc_curve', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (342, 358), False, 'from sklearn.metrics import roc_curve\n'), ((534, 560), 'sklearn.metrics.roc_curv...
import numpy as np from typing import Tuple, Callable def get_velocity_sets() -> np.ndarray: """ Get velocity set. Note that the length of the discrete velocities can be different. Returns: velocity set """ return np.array( [ [0, 0], [1, 0], [...
[ "numpy.dstack", "numpy.divide", "numpy.zeros_like", "numpy.sum", "numpy.roll", "numpy.power", "numpy.expand_dims", "numpy.array", "numpy.linalg.norm" ]
[((247, 340), 'numpy.array', 'np.array', (['[[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [-1, 1], [-1, -1], [1, -1]]'], {}), '([[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [-1, 1], [-1, -\n 1], [1, -1]])\n', (255, 340), True, 'import numpy as np\n'), ((626, 663), 'numpy.array', 'np.array', (['[0, 3, 4, 1...
############################## # Copyright (C) 2009-2011 by # <NAME> (<EMAIL>, <EMAIL>) # <NAME> (<EMAIL>, <EMAIL>) # <NAME> (<EMAIL>) # ... and other members of the Reconstruction Team of David Haussler's # lab (BME Dept. UCSC). # # Permission is hereby granted, free of charge, to any person obtaining a copy # of t...
[ "libMafGffPlot.objListUtility_xAxis", "libMafGffPlot.objListUtility_normalizeCategories", "libMafGffPlot.objListUtility_indexToPos", "numpy.floor", "libMafGffPlot.objListUtility_rangeToPos", "math.floor", "cPickle.load", "numpy.zeros", "os.path.exists", "cPickle.dump", "sys.stderr.write", "lib...
[((11004, 11060), 'libMafGffPlot.objListUtility_indexToPos', 'objListUtility_indexToPos', (['mb.refStart', 'featLen', 'numBins'], {}), '(mb.refStart, featLen, numBins)\n', (11029, 11060), False, 'from libMafGffPlot import objListUtility_indexToPos\n'), ((11075, 11129), 'libMafGffPlot.objListUtility_indexToPos', 'objLis...
"""Solution problems / methods / algorithms module""" import collections import cvxpy as cp import gurobipy as gp import itertools import numpy as np import pandas as pd import scipy.optimize import scipy.sparse as sp import typing import mesmo.config import mesmo.utils logger = mesmo.config.get_logger(__name__) c...
[ "pandas.DataFrame", "scipy.sparse.diags", "scipy.sparse.find", "numpy.transpose", "numpy.zeros", "gurobipy.Model", "numpy.isnan", "collections.defaultdict", "numpy.finfo", "numpy.shape", "numpy.array", "pandas.MultiIndex.from_frame", "scipy.sparse.block_diag", "pandas.concat", "numpy.con...
[((6193, 6252), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['name', 'timestep', 'variable_type']"}), "(columns=['name', 'timestep', 'variable_type'])\n", (6205, 6252), True, 'import pandas as pd\n'), ((6280, 6341), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['name', 'timestep', 'constraint_type']"...
""" train_gymcc.py train an agent on gym classic control environment. Supported environments : """ import os import sys import time import argparse import importlib from functools import partial from collections import OrderedDict import gym import numpy as np import yaml from stable_baselines.common import set_global...
[ "argparse.ArgumentParser", "stable_baselines.common.set_global_seeds", "stable_baselines.common.noise.AdaptiveParamNoiseSpec", "stable_baselines.common.cmd_util.make_atari_env", "yaml.dump", "time.strftime", "numpy.ones", "os.path.isfile", "os.path.join", "zoo.utils.linear_schedule", "os.path.di...
[((1146, 1169), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1164, 1169), False, 'import os\n'), ((1309, 1334), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1332, 1334), False, 'import argparse\n'), ((2177, 2243), 'os.path.join', 'os.path.join', (['exp_params.ou...
import random import numpy as np import matplotlib.pyplot as plt from PIL import Image class LimGenerator(): def __init__(self, layers): super(LimGenerator, self).__init__() self.layers = layers self.colors = [(163, 156, 255), (236, 177, 161), (22, 22, 22), (190, 0, 32), (0, 0, 0), (255, 25...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "numpy.array", "random.randrange", "PIL.Image.fromarray", "matplotlib.pyplot.subplots" ]
[((622, 634), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (630, 634), True, 'import numpy as np\n'), ((861, 882), 'PIL.Image.fromarray', 'Image.fromarray', (['data'], {}), '(data)\n', (876, 882), False, 'from PIL import Image\n'), ((1161, 1176), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')...
# Released under The MIT License (MIT) # http://opensource.org/licenses/MIT # Copyright (c) 2013-2015 SCoT Development Team """ Utility functions """ from __future__ import division from functools import partial import numpy as np def check_random_state(seed): """Turn seed into a np.random.RandomState instanc...
[ "numpy.atleast_2d", "functools.partial", "numpy.sum", "numpy.asarray", "numpy.random.RandomState", "numpy.argmin", "numpy.nonzero", "numpy.argsort", "numpy.logical_or", "numpy.prod", "numpy.repeat" ]
[((1780, 1801), 'numpy.atleast_2d', 'np.atleast_2d', (['matrix'], {}), '(matrix)\n', (1793, 1801), True, 'import numpy as np\n'), ((2010, 2041), 'numpy.logical_or', 'np.logical_or', (['matrix', 'matrix.T'], {}), '(matrix, matrix.T)\n', (2023, 2041), True, 'import numpy as np\n'), ((2056, 2073), 'numpy.sum', 'np.sum', (...
from sklearn.decomposition import PCA import matplotlib.pyplot as plt import time as timelib import numpy as np import pandas as pd def compute_pca(session_data, session_features, cluster_types, verbose = False): """ Compute principal components analysis Parameters ---------- sess...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.clf", "numpy.arange", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "matplotlib.pyplot.axvline", "matplotlib.pyplot.close", "numpy.transpose", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "matplotlib.p...
[((689, 694), 'sklearn.decomposition.PCA', 'PCA', ([], {}), '()\n', (692, 694), False, 'from sklearn.decomposition import PCA\n'), ((871, 963), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'session_data_reduced', 'columns': 'column_names', 'index': 'session_data.index'}), '(data=session_data_reduced, columns=colum...
#!/usr/bin/env python # coding: utf-8 # In[1]: from keras.models import load_model import pandas as pd import numpy as np from PIL import Image,ImageOps import CharacterSegmentation as cs import matplotlib.pyplot as plt from matplotlib.pyplot import figure import os # In[2]: INPUT_IMAGE = './input/input_1.jpg' S...
[ "keras.models.load_model", "os.remove", "numpy.argmax", "pandas.read_csv", "CharacterSegmentation.image_segmentation", "os.walk", "numpy.ones", "matplotlib.pyplot.figure", "cv2.erode", "matplotlib.pyplot.imshow", "cv2.imwrite", "os.path.exists", "PIL.ImageOps.invert", "matplotlib.pyplot.su...
[((548, 571), 'PIL.Image.open', 'Image.open', (['INPUT_IMAGE'], {}), '(INPUT_IMAGE)\n', (558, 571), False, 'from PIL import Image, ImageOps\n'), ((572, 587), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (582, 587), True, 'import matplotlib.pyplot as plt\n'), ((601, 635), 'CharacterSegmentation.im...
import os import numpy as np import time import tensorflow as tf import dcgan from utils import save_checkpoint, load_checkpoint from config_device import config_device def train_dcgan(data, config): training_graph = tf.Graph() with training_graph.as_default(): tf.set_random_seed(1) gan = d...
[ "utils.save_checkpoint", "numpy.average", "tensorflow.global_variables_initializer", "tensorflow.reset_default_graph", "numpy.std", "tensorflow.Session", "dcgan.dcgan", "tensorflow.set_random_seed", "time.time", "utils.load_checkpoint", "tensorflow.summary.FileWriter", "config_device.config_de...
[((223, 233), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (231, 233), True, 'import tensorflow as tf\n'), ((3262, 3286), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (3284, 3286), True, 'import tensorflow as tf\n'), ((282, 303), 'tensorflow.set_random_seed', 'tf.set_random_seed', ...
import pandas as pd import importlib import seaborn as sns import re import praw from matplotlib import pyplot as plt import numpy as np import pickle import sys import os #os.chdir("HelperFunctions") from ChangePointAnalysis import BayesianMethods, Preprocess, PopularWords #os.chdir("../") def compute_changepoin...
[ "pandas.DataFrame", "ChangePointAnalysis.BayesianMethods.bayesian_optional_change_point", "pickle.dump", "os.makedirs", "matplotlib.pyplot.ylim", "os.getcwd", "os.path.isdir", "numpy.std", "ChangePointAnalysis.PopularWords.popular_words_unioned_each_date", "ChangePointAnalysis.BayesianMethods.beta...
[((446, 457), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (455, 457), False, 'import os\n'), ((523, 569), 'ChangePointAnalysis.Preprocess.load_and_preprocess', 'Preprocess.load_and_preprocess', (['subreddit_path'], {}), '(subreddit_path)\n', (553, 569), False, 'from ChangePointAnalysis import BayesianMethods, Preproces...
import h5py import numpy as np from yaml import safe_load from sys import getsizeof import random from warnings import warn from progressbar import progressbar SKIPPED = 0 # # # # def get_box_lat(around=None, diff_lats=0.23468057366362416, lat_cyclon_min=None, lat_cyclon...
[ "numpy.stack", "h5py.File", "numpy.isclose", "yaml.safe_load", "warnings.warn" ]
[((5452, 5472), 'h5py.File', 'h5py.File', (['data_path'], {}), '(data_path)\n', (5461, 5472), False, 'import h5py\n'), ((6848, 6889), 'h5py.File', 'h5py.File', (["config_var['output_path']", '"""w"""'], {}), "(config_var['output_path'], 'w')\n", (6857, 6889), False, 'import h5py\n'), ((362, 428), 'warnings.warn', 'warn...
import os.path import tensorflow as tf import helper import warnings import time from distutils.version import LooseVersion import project_tests as tests import numpy as np from moviepy.editor import VideoFileClip from moviepy.editor import ImageSequenceClip # Check TensorFlow Version assert LooseVersion(tf.__version...
[ "helper.segment_single_image", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.reshape", "tensorflow.Variable", "project_tests.test_for_kitti_dataset", "project_tests.test_train_nn", "moviepy.editor.ImageSequenceClip", "tensorflow.get_default_graph", "project_tests.test_load_vgg", "moviepy...
[((2091, 2124), 'project_tests.test_load_vgg', 'tests.test_load_vgg', (['load_vgg', 'tf'], {}), '(load_vgg, tf)\n', (2110, 2124), True, 'import project_tests as tests\n'), ((5024, 5049), 'project_tests.test_layers', 'tests.test_layers', (['layers'], {}), '(layers)\n', (5041, 5049), True, 'import project_tests as tests\...
""" Simulation of behavioral experiment. This module tests the previously trained model. The stimuli was selected taking into account hangman entropy in edges (initial and final positions). Summary of behavioral experiment: ================================= Stimuli: 3 types of words (all 7-letter ...
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "pandas.read_csv", "numpy.arange", "myUtils.misc.extend_filename_proc", "os.path.join", "warnings.simplefilter", "myUtils.simulation.Simulation", "os.path.exists", "random.seed", "os.path.basename", "re.match", "scipy.stats.sem", ...
[((1063, 1125), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (1084, 1125), False, 'import warnings\n'), ((1348, 1400), 'os.path.join', 'join', (['SCRIPT_FOLDER', 'os.pardir', 'os.pardir', 'os.pardir'], {})...
from numpy import dot, linalg class PCA: def __init__(self): pass def fit(self, x): sigma = dot(x.T, x) / float(len(x)) u, s, _ = linalg.svd(sigma, full_matrices=0) return u, s def project(self, x, u, k): U_reduce = u[:, :k] return dot(x, U_reduce) de...
[ "numpy.dot", "numpy.linalg.svd" ]
[((165, 199), 'numpy.linalg.svd', 'linalg.svd', (['sigma'], {'full_matrices': '(0)'}), '(sigma, full_matrices=0)\n', (175, 199), False, 'from numpy import dot, linalg\n'), ((296, 312), 'numpy.dot', 'dot', (['x', 'U_reduce'], {}), '(x, U_reduce)\n', (299, 312), False, 'from numpy import dot, linalg\n'), ((389, 407), 'nu...
""" RLU 2020 """ import functools import numpy as np from inspect import getfullargspec import copy #import numba def gaussian_argument_variation(std, n=100): """Function decorator that varies input arguments of a given function stochastically and produces a list of function returns for every stochastic iteration...
[ "numpy.size", "inspect.getfullargspec", "copy.copy", "numpy.random.normal", "functools.wraps" ]
[((676, 696), 'inspect.getfullargspec', 'getfullargspec', (['func'], {}), '(func)\n', (690, 696), False, 'from inspect import getfullargspec\n'), ((706, 727), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (721, 727), False, 'import functools\n'), ((888, 905), 'copy.copy', 'copy.copy', (['kwargs'], {...
import numpy as np class SGD: def __init__(self, lr=0.01): self.lr = lr def update(self, params, grads): for key in params.keys(): params[key] -= self.lr * grads[key] class Momentum: def __init__(self, lr=0.01, momentum=0.9): self.lr = lr self.momentum = momen...
[ "numpy.random.randn", "numpy.zeros_like", "numpy.sqrt" ]
[((509, 527), 'numpy.zeros_like', 'np.zeros_like', (['val'], {}), '(val)\n', (522, 527), True, 'import numpy as np\n'), ((979, 997), 'numpy.zeros_like', 'np.zeros_like', (['val'], {}), '(val)\n', (992, 997), True, 'import numpy as np\n'), ((1534, 1552), 'numpy.zeros_like', 'np.zeros_like', (['val'], {}), '(val)\n', (15...
#!/usr/bin/python ''' (C) <NAME>, February 2015 ''' import argparse import numpy as np from matplotlib import pyplot as plt if __name__ == "__main__": parser = argparse.ArgumentParser(description="A small utility to plot RAW greyscale images") parser.add_argument("input_image_name", help="Name of the raw image ...
[ "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pyplot.get_cmap", "numpy.fromfile", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "argparse.ArgumentTypeError" ]
[((167, 255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A small utility to plot RAW greyscale images"""'}), "(description=\n 'A small utility to plot RAW greyscale images')\n", (190, 255), False, 'import argparse\n'), ((575, 635), 'numpy.fromfile', 'np.fromfile', (["parser_args['...
import torch # import CLIP.clip as clip_orig # OpenAI/CLIP from clip import clip # open_clip repo from clip.model import * # open_clip repo from training.main import convert_models_to_fp32 # open_clip repo import torch.distributed as dist import PIL from PIL import Image, ImageDraw from pathlib import Path import json...
[ "os.mkdir", "PIL.Image.new", "clip.clip._transform", "numpy.random.seed", "argparse.ArgumentParser", "torch.eye", "clip.clip.tokenize", "torch.bmm", "torch.autograd.grad", "matplotlib.pyplot.imsave", "torch.arange", "os.path.join", "clip.clip.load", "cv2.cvtColor", "torch.nn.parallel.Dis...
[((3937, 3948), 'time.time', 'time.time', ([], {}), '()\n', (3946, 3948), False, 'import time\n'), ((4331, 4342), 'time.time', 'time.time', ([], {}), '()\n', (4340, 4342), False, 'import time\n'), ((5726, 5782), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(im_arr.shape[1], 20)', '(255, 255, 255)'], {}), "('RGB', (im_...
import numpy as np def compute_D(mdp, gamma, policy, P_0=None, t_max=None, threshold=1e-6): ''' Computes occupancy measure of a MDP under a given time-constrained policy -- the expected discounted number of times that policy π visits state s in a given number of timesteps. The version w/o d...
[ "numpy.zeros_like", "numpy.ones", "numpy.copy" ]
[((1238, 1256), 'numpy.zeros_like', 'np.zeros_like', (['P_0'], {}), '(P_0)\n', (1251, 1256), True, 'import numpy as np\n'), ((1380, 1392), 'numpy.copy', 'np.copy', (['P_0'], {}), '(P_0)\n', (1387, 1392), True, 'import numpy as np\n'), ((1726, 1736), 'numpy.copy', 'np.copy', (['D'], {}), '(D)\n', (1733, 1736), True, 'im...
import numpy as np from tqdm import tqdm import xlrd from copy import deepcopy valid_schedules = [] all_valid_schedules = [] class_name_to_class_ID = {} class_ID_to_class_name = {} class_names = set() class_name_combos = [] class_ID_combos = [] def get_class_name_ID_dicts(excel_data): global class_name...
[ "copy.deepcopy", "tqdm.tqdm", "numpy.zeros", "numpy.matmul" ]
[((1374, 1409), 'numpy.zeros', 'np.zeros', (['(num_combos, num_classes)'], {}), '((num_combos, num_classes))\n', (1382, 1409), True, 'import numpy as np\n'), ((2376, 2388), 'tqdm.tqdm', 'tqdm', (['x_list'], {}), '(x_list)\n', (2380, 2388), False, 'from tqdm import tqdm\n'), ((3757, 3782), 'copy.deepcopy', 'deepcopy', (...
import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from models.langevin import sample_langevin class EnergyBasedModel(nn.Module): def __init__(self, net, alpha=1, step_size=10, sample_step=60, noise_std=0.005, buffer_size=10000, replay_ratio=0.95, ...
[ "torch.stack", "torch.sqrt", "torch.min", "random.choices", "torch.cat", "torch.randn", "torch.rand", "numpy.random.rand", "torch.no_grad", "models.langevin.sample_langevin" ]
[((2592, 2768), 'models.langevin.sample_langevin', 'sample_langevin', (['x0', 'self', 'step_size', 'sample_step'], {'noise_scale': 'self.noise_std', 'intermediate_samples': 'intermediate', 'clip_x': 'self.clip_x', 'clip_grad': 'self.langevin_clip_grad'}), '(x0, self, step_size, sample_step, noise_scale=self.\n noise...
""" Macrocycle Vertices =================== """ from __future__ import annotations import typing import numpy as np from scipy.spatial.distance import euclidean from ...molecules import BuildingBlock from ..topology_graph import Edge, Vertex class CycleVertex(Vertex): """ Represents a vertex in a macrocy...
[ "numpy.array" ]
[((2607, 2626), 'numpy.array', 'np.array', (['[0, 0, 1]'], {}), '([0, 0, 1])\n', (2615, 2626), True, 'import numpy as np\n'), ((2435, 2476), 'numpy.array', 'np.array', (['[-1 if self._flip else 1, 0, 0]'], {}), '([-1 if self._flip else 1, 0, 0])\n', (2443, 2476), True, 'import numpy as np\n')]
import numpy as np from scipy.ndimage.interpolation import affine_transform import elasticdeform import multiprocessing as mp def patch_extraction(Xb, yb, sizePatches=128, Npatches=1): """ 3D patch extraction """ batch_size, rows, columns, slices, channels = Xb.shape X_patches = np.empty((batc...
[ "numpy.abs", "numpy.random.random_sample", "numpy.empty", "scipy.ndimage.interpolation.affine_transform", "numpy.zeros", "numpy.empty_like", "numpy.sign", "numpy.random.randint", "elasticdeform.deform_random_grid", "numpy.sin", "numpy.cos", "multiprocessing.Pool", "numpy.dot" ]
[((306, 392), 'numpy.empty', 'np.empty', (['(batch_size * Npatches, sizePatches, sizePatches, sizePatches, channels)'], {}), '((batch_size * Npatches, sizePatches, sizePatches, sizePatches,\n channels))\n', (314, 392), True, 'import numpy as np\n'), ((403, 475), 'numpy.empty', 'np.empty', (['(batch_size * Npatches, ...
import numpy as np from scipy.cluster.hierarchy import dendrogram, linkage from sklearn import preprocessing from sklearn.cluster import KMeans from matplotlib import pyplot as plt data = np.load('Data/dji_5yr_20d_log_close_data.npy') data = preprocessing.minmax_scale(data, axis=1) print(data.shape) km = KMeans( n...
[ "numpy.load", "matplotlib.pyplot.show", "sklearn.cluster.KMeans", "matplotlib.pyplot.legend", "sklearn.preprocessing.minmax_scale", "numpy.mean", "matplotlib.pyplot.xlabel" ]
[((189, 235), 'numpy.load', 'np.load', (['"""Data/dji_5yr_20d_log_close_data.npy"""'], {}), "('Data/dji_5yr_20d_log_close_data.npy')\n", (196, 235), True, 'import numpy as np\n'), ((243, 283), 'sklearn.preprocessing.minmax_scale', 'preprocessing.minmax_scale', (['data'], {'axis': '(1)'}), '(data, axis=1)\n', (269, 283)...
import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from sqlalchemy import and_, or_ from os import environ, path from flask import Flask, jsonify from dateutil.rela...
[ "sqlalchemy.func.avg", "numpy.ravel", "flask.Flask", "datetime.date", "sqlalchemy.orm.Session", "datetime.datetime.strptime", "flask.jsonify", "sqlalchemy.func.min", "sqlalchemy.func.count", "sqlalchemy.create_engine", "sqlalchemy.ext.automap.automap_base", "sqlalchemy.func.max" ]
[((345, 360), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'from flask import Flask, jsonify\n'), ((368, 382), 'sqlalchemy.ext.automap.automap_base', 'automap_base', ([], {}), '()\n', (380, 382), False, 'from sqlalchemy.ext.automap import automap_base\n'), ((509, 638), 'sqlalchemy.crea...
import librosa import numpy as np import math def ratio_to_cents(r): return 1200.0 * np.log2(r) def ratio_to_cents_protected(f1, f2): out = np.zeros_like(f1) key = (f1!=0.0) * (f2!=0.0) out[key] = 1200.0 * np.log2(f1[key]/f2[key]) out[f1==0.0] = -np.inf out[f2==0.0] = np.inf out[(f1==0.0) * (f2==0.0)...
[ "numpy.abs", "numpy.nan_to_num", "numpy.ravel", "numpy.clip", "numpy.isnan", "numpy.argsort", "librosa.core.ifgram", "numpy.tile", "numpy.diag", "numpy.atleast_2d", "numpy.zeros_like", "numpy.copy", "math.pow", "numpy.power", "numpy.max", "numpy.log2", "numpy.concatenate", "numpy.m...
[((149, 166), 'numpy.zeros_like', 'np.zeros_like', (['f1'], {}), '(f1)\n', (162, 166), True, 'import numpy as np\n'), ((375, 398), 'numpy.power', 'np.power', (['(2)', '(c / 1200.0)'], {}), '(2, c / 1200.0)\n', (383, 398), True, 'import numpy as np\n'), ((1098, 1190), 'librosa.core.ifgram', 'librosa.core.ifgram', (['y']...
import base64 import io import cv2 import numpy as np from PIL import Image def rawtoPILImg(raw_img): assert raw_img is not None image = Image.open(io.BytesIO(raw_img)) return image def rawtoOCVImg(raw_img): assert raw_img is not None im_arr = np.frombuffer(raw_img, dtype=np.uint8) # im_arr is ...
[ "io.BytesIO", "numpy.frombuffer", "cv2.imwrite", "cv2.imdecode", "base64.b64decode", "cv2.resize" ]
[((268, 306), 'numpy.frombuffer', 'np.frombuffer', (['raw_img'], {'dtype': 'np.uint8'}), '(raw_img, dtype=np.uint8)\n', (281, 306), True, 'import numpy as np\n'), ((350, 394), 'cv2.imdecode', 'cv2.imdecode', (['im_arr'], {'flags': 'cv2.IMREAD_COLOR'}), '(im_arr, flags=cv2.IMREAD_COLOR)\n', (362, 394), False, 'import cv...
import os import math import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from utils import tfwatcher from utils.tf_metric_loss import masked_minimum, masked_maximum, triplet_semihard_loss, npairs_loss, lifted_struct_loss # @tf.custom_gradient # def pseudo_loss(x, grad): # def pseu...
[ "tensorflow.zeros_like", "tensorflow.unique", "tensorflow.sqrt", "tensorflow.contrib.slim.batch_norm", "tensorflow.nn.relu", "tensorflow.logical_and", "tensorflow.stack", "tensorflow.unsorted_segment_sum", "tensorflow.norm", "tensorflow.summary.image", "tensorflow.stop_gradient", "math.sin", ...
[((469, 505), 'tensorflow.reshape', 'tf.reshape', (['x', '[-1, 2, num_features]'], {}), '(x, [-1, 2, num_features])\n', (479, 505), True, 'import tensorflow as tf\n'), ((599, 623), 'tensorflow.where', 'tf.where', (['select', 'x1', 'x2'], {}), '(select, x1, x2)\n', (607, 623), True, 'import tensorflow as tf\n'), ((637, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import argparse import logging # import os import sys import matplotlib.pyplot as plt import numpy as np # from matplotlib import cm # from mud import __version__ as __mud_version__ from scipy.stats import gaussian_kde as kde # A standard kernel density estimator fro...
[ "numpy.random.uniform", "numpy.random.seed", "scipy.stats.uniform.pdf", "logging.basicConfig", "matplotlib.pyplot.annotate", "scipy.stats.norm.rvs", "matplotlib.pyplot.close", "scipy.stats.gaussian_kde", "numpy.zeros", "scipy.stats.norm.pdf", "mud_examples.utils.check_dir", "numpy.mean", "nu...
[((681, 708), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (698, 708), False, 'import logging\n'), ((936, 1041), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'loglevel', 'stream': 'sys.stdout', 'format': 'logformat', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=loglev...
import pandas as pd import numpy as np import os, sys, glob, time, gc import plotly.graph_objs as go from plotly.offline import init_notebook_mode, iplot import torch # calculate M values using a single DD interaction model. def M_list_return(time_table, wL_value, AB_list, n_pulse): AB_list = np.array(AB_list) ...
[ "numpy.load", "numpy.sum", "numpy.abs", "numpy.argmax", "numpy.random.randint", "numpy.arange", "numpy.exp", "numpy.sin", "glob.glob", "numpy.prod", "numpy.full", "numpy.random.randn", "numpy.max", "torch.Tensor", "numpy.random.shuffle", "numpy.stack", "numpy.min", "numpy.cos", "...
[((302, 319), 'numpy.array', 'np.array', (['AB_list'], {}), '(AB_list)\n', (310, 319), True, 'import numpy as np\n'), ((1220, 1248), 'numpy.prod', 'np.prod', (['M_list_temp'], {'axis': '(0)'}), '(M_list_temp, axis=0)\n', (1227, 1248), True, 'import numpy as np\n'), ((1995, 2028), 'numpy.zeros', 'np.zeros', (['(B_num, c...
import unittest as ut from .. import tabular as ta from ....common import RTOL, ATOL, pandas, requires as _requires from ....examples import get_path from ...shapes import Polygon from ....io import geotable as pdio from ... import ops as GIS import numpy as np try: import shapely as shp except ImportError: sh...
[ "pandas.DataFrame", "unittest.skipIf", "numpy.testing.assert_allclose", "numpy.array" ]
[((394, 467), 'unittest.skipIf', 'ut.skipIf', (['(PANDAS_EXTINCT or SHAPELY_EXTINCT)', '"""missing pandas or shapely"""'], {}), "(PANDAS_EXTINCT or SHAPELY_EXTINCT, 'missing pandas or shapely')\n", (403, 467), True, 'import unittest as ut\n'), ((941, 986), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['r...
# -*- coding: utf-8 -*- # Copyright (C) 2015-2018 by <NAME> <<EMAIL>> # All rights reserved. BSD 3-clause License. # This file is part of the SPORCO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. """Utility functions""" from __future__ impor...
[ "numpy.load", "numpy.sum", "numpy.abs", "numpy.empty", "numpy.floor", "numpy.ones", "numpy.linalg.svd", "numpy.frompyfunc", "numpy.mean", "builtins.range", "multiprocessing.cpu_count", "numpy.pad", "numpy.random.randn", "os.getloadavg", "os.path.dirname", "urllib.request.urlopen", "n...
[((2307, 2345), 'collections.namedtuple', 'collections.namedtuple', (['arr[2]', 'arr[1]'], {}), '(arr[2], arr[1])\n', (2329, 2345), False, 'import collections\n'), ((4008, 4022), 'numpy.amax', 'np.amax', (['sz', '(1)'], {}), '(sz, 1)\n', (4015, 4022), True, 'import numpy as np\n'), ((4414, 4426), 'builtins.range', 'ran...
import binpacking import numpy as np from keras.models import load_model, Model class FusionData: def __init__( self, data, keys, input_dim=142, input_index=3, output_dim=1, output_index=3, warning=30, filter_size=128, batch_size=128,...
[ "binpacking.to_constant_bin_number", "keras.models.load_model", "numpy.load", "numpy.zeros" ]
[((665, 678), 'numpy.load', 'np.load', (['keys'], {}), '(keys)\n', (672, 678), True, 'import numpy as np\n'), ((2053, 2115), 'numpy.zeros', 'np.zeros', (['(num_measurements, self.data[self.keys[0]].shape[1])'], {}), '((num_measurements, self.data[self.keys[0]].shape[1]))\n', (2061, 2115), True, 'import numpy as np\n'),...
import indiesolver import numpy as np from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right def evaluate(solution): x = solution["parameters"] m = 5 coll = CollGaussRadau_Right(num_nodes=m, tleft=0.0, tright=1.0) Q = coll.Qmat[1:, 1:] Qd =...
[ "indiesolver.indiesolver", "numpy.linalg.eigvals", "numpy.array", "numpy.eye", "pySDC.implementations.collocation_classes.gauss_radau_right.CollGaussRadau_Right" ]
[((2825, 2850), 'indiesolver.indiesolver', 'indiesolver.indiesolver', ([], {}), '()\n', (2848, 2850), False, 'import indiesolver\n'), ((225, 281), 'pySDC.implementations.collocation_classes.gauss_radau_right.CollGaussRadau_Right', 'CollGaussRadau_Right', ([], {'num_nodes': 'm', 'tleft': '(0.0)', 'tright': '(1.0)'}), '(...
from __future__ import division import numpy as np from itertools import combinations_with_replacement from .core import Data, Summary, Propensity, PropensitySelect, Strata from .estimators import OLS, Blocking, Weighting, Matching, Estimators class CausalModel(object): """ Class that provides the main tools of C...
[ "numpy.log", "numpy.percentile", "numpy.sort", "numpy.max", "numpy.cumsum", "numpy.array", "numpy.linalg.inv", "numpy.linspace", "numpy.cov", "numpy.sqrt" ]
[((9840, 9880), 'numpy.array', 'np.array', (['[deduped_values[x] for x in g]'], {}), '([deduped_values[x] for x in g])\n', (9848, 9880), True, 'import numpy as np\n'), ((6452, 6481), 'numpy.log', 'np.log', (['(pscore / (1 - pscore))'], {}), '(pscore / (1 - pscore))\n', (6458, 6481), True, 'import numpy as np\n'), ((996...
import numpy as np from numba import njit, objmode, types from numba.typed import List from numba.pycc import CC cc = CC('algoxtoolsp') cc.verbose = True @cc.export('annex_row', 'void( i2[:,:,:], i2, i2[:] )') @njit( 'void( i2[:,:,:], i2, i2[:] )') def annex_row( array, cur_row, col_list ): L, R, U, D, LINKED, VA...
[ "numba.pycc.CC", "numba.njit", "numpy.zeros", "numpy.iinfo", "numpy.arange", "numpy.array", "numba.typed.List" ]
[((119, 136), 'numba.pycc.CC', 'CC', (['"""algoxtoolsp"""'], {}), "('algoxtoolsp')\n", (121, 136), False, 'from numba.pycc import CC\n'), ((213, 249), 'numba.njit', 'njit', (['"""void( i2[:,:,:], i2, i2[:] )"""'], {}), "('void( i2[:,:,:], i2, i2[:] )')\n", (217, 249), False, 'from numba import njit, objmode, types\n'),...
import cv2 import numpy as np from typing import List, Tuple, Union from statistics import mode, median, mean import io import uuid from collections import deque from minio.error import ResponseError from minio_setup import minio_client, bucket_name class ImagePreprocessingService: min_height_to_width_ratio: int...
[ "cv2.GaussianBlur", "cv2.imdecode", "numpy.ones", "cv2.rectangle", "cv2.imencode", "collections.deque", "numpy.zeros_like", "cv2.filter2D", "cv2.cvtColor", "cv2.imwrite", "cv2.copyMakeBorder", "cv2.hconcat", "statistics.mode", "cv2.drawContours", "cv2.boundingRect", "cv2.resize", "io...
[((726, 794), 'cv2.drawContours', 'cv2.drawContours', (['img_contours_roi', 'contours', '(-1)', 'cls.green_color', '(3)'], {}), '(img_contours_roi, contours, -1, cls.green_color, 3)\n', (742, 794), False, 'import cv2\n'), ((1080, 1098), 'numpy.zeros_like', 'np.zeros_like', (['roi'], {}), '(roi)\n', (1093, 1098), True, ...
import matplotlib.pyplot as plt import numpy as np x = np.array([1, 2, 3, 4, 5]) y1 = x ** 2 y2 = x ** 3 plt.subplot(1, 2, 1) plt.plot(x, y1, 'r-') plt.legend(['Y = x^2']) plt.subplot(1, 2, 2) plt.plot(x, y2, 'b-') plt.legend(['Y = x^3']) plt.suptitle('contoh grafik fungsi') plt.show()
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.legend", "numpy.array" ]
[((56, 81), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5]'], {}), '([1, 2, 3, 4, 5])\n', (64, 81), True, 'import numpy as np\n'), ((107, 127), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (118, 127), True, 'import matplotlib.pyplot as plt\n'), ((128, 149), 'matplotlib.pyplot.p...
""" Testing for the openmm_wrapper module """ import pytest from janus.mm_wrapper import OpenMMWrapper import simtk.unit as OM_unit import numpy as np import os #ala_water_pdb_file = os.path.join(str('tests/files/test_openmm/ala_water.pdb')) water_pdb_file = os.path.join(str('tests/files/test_openmm/water.pdb')) ala_p...
[ "numpy.array", "numpy.allclose", "janus.mm_wrapper.OpenMMWrapper" ]
[((402, 489), 'janus.mm_wrapper.OpenMMWrapper', 'OpenMMWrapper', ([], {'sys_info': 'water_pdb_file'}), "(sys_info=water_pdb_file, **{'md_ensemble': 'NVT',\n 'return_info': []})\n", (415, 489), False, 'from janus.mm_wrapper import OpenMMWrapper\n'), ((498, 560), 'janus.mm_wrapper.OpenMMWrapper', 'OpenMMWrapper', ([],...
#!/usr/bin/env python """ -------------------------------------------------------- READ_JSON_TCG reads communication game json files originating from the web version of the tcg or tcg kids INPUT Use as: data = read_json_tcg('room001225') where 'roomxxx' is a folder containing the '*.json' files OUTPUT A struct conta...
[ "json.load", "os.stat", "os.path.exists", "re.findall", "glob.glob", "numpy.nanmean" ]
[((2258, 2305), 'glob.glob', 'glob.glob', (["(logfile + os.path.sep + s + '*.json')"], {}), "(logfile + os.path.sep + s + '*.json')\n", (2267, 2305), False, 'import glob\n'), ((2365, 2386), 're.findall', 're.findall', (['"""\\\\d+"""', 'l'], {}), "('\\\\d+', l)\n", (2375, 2386), False, 'import re\n'), ((3669, 3693), 'o...
from pyreeEngine.node import RenderNode, BaseNode, signalInput, signalOutput, execOut, execIn from pyreeEngine.basicObjects import ModelObject, FSQuad from pyreeEngine.engine import PerspectiveCamera, OrthoCamera, HotloadingShader, Camera from pyreeEngine.textures import TextureFromImage, RandomRGBATexture import mat...
[ "pyreeEngine.basicObjects.ModelObject", "numpy.ones", "pyreeEngine.engine.PerspectiveCamera", "pyutil.clk.Clkdiv", "pyutil.filter.PT1", "random.random", "pathlib.Path", "pyreeEngine.basicObjects.FSQuad", "numpy.array", "math.cos", "math.sin", "quaternion.from_euler_angles", "pyreeEngine.node...
[((4125, 4138), 'pyreeEngine.node.execIn', 'execIn', (['"""run"""'], {}), "('run')\n", (4131, 4138), False, 'from pyreeEngine.node import RenderNode, BaseNode, signalInput, signalOutput, execOut, execIn\n'), ((872, 885), 'pyreeEngine.basicObjects.ModelObject', 'ModelObject', ([], {}), '()\n', (883, 885), False, 'from p...
import click import sys import os import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from zipfile import ZipFile def extract_data(path="../data", zip_name="titanic.zip", data_name="train.csv"): """Extract dataset. Parameters: path (str): Path to extra...
[ "os.mkdir", "numpy.save", "zipfile.ZipFile", "pandas.read_csv", "click.option", "os.path.exists", "numpy.isnan", "click.command", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "numpy.nanmean" ]
[((2663, 2807), 'click.command', 'click.command', ([], {'help': '"""Given the titanic zip file (see dataset_folder and zip_name), exctract it, preprocess it and save it as npy file"""'}), "(help=\n 'Given the titanic zip file (see dataset_folder and zip_name), exctract it, preprocess it and save it as npy file'\n ...
# Copyright 2016 Hewlett Packard Enterprise Development LP # # 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 ...
[ "numpy.less_equal", "numpy.minimum", "numpy.maximum", "numpy.abs", "numpy.logical_and", "numpy.arctan2", "numpy.true_divide", "numpy.power", "numpy.greater", "numpy.random.RandomState", "numpy.not_equal", "numpy.equal", "numpy.logical_or", "numpy.less", "numpy.greater_equal" ]
[((1928, 1952), 'numpy.random.RandomState', 'np.random.RandomState', (['(1)'], {}), '(1)\n', (1949, 1952), True, 'import numpy as np\n'), ((2299, 2313), 'numpy.equal', 'np.equal', (['y', '(0)'], {}), '(y, 0)\n', (2307, 2313), True, 'import numpy as np\n'), ((3295, 3309), 'numpy.equal', 'np.equal', (['a', 'b'], {}), '(a...
import numpy as np # ndarry.shape # 这一数组属性返回一个包含数组维度的元组,它也可以用于调整数组大小 # example 1 a = np.array([[1, 2, 3], [4, 5, 6]]) print(a.shape) # example 2 # 调整数组大小 a = np.array([[1, 2, 3], [4, 5, 6]]) a.shape = (6, 1) print(a) # example 3 # Numpy也提供了reshape函数来调整数组大小 a = np.array([[1, 2, 3], [4, 5, 6]]) b = a.reshape(3, 2) pr...
[ "numpy.array", "numpy.arange" ]
[((87, 119), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (95, 119), True, 'import numpy as np\n'), ((161, 193), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (169, 193), True, 'import numpy as np\n'), ((265, 297), 'numpy.array',...
__doc__ = """Iterative medoid clustering. Usage: >>> cluster_iterator = cluster(matrix, labels=contignames) >>> clusters = dict(cluster_iterator) Implements one core function, cluster, along with the helper functions write_clusters and read_clusters. For all functions in this module, a collection of clusters are repr...
[ "math.ceil", "random.Random", "torch.any", "torch.nonzero", "numpy.random.RandomState", "collections.defaultdict", "torch.Tensor", "vamb.vambtools.torch_inplace_maskarray", "collections.deque", "torch.from_numpy" ]
[((869, 1345), 'torch.Tensor', '_torch.Tensor', (['[2.43432053e-11, 9.13472041e-10, 2.66955661e-08, 6.07588285e-07, \n 1.076976e-05, 0.000148671951, 0.00159837411, 0.0133830226, 0.0872682695,\n 0.443184841, 1.75283005, 5.39909665, 12.9517596, 24.1970725, 35.2065327,\n 39.894228, 35.2065327, 24.1970725, 12.9517...
from __future__ import absolute_import, division, unicode_literals import numpy as np import struct from . import _common as common class dist_reader(): @staticmethod def read_matrix(filename): with open(filename, 'rb') as file: # check header file_signature = file.read(len(c...
[ "numpy.dtype", "numpy.zeros", "numpy.triu_indices" ]
[((994, 1016), 'numpy.zeros', 'np.zeros', (['(size, size)'], {}), '((size, size))\n', (1002, 1016), True, 'import numpy as np\n'), ((1036, 1060), 'numpy.triu_indices', 'np.triu_indices', (['size', '(1)'], {}), '(size, 1)\n', (1051, 1060), True, 'import numpy as np\n'), ((858, 876), 'numpy.dtype', 'np.dtype', (['np_dtyp...
"""Old (2018-19) adapted from <NAME>'s code""" from Generator import Generator from DynamicParameter import DynamicParameter import utils_old import numpy as np import os from shutil import copyfile, rmtree from time import time class Optimizer: def __init__(self, recorddir, random_seed=None, thread=None): ...
[ "utils_old.write_images", "os.mkdir", "numpy.sum", "numpy.argmax", "numpy.empty", "numpy.floor", "numpy.ones", "numpy.isnan", "numpy.argsort", "numpy.sin", "numpy.linalg.norm", "numpy.exp", "numpy.diag", "shutil.rmtree", "os.path.join", "utils_old.savez", "numpy.random.randn", "num...
[((4387, 4405), 'numpy.cumsum', 'np.cumsum', (['fitness'], {}), '(fitness)\n', (4396, 4405), True, 'import numpy as np\n'), ((4627, 4668), 'numpy.empty', 'np.empty', (['(new_size, population.shape[1])'], {}), '((new_size, population.shape[1]))\n', (4635, 4668), True, 'import numpy as np\n'), ((432, 456), 'os.path.isdir...
import os import sys import csv import numpy as np # matplotlib import matplotlib.pyplot as plt; plt.rcdefaults() import matplotlib.pyplot as plt def run(path): d = {} for f in os.listdir(path): c_path = os.path.join(path, f) if '.pdf' not in c_path: with open(c_path, 'r') as of:...
[ "csv.reader", "os.path.join", "os.path.basename", "matplotlib.pyplot.subplots", "matplotlib.pyplot.rcdefaults", "numpy.arange", "matplotlib.pyplot.tight_layout", "os.listdir", "matplotlib.pyplot.savefig" ]
[((99, 115), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (113, 115), True, 'import matplotlib.pyplot as plt\n'), ((189, 205), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (199, 205), False, 'import os\n'), ((1075, 1089), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', ...
import yaml import numpy as np import os from tensorflow import keras from spektral.layers import * # Some helper functions def yaml_load(filename: str) -> dict: with open(filename, 'rt') as f: return yaml.load(f, Loader=yaml.CLoader) def yaml_write(filename: str, obj, mode='wt'): with open(filen...
[ "numpy.stack", "yaml.load", "numpy.load", "yaml.dump", "numpy.zeros", "os.path.join", "numpy.random.shuffle" ]
[((215, 248), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.CLoader'}), '(f, Loader=yaml.CLoader)\n', (224, 248), False, 'import yaml\n'), ((345, 362), 'yaml.dump', 'yaml.dump', (['obj', 'f'], {}), '(obj, f)\n', (354, 362), False, 'import yaml\n'), ((2959, 2975), 'numpy.stack', 'np.stack', (['graphs'], {}), '(grap...
#xml reader functions for IRS 990 files. import xml.etree.ElementTree as ET import matplotlib.pyplot as plt import numpy as np import os def read_xml(file): ''' Reads an xml file to ElementTree Inputs: file: xml file Returns: ElementTree object ''' tree = ET.parse(file) ro...
[ "xml.etree.ElementTree.parse", "numpy.quantile", "matplotlib.pyplot.hist", "numpy.array", "os.listdir" ]
[((299, 313), 'xml.etree.ElementTree.parse', 'ET.parse', (['file'], {}), '(file)\n', (307, 313), True, 'import xml.etree.ElementTree as ET\n'), ((4036, 4059), 'os.listdir', 'os.listdir', (['folder_path'], {}), '(folder_path)\n', (4046, 4059), False, 'import os\n'), ((5028, 5044), 'matplotlib.pyplot.hist', 'plt.hist', (...
import sys from matplotlib.animation import FuncAnimation, PillowWriter import matplotlib.pyplot as plt import numpy as np def make_note(i, f, dy=5): X = np.linspace(i, i+1, 100) m1 = 100 + np.random.rand() * 100 m2 = np.random.rand() * 2 * np.pi m3 = np.random.normal(dy, 2) Y = f + (np.sin(X * m...
[ "matplotlib.pyplot.close", "numpy.cumsum", "numpy.sin", "numpy.array", "numpy.arange", "numpy.random.normal", "numpy.linspace", "numpy.random.rand", "numpy.random.randint", "numpy.mean", "matplotlib.pyplot.subplots" ]
[((161, 187), 'numpy.linspace', 'np.linspace', (['i', '(i + 1)', '(100)'], {}), '(i, i + 1, 100)\n', (172, 187), True, 'import numpy as np\n'), ((271, 294), 'numpy.random.normal', 'np.random.normal', (['dy', '(2)'], {}), '(dy, 2)\n', (287, 294), True, 'import numpy as np\n'), ((437, 475), 'matplotlib.pyplot.subplots', ...
# -*- coding: utf-8 -*- """ run 9999: 8 6 [32, 32].int64 [[0 1 0 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1] [1 0 1 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 1 0] [0 0 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 0 0 0 1] [1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 ...
[ "numpy.zeros", "random.shuffle", "numpy.set_printoptions", "random.seed" ]
[((3343, 3396), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '(64 * 65)', 'linewidth': '(200)'}), '(threshold=64 * 65, linewidth=200)\n', (3362, 3396), True, 'import numpy as np\n'), ((9312, 9328), 'random.seed', 'random.seed', (['(114)'], {}), '(114)\n', (9323, 9328), False, 'import random\n'), ...
from warnings import filters import numpy as np import tensorflow as tf from tensorflow.keras.layers import Add, Activation, Input, Conv2D, MaxPool2D, Dense, Dropout, GlobalAveragePooling2D, BatchNormalization from tensorflow.keras.models import load_model, Model from tensorflow.keras.callbacks import ModelCheckpoint f...
[ "tensorflow.keras.layers.Dense", "numpy.argmax", "tensorflow.keras.utils.get_custom_objects", "tensorflow.keras.optimizers.SGD", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.layers.MaxPool2D", "tensorflow.keras.initializers.glorot_uniform", "tensorflow.keras.optimizers.RMSprop", "...
[((582, 620), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (613, 620), True, 'import tensorflow as tf\n'), ((2155, 2317), 'tensorflow.keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', ([], {'filepath': 'f"""{PROJECT_ROOT}/models/{model_fn}"""', 'save...
from datasets import PartDataset import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.optim as optim from kdtree import make_cKDTree import sys num_points = 2048 class KDNet(nn.Module): def __init__(self, k = 16): super(KDNe...
[ "torch.median", "torch.numel", "numpy.log", "torch.autograd.Variable", "torch.load", "torch.nn.Conv1d", "torch.FloatTensor", "torch.nonzero", "torch.squeeze", "torch.index_select", "torch.max", "numpy.array", "torch.arange", "torch.nn.Linear", "datasets.PartDataset" ]
[((4294, 4399), 'datasets.PartDataset', 'PartDataset', ([], {'root': '"""shapenetcore_partanno_segmentation_benchmark_v0"""', 'classification': '(True)', 'train': '(False)'}), "(root='shapenetcore_partanno_segmentation_benchmark_v0',\n classification=True, train=False)\n", (4305, 4399), False, 'from datasets import ...
import os import time import numpy def recall_2at1(score_list, k=1): num_correct = 0 num_total = len(score_list) for scores in score_list: ranking_index = numpy.argsort(-numpy.array(scores[0:2])) # Message at index 0 is always correct next message in our test data if 0 in ranking_in...
[ "numpy.count_nonzero", "numpy.sum", "numpy.log2", "numpy.argsort", "numpy.sort", "numpy.array" ]
[((597, 618), 'numpy.sort', 'numpy.sort', (['scores', '(1)'], {}), '(scores, 1)\n', (607, 618), False, 'import numpy\n'), ((620, 645), 'numpy.argsort', 'numpy.argsort', (['(-scores)', '(1)'], {}), '(-scores, 1)\n', (633, 645), False, 'import numpy\n'), ((739, 759), 'numpy.sum', 'numpy.sum', (['labels[i]'], {}), '(label...
# -*- coding: utf-8 -*- import numpy as np from qupy.operator import X, Y, Z from scipy.sparse import csr_matrix, kron class Hamiltonian: """ Creats Hamiltonian as a sum of pauli terms. $ H = \sum_j coefs[j]*ops[j] $ Args: n_qubit (:class:`int`): Number of qubits. ...
[ "numpy.conj", "scipy.sparse.kron", "numpy.copy", "numpy.linalg.eigh", "scipy.sparse.csr_matrix", "qubit.Qubits" ]
[((3452, 3467), 'numpy.copy', 'np.copy', (['q.data'], {}), '(q.data)\n', (3459, 3467), True, 'import numpy as np\n'), ((4280, 4289), 'qubit.Qubits', 'Qubits', (['(3)'], {}), '(3)\n', (4286, 4289), False, 'from qubit import Qubits\n'), ((4669, 4685), 'numpy.linalg.eigh', 'eigh', (['ham_matrix'], {}), '(ham_matrix)\n', (...
from .. import material from .. import geometry import numpy import shapely from shapely.geometry import Polygon class upstreamWaterPressure: """ Attributes --------------------------------- fx:Horizontal force of upstream pressure fy:Vertical force of upstream pressure xFocus:Cen...
[ "numpy.tan", "shapely.geometry.Polygon" ]
[((2243, 2259), 'shapely.geometry.Polygon', 'Polygon', (['self.uP'], {}), '(self.uP)\n', (2250, 2259), False, 'from shapely.geometry import Polygon\n'), ((2986, 3016), 'numpy.tan', 'numpy.tan', (['(40 / 180 * numpy.pi)'], {}), '(40 / 180 * numpy.pi)\n', (2995, 3016), False, 'import numpy\n')]
import unittest from qlearn import QLearn from action_state import ActionState import numpy as np class QlearnTest(unittest.TestCase): def testStateEquality(self): ai = QLearn([-1, 0, 1]) a1 = ActionState(1.0, 1.0, {'vol60': 1}) a2 = ActionState(1.0, 1.0, {'vol60': 1}) ai.learn(a1,...
[ "qlearn.QLearn", "action_state.ActionState", "numpy.load" ]
[((487, 502), 'qlearn.QLearn', 'QLearn', (['actions'], {}), '(actions)\n', (493, 502), False, 'from qlearn import QLearn\n'), ((552, 576), 'action_state.ActionState', 'ActionState', (['(30)', '(0.9)', '{}'], {}), '(30, 0.9, {})\n', (563, 576), False, 'from action_state import ActionState\n'), ((183, 201), 'qlearn.QLear...
import gym import numpy as np # Init environment env = gym.make("FrozenLake-v0") # you can set it to deterministic with: # env = gym.make("FrozenLake-v0", is_slippery=False) # If you want to try larger maps you can do this using: #random_map = gym.envs.toy_text.frozen_lake.generate_random_map(size=5, p=0.8) #env = gy...
[ "numpy.array", "numpy.asarray", "numpy.zeros", "gym.make" ]
[((56, 81), 'gym.make', 'gym.make', (['"""FrozenLake-v0"""'], {}), "('FrozenLake-v0')\n", (64, 81), False, 'import gym\n'), ((534, 552), 'numpy.zeros', 'np.zeros', (['n_states'], {}), '(n_states)\n', (542, 552), True, 'import numpy as np\n'), ((1513, 1529), 'numpy.array', 'np.array', (['policy'], {}), '(policy)\n', (15...
# -*- coding: utf-8 -*- """ Created on Wed May 6 14:05:46 2020 Content: patially reuse code from ml-sound-classifier-master\..\realtime_predictor.py @author: magicalme """ # import scipy import numpy as np from librosa import feature, power_to_db from pyaudio import paContinue, PyAudio, paInt16 #import pan...
[ "numpy.sum", "tensorflow.keras.layers.Dense", "numpy.empty", "numpy.floor", "numpy.argsort", "librosa.power_to_db", "numpy.random.randint", "tensorflow.keras.layers.MaxPool2D", "librosa.feature.melspectrogram", "collections.deque", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.Ba...
[((894, 921), 'logging.getLogger', 'logging.getLogger', (['"""detect"""'], {}), "('detect')\n", (911, 921), False, 'import logging\n'), ((966, 989), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (987, 989), False, 'import logging\n'), ((3055, 3107), 'numpy.empty', 'np.empty', ([], {'shape': '(1, c...
import numpy as np from decimal import * from matplotlib.patches import Ellipse import matplotlib.transforms as transforms def gaussian_dec(x, m, var): ''' Computes the Gaussian pdf value (Decimal type) at x. x: value at which the pdf is computed (Decimal type) m: mean (Decimal type) var: variance...
[ "numpy.sum", "numpy.log", "numpy.abs", "numpy.ones", "numpy.mean", "numpy.exp", "matplotlib.transforms.Affine2D", "numpy.diag", "matplotlib.patches.Ellipse", "numpy.cov", "numpy.sinh", "numpy.sqrt" ]
[((1844, 1854), 'numpy.log', 'np.log', (['mn'], {}), '(mn)\n', (1850, 1854), True, 'import numpy as np\n'), ((1866, 1888), 'numpy.sum', 'np.sum', (['(m * dx * mnlog)'], {}), '(m * dx * mnlog)\n', (1872, 1888), True, 'import numpy as np\n'), ((7956, 7967), 'numpy.log', 'np.log', (['aux'], {}), '(aux)\n', (7962, 7967), T...
import os import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import dirt import dirt.lighting import dirt.matrices import dirt.projection DATA_PATH = os.path.realpath(os.path.join(__file__, '../../data')) SHAPE_BASIS_PATH = os.path.join(DATA_PATH, "shape_basis.npy") SHAPE_MEAN_PATH = os.path.j...
[ "numpy.load", "tensorflow.gather_nd", "tensorflow.reshape", "tensorflow.matmul", "os.path.join", "tensorflow.abs", "dirt.matrices.perspective_projection", "matplotlib.pyplot.imshow", "tensorflow.cast", "numpy.reshape", "tensorflow.io.read_file", "dirt.lighting.vertex_normals", "matplotlib.py...
[((250, 292), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""shape_basis.npy"""'], {}), "(DATA_PATH, 'shape_basis.npy')\n", (262, 292), False, 'import os\n'), ((311, 352), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""shape_mean.npy"""'], {}), "(DATA_PATH, 'shape_mean.npy')\n", (323, 352), False, 'import os\n'...
####################################################################################################################### # Quantile loss modeling example # This example takes data from dataset presented in [1]. It is a much simpler version of what is done in [2], the # example has o...
[ "matplotlib.pyplot.title", "mbtr.mbtr.MBT", "matplotlib.pyplot.plot", "mbtr.utils.set_figure", "matplotlib.pyplot.close", "numpy.floor", "numpy.squeeze", "numpy.zeros", "numpy.min", "numpy.max", "numpy.arange", "numpy.linspace", "mbtr.utils.load_dataset", "matplotlib.pyplot.ylabel", "mat...
[((1512, 1529), 'mbtr.utils.load_dataset', 'ut.load_dataset', ([], {}), '()\n', (1527, 1529), True, 'import mbtr.utils as ut\n'), ((2142, 2160), 'mbtr.utils.set_figure', 'set_figure', (['(5, 4)'], {}), '((5, 4))\n', (2152, 2160), False, 'from mbtr.utils import set_figure\n'), ((2540, 2556), 'matplotlib.pyplot.close', '...
# # Copyright 2022 NVIDIA Corporation # # 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 w...
[ "cv2.waitKey", "numpy.empty", "numpy.asarray", "PyNvCodec.PyNvDecoder", "torch.divide", "os.path.isdir", "PyNvCodec.PySurfaceConverter", "os.add_dll_directory", "torchvision.models.detection.ssd300_vgg16", "torchvision.transforms.Normalize", "cv2.imshow", "torch.no_grad", "PyNvCodec.Colorspa...
[((2765, 2819), 'numpy.empty', 'np.empty', (['(img_r.shape[0], img_r.shape[1], 3)', '"""uint8"""'], {}), "((img_r.shape[0], img_r.shape[1], 3), 'uint8')\n", (2773, 2819), True, 'import numpy as np\n'), ((3707, 3765), 'torchvision.models.detection.ssd300_vgg16', 'torchvision.models.detection.ssd300_vgg16', ([], {'pretra...
#!/usr/bin/env python import sys, os import argparse import numpy as np from nmtpytorch.utils.embedding import load_fasttext,load_glove,load_word2vec from nmtpytorch.vocabulary import Vocabulary # main def main(args): vocab = Vocabulary(args.vocab, None) if args.type == 'fastText': embs = load_...
[ "nmtpytorch.utils.embedding.load_fasttext", "numpy.save", "nmtpytorch.vocabulary.Vocabulary", "argparse.ArgumentParser", "nmtpytorch.utils.embedding.load_glove", "nmtpytorch.utils.embedding.load_word2vec" ]
[((234, 262), 'nmtpytorch.vocabulary.Vocabulary', 'Vocabulary', (['args.vocab', 'None'], {}), '(args.vocab, None)\n', (244, 262), False, 'from nmtpytorch.vocabulary import Vocabulary\n'), ((559, 585), 'numpy.save', 'np.save', (['args.output', 'embs'], {}), '(args.output, embs)\n', (566, 585), True, 'import numpy as np\...
import pandas as pd import scipy.sparse as sp import numpy as np import pickle from collections import defaultdict raw_allx = pd.read_csv('ind.game.allx.csv', sep=' ', header=None) allx = sp.csr_matrix(raw_allx.values) raw_tx = pd.read_csv('ind.game.tx.csv', sep=' ', header=None) tx = sp.csr_matrix(raw_tx.values) r...
[ "pickle.dump", "pandas.read_csv", "collections.defaultdict", "scipy.sparse.csr_matrix", "numpy.array" ]
[((128, 182), 'pandas.read_csv', 'pd.read_csv', (['"""ind.game.allx.csv"""'], {'sep': '""" """', 'header': 'None'}), "('ind.game.allx.csv', sep=' ', header=None)\n", (139, 182), True, 'import pandas as pd\n'), ((190, 220), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['raw_allx.values'], {}), '(raw_allx.values)\n', (20...
# * cancer 데이터셋 : 위스콘신 유방암 데이터셋. 유방암 종양의 임상 데이터가 기록된 실제 데이터셋. # 569개의 데이터와 30개의 특성을 가진다. 그중 212개는 악성이고 357개는 양성이다. import scipy as sp import numpy as np import matplotlib.pyplot as plt import pandas as pd import mglearn from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() print("ca...
[ "sklearn.datasets.load_breast_cancer", "numpy.bincount" ]
[((289, 309), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (307, 309), False, 'from sklearn.datasets import load_breast_cancer\n'), ((490, 516), 'numpy.bincount', 'np.bincount', (['cancer.target'], {}), '(cancer.target)\n', (501, 516), True, 'import numpy as np\n')]
import librosa import librosa.display import numpy as np import speech_recognition as sr r = sr.Recognizer() mic = sr.Microphone() import datetime import os import Database as db import Compression as cp import Recorder as rec import CompareAlgorithms as ca start = datetime.datetime.now() def findmostaccurate(test,...
[ "numpy.abs", "CompareAlgorithms.comparealgorithhm", "librosa.stft", "speech_recognition.Microphone", "Recorder.Record", "librosa.resample", "librosa.load", "numpy.loadtxt", "CompareAlgorithms.textcomparealgorithhmv2", "numpy.array", "Compression.hashsupercompression", "datetime.datetime.now", ...
[((94, 109), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (107, 109), True, 'import speech_recognition as sr\n'), ((116, 131), 'speech_recognition.Microphone', 'sr.Microphone', ([], {}), '()\n', (129, 131), True, 'import speech_recognition as sr\n'), ((268, 291), 'datetime.datetime.now', 'datetim...
import numpy as np def MatMul(A,B): ''' A function for matrix multiplication ''' if (A.shape[1]!=B.shape[0]): return "Matrix Multiplication not possible due to shape mismatch" shape_A = A.shape[0] shape_B = B.shape[1] result = np.zeros(shape = (shape_A,shape_B),dtype = int) for i in range(shape_A): ...
[ "numpy.zeros", "numpy.array" ]
[((722, 749), 'numpy.array', 'np.array', (['[[5, -1], [6, 7]]'], {}), '([[5, -1], [6, 7]])\n', (730, 749), True, 'import numpy as np\n'), ((751, 777), 'numpy.array', 'np.array', (['[[2, 1], [3, 4]]'], {}), '([[2, 1], [3, 4]])\n', (759, 777), True, 'import numpy as np\n'), ((245, 290), 'numpy.zeros', 'np.zeros', ([], {'...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import load_iris class Perceptron: def __init__(self): self.W = None self.b = None def _init_params(self, dim): self.W = np.random.randn(dim) self.b = 0 def linear(self, x): ...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "matplotlib.pyplot.show", "numpy.ones_like", "numpy.random.randn", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.array", "matplotlib.pyplot.contourf", "numpy.arange", "numpy.dot", "matplotlib.pyplot.ylabel", "matplotlib.pypl...
[((1301, 1312), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (1310, 1312), False, 'from sklearn.datasets import load_iris\n'), ((1322, 1373), 'pandas.DataFrame', 'pd.DataFrame', (['iris.data'], {'columns': 'iris.feature_names'}), '(iris.data, columns=iris.feature_names)\n', (1334, 1373), True, 'import p...
import pandas as pd import matplotlib.pyplot as plt from numpy.core.fromnumeric import shape import numpy as np from astropy.table import Table from scipy.interpolate import interp1d import os import sys sys.path.insert(1, '/home/astrolab/pycmpfit/build/lib.linux-x86_64-3.6') import pycmpfit # from kapteyn import kmpfi...
[ "numpy.sum", "numpy.isnan", "numpy.argmin", "pycmpfit.MpPar", "numpy.arange", "matplotlib.pyplot.gca", "scipy.interpolate.interp1d", "os.path.join", "os.path.dirname", "numpy.transpose", "numpy.insert", "matplotlib.pyplot.errorbar", "matplotlib.pyplot.show", "pycmpfit.Mpfit", "matplotlib...
[((204, 276), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""/home/astrolab/pycmpfit/build/lib.linux-x86_64-3.6"""'], {}), "(1, '/home/astrolab/pycmpfit/build/lib.linux-x86_64-3.6')\n", (219, 276), False, 'import sys\n'), ((333, 358), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (348, 3...
import os import sys import torch import random import logging import numpy as np def setup_seed(seed=20211117): # there are still other seed to set, NASBenchDataset random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) ...
[ "os.remove", "numpy.random.seed", "logging.FileHandler", "torch.manual_seed", "logging.StreamHandler", "torch.cuda.manual_seed", "os.path.exists", "logging.Formatter", "torch.cuda.manual_seed_all", "random.seed", "logging.getLogger" ]
[((176, 193), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (187, 193), False, 'import random\n'), ((198, 218), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (212, 218), True, 'import numpy as np\n'), ((223, 246), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (24...
import numpy as np def train_test_splice(X, y, test_ratio=0.2, seed = None): """将数据 X 和 y 按照 test_ratio 分割成 X_train, y_train, X_test, y_test""" assert X.shape[0] == y.shape[0], \ "the size of X must be equal to the size of y" assert 0.0 <= test_ratio <= 1.0, \ "test_ratio must be valid" ...
[ "numpy.random.seed" ]
[((338, 358), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (352, 358), True, 'import numpy as np\n')]
from Clean_Json import clean_json from Find_Best_Hyperparameters import get_best_lr import numpy as np from Pycox import evaluate_model from Train_models import train_MTL_model from Make_h5_trained_models.py import Extract_Image_Features import warnings import pandas import os from extract_variables import extract_vari...
[ "Clean_Json.clean_json", "pandas.DataFrame", "pandas.DataFrame.from_dict", "pandas.read_csv", "os.getcwd", "Make_h5_trained_models.py.Extract_Image_Features", "Train_models.train_MTL_model", "numpy.arange", "Pycox.evaluate_model", "pandas.concat", "Find_Best_Hyperparameters.get_best_lr", "extr...
[((327, 346), 'extract_variables.extract_variables', 'extract_variables', ([], {}), '()\n', (344, 346), False, 'from extract_variables import extract_variables\n'), ((347, 359), 'Clean_Json.clean_json', 'clean_json', ([], {}), '()\n', (357, 359), False, 'from Clean_Json import clean_json\n'), ((755, 773), 'pandas.DataF...
from math import cos import matplotlib.pyplot as plt import numpy as np from src.eig_problem.FFTfromFile1D import FFTfromFile1D from src.eig_problem.WektorySieciOdwrotnej import WektorySieciOdwrotnej # FIXME: Move from ParametryMaterialowe to nwe concept of reading data class StaticDemagnetizingField1D: def __i...
[ "numpy.absolute", "matplotlib.pyplot.show", "src.eig_problem.WektorySieciOdwrotnej.WektorySieciOdwrotnej", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.transpose", "math.cos", "numpy.linspace", "numpy.exp", "src.eig_problem.FFTfromFile1D.FFTfromFile1D", "numpy.loadtxt", "matplotlib.pyplot.s...
[((376, 400), 'src.eig_problem.FFTfromFile1D.FFTfromFile1D', 'FFTfromFile1D', (['input_fft'], {}), '(input_fft)\n', (389, 400), False, 'from src.eig_problem.FFTfromFile1D import FFTfromFile1D\n'), ((953, 998), 'numpy.linspace', 'np.linspace', (['(-ParametryMaterialowe.a)', '(0)', 'grid'], {}), '(-ParametryMaterialowe.a...
from styx_msgs.msg import TrafficLight import cv2 import numpy as np import tensorflow as tf import rospy import os import yaml img_path = os.path.dirname(os.path.realpath(__file__)) + '/../../../../test_images/simulator/' m_wdt = 300 m_hgt = 300 r_image = False class TLClassifier(object): def __init__(self): ...
[ "yaml.load", "cv2.cvtColor", "os.path.realpath", "tensorflow.Session", "numpy.expand_dims", "rospy.get_param", "tensorflow.ConfigProto", "rospy.logdebug", "tensorflow.gfile.GFile", "tensorflow.Graph", "numpy.squeeze", "tensorflow.import_graph_def", "tensorflow.GraphDef", "os.path.join", ...
[((156, 182), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (172, 182), False, 'import os\n'), ((619, 659), 'rospy.get_param', 'rospy.get_param', (['"""/traffic_light_config"""'], {}), "('/traffic_light_config')\n", (634, 659), False, 'import rospy\n'), ((682, 706), 'yaml.load', 'yaml.load...
# coding=utf-8 # Copyright 2021 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...
[ "absl.testing.absltest.main", "os.remove", "tempfile.mkstemp", "numpy.zeros", "numpy.ones", "absl.testing.parameterized.parameters", "experiment.run_regression_experiment", "numpy.savez", "experiment.run_design_experiment" ]
[((1415, 1456), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['"""cnn"""', '"""linear"""'], {}), "('cnn', 'linear')\n", (1439, 1456), False, 'from absl.testing import parameterized\n'), ((2809, 2856), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["('cnn',)", "('linear',...
#!/usr/bin/env python from setuptools import setup import numpy as np numpy_include_dir = np.get_include() # Setup script written by <NAME> # Modified by <NAME> setup( name = 'prosci', version = '1.0', description = "FREAD: fragment-based loop modelling method", author='<NAME>', ...
[ "numpy.get_include", "setuptools.setup" ]
[((92, 108), 'numpy.get_include', 'np.get_include', ([], {}), '()\n', (106, 108), True, 'import numpy as np\n'), ((165, 842), 'setuptools.setup', 'setup', ([], {'name': '"""prosci"""', 'version': '"""1.0"""', 'description': '"""FREAD: fragment-based loop modelling method"""', 'author': '"""<NAME>"""', 'author_email': '...
import numpy import torch import util class SequenceLoader(object): def __init__(self, data, batch_begin, n_steps): self.data = data self.batch_begin = batch_begin self.n_steps = n_steps def __iter__(self): self.t = 0 return self def __next__(self): if ...
[ "util.transpose_vision", "numpy.unravel_index", "numpy.sort", "numpy.arange", "numpy.random.permutation", "torch.from_numpy" ]
[((3038, 3061), 'numpy.sort', 'numpy.sort', (['batch_index'], {}), '(batch_index)\n', (3048, 3061), False, 'import numpy\n'), ((5046, 5069), 'numpy.sort', 'numpy.sort', (['batch_index'], {}), '(batch_index)\n', (5056, 5069), False, 'import numpy\n'), ((5126, 5189), 'numpy.unravel_index', 'numpy.unravel_index', (['batch...
from dataclasses import dataclass from typing import List import numpy as np import pint from pandas.api.types import is_datetime64_any_dtype as is_datetime from pandas.api.types import is_timedelta64_dtype as is_timedelta from weldx.asdf.types import WeldxType from weldx.constants import WELDX_QUANTITY as Q_ @data...
[ "pandas.api.types.is_datetime64_any_dtype", "numpy.dtype", "pandas.api.types.is_timedelta64_dtype" ]
[((4432, 4455), 'numpy.dtype', 'np.dtype', (["tree['dtype']"], {}), "(tree['dtype'])\n", (4440, 4455), True, 'import numpy as np\n'), ((2707, 2730), 'pandas.api.types.is_datetime64_any_dtype', 'is_datetime', (['data.dtype'], {}), '(data.dtype)\n', (2718, 2730), True, 'from pandas.api.types import is_datetime64_any_dtyp...
# coding=utf-8 import io import sys import requests from bs4 import BeautifulSoup import numpy as np import pandas as pd sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030') # 改变标准输出的默认编码, 防止控制台打印乱码 url = "https://www.checkee.info/main.php?dispdate=2019-06" def get_soup(url): try:...
[ "pandas.DataFrame", "io.TextIOWrapper", "numpy.array", "requests.get", "numpy.ndarray.tolist", "bs4.BeautifulSoup" ]
[((143, 198), 'io.TextIOWrapper', 'io.TextIOWrapper', (['sys.stdout.buffer'], {'encoding': '"""gb18030"""'}), "(sys.stdout.buffer, encoding='gb18030')\n", (159, 198), False, 'import io\n'), ((682, 740), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['date', 'tq', 'temp', 'wind']"}), "(data, columns=['date...
# -*- coding: utf-8 -*- """ Created on Sun Feb 2 11:50:01 2020 @author: Sander """ import numpy as np import matplotlib.pyplot as plt def function(num, complex_number): return num ** 2 + complex_number def iterate(num, iterations): value = num for i in range(iterations): value = function(value, ...
[ "numpy.empty", "numpy.abs", "numpy.linspace", "matplotlib.pyplot.imshow" ]
[((424, 474), 'numpy.empty', 'np.empty', (['(resolution, resolution)'], {'dtype': 'np.uint8'}), '((resolution, resolution), dtype=np.uint8)\n', (432, 474), True, 'import numpy as np\n'), ((1048, 1086), 'matplotlib.pyplot.imshow', 'plt.imshow', (['(bin_map * 255)'], {'cmap': '"""gray"""'}), "(bin_map * 255, cmap='gray')...
# -*- coding: utf-8 -*- """ Created on Fri Feb 15 19:37:48 2019 @author: <NAME> <EMAIL> """ import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.decomposition import KernelPCA # ============================================================...
[ "matplotlib.pyplot.title", "numpy.random.seed", "numpy.abs", "matplotlib.pyplot.clf", "sklearn.datasets.load_diabetes", "sklearn.tree.DecisionTreeClassifier", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.arange", "sklearn.neural_network.MLPClassifier", "sklearn.svm.SVC", "sklearn...
[((613, 628), 'sklearn.datasets.load_diabetes', 'load_diabetes', ([], {}), '()\n', (626, 628), False, 'from sklearn.datasets import load_diabetes\n'), ((895, 913), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (911, 913), False, 'from sklearn.linear_model import LinearRegression\n'), ((...
import sys if sys.hexversion < 0x3000000: raise RuntimeError("expecting python v3+ instead of %x" % sys.hexversion) import array import numpy as np import time # ---------------------------------------------------------------------------- ''' this is an almost one-for-one translation of the Julia version, see kn...
[ "numpy.uint64", "time.time_ns" ]
[((2054, 2067), 'numpy.uint64', 'np.uint64', (['(13)'], {}), '(13)\n', (2063, 2067), True, 'import numpy as np\n'), ((2074, 2086), 'numpy.uint64', 'np.uint64', (['(7)'], {}), '(7)\n', (2083, 2086), True, 'import numpy as np\n'), ((2093, 2106), 'numpy.uint64', 'np.uint64', (['(17)'], {}), '(17)\n', (2102, 2106), True, '...
"""The Nyles main class.""" import sys import numpy as np import pickle import model_les import model_advection as model_adv import variables import grid import nylesIO import plotting import timing import topology as topo import mpitools from time import time class Nyles(object): """ Attributes : ...
[ "pickle.dump", "model_advection.Advection", "timing.write_timings", "mpitools.global_max", "grid.Grid", "parameters.UserParameters", "mpitools.get_myrank", "topology.rank2loc", "nylesIO.NylesIO", "time.time", "timing.analyze_timing", "mpitools.barrier", "mpitools.global_sum", "numpy.max", ...
[((9685, 9701), 'parameters.UserParameters', 'UserParameters', ([], {}), '()\n', (9699, 9701), False, 'from parameters import UserParameters\n'), ((1409, 1435), 'mpitools.get_myrank', 'mpitools.get_myrank', (['procs'], {}), '(procs)\n', (1428, 1435), False, 'import mpitools\n'), ((1450, 1478), 'topology.rank2loc', 'top...
""" Phase plane plot function """ import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm __all__ = [ 'phase_plane' ] def phase_plane(odeobject, initial_conditions, display_window, nvectors=[20, 20], calculation_window=None, solution_direction='both', ...
[ "numpy.meshgrid", "numpy.zeros_like", "numpy.hypot", "numpy.max", "numpy.mean", "numpy.array", "numpy.reshape", "numpy.linspace", "numpy.min", "numpy.logical_or", "matplotlib.pyplot.subplots", "numpy.concatenate" ]
[((2724, 2786), 'numpy.linspace', 'np.linspace', (['display_window[0]', 'display_window[1]', 'nvectors[0]'], {}), '(display_window[0], display_window[1], nvectors[0])\n', (2735, 2786), True, 'import numpy as np\n'), ((2795, 2857), 'numpy.linspace', 'np.linspace', (['display_window[2]', 'display_window[3]', 'nvectors[1]...
#!/usr/bin/env python3 # Author: <NAME> (<EMAIL>) # License: BSD-3-Clause import os import numpy as np import astropy.units as u import matplotlib.pyplot as plt import matplotlib import pandas as pd from astropy import units as u from astropy.cosmology import Planck15 as cosmo from astropy import constants as const fr...
[ "matplotlib.pyplot.yscale", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.tight_layout", "os.path.join", "pandas.DataFrame", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "scipy.interpolate.UnivariateSpline", "os.path.exists", "numpy.max", "matplotlib.pyplot.legend"...
[((697, 735), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (['nice_fonts'], {}), '(nice_fonts)\n', (723, 735), False, 'import matplotlib\n'), ((1121, 1161), 'os.path.join', 'os.path.join', (['"""plots"""', '"""global"""', 'fittype'], {}), "('plots', 'global', fittype)\n", (1133, 1161), False, 'import os\...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "numpy.zeros", "math.sqrt" ]
[((1204, 1267), 'numpy.zeros', 'np.zeros', (['(self.gate_hidden_size, input_size)'], {'dtype': 'np.float32'}), '((self.gate_hidden_size, input_size), dtype=np.float32)\n', (1212, 1267), True, 'import numpy as np\n'), ((1326, 1390), 'numpy.zeros', 'np.zeros', (['(self.gate_hidden_size, hidden_size)'], {'dtype': 'np.floa...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np x = np.array([1, 2, 3, 4]) print(np.sum(x)) print(x.sum()) x = np.array([[1, 1], [2, 2]]) print(x) # columns (first dimension) print(x.sum(axis=0)) print(x[:, 0].sum(), x[:, 1].sum()) # rows (second dimension) print(x.sum(axis=1)) print(x[0, :].sum(),...
[ "numpy.sum", "numpy.median", "numpy.zeros", "numpy.any", "numpy.array", "numpy.random.rand", "numpy.all" ]
[((71, 93), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (79, 93), True, 'import numpy as np\n'), ((130, 156), 'numpy.array', 'np.array', (['[[1, 1], [2, 2]]'], {}), '([[1, 1], [2, 2]])\n', (138, 156), True, 'import numpy as np\n'), ((340, 363), 'numpy.random.rand', 'np.random.rand', (['(2)', ...
import numpy as np import matplotlib.pyplot as plt import pandas as pd t = np.linspace(0,39.98,num=2000) u = pd.read_excel('deslocamentos_artificial.xlsx').to_numpy() def plot_graph(u,t,no): """u = matrix of displacements, accelerations or velocitys no = number of node""" plt.figure(1,figs...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_excel", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((80, 111), 'numpy.linspace', 'np.linspace', (['(0)', '(39.98)'], {'num': '(2000)'}), '(0, 39.98, num=2000)\n', (91, 111), True, 'import numpy as np\n'), ((303, 333), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(12, 4)'}), '(1, figsize=(12, 4))\n', (313, 333), True, 'import matplotlib.pyplot as pl...
""" Input is group of motion corrected micrographs. Output is group of equalized images. """ import sys import mrcfile import cv2 import numpy as np import os from multiprocessing import Pool from icebreaker import filter_designer as fd from icebreaker import window_mean as wm from icebreaker import local_mask as lm ...
[ "cv2.resize", "cv2.GaussianBlur", "os.mkdir", "icebreaker.local_mask.local_mask", "numpy.unique", "numpy.zeros", "mrcfile.open", "icebreaker.window_mean.window", "icebreaker.KNN_segmenter.segmenter", "multiprocessing.Pool", "icebreaker.filter_designer.filtering", "os.path.split", "os.path.jo...
[((649, 677), 'os.path.split', 'os.path.split', (['filelist_full'], {}), '(filelist_full)\n', (662, 677), False, 'import os\n'), ((1389, 1425), 'icebreaker.filter_designer.lowpass', 'fd.lowpass', (['img', '(0.85)', '(20)', '"""cos"""', '(50)'], {}), "(img, 0.85, 20, 'cos', 50)\n", (1399, 1425), True, 'from icebreaker i...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 18 21:08:18 2021 @author: rick """ import os from glob import glob import numpy as np import subprocess, collections from obspy.geodetics import gps2dist_azimuth ev_info = collections.namedtuple('ev_info','st stack_p lon lat dep') BP_path = './out...
[ "os.path.abspath", "os.stat", "os.path.basename", "obspy.geodetics.gps2dist_azimuth", "subprocess.call", "collections.namedtuple", "os.path.join", "numpy.sqrt" ]
[((244, 303), 'collections.namedtuple', 'collections.namedtuple', (['"""ev_info"""', '"""st stack_p lon lat dep"""'], {}), "('ev_info', 'st stack_p lon lat dep')\n", (266, 303), False, 'import subprocess, collections\n'), ((540, 576), 'os.path.join', 'os.path.join', (['BP_path', '"""????.???.??"""'], {}), "(BP_path, '?...
""" Additional transformations """ import warnings import numpy as np from dimarray.core import Axes, Axis # # INTERPOLATION # def interp1d_numpy(obj, values, axis=0, **kwargs): """ interpolate along one axis: wrapper around numpy's interp Parameters ---------- obj : DimArray values : 1d array, ...
[ "numpy.meshgrid", "numpy.array", "scipy.interpolate.RegularGridInterpolator", "warnings.warn", "dimarray.core.Axis" ]
[((4227, 4244), 'dimarray.core.Axis', 'Axis', (['xi', 'x0.name'], {}), '(xi, x0.name)\n', (4231, 4244), False, 'from dimarray.core import Axes, Axis\n'), ((4272, 4289), 'dimarray.core.Axis', 'Axis', (['yi', 'y0.name'], {}), '(yi, y0.name)\n', (4276, 4289), False, 'from dimarray.core import Axes, Axis\n'), ((4530, 4578)...
import numpy as np import os import time from estimator import * import matplotlib matplotlib.use('TKAgg') matplotlib.rcParams['text.usetex'] = True matplotlib.rcParams['font.family'] = 'serif' matplotlib.rcParams['font.serif'] = 'Computer Modern' import matplotlib.pyplot as plt LAMBDAS = [0, 1/512, 1/256, 1/128, 1/...
[ "matplotlib.pyplot.yscale", "numpy.sum", "numpy.random.seed", "numpy.argmin", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.random.normal", "numpy.full", "numpy.std", "os.path.exists", "numpy.max", "numpy.reshape", "time.localtime", "numpy.median", "numpy.square", ...
[((85, 108), 'matplotlib.use', 'matplotlib.use', (['"""TKAgg"""'], {}), "('TKAgg')\n", (99, 108), False, 'import matplotlib\n'), ((1868, 1891), 'numpy.array', 'np.array', (['ns'], {'dtype': 'int'}), '(ns, dtype=int)\n', (1876, 1891), True, 'import numpy as np\n'), ((1942, 1966), 'numpy.zeros', 'np.zeros', (['(d, N, rep...
import os import numpy as np import torch import torch.nn as nn from torch import Tensor import librosa from torch.utils.data import Dataset ___author__ = "<NAME>" __email__ = "<EMAIL>" def genSpoof_list( dir_meta,is_train=False,is_eval=False): d_meta = {} file_list=[] with open(dir_meta, 'r') as f...
[ "torch.Tensor", "librosa.load", "numpy.tile" ]
[((1791, 1844), 'librosa.load', 'librosa.load', (["(self.base_dir + key + '.flac')"], {'sr': '(16000)'}), "(self.base_dir + key + '.flac', sr=16000)\n", (1803, 1844), False, 'import librosa\n'), ((1896, 1909), 'torch.Tensor', 'Tensor', (['X_pad'], {}), '(X_pad)\n', (1902, 1909), False, 'from torch import Tensor\n'), ((...