code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities to fit dark matter spectra to castro data """ from __future__ import absolute_import, division, print_function from functools import partial import numpy as np import scipy.optimize as opt from scipy.interpolate import splrep, splev from f...
[ "scipy.optimize.fmin", "functools.partial", "fermipy.castro.Interpolator", "numpy.log", "numpy.sum", "scipy.optimize.brentq", "numpy.zeros", "numpy.array", "numpy.exp", "scipy.interpolate.splev", "scipy.interpolate.splrep" ]
[((1939, 1962), 'numpy.log', 'np.log', (['self._nuis_norm'], {}), '(self._nuis_norm)\n', (1945, 1962), True, 'import numpy as np\n'), ((5849, 5869), 'numpy.array', 'np.array', (['x'], {'ndmin': '(1)'}), '(x, ndmin=1)\n', (5857, 5869), True, 'import numpy as np\n'), ((6323, 6343), 'numpy.array', 'np.array', (['x'], {'nd...
# coding: utf-8 # ## neural network trained on kmers using numpy # Steps: # 1. load data # 2. find dimensions of the data # 3. standardize the data? # 4. build a model # 5. train the model # In[1]: import sys import time import numpy as np import pandas as pd import sklearn.utils from keras.models import Sequenti...
[ "numpy.zeros", "numpy.ones", "time.time", "keras.layers.Dense", "pandas.read_table", "keras.models.Sequential", "pandas.concat" ]
[((3061, 3073), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (3071, 3073), False, 'from keras.models import Sequential\n'), ((3374, 3386), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (3384, 3386), False, 'from keras.models import Sequential\n'), ((4306, 4317), 'time.time', 'time.time', ([],...
""" Artists and functions for generating plots and plot elements. """ from matplotlib.collections import LineCollection from matplotlib.colors import Normalize import matplotlib.pyplot as plt import numpy as np from .arrays import find_groups def cmapline(x, y, c, ax=None, cmap=None, **fmt): """Plot a continuou...
[ "matplotlib.collections.LineCollection", "numpy.logical_and", "matplotlib.colors.Normalize", "matplotlib.pyplot.draw_if_interactive", "numpy.array", "numpy.exp", "matplotlib.pyplot.gca", "numpy.squeeze", "numpy.concatenate" ]
[((952, 1001), 'numpy.concatenate', 'np.concatenate', (['[points[:-1], points[1:]]'], {'axis': '(1)'}), '([points[:-1], points[1:]], axis=1)\n', (966, 1001), True, 'import numpy as np\n'), ((1014, 1027), 'numpy.squeeze', 'np.squeeze', (['c'], {}), '(c)\n', (1024, 1027), True, 'import numpy as np\n'), ((1201, 1243), 'ma...
''' Type anomaly detection file ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import keras from keras.models import Sequential from keras.layers.core import Dense from tensorflow.keras import optimizers import keras.backend as K import json from sklearn.utils import shuffle import os impor...
[ "matplotlib.pyplot.title", "keras.models.load_model", "numpy.sum", "pandas.read_csv", "tensorflow.keras.optimizers.SGD", "keras.backend.abs", "matplotlib.pyplot.figure", "numpy.random.randint", "matplotlib.pyplot.tight_layout", "numpy.unique", "os.path.exists", "pandas.concat", "theano.tenso...
[((9193, 9213), 'numpy.isinf', 'np.isinf', (['clip_value'], {}), '(clip_value)\n', (9201, 9213), True, 'import numpy as np\n'), ((25394, 25407), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (25404, 25407), True, 'import matplotlib.pyplot as plt\n'), ((25412, 25428), 'matplotlib.pyplot.subplot', 'pl...
import pygame.surfarray as surfarray import numpy as np import pygame import pygame.camera import tensorflow as tf from tensorflow.keras.models import model_from_json import cv2 ## multi thread webcam ## https://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/ def load_model(json_model,...
[ "cv2.putText", "numpy.argmax", "pygame.display.set_mode", "pygame.init", "pygame.camera.Camera", "pygame.display.update", "pygame.surfarray.make_surface", "numpy.array", "cv2.CascadeClassifier", "pygame.surfarray.array3d", "pygame.camera.init", "cv2.resize", "tensorflow.keras.models.model_fr...
[((911, 990), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""../face_detection//haarcascade_frontalface_default.xml"""'], {}), "('../face_detection//haarcascade_frontalface_default.xml')\n", (932, 990), False, 'import cv2\n'), ((1039, 1052), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1050, 1052), False, ...
import os import collections import json import logging import subprocess from tqdm import tqdm import numpy as np from pyquaternion import Quaternion from smoke.utils.miscellaneous import mkdir ID_TYPE_CONVERSION = { 0: 'bicycle', 1: 'bus', 2: 'car', 3: 'construction_vehicle', 4: 'motorcycle', ...
[ "json.dump", "smoke.utils.miscellaneous.mkdir", "numpy.arctan2", "collections.defaultdict", "numpy.sin", "numpy.array", "numpy.cos", "numpy.dot", "os.path.join", "logging.getLogger" ]
[((493, 520), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (510, 520), False, 'import logging\n'), ((1112, 1147), 'os.path.join', 'os.path.join', (['output_folder', '"""data"""'], {}), "(output_folder, 'data')\n", (1124, 1147), False, 'import os\n'), ((1175, 1196), 'smoke.utils.miscella...
import pickle import os import numpy as np from sklearn.model_selection import train_test_split, cross_val_score from sklearn.metrics import classification_report, confusion_matrix from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedShuffleSplit ''' Import os package which u...
[ "sklearn.ensemble.RandomForestClassifier", "pickle.dump", "sklearn.model_selection.train_test_split", "os.path.realpath", "sklearn.tree.DecisionTreeClassifier", "sklearn.metrics.classification_report", "pickle.load", "numpy.array", "sklearn.metrics.confusion_matrix", "os.listdir", "numpy.vstack"...
[((545, 565), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (555, 565), False, 'import os\n'), ((753, 776), 'pickle.load', 'pickle.load', (['first_file'], {}), '(first_file)\n', (764, 776), False, 'import pickle\n'), ((1251, 1298), 'numpy.array', 'np.array', (["[scene_info[i]['ball'][0] for i in k]"],...
# Copyright Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" ...
[ "numpy.argmax", "numpy.logical_not", "random.choice", "numpy.where", "numpy.array" ]
[((4684, 4700), 'numpy.array', 'np.array', (['action'], {}), '(action)\n', (4692, 4700), True, 'import numpy as np\n'), ((4727, 4744), 'numpy.argmax', 'np.argmax', (['action'], {}), '(action)\n', (4736, 4744), True, 'import numpy as np\n'), ((5944, 5971), 'random.choice', 'random.choice', (['[0, 1, 2, 3]'], {}), '([0, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Main module of wod_prof_db.""" import argparse import numpy as np import glob import os from wodpy import wod import subprocess def get_prof_data(profile): nlevs = profile.n_levels() year, mon, day = profile.year(), profile.month(), profile.day() p_datet...
[ "argparse.ArgumentParser", "wodpy.wod.WodProfile", "os.path.isdir", "subprocess.check_output", "os.system", "numpy.savez_compressed", "numpy.diff", "numpy.array", "glob.glob" ]
[((2323, 2395), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""setup WOD profile lookup database"""'}), "(description='setup WOD profile lookup database')\n", (2346, 2395), False, 'import argparse\n'), ((4795, 5218), 'numpy.array', 'np.array', (['dbase'], {'dtype': "[('probe_type', '|S21...
#!/usr/bin/env python3 import argparse import os import sys import time import subprocess import logging import cv2 import numpy as np from openvino.inference_engine import IENetwork, IECore try: from tqdm import tqdm except BaseException: tqdm = None logger = logging.getLogger(__name__) class Queue: ...
[ "numpy.load", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "os.path.isfile", "cv2.rectangle", "cv2.imshow", "os.path.join", "openvino.inference_engine.IECore", "cv2.destroyAllWindows", "cv2.resize", "os.stat", "cv2.waitKey", "tqdm.tqdm.write", "cv2.putText", "openvino.inference_e...
[((274, 301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (291, 301), False, 'import logging\n'), ((5750, 5761), 'time.time', 'time.time', ([], {}), '()\n', (5759, 5761), False, 'import time\n'), ((7179, 7190), 'time.time', 'time.time', ([], {}), '()\n', (7188, 7190), False, 'import ti...
import numpy as np import matplotlib.pyplot as plt from sklearn import metrics from sklearn.metrics import roc_auc_score from .metrics import EffectSize def plot_effect_size( X, treatment, weight=None, ascending=False, sortbyraw=True, figsize=(12, 6), threshold=0.2): """Plot the effects of the i...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "sklearn.metrics.roc_curve", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "numpy.argsort", "sklearn.metrics.auc", "matplotlib.pyplot.figure", "numpy.linspa...
[((1328, 1355), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (1338, 1355), True, 'import matplotlib.pyplot as plt\n'), ((1360, 1386), 'matplotlib.pyplot.title', 'plt.title', (['"""Standard Diff"""'], {}), "('Standard Diff')\n", (1369, 1386), True, 'import matplotlib.pyp...
import os import json import argparse import numpy as np from tqdm import tqdm if __name__ == '__main__': parser = argparse.ArgumentParser(description='Interpolate runs') parser.add_argument('--run1', required=True, help='retrieval run1') parser.add_argument('--run2', required=True, help='retrieval run2') ...
[ "os.makedirs", "argparse.ArgumentParser", "os.path.exists", "numpy.arange", "os.path.join" ]
[((120, 175), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Interpolate runs"""'}), "(description='Interpolate runs')\n", (143, 175), False, 'import argparse\n'), ((811, 867), 'numpy.arange', 'np.arange', (['args.start_weight', 'args.end_weight', 'args.step'], {}), '(args.start_weight, ...
# ''' # Written by <NAME> and Improved by us # Refer[Original Code]: https://github.com/gregversteeg/NPEET # ''' import numpy as np from scipy.special import digamma from scipy.spatial import cKDTree # CONTINUOUS ESTIMATORS def entropy(x, k=3): """ The classic K-L k-nearest neighbor continuous entropy estimator ...
[ "numpy.log", "numpy.random.random_sample", "numpy.asarray", "scipy.special.digamma", "scipy.spatial.cKDTree" ]
[((475, 488), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (485, 488), True, 'import numpy as np\n'), ((1344, 1357), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1354, 1357), True, 'import numpy as np\n'), ((1817, 1827), 'scipy.spatial.cKDTree', 'cKDTree', (['x'], {}), '(x)\n', (1824, 1827), False, 'fr...
# Copyright 2019 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 agree...
[ "numpy.zeros_like", "numpy.zeros", "importlib.import_module" ]
[((839, 890), 'importlib.import_module', 'importlib.import_module', (["('mtl.config.' + opt.config)"], {}), "('mtl.config.' + opt.config)\n", (862, 890), False, 'import importlib\n'), ((955, 997), 'numpy.zeros', 'np.zeros', (['(opt.num_samples, self.num_exps)'], {}), '((opt.num_samples, self.num_exps))\n', (963, 997), ...
#!/usr/bin/env python """ """ # Script information for the file. __author__ = "<NAME> (<EMAIL>)" __version__ = "" __date__ = "" __copyright__ = "Copyright (c) 2011 <NAME>" __license__ = "" # Standard library modules. import unittest import logging import os.path import tempfile import shutil # Third...
[ "logging.error", "unittest.TestCase.setUp", "shutil.rmtree", "pymcxray.serialization.SerializationNumpy.SerializationNumpyNPY", "pymcxray.serialization.SerializationNumpy.SerializationNumpyTxt", "pymcxray.serialization.SerializationNumpy.SerializationNumpyNPZ", "numpy.ones", "pymcxray.Testings.runTest...
[((4444, 4459), 'pymcxray.Testings.runTestModule', 'runTestModule', ([], {}), '()\n', (4457, 4459), False, 'from pymcxray.Testings import runTestModule\n'), ((592, 621), 'unittest.TestCase.setUp', 'unittest.TestCase.setUp', (['self'], {}), '(self)\n', (615, 621), False, 'import unittest\n'), ((649, 695), 'tempfile.mkdt...
import numpy as np import matplotlib.pyplot as plt import astropy.constants as con import utils as utl import covariance as cov import os # Defining kappa sol_lum = (con.L_sun*1e7).value kap_uv = 2.2e-10/sol_lum # Range of Luminosities (or absolute magnitudes) used mags_all = np.linspace(-24, -13, 10) lums_all = utl....
[ "utils.m_to_l_wave", "matplotlib.pyplot.show", "numpy.abs", "utils.log_err", "os.getcwd", "matplotlib.pyplot.legend", "covariance.sfrd_w_err", "matplotlib.pyplot.figure", "numpy.array", "numpy.loadtxt", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.p...
[((279, 304), 'numpy.linspace', 'np.linspace', (['(-24)', '(-13)', '(10)'], {}), '(-24, -13, 10)\n', (290, 304), True, 'import numpy as np\n'), ((316, 347), 'utils.m_to_l_wave', 'utl.m_to_l_wave', (['mags_all', '(1500)'], {}), '(mags_all, 1500)\n', (331, 347), True, 'import utils as utl\n'), ((608, 622), 'os.listdir', ...
import torch.nn as nn from .layer import Layer import numpy as np # FIXME should not inherit from Layer anymore class Dropout(Layer): """Represents a max pooling layer.""" def __init__(self, p=None): super().__init__() self.p = p def setup(self): super().setup() if self.p...
[ "torch.nn.Dropout", "numpy.random.randint" ]
[((443, 463), 'torch.nn.Dropout', 'nn.Dropout', ([], {'p': 'self.p'}), '(p=self.p)\n', (453, 463), True, 'import torch.nn as nn\n'), ((351, 374), 'numpy.random.randint', 'np.random.randint', (['(0)', '(7)'], {}), '(0, 7)\n', (368, 374), True, 'import numpy as np\n')]
"""@package util misc. utility functions used in limix modules and demos """ import numpy as np import scipy as sp import scipy as SP import pdb, sys, pickle import matplotlib.pylab as plt import scipy.stats as st import scipy.interpolate def mean_impute(X, imissX=None, maxval=2.0): if imissX is None: i...
[ "numpy.ones", "scipy.concatenate", "numpy.isnan", "numpy.sqrt" ]
[((1281, 1304), 'scipy.concatenate', 'SP.concatenate', (['pos_new'], {}), '(pos_new)\n', (1295, 1304), True, 'import scipy as SP\n'), ((328, 339), 'numpy.isnan', 'np.isnan', (['X'], {}), '(X)\n', (336, 339), True, 'import numpy as np\n'), ((406, 422), 'numpy.ones', 'np.ones', (['X.shape'], {}), '(X.shape)\n', (413, 422...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
[ "numpy.sum", "numpy.negative", "numpy.shape", "akg.topi.expand_dims", "akg.topi.subtract", "akg.topi.multiply", "numpy.full", "numpy.multiply", "akg.topi.full", "comm_functions.test_single_out", "numpy.add", "akg.schedule", "comm_functions.test_multi_out", "akg.topi.broadcast_to", "numpy...
[((6196, 6228), 'akg.schedule', 'akg.schedule', (['schedule_injective'], {}), '(schedule_injective)\n', (6208, 6228), False, 'import akg\n'), ((1114, 1153), 'akg.topi.full', 'topi.full', (['[640]', '"""float32"""', '(0.00130208)'], {}), "([640], 'float32', 0.00130208)\n", (1123, 1153), True, 'import akg.topi as topi\n'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import cos, sin import numpy as np import pytest from aeroframe.interpol.translate import get_deformed_mesh @pytest.fixture def target_mesh(): mesh = np.array([ [0, 1, 0], [1, 1, 0], ]) return mesh def test_mesh_deformation(targ...
[ "numpy.allclose", "aeroframe.interpol.translate.get_deformed_mesh", "math.sin", "numpy.array", "math.cos", "numpy.linspace" ]
[((216, 248), 'numpy.array', 'np.array', (['[[0, 1, 0], [1, 1, 0]]'], {}), '([[0, 1, 0], [1, 1, 0]])\n', (224, 248), True, 'import numpy as np\n'), ((494, 562), 'numpy.array', 'np.array', (['[[0, 0, 0, 2, 2, 2, 0, 0, 0], [1, 0, 0, 4, 4, 4, 0, 0, 0]]'], {}), '([[0, 0, 0, 2, 2, 2, 0, 0, 0], [1, 0, 0, 4, 4, 4, 0, 0, 0]])\...
import pandas as pd import numpy as np import glob import HP from multiprocessing import Pool def merge_assessment_score(df): new_df = pd.DataFrame() for note in note_list: tmp = df.loc[df['note_id'] == note] score_list = tmp.score.unique() if 'No score' in score_list: if t...
[ "pandas.DataFrame", "numpy.array_split", "pandas.read_parquet", "multiprocessing.Pool" ]
[((141, 155), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (153, 155), True, 'import pandas as pd\n'), ((1358, 1385), 'numpy.array_split', 'np.array_split', (['df', 'n_cores'], {}), '(df, n_cores)\n', (1372, 1385), True, 'import numpy as np\n'), ((1397, 1410), 'multiprocessing.Pool', 'Pool', (['n_cores'], {}),...
import numpy as np from strategies.probability_calculation import DistributionBelief as DB from strategies.probability_calculation import aggregate_distribution as agg dic=['liar','spot-on'] # only for easy read # def roll_dice(num): # """ This is a function simulate dice rolling # Arguments: # ...
[ "numpy.argmax", "numpy.zeros", "strategies.probability_calculation.DistributionBelief", "numpy.all", "numpy.sqrt" ]
[((3556, 3600), 'strategies.probability_calculation.DistributionBelief', 'DB', (['self.dice', 'total_dice', 'call_level', 'bluff'], {}), '(self.dice, total_dice, call_level, bluff)\n', (3558, 3600), True, 'from strategies.probability_calculation import DistributionBelief as DB\n'), ((4302, 4356), 'strategies.probabilit...
import unittest from typing import List import numpy as np import numpy.typing as npt import torch from nuplan.planning.training.modeling.objectives.agents_imitation_objective import AgentsImitationObjective from nuplan.planning.training.preprocessing.features.agents_trajectories import AgentsTrajectories class Tes...
[ "unittest.main", "nuplan.planning.training.preprocessing.features.agents_trajectories.AgentsTrajectories", "numpy.array", "nuplan.planning.training.modeling.objectives.agents_imitation_objective.AgentsImitationObjective", "torch.tensor" ]
[((2099, 2114), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2112, 2114), False, 'import unittest\n'), ((1208, 1234), 'nuplan.planning.training.modeling.objectives.agents_imitation_objective.AgentsImitationObjective', 'AgentsImitationObjective', ([], {}), '()\n', (1232, 1234), False, 'from nuplan.planning.train...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 23/10/17 @author: <NAME> """ import numpy as np import time, sys import scipy.sparse as sps class Compute_Similarity_Euclidean: def __init__(self, dataMatrix, topK=100, shrink = 0, normalize=False, normalize_avg_row=False, similari...
[ "numpy.atleast_2d", "scipy.sparse.diags", "numpy.sum", "numpy.multiply", "numpy.log", "numpy.ones", "time.time", "numpy.argsort", "scipy.sparse.csr_matrix", "sys.stdout.flush", "numpy.exp", "sys.stderr.flush", "numpy.sqrt" ]
[((3269, 3280), 'time.time', 'time.time', ([], {}), '()\n', (3278, 3280), False, 'import time, sys\n'), ((3870, 3900), 'numpy.sqrt', 'np.sqrt', (['item_distance_initial'], {}), '(item_distance_initial)\n', (3877, 3900), True, 'import numpy as np\n'), ((8273, 8374), 'scipy.sparse.csr_matrix', 'sps.csr_matrix', (['(value...
from DataProcessor import DataProcessor from MLP import MLP import numpy as np n_fold = 10 train_file = "data/SemEval2018-T3-taskA.txt" test_file = "data/SemEval2018-T3_input_test_taskA.txt" train_data, test_data = DataProcessor().process_data(train_file, test_file, load_saved_data=False) k_fold_train, k_fold_valid =...
[ "numpy.average", "DataProcessor.DataProcessor.split_kfolds", "DataProcessor.DataProcessor", "numpy.array", "MLP.MLP", "numpy.column_stack" ]
[((321, 367), 'DataProcessor.DataProcessor.split_kfolds', 'DataProcessor.split_kfolds', (['train_data', 'n_fold'], {}), '(train_data, n_fold)\n', (347, 367), False, 'from DataProcessor import DataProcessor\n'), ((807, 838), 'numpy.average', 'np.average', (['mlp_predict'], {'axis': '(1)'}), '(mlp_predict, axis=1)\n', (8...
from itertools import cycle from functools import reduce, lru_cache from operator import and_, attrgetter from collections import Counter import pandas as pd import numpy as np from i2 import Pipe from funds.scrap.company_info_w_historical_metrics import ( get_simfin_src_store, JsonFiles, ) from funds.scrap....
[ "funds.scrap.company_info_w_historical_metrics.get_simfin_src_store", "funds.scrap.company_info_w_historical_metrics.JsonFiles", "operator.attrgetter", "numpy.where", "collections.Counter", "funds.scrap.company_info_prep.get_companies_info", "pandas.concat" ]
[((3156, 3178), 'pandas.concat', 'pd.concat', (['dfs'], {'axis': '(1)'}), '(dfs, axis=1)\n', (3165, 3178), True, 'import pandas as pd\n'), ((4177, 4252), 'pandas.concat', 'pd.concat', (['dfs'], {'keys': 'keys', 'axis': '(0)', 'ignore_index': '(True)', 'verify_integrity': '(True)'}), '(dfs, keys=keys, axis=0, ignore_ind...
import numpy as np arr = np.array([[1, -0.5, 2], [0, 1, 2], [-2, -1.5, 0.75]]) print(arr) def get_back_in_range(array): mask = np.where(array > 1) array[mask] -= 1 mask = np.where(array < -1) array[mask] += 1 return array print(func(arr))
[ "numpy.where", "numpy.array" ]
[((26, 79), 'numpy.array', 'np.array', (['[[1, -0.5, 2], [0, 1, 2], [-2, -1.5, 0.75]]'], {}), '([[1, -0.5, 2], [0, 1, 2], [-2, -1.5, 0.75]])\n', (34, 79), True, 'import numpy as np\n'), ((166, 185), 'numpy.where', 'np.where', (['(array > 1)'], {}), '(array > 1)\n', (174, 185), True, 'import numpy as np\n'), ((219, 239)...
# imports import csv import functools import hashlib import logging import warnings from os.path import isfile as isfile import click import fbprophet import mlflow import mlflow.pyfunc import numpy as np import pandas as pd from elasticsearch import Elasticsearch from elasticsearch_dsl import Search from fbprophet im...
[ "elasticsearch.Elasticsearch", "fbprophet.Prophet", "mlflow.start_run", "mlflow.log_param", "numpy.random.seed", "logging.basicConfig", "warnings.filterwarnings", "pandas.read_csv", "json.loads", "click.option", "click.command", "os.path.isfile", "elasticsearch_dsl.Search", "pandas.to_date...
[((526, 565), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARN'}), '(level=logging.WARN)\n', (545, 565), False, 'import logging\n'), ((575, 602), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (592, 602), False, 'import logging\n'), ((3809, 3824), 'click.command'...
import numpy as np def soft_threshold(x, data): temp1 = (np.abs(x)-data)[np.newaxis, :] temp2 = np.zeros((1, len(x))) temp = np.append(temp1, temp2, axis=0) out = np.sign(x)*np.max(temp, axis=0) return out if __name__ =='__main__': x = np.array([1.2,-3.4,5,2]) data =0 print(soft_thresho...
[ "numpy.abs", "numpy.append", "numpy.max", "numpy.array", "numpy.sign" ]
[((137, 168), 'numpy.append', 'np.append', (['temp1', 'temp2'], {'axis': '(0)'}), '(temp1, temp2, axis=0)\n', (146, 168), True, 'import numpy as np\n'), ((261, 288), 'numpy.array', 'np.array', (['[1.2, -3.4, 5, 2]'], {}), '([1.2, -3.4, 5, 2])\n', (269, 288), True, 'import numpy as np\n'), ((179, 189), 'numpy.sign', 'np...
import os import torch import numpy as np from torchvision import datasets, transforms import torchtext from torch.utils.data import DataLoader, Dataset from base import BaseDataLoader from sklearn.preprocessing import MultiLabelBinarizer, normalize, LabelBinarizer, LabelEncoder from torch.utils.data.sampler import Sub...
[ "torch.utils.data.sampler.SubsetRandomSampler", "sklearn.preprocessing.LabelBinarizer", "torch.utils.data.DataLoader", "numpy.asarray", "numpy.unique", "torchvision.datasets.CIFAR100", "sklearn.preprocessing.MultiLabelBinarizer", "PIL.Image.open", "torchvision.datasets.CIFAR10", "torchvision.trans...
[((11574, 11615), 'torch.utils.data.DataLoader', 'DataLoader', (['german_dataset'], {'batch_size': '(16)'}), '(german_dataset, batch_size=16)\n', (11584, 11615), False, 'from torch.utils.data import DataLoader, Dataset\n'), ((662, 747), 'torchvision.datasets.CIFAR100', 'datasets.CIFAR100', (['self.data_dir'], {'train':...
#!/usr/bin/env python # -*- coding: utf-8 -*- from Tkinter import * import Tkinter import Similarity import numpy as np import rospy, math from std_msgs.msg import UInt8, String from sensor_msgs.msg import Imu from geometry_msgs.msg import Twist, Vector3 from ros_myo.msg import EmgArray import threading as th from cop...
[ "serial.Serial", "threading.Thread", "numpy.load", "copy.deepcopy", "rospy.Subscriber", "rospy.Publisher", "time.sleep", "numpy.array", "rospy.init_node", "Similarity.Similarity", "ttk.Combobox", "rospy.spin", "std_msgs.msg.UInt8" ]
[((5465, 5515), 'rospy.Publisher', 'rospy.Publisher', (['"""/init_pose"""', 'UInt8'], {'queue_size': '(1)'}), "('/init_pose', UInt8, queue_size=1)\n", (5480, 5515), False, 'import rospy, math\n'), ((5522, 5545), 'Similarity.Similarity', 'Similarity.Similarity', ([], {}), '()\n', (5543, 5545), False, 'import Similarity\...
# Import de packages externes import numpy as np import pandas as pd import matplotlib.pyplot as plt import copy from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import PCA from sklearn.manifold import TSNE from sklearn.manifold import MDS from sklearn.cluster import ...
[ "pandas.DataFrame", "sklearn.metrics.pairwise.cosine_distances", "copy.deepcopy", "sklearn.metrics.pairwise.cosine_similarity", "sklearn.metrics.pairwise.manhattan_distances", "sklearn.manifold.TSNE", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.cluster.KMeans", "numpy.vdot", "numpy...
[((616, 667), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'min_df': 'seuil_min', 'max_df': 'seuil_max'}), '(min_df=seuil_min, max_df=seuil_max)\n', (631, 667), False, 'from sklearn.feature_extraction.text import TfidfVectorizer\n'), ((841, 887), 'pandas.DataFrame', 'pd.DataFrame', (['den...
import numpy as np from collections import Counter from board import Board class Solver: def __init__(self): pass @staticmethod def solve(grid, search_for_all_solutions=False): table = np.array([[grid[j, i] or set(range(1, 10)) for i in range(9)] for j in range(...
[ "board.Board", "numpy.array", "selenium.webdriver.Chrome" ]
[((3524, 3542), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (3540, 3542), False, 'from selenium import webdriver\n'), ((4249, 4267), 'numpy.array', 'np.array', (['([0] * 81)'], {}), '([0] * 81)\n', (4257, 4267), True, 'import numpy as np\n'), ((5105, 5121), 'board.Board', 'Board', ([], {'n_drop':...
from .Data import Data import numpy as np class DataAutoPatternExtractionAgent(Data): def __init__(self, data, state_mode, action_name, device, gamma, n_step=4, batch_size=50, window_size=1, transaction_cost=0.0): """ This data dedicates to non-sequential models. For this, we pure...
[ "numpy.array", "numpy.concatenate" ]
[((2179, 2234), 'numpy.concatenate', 'np.concatenate', (['[self.data_preprocessed, trend]'], {'axis': '(1)'}), '([self.data_preprocessed, trend], axis=1)\n', (2193, 2234), True, 'import numpy as np\n'), ((2495, 2556), 'numpy.concatenate', 'np.concatenate', (['[self.data_preprocessed, candle_data]'], {'axis': '(1)'}), '...
#! /usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'maxim' import math import numpy as np from scipy import stats class BaseUtility(object): """ Utility (aka acquisition) is a function that evaluates a potential of the points in high-dimensional spaces. Utility can use prior information about the tru...
[ "numpy.abs", "numpy.eye", "numpy.log", "numpy.einsum", "scipy.stats.norm.pdf", "scipy.stats.norm.cdf", "numpy.max", "numpy.array", "numpy.dot", "numpy.linalg.pinv" ]
[((553, 569), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (561, 569), True, 'import numpy as np\n'), ((588, 604), 'numpy.array', 'np.array', (['values'], {}), '(values)\n', (596, 604), True, 'import numpy as np\n'), ((1474, 1492), 'numpy.array', 'np.array', (['mu_prior'], {}), '(mu_prior)\n', (1482, 1492...
import logging import numpy as np from src.algorithms.ml.encoder import encode_peptides_to_predict from src.io.writer.labeled_peptides_writer import write_labeled_outputfile from src.model.encoding.extended_blomap import extended_blomap_dict console = logging.StreamHandler() formatter = logging.Formatter('%(asctime)s...
[ "numpy.asarray", "logging.StreamHandler", "src.io.writer.labeled_peptides_writer.write_labeled_outputfile", "logging.getLogger", "logging.Formatter", "src.algorithms.ml.encoder.encode_peptides_to_predict" ]
[((254, 277), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (275, 277), False, 'import logging\n'), ((290, 363), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (307, 363),...
# coding=UTF-8 # This Python file uses the following encoding: utf-8 import numpy as np import matplotlib.pyplot as plt from numpy import linalg from mpl_toolkits.mplot3d import Axes3D import matplotlib.cm as cmx from matplotlib.pyplot import MultipleLocator import os import astropy.coordinates as apycoords def visua...
[ "matplotlib.pyplot.title", "numpy.size", "matplotlib.pyplot.show", "numpy.dot", "numpy.square", "numpy.linalg.eigh", "matplotlib.pyplot.figure", "numpy.where", "numpy.sin", "matplotlib.pyplot.set_cmap", "numpy.linspace", "numpy.cos", "numpy.linalg.inv", "numpy.round", "matplotlib.pyplot....
[((819, 845), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (829, 845), True, 'import matplotlib.pyplot as plt\n'), ((899, 909), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (907, 909), True, 'import matplotlib.pyplot as plt\n'), ((1742, 1761), 'matplotlib.pyplo...
#!/usr/bin/env python2 """ Policy iteration for a finite markov decision process. """ # Dependencies from __future__ import division import numpy as np; npl = np.linalg import scipy.linalg as spl # State and action spaces S = [0, 1, 2] A = [0, 1] # Transition matrix for u=0 P0 = np.array([[ 1, 0, 0], ...
[ "numpy.zeros_like", "numpy.copy", "numpy.argmin", "numpy.array", "numpy.round", "numpy.all" ]
[((283, 330), 'numpy.array', 'np.array', (['[[1, 0, 0], [1, 0, 0], [0, 0.3, 0.7]]'], {}), '([[1, 0, 0], [1, 0, 0], [0, 0.3, 0.7]])\n', (291, 330), True, 'import numpy as np\n'), ((409, 466), 'numpy.array', 'np.array', (['[[0.4, 0, 0.6], [0.1, 0.6, 0.3], [0, 0.1, 0.9]]'], {}), '([[0.4, 0, 0.6], [0.1, 0.6, 0.3], [0, 0.1,...
# Opens the default audio devices and runs a VAD and a sound classifier on them import argparse import numpy as np import pyaudio import os import as_classification.ann_models import as_sound.detectors.VAD_nn import as_sound.features.extractFeatures parser = argparse.ArgumentParser(description='Classify input speech...
[ "argparse.ArgumentParser", "os.path.realpath", "numpy.swapaxes", "pyaudio.PyAudio", "numpy.fromstring" ]
[((262, 322), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Classify input speech"""'}), "(description='Classify input speech')\n", (285, 322), False, 'import argparse\n'), ((769, 786), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (784, 786), False, 'import pyaudio\n'), ((137...
import numpy as np _RTOL = 0. _ATOL = 1.E-12 # For setters implement check_type, check_value, flag_greens # For getters implement flag_greens # for functions implement check_type, check_value, flag_greens def flag_greens_on_get(func): def wrapper(obj): if not obj._uptodate: obj._compute_gree...
[ "numpy.allclose" ]
[((1325, 1374), 'numpy.allclose', 'np.allclose', (['ref_val', 'value'], {'rtol': '(0.0)', 'atol': '_ATOL'}), '(ref_val, value, rtol=0.0, atol=_ATOL)\n', (1336, 1374), True, 'import numpy as np\n')]
import numpy as np from nz_snow_tools.snow.clark2009_snow_model import snow_main_simple from nz_snow_tools.util.utils import make_regular_timeseries,convert_datetime_julian_day,convert_dt_to_hourdec,nash_sut, mean_bias, rmsd, mean_absolute_error import matplotlib.pylab as plt import datetime as dt import matplotlib.dat...
[ "netCDF4.Dataset", "csv.writer", "numpy.logical_and", "nz_snow_tools.eval.utils_Ambre.amount_snowmelt", "numpy.asarray", "numpy.genfromtxt", "nz_snow_tools.eval.utils_Ambre.maxmin", "numpy.cumsum", "datetime.datetime.strptime", "nz_snow_tools.eval.utils_Ambre.amount_precipitation", "nz_snow_tool...
[((2323, 2468), 'netCDF4.Dataset', 'nc.Dataset', (['"""C:/Users/Bonnamourar/Desktop/SIN/VCSN/VC_2007-2019/tseries_2007010122_2019013121_utc_topnet_Murchiso_strahler3-VC.nc"""', '"""r"""'], {}), "(\n 'C:/Users/Bonnamourar/Desktop/SIN/VCSN/VC_2007-2019/tseries_2007010122_2019013121_utc_topnet_Murchiso_strahler3-VC.nc'...
import copy import threading from LspAlgorithms.GeneticAlgorithms.Chromosome import Chromosome from LspAlgorithms.GeneticAlgorithms.Gene import Gene from LspInputDataReading.LspInputDataInstance import InputDataInstance import random import concurrent.futures import numpy as np from ParameterSearch.ParameterData impor...
[ "LspAlgorithms.GeneticAlgorithms.Gene.Gene", "copy.deepcopy", "random.shuffle", "LspAlgorithms.GeneticAlgorithms.Chromosome.Chromosome", "threading.Lock", "numpy.array_split", "LspInputDataReading.LspInputDataInstance.InputDataInstance.instance.demandsArray.sum" ]
[((561, 573), 'LspAlgorithms.GeneticAlgorithms.Chromosome.Chromosome', 'Chromosome', ([], {}), '()\n', (571, 573), False, 'from LspAlgorithms.GeneticAlgorithms.Chromosome import Chromosome\n'), ((2379, 2420), 'copy.deepcopy', 'copy.deepcopy', (['CrossOverNode.itemsToOrder'], {}), '(CrossOverNode.itemsToOrder)\n', (2392...
import numpy as np from random import random, randint def greedy_policy(q): """ choose the best action q (dict): {'bet': val1, 'fold': val2} Returns: string: best action """ return 'bet' if q['bet'] >= q['fold'] else 'fold' def eps_greedy_policy(q, eps=0.1): """ choose a ran...
[ "random.random", "numpy.exp" ]
[((1083, 1091), 'random.random', 'random', ([], {}), '()\n', (1089, 1091), False, 'from random import random, randint\n'), ((562, 570), 'random.random', 'random', ([], {}), '()\n', (568, 570), False, 'from random import random, randint\n'), ((947, 963), 'numpy.exp', 'np.exp', (["q['bet']"], {}), "(q['bet'])\n", (953, 9...
import os import argparse import random import numpy import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel from transformers import BertJapaneseTokeni...
[ "numpy.random.seed", "argparse.ArgumentParser", "LivedoorDataLoader.LivedoorDatasetPreprocesser", "torch.device", "torch.no_grad", "torch.nn.parallel.DistributedDataParallel", "torch.utils.data.distributed.DistributedSampler", "random.seed", "mlflow.log_metric", "model.BERTClassificationModel", ...
[((594, 611), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (605, 611), False, 'import random\n'), ((616, 639), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed)\n', (633, 639), False, 'import numpy\n'), ((644, 667), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (661,...
# -*- coding: utf-8 -*- """ Created on Wed May 22 16:58:10 2019 @author: sgs4167 """ import sys from flask_cors import CORS from flask import request,Flask,render_template,jsonify from werkzeug.utils import secure_filename import os import numpy as np import cv2 import base64 import uuid import threading import util ...
[ "flask_cors.CORS", "flask.jsonify", "numpy.random.randint", "cv2.rectangle", "cv2.imencode", "os.path.join", "os.path.abspath", "cv2.cvtColor", "os.path.exists", "flask.render_template", "util.safetycap_model_pic", "os.urandom", "threading.Thread", "werkzeug.utils.secure_filename", "uuid...
[((327, 342), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (332, 342), False, 'from flask import request, Flask, render_template, jsonify\n'), ((360, 374), 'os.urandom', 'os.urandom', (['(24)'], {}), '(24)\n', (370, 374), False, 'import os\n'), ((445, 478), 'os.path.join', 'os.path.join', (['APP_ROOT', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- r"""Provide the postural acceleration task. The postural task tries to bring the robot to a reference posture; that is, it minimizes the joint accelerations such that it gets close to the specified posture (given by the desired joint positions, velocities, and acceleration...
[ "numpy.dot", "numpy.asarray", "numpy.zeros" ]
[((5336, 5352), 'numpy.asarray', 'np.asarray', (['dq_d'], {}), '(dq_d)\n', (5346, 5352), True, 'import numpy as np\n'), ((6165, 6182), 'numpy.asarray', 'np.asarray', (['ddq_d'], {}), '(ddq_d)\n', (6175, 6182), True, 'import numpy as np\n'), ((4514, 4529), 'numpy.asarray', 'np.asarray', (['q_d'], {}), '(q_d)\n', (4524, ...
# to estimate flood control voluse from ReGeom data from datetime import datetime from datetime import date import os import numpy as np import pandas as pd import sys from dateutil.relativedelta import relativedelta print(os.path.basename(__file__)) ##### initial setting ------------------------------ tag = sys.arg...
[ "pandas.DataFrame", "os.path.basename", "pandas.read_csv", "numpy.percentile", "numpy.max", "os.path.isfile", "pandas.Series", "pandas.read_table", "sys.exit" ]
[((725, 746), 'pandas.read_csv', 'pd.read_csv', (['dam_file'], {}), '(dam_file)\n', (736, 746), True, 'import pandas as pd\n'), ((755, 784), 'pandas.read_csv', 'pd.read_csv', (['ReGeom_ErrorFile'], {}), '(ReGeom_ErrorFile)\n', (766, 784), True, 'import pandas as pd\n'), ((909, 945), 'pandas.DataFrame', 'pd.DataFrame', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- #https://qiita.com/kazukiii/items/df809d6cd5d7d1f57be3 import pandas as pd import numpy as np import math import random import matplotlib.pyplot as plt import seaborn as sns # サイクルあたりのステップ数 steps_per_cycle = 80 # 生成するサイクル数 number_of_cycles = 50 df = pd.DataFrame(np.ar...
[ "pandas.DataFrame", "keras.layers.core.Dense", "random.uniform", "keras.layers.core.Activation", "numpy.arange", "numpy.array", "keras.layers.recurrent.LSTM", "keras.models.Sequential", "matplotlib.pyplot.savefig" ]
[((591, 622), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""temp_output1.png"""'], {}), "('temp_output1.png')\n", (602, 622), True, 'import matplotlib.pyplot as plt\n'), ((1475, 1487), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1485, 1487), False, 'from keras.models import Sequential\n'), ((1879, 1...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from numpy.testing import assert_allclose import numpy as np import astropy.units as u from astropy.coordinates import SkyCoord from gammapy.data import DataStore from gammapy.datasets import MapDataset from gammapy.irf import EDispMap, EDisp...
[ "numpy.testing.assert_allclose", "pytest.fixture", "gammapy.maps.WcsGeom.create", "gammapy.makers.SafeMaskMaker", "gammapy.data.DataStore.from_dir", "gammapy.datasets.MapDataset.create", "numpy.linspace", "gammapy.maps.MapAxis.from_edges", "gammapy.utils.testing.requires_data", "astropy.coordinate...
[((486, 517), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (500, 517), False, 'import pytest\n'), ((989, 1004), 'gammapy.utils.testing.requires_data', 'requires_data', ([], {}), '()\n', (1002, 1004), False, 'from gammapy.utils.testing import requires_data\n'), ((5268, 528...
import os from collections import defaultdict import numbers import numpy as np from torch.utils.data.sampler import Sampler import sys import os.path as osp import scipy.io as scio def GenIdx( train_color_label, train_thermal_label): color_pos = [] unique_label_color = np.unique(train_color_label) for i i...
[ "os.makedirs", "os.path.dirname", "os.path.exists", "numpy.hstack", "numpy.arange", "numpy.random.choice", "numpy.unique" ]
[((280, 308), 'numpy.unique', 'np.unique', (['train_color_label'], {}), '(train_color_label)\n', (289, 308), True, 'import numpy as np\n'), ((535, 565), 'numpy.unique', 'np.unique', (['train_thermal_label'], {}), '(train_thermal_label)\n', (544, 565), True, 'import numpy as np\n'), ((1194, 1222), 'numpy.unique', 'np.un...
""" Dipole interacting with a topography one layer case For the initial state, you may either decide that a) the h+hb is constant over the topography (flat interface) b) h=H over the topography (bumped interface) Look at the PV evolution to understand the differences! """ import numpy as np fr...
[ "numpy.zeros_like", "parameters.Param", "grid.Grid", "numpy.exp", "rsw.RSW", "geostrophy.set_balance", "numpy.sqrt" ]
[((424, 431), 'parameters.Param', 'Param', ([], {}), '()\n', (429, 431), False, 'from parameters import Param\n'), ((1589, 1600), 'grid.Grid', 'Grid', (['param'], {}), '(param)\n', (1593, 1600), False, 'from grid import Grid\n'), ((1891, 1907), 'rsw.RSW', 'RSW', (['param', 'grid'], {}), '(param, grid)\n', (1894, 1907),...
import numpy as np import pandas as pd import globals as g import os # ---------- RETORNA O CABEÇALHO E A MATRIZ DE VALROES ---------------------------------------------------------------- def dataRead(filename): fileName = "Datasource/Datasets/" + filename + ".txt" try: with open(fileName, 'rb') as fi...
[ "numpy.max", "numpy.savetxt", "os.path.abspath", "numpy.genfromtxt" ]
[((1245, 1285), 'numpy.savetxt', 'np.savetxt', (['file', 'matrixPilhas'], {'fmt': '"""%s"""'}), "(file, matrixPilhas, fmt='%s')\n", (1255, 1285), True, 'import numpy as np\n'), ((1865, 1892), 'numpy.max', 'np.max', (['qtdPilhasAbertas', '(0)'], {}), '(qtdPilhasAbertas, 0)\n', (1871, 1892), True, 'import numpy as np\n')...
import pickle import numpy as np from xgboost import XGBClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score with open('train_featurized_5.p', 'rb') as f: train_dataset = pickle.load(f) train_dataset = np.array(train_dataset) with open('test_featurized_5.p'...
[ "sklearn.metrics.accuracy_score", "pickle.load", "numpy.array", "xgboost.XGBClassifier" ]
[((264, 287), 'numpy.array', 'np.array', (['train_dataset'], {}), '(train_dataset)\n', (272, 287), True, 'import numpy as np\n'), ((385, 407), 'numpy.array', 'np.array', (['test_dataset'], {}), '(test_dataset)\n', (393, 407), True, 'import numpy as np\n'), ((765, 780), 'xgboost.XGBClassifier', 'XGBClassifier', ([], {})...
import dnnlib.tflib as tflib from training import dataset import numpy as np tfrecord_dir = '../../datasets/cars_v5_512' tflib.init_tf({'gpu_options.allow_growth': True}) training_set = dataset.TFRecordDataset(tfrecord_dir, max_label_size='full', repeat=False, shuffle_mb=0) tflib.init_uninitialized_vars() batch_size...
[ "numpy.random.uniform", "dnnlib.tflib.init_uninitialized_vars", "numpy.argmax", "numpy.zeros", "numpy.expand_dims", "numpy.max", "numpy.arange", "numpy.random.choice", "numpy.round", "training.dataset.TFRecordDataset", "dnnlib.tflib.init_tf" ]
[((123, 172), 'dnnlib.tflib.init_tf', 'tflib.init_tf', (["{'gpu_options.allow_growth': True}"], {}), "({'gpu_options.allow_growth': True})\n", (136, 172), True, 'import dnnlib.tflib as tflib\n'), ((188, 280), 'training.dataset.TFRecordDataset', 'dataset.TFRecordDataset', (['tfrecord_dir'], {'max_label_size': '"""full""...
from util.util import base import numpy as np class solve_day(base): def __init__(self, type='data'): super().__init__(type=type) self.data = [x.split(' ') for x in self.data] self.data = [[x[0],[[int(x) for x in x.split('=')[1].split('..')] for x in x[1].split(',')]] for x in self.data] ...
[ "numpy.zeros", "numpy.sum" ]
[((340, 378), 'numpy.zeros', 'np.zeros', (['(101, 101, 101)'], {'dtype': '"""int"""'}), "((101, 101, 101), dtype='int')\n", (348, 378), True, 'import numpy as np\n'), ((1128, 1145), 'numpy.sum', 'np.sum', (['self.grid'], {}), '(self.grid)\n', (1134, 1145), True, 'import numpy as np\n')]
"""Electric grid models module.""" import cvxpy as cp import itertools from multimethod import multimethod import natsort import numpy as np import opendssdirect import pandas as pd import scipy.sparse as sp import scipy.sparse.linalg import typing import mesmo.config import mesmo.data_interface import mesmo.utils l...
[ "opendssdirect.Transformers.Next", "numpy.abs", "opendssdirect.Lines.First", "numpy.isnan", "opendssdirect.Circuit.Losses", "numpy.imag", "numpy.linalg.norm", "numpy.exp", "opendssdirect.Circuit.Name", "numpy.unique", "opendssdirect.Transformers.Count", "pandas.DataFrame", "opendssdirect.Ckt...
[((4270, 4331), 'pandas.Index', 'pd.Index', (["electric_grid_data.electric_grid_nodes['node_name']"], {}), "(electric_grid_data.electric_grid_nodes['node_name'])\n", (4278, 4331), True, 'import pandas as pd\n'), ((4358, 4391), 'pandas.Index', 'pd.Index', (["['source', 'no_source']"], {}), "(['source', 'no_source'])\n",...
# Copyright 2020 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, s...
[ "numpy.moveaxis", "monai.transforms.Resize", "numpy.expand_dims", "numpy.clip", "numpy.min", "numpy.max", "monai.utils.misc.ensure_tuple_rep", "skimage.io.imsave" ]
[((2711, 2767), 'skimage.io.imsave', 'io.imsave', (['file_name', 'data'], {'plugin': 'plugin'}), '(file_name, data, plugin=plugin, **plugin_args)\n', (2720, 2767), False, 'from skimage import io\n'), ((1993, 2026), 'monai.utils.misc.ensure_tuple_rep', 'ensure_tuple_rep', (['output_shape', '(2)'], {}), '(output_shape, 2...
import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import fft, ifft, fftfreq from scipy.integrate import simps from numba import jit @jit def ftcs_step(psi, dt, dx, E_T, V): d2psidx2 = (np.roll(psi, -1) - 2*psi + np.roll(psi, 1)) / dx**2 return psi + dt * (d2psidx2 / 2 - V * psi) @jit def c...
[ "matplotlib.pyplot.show", "scipy.fftpack.fftfreq", "matplotlib.pyplot.plot", "numpy.roll", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.linalg.norm", "numpy.exp", "numpy.linspace", "numpy.cos", "scipy.optimize.root", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "scipy.integ...
[((1041, 1063), 'numpy.linspace', 'np.linspace', (['(0)', 'L', 'N_x'], {}), '(0, L, N_x)\n', (1052, 1063), True, 'import numpy as np\n'), ((1117, 1130), 'numpy.zeros', 'np.zeros', (['N_x'], {}), '(N_x)\n', (1125, 1130), True, 'import numpy as np\n'), ((1233, 1251), 'scipy.integrate.simps', 'simps', (['(psi ** 2)', 'x']...
from io import BytesIO from PIL import Image import sys, random, argparse import numpy as np import math def covertImageToAscii(img, cols, scale, moreLevels): """ Given Image and dims (rows, cols) returns an m*n list of Images """ # gray scale level values from: # http://paulbourke.net/dat...
[ "io.BytesIO", "numpy.array" ]
[((680, 695), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (688, 695), True, 'import numpy as np\n'), ((938, 958), 'io.BytesIO', 'BytesIO', (['img.content'], {}), '(img.content)\n', (945, 958), False, 'from io import BytesIO\n')]
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Mon May 4 12:55:05 2015 @author: ddboline """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np from sklearn.linear_model import LinearRegres...
[ "sklearn.cross_validation.train_test_split", "load_data.load_data", "sklearn.metrics.roc_auc_score", "sklearn.ensemble.GradientBoostingClassifier", "numpy.expm1", "numpy.log1p" ]
[((756, 767), 'numpy.log1p', 'np.log1p', (['y'], {}), '(y)\n', (764, 767), True, 'import numpy as np\n'), ((1061, 1114), 'sklearn.cross_validation.train_test_split', 'train_test_split', (['xtrain', 'ytrain[:, 0]'], {'test_size': '(0.5)'}), '(xtrain, ytrain[:, 0], test_size=0.5)\n', (1077, 1114), False, 'from sklearn.cr...
import numpy as np import pylab import time def genSine(MAXFREQ=20,DUR=20,RATE=10000): print("generating sine wave ...") MULT=MAXFREQ/DUR/2 xs=np.arange(0,DUR,1/RATE) # time points for x axis zi=np.sqrt(np.arange(0,(xs[-1]**2)*MULT,1)/MULT) # zero intercept times ys=np.sin(2*np.pi*(...
[ "pylab.title", "pylab.show", "time.sleep", "pylab.savefig", "numpy.sin", "numpy.arange", "pylab.figure", "pylab.tight_layout", "pylab.plot" ]
[((150, 177), 'numpy.arange', 'np.arange', (['(0)', 'DUR', '(1 / RATE)'], {}), '(0, DUR, 1 / RATE)\n', (159, 177), True, 'import numpy as np\n'), ((304, 338), 'numpy.sin', 'np.sin', (['(2 * np.pi * xs ** 2 * MULT)'], {}), '(2 * np.pi * xs ** 2 * MULT)\n', (310, 338), True, 'import numpy as np\n'), ((884, 913), 'pylab.f...
# -*- coding: utf-8 -*- """ Created on Sat Dec 30 15:08:41 2017 @author: <NAME> """ import numpy as np from scipy.optimize import minimize_scalar import matplotlib.pyplot as plt import diffEquation as de def f(t, y): g = 10 c = g/4 A = np.array([[0, 1, 0, 0], [0, -c, 0, 0], ...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.rad2deg", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.array", "diffEquation.solve", "numpy.cos", "numpy.dot", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((653, 669), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (662, 669), True, 'import matplotlib.pyplot as plt\n'), ((1138, 1151), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (1148, 1151), True, 'import matplotlib.pyplot as plt\n'), ((1159, 1190), 'numpy.arange', 'np.ar...
# Copyright 2020 JD.com, Inc. Galileo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
[ "galileo.platform.utils.get_time_str", "galileo.platform.export.export", "tensorflow.summary.scalar", "timeit.default_timer", "collections.defaultdict", "numpy.mean", "numpy.array", "tensorflow.summary.create_file_writer", "tensorflow.python.eager.context.eager_mode" ]
[((948, 968), 'galileo.platform.export.export', 'export', (['"""galileo.tf"""'], {}), "('galileo.tf')\n", (954, 968), False, 'from galileo.platform.export import export\n'), ((1638, 1653), 'timeit.default_timer', 'default_timer', ([], {}), '()\n', (1651, 1653), False, 'from timeit import default_timer\n'), ((1737, 1754...
import psutil import time import torch import math from collections import deque import numpy as np from rlpyt.runners.base import BaseRunner from rlpyt.utils.quick_args import save__init__args from rlpyt.utils.seed import set_seed, make_seed from rlpyt.utils.logging import logger from rlpyt.utils.prog_bar import Pro...
[ "psutil.Process", "rlpyt.utils.logging.logger.record_tabular_misc_stat", "rlpyt.utils.logging.logger.dump_tabular", "rlpyt.utils.logging.logger.tabular_prefix", "time.time", "rlpyt.utils.logging.logger.set_iteration", "rlpyt.utils.logging.logger.prefix", "torch.set_num_threads", "rlpyt.utils.logging...
[((1694, 1710), 'psutil.Process', 'psutil.Process', ([], {}), '()\n', (1708, 1710), False, 'import psutil\n'), ((2360, 2379), 'rlpyt.utils.seed.set_seed', 'set_seed', (['self.seed'], {}), '(self.seed)\n', (2368, 2379), False, 'from rlpyt.utils.seed import set_seed, make_seed\n'), ((4209, 4220), 'time.time', 'time.time'...
# -*- coding: utf-8 -*- from scipy.interpolate import splprep from scipy.interpolate import splev from numpy.random import random from numpy import array from numpy import column_stack from numpy import cos from numpy import cumsum from numpy import linspace from numpy import logical_not from numpy import pi from nu...
[ "scipy.spatial.distance.cdist", "numpy.logical_not", "numpy.zeros", "numpy.argmin", "scipy.interpolate.splprep", "numpy.argsort", "numpy.sort", "numpy.random.random", "numpy.array", "numpy.row_stack", "numpy.linspace", "numpy.column_stack", "scipy.interpolate.splev", "numpy.reshape", "nu...
[((596, 613), 'numpy.row_stack', 'row_stack', (['glyphs'], {}), '(glyphs)\n', (605, 613), False, 'from numpy import row_stack\n'), ((903, 920), 'numpy.row_stack', 'row_stack', (['glyphs'], {}), '(glyphs)\n', (912, 920), False, 'from numpy import row_stack\n'), ((1132, 1151), 'numpy.argmin', 'argmin', (['glyph[:, 0]'], ...
#!/usr/bin/python import numpy as np; from perceptron import perceptron; from linmach import linmach; from confus import confus data=np.loadtxt('OCR_14x14'); N,L=data.shape; D=L-1; labs=np.unique(data[:,L-1]); C=labs.size; np.random.seed(23); perm=np.random.permutation(N); data=data[perm]; NTr=int(round(...
[ "numpy.random.seed", "numpy.concatenate", "numpy.zeros", "perceptron.perceptron", "numpy.loadtxt", "numpy.random.permutation", "numpy.unique" ]
[((140, 163), 'numpy.loadtxt', 'np.loadtxt', (['"""OCR_14x14"""'], {}), "('OCR_14x14')\n", (150, 163), True, 'import numpy as np\n'), ((196, 221), 'numpy.unique', 'np.unique', (['data[:, L - 1]'], {}), '(data[:, L - 1])\n', (205, 221), True, 'import numpy as np\n'), ((235, 253), 'numpy.random.seed', 'np.random.seed', (...
import os.path as osp import torch from torch_geometric.data import Data from torch_geometric.data import InMemoryDataset from torch_geometric.utils import to_undirected, add_self_loops from torch_sparse import coalesce from torch_geometric.io import read_txt_array import random import numpy as np import scipy.sparse...
[ "numpy.load", "torch_geometric.io.read_txt_array", "torch.LongTensor", "scipy.sparse.load_npz", "torch.bincount", "torch.load", "torch.FloatTensor", "torch_geometric.utils.add_self_loops", "torch_sparse.coalesce", "torch.save", "torch_geometric.data.Data", "torch.arange", "numpy.array", "n...
[((473, 515), 'torch_geometric.io.read_txt_array', 'read_txt_array', (['path'], {'sep': '""","""', 'dtype': 'dtype'}), "(path, sep=',', dtype=dtype)\n", (487, 515), False, 'from torch_geometric.io import read_txt_array\n'), ((1513, 1563), 'scipy.sparse.load_npz', 'sp.load_npz', (["(folder + f'new_{feature}_feature.npz'...
''' Author: <NAME>(<EMAIL>) Date: 1969-12-31 18:00:00 LastEditTime: 2022-04-08 23:40:46 LastEditors: <NAME>(<EMAIL>) Description: Helpful function FilePath: /projects/ELight/ops/utils.py ''' import numpy as np # math operations import torch import torch.nn as nn __all__ = ["weight_quantize_fn_log", "weight_to_quantiz...
[ "torch.tanh", "torch.stack", "numpy.log", "torch.cat", "torch.chunk", "torch.abs", "torch.log", "torch.tensor", "torch.logical_and" ]
[((11469, 11481), 'torch.abs', 'torch.abs', (['x'], {}), '(x)\n', (11478, 11481), False, 'import torch\n'), ((4749, 4761), 'torch.abs', 'torch.abs', (['x'], {}), '(x)\n', (4758, 4761), False, 'import torch\n'), ((11125, 11138), 'torch.tanh', 'torch.tanh', (['x'], {}), '(x)\n', (11135, 11138), False, 'import torch\n'), ...
import pygame import pygame.gfxdraw import numpy as np import random import math windowSize = 500 class Dot: def __init__(self,position,velocity=[0,0],radius=1): self.position = position self.velocity = velocity self.radius = radius self.connected = [] def velocity(self,veloc...
[ "pygame.quit", "random.randint", "random.uniform", "pygame.event.get", "pygame.display.set_mode", "numpy.power", "pygame.draw.aaline", "pygame.init", "pygame.display.flip", "pygame.display.set_caption", "pygame.time.Clock" ]
[((2046, 2059), 'pygame.init', 'pygame.init', ([], {}), '()\n', (2057, 2059), False, 'import pygame\n'), ((2068, 2087), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (2085, 2087), False, 'import pygame\n'), ((2149, 2178), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size'], {}), '(size)\n', (2...
from __future__ import print_function # utils import pickle import argparse import os import numpy as np from torch.nn import Module, Linear from torch.nn.functional import tanh import pandas as pd from sklearn.model_selection import train_test_split from functools import partial from urllib.request import urlretri...
[ "numpy.save", "sklearn.preprocessing.StandardScaler", "argparse.ArgumentParser", "pandas.read_csv", "numpy.asarray", "numpy.unique" ]
[((1821, 1844), 'pandas.read_csv', 'pd.read_csv', (['train_file'], {}), '(train_file)\n', (1832, 1844), True, 'import pandas as pd\n'), ((1863, 1885), 'pandas.read_csv', 'pd.read_csv', (['test_file'], {}), '(test_file)\n', (1874, 1885), True, 'import pandas as pd\n'), ((2008, 2024), 'sklearn.preprocessing.StandardScale...
""" Solve OT problem """ import numpy as np import matplotlib.pyplot as plt import ot class EarthMovers2D: dimension = '2D' def __init__(self, n: int): self.n = n # number of samples self.p = None self._set_positions() # Cost matrix self.M = None # OT matrix...
[ "numpy.sum", "matplotlib.pyplot.show", "numpy.random.random_sample", "matplotlib.pyplot.hist", "numpy.empty", "ot.dist", "ot.emd", "matplotlib.pyplot.subplots" ]
[((3918, 3928), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3926, 3928), True, 'import matplotlib.pyplot as plt\n'), ((487, 523), 'numpy.random.random_sample', 'np.random.random_sample', (['(self.n, 2)'], {}), '((self.n, 2))\n', (510, 523), True, 'import numpy as np\n'), ((568, 604), 'numpy.random.random_s...
import numpy as np import talib import time from binance.client import Client from binance.enums import * import Config # Trading Strategy -------------------------------------------------------------------------------------------------- class AlgorithmTrading: def __init__(self, mainkey, secretkey, l...
[ "time.asctime", "numpy.array", "talib.RSI", "binance.client.Client", "Config.api_keys" ]
[((7738, 7761), 'Config.api_keys', 'Config.api_keys', (['"""test"""'], {}), "('test')\n", (7753, 7761), False, 'import Config\n'), ((383, 409), 'binance.client.Client', 'Client', (['mainkey', 'secretkey'], {}), '(mainkey, secretkey)\n', (389, 409), False, 'from binance.client import Client\n'), ((1675, 1715), 'talib.RS...
import matplotlib.pyplot as plt import numpy as np import json from sklearn.metrics import roc_curve, auc plt.style.use('ggplot') from sklearn.metrics import confusion_matrix from src.support.cf_metrix import make_confusion_matrix # %matplotlib inline def acc_n_loss(history): acc = history.history['accuracy'] ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "matplotlib.pyplot.xlabel", "numpy.eye", "json.dump", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "numpy.concatenate", "matplotlib.pyplot.xlim",...
[((107, 130), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (120, 130), True, 'import matplotlib.pyplot as plt\n'), ((701, 755), 'matplotlib.pyplot.plot', 'plt.plot', (['epochs', 'acc', '"""bo"""'], {'label': '"""Training accuracy"""'}), "(epochs, acc, 'bo', label='Training acc...
r""" Localization of Fourier modes ============================= The Fourier modes (the eigenvectors of the graph Laplacian) can be localized in the spacial domain. As a consequence, graph signals can be localized in both space and frequency (which is impossible for Euclidean domains or manifolds, by the Heisenberg's ...
[ "matplotlib.lines.Line2D", "numpy.ones", "numpy.arange", "matplotlib.pyplot.subplots", "pygsp.graphs.Graph", "numpy.sqrt" ]
[((968, 1002), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(8, 8)'}), '(2, 2, figsize=(8, 8))\n', (980, 1002), True, 'from matplotlib import pyplot as plt\n'), ((1183, 1209), 'pygsp.graphs.Graph', 'pg.graphs.Graph', (['adjacency'], {}), '(adjacency)\n', (1198, 1209), True, 'import pygsp ...
import matplotlib import matplotlib.pyplot as plt import numpy as np from mach import MachSolver, Mesh, Vector num_magnets_true = 40 num_magnets = 160 mag_pitch = num_magnets // num_magnets_true num_slots = 24 start = 10 nturns = 1 torque = [] if __name__ == "__main__": for rotation in range(start, start+nturns...
[ "numpy.array", "mach.MachSolver" ]
[((5083, 5119), 'mach.MachSolver', 'MachSolver', (['"""Magnetostatic"""', 'options'], {}), "('Magnetostatic', options)\n", (5093, 5119), False, 'from mach import MachSolver, Mesh, Vector\n'), ((5180, 5205), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (5188, 5205), True, 'import numpy as...
# <NAME>, <EMAIL> # MSNE Research Internship Hybrid BCI # 03.03´4.2018 # class used for live EEG with a CNN for classification based on CNN-py by <NAME> from __future__ import print_function import sys sys.path.append('..\..') import numpy as np import gumpy from gumpy.data.nst_eeg_live import NST_EEG_...
[ "keras.models.load_model", "keras.models.Sequential", "numpy.floor", "numpy.ones", "numpy.clip", "keras.backend.image_dim_ordering", "os.path.isfile", "numpy.mean", "os.path.join", "sys.path.append", "numpy.std", "keras.layers.Flatten", "gumpy.utils.extract_trials_corrJB", "numpy.rollaxis"...
[((214, 239), 'sys.path.append', 'sys.path.append', (['"""..\\\\.."""'], {}), "('..\\\\..')\n", (229, 239), False, 'import sys\n'), ((1326, 1367), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'batch_input_shape'}), '(size=batch_input_shape)\n', (1343, 1367), True, 'import numpy as np\n'), ((1369, 1411), '...
import argparse import functools import numpy as np from torch import nn from torch.nn import functional as F from models.modules.munit_architecture.munit_generator import Conv2dBlock from models.modules.spade_architecture.normalization import get_nonspade_norm_layer from models.networks import BaseNetwork class Ms...
[ "numpy.ceil", "torch.nn.Sequential", "torch.nn.ModuleList", "torch.nn.functional.avg_pool2d", "torch.nn.Conv2d", "torch.nn.AvgPool2d", "torch.nn.LeakyReLU", "models.modules.munit_architecture.munit_generator.Conv2dBlock", "models.modules.spade_architecture.normalization.get_nonspade_norm_layer" ]
[((688, 754), 'torch.nn.AvgPool2d', 'nn.AvgPool2d', (['(3)'], {'stride': '(2)', 'padding': '[1, 1]', 'count_include_pad': '(False)'}), '(3, stride=2, padding=[1, 1], count_include_pad=False)\n', (700, 754), False, 'from torch import nn\n'), ((775, 790), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (788, 79...
# %% import os import numpy as np import matplotlib.pyplot as plt plt.rcParams['text.usetex'] = True def nearestRefraction(x_Value_Store, y_Value_Store, Single_x_Value): x_diffs = Single_x_Value-x_Value_Store if np.where(x_diffs==0)[0].size > 0: lowest=np.where(x_diffs==0)[0] elif np.wher...
[ "numpy.size", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.max", "numpy.vstack", "numpy.where", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join", "os.listdir", "matplotlib.pyplot.savefig" ]
[((1162, 1178), 'numpy.zeros', 'np.zeros', (['(1, 2)'], {}), '((1, 2))\n', (1170, 1178), True, 'import numpy as np\n'), ((1468, 1497), 'matplotlib.pyplot.figure', 'plt.figure', (['"""Intensity Graph"""'], {}), "('Intensity Graph')\n", (1478, 1497), True, 'import matplotlib.pyplot as plt\n'), ((1499, 1558), 'matplotlib....
import numpy as np def cvt1to3channels(one_channel): return np.stack((one_channel,)*3, axis=-1) def normalize_image(image): return 255*((image - np.min(image)) / (np.max(image) - np.min(image)))
[ "numpy.stack", "numpy.min", "numpy.max" ]
[((66, 103), 'numpy.stack', 'np.stack', (['((one_channel,) * 3)'], {'axis': '(-1)'}), '((one_channel,) * 3, axis=-1)\n', (74, 103), True, 'import numpy as np\n'), ((156, 169), 'numpy.min', 'np.min', (['image'], {}), '(image)\n', (162, 169), True, 'import numpy as np\n'), ((174, 187), 'numpy.max', 'np.max', (['image'], ...
import pandas as pd import numpy as np from RandomShapelets.RandomShapeletClassifier import RandomShapeletForest model = RandomShapeletForest(number_shapelets = 10, min_shapelet_length=5, max_shapelet_length=10) print(model) data = pd.read_csv('ShapeletForestTest.csv', sep = ';', decimal=b',', index_col = 0) print(da...
[ "pandas.read_csv", "RandomShapelets.RandomShapeletClassifier.RandomShapeletForest", "numpy.array", "pandas.DataFrame" ]
[((122, 214), 'RandomShapelets.RandomShapeletClassifier.RandomShapeletForest', 'RandomShapeletForest', ([], {'number_shapelets': '(10)', 'min_shapelet_length': '(5)', 'max_shapelet_length': '(10)'}), '(number_shapelets=10, min_shapelet_length=5,\n max_shapelet_length=10)\n', (142, 214), False, 'from RandomShapelets....
# -*- coding: utf-8 -*- #calculateCorrelation.py """ Created on Wed Mar 27 11:48:12 2019 Takes in Q curves in the form of a list of arrays and turns them into correlation curves at the various time spacings @author: Lionel """ import numpy as np """ qCurves: a list of 1d arrays of intensity RETURN: the array of all q ...
[ "numpy.array" ]
[((539, 556), 'numpy.array', 'np.array', (['qCurves'], {}), '(qCurves)\n', (547, 556), True, 'import numpy as np\n')]
import codecs import os import numpy from keras import regularizers from keras.initializers import Constant from keras.layers import Dense, Embedding, SpatialDropout1D, Input, Bidirectional, Dropout, \ BatchNormalization, Lambda, concatenate, Flatten, Conv1D, MaxPooling1D, CuDNNGRU from keras.models import Model fr...
[ "keras.models.load_model", "keras.regularizers.l2", "numpy.argmax", "keras.models.Model", "keras.layers.Input", "keras.layers.concatenate", "codecs.open", "keras.layers.Flatten", "keras.layers.MaxPooling1D", "os.path.basename", "scipy.sparse.load_npz", "keras.layers.Dropout", "keras.initiali...
[((1698, 1723), 'keras.layers.Input', 'Input', ([], {'shape': '(total_len,)'}), '(shape=(total_len,))\n', (1703, 1723), False, 'from keras.layers import Dense, Embedding, SpatialDropout1D, Input, Bidirectional, Dropout, BatchNormalization, Lambda, concatenate, Flatten, Conv1D, MaxPooling1D, CuDNNGRU\n'), ((3795, 3840),...
import unittest import numpy import itertools import theano from theano import tensor from theano.tests import unittest_tools as utt import theano.tensor.nnet.abstract_conv as conv from theano.sandbox.cuda import float32_shared_constructor as gpu_shared from theano.compile import shared as cpu_shared from theano.sandb...
[ "theano.tensor.ftensor4", "theano.tests.unittest_tools.assert_allclose", "theano.compile.mode.get_mode", "theano.compile.get_default_mode", "theano.compile.shared", "theano.compile.mode.get_default_mode", "theano.tensor.nnet.abstract_conv.conv2d", "itertools.product", "theano.sandbox.cuda.float32_sh...
[((663, 705), 'nose.plugins.skip.SkipTest', 'SkipTest', (['"""Optional package cuda disabled"""'], {}), "('Optional package cuda disabled')\n", (671, 705), False, 'from nose.plugins.skip import SkipTest\n'), ((3574, 3715), 'theano.tensor.nnet.abstract_conv.conv2d', 'conv.conv2d', (['inputs', 'filters'], {'border_mode':...
import numpy as np from numba import jit, njit, prange from PIL import Image @njit(parallel=True,nogil=True) def transposeImg(npimg): ret = np.zeros((npimg.shape[1], npimg.shape[0], 3), dtype=np.uint8) for i in prange(0, npimg.shape[0]): for j in range(0,npimg.shape[1]): for k in r...
[ "numba.njit", "numpy.zeros", "numpy.arange", "numba.prange", "PIL.Image.fromarray" ]
[((83, 114), 'numba.njit', 'njit', ([], {'parallel': '(True)', 'nogil': '(True)'}), '(parallel=True, nogil=True)\n', (87, 114), False, 'from numba import jit, njit, prange\n'), ((392, 423), 'numba.njit', 'njit', ([], {'parallel': '(True)', 'nogil': '(True)'}), '(parallel=True, nogil=True)\n', (396, 423), False, 'from n...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
[ "poker.hand.Combo", "poker.hand.Range", "flask.Flask", "flask.json.dumps", "numpy.mean", "calculation.holdem_calc.calculate_odds_villan", "flask.render_template", "flask.request.get_json" ]
[((828, 843), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (833, 843), False, 'from flask import Flask, render_template, redirect, url_for, request, json\n'), ((3624, 3653), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (3639, 3653), False, 'from flask import...
# -*- coding: utf-8 -*- """ Created on Mon Mar 6 15:05:01 2017 @author: <NAME> @email: <EMAIL> """ from pdb import set_trace import sys, dill, functools, itertools, copyreg, logging import pandas as pd import numpy as np # from joblib import Parallel, delayed # IMPORTANT: pathos is better than joblib # it uses di...
[ "numpy.random.seed", "numpy.sum", "sklearn.metrics.r2_score", "numpy.isnan", "dill.loads", "numpy.argsort", "numpy.isclose", "numpy.arange", "numpy.asscalar", "pathos.multiprocessing.ProcessingPool", "numpy.atleast_2d", "logging.FileHandler", "numpy.random.randn", "sklearn.cluster.KMeans",...
[((37537, 37556), 'numpy.random.seed', 'np.random.seed', (['(666)'], {}), '(666)\n', (37551, 37556), True, 'import numpy as np\n'), ((5406, 5453), 'numpy.array', 'np.array', (['[self._space.bounds[i] for i in mask]'], {}), '([self._space.bounds[i] for i in mask])\n', (5414, 5453), True, 'import numpy as np\n'), ((5534,...
# Author: <NAME> # Date: 3 Nov 2018 """Visualize examples and labels for given AutoDL dataset. Usage: `python data_browser.py -dataset_dir=/AutoDL_sample_data/miniciao` Full usage: `python data_browser.py -dataset_dir=/AutoDL_sample_data/miniciao -subset=test -num_examples=7` """ import os import sys import ten...
[ "playsound.playsound", "tensorflow.logging.info", "numpy.empty", "tensorflow.logging.set_verbosity", "matplotlib.animation.FuncAnimation", "numpy.random.randint", "os.path.join", "sys.path.append", "matplotlib.pyplot.imshow", "numpy.max", "numpy.loadtxt", "matplotlib.pyplot.subplots", "matpl...
[((612, 653), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (636, 653), True, 'import tensorflow as tf\n'), ((833, 891), 'os.path.join', 'os.path.join', (['STARTING_KIT_DIR', '"""AutoDL_ingestion_program"""'], {}), "(STARTING_KIT_DIR, 'AutoDL_ingestion...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "numpy.maximum", "numpy.argmax", "paddle.fluid.layers.multiclass_nms", "numpy.argsort", "paddle.fluid.layers.matrix_nms", "numpy.exp", "paddle.fluid.layers.reduce_prod", "paddle.fluid.layers.pool2d", "numpy.round", "paddle.fluid.LoDTensor", "numpy.unique", "paddle.fluid.layers.reduce_sum", "...
[((1346, 1368), 'numpy.maximum', 'np.maximum', (['x1_1', 'x1_2'], {}), '(x1_1, x1_2)\n', (1356, 1368), True, 'import numpy as np\n'), ((1379, 1401), 'numpy.maximum', 'np.maximum', (['y1_1', 'y1_2'], {}), '(y1_1, y1_2)\n', (1389, 1401), True, 'import numpy as np\n'), ((1412, 1434), 'numpy.minimum', 'np.minimum', (['x2_1...
from random import choice, random import numpy as np import time import pickle #assuming d1 is a dictionary that has all types of cell, and its shifts to left #similarly d2, but its values are shifts to right. with open('ds.pickle', 'rb') as var: ds = pickle.load(var) #list of dicts d1 = ds[0] #dictionary contai...
[ "numpy.asarray", "random.choice", "time.time", "random.random", "pickle.load", "numpy.arange" ]
[((258, 274), 'pickle.load', 'pickle.load', (['var'], {}), '(var)\n', (269, 274), False, 'import pickle\n'), ((1888, 1897), 'random.choice', 'choice', (['p'], {}), '(p)\n', (1894, 1897), False, 'from random import choice, random\n'), ((3323, 3394), 'numpy.asarray', 'np.asarray', (['[[2, 2, 0, 2], [4, 4, 0, 2], [32, 32,...
"""@package docstring This code is uesd for color detection. To run this code, you need to install OpenCV2 Then run it use python3 color_detection_cpp.py """ # import the necessary packages import numpy as np import imutils import cv2 import time import sys ## @var lower # define the lower boundaries of the colors ...
[ "cv2.GaussianBlur", "cv2.minEnclosingCircle", "cv2.cvtColor", "cv2.morphologyEx", "cv2.moments", "numpy.ones", "time.sleep", "cv2.VideoCapture", "sys.stdout.flush", "imutils.resize", "cv2.inRange" ]
[((773, 792), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (789, 792), False, 'import cv2\n'), ((1085, 1117), 'imutils.resize', 'imutils.resize', (['frame'], {'width': '(600)'}), '(frame, width=600)\n', (1099, 1117), False, 'import imutils\n'), ((1132, 1168), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (...
#!/usr/bin/env python3 from signals import SignalGenerationLayer, create_synthetic_dataset import os import numpy as np import argparse import configparser from model import EncoderTrainer import tensorflow as tf from tensorflow import keras import tensorflow_addons as tfa import wandb from wandb.keras import WandbC...
[ "tensorflow.random.set_seed", "wandb.log", "numpy.load", "numpy.random.seed", "argparse.ArgumentParser", "tensorflow.reshape", "os.path.isfile", "tensorflow.Variable", "tensorflow.image.random_crop", "tensorflow_addons.optimizers.SWA", "os.path.exists", "tensorflow.concat", "wandb.keras.Wand...
[((1158, 1229), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(real_data, predicted_distribution)'], {}), '((real_data, predicted_distribution))\n', (1192, 1229), True, 'import tensorflow as tf\n'), ((2891, 2908), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (289...
import numpy as np import pandas as pd import os if __name__ == '__main__': data_dir = 'data_reviews' x_train_df = pd.read_csv(os.path.join(data_dir, 'x_train.csv')) y_train_df = pd.read_csv(os.path.join(data_dir, 'y_train.csv')) N, n_cols = x_train_df.shape print("Shape of x_train_df: (%d, %d)" ...
[ "numpy.arange", "os.path.join" ]
[((516, 531), 'numpy.arange', 'np.arange', (['(0)', '(5)'], {}), '(0, 5)\n', (525, 531), True, 'import numpy as np\n'), ((704, 723), 'numpy.arange', 'np.arange', (['(N - 5)', 'N'], {}), '(N - 5, N)\n', (713, 723), True, 'import numpy as np\n'), ((137, 174), 'os.path.join', 'os.path.join', (['data_dir', '"""x_train.csv"...
from __future__ import division, print_function import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import logging from sklearn.preprocessing import MinMaxScaler from sklearn.decomposition import FactorAnalysis, FastICA, PCA, NMF...
[ "sklearn.decomposition.NMF", "sklearn.decomposition.FastICA", "os.mkdir", "logging.FileHandler", "os.path.isdir", "logging.StreamHandler", "sklearn.preprocessing.MinMaxScaler", "numpy.prod", "logging.Formatter", "sklearn.decomposition.FactorAnalysis", "sklearn.decomposition.PCA", "logging.getL...
[((514, 544), 'logging.getLogger', 'logging.getLogger', (['logger_name'], {}), '(logger_name)\n', (531, 544), False, 'import logging\n'), ((562, 607), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s: %(message)s"""'], {}), "('%(asctime)s: %(message)s')\n", (579, 607), False, 'import logging\n'), ((627, 685)...
import unittest import pytest import six import numpy as np import tensorflow as tf from mock import Mock from tfsnippet.stochastic import StochasticTensor from tfsnippet.utils import (is_integer, is_float, TensorWrapper, is_tensor_object, TensorArgValidator) if six.PY2: LONG_MAX = l...
[ "tfsnippet.utils.TensorWrapper", "tfsnippet.utils.is_tensor_object", "numpy.asarray", "tfsnippet.utils.is_float", "numpy.zeros", "tfsnippet.utils.is_integer", "tensorflow.constant", "tfsnippet.utils.TensorArgValidator", "pytest.raises", "mock.Mock", "tensorflow.get_variable" ]
[((2908, 2933), 'tfsnippet.utils.TensorArgValidator', 'TensorArgValidator', (['"""xyz"""'], {}), "('xyz')\n", (2926, 2933), False, 'from tfsnippet.utils import is_integer, is_float, TensorWrapper, is_tensor_object, TensorArgValidator\n'), ((3812, 3837), 'tfsnippet.utils.TensorArgValidator', 'TensorArgValidator', (['"""...
# -*- coding: utf-8 -*- """ Created on Wed Jul 25 13:01:41 2018 @author: ap18525 """ import numpy as np def sound_wave(): amp = 2.7 # amplitude phase = 0.6 # phase freq = 4.2 # frequency x = np.linspace(0,1,500) # x axis from 0 to 1 with a 1/500 step y = amp * np.sin(2 * np.pi * (freq * x + phase)...
[ "numpy.sin", "numpy.linspace" ]
[((209, 231), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(500)'], {}), '(0, 1, 500)\n', (220, 231), True, 'import numpy as np\n'), ((283, 321), 'numpy.sin', 'np.sin', (['(2 * np.pi * (freq * x + phase))'], {}), '(2 * np.pi * (freq * x + phase))\n', (289, 321), True, 'import numpy as np\n')]
from flosic_os import get_multiplicity,ase2pyscf,xyz_to_nuclei_fod,dynamic_rdm,flosic from flosic_scf import FLOSIC from ase.io import read from pyscf import gto,dft import numpy as np import matplotlib.pyplot as plt # This example shows how the density can be visualized on the numerical grid. # The routines provided ...
[ "flosic_os.ase2pyscf", "numpy.argsort", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "flosic_os.xyz_to_nuclei_fod", "pyscf.dft.UKS", "flosic_os.flosic", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "pyscf.dft.numint.eval_rho", "numpy.sort",...
[((755, 787), 'ase.io.read', 'read', (['"""H2_stretched_density.xyz"""'], {}), "('H2_stretched_density.xyz')\n", (759, 787), False, 'from ase.io import read\n'), ((820, 847), 'flosic_os.xyz_to_nuclei_fod', 'xyz_to_nuclei_fod', (['molecule'], {}), '(molecule)\n', (837, 847), False, 'from flosic_os import get_multiplicit...
# Licensed with the 3-clause BSD license. See LICENSE for details. """utility closet""" import struct import numpy as np from astropy.time import Time import astropy.coordinates as coords from astropy.coordinates import Angle from astropy.coordinates.angle_utilities import angular_separation import astropy.units as u ...
[ "astropy.coordinates.cartesian_to_spherical", "astropy.coordinates.angle_utilities.angular_separation", "numpy.size", "astropy.time.Time", "numpy.cross", "geoalchemy2.shape.to_shape", "numpy.sin", "numpy.array", "numpy.cos", "numpy.iterable", "astropy.coordinates.Angle" ]
[((5658, 5669), 'astropy.time.Time', 'Time', (['times'], {}), '(times)\n', (5662, 5669), False, 'from astropy.time import Time\n'), ((7786, 7800), 'numpy.cross', 'np.cross', (['a', 'b'], {}), '(a, b)\n', (7794, 7800), True, 'import numpy as np\n'), ((7886, 7919), 'astropy.coordinates.cartesian_to_spherical', 'coords.ca...
from contextlib import contextmanager from xml.dom import minidom import sys, os import numpy as np @contextmanager def hidden_prints(): with open(os.devnull, "w") as devnull: old_stdout = sys.stdout sys.stdout = devnull try: yield finally: sys.stdout = old_s...
[ "numpy.interp" ]
[((1145, 1182), 'numpy.interp', 'np.interp', (['x', 'xp', 'yp'], {'left': 'l', 'right': 'r'}), '(x, xp, yp, left=l, right=r)\n', (1154, 1182), True, 'import numpy as np\n')]
#!/usr/bin/env python3 """ Generate a set of agent demonstrations. The agent can either be a trained model or the heuristic expert (bot). Demonstration generation can take a long time, but it can be parallelized if you have a cluster at your disposal. Provide a script that launches make_agent_demos.py at your cluste...
[ "os.remove", "argparse.ArgumentParser", "babyai.utils.load_agent", "ipdb.set_trace", "numpy.mean", "babyai.utils.seed", "numpy.std", "os.path.exists", "babyai.utils.get_demos_path", "copy.deepcopy", "subprocess.check_output", "time.sleep", "gym.make", "logging.basicConfig", "time.time", ...
[((1146, 1190), 'os.environ.get', 'os.environ.get', (['"""BABYAI_DONE_ACTIONS"""', '(False)'], {}), "('BABYAI_DONE_ACTIONS', False)\n", (1160, 1190), False, 'import os\n'), ((1450, 1529), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatt...
import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter import yaml import numpy as np import time import argparse from pathlib import Path from dataset.dataset import AudioDataset from modules.generator import Generator from modules.mr_disc...
[ "modules.stft_losses.MultiResolutionSTFTLoss", "modules.helper_functions.save_sample", "modules.stft.Audio2Mel", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "torch.load", "yaml.dump", "numpy.asarray", "torch.randn", "torch.nn.functional.l1_loss", "time.time", "pathlib.Path", "t...
[((543, 568), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (566, 568), False, 'import argparse\n'), ((1618, 1638), 'pathlib.Path', 'Path', (['args.save_path'], {}), '(args.save_path)\n', (1622, 1638), False, 'from pathlib import Path\n'), ((3484, 3584), 'torch.utils.data.DataLoader', 'DataLoa...