code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. https://assets.leetcode.com/uploads/2019/10/20/hint_transpose.png Example 1: Input: [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,...
[ "numpy.array" ]
[((681, 692), 'numpy.array', 'np.array', (['A'], {}), '(A)\n', (689, 692), True, 'import numpy as np\n')]
import numpy as np import datetime import calendar import matplotlib.mlab matplotlib.use('Agg') from netCDF4 import Dataset import io import collections def time2unix(datestring): try: f = datetime.datetime.strptime(datestring,"%Y%m%d%H%M%S.%f") unix = calendar.timegm(f.timetuple()) except...
[ "collections.deque", "numpy.ones", "datetime.datetime.strptime", "netCDF4.Dataset", "io.open", "numpy.zeros", "numpy.empty" ]
[((9333, 9371), 'netCDF4.Dataset', 'Dataset', (['ncname', '"""w"""'], {'format': '"""NETCDF4"""'}), "(ncname, 'w', format='NETCDF4')\n", (9340, 9371), False, 'from netCDF4 import Dataset\n'), ((12960, 12998), 'netCDF4.Dataset', 'Dataset', (['ncname', '"""w"""'], {'format': '"""NETCDF4"""'}), "(ncname, 'w', format='NETC...
'''My CMA=ES ''' import numpy as np import matplotlib.pyplot as plt mean = [0, 0] cov = [[1, 0], [0, 100]] x, y = np.random.multivariate_normal(mean, cov, 5000).T plt.plot(x, y, 'x') plt.axis('equal') plt.show()
[ "numpy.random.multivariate_normal", "matplotlib.pyplot.axis", "matplotlib.pyplot.plot", "matplotlib.pyplot.show" ]
[((165, 184), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""x"""'], {}), "(x, y, 'x')\n", (173, 184), True, 'import matplotlib.pyplot as plt\n'), ((185, 202), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (193, 202), True, 'import matplotlib.pyplot as plt\n'), ((203, 213), 'matplot...
# -*- coding: utf-8 -*- """ .. invisible: _ _ _____ _ _____ _____ | | | | ___| | | ___/ ___| | | | | |__ | | | |__ \ `--. | | | | __|| | | __| `--. \ \ \_/ / |___| |___| |___/\__/ / \___/\____/\_____|____/\____/ Created on May 19, 2014 Unit test for convolutional layer forwa...
[ "veles.znicz.tests.functional.StandardTest.main", "veles.znicz.gd_conv.GradientDescentConv", "veles.znicz.conv.Conv", "veles.znicz.evaluator.EvaluatorSoftmax", "veles.znicz.normalization.LRNormalizerForward", "veles.znicz.gd.GDSoftmax", "veles.znicz.all2all.All2AllSoftmax", "numpy.greater", "veles.z...
[((33981, 34000), 'veles.znicz.tests.functional.StandardTest.main', 'StandardTest.main', ([], {}), '()\n', (33998, 34000), False, 'from veles.znicz.tests.functional import StandardTest\n'), ((4639, 4686), 'os.path.join', 'os.path.join', (['self.data_dir_path', 'data_filename'], {}), '(self.data_dir_path, data_filename)...
from curses import COLOR_CYAN from os import wait import string from manim import * from manim.utils import tex import numpy as np import math import textwrap import random from solarized import * from tqdm import tqdm # Use our fork of manim_rubikscube! from manim_rubikscube import * # Temne pozadi, ale zakomentovat...
[ "numpy.insert", "random.choice", "random.randint", "random.setstate", "math.sqrt", "random.seed", "random.getstate", "math.cos", "numpy.array", "math.sin", "math.atan" ]
[((387, 401), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (398, 401), False, 'import random\n'), ((1479, 1496), 'random.getstate', 'random.getstate', ([], {}), '()\n', (1494, 1496), False, 'import random\n'), ((3101, 3118), 'random.getstate', 'random.getstate', ([], {}), '()\n', (3116, 3118), False, 'import r...
import os import numpy as np import nilearn as nl import nilearn.plotting from math import floor import numpy as np import torch import torch.utils.data as data from torch import Tensor from typing import Optional def load_scenes(path: str) -> list: with open(path, "r") as f: result = [] for line ...
[ "os.listdir", "math.floor", "nilearn.image.load_img", "os.path.join", "numpy.concatenate", "numpy.transpose" ]
[((1030, 1049), 'math.floor', 'floor', (['num_examples'], {}), '(num_examples)\n', (1035, 1049), False, 'from math import floor\n'), ((3255, 3313), 'os.path.join', 'os.path.join', (['root', '"""stimuli"""', '"""annotations"""', '"""scenes.csv"""'], {}), "(root, 'stimuli', 'annotations', 'scenes.csv')\n", (3267, 3313), ...
# -*- coding: utf-8 -*- import numpy as np import tensorflow as tf import warnings import skimage.segmentation from patchwork._augment import SINGLE_AUG_FUNC SEG_AUG_FUNCTIONS = ["flip_left_right", "flip_up_down", "rot90", "shear", "zoom_scale", "center_zoom_scale"] def _get_segments(img, mean_scale=1000, num_samp...
[ "numpy.sqrt", "tensorflow.reshape", "tensorflow.image.resize", "numpy.random.choice", "tensorflow.reduce_sum", "numpy.stack", "numpy.zeros", "tensorflow.reduce_mean", "numpy.random.uniform", "warnings.warn", "tensorflow.expand_dims", "tensorflow.cast", "numpy.arange" ]
[((1088, 1141), 'numpy.random.uniform', 'np.random.uniform', (['(0.5 * mean_scale)', '(1.5 * mean_scale)'], {}), '(0.5 * mean_scale, 1.5 * mean_scale)\n', (1105, 1141), True, 'import numpy as np\n'), ((1424, 1450), 'numpy.arange', 'np.arange', (['(max_segment + 1)'], {}), '(max_segment + 1)\n', (1433, 1450), True, 'imp...
""" FID evaluation function used by misalignments.py """ import os import shutil import numpy as np import torch from pytorch_fid import fid_score from generate_samples import save_individuals_v2 def fid_eval(generator, real_data, directory, inception_net, noise): ...
[ "os.path.exists", "generate_samples.save_individuals_v2", "numpy.savez", "os.makedirs", "pytorch_fid.fid_score.calculate_frechet_distance", "os.path.join", "pytorch_fid.fid_score.compute_statistics_of_path", "torch.device" ]
[((1798, 1840), 'os.path.join', 'os.path.join', (['directory', '"""samples_for_fid"""'], {}), "(directory, 'samples_for_fid')\n", (1810, 1840), False, 'import os\n'), ((1848, 1881), 'os.path.exists', 'os.path.exists', (['fake_samples_path'], {}), '(fake_samples_path)\n', (1862, 1881), False, 'import os\n'), ((1942, 197...
import numpy as np import matplotlib.pyplot as plt import csv causes = ['OUTRAS', 'COVID', 'INSUFICIENCIA_RESPIRATORIA', 'PNEUMONIA', 'SEPTICEMIA', 'SRAG', 'INDETERMINADA'] for i in range(len(causes)): vars()[causes[i]] = 0 firstRow = 1 with open('obitos-2020.csv', newline='') as csvfile: originalfile = csv...
[ "numpy.array", "csv.reader", "matplotlib.pyplot.rcdefaults", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((1340, 1356), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (1354, 1356), True, 'import matplotlib.pyplot as plt\n'), ((1367, 1381), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1379, 1381), True, 'import matplotlib.pyplot as plt\n'), ((1518, 1528), 'matplotlib.pyplot.show', ...
""" Copyright (C) 2019 <NAME>, ETH Zurich 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, distri...
[ "keras.optimizers.Adam", "keras.initializers.zeros", "numpy.prod", "keras.initializers.he_normal", "keras.layers.Lambda", "keras.regularizers.L1L2", "keras.layers.Input", "keras.optimizers.SGD", "functools.partial", "keras.layers.concatenate", "keras.models.Model", "keras.layers.dot", "keras...
[((4213, 4290), 'keras.models.Model', 'Model', ([], {'inputs': '[input_layer]', 'outputs': '[topmost_hidden_state, auxiliary_output]'}), '(inputs=[input_layer], outputs=[topmost_hidden_state, auxiliary_output])\n', (4218, 4290), False, 'from keras.models import Model\n'), ((15669, 15703), 'keras.layers.concatenate', 'c...
import tensorflow as tf import numpy as np def clip_by_value_with_gradient(x, l=-1., u=1.): clip_up = tf.cast(x > u, tf.float32) clip_low = tf.cast(x < l, tf.float32) # if the difference between x and l or u is smaller than the precision, # the following may cause the result to be 0 or 2*u return x...
[ "tensorflow.nn.conv2d", "tensorflow.shape", "tensorflow.variable_scope", "tensorflow.get_variable", "numpy.sqrt", "tensorflow.placeholder", "tensorflow.nn.rnn_cell.LSTMStateTuple", "tensorflow.add", "tensorflow.nn.rnn_cell.LSTMCell", "tensorflow.truncated_normal_initializer", "tensorflow.nn.dyna...
[((107, 133), 'tensorflow.cast', 'tf.cast', (['(x > u)', 'tf.float32'], {}), '(x > u, tf.float32)\n', (114, 133), True, 'import tensorflow as tf\n'), ((149, 175), 'tensorflow.cast', 'tf.cast', (['(x < l)', 'tf.float32'], {}), '(x < l, tf.float32)\n', (156, 175), True, 'import tensorflow as tf\n'), ((504, 546), 'tensorf...
import string import pandas as pd import numpy as np MODEL_RUN_SCRIPT_PREFIX=''' from System import Array import TIME.DataTypes.TimeStep as TimeStep import TIME.DataTypes.TimeSeries as TimeSeries import System.DateTime as DateTime import ${namespace}.${klass} as ${klass} import TIME.Tools.ModelRunner as ModelRunner mo...
[ "pandas.DataFrame", "numpy.array", "string.Template" ]
[((455, 471), 'numpy.array', 'np.array', (['series'], {}), '(series)\n', (463, 471), True, 'import numpy as np\n'), ((1784, 1824), 'string.Template', 'string.Template', (['MODEL_RUN_SCRIPT_PREFIX'], {}), '(MODEL_RUN_SCRIPT_PREFIX)\n', (1799, 1824), False, 'import string\n'), ((2930, 2961), 'pandas.DataFrame', 'pd.DataF...
# Code for CVPR'21 paper: # [Title] - "CoLA: Weakly-Supervised Temporal Action Localization with Snippet Contrastive Learning" # [Author] - <NAME>*, <NAME>, <NAME>, <NAME> and <NAME> # [Github] - https://github.com/zhang-can/CoLA import numpy as np import os from easydict import EasyDict as edict cfg = edict() cfg....
[ "easydict.EasyDict", "numpy.linspace", "os.path.join", "numpy.arange" ]
[((307, 314), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (312, 314), True, 'from easydict import EasyDict as edict\n'), ((696, 723), 'numpy.arange', 'np.arange', (['(0.0)', '(0.25)', '(0.025)'], {}), '(0.0, 0.25, 0.025)\n', (705, 723), True, 'import numpy as np\n'), ((743, 771), 'numpy.arange', 'np.arange', (['(0....
import io import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import yaml from scipy.optimize import curve_fit from scipy.signal import savgol_filter # if compact printing is required np.set_printoptions(precision=2) def friction_func(xdot, mass, mu, damping): return np.sign(xdot) *...
[ "scipy.optimize.curve_fit", "pandas.read_csv", "numpy.set_printoptions", "matplotlib.pyplot.plot", "scipy.signal.savgol_filter", "io.open", "numpy.diff", "matplotlib.pyplot.figure", "numpy.sign", "matplotlib.pyplot.title", "pandas.Series.str", "matplotlib.pyplot.show" ]
[((216, 248), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (235, 248), True, 'import numpy as np\n'), ((2998, 3051), 'pandas.read_csv', 'pd.read_csv', (["config['low_mass_file_1']"], {'delimiter': '""","""'}), "(config['low_mass_file_1'], delimiter=',')\n", (3009, 3051...
import numpy as np import os, pickle from tqdm import tqdm def get_word_emb(word2coef_dict, word, default_value): return word2coef_dict.get(word, default_value) def get_phrase_emb(word2coef_dict, phrase, default_value): words = phrase.split(' ') embs = [ get_word_emb(word2coef_dict, word, default_value) fo...
[ "numpy.mean", "pickle.dump", "os.path.join", "numpy.asarray", "numpy.zeros" ]
[((349, 370), 'numpy.mean', 'np.mean', (['embs'], {'axis': '(0)'}), '(embs, axis=0)\n', (356, 370), True, 'import numpy as np\n'), ((534, 550), 'numpy.zeros', 'np.zeros', (['(300,)'], {}), '((300,))\n', (542, 550), True, 'import numpy as np\n'), ((999, 1029), 'pickle.dump', 'pickle.dump', (['word2coef_dict', 'f'], {}),...
# -*- coding: utf-8 -*- """ Created on Sat Aug 26 13:29:13 2017 @author: amirs """ # Artificial Neural Network # Installing Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow # Install Tensorflow from the website: https://www.tensorflow.org/versions/r0.12/get_sta...
[ "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.Imputer", "keras.utils.to_categorical", "sklearn.preprocessing.StandardScaler", "keras.models.Sequential", "numpy.concatenate", "keras.layers.Dense", "sklearn.metrics.confusi...
[((554, 622), 'pandas.read_csv', 'pd.read_csv', (['"""features/Table_Step2_159Features-85Subs-5Levels-z.csv"""'], {}), "('features/Table_Step2_159Features-85Subs-5Levels-z.csv')\n", (565, 622), True, 'import pandas as pd\n'), ((709, 763), 'sklearn.preprocessing.Imputer', 'Imputer', ([], {'missing_values': '"""NaN"""', ...
import numpy as np import pandas as pd import cvxopt as opt from cvxopt import solvers #, blas from matplotlib import pyplot as plt plt.style.use('seaborn') np.random.seed(9062020) # Cargar y limpiar datos df = pd.read_csv("stocks.csv", sep=",", engine="python") #���Field 1 la columna tiene caracteres extranios df....
[ "numpy.sqrt", "pandas.read_csv", "matplotlib.pyplot.ylabel", "numpy.log", "numpy.array", "numpy.random.binomial", "numpy.where", "numpy.random.random", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.asarray", "matplotlib.pyplot.style.use", "numpy.random.seed", "matplotlib.pyp...
[((134, 158), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (147, 158), True, 'from matplotlib import pyplot as plt\n'), ((159, 182), 'numpy.random.seed', 'np.random.seed', (['(9062020)'], {}), '(9062020)\n', (173, 182), True, 'import numpy as np\n'), ((215, 266), 'pandas.rea...
# -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["Parameter", "UnitVector", "Model"] import numpy as np import tensorflow as tf def get_param_for_value(value, min_value, max_value): if ((min_value is not None and np.any(value <= min_value)) or (max_value is not Non...
[ "numpy.reshape", "tensorflow.Variable", "tensorflow.reduce_sum", "numpy.size", "numpy.log", "tensorflow.get_default_session", "numpy.any", "tensorflow.gradients", "tensorflow.sqrt", "numpy.empty", "tensorflow.name_scope", "tensorflow.constant", "tensorflow.square", "numpy.shape", "tensor...
[((568, 593), 'numpy.log', 'np.log', (['(value - min_value)'], {}), '(value - min_value)\n', (574, 593), True, 'import numpy as np\n'), ((642, 667), 'numpy.log', 'np.log', (['(max_value - value)'], {}), '(max_value - value)\n', (648, 667), True, 'import numpy as np\n'), ((4993, 5035), 'tensorflow.gradients', 'tf.gradie...
import numpy as np import sys, os, json, argparse, glob, itertools, pickle from typing import List from dataclasses import dataclass import matplotlib.pyplot as plt import matplotlib.cm as cm from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy.interpolate import griddata from scipy.interpolate import I...
[ "numpy.log10", "scipy.interpolate.interp1d", "os.path.exists", "os.listdir", "argparse.ArgumentParser", "matplotlib.pyplot.close", "os.path.isdir", "mpl_toolkits.axes_grid1.make_axes_locatable", "matplotlib.pyplot.gca", "pickle.load", "h5py.File", "os.path.isfile", "matplotlib.pyplot.cm.get_...
[((1018, 1027), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (1025, 1027), True, 'import matplotlib.pyplot as plt\n'), ((1804, 1849), 'numpy.loadtxt', 'np.loadtxt', (['inputf'], {'delimiter': '""","""', 'skiprows': '(1)'}), "(inputf, delimiter=',', skiprows=1)\n", (1814, 1849), True, 'import numpy as np\n'), (...
#!/usr/bin/env python3 # Copyright (c) 2017 <NAME>. All rights reserved # coding=utf-8 # -*- coding: utf8 -*- """ SpectrumClass is a class to store the spectrum information, i.e. the ralation between wavelength and intensity. The constructor of this calss includes two necessities and one option ...
[ "pandas.Series", "Help.myNumericalIntegration.myNumericalIntegration", "os.path.dirname", "numpy.array", "doctest.testmod", "os.path.abspath", "numpy.transpose", "sys.path.append" ]
[((3750, 3779), 'os.path.dirname', 'os.path.dirname', (['MaterialPath'], {}), '(MaterialPath)\n', (3765, 3779), False, 'import os\n'), ((3712, 3737), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (3727, 3737), False, 'import os\n'), ((3814, 3838), 'sys.path.append', 'sys.path.append', (['src...
import numpy as np PI = np.pi DEG = 180./PI INF = np.inf def eig(M, sort_type=1): """ Calculates eigenvalues and eigenvectors of matrix """ if sort_type not in [1,2,3,4]: raise ValueError lam,V = np.linalg.eigh(M) # sorting of eigenvalues # 1: highest to lowest, algebraic: lam1...
[ "numpy.abs", "numpy.arccos", "numpy.sin", "numpy.column_stack", "numpy.linalg.det", "numpy.argsort", "numpy.array", "numpy.dot", "numpy.linspace", "numpy.arctan2", "numpy.cos", "numpy.linalg.norm", "numpy.linalg.eigh" ]
[((229, 246), 'numpy.linalg.eigh', 'np.linalg.eigh', (['M'], {}), '(M)\n', (243, 246), True, 'import numpy as np\n'), ((1293, 1311), 'numpy.cos', 'np.cos', (['(xdeg / DEG)'], {}), '(xdeg / DEG)\n', (1299, 1311), True, 'import numpy as np\n'), ((1323, 1341), 'numpy.sin', 'np.sin', (['(xdeg / DEG)'], {}), '(xdeg / DEG)\n...
import numpy as np from scipy import sparse as sps from src.models.QuantumSLIM.ItemSelectors.ItemSelectorInterface import ItemSelectorInterface class ItemSelectorByPopularity(ItemSelectorInterface): """ Item selector that selects the items to be kept by item popularity. The higher popular items are kept. ...
[ "numpy.argsort" ]
[((465, 485), 'numpy.argsort', 'np.argsort', (['item_pop'], {}), '(item_pop)\n', (475, 485), True, 'import numpy as np\n'), ((748, 768), 'numpy.argsort', 'np.argsort', (['item_pop'], {}), '(item_pop)\n', (758, 768), True, 'import numpy as np\n')]
import random import re import math import numpy as np from src import constants from src.multi_agent.elements.camera import Camera, CameraRepresentation from src.my_utils import constant_class from src.my_utils.my_math.bound import bound_angle_btw_minus_pi_plus_pi, bound from src.my_utils.my_math.line import distance...
[ "src.my_utils.my_math.line.Line", "src.constants.get_time", "random.uniform", "src.my_utils.my_math.bound.bound_angle_btw_minus_pi_plus_pi", "src.multi_agent.elements.camera.CameraRepresentation.__init__", "src.my_utils.my_math.line.distance_btw_two_point", "math.degrees", "math.radians", "src.multi...
[((1391, 1476), 'src.multi_agent.elements.camera.CameraRepresentation.__init__', 'CameraRepresentation.__init__', (['self', 'id', 'xc', 'yc', 'alpha', 'beta', 'field_depth', 'color'], {}), '(self, id, xc, yc, alpha, beta, field_depth, color\n )\n', (1420, 1476), False, 'from src.multi_agent.elements.camera import Ca...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Code accompanying the manuscript: "Reinterpreting the relationship between number of species and number of links connects community structure and stability" ------- v1.0.0 (First release) ------- For any question or comment, please contact: <NAME>(1), <EMAIL> (1)...
[ "numpy.mean", "collections.namedtuple", "numpy.repeat", "numpy.ones", "numpy.full_like", "numpy.where", "numpy.log", "numpy.exp", "numpy.array", "numpy.sum", "numpy.zeros", "numpy.tril", "numpy.arange", "numpy.random.permutation" ]
[((2145, 2162), 'numpy.tril', 'np.tril', (['(mat != 0)'], {}), '(mat != 0)\n', (2152, 2162), True, 'import numpy as np\n'), ((2929, 2953), 'numpy.array', 'np.array', (['(nbsimu * [mat])'], {}), '(nbsimu * [mat])\n', (2937, 2953), True, 'import numpy as np\n'), ((3045, 3065), 'numpy.ones', 'np.ones', (['(nbsimu, S)'], {...
# coding: utf-8 import numpy as np import librosa import argparse import time def main(): parser = argparse.ArgumentParser( prog = 'The Noise Reduction (Spectral Subtraction)', usage = 'シンプルなスペクトルサブトラクションで, ノイズを軽減します.', description = 'python3 NoiseReduction.py -i [Input Filena...
[ "librosa.istft", "librosa.db_to_power", "argparse.ArgumentParser", "numpy.average", "librosa.output.write_wav", "librosa.power_to_db", "librosa.stft", "time.time", "librosa.util.normalize", "librosa.load" ]
[((115, 419), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""The Noise Reduction (Spectral Subtraction)"""', 'usage': '"""シンプルなスペクトルサブトラクションで, ノイズを軽減します."""', 'description': '"""python3 NoiseReduction.py -i [Input Filename] -o [Output Filename] -s [Noise start time(sec)] -f [Noise finish time(s...
import json import re import ast import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split, GridSearchCV, StratifiedKFold, cross_val_score from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, log_los...
[ "pandas.read_csv", "sklearn.model_selection.StratifiedKFold", "sklearn.metrics.log_loss", "sklearn.metrics.r2_score", "numpy.mean", "json.dumps", "numpy.asarray", "pandas.DataFrame", "sklearn.metrics.confusion_matrix", "sklearn.model_selection.cross_val_score", "json.loads", "matplotlib.pyplot...
[((494, 569), 'pandas.read_csv', 'pd.read_csv', (['"""../data/processed/people_transformation/people_cast_list.csv"""'], {}), "('../data/processed/people_transformation/people_cast_list.csv')\n", (505, 569), True, 'import pandas as pd\n'), ((2605, 2642), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['y_test...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/2/10 21:53 # @Author : DaiPuWei # E-Mail : <EMAIL> # blog : https://blog.csdn.net/qq_30091945 # @Site : 中国民航大学北教25-506实验室 # @File : GMM.py # @Software: PyCharm """ 这是高斯混合模型的Python类代码,这份代码使用EM算法进行 求解模型参数,对于高斯分布的均值向量利用K-Means聚类算法 的最...
[ "numpy.abs", "numpy.eye", "numpy.power", "numpy.argmax", "numpy.linalg.det", "numpy.array", "numpy.sum", "numpy.linalg.inv", "numpy.cov", "numpy.zeros", "numpy.dot", "numpy.shape", "KMeansCluster.KMeansCluster.KMeansCluster" ]
[((880, 899), 'numpy.shape', 'np.shape', (['self.Data'], {}), '(self.Data)\n', (888, 899), True, 'import numpy as np\n'), ((1992, 2011), 'KMeansCluster.KMeansCluster.KMeansCluster', 'KMeansCluster', (['data'], {}), '(data)\n', (2005, 2011), False, 'from KMeansCluster.KMeansCluster import KMeansCluster\n'), ((1298, 1331...
""" Auxiliarry functions for the pointwise gravity spherical harmonics expansion. """ import warnings import numpy as np from joblib import Parallel, delayed from .legendre import lplm, lplm_d1 np.seterr(over='raise') def expand_parallel(x, q, *args): nlat = x.shape[0] # parallel only if there are more than...
[ "numpy.atleast_2d", "numpy.tile", "numpy.allclose", "numpy.all", "numpy.power", "numpy.asarray", "numpy.any", "joblib.Parallel", "numpy.sum", "numpy.cos", "numpy.sin", "joblib.delayed", "warnings.warn", "numpy.seterr", "warnings.filterwarnings", "numpy.arange" ]
[((196, 219), 'numpy.seterr', 'np.seterr', ([], {'over': '"""raise"""'}), "(over='raise')\n", (205, 219), True, 'import numpy as np\n'), ((1082, 1100), 'numpy.atleast_2d', 'np.atleast_2d', (['lat'], {}), '(lat)\n', (1095, 1100), True, 'import numpy as np\n'), ((1111, 1129), 'numpy.atleast_2d', 'np.atleast_2d', (['lon']...
"""Script to perform a simple at-home yes/no experiment and analyze the resulting data using signal detection theory. """ import numpy as np from scipy.stats import norm import prettytable as pt import sounddevice as sd def trial(signal, n=None): """Performs a trial in the experiment. Args: signal (...
[ "prettytable.PrettyTable", "numpy.sqrt", "scipy.stats.norm.ppf", "numpy.sin", "numpy.arange", "numpy.random.shuffle" ]
[((790, 818), 'numpy.arange', 'np.arange', (['(0)', '(0.1)', '(1 / 44100)'], {}), '(0, 0.1, 1 / 44100)\n', (799, 818), True, 'import numpy as np\n'), ((1594, 1614), 'numpy.random.shuffle', 'np.random.shuffle', (['X'], {}), '(X)\n', (1611, 1614), True, 'import numpy as np\n'), ((3582, 3598), 'prettytable.PrettyTable', '...
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, merg...
[ "collections.OrderedDict", "numpy.average", "anim_utils.utilities.log.write_message_to_log", "numpy.array", "anim_utils.animation_data.MotionVector", "json.dump", "anim_utils.animation_data.motion_concatenation.align_and_concatenate_frames" ]
[((4124, 4188), 'anim_utils.animation_data.MotionVector', 'MotionVector', (['self.motion_state_graph.skeleton', 'algorithm_config'], {}), '(self.motion_state_graph.skeleton, algorithm_config)\n', (4136, 4188), False, 'from anim_utils.animation_data import MotionVector, align_quaternion_frames\n'), ((9588, 9653), 'anim_...
# Standard imports import cv2 import argparse import numpy as np ap = argparse.ArgumentParser() ap.add_argument('-i', '--image', required=False, help='Path to the image') args = vars(ap.parse_args()) # Read image image = cv2.imread(args['image']) # image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) dim = (320, 240) ...
[ "cv2.rectangle", "argparse.ArgumentParser", "numpy.hstack", "cv2.inRange", "cv2.bitwise_and", "numpy.array", "cv2.waitKey", "cv2.resize", "cv2.GaussianBlur", "cv2.imread", "cv2.boundingRect" ]
[((72, 97), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (95, 97), False, 'import argparse\n'), ((225, 250), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (235, 250), False, 'import cv2\n'), ((328, 380), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolatio...
import argparse from keras.models import load_model import make_dataset import numpy as np import matplotlib.pyplot as plt # load the model import tkinter as tk from tkinter import filedialog def main(): parser = argparse.ArgumentParser() parser.add_argument("base", help="base directory where dataset data i...
[ "keras.models.load_model", "argparse.ArgumentParser", "numpy.argmax", "make_dataset.load_data", "numpy.zeros", "matplotlib.pyplot.figure", "matplotlib.pyplot.show" ]
[((221, 246), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (244, 246), False, 'import argparse\n'), ((454, 487), 'make_dataset.load_data', 'make_dataset.load_data', (['args.base'], {}), '(args.base)\n', (476, 487), False, 'import make_dataset\n'), ((665, 699), 'keras.models.load_model', 'load...
""" Thanks to <NAME> """ from __future__ import division, print_function import sys import math import numba from numba import jit, autojit, size_t import numpy as np import numpy.testing as npt try: from skimage import img_as_float except ImportError as e: print("skimage not available, skipping") sys.exi...
[ "numba.autojit", "sys.exit", "math.sqrt", "skimage.img_as_float", "numpy.asarray", "numpy.zeros", "numba.jit", "numpy.empty_like", "numpy.linalg.norm", "numpy.testing.assert_array_equal" ]
[((1164, 1178), 'math.sqrt', 'math.sqrt', (['(3.0)'], {}), '(3.0)\n', (1173, 1178), False, 'import math\n'), ((880, 892), 'math.sqrt', 'math.sqrt', (['s'], {}), '(s)\n', (889, 892), False, 'import math\n'), ((1061, 1073), 'math.sqrt', 'math.sqrt', (['s'], {}), '(s)\n', (1070, 1073), False, 'import math\n'), ((1120, 115...
import PIL import numpy as np from covid.metrics import VQMTMetrics from covid.video_reader import PlaybackPosition, FfmsReader, NonBlockingPairReader def test_playback(): pos = PlaybackPosition(10, 100) assert pos.get_playback_frame_position() == 9 pos.shift_playback_frame_position(-100) assert pos...
[ "covid.video_reader.FfmsReader", "numpy.array", "covid.video_reader.PlaybackPosition", "covid.video_reader.NonBlockingPairReader" ]
[((185, 210), 'covid.video_reader.PlaybackPosition', 'PlaybackPosition', (['(10)', '(100)'], {}), '(10, 100)\n', (201, 210), False, 'from covid.video_reader import PlaybackPosition, FfmsReader, NonBlockingPairReader\n'), ((579, 624), 'covid.video_reader.FfmsReader', 'FfmsReader', (['"""samples/foreman_crf30_short.mp4""...
from typing import Any, Optional import numpy as np from joblib import Parallel, delayed from budgetcb.base import MAB from budgetcb.helper import _get_ALP_predict, _LinUCBnTSSingle, _sherman_morrison_update class LinUCB(MAB): """ Constrained LinUCB References: Li, Lihong, et al. "A contextual-b...
[ "numpy.eye", "numpy.ones", "numpy.log", "numpy.argmax", "numpy.max", "joblib.Parallel", "numpy.array", "numpy.zeros", "numpy.dot", "joblib.delayed", "numpy.random.uniform", "budgetcb.helper._sherman_morrison_update", "budgetcb.helper._LinUCBnTSSingle" ]
[((3153, 3201), 'budgetcb.helper._sherman_morrison_update', '_sherman_morrison_update', (['self.AaI[arm]', 'context'], {}), '(self.AaI[arm], context)\n', (3177, 3201), False, 'from budgetcb.helper import _get_ALP_predict, _LinUCBnTSSingle, _sherman_morrison_update\n'), ((4270, 4300), 'numpy.zeros', 'np.zeros', (['(self...
import numpy as np import sys, os, os.path, time, gc from astropy.table import Table, vstack, join import matplotlib.pyplot as plt from astropy import units as u from scipy.optimize import curve_fit, minimize from astropy.time import Time import astropy.coordinates as coords from astropy.stats import sigma_clip from ma...
[ "numpy.sqrt", "astropy.table.Table", "matplotlib.pyplot.ylabel", "numpy.hstack", "Register_Frames.GetRegistrators", "numpy.log", "emcee.EnsembleSampler", "matplotlib.pyplot.fill_between", "numpy.argsort", "numpy.array", "astropy.coordinates.solar_system_ephemeris.set", "numpy.isfinite", "ast...
[((728, 756), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(8)'}), "('xtick', labelsize=8)\n", (734, 756), True, 'import matplotlib.pyplot as plt\n'), ((757, 785), 'matplotlib.pyplot.rc', 'plt.rc', (['"""ytick"""'], {'labelsize': '(8)'}), "('ytick', labelsize=8)\n", (763, 785), True, 'import matpl...
import torch from abc import abstractmethod from numpy import inf import numpy as np class BaseTrainer: """ Base class for all trainers """ def __init__(self, model, criterion, metric_ftns, optimizer, config, fold_id): self.config = config self.logger = config.get_logger('trainer', conf...
[ "sklearn.metrics.confusion_matrix", "sklearn.metrics.classification_report", "torch.load", "os.walk", "os.path.join", "torch.cuda.device_count", "sklearn.metrics.cohen_kappa_score", "torch.nn.DataParallel", "numpy.array", "torch.save", "pandas.DataFrame", "numpy.load", "sklearn.metrics.accur...
[((3964, 4016), 'numpy.save', 'np.save', (['(self.config._save_dir / outs_name)', 'all_outs'], {}), '(self.config._save_dir / outs_name, all_outs)\n', (3971, 4016), True, 'import numpy as np\n'), ((4025, 4077), 'numpy.save', 'np.save', (['(self.config._save_dir / trgs_name)', 'all_trgs'], {}), '(self.config._save_dir /...
import numpy as np def hist_to_xy(array, bins): hist = np.histogram(array, bins=bins) y, x = [hist[0], 0.5 * (hist[1][1:] + hist[1][:-1])] return x, y def find_nearest(array, values): indices = np.abs(np.subtract.outer(array, values)).argmin(0) return indices def check_for_completeness(list): ...
[ "numpy.histogram", "numpy.subtract.outer" ]
[((61, 91), 'numpy.histogram', 'np.histogram', (['array'], {'bins': 'bins'}), '(array, bins=bins)\n', (73, 91), True, 'import numpy as np\n'), ((221, 253), 'numpy.subtract.outer', 'np.subtract.outer', (['array', 'values'], {}), '(array, values)\n', (238, 253), True, 'import numpy as np\n')]
#!/usr/bin/env python ######################################################### # # Main file for parallel mesh testing. # # This is a modification of the run_parallel_advection.py # file. # # # *) The (new) files that have been added to manage the # grid partitioning are # +) pmesh_divide_metis.py: subdivide a pm...
[ "anuga.interface.Reflective_boundary", "anuga.interface.Transmissive_boundary", "parallel_shallow_water.Parallel_domain", "anuga.abstract_2d_finite_volumes.pmesh2domain.pmesh_to_domain_instance", "distribute_mesh.send_submesh", "distribute_mesh.pmesh_divide_metis", "distribute_mesh.build_submesh", "nu...
[((2128, 2151), 'numpy.zeros', 'num.zeros', (['(4)', 'num.float'], {}), '(4, num.float)\n', (2137, 2151), True, 'import numpy as num\n'), ((4666, 4777), 'parallel_shallow_water.Parallel_domain', 'Parallel_domain', (['points', 'vertices', 'boundary'], {'full_send_dict': 'full_send_dict', 'ghost_recv_dict': 'ghost_recv_d...
import itertools from cirq import ops from cirq.qutrit import raw_types from cirq.qutrit import common_gates import math, numpy as np class ControlledTernaryGate(raw_types.TernaryLogicGate, ops.CompositeGate, ops.ReversibleEffect, o...
[ "itertools.product", "math.cos", "numpy.array", "math.sin", "cirq.ops.TextDiagramInfo" ]
[((3523, 3625), 'cirq.ops.TextDiagramInfo', 'ops.TextDiagramInfo', (['(c_syms + base_info.wire_symbols)'], {'exponent': 'base_info.exponent', 'connected': '(True)'}), '(c_syms + base_info.wire_symbols, exponent=base_info.\n exponent, connected=True)\n', (3542, 3625), False, 'from cirq import ops\n'), ((8244, 8528), ...
""" @Time : 2021/11/27 16:19 @File : misc.py @Software: PyCharm @Desc : """ import random import warnings import numpy as np import torch def setup_manual_seed(seed): warnings.warn(f'You have chosen to seed ({seed}) training. This will turn on the CUDNN deterministic setting, ' f'whic...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "random.seed", "torch.cuda.is_available", "numpy.random.seed", "warnings.warn" ]
[((184, 419), 'warnings.warn', 'warnings.warn', (['f"""You have chosen to seed ({seed}) training. This will turn on the CUDNN deterministic setting, which can slow down your training considerably! You may see unexpected behavior when restarting from checkpoints."""'], {}), "(\n f'You have chosen to seed ({seed}) tra...
"""<https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm>""" import heapq import sys import numba as nb import numpy as np input = sys.stdin.readline # NOTE: Dijkstra algorithm with priority queue (this is slow for dense graphs) # 1. SciPy # 2. Python # 3. Numba def solve1(N, A, B, T): from scipy.sparse import...
[ "numba.njit", "scipy.sparse.csgraph.dijkstra", "numpy.max", "numpy.zeros", "heapq.heappop", "heapq.heappush", "scipy.sparse.csr_matrix" ]
[((1360, 1400), 'numba.njit', 'nb.njit', (['"""i8(i8,i8,i8[:,:])"""'], {'cache': '(True)'}), "('i8(i8,i8,i8[:,:])', cache=True)\n", (1367, 1400), True, 'import numba as nb\n'), ((393, 430), 'scipy.sparse.csr_matrix', 'csr_matrix', (['(T, (A, B))'], {'shape': '(N, N)'}), '((T, (A, B)), shape=(N, N))\n', (403, 430), Fals...
import bibtexparser as bp import Levenshtein as le import fuzzy as fz import numpy import scipy.misc as ch from sklearn import linear_model from sklearn.cross_validation import train_test_split # from scipy import misc as ch # import gmpy2 as ch import re, csv, os, threading, logging, sys from datetime import * fr...
[ "logging.getLogger", "Levenshtein.jaro_winkler", "numpy.array", "numpy.random.RandomState", "fuzzy.Soundex", "numpy.mean", "os.listdir", "numpy.exp", "os.path.isdir", "csv.reader", "scipy.misc.comb", "csv.writer", "os.path.splitext", "bibtexparser.bparser.BibTexParser", "Levenshtein.dist...
[((436, 463), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (453, 463), False, 'import re, csv, os, threading, logging, sys\n'), ((2596, 2780), 'numpy.array', 'numpy.array', (['[200.064, 1.192, -3.152, 33.034, 0.0, 0.985, 80.515, -3.527, -2.33, -1.916,\n 0.006, 1.863, 0.149, -0.108, -...
# -*- coding: utf-8 -*- """ Created on Mon July 9 22:20:12 2018 @author: Adam """ import os import sqlite3 import numpy as np import pandas as pd from datetime import datetime from emonitor.core import TABLE, DATA_DIRE from emonitor.tools import db_path, db_init, db_check, db_describe, db_insert from emonitor.data imp...
[ "datetime.datetime", "os.path.exists", "sqlite3.connect", "emonitor.tools.db_insert", "emonitor.tools.db_describe", "os.path.isfile", "numpy.array", "numpy.array_equal", "emonitor.history", "emonitor.data.EmonitorData", "emonitor.tools.db_path", "emonitor.tools.db_init", "emonitor.tools.db_c...
[((452, 465), 'emonitor.tools.db_path', 'db_path', (['NAME'], {}), '(NAME)\n', (459, 465), False, 'from emonitor.tools import db_path, db_init, db_check, db_describe, db_insert\n'), ((469, 487), 'os.path.isfile', 'os.path.isfile', (['DB'], {}), '(DB)\n', (483, 487), False, 'import os\n'), ((514, 533), 'sqlite3.connect'...
# # Copyright (c) 2016-2021 <NAME> # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import numpy as np from sklearn.utils import arrayfuncs from sklearn import datasets class LarsLasso: def __init__(self, alpha: flo...
[ "numpy.copy", "numpy.abs", "numpy.sqrt", "sklearn.datasets.load_boston", "numpy.dot", "numpy.zeros", "numpy.linalg.inv", "numpy.sign", "sklearn.utils.arrayfuncs.min_pos" ]
[((3781, 3803), 'sklearn.datasets.load_boston', 'datasets.load_boston', ([], {}), '()\n', (3801, 3803), False, 'from sklearn import datasets\n'), ((628, 639), 'numpy.zeros', 'np.zeros', (['p'], {}), '(p)\n', (636, 639), True, 'import numpy as np\n'), ((718, 729), 'numpy.zeros', 'np.zeros', (['p'], {}), '(p)\n', (726, 7...
#!/usr/bin/env python # coding: utf-8 # <img style="float: left;padding: 1.3em" src="https://indico.in2p3.fr/event/18313/logo-786578160.png"> # # # Gravitational Wave Open Data Workshop #3 # # # ## Tutorial 2.1 PyCBC Tutorial, An introduction to matched-filtering # # We will be using the [PyCBC](http://github.c...
[ "pylab.title", "pycbc.waveform.get_td_waveform", "pylab.xlabel", "pylab.loglog", "numpy.mean", "pylab.ylim", "pylab.ylabel", "pylab.plot", "pylab.xlim", "numpy.random.normal", "numpy.argmax", "pylab.figure", "numpy.correlate", "scipy.stats.norm.pdf", "numpy.std", "matplotlib.pyplot.sho...
[((2644, 2697), 'numpy.random.normal', 'numpy.random.normal', ([], {'size': '[sample_rate * data_length]'}), '(size=[sample_rate * data_length])\n', (2663, 2697), False, 'import numpy\n'), ((3479, 3574), 'pycbc.waveform.get_td_waveform', 'get_td_waveform', ([], {'approximant': 'apx', 'mass1': '(10)', 'mass2': '(10)', '...
import numpy import cv2 def make2Dcolormap( colors=( (1, 1, 0), (0, 0, 1), (0, 1, 0), (1, 0, 0), ), size=20): ###################### colormap = numpy.zeros((2, 2, 3)) colormap[1, 1] = colors[0] colormap[0, 1] = colors[1] colormap[0, ...
[ "numpy.clip", "numpy.zeros", "cv2.resize" ]
[((219, 241), 'numpy.zeros', 'numpy.zeros', (['(2, 2, 3)'], {}), '((2, 2, 3))\n', (230, 241), False, 'import numpy\n'), ((401, 435), 'cv2.resize', 'cv2.resize', (['colormap', '(size, size)'], {}), '(colormap, (size, size))\n', (411, 435), False, 'import cv2\n'), ((451, 477), 'numpy.clip', 'numpy.clip', (['colormap', '(...
import numpy as np from gym_cooking.cooking_world.world_objects import * from collections import namedtuple GraphicScaling = namedtuple("GraphicScaling", ["holding_scale", "container_scale"]) class GraphicStore: OBJECT_PROPERTIES = {Blender: GraphicScaling(None, 0.5)} def __init__(self, world_height, worl...
[ "collections.namedtuple", "numpy.asarray" ]
[((127, 193), 'collections.namedtuple', 'namedtuple', (['"""GraphicScaling"""', "['holding_scale', 'container_scale']"], {}), "('GraphicScaling', ['holding_scale', 'container_scale'])\n", (137, 193), False, 'from collections import namedtuple\n'), ((645, 671), 'numpy.asarray', 'np.asarray', (['self.tile_size'], {}), '(...
import numpy as np import seaborn as sns import matplotlib.pyplot as pl from sklearn.metrics import roc_curve def uim_data(N=20, M=100, sparsity=0.1, frac_test=0.2, show=True, fill_num=0.9, fs=30): """ Show splitting by frac_test using random holdout. """ np.random.seed(1234) tot_size...
[ "seaborn.cubehelix_palette", "matplotlib.pyplot.hist", "matplotlib.pyplot.ylabel", "numpy.argsort", "numpy.array", "sklearn.metrics.roc_curve", "numpy.arange", "matplotlib.pyplot.imshow", "numpy.mean", "numpy.where", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.max", "matpl...
[((287, 307), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (301, 307), True, 'import numpy as np\n'), ((345, 374), 'numpy.round', 'np.round', (['(tot_size * sparsity)'], {}), '(tot_size * sparsity)\n', (353, 374), True, 'import numpy as np\n'), ((538, 564), 'matplotlib.pyplot.figure', 'pl.figure...
# Various functions and methods for preprocessing/metric measurement/plotting etc... import numpy as np import matplotlib.pyplot as plt ######################################################################################################################## # Metrics ###################################################...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.sum", "numpy.load", "matplotlib.pyplot.legend" ]
[((2501, 2534), 'numpy.sum', 'np.sum', (['[(x == 0) for x in truth]'], {}), '([(x == 0) for x in truth])\n', (2507, 2534), True, 'import numpy as np\n'), ((2548, 2581), 'numpy.sum', 'np.sum', (['[(x == 1) for x in truth]'], {}), '([(x == 1) for x in truth])\n', (2554, 2581), True, 'import numpy as np\n'), ((2595, 2628)...
import matplotlib as mpl import os import numpy as np def figsize(scale): fig_width_pt = 510. inches_per_pt = 1.0/72.27 golden_mean = (np.sqrt(5.0)-1.0)/2. fig_width = fig_width_pt * inches_per_pt * scale fig_height = fig_width_pt * inches_per_pt * golden_mean * 0.5 fig_size = [fig_width, fig_h...
[ "numpy.mean", "numpy.shape", "matplotlib.pyplot.axvspan", "matplotlib.pyplot.savefig", "numpy.sqrt", "matplotlib.rcParams.update", "matplotlib.pyplot.ylabel", "matplotlib.use", "matplotlib.pyplot.xticks", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.tick_params", ...
[((349, 363), 'matplotlib.use', 'mpl.use', (['"""pgf"""'], {}), "('pgf')\n", (356, 363), True, 'import matplotlib as mpl\n'), ((758, 803), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (['pgf_with_custom_preamble'], {}), '(pgf_with_custom_preamble)\n', (777, 803), True, 'import matplotlib as mpl\n'), ((2153, 229...
###modified based on centernet### #MIT License #Copyright (c) 2019 <NAME> #All rights reserved. from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import datetime import pycocotools.coco as coco from pycocotools.cocoeval import COCOeval import nump...
[ "numpy.clip", "numpy.sqrt", "re.compile", "numpy.log", "torch.from_numpy", "numpy.array", "torch.utils.data.distributed.DistributedSampler", "numpy.sin", "numpy.random.RandomState", "numpy.arange", "numpy.random.random", "numpy.asarray", "pycocotools.coco.COCO", "numpy.exp", "numpy.dot",...
[((9777, 9797), 're.compile', 're.compile', (['"""[SaUO]"""'], {}), "('[SaUO]')\n", (9787, 9797), False, 'import re\n'), ((601, 628), 'torch.manual_seed', 'torch.manual_seed', (['opt.seed'], {}), '(opt.seed)\n', (618, 628), False, 'import torch\n'), ((742, 855), 'torch.utils.data.distributed.DistributedSampler', 'torch...
import numpy as np from keras_htr import compute_output_shape from keras_htr.adapters.base import BatchAdapter import tensorflow as tf class CTCAdapter(BatchAdapter): def compute_input_lengths(self, image_arrays): batch_size = len(image_arrays) lstm_input_shapes = [compute_output_shape(a.shape) f...
[ "numpy.array", "tensorflow.keras.preprocessing.image.img_to_array", "keras_htr.compute_output_shape" ]
[((1404, 1452), 'tensorflow.keras.preprocessing.image.img_to_array', 'tf.keras.preprocessing.image.img_to_array', (['image'], {}), '(image)\n', (1445, 1452), True, 'import tensorflow as tf\n'), ((289, 318), 'keras_htr.compute_output_shape', 'compute_output_shape', (['a.shape'], {}), '(a.shape)\n', (309, 318), False, 'f...
############################################################## # # ccm_unred: Deredden a flux vector using the CCM 1989 parameterization # # Cardelli_coeff: Calculate a,b and a+b/Rv for the Cardelli dust # law given a wavelength lam in angstroms # # calc_Av_from_Balmer_decrement: derive extinction using Balmer decr...
[ "numpy.isscalar", "numpy.where", "numpy.log", "numpy.array", "numpy.zeros", "numpy.polyval", "numpy.ndarray" ]
[((4029, 4042), 'numpy.zeros', 'n.zeros', (['npts'], {}), '(npts)\n', (4036, 4042), True, 'import numpy as n\n'), ((4055, 4068), 'numpy.zeros', 'n.zeros', (['npts'], {}), '(npts)\n', (4062, 4068), True, 'import numpy as n\n'), ((4124, 4154), 'numpy.where', 'n.where', (['((x > 0.3) & (x < 1.1))'], {}), '((x > 0.3) & (x ...
# -*- coding: utf-8 -*- """Tarea_2.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1zWnlDFVNS9UkQ9mCQwPC7u-tTaHEVeox """ import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set() #datos Lm=0.05 #Longitud en x Ln=0.05 #...
[ "seaborn.set", "seaborn.heatmap", "numpy.linspace", "numpy.zeros", "matplotlib.pyplot.scatter", "numpy.meshgrid" ]
[((269, 278), 'seaborn.set', 'sns.set', ([], {}), '()\n', (276, 278), True, 'import seaborn as sns\n'), ((418, 440), 'numpy.linspace', 'np.linspace', (['(0)', 'Lm', 'Nm'], {}), '(0, Lm, Nm)\n', (429, 440), True, 'import numpy as np\n'), ((459, 481), 'numpy.linspace', 'np.linspace', (['(0)', 'Ln', 'Nn'], {}), '(0, Ln, N...
#!/usr/bin/env python # -*- coding: utf-8 -*- # everything that relates to ProbFuse2006 is in this library. # Enjoy. import os import random import numpy as np from itertools import * import shutil def clean_out_files(output_folder): # make sure tmp/topic_id.txt file are empty before appending, if they exi...
[ "random.sample", "os.listdir", "os.path.isfile", "os.path.dirname", "numpy.zeros", "os.path.isdir", "shutil.rmtree" ]
[((327, 355), 'os.path.isdir', 'os.path.isdir', (['output_folder'], {}), '(output_folder)\n', (340, 355), False, 'import os\n'), ((15150, 15199), 'random.sample', 'random.sample', (['possible_topics', 'n_training_topics'], {}), '(possible_topics, n_training_topics)\n', (15163, 15199), False, 'import random\n'), ((385, ...
# numpy.isnumeric() function import numpy as np # counting a substring print(np.char.isnumeric('arfyslowy')) # counting a substring print(np.char.isnumeric('kloter2surga'))
[ "numpy.char.isnumeric" ]
[((83, 113), 'numpy.char.isnumeric', 'np.char.isnumeric', (['"""arfyslowy"""'], {}), "('arfyslowy')\n", (100, 113), True, 'import numpy as np\n'), ((146, 179), 'numpy.char.isnumeric', 'np.char.isnumeric', (['"""kloter2surga"""'], {}), "('kloter2surga')\n", (163, 179), True, 'import numpy as np\n')]
"""Tests for `fake_data_for_learning` package.""" import pytest import numpy as np from sklearn.preprocessing import LabelEncoder from fake_data_for_learning.fake_data_for_learning import ( BayesianNodeRV, SampleValue ) # (Conditional) probability distributions @pytest.fixture def binary_pt(): return np.arr...
[ "sklearn.preprocessing.LabelEncoder", "fake_data_for_learning.fake_data_for_learning.SampleValue", "numpy.array", "pytest.raises", "fake_data_for_learning.fake_data_for_learning.BayesianNodeRV", "fake_data_for_learning.fake_data_for_learning.SampleValue.possible_default_value" ]
[((314, 334), 'numpy.array', 'np.array', (['[0.1, 0.9]'], {}), '([0.1, 0.9])\n', (322, 334), True, 'import numpy as np\n'), ((382, 416), 'numpy.array', 'np.array', (['[[0.2, 0.8], [0.7, 0.3]]'], {}), '([[0.2, 0.8], [0.7, 0.3]])\n', (390, 416), True, 'import numpy as np\n'), ((516, 547), 'fake_data_for_learning.fake_dat...
#!python # #Calculate the lattice constant and elastic constant of refractory HEAs import os import re import shutil import operator from itertools import combinations from pymatgen.core.periodic_table import Element import scipy.constants from pyemto.latticeinputs.batch import batch_head from pyemto.utilities import ...
[ "math.sqrt", "numpy.array", "pyemto.utilities.distort", "os.path.exists", "re.split", "os.listdir", "pymatgen.core.periodic_table.Element", "numpy.linspace", "os.path.isfile", "operator.eq", "pyemto.latticeinputs.batch.batch_head", "os.makedirs", "math.pow", "os.path.join", "os.chdir", ...
[((2387, 2445), 'pyemto.examples.emto_input_generator.EMTO', 'EMTO', ([], {'folder': 'emtopath', 'EMTOdir': '"""/storage/home/mjl6505/bin"""'}), "(folder=emtopath, EMTOdir='/storage/home/mjl6505/bin')\n", (2391, 2445), False, 'from pyemto.examples.emto_input_generator import EMTO\n'), ((3022, 3059), 'numpy.linspace', '...
import os import numpy as np import pandas as pd from collections import defaultdict from tensorboard.backend.event_processing.event_accumulator import EventAccumulator def tabulate_events(dir_path): summary_iterators = [EventAccumulator(os.path.join(dir_path, dname)).Reload() for dname in os.listdir(dir_path)] ...
[ "os.path.exists", "os.listdir", "os.makedirs", "os.path.join", "numpy.array", "collections.defaultdict", "numpy.vstack" ]
[((460, 477), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (471, 477), False, 'from collections import defaultdict\n'), ((940, 964), 'os.listdir', 'os.listdir', (['log_dir_path'], {}), '(log_dir_path)\n', (950, 964), False, 'import os\n'), ((1074, 1090), 'numpy.array', 'np.array', (['values'], ...
#!/usr/bin/env python3 """ Module to take in .mat MatLab files and generate spectrogram images via Short Time Fourier Transform ---------- ------------------------------ -------------------- | Data.mat | -> | Short-Time Fourier Transform | -> | Spectrogram Images | ...
[ "numpy.log10", "matplotlib.pyplot.ylabel", "math.floor", "numpy.genfromtxt", "os.walk", "argparse.ArgumentParser", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.path.isdir", "os.mkdir", "matplotlib.pyplot.axis", "glob.glob", "numpy.abs", "matplotlib.pyplot.savefig", "matplotl...
[((489, 510), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (503, 510), False, 'import matplotlib\n'), ((643, 668), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""raise"""'}), "(divide='raise')\n", (652, 668), True, 'import numpy as np\n'), ((1004, 1029), 'os.path.join', 'os.path.join', (['CWD...
import logging import cv2 import numpy as np from image_segmentation.extended_image import ExtendedImage from image_segmentation.line import Line LOGGER = logging.getLogger() class Picture(ExtendedImage): INDENTATION_THRESHOLD = 50 ARTIFACT_PERCENTAGE_THRESHOLD = 0.08 MINIMUM_LINE_OVERLAP = 0.25 d...
[ "logging.getLogger", "numpy.copy", "cv2.rectangle", "cv2.drawContours", "cv2.bitwise_and", "numpy.equal", "cv2.imshow", "cv2.waitKey", "image_segmentation.line.Line", "numpy.concatenate", "numpy.zeros_like", "cv2.boundingRect" ]
[((158, 177), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (175, 177), False, 'import logging\n'), ((3051, 3069), 'numpy.zeros_like', 'np.zeros_like', (['img'], {}), '(img)\n', (3064, 3069), True, 'import numpy as np\n'), ((3078, 3134), 'cv2.drawContours', 'cv2.drawContours', (['mask', 'contours', 'conto...
# train logistic regression on mnist dataest import numpy as np import theano.tensor as T import theano as K import gzip, cPickle import matplotlib.pyplot as plt from random import sample, seed import os, sys os.chdir('data/sparse_lstm') print(os.getcwd()) from sparse_lstm import Sparse_LSTM_wo_O_Gate_v2 from keras.m...
[ "numpy.hstack", "matplotlib.pyplot.ylabel", "gzip.open", "numpy.arange", "os.path.exists", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.random.seed", "numpy.vstack", "os.mkdir", "sys.setrecursionlimit", "matplotlib.pyplot.savefig", "keras.models.Sequential", "keras.regulari...
[((210, 238), 'os.chdir', 'os.chdir', (['"""data/sparse_lstm"""'], {}), "('data/sparse_lstm')\n", (218, 238), False, 'import os, sys\n'), ((648, 676), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000)'], {}), '(10000)\n', (669, 676), False, 'import os, sys\n'), ((1411, 1463), 'numpy.vstack', 'np.vstack', (['...
# coding=utf-8 # 结构方程模型的参数估计 from __future__ import division, print_function, unicode_literals from psy import sem, data import numpy as np data_ = data['ex5.11.dat'] beta = np.array([ [0, 0], [1, 0] ]) gamma = np.array([ [1, 1], [0, 0] ]) x = [0, 1, 2, 3, 4, 5] lam_x = np.array([ [1, 0], [...
[ "numpy.array", "numpy.diag", "psy.sem" ]
[((176, 202), 'numpy.array', 'np.array', (['[[0, 0], [1, 0]]'], {}), '([[0, 0], [1, 0]])\n', (184, 202), True, 'import numpy as np\n'), ((222, 248), 'numpy.array', 'np.array', (['[[1, 1], [0, 0]]'], {}), '([[1, 1], [0, 0]])\n', (230, 248), True, 'import numpy as np\n'), ((292, 350), 'numpy.array', 'np.array', (['[[1, 0...
# -*- coding: utf-8 -*- """ @author: fornax """ from __future__ import print_function, division import os import numpy as np import pandas as pd os.chdir(os.path.dirname(os.path.abspath(__file__))) os.sys.path.append(os.path.dirname(os.getcwd())) import prepare_data1 as prep DATA_PATH = os.path.join('..', prep.DATA_PA...
[ "os.path.abspath", "os.path.join", "numpy.unique", "os.getcwd" ]
[((289, 323), 'os.path.join', 'os.path.join', (['""".."""', 'prep.DATA_PATH'], {}), "('..', prep.DATA_PATH)\n", (301, 323), False, 'import os\n'), ((6104, 6146), 'os.path.join', 'os.path.join', (['DATA_PATH', "(filename + '.csv')"], {}), "(DATA_PATH, filename + '.csv')\n", (6116, 6146), False, 'import os\n'), ((381, 41...
""" This module contains auxiliary functions to plot some information on the RESTUD economy. """ # standard library import matplotlib.pylab as plt import numpy as np import shutil import shlex import os from mpl_toolkits.mplot3d import Axes3D from matplotlib.ticker import FuncFormatter from matplotlib import cm # Ev...
[ "numpy.tile", "matplotlib.pylab.savefig", "matplotlib.pylab.figure", "shlex.split", "matplotlib.pylab.legend", "numpy.exp", "os.mkdir", "shutil.rmtree", "matplotlib.pylab.bar" ]
[((1060, 1072), 'numpy.exp', 'np.exp', (['wage'], {}), '(wage)\n', (1066, 1072), True, 'import numpy as np\n'), ((1772, 1795), 'numpy.tile', 'np.tile', (['np.nan', '(0, 4)'], {}), '(np.nan, (0, 4))\n', (1779, 1795), True, 'import numpy as np\n'), ((3513, 3540), 'matplotlib.pylab.figure', 'plt.figure', ([], {'figsize': ...
from legendre import legendre import seidel import matrix import numpy as np from math import sqrt, pi, e def quadrature(k): if k % 2: return 0 else: return 2 / (k + 1) def integrate(a, b, n, f): l = legendre(n) A = np.zeros((n, n)) B = np.zeros((n, 1)) for k in range(n): ...
[ "numpy.zeros", "matrix.multi", "matrix.inv", "legendre.legendre" ]
[((231, 242), 'legendre.legendre', 'legendre', (['n'], {}), '(n)\n', (239, 242), False, 'from legendre import legendre\n'), ((252, 268), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (260, 268), True, 'import numpy as np\n'), ((277, 293), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {}), '((n, 1))\n', (285, 293...
import configparser import numpy import sys import time import random import math import os from copy import deepcopy import json from numpy.linalg import norm from numpy import dot import numpy as np import codecs from scipy.stats import spearmanr import tensorflow as tf import torch import torch.nn as nn from torch....
[ "torch.mul", "torch.LongTensor", "numpy.array", "torch.sum", "numpy.linalg.norm", "torch.DoubleTensor", "numpy.dot", "numpy.argmin", "scipy.stats.spearmanr", "numpy.fromstring", "numpy.dtype", "random.randint", "torch.nn.Embedding", "numpy.round", "torch.nn.functional.mse_loss", "scipy...
[((1087, 1152), 'torch.nn.functional.mse_loss', 'nn.functional.mse_loss', (['input_tensor', 'target_tensor'], {'reduce': '(False)'}), '(input_tensor, target_tensor, reduce=False)\n', (1109, 1152), True, 'import torch.nn as nn\n'), ((20439, 20471), 'random.randint', 'random.randint', (['(0)', '(top_range - 1)'], {}), '(...
# -*- coding: utf-8 -*- """ Plot sensitivity and false positive rate for output of "core_and_accessory_results.py" """ import glob import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt tenthousand = glob.glob("cluster_results/core/*.csv") files_dict = [] kmer_dict = {} for kmer in tqdm([1,2,4,6,8...
[ "pandas.read_csv", "tqdm.tqdm", "numpy.linspace", "matplotlib.pyplot.subplots", "glob.glob" ]
[((220, 259), 'glob.glob', 'glob.glob', (['"""cluster_results/core/*.csv"""'], {}), "('cluster_results/core/*.csv')\n", (229, 259), False, 'import glob\n'), ((305, 330), 'tqdm.tqdm', 'tqdm', (['[1, 2, 4, 6, 8, 10]'], {}), '([1, 2, 4, 6, 8, 10])\n', (309, 330), False, 'from tqdm import tqdm\n'), ((2063, 2077), 'matplotl...
import numpy as np import matplotlib.pyplot as plt plt.style.use('seaborn') ## Example 1 x = np.linspace(-3,3,100) obj_fun = np.cos(14.5 * x - 0.3) + x*(x + 0.2) + 1.01 fig, ax = plt.subplots(1,1,figsize=(10,6)) ax.plot(x,obj_fun) ax.axvline(x = x[np.argmin(obj_fun)],color='r',ls='--') ax.set_ylabel(r'$f(x)$') ax.s...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.style.use", "matplotlib.pyplot.close", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.cos", "numpy.argmin", "numpy.meshgrid", "matplotlib.pyplot.subplots" ]
[((51, 75), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (64, 75), True, 'import matplotlib.pyplot as plt\n'), ((96, 119), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(100)'], {}), '(-3, 3, 100)\n', (107, 119), True, 'import numpy as np\n'), ((183, 218), 'matplotlib.p...
import numpy as np import pyFAI import h5py import fabio ### This function integrates a 2D image using integrate2D pyfai's function and save the results in a h5file named Results_name of the h5 file containing the image ### 1) It looks on the image on th h5 file ### 2) creates a mask based on the int_max and in...
[ "pyFAI.load", "numpy.float64", "numpy.ndim", "h5py.File", "fabio.open", "numpy.shape" ]
[((1771, 1829), 'h5py.File', 'h5py.File', (["(root_data + '/' + 'Results' + '_' + h5file)", '"""a"""'], {}), "(root_data + '/' + 'Results' + '_' + h5file, 'a')\n", (1780, 1829), False, 'import h5py\n'), ((2353, 2374), 'pyFAI.load', 'pyFAI.load', (['poni_file'], {}), '(poni_file)\n', (2363, 2374), False, 'import pyFAI\n...
# -*- coding:utf-8 -*- import unittest import nose import dmr import os import numpy as np from tests.settings import (DMR_DOC_FILEPATH, DMR_VEC_FILEPATH, K, BETA, SIGMA, L, mk_dmr_dat, count_word_freq) class DMRTestCase(unittest.TestCase): NUM_VECS = 10 def setUp(self): np.random.seed(0) i...
[ "numpy.random.normal", "os.path.exists", "tests.settings.count_word_freq", "dmr.Vocabulary", "dmr.Corpus.read", "tests.settings.mk_dmr_dat", "numpy.exp", "numpy.sum", "numpy.array", "numpy.random.randint", "numpy.random.seed", "nose.main" ]
[((5021, 5051), 'nose.main', 'nose.main', ([], {'argv': "['nose', '-v']"}), "(argv=['nose', '-v'])\n", (5030, 5051), False, 'import nose\n'), ((293, 310), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (307, 310), True, 'import numpy as np\n'), ((482, 515), 'dmr.Corpus.read', 'dmr.Corpus.read', (['DMR_D...
# Copyright 2020, General Electric Company. All rights reserved. See https://github.com/xcist/code/blob/master/LICENSE import numpy as np from catsim.GetMu import GetMu Mu = [] Mu.append(GetMu('water', 70)) Mu.append(GetMu('water', 70.0)) Mu.append(GetMu('bone', (30, 50, 70))) Mu.append(GetMu('bone', [30, 50, 70])) ...
[ "numpy.array", "catsim.GetMu.GetMu" ]
[((519, 574), 'numpy.array', 'np.array', (['[(20, 30, 40), (50, 60, 70)]'], {'dtype': 'np.single'}), '([(20, 30, 40), (50, 60, 70)], dtype=np.single)\n', (527, 574), True, 'import numpy as np\n'), ((580, 600), 'catsim.GetMu.GetMu', 'GetMu', (['"""water"""', 'Evec'], {}), "('water', Evec)\n", (585, 600), False, 'from ca...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 21 10:30:25 2018 Try to predict in which lab an animal was trained based on its behavior @author: guido """ import pandas as pd import matplotlib.pyplot as plt import numpy as np from scipy import stats from os.path import join import seaborn as s...
[ "numpy.unique", "os.path.join", "sklearn.ensemble.RandomForestClassifier", "sklearn.linear_model.LogisticRegression", "numpy.append", "numpy.array", "pandas.concat", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "sklearn.naive_bayes.GaussianNB", "sklearn.model_selection.KFold", "numpy....
[((1951, 2144), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['mouse', 'lab', 'time_zone', 'learned', 'date_learned', 'training_time',\n 'perf_easy', 'n_trials', 'threshold', 'bias', 'reaction_time',\n 'lapse_low', 'lapse_high']"}), "(columns=['mouse', 'lab', 'time_zone', 'learned',\n 'date_learned', ...
import argparse import numpy as np from pyimzml.ImzMLWriter import ImzMLWriter from pyImagingMSpec.inMemoryIMS import inMemoryIMS from scipy.optimize import least_squares from pyimzml.ImzMLParser import ImzMLParser from pyimzml.ImzMLWriter import ImzMLWriter from scipy.signal import medfilt2d import logging def fit_fu...
[ "numpy.polyfit", "pyimzml.ImzMLWriter.ImzMLWriter", "numpy.poly1d", "numpy.random.RandomState", "numpy.arange", "scipy.optimize.least_squares", "argparse.ArgumentParser", "numpy.searchsorted", "numpy.asarray", "numpy.max", "numpy.polyval", "numpy.min", "numpy.abs", "scipy.signal.medfilt2d"...
[((337, 353), 'numpy.polyval', 'np.polyval', (['x', 't'], {}), '(x, t)\n', (347, 353), True, 'import numpy as np\n'), ((544, 557), 'numpy.asarray', 'np.asarray', (['v'], {}), '(v)\n', (554, 557), True, 'import numpy as np\n'), ((567, 588), 'numpy.searchsorted', 'np.searchsorted', (['v', 't'], {}), '(v, t)\n', (582, 588...
import os import numpy as np import pydub as pd from abc import ABC, abstractmethod class Messenger(ABC): """ Abstract methods """ def __init__(self, files_path=None): if files_path is None: self.message_left, self.message_right = np.array([]), np.array([]) else: self....
[ "numpy.array", "os.listdir", "numpy.concatenate" ]
[((3270, 3292), 'os.listdir', 'os.listdir', (['files_path'], {}), '(files_path)\n', (3280, 3292), False, 'import os\n'), ((4319, 4343), 'numpy.concatenate', 'np.concatenate', (['messages'], {}), '(messages)\n', (4333, 4343), True, 'import numpy as np\n'), ((262, 274), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', ...
# 2021.03.20 # @yifan # import numpy as np from skimage.util import view_as_windows from scipy.fftpack import dct, idct def Shrink(X, win): X = view_as_windows(X, (1,win,win,1), (1,win,win,1)) return X.reshape(X.shape[0], X.shape[1], X.shape[2], -1) def invShrink(X, win): S = X.shape X = X.reshape(S[0...
[ "numpy.sqrt", "numpy.ones", "numpy.unique", "numpy.argmax", "scipy.fftpack.idct", "numpy.min", "numpy.argsort", "numpy.zeros", "scipy.fftpack.dct", "numpy.matmul", "numpy.concatenate", "numpy.linalg.lstsq", "numpy.moveaxis", "skimage.util.view_as_windows" ]
[((149, 203), 'skimage.util.view_as_windows', 'view_as_windows', (['X', '(1, win, win, 1)', '(1, win, win, 1)'], {}), '(X, (1, win, win, 1), (1, win, win, 1))\n', (164, 203), False, 'from skimage.util import view_as_windows\n'), ((363, 383), 'numpy.moveaxis', 'np.moveaxis', (['X', '(5)', '(2)'], {}), '(X, 5, 2)\n', (37...
import numpy as np import utils test_np = np.ndarray(shape=(100, 256, 256, 1)) train_np = np.ndarray(shape=(800, 256, 256, 1)) valid_np = np.ndarray(shape=(100, 256, 256, 1)) train_np_gt = np.ndarray(shape=(800, 64, 64, 2)) valid_np_gt = np.ndarray(shape=(100, 64, 64, 2)) train_np_real = np.ndarray(shape=(800, 256,...
[ "utils.cvt2Lab", "utils.read_image", "numpy.ndarray", "numpy.save" ]
[((43, 79), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(100, 256, 256, 1)'}), '(shape=(100, 256, 256, 1))\n', (53, 79), True, 'import numpy as np\n'), ((92, 128), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(800, 256, 256, 1)'}), '(shape=(800, 256, 256, 1))\n', (102, 128), True, 'import numpy as np\n'), ((140, 1...
import numpy as np def get_ranks(array): args_tmp = np.argsort(array) args = np.empty_like(args_tmp) args[args_tmp] = np.arange(len(args)) return args
[ "numpy.argsort", "numpy.empty_like" ]
[((58, 75), 'numpy.argsort', 'np.argsort', (['array'], {}), '(array)\n', (68, 75), True, 'import numpy as np\n'), ((87, 110), 'numpy.empty_like', 'np.empty_like', (['args_tmp'], {}), '(args_tmp)\n', (100, 110), True, 'import numpy as np\n')]
"""Tests for NoiseTable.""" import numpy as np from src.utils.noise_table import NoiseTable def test_mirrored_sample(): table = NoiseTable(size=1000) rng = np.random.default_rng() vec = table.sample_index_vec(rng, 100, None) noise = table.get_vec(vec) vec.mirror = True mirrored_noise = table....
[ "src.utils.noise_table.NoiseTable", "numpy.random.default_rng" ]
[((135, 156), 'src.utils.noise_table.NoiseTable', 'NoiseTable', ([], {'size': '(1000)'}), '(size=1000)\n', (145, 156), False, 'from src.utils.noise_table import NoiseTable\n'), ((167, 190), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (188, 190), True, 'import numpy as np\n')]
import numpy as np import pickle from pathlib import Path source_path = "./data/unirep/stability" for path in Path(source_path).rglob('*.npz'): pickle_file = str(path).replace('npz', 'p') seq_dict = dict() data = np.load(path, allow_pickle=True) print(path) dups = set() dup_count = 0 for ...
[ "numpy.load", "pickle.dump", "pathlib.Path" ]
[((228, 260), 'numpy.load', 'np.load', (['path'], {'allow_pickle': '(True)'}), '(path, allow_pickle=True)\n', (235, 260), True, 'import numpy as np\n'), ((111, 128), 'pathlib.Path', 'Path', (['source_path'], {}), '(source_path)\n', (115, 128), False, 'from pathlib import Path\n'), ((764, 788), 'pickle.dump', 'pickle.du...
""" A set of large-scale tests which test code updates against previously-run "golden" results. The idea here is that any new updates (except for major versions) should be non-breaking; firstly, they should not break the API, so that the tests should run without crashing without being changed. Secondly, the actual res...
[ "logging.getLogger", "numpy.allclose", "py21cmfast.global_params.use", "py21cmfast.config.use", "numpy.isclose", "numpy.testing.assert_allclose", "pytest.mark.parametrize", "numpy.sum" ]
[((1632, 1661), 'logging.getLogger', 'logging.getLogger', (['"""21cmFAST"""'], {}), "('21cmFAST')\n", (1649, 1661), False, 'import logging\n'), ((1818, 1858), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name"""', 'options'], {}), "('name', options)\n", (1841, 1858), False, 'import pytest\n'), ((3046, 30...
# Preppin' Data 2021 Week 01 import os import pandas import numpy # Load csv data = pandas.read_csv('unprepped_data\\PD 2021 Wk 1 Input - Bike Sales.csv') # Split the 'Store-Bike' into 'Store' and 'Bike' data[['Store','Bike']] = data['Store - Bike'].str.split(' - ', expand=True) # Clean up the 'Bike' field to: Mou...
[ "numpy.where", "pandas.to_datetime", "pandas.read_csv" ]
[((87, 157), 'pandas.read_csv', 'pandas.read_csv', (['"""unprepped_data\\\\PD 2021 Wk 1 Input - Bike Sales.csv"""'], {}), "('unprepped_data\\\\PD 2021 Wk 1 Input - Bike Sales.csv')\n", (102, 157), False, 'import pandas\n'), ((582, 614), 'pandas.to_datetime', 'pandas.to_datetime', (["data['Date']"], {}), "(data['Date'])...
import copy import numpy as np import imageio import torch import torch.nn.functional as F from models.rendering import get_rays_tourism, sample_points, volume_render def test_time_optimize(args, model, meta_state_dict, tto_view): """ quicky optimize the meta trained model to a target appearance and retur...
[ "torch.nn.functional.mse_loss", "torch.as_tensor", "numpy.ones", "models.rendering.get_rays_tourism", "imageio.mimwrite", "models.rendering.sample_points", "numpy.stack", "numpy.linspace", "torch.randint", "torch.no_grad", "models.rendering.volume_render", "torch.cat" ]
[((543, 630), 'models.rendering.get_rays_tourism', 'get_rays_tourism', (["tto_view['H']", "tto_view['W']", "tto_view['kinv']", "tto_view['pose']"], {}), "(tto_view['H'], tto_view['W'], tto_view['kinv'], tto_view[\n 'pose'])\n", (559, 630), False, 'from models.rendering import get_rays_tourism, sample_points, volume_...
import numpy as np from keras.models import Sequential from keras.layers.core import Dense, Activation from keras.optimizers import SGD from grid.clients.keras import KerasClient from grid.workers.compute import GridCompute import time from threading import Thread import pytest client = None compute_id = None @pytes...
[ "keras.layers.core.Activation", "grid.clients.keras.KerasClient", "time.sleep", "keras.models.Sequential", "numpy.array", "keras.optimizers.SGD", "keras.layers.core.Dense" ]
[((357, 370), 'grid.clients.keras.KerasClient', 'KerasClient', ([], {}), '()\n', (368, 370), False, 'from grid.clients.keras import KerasClient\n'), ((485, 499), 'time.sleep', 'time.sleep', (['(30)'], {}), '(30)\n', (495, 499), False, 'import time\n'), ((1034, 1076), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 0...
# -*- coding: utf-8 -*- import pytest import numpy as np from ...hypothesiser.probability import PDAHypothesiser from ...hypothesiser.distance import DistanceHypothesiser from ...measures import Mahalanobis from ...models.measurement.linear import LinearGaussian from ...types.array import CovarianceMatrix from ...mode...
[ "pytest.fixture", "numpy.diag" ]
[((507, 523), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (521, 523), False, 'import pytest\n'), ((681, 697), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (695, 697), False, 'import pytest\n'), ((930, 946), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (944, 946), False, 'import pytest\n'), (...
#!/usr/bin/env python __author__ = '<NAME>' #============================================================================ import os import sys import time import uuid import shutil import importlib import subprocess import numpy as np from Utils.utils import Printer, ParserJSON #================================...
[ "main.get_suggestion", "importlib.import_module", "spearmint.resources.resource.parse_resources_from_config", "time.time", "numpy.linalg.norm", "time.sleep", "os.getcwd", "os.chdir", "Utils.utils.ParserJSON", "numpy.array", "shutil.rmtree", "os.mkdir", "subprocess.call", "numpy.random.unif...
[((373, 384), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (382, 384), False, 'import os\n'), ((385, 439), 'sys.path.append', 'sys.path.append', (["('%s/ParamGenerator/Spearmint/' % home)"], {}), "('%s/ParamGenerator/Spearmint/' % home)\n", (400, 439), False, 'import sys\n'), ((440, 503), 'sys.path.append', 'sys.path.ap...
#!/usr/bin/python3 import random s=[] with open('dirstart.txt','r') as fp: for line in fp: s.append(int(line)) g=[] with open('dirdest.txt','r') as fp: for line in fp: g.append(int(line)) v={} with open('dirvertices.txt','r') as vfp: for line in vfp: l=line.split(' ') v[int(l[0])]=[int(f) for f...
[ "numpy.array", "random.randint" ]
[((870, 890), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (884, 890), False, 'import random\n'), ((402, 413), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (410, 413), True, 'import numpy as np\n'), ((414, 425), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (422, 425), True, 'import nump...
# AntiBiofilm Peptide Research # Department of Computer Science and Engineering, Santa Clara University # Author: <NAME> # A python script that performs forward selection and hyperparameter optimization # in order to find the best performing SVR model for the MBEC peptides # Loss function used is RMSE # The script dum...
[ "sklearn.model_selection.RepeatedKFold", "numpy.mean", "numpy.sqrt", "pandas.read_csv", "numpy.min", "sklearn.metrics.mean_squared_error", "numpy.around", "sklearn.utils.validation.column_or_1d", "copy.deepcopy", "numpy.argmin", "sys.stdout.flush", "sklearn.svm.SVR", "sklearn.preprocessing.M...
[((1012, 1045), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1035, 1045), False, 'import warnings\n'), ((1785, 1833), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/mbec_training_data.csv"""'], {}), "('../../data/mbec_training_data.csv')\n", (1796, 1833), True, 'imp...
""" Scripts to parse the gender data for the PhD recipients. genderize.io gender-api.com """ import urllib import json import yaml import glob import numpy as np import astropy from astropy.io import ascii import requests import os ### gender-api.com GENDER_API_KEY = os.getenv(GENDER_API_KEY) ### genederize.io GEND...
[ "numpy.unique", "os.getenv", "requests.get", "numpy.array", "numpy.sum", "os.system", "astropy.io.ascii.read", "numpy.arange" ]
[((271, 296), 'os.getenv', 'os.getenv', (['GENDER_API_KEY'], {}), '(GENDER_API_KEY)\n', (280, 296), False, 'import os\n'), ((336, 364), 'os.getenv', 'os.getenv', (['GENDERIZE_API_KEY'], {}), '(GENDERIZE_API_KEY)\n', (345, 364), False, 'import os\n'), ((2254, 2270), 'astropy.io.ascii.read', 'ascii.read', (['file'], {}),...
import numpy as np import pandas as pd from tqdm import tqdm from joblib import Parallel, delayed import os bitsize = 1024 total_sample = 110913349 data_save_folder = './data' file = './data/%s_%s.npy' % (total_sample, bitsize) f = np.memmap(file, dtype = np.bool, shape = (total_sample, bitsize)) def _sum(memmap...
[ "joblib.Parallel", "joblib.delayed", "numpy.memmap", "pandas.Series" ]
[((236, 297), 'numpy.memmap', 'np.memmap', (['file'], {'dtype': 'np.bool', 'shape': '(total_sample, bitsize)'}), '(file, dtype=np.bool, shape=(total_sample, bitsize))\n', (245, 297), True, 'import numpy as np\n'), ((360, 379), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': '(16)'}), '(n_jobs=16)\n', (368, 379), False, ...
""" --------------------------------------------------------------------- -- Author: <NAME> --------------------------------------------------------------------- Util functions for partitioning input data """ import numpy as np def partition_train_val(x_train, y_train, proportion, num_classes, shuffle=True): ""...
[ "numpy.prod", "numpy.hstack", "numpy.where", "numpy.random.permutation", "numpy.array", "numpy.vstack", "numpy.random.shuffle" ]
[((1105, 1133), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.int32'}), '([], dtype=np.int32)\n', (1113, 1133), True, 'import numpy as np\n'), ((1157, 1185), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.int32'}), '([], dtype=np.int32)\n', (1165, 1185), True, 'import numpy as np\n'), ((4392, 4412), 'numpy.prod'...
annotations_dic = \ {"lipsUpperOuter": [61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291,78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308], "lipsLowerOuter": [146, 91, 181, 84, 17, 314, 405, 321, 375, 291,78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308], "lipsUpperInner": [78, 191, 80, 81, 82, 13, 312, 311, 310, ...
[ "numpy.zeros", "numpy.int32" ]
[((2534, 2579), 'numpy.zeros', 'np.zeros', (['(image.shape[0], image.shape[1], 3)'], {}), '((image.shape[0], image.shape[1], 3))\n', (2542, 2579), True, 'import numpy as np\n'), ((2975, 3020), 'numpy.zeros', 'np.zeros', (['(image.shape[0], image.shape[1], 3)'], {}), '((image.shape[0], image.shape[1], 3))\n', (2983, 302...
__copyright__ = "Copyright (c) Microsoft Corporation and Mila - Quebec AI Institute" __license__ = "MIT" """Metrics for MDPs """ import numpy as np import ot from segar.factors.number_factors import NumericFactor from segar.factors.bools import BooleanFactor from segar.factors.arrays import VectorFactor from segar.m...
[ "ot.emd2", "numpy.zeros", "segar.metrics.wasserstein_distance", "numpy.ones" ]
[((1981, 1999), 'numpy.zeros', 'np.zeros', (['(n1, n2)'], {}), '((n1, n2))\n', (1989, 1999), True, 'import numpy as np\n'), ((2821, 2849), 'segar.metrics.wasserstein_distance', 'wasserstein_distance', (['s1', 's2'], {}), '(s1, s2)\n', (2841, 2849), False, 'from segar.metrics import wasserstein_distance\n'), ((3377, 339...
import sys, os from read_struc import read_struc from math import sin, cos import numpy as np def euler2rotmat(phi,ssi,rot): cs=cos(ssi) cp=cos(phi) ss=sin(ssi) sp=sin(phi) cscp=cs*cp cssp=cs*sp sscp=ss*cp sssp=ss*sp crot=cos(rot) srot=sin(rot) r1 = crot * cscp + srot * sp ...
[ "numpy.eye", "json.dumps", "math.cos", "numpy.array", "math.sin" ]
[((133, 141), 'math.cos', 'cos', (['ssi'], {}), '(ssi)\n', (136, 141), False, 'from math import sin, cos\n'), ((149, 157), 'math.cos', 'cos', (['phi'], {}), '(phi)\n', (152, 157), False, 'from math import sin, cos\n'), ((165, 173), 'math.sin', 'sin', (['ssi'], {}), '(ssi)\n', (168, 173), False, 'from math import sin, c...
import numpy as np from loadsounds import parse_file, load_data_definition, reshape_dataset data_def_file = 'sounddata-csv.yml' datafile = 'cherry-sound-20200218113643319806.csv' data_chunk = load_data_definition(data_def_file) csv_dataset = parse_file(datafile,np.array([]),data_chunk, by_channel=True) #sound_dataset ...
[ "loadsounds.reshape_dataset", "loadsounds.load_data_definition", "json.dumps", "numpy.array", "datetime.datetime.now", "tensorflow.keras.models.load_model" ]
[((193, 228), 'loadsounds.load_data_definition', 'load_data_definition', (['data_def_file'], {}), '(data_def_file)\n', (213, 228), False, 'from loadsounds import parse_file, load_data_definition, reshape_dataset\n'), ((719, 753), 'tensorflow.keras.models.load_model', 'models.load_model', (['model_file_path'], {}), '(mo...
import logging import sys from time import time import numpy as np import itertools as it import csv import torch from torch import nn from torch import optim from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from zensols.actioncli import persisted from zensols.dltools imp...
[ "logging.getLogger", "torch.nn.CrossEntropyLoss", "torch.max", "torch.exp", "zensols.actioncli.persisted", "zensols.dlqaclass.Net", "torch.utils.data.sampler.SubsetRandomSampler", "torch.sort", "csv.writer", "numpy.floor", "zensols.dlqaclass.QADataLoader", "time.time", "torch.cat", "iterto...
[((406, 433), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (423, 433), False, 'import logging\n'), ((1892, 1917), 'zensols.actioncli.persisted', 'persisted', (['"""_data_loader"""'], {}), "('_data_loader')\n", (1901, 1917), False, 'from zensols.actioncli import persisted\n'), ((1233, 12...
import pandas as pd import os import numpy as np import glob inf = glob.glob('/home/wequ0318/sleep/data/eeg_fpz_cz/*.npz') for _f in inf: with np.load(_f) as f: data = f["x"] labels = f["y"] sampling_rate = f["fs"] df_data = pd.DataFrame(np.squeeze(data)) df_label = pd.DataFr...
[ "numpy.repeat", "numpy.arange", "numpy.squeeze", "os.path.basename", "pandas.DataFrame", "numpy.load", "pandas.concat", "glob.glob" ]
[((67, 122), 'glob.glob', 'glob.glob', (['"""/home/wequ0318/sleep/data/eeg_fpz_cz/*.npz"""'], {}), "('/home/wequ0318/sleep/data/eeg_fpz_cz/*.npz')\n", (76, 122), False, 'import glob\n'), ((147, 158), 'numpy.load', 'np.load', (['_f'], {}), '(_f)\n', (154, 158), True, 'import numpy as np\n'), ((311, 331), 'pandas.DataFra...
import functools import numpy as np from estimagic.batch_evaluators import joblib_batch_evaluator from src.manfred.minimize_manfred import minimize_manfred def minimize_manfred_estimagic( internal_criterion_and_derivative, x, lower_bounds, upper_bounds, convergence_relative_params_tolerance=0.00...
[ "functools.partial", "numpy.random.seed" ]
[((6673, 6774), 'functools.partial', 'functools.partial', (['internal_criterion_and_derivative'], {'algorithm_info': 'algo_info', 'task': '"""criterion"""'}), "(internal_criterion_and_derivative, algorithm_info=\n algo_info, task='criterion')\n", (6690, 6774), False, 'import functools\n'), ((7916, 7993), 'functools....
from __future__ import print_function from cepbp.common.input_testing import TestInputs from cepbp.common.logs import Logs from cepbp.common.custom_error_handler import CustomError from cepbp.areas import Areas from cepbp.perimeters import Perimeters import configparser import logging import sys import numpy as np cl...
[ "cepbp.common.input_testing.TestInputs.__init__", "cepbp.common.logs.Logs", "cepbp.common.custom_error_handler.CustomError", "numpy.isinf" ]
[((1278, 1303), 'cepbp.common.input_testing.TestInputs.__init__', 'TestInputs.__init__', (['self'], {}), '(self)\n', (1297, 1303), False, 'from cepbp.common.input_testing import TestInputs\n'), ((1476, 1482), 'cepbp.common.logs.Logs', 'Logs', ([], {}), '()\n', (1480, 1482), False, 'from cepbp.common.logs import Logs\n'...