code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import copy import logging import numpy import theano from theano import tensor from theano.gradient import disconnected_grad from blocks.bricks import ( Bias, Identity, Initializable, MLP, Tanh, Softmax, Random) from blocks.bricks.attention import SequenceContentAttention from blocks.bricks.base import applicati...
[ "logging.getLogger", "theano.tensor.exp", "lvsr.bricks.attention.SequenceContentAndConvAttention", "theano.tensor.lscalar", "theano.tensor.roll", "blocks.bricks.attention.SequenceContentAttention", "lvsr.beam_search.BeamSearch", "theano.tensor.zeros_like", "numpy.array", "lvsr.utils.global_push_in...
[((1233, 1260), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1250, 1260), False, 'import logging\n'), ((2675, 2726), 'blocks.bricks.base.application', 'application', ([], {'inputs': "['inputs']", 'outputs': "['outputs']"}), "(inputs=['inputs'], outputs=['outputs'])\n", (2686, 2726), Fa...
import numpy as np import matplotlib.pyplot as plt def plot_hist_sum(data, r_labels, ylabel, xlabel, title, x_tick_labels=None, adjacent_bars=True): """ plots Histogram of sum plots multiple bars """ n_rows = len(r_labels) total_bars_width = 0.8 bar_width = total_bars_width / n_rows #...
[ "matplotlib.pyplot.subplots", "numpy.arange" ]
[((425, 454), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (437, 454), True, 'import matplotlib.pyplot as plt\n'), ((1398, 1427), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (1410, 1427), True, 'import matplotli...
""" Tests for the midgard.math.planetary_motion module""" # Third party imports import numpy as np # Midgard imports from midgard.data import time from midgard.math import planetary_motion def t_jd_gps(): """Time, format julian date, scale gps""" return time.Time(2457448.5, scale="gps", fmt="jd") def test...
[ "midgard.data.time.Time", "numpy.array", "numpy.testing.assert_allclose" ]
[((266, 309), 'midgard.data.time.Time', 'time.Time', (['(2457448.5)'], {'scale': '"""gps"""', 'fmt': '"""jd"""'}), "(2457448.5, scale='gps', fmt='jd')\n", (275, 309), False, 'from midgard.data import time\n'), ((406, 469), 'numpy.array', 'np.array', (['[-148102175.80162, -7980320.884334, -19534142.160482]'], {}), '([-1...
from src.params.ParamsPING import * from src.izhikevich_simulation.IzhikevichNetworkOutcome import * from src.params.ParamsFrequencies import * import numpy as np from math import floor, pi from scipy import fft import matplotlib.pyplot as plt from collections import Counter from tqdm import tqdm import warnings cl...
[ "numpy.abs", "scipy.fft.ifft", "matplotlib.pyplot.hist", "tqdm.tqdm", "warnings.catch_warnings", "numpy.count_nonzero", "numpy.array", "numpy.argwhere", "warnings.simplefilter", "scipy.fft.fft", "matplotlib.pyplot.subplots" ]
[((1780, 1810), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(30, 30)'}), '(figsize=(30, 30))\n', (1792, 1810), True, 'import matplotlib.pyplot as plt\n'), ((1885, 1935), 'matplotlib.pyplot.hist', 'plt.hist', (['frequencies'], {'color': '"""#ACDDE7"""', 'rwidth': '(0.7)'}), "(frequencies, color='#ACD...
import numpy as np import pandas as pd def rolling_window_sequences(X, window_size, target_size, value_column, time_column): """ Function that takes in a pandas.DataFrame and a window_size then creates output arrays that correspond to a timeseries sequence with window_size overlap. ...
[ "pandas.DataFrame", "numpy.asarray" ]
[((3295, 3361), 'pandas.DataFrame', 'pd.DataFrame', (['accepted_points'], {'columns': '[time_column, value_column]'}), '(accepted_points, columns=[time_column, value_column])\n', (3307, 3361), True, 'import pandas as pd\n'), ((1601, 1621), 'numpy.asarray', 'np.asarray', (['output_X'], {}), '(output_X)\n', (1611, 1621),...
# @Date : 2019-10-22 # @Author : <NAME> import os import numpy as np import math import torch import torch.nn as nn from torchvision.utils import make_grid from imageio import imsave from tqdm import tqdm from copy import deepcopy import logging from utils.inception_score import get_inception_score from utils.fid...
[ "logging.getLogger", "numpy.random.normal", "torch.nn.ReLU", "os.makedirs", "math.floor", "imageio.imsave", "torch.mean", "tqdm.tqdm", "os.path.join", "utils.inception_score.get_inception_score", "torchvision.utils.make_grid", "utils.fid_score.calculate_fid_given_paths" ]
[((455, 482), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (472, 482), False, 'import logging\n'), ((5942, 6006), 'torchvision.utils.make_grid', 'make_grid', (['sample_imgs'], {'nrow': '(10)', 'normalize': '(True)', 'scale_each': '(True)'}), '(sample_imgs, nrow=10, normalize=True, scale...
import os from copy import deepcopy import numpy as np import torch import goalrepresent as gr from goalrepresent.helper.randomhelper import set_seed from goalrepresent.models import PCAModel class BCSpectrumFourierModel(): @staticmethod def default_config(): default_config = gr.Config() de...
[ "numpy.ones", "goalrepresent.helper.randomhelper.set_seed", "goalrepresent.Config", "torch.rfft", "goalrepresent.models.PCAModel.load_model", "torch.from_numpy", "os.path.dirname", "numpy.zeros", "torch.cuda.is_available", "torch.range", "copy.deepcopy", "torch.zeros", "torch.atan", "torch...
[((298, 309), 'goalrepresent.Config', 'gr.Config', ([], {}), '()\n', (307, 309), True, 'import goalrepresent as gr\n'), ((439, 450), 'goalrepresent.helper.randomhelper.set_seed', 'set_seed', (['(0)'], {}), '(0)\n', (447, 450), False, 'from goalrepresent.helper.randomhelper import set_seed\n'), ((915, 955), 'goalreprese...
#!/usr/bin/env python import numpy as np import pytest import raytracing as rt def test_ray_penetrates_grid_1d_pos_x(): start = np.array([[-1.23]]) end = np.array([[6.78]]) shape = np.array([5]) size = np.array([0.45]) map_gt = rt.gridmap(shape, size) map_gt.misses[:5] = 1 map = rt....
[ "numpy.ones", "pytest.main", "numpy.array", "raytracing.gridmap", "raytracing.trace2d", "raytracing.trace1d" ]
[((135, 154), 'numpy.array', 'np.array', (['[[-1.23]]'], {}), '([[-1.23]])\n', (143, 154), True, 'import numpy as np\n'), ((165, 183), 'numpy.array', 'np.array', (['[[6.78]]'], {}), '([[6.78]])\n', (173, 183), True, 'import numpy as np\n'), ((196, 209), 'numpy.array', 'np.array', (['[5]'], {}), '([5])\n', (204, 209), T...
import numpy as np x = np.array([75, 138, 679]) y = np.array([3.45, 2.7, 0.3]) a = np.polyfit(x, np.log(y),1) demand_erraticity = 140 print(a) print(round(np.exp(a[0] *demand_erraticity + a[1]))) print(isinstance(int(np.round(2.99)), int))
[ "numpy.exp", "numpy.array", "numpy.log", "numpy.round" ]
[((24, 48), 'numpy.array', 'np.array', (['[75, 138, 679]'], {}), '([75, 138, 679])\n', (32, 48), True, 'import numpy as np\n'), ((53, 79), 'numpy.array', 'np.array', (['[3.45, 2.7, 0.3]'], {}), '([3.45, 2.7, 0.3])\n', (61, 79), True, 'import numpy as np\n'), ((98, 107), 'numpy.log', 'np.log', (['y'], {}), '(y)\n', (104...
import gym import itertools import matplotlib import numpy as np import sys import tensorflow as tf import collections from time import time import os.path from fourInARowWrapper import FourInARowWrapper if "../" not in sys.path: sys.path.append("../") from lib import plotting matplotlib.style....
[ "tensorflow.contrib.framework.get_global_step", "tensorflow.reduce_sum", "numpy.log", "tensorflow.get_default_session", "tensorflow.multiply", "numpy.array", "matplotlib.style.use", "sys.path.append", "tensorflow.squared_difference", "tensorflow.Session", "tensorflow.placeholder", "tensorflow....
[((303, 333), 'matplotlib.style.use', 'matplotlib.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (323, 333), False, 'import matplotlib\n'), ((343, 363), 'fourInARowWrapper.FourInARowWrapper', 'FourInARowWrapper', (['(1)'], {}), '(1)\n', (360, 363), False, 'from fourInARowWrapper import FourInARowWrapper\n'), ((215...
import numpy import csb.test as test from csb.numeric import log from csb.statistics.pdf.parameterized import ParameterizedDensity from csb.statistics.pdf.parameterized import ParameterValueError, ParameterizationError from csb.statistics.pdf.parameterized import AbstractParameter, Parameter, NonVirtualParameter c...
[ "csb.statistics.pdf.parameterized.ParameterValueError", "csb.statistics.pdf.parameterized.Parameter", "numpy.sqrt", "csb.test.Console" ]
[((10393, 10407), 'csb.test.Console', 'test.Console', ([], {}), '()\n', (10405, 10407), True, 'import csb.test as test\n'), ((8545, 8556), 'csb.statistics.pdf.parameterized.Parameter', 'Parameter', ([], {}), '()\n', (8554, 8556), False, 'from csb.statistics.pdf.parameterized import AbstractParameter, Parameter, NonVirt...
import numpy as np import random from collections import namedtuple, deque from DQNmodel import QNetwork import torch import torch.nn.functional as F import torch.optim as optim BUFFER_SIZE = int(1e5) # replay buffer size BATCH_SIZE = 64 # minibatch size GAMMA = 0.99 # discount factor TAU = 1e-3 ...
[ "random.sample", "torch.nn.functional.mse_loss", "collections.deque", "collections.namedtuple", "DQNmodel.QNetwork", "random.seed", "torch.min", "torch.from_numpy", "torch.cuda.is_available", "numpy.vstack", "torch.no_grad", "random.random", "numpy.arange" ]
[((506, 531), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (529, 531), False, 'import torch\n'), ((1006, 1023), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1017, 1023), False, 'import random\n'), ((3648, 3679), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['Q_expected', 'Q1_c...
""" A script to convert between the J2000 and the sun. """ from sunpy.coordinates.sun import sky_position as sun_position import sunpy.coordinates.sun as sun_coord import numpy as np def j2000xy(RA,DEC,t_sun): [RA_sun, DEC_sun] = sun_position(t_sun,False) rotate_angel = sun_coord.P(t_sun) # shift the ce...
[ "numpy.sin", "sunpy.coordinates.sun.P", "numpy.cos", "sunpy.coordinates.sun.sky_position" ]
[((237, 263), 'sunpy.coordinates.sun.sky_position', 'sun_position', (['t_sun', '(False)'], {}), '(t_sun, False)\n', (249, 263), True, 'from sunpy.coordinates.sun import sky_position as sun_position\n'), ((282, 300), 'sunpy.coordinates.sun.P', 'sun_coord.P', (['t_sun'], {}), '(t_sun)\n', (293, 300), True, 'import sunpy....
import argparse import os.path as osp import random from time import perf_counter as t import yaml from yaml import SafeLoader import torch import torch_geometric.transforms as T import torch.nn.functional as F import torch.nn as nn from torch_geometric.datasets import Planetoid, CitationFull from torch_geometric.util...
[ "torch.manual_seed", "datasets.get_citation_dataset", "argparse.ArgumentParser", "eval_digcl.label_classification", "model_digcl.Model", "time.perf_counter", "random.seed", "torch.nn.PReLU", "numpy.exp", "torch.cuda.is_available", "model_digcl.Encoder", "torch.nn.RReLU", "torch.cuda.set_devi...
[((681, 714), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (704, 714), False, 'import warnings\n'), ((1011, 1047), 'model_digcl.drop_feature', 'drop_feature', (['x', 'drop_feature_rate_1'], {}), '(x, drop_feature_rate_1)\n', (1023, 1047), False, 'from model_digcl import ...
#!/usr/bin/env python # coding: utf-8 """ This script loads a template file and fills in IDs in columns where they are missing author: <NAME> for Knocean Inc., 22 September 2020 """ import pandas as pd import numpy as np from pathlib import Path from argparse import ArgumentParser parser = ArgumentParser() parser.ad...
[ "numpy.isnan", "pathlib.Path", "argparse.ArgumentParser", "pandas.read_csv" ]
[((294, 310), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (308, 310), False, 'from argparse import ArgumentParser\n'), ((1340, 1392), 'pandas.read_csv', 'pd.read_csv', (['args.template_file'], {'sep': '"""\t"""', 'dtype': 'str'}), "(args.template_file, sep='\\t', dtype=str)\n", (1351, 1392), True, 'i...
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import functools def doublewrap(function): """ A decorator decorator, allowing to use the decorator to be used without parentheses if not arguments are provided. All arguments must be optional. """ @functools.wraps(function) d...
[ "numpy.sqrt", "tensorflow.variable_scope", "tensorflow.Variable", "functools.wraps", "tensorflow.random_uniform" ]
[((289, 314), 'functools.wraps', 'functools.wraps', (['function'], {}), '(function)\n', (304, 314), False, 'import functools\n'), ((1220, 1245), 'functools.wraps', 'functools.wraps', (['function'], {}), '(function)\n', (1235, 1245), False, 'import functools\n'), ((1787, 1832), 'tensorflow.random_uniform', 'tf.random_un...
""" Code modified from PyTorch DCGAN examples: https://github.com/pytorch/examples/tree/master/dcgan """ from __future__ import print_function import argparse import os import numpy as np import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn from utils import den...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "numpy.random.normal", "random.randint", "argparse.ArgumentParser", "os.makedirs", "network._netG", "torch.LongTensor", "network._netD_CIFAR10", "os.path.join", "random.seed", "torch.from_numpy", "network._netG_CIFAR10", "numpy.zeros", "...
[((523, 548), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (546, 548), False, 'import argparse\n'), ((1797, 1824), 'random.seed', 'random.seed', (['opt.manualSeed'], {}), '(opt.manualSeed)\n', (1808, 1824), False, 'import random\n'), ((1829, 1862), 'torch.manual_seed', 'torch.manual_seed', ([...
""" The game of Reversi. Warning: this game is not coded in an optimal way, the AI will be slow. """ import numpy as np from easyAI import TwoPlayersGame to_string = lambda a : "ABCDEFGH"[a[0]] + str(a[1]+1) to_array = lambda s : np.array(["ABCDEFGH".index(s[0]),int(s[1])-1]) class Reversi( TwoPlayersGame ): """...
[ "easyAI.Negamax", "numpy.array", "numpy.zeros", "numpy.sum" ]
[((3016, 3243), 'numpy.array', 'np.array', (['[[9, 3, 3, 3, 3, 3, 3, 9], [3, 1, 1, 1, 1, 1, 1, 3], [3, 1, 1, 1, 1, 1, 1, \n 3], [3, 1, 1, 1, 1, 1, 1, 3], [3, 1, 1, 1, 1, 1, 1, 3], [3, 1, 1, 1, 1,\n 1, 1, 3], [3, 1, 1, 1, 1, 1, 1, 3], [9, 3, 3, 3, 3, 3, 3, 9]]'], {}), '([[9, 3, 3, 3, 3, 3, 3, 9], [3, 1, 1, 1, 1, 1...
import os.path import numpy as np import math from collections import namedtuple from typing import Dict, Any, Tuple, List, Optional from models.adaptive_model import AdaptiveModel from models.standard_model import StandardModel from dataset.dataset import Dataset, DataSeries from utils.file_utils import save_by_file_...
[ "utils.file_utils.read_by_file_suffix", "collections.namedtuple", "numpy.isclose", "numpy.argmax", "numpy.any", "utils.file_utils.save_by_file_suffix", "numpy.count_nonzero", "numpy.sum", "numpy.zeros", "numpy.array", "numpy.concatenate", "numpy.argmin", "numpy.bincount" ]
[((563, 642), 'collections.namedtuple', 'namedtuple', (['"""ModelResults"""', "['predictions', 'labels', 'stop_probs', 'accuracy']"], {}), "('ModelResults', ['predictions', 'labels', 'stop_probs', 'accuracy'])\n", (573, 642), False, 'from collections import namedtuple\n'), ((1447, 1491), 'utils.file_utils.save_by_file_...
''' Resampling methods ================== ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn import datasets import sklearn.linear_model as lm from sklearn.model_selection import train_test_split, KFold, PredefinedSplit from sklearn.model_selection import cro...
[ "numpy.sqrt", "sklearn.metrics.balanced_accuracy_score", "sklearn.model_selection.StratifiedKFold", "numpy.array", "sklearn.linear_model.LogisticRegressionCV", "sklearn.linear_model.RidgeCV", "seaborn.violinplot", "sklearn.model_selection.KFold", "sklearn.metrics.r2_score", "numpy.arange", "nump...
[((389, 483), 'sklearn.datasets.make_regression', 'datasets.make_regression', ([], {'n_samples': '(100)', 'n_features': '(100)', 'n_informative': '(10)', 'random_state': '(42)'}), '(n_samples=100, n_features=100, n_informative=10,\n random_state=42)\n', (413, 483), False, 'from sklearn import datasets\n'), ((3002, 3...
from ...pipeline.BPtPipeline import BPtPipeline from ...pipeline.BPtSearchCV import NevergradSearchCV from ...pipeline.ScopeObjs import ScopeTransformer from ...pipeline.BPtModel import BPtModel from ..input import (Model, ModelPipeline, Pipeline, CV, Scaler, ProblemSpec, ParamSearch, Imputer, Tran...
[ "sklearn.preprocessing.RobustScaler", "sklearn.linear_model.Ridge", "numpy.ones", "pytest.raises" ]
[((20233, 20240), 'sklearn.linear_model.Ridge', 'Ridge', ([], {}), '()\n', (20238, 20240), False, 'from sklearn.linear_model import Ridge\n'), ((20644, 20651), 'sklearn.linear_model.Ridge', 'Ridge', ([], {}), '()\n', (20649, 20651), False, 'from sklearn.linear_model import Ridge\n'), ((21922, 21939), 'numpy.ones', 'np....
import numpy as np import pandas as pd def autocorr_single_tp(a: np.array, t: int) -> float: """Do autocorrelation for a single time point. Parameters ---------- a : np.array The array to correlate (complex or real number) t : int The distance (in the index) Returns -----...
[ "pandas.DataFrame", "numpy.conj" ]
[((798, 812), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (810, 812), True, 'import pandas as pd\n'), ((420, 433), 'numpy.conj', 'np.conj', (['a[t]'], {}), '(a[t])\n', (427, 433), True, 'import numpy as np\n')]
import os import numpy as np import scipy.io from sklearn.manifold import TSNE from sklearn.svm import SVC from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, classification_report import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') im...
[ "numpy.ones", "sklearn.model_selection.train_test_split", "sklearn.metrics.classification_report", "numpy.array", "numpy.zeros", "matplotlib.style.use", "numpy.vstack", "numpy.save", "numpy.load", "xgboost.XGBClassifier", "sklearn.metrics.confusion_matrix" ]
[((289, 317), 'matplotlib.style.use', 'style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (298, 317), False, 'from matplotlib import style\n'), ((377, 421), 'numpy.load', 'np.load', (['"""realChinesesignetf95_features.npy"""'], {}), "('realChinesesignetf95_features.npy')\n", (384, 421), True, 'import...
import pandas as pd import numpy as np from enrest.functions import run_test, get_threshold, get_deg_gene_ids, get_other_gene_ids_for_deg_case, split_scores_by_gene_ids from enrest.parsers import matrices_parser, promoters_parser, read_set_of_genes import enrest.speedup as sup def work_with_matrix(name, pwm, pfm, mat...
[ "enrest.functions.split_scores_by_gene_ids", "pandas.read_csv", "numpy.searchsorted", "enrest.parsers.promoters_parser", "enrest.functions.get_other_gene_ids_for_deg_case", "enrest.functions.get_threshold", "enrest.functions.get_deg_gene_ids", "enrest.functions.run_test", "numpy.max", "numpy.array...
[((496, 522), 'enrest.speedup.scaner', 'sup.scaner', (['promoters', 'pwm'], {}), '(promoters, pwm)\n', (506, 522), True, 'import enrest.speedup as sup\n'), ((541, 567), 'numpy.max', 'np.max', (['all_scores'], {'axis': '(1)'}), '(all_scores, axis=1)\n', (547, 567), True, 'import numpy as np\n'), ((629, 653), 'enrest.spe...
# ----------------------------------------------------------------- # # This code was taken from github repo: # # "Connectionist Temporal Classification (CTC) decoding algorithms" # # developed by <NAME> # # https://github.com/githubharald/CTCDec...
[ "itertools.groupby", "numpy.argmax" ]
[((758, 780), 'numpy.argmax', 'np.argmax', (['mat'], {'axis': '(1)'}), '(mat, axis=1)\n', (767, 780), True, 'import numpy as np\n'), ((1022, 1040), 'itertools.groupby', 'groupby', (['best_path'], {}), '(best_path)\n', (1029, 1040), False, 'from itertools import groupby\n')]
import argparse import gc import glob import logging import math import os import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import data import model_search_rnn as model from architect_rnn import Architect from utils_rnn i...
[ "logging.getLogger", "architect_rnn.Architect", "numpy.log", "utils_rnn.get_batch", "torch.cuda.is_available", "model_search_rnn.cuda", "math.exp", "logging.info", "argparse.ArgumentParser", "numpy.random.random", "utils_rnn.save_checkpoint", "model_search_rnn.RNNModelSearch", "utils.get_dir...
[((404, 493), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch PennTreeBank/WikiText2 Language Model"""'}), "(description=\n 'PyTorch PennTreeBank/WikiText2 Language Model')\n", (427, 493), False, 'import argparse\n'), ((5783, 5894), 'logging.basicConfig', 'logging.basicConfig',...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import joblib from utils import normalize_MPU9250_data, split_df, get_intervals_from_moments, EventIntervals from GeneralAnalyser import GeneralAnalyser, plot_measurements # plt.interactive(True) pd.options.display.max_columns = 15 pic_pr...
[ "torch.utils.data.DataLoader", "torch.nn.LSTM", "joblib.load", "utils.get_intervals_from_moments", "torch.nn.utils.rnn.pack_sequence", "torch.Tensor", "pandas.to_datetime", "torch.utils.data.TensorDataset", "sklearn.preprocessing.StandardScaler", "torch.nn.utils.rnn.pack_padded_sequence", "panda...
[((465, 498), 'joblib.load', 'joblib.load', (['"""data/sessions_dict"""'], {}), "('data/sessions_dict')\n", (476, 498), False, 'import joblib\n'), ((515, 548), 'joblib.load', 'joblib.load', (['"""data/gamedata_dict"""'], {}), "('data/gamedata_dict')\n", (526, 548), False, 'import joblib\n'), ((2745, 2771), 'pandas.Peri...
import pandas as pd import numpy as np import sys import glob import os import re import Bio.PDB.PDBParser import warnings import math warnings.filterwarnings("ignore", message="Used element '.' for Atom") levels = ["class", "arch", "topo", "superfam"] import argparse parser = argparse.ArgumentParser() parser.add_arg...
[ "numpy.mean", "argparse.ArgumentParser", "re.compile", "pandas.read_csv", "numpy.logical_and", "os.path.join", "numpy.linalg.norm", "numpy.array", "os.path.basename", "sys.exit", "pandas.concat", "warnings.filterwarnings" ]
[((135, 205), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""Used element \'.\' for Atom"""'}), '(\'ignore\', message="Used element \'.\' for Atom")\n', (158, 205), False, 'import warnings\n'), ((280, 305), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n',...
import numpy as np def get_user_purchase_matrix(shoppers,numshoppers, brands,num_brands): # numpy zeros is sparse, so size is ok. shopper_brand_matrix = np.zeros((numshoppers,num_brands),dtype = np.int8) for i in range(len(shoppers)): shopper_brand_matrix[shoppers[i],brands[i]]+=1 return shoppe...
[ "numpy.zeros" ]
[((162, 212), 'numpy.zeros', 'np.zeros', (['(numshoppers, num_brands)'], {'dtype': 'np.int8'}), '((numshoppers, num_brands), dtype=np.int8)\n', (170, 212), True, 'import numpy as np\n')]
import unittest import numpy as np from spn.algorithms.Inference import log_likelihood from spn.algorithms.MPE import mpe from spn.io.CPP import get_cpp_function, setup_cpp_bridge, get_cpp_mpe_function from spn.io.Graphics import plot_spn from spn.structure.Base import get_nodes_by_type from spn.structure.leaves.para...
[ "numpy.allclose", "spn.algorithms.Inference.log_likelihood", "spn.algorithms.MPE.mpe", "spn.io.CPP.get_cpp_mpe_function", "spn.io.CPP.setup_cpp_bridge", "spn.io.CPP.get_cpp_function", "spn.structure.leaves.parametric.Inference.add_parametric_inference_support", "numpy.zeros", "numpy.array", "spn.s...
[((2146, 2161), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2159, 2161), False, 'import unittest\n'), ((517, 551), 'spn.structure.leaves.parametric.Inference.add_parametric_inference_support', 'add_parametric_inference_support', ([], {}), '()\n', (549, 551), False, 'from spn.structure.leaves.parametric.Inferen...
#!/usr/bin/python3 from numpy import array from numpy.linalg import eig from scipy.sparse import diags import numpy as np import sys import ast # define matrix args = sys.argv maind = ast.literal_eval(args[3]) second = ast.literal_eval(args[4]) k = array([ second, maind, second ]) offset = [-1, 0, 1] A = diags(k, ...
[ "ast.literal_eval", "numpy.array", "numpy.linalg.eig", "scipy.sparse.diags" ]
[((185, 210), 'ast.literal_eval', 'ast.literal_eval', (['args[3]'], {}), '(args[3])\n', (201, 210), False, 'import ast\n'), ((220, 245), 'ast.literal_eval', 'ast.literal_eval', (['args[4]'], {}), '(args[4])\n', (236, 245), False, 'import ast\n'), ((250, 280), 'numpy.array', 'array', (['[second, maind, second]'], {}), '...
"""Conversion data fixtures """ import numpy as np from pytest import fixture @fixture(scope='module') def year_to_month_coefficients(): """From one year to 12 months (apportions) """ return np.array([[31, 28, 31, 30, 31, 31, 30, 30, 31, 31, 30, 31]], dtype=np.float).T / 365 @fixture(scope='module'...
[ "pytest.fixture", "numpy.array", "numpy.transpose", "numpy.ones" ]
[((81, 104), 'pytest.fixture', 'fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (88, 104), False, 'from pytest import fixture\n'), ((298, 321), 'pytest.fixture', 'fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (305, 321), False, 'from pytest import fixture\n'), ((445, 468), 'pytest.fi...
""" Class that plays the Reinforcement Learning agent """ # !/usr/bin/python import csv import pprint import threading import numpy as np import json import random import pathlib from datetime import datetime import time import copy from time import sleep import logging import sys from formatter_for_output import...
[ "logging.getLogger", "logging.debug", "time.sleep", "copy.deepcopy", "numpy.genfromtxt", "logging.info", "logging.error", "state_machine.state_machine_yeelight.get_optimal_path", "formatter_for_output.format_console_output", "pathlib.Path", "state_machine.state_machine_yeelight.get_optimal_polic...
[((29168, 29191), 'formatter_for_output.format_console_output', 'format_console_output', ([], {}), '()\n', (29189, 29191), False, 'from formatter_for_output import format_console_output\n'), ((2470, 2484), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2482, 2484), False, 'from datetime import datetime\n')...
import torch import torch.nn.functional as F import argparse import cv2 import numpy as np from glob import glob import copy num_classes = 2 img_height, img_width = 96, 96 channel = 3 GPU = False torch.manual_seed(0) class MobileNet_v1(torch.nn.Module): def __init__(self): class MobileNetBlock(torch.nn....
[ "torch.nn.ReLU", "numpy.sqrt", "torch.nn.Sequential", "torch.nn.CNLLLoss", "numpy.array", "copy.copy", "torch.nn.functional.softmax", "torch.nn.BatchNorm2d", "argparse.ArgumentParser", "numpy.random.seed", "torch.nn.AdaptiveAvgPool2d", "glob.glob", "numpy.ceil", "cv2.warpAffine", "cv2.ge...
[((197, 217), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (214, 217), False, 'import torch\n'), ((2898, 2915), 'glob.glob', 'glob', (["(path + '/*')"], {}), "(path + '/*')\n", (2902, 2915), False, 'from glob import glob\n'), ((5086, 5116), 'numpy.array', 'np.array', (['xs'], {'dtype': 'np.float32'...
import argparse import numpy as np from pathlib import Path import cv2 from model import get_model from noise_model import get_noise_model import sys import tensorflow as tf from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2 import tensorflow_datasets as tfds def get_args()...
[ "numpy.clip", "sys.exit", "argparse.ArgumentParser", "pathlib.Path", "tensorflow.image.resize", "tensorflow_datasets.load", "noise_model.get_noise_model", "cv2.imshow", "tensorflow.TensorSpec", "numpy.zeros", "tensorflow.lite.TFLiteConverter.from_keras_model", "tensorflow.python.framework.conv...
[((335, 453), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test trained model"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Test trained model', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (358, 453), False, 'import argparse\n'...
# Copyright 2021 ETH Zurich and the NPBench authors. All rights reserved. import numpy as np def initialize(C_in, C_out, H, K, N, W): from numpy.random import default_rng rng = default_rng(42) # NHWC data layout input = rng.random((N, H, W, C_in), dtype=np.float32) # Weights weights = rng.ran...
[ "numpy.random.default_rng" ]
[((188, 203), 'numpy.random.default_rng', 'default_rng', (['(42)'], {}), '(42)\n', (199, 203), False, 'from numpy.random import default_rng\n')]
"""Learning how to access an API using Python.""" import numpy as np import requests import json # convert lat/lon/zoom to x/y def convert_to_xy(lat, lon, zoom): lat_rad = np.radians(lat) n = 2.0 ** zoom x = int((lon + 180.0) / 360.0 * n) y = int((1.0 - np.arcsinh(np.tan(lat_rad)) / np.pi) / 2.0 * n)...
[ "numpy.radians", "numpy.tan", "numpy.arange", "requests.get", "json.dump" ]
[((1163, 1186), 'numpy.arange', 'np.arange', (['x_min', 'x_max'], {}), '(x_min, x_max)\n', (1172, 1186), True, 'import numpy as np\n'), ((1198, 1221), 'numpy.arange', 'np.arange', (['y_min', 'y_max'], {}), '(y_min, y_max)\n', (1207, 1221), True, 'import numpy as np\n'), ((2512, 2530), 'json.dump', 'json.dump', (['data'...
import numpy as np import matplotlib.pyplot as plt from datetime import datetime # q3. a # (1) def cal_log(x, y, sigma): return (-1/(np.pi * np.power(sigma, 4)))\ * (1-(np.power(x, 2)+np.power(y, 2))/(2*np.power(sigma, 2)))\ * np.exp(-(np.power(x, 2)+np.power(y, 2))/(2*np.power(sigma, 2))) ...
[ "numpy.abs", "numpy.mean", "matplotlib.pyplot.ylabel", "numpy.power", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "datetime.datetime.now", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.tight_layout", "numpy.nonzero", "num...
[((404, 420), 'numpy.abs', 'np.abs', (['(max * tp)'], {}), '(max * tp)\n', (410, 420), True, 'import numpy as np\n'), ((568, 593), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n', (576, 593), True, 'import numpy as np\n'), ((919, 935), 'numpy.linalg.svd', 'np.linalg.svd', (['M'], {}), '(M)\n...
from __future__ import print_function import pytest from hashlib import sha256 import json import re import sys import numpy as np import flowpipe.utilities as util class WeirdObject(object): """An object that is not json serializable and has no bytes() interface.""" foo = "bar" def test_node_encoder()...
[ "hashlib.sha256", "json.loads", "json.dumps", "flowpipe.utilities.get_hash", "numpy.arange" ]
[((439, 463), 'json.dumps', 'json.dumps', (['valid_object'], {}), '(valid_object)\n', (449, 463), False, 'import json\n'), ((485, 508), 'json.loads', 'json.loads', (['json_string'], {}), '(json_string)\n', (495, 508), False, 'import json\n'), ((664, 710), 'json.dumps', 'json.dumps', (['bytes_object'], {'cls': 'util.Nod...
# Copyright 2018 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 th...
[ "numpy.mean", "collections.OrderedDict", "numpy.allclose", "unittest.mock.Mock", "numpy.unique", "numpy.isclose", "numpy.ones", "pickle.load", "numpy.argmax", "os.path.isfile", "numpy.array", "mxnet.module.Module.load", "numpy.sum", "numpy.array_equal", "xfer.load", "xfer.BnnRepurposer...
[((1017, 1085), 'unittest.mock.patch', 'patch', (['RepurposerTestUtils.META_MODEL_REPURPOSER_MODEL_HANDLER_CLASS'], {}), '(RepurposerTestUtils.META_MODEL_REPURPOSER_MODEL_HANDLER_CLASS)\n', (1022, 1085), False, 'from unittest.mock import Mock, patch\n'), ((1639, 1692), 'numpy.loadtxt', 'np.loadtxt', (["(self._test_data...
import tensorrt as trt import pycuda.driver as cuda import pycuda.autoinit import numpy as np import cv2 class pose: # constructor def __init__(self): self.TRT_LOGGER = trt.Logger(trt.Logger.WARNING) self.trt_runtime = trt.Runtime(self.TRT_LOGGER) self.load_engine('donModel.plan') ...
[ "numpy.copyto", "tensorrt.nptype", "pycuda.driver.mem_alloc", "tensorrt.Profiler", "pycuda.driver.Stream", "numpy.asarray", "pycuda.driver.memcpy_htod_async", "tensorrt.Logger", "tensorrt.Runtime", "numpy.load", "pycuda.driver.memcpy_dtoh_async" ]
[((2420, 2444), 'numpy.load', 'np.load', (['input_file_path'], {}), '(input_file_path)\n', (2427, 2444), True, 'import numpy as np\n'), ((188, 218), 'tensorrt.Logger', 'trt.Logger', (['trt.Logger.WARNING'], {}), '(trt.Logger.WARNING)\n', (198, 218), True, 'import tensorrt as trt\n'), ((246, 274), 'tensorrt.Runtime', 't...
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
[ "numpy.prod", "lingvo.jax.tasks.lm.input_generator.SyntheticLmData.Params", "jax.local_device_count", "lingvo.jax.optimizers.Adam.Params", "math.sqrt", "lingvo.jax.layers.StackedTransformer.Params", "lingvo.jax.model.LanguageModel.Params", "lingvo.jax.schedules.LinearRampupExponentialDecay.Params", ...
[((1429, 1453), 'jax.local_device_count', 'jax.local_device_count', ([], {}), '()\n', (1451, 1453), False, 'import jax\n'), ((1529, 1569), 'lingvo.jax.tasks.lm.input_generator.SyntheticLmData.Params', 'input_generator.SyntheticLmData.Params', ([], {}), '()\n', (1567, 1569), False, 'from lingvo.jax.tasks.lm import input...
import matplotlib.pyplot as plt import numpy as np ''' plt.figure() plt.subplot(1,2,1) linear_data = np.array([1,2,3,4,5,6,7,8]) plt.plot(linear_data, '-o') exponential_data = linear_data**2 plt.subplot(1,2,2) plt.plot(exponential_data, '-o') plt.subplot(1,2,1) plt.plot(exponential_data,'-x') ...
[ "numpy.random.normal", "matplotlib.pyplot.hist2d", "numpy.random.random", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure" ]
[((3724, 3736), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (3734, 3736), True, 'import matplotlib.pyplot as plt\n'), ((3743, 3791), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.0)', 'scale': '(1.0)', 'size': '(10000)'}), '(loc=0.0, scale=1.0, size=10000)\n', (3759, 3791), True, 'import n...
# Copyright 2019 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd import sys import numpy as np import dex_binary_object as dbo sys.path.append("../jax") from examples import datasets def on...
[ "numpy.max", "dex_binary_object.dump", "examples.datasets.mnist", "sys.path.append", "numpy.arange" ]
[((257, 282), 'sys.path.append', 'sys.path.append', (['"""../jax"""'], {}), "('../jax')\n", (272, 282), False, 'import sys\n'), ((949, 970), 'dex_binary_object.dump', 'dbo.dump', (['data_out', 'f'], {}), '(data_out, f)\n', (957, 970), True, 'import dex_binary_object as dbo\n'), ((435, 448), 'numpy.max', 'np.max', (['xs...
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions as dist from torch.utils.data import DataLoader, TensorDataset from torchvision.utils import save_image, make_grid from torchvision import datasets, transforms import numpy as np import math from numpy import prod, sqrt from ...
[ "numpy.prod", "torch.nn.Sequential", "torch.tensor", "torch.nn.Linear", "torchvision.datasets.MNIST", "torch.no_grad", "torchvision.transforms.ToTensor", "torch.Size", "torch.zeros", "torch.cat" ]
[((382, 405), 'torch.Size', 'torch.Size', (['[1, 28, 28]'], {}), '([1, 28, 28])\n', (392, 405), False, 'import torch\n'), ((421, 436), 'numpy.prod', 'prod', (['data_size'], {}), '(data_size)\n', (425, 436), False, 'from numpy import prod, sqrt\n'), ((510, 543), 'torch.nn.Linear', 'nn.Linear', (['hidden_dim', 'hidden_di...
import numpy as np """ output a list of points consumable by openscad polygon function """ def wave(degs, scale=10): pts = [] for i in xrange(degs): rad = i*np.pi/180.0 x = float(i/180.0*scale) y=np.sin(rad) * scale pts.append([x, y]) return pts def pwave(degs, scale=20): ...
[ "numpy.sin" ]
[((229, 240), 'numpy.sin', 'np.sin', (['rad'], {}), '(rad)\n', (235, 240), True, 'import numpy as np\n')]
import numpy as np import torch import gtimer as gt import lifelong_rl.torch.pytorch_util as ptu from lifelong_rl.trainers.lisp.mb_skill import MBSkillTrainer import lifelong_rl.util.pythonplusplus as ppp from lifelong_rl.util.eval_util import create_stats_ordered_dict class LiSPTrainer(MBSkillTrainer): """ ...
[ "lifelong_rl.torch.pytorch_util.get_numpy", "lifelong_rl.torch.pytorch_util.from_numpy", "lifelong_rl.util.pythonplusplus.sample_batch", "lifelong_rl.torch.pytorch_util.np_to_pytorch_batch", "lifelong_rl.util.eval_util.create_stats_ordered_dict", "numpy.expand_dims", "numpy.random.uniform", "numpy.con...
[((1808, 1830), 'lifelong_rl.torch.pytorch_util.get_numpy', 'ptu.get_numpy', (['latents'], {}), '(latents)\n', (1821, 1830), True, 'import lifelong_rl.torch.pytorch_util as ptu\n'), ((4561, 4602), 'gtimer.stamp', 'gt.stamp', (['"""policy training"""'], {'unique': '(False)'}), "('policy training', unique=False)\n", (456...
from typing import Tuple import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.csgraph import connected_components from dft_dummy.crystal_utils import calc_reciprocal, project_points from dft_dummy.symmetry import ( calc_overlap_matrix, check_symmetry, possible_unitary_rotations, ) de...
[ "dft_dummy.symmetry.calc_overlap_matrix", "scipy.sparse.csgraph.connected_components", "dft_dummy.symmetry.check_symmetry", "dft_dummy.crystal_utils.calc_reciprocal", "numpy.floor", "dft_dummy.crystal_utils.project_points", "numpy.linalg.norm", "scipy.sparse.csr_matrix", "dft_dummy.symmetry.possible...
[((766, 790), 'dft_dummy.symmetry.calc_overlap_matrix', 'calc_overlap_matrix', (['vec'], {}), '(vec)\n', (785, 790), False, 'from dft_dummy.symmetry import calc_overlap_matrix, check_symmetry, possible_unitary_rotations\n'), ((810, 838), 'dft_dummy.symmetry.possible_unitary_rotations', 'possible_unitary_rotations', ([]...
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # 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 # us...
[ "numpy.testing.assert_array_equal", "numpy.around", "pandas.DataFrame", "preprocess.DataProcessor.merge_two_dicts", "preprocess.DataProcessor" ]
[((1565, 1743), 'pandas.DataFrame', 'pd.DataFrame', (["[['M', 5, 0.3, 1, 0.3, 2, 1, 0, 10], ['F', 3, 0.2, 2, 0.2, 1, 3, 0, 7], [\n 'I', 2, 0.5, 3, 0.1, 1, 2, 0, 5]]"], {'columns': '(feature_columns_names + [label_column])'}), "([['M', 5, 0.3, 1, 0.3, 2, 1, 0, 10], ['F', 3, 0.2, 2, 0.2, 1, \n 3, 0, 7], ['I', 2, 0....
# -*- coding: utf-8 -*- """ .. Authors <NAME> <<EMAIL>> <NAME> <<EMAIL>> <NAME> <<EMAIL>> Contains the XicsrtPlasmaGeneric class. """ import logging import numpy as np from xicsrt.util import profiler from xicsrt.tools import xicsrt_spread from xicsrt.tools.xicsrt_doc import dochelper from xicsrt.objects...
[ "numpy.mean", "numpy.median", "numpy.ones", "xicsrt.tools.xicsrt_spread.solid_angle", "xicsrt.sources._XicsrtSourceFocused.XicsrtSourceFocused", "numpy.linalg.norm", "numpy.min", "numpy.max", "numpy.sum", "numpy.zeros", "xicsrt.util.profiler.stop", "numpy.random.uniform", "xicsrt.util.profil...
[((7034, 7093), 'numpy.zeros', 'np.zeros', (["[self.param['bundle_count'], 3]"], {'dtype': 'np.float64'}), "([self.param['bundle_count'], 3], dtype=np.float64)\n", (7042, 7093), True, 'import numpy as np\n'), ((7135, 7190), 'numpy.ones', 'np.ones', (["[self.param['bundle_count']]"], {'dtype': 'np.float64'}), "([self.pa...
import multiprocessing import pickle import random import sys from collections import defaultdict from math import ceil, sqrt import numpy as np from scipy.stats import norm, skewnorm from tqdm import tqdm sys.path.append('..') import features INCOME_SECURITY = { 'employee_wage': 0.8, 'state_wage': 0.9, ...
[ "random.choice", "math.ceil", "pickle.dump", "features.feature_dict_to_array", "math.sqrt", "features.CUM_FEATURES.items", "numpy.array", "scipy.stats.skewnorm", "collections.defaultdict", "features.NUM_FEATURES.items", "multiprocessing.Pool", "features.CAT_FEATURES.items", "random.random", ...
[((208, 229), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (223, 229), False, 'import sys\n'), ((3895, 3924), 'features.NUM_FEATURES.items', 'features.NUM_FEATURES.items', ([], {}), '()\n', (3922, 3924), False, 'import features\n'), ((4002, 4031), 'features.CAT_FEATURES.items', 'features.CAT_FE...
######################################################################################## # # Forge # Copyright (C) 2018 <NAME>, Oxford Robotics Institute and # Department of Statistics, University of Oxford # # email: <EMAIL> # webpage: http://akosiorek.github.io/ # github: https://github.com/akosiorek/forge/ #...
[ "numpy.random.choice", "tensorflow.py_func", "numpy.arange", "builtins.range" ]
[((2605, 2636), 'tensorflow.py_func', 'tf.py_func', (['data_fun', '[]', 'types'], {}), '(data_fun, [], types)\n', (2615, 2636), True, 'import tensorflow as tf\n'), ((1963, 2017), 'numpy.random.choice', 'np.random.choice', (['n_entries', 'batch_size'], {'replace': '(False)'}), '(n_entries, batch_size, replace=False)\n',...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # s_co...
[ "numpy.sqrt", "pandas.read_csv", "matplotlib.pyplot.ylabel", "arpym.estimation.cointegration_fp", "numpy.log", "numpy.array", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.style.use", "matplotlib.pyplot.yticks", "matplotlib.pyplot.axis", "numpy.tile...
[((1263, 1292), 'numpy.array', 'np.array', (['[1, 2, 3, 5, 7, 10]'], {}), '([1, 2, 3, 5, 7, 10])\n', (1271, 1292), True, 'import numpy as np\n'), ((1365, 1419), 'pandas.read_csv', 'pd.read_csv', (["(path + '/data.csv')"], {'header': '(0)', 'index_col': '(0)'}), "(path + '/data.csv', header=0, index_col=0)\n", (1376, 14...
import pandas as pd import numpy as np from sklearn import datasets, linear_model from __future__ import division class LRPI: def __init__(self, normalize=False, n_jobs=1, t_value = 2.13144955): self.normalize = normalize self.n_jobs = n_jobs self.LR = linear_model.LinearRegression(normaliz...
[ "numpy.multiply", "numpy.dot", "pandas.DataFrame", "numpy.transpose", "sklearn.linear_model.LinearRegression" ]
[((282, 357), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {'normalize': 'self.normalize', 'n_jobs': 'self.n_jobs'}), '(normalize=self.normalize, n_jobs=self.n_jobs)\n', (311, 357), False, 'from sklearn import datasets, linear_model\n'), ((459, 487), 'pandas.DataFrame', 'pd.DataFrame',...
import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from pandas.tseries.offsets import BDay import stock.utils.symbol_util from stock.marketdata.storefactory import get_store from stock.globalvar import * from config import store_type import tushare as ts def get_last_trading_date(today):...
[ "numpy.absolute", "pandas.set_option", "pandas.datetime.today", "pandas.datetime.strptime", "pandas.tseries.offsets.BDay", "numpy.round" ]
[((1601, 1641), 'numpy.round', 'np.round', (["(df_yest['yest_close'] * 1.1)", '(2)'], {}), "(df_yest['yest_close'] * 1.1, 2)\n", (1609, 1641), True, 'import numpy as np\n'), ((1909, 1985), 'numpy.absolute', 'np.absolute', (["((df_today['open'] - df_today['close']) / df_today['yest_close'])"], {}), "((df_today['open'] -...
import unittest import os import numpy as np import pandas as pd from pyinterpolate.semivariance.semivariogram_fit.fit_semivariance import TheoreticalSemivariogram from pyinterpolate.semivariance.semivariogram_estimation.calculate_semivariance import calculate_semivariance from pyinterpolate.semivariance.semivariogram...
[ "pandas.read_csv", "pyinterpolate.semivariance.semivariogram_estimation.calculate_semivariance.calculate_weighted_semivariance", "os.path.join", "os.path.dirname", "numpy.zeros", "pyinterpolate.semivariance.semivariogram_fit.fit_semivariance.TheoreticalSemivariogram", "unittest.main", "numpy.load", ...
[((4465, 4480), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4478, 4480), False, 'import unittest\n'), ((569, 594), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (584, 594), False, 'import os\n'), ((610, 667), 'os.path.join', 'os.path.join', (['my_dir', '"""../sample_data/armstrong_d...
from networkx import from_numpy_matrix, set_node_attributes, relabel_nodes, DiGraph from numpy import matrix from data import DISTANCES, DEMANDS_DROP import sys sys.path.append("../../") from vrpy import VehicleRoutingProblem # Transform distance matrix to DiGraph A = matrix(DISTANCES, dtype=[("cost", int)]) G = from...
[ "networkx.relabel_nodes", "networkx.DiGraph", "networkx.set_node_attributes", "vrpy.VehicleRoutingProblem", "numpy.matrix", "sys.path.append" ]
[((162, 187), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (177, 187), False, 'import sys\n'), ((271, 311), 'numpy.matrix', 'matrix', (['DISTANCES'], {'dtype': "[('cost', int)]"}), "(DISTANCES, dtype=[('cost', int)])\n", (277, 311), False, 'from numpy import matrix\n'), ((376, 434), 'ne...
# coding=utf-8 # Author: <NAME> # Date: Aug 06, 2019 # # Description: Plots results of screened DM genes # # Instructions: # import numpy as np import pandas as pd pd.set_option('display.max_rows', 100) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) import matplotlib as mpl from matplotl...
[ "pandas.read_csv", "numpy.arange", "pandas.Categorical", "pandas.set_option", "matplotlib.pyplot.figure", "matplotlib.gridspec.GridSpec", "numpy.linspace", "matplotlib.colors.Normalize", "matplotlib.colors.rgb2hex", "numpy.log2", "matplotlib.pyplot.subplot", "matplotlib.pyplot.subplots_adjust"...
[((164, 202), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(100)'], {}), "('display.max_rows', 100)\n", (177, 202), True, 'import pandas as pd\n'), ((203, 244), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (216, 244), True, '...
from netCDF4._netCDF4 import Variable import numpy def decode_time(variable: Variable, unit: str = None) -> numpy.array: if unit is None: unit = variable.units unit, direction, base_date = unit.split(' ', 2) intervals = { 'years': 'Y', 'months': 'M', 'days': 'D', 'h...
[ "numpy.array", "numpy.datetime64" ]
[((437, 464), 'numpy.datetime64', 'numpy.datetime64', (['base_date'], {}), '(base_date)\n', (453, 464), False, 'import numpy\n'), ((467, 488), 'numpy.array', 'numpy.array', (['variable'], {}), '(variable)\n', (478, 488), False, 'import numpy\n')]
'''This class will log 1d array in Nd matrix from device and qualisys object''' import numpy as np from datetime import datetime as datetime from time import time from utils_mpc import quaternionToRPY class LoggerControl(): def __init__(self, dt, N0_gait, joystick=None, estimator=None, loop=None, gait=None, state...
[ "matplotlib.pyplot.ylabel", "numpy.array", "numpy.sin", "matplotlib.widgets.Slider", "numpy.savez", "utils_mpc.EulerToQuaternion", "matplotlib.pyplot.plot", "IPython.embed", "matplotlib.pyplot.xlabel", "numpy.max", "numpy.min", "matplotlib.pyplot.ylim", "numpy.round", "glob.glob", "utils...
[((44262, 44303), 'LoggerSensors.LoggerSensors', 'LoggerSensors.LoggerSensors', ([], {'logSize': '(5997)'}), '(logSize=5997)\n', (44289, 44303), False, 'import LoggerSensors\n'), ((491, 506), 'numpy.int', 'np.int', (['logSize'], {}), '(logSize)\n', (497, 506), True, 'import numpy as np\n'), ((653, 675), 'numpy.zeros', ...
from typing import Any, Tuple, Callable, Iterator from os import path import csv import random import numpy as np from PIL import Image import torch from torchvision.transforms.functional import to_tensor def make_reproducible(seed: int = 0) -> None: random.seed(seed) np.random.seed(seed) torch.manual_see...
[ "torch.manual_seed", "csv.DictReader", "PIL.Image.open", "os.path.join", "random.seed", "os.path.dirname", "numpy.random.seed" ]
[((257, 274), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (268, 274), False, 'import random\n'), ((279, 299), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (293, 299), True, 'import numpy as np\n'), ((304, 327), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (32...
import matplotlib.pyplot as plt import numpy as np x = np.linspace(-4, 4, num=20) y1 = x y2 = -y1 y3 = y1**2 fig = plt.figure(figsize=(8, 5)) ax = fig.add_subplot() ax.scatter(x=x, y=y1, marker="v", s=1000) ax.scatter(x=x, y=y2, marker="X", s=100) ax.scatter(x=x, y=y3, marker="s", s=10) plt.tight_layout() plt.s...
[ "matplotlib.pyplot.savefig", "numpy.linspace", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show" ]
[((57, 83), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)'], {'num': '(20)'}), '(-4, 4, num=20)\n', (68, 83), True, 'import numpy as np\n'), ((119, 145), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 5)'}), '(figsize=(8, 5))\n', (129, 145), True, 'import matplotlib.pyplot as plt\n'), ((296, 314), 'm...
#Write by <NAME>, contact: <EMAIL> # -*- coding: utf-8 -*- ## use GPU import os import tensorflow as tf os.environ['CUDA_VISIBLE_DEVICES']='0' config=tf.ConfigProto() config.gpu_options.allow_growth= True sess=tf.Session(config=config) import numpy as np import matplotlib.pyplot as plt import scipy.io as sio from ker...
[ "numpy.prod", "keras.models.load_model", "scipy.io.savemat", "Utils.zeroPadding.zeroPadding_3D", "tensorflow.Session", "scipy.io.loadmat", "matplotlib.pyplot.Axes", "h5py.File", "numpy.max", "Utils.ssrn_SS_Houston_3FF_F1.ResnetBuilder.build_resnet_2_2", "matplotlib.pyplot.figure", "numpy.zeros...
[((151, 167), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (165, 167), True, 'import tensorflow as tf\n'), ((211, 236), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (221, 236), True, 'import tensorflow as tf\n'), ((3432, 3519), 'scipy.io.loadmat', 'sio.loadmat', ...
""" This file to define Estimate various parameters """ import numpy as np import pandas as pd from scipy.spatial import distance import matplotlib.pyplot as plt import networkx as nx from pyproj import Proj from pyproj import Proj, transform # trasforming latlong into mercetor coordinates def tran(data): ut...
[ "pandas.Series", "numpy.abs", "pyproj.transform", "numpy.array", "pyproj.Proj", "scipy.spatial.distance.euclidean" ]
[((639, 651), 'numpy.array', 'np.array', (['rx'], {}), '(rx)\n', (647, 651), True, 'import numpy as np\n'), ((659, 671), 'numpy.array', 'np.array', (['ry'], {}), '(ry)\n', (667, 671), True, 'import numpy as np\n'), ((1112, 1126), 'numpy.array', 'np.array', (['dist'], {}), '(dist)\n', (1120, 1126), True, 'import numpy a...
""" Operative functions to be run into the SA_algorithm. Creation of initial value, definition of 2-D movements and dedicated domain boundaries conditions, optimization methods and stopping criteria are listed below. """ import numpy as np from numpy import random as rnd #-------Neighbour generation----------# de...
[ "numpy.mean", "numpy.sqrt", "numpy.random.random", "numpy.exp", "numpy.random.uniform" ]
[((1106, 1118), 'numpy.random.random', 'rnd.random', ([], {}), '()\n', (1116, 1118), True, 'from numpy import random as rnd\n'), ((4595, 4608), 'numpy.mean', 'np.mean', (['diff'], {}), '(diff)\n', (4602, 4608), True, 'import numpy as np\n'), ((2132, 2153), 'numpy.random.uniform', 'rnd.uniform', (['a', 'state'], {}), '(...
import os import sys from typing import List, Tuple import kaggle import zipfile import cv2 from matplotlib import pyplot as plt import numpy as np from pandas import DataFrame from torch.tensor import Tensor from torchvision import transforms # from cn.protect import Protect # from cn.protect.privacy import KAnonymit...
[ "os.path.exists", "os.listdir", "os.makedirs", "zipfile.ZipFile", "torchvision.transforms.RandomRotation", "kaggle.api.authenticate", "logger.logPrint", "kaggle.api.dataset_download_files", "os.path.join", "torchvision.transforms.RandomHorizontalFlip", "numpy.array", "sys.exit", "pandas.Data...
[((1172, 1212), 'logger.logPrint', 'logPrint', (['"""Loading Pneumonia Dataset..."""'], {}), "('Loading Pneumonia Dataset...')\n", (1180, 1212), False, 'from logger import logPrint\n'), ((1373, 1419), 'logger.logPrint', 'logPrint', (['"""Splitting datasets over clients..."""'], {}), "('Splitting datasets over clients.....
#!/usr/bin/env python """Tests for `rawtools` package.""" import numpy as np import pytest from numpy import uint8, uint16 from rawtools import rawtools DIMS = (4, 5) @pytest.fixture def slice_uint8(): """Sample uint8 slice""" return np.rint(np.arange(0, 20, dtype=uint8).reshape(DIMS)) @pytest.fixture de...
[ "rawtools.convert.scale", "numpy.arange", "numpy.iinfo", "numpy.array", "numpy.zeros", "numpy.testing.assert_array_equal" ]
[((547, 623), 'numpy.array', 'np.array', (['[-1, 0, 100, 1000, 5000, 14830, 50321, 65535, 65536]'], {'dtype': 'uint16'}), '([-1, 0, 100, 1000, 5000, 14830, 50321, 65535, 65536], dtype=uint16)\n', (555, 623), True, 'import numpy as np\n'), ((907, 948), 'rawtools.convert.scale', 'scale', (['xs', 'lbound', 'ubound', 'lbou...
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> and <NAME> # # Modified by <NAME> # -------------------------------------------------------- import numpy as np def generate_anchors(...
[ "numpy.sqrt", "numpy.arange", "numpy.array", "numpy.meshgrid", "numpy.round" ]
[((1300, 1322), 'numpy.array', 'np.array', (['anchor_bases'], {}), '(anchor_bases)\n', (1308, 1322), True, 'import numpy as np\n'), ((1671, 1707), 'numpy.arange', 'np.arange', (['(0)', '(width * stride)', 'stride'], {}), '(0, width * stride, stride)\n', (1680, 1707), True, 'import numpy as np\n'), ((1723, 1760), 'numpy...
import os import logging import math from functools import reduce from collections import defaultdict import json from timeit import default_timer from tqdm import trange, tqdm import numpy as np import torch import sklearn.metrics import sklearn.svm as svm import multiprocessing import time def generator(mus, mus_te...
[ "numpy.mean", "numpy.abs", "numpy.sort", "sklearn.svm.LinearSVC", "gin.parse_config_files_and_bindings", "numpy.quantile", "numpy.zeros", "multiprocessing.Pool", "numpy.cov", "lib.disentanglement_lib.disentanglement_lib.evaluation.metrics.mig._compute_mig", "numpy.var" ]
[((738, 784), 'sklearn.svm.LinearSVC', 'svm.LinearSVC', ([], {'C': '(0.01)', 'class_weight': '"""balanced"""'}), "(C=0.01, class_weight='balanced')\n", (751, 784), True, 'import sklearn.svm as svm\n'), ((897, 922), 'numpy.mean', 'np.mean', (['(pred == y_j_test)'], {}), '(pred == y_j_test)\n', (904, 922), True, 'import ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # S_To...
[ "numpy.eye", "matplotlib.pyplot.grid", "numpy.linalg.eig", "numpy.ones", "numpy.sort", "matplotlib.pyplot.plot", "matplotlib.pyplot.style.use", "numpy.argsort", "matplotlib.pyplot.figure", "os.path.abspath" ]
[((901, 925), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (914, 925), True, 'import matplotlib.pyplot as plt\n'), ((1069, 1076), 'numpy.eye', 'eye', (['n_'], {}), '(n_)\n', (1072, 1076), False, 'from numpy import ones, sort, argsort, diagflat, eye\n'), ((1247, 1253), 'numpy...
import cv2 import os import numpy as np from sys import argv from lib import sauvola, linelocalization, pathfinder from WordSegmentation import wordSegmentation, prepareImg from time import time as timer from SamplePreprocessor import preprocess from DataLoader import Batch from Model import Model def draw_line(im, p...
[ "cv2.rectangle", "cv2.imwrite", "WordSegmentation.prepareImg", "os.path.exists", "numpy.ones", "cv2.threshold", "cv2.erode", "lib.linelocalization.localize", "os.path.join", "numpy.max", "numpy.zeros", "WordSegmentation.wordSegmentation", "os.mkdir", "numpy.min", "DataLoader.Batch", "t...
[((426, 461), 'cv2.rectangle', 'cv2.rectangle', (['im', 'prev', 'curr', '(0)', '(3)'], {}), '(im, prev, curr, 0, 3)\n', (439, 461), False, 'import cv2\n'), ((791, 823), 'cv2.imwrite', 'cv2.imwrite', (['imbw_filename', 'imbw'], {}), '(imbw_filename, imbw)\n', (802, 823), False, 'import cv2\n'), ((885, 919), 'cv2.imwrite...
#!/usr/bin/env python3 import sqlite3 import pandas as pd import numpy as np import matplotlib.pyplot as plt from contextlib import closing as ctx_closing from argparse import ArgumentParser def read_daily_stats(sqc): df = pd.read_sql_query( "SELECT day, avg, (xx/n - avg*avg) AS var, min, max, n AS count FROM (" + ...
[ "pandas.read_sql_query", "numpy.sqrt", "numpy.minimum", "argparse.ArgumentParser", "sqlite3.connect", "matplotlib.pyplot.legend", "matplotlib.pyplot.style.context", "pandas.DataFrame", "numpy.maximum", "matplotlib.pyplot.subplots", "pandas.to_datetime", "matplotlib.pyplot.show" ]
[((225, 648), 'pandas.read_sql_query', 'pd.read_sql_query', (['(\'SELECT day, avg, (xx/n - avg*avg) AS var, min, max, n AS count FROM (\' +\n "SELECT strftime(\'%Y-%m-%d\',timestamp,\'unixepoch\') AS day," +\n \' AVG(delay_ms) AS avg,\' + \' MIN(delay_ms) AS min,\' +\n \' MAX(delay_ms) AS max,\' + \' SUM(delay...
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import skimage.io as io import skimage.transform as transform from os.path import join import vfn.network as nw import argparse import json import time global_dtype = tf.float32 global_dtype_np = np.float32 batch_size = 200 def overlap_ratio(x1, y1, ...
[ "vfn.network.score", "numpy.repeat", "argparse.ArgumentParser", "tensorflow.placeholder", "vfn.network.get_variable_dict", "tensorflow.ConfigProto", "vfn.network.build_alexconvnet", "json.loads", "tensorflow.variable_scope", "tensorflow.global_variables", "argparse.ArgumentTypeError", "skimage...
[((795, 830), 'numpy.zeros', 'np.zeros', (['(batch_size, 227, 227, 3)'], {}), '((batch_size, 227, 227, 3))\n', (803, 830), True, 'import numpy as np\n'), ((1512, 1547), 'json.loads', 'json.loads', (['slidling_windows_string'], {}), '(slidling_windows_string)\n', (1522, 1547), False, 'import json\n'), ((3641, 3666), 'ar...
from collections import Counter import numpy as np import sklearn from pandas import DataFrame from sklearn.impute import SimpleImputer import data.utils.df_loader as dl import data.utils.web_scrappers as ws def process_data_for_labels(ticker): """ Computes new columns needed for label generation for specif...
[ "pandas.DataFrame.from_records", "data.utils.df_loader.get_dax__as_df", "numpy.log", "data.utils.web_scrappers.get_tickers", "collections.Counter", "numpy.array", "sklearn.impute.SimpleImputer", "data.utils.df_loader.get_com_as_df", "sklearn.preprocessing.MinMaxScaler" ]
[((532, 551), 'data.utils.df_loader.get_dax__as_df', 'dl.get_dax__as_df', ([], {}), '()\n', (549, 551), True, 'import data.utils.df_loader as dl\n'), ((1180, 1196), 'data.utils.web_scrappers.get_tickers', 'ws.get_tickers', ([], {}), '()\n', (1194, 1196), True, 'import data.utils.web_scrappers as ws\n'), ((2911, 2935), ...
# 导入包 import zipfile import paddle import paddle.fluid as fluid import matplotlib.pyplot as plt import matplotlib.image as mping from PIL import Image import json import numpy as np import cv2 import sys import time import h5py # import scipy.io as io from matplotlib import pyplot as plt from scipy.ndimage.filters impo...
[ "paddle.fluid.layers.sqrt", "csv.DictWriter", "paddle.fluid.DataFeeder", "zipfile.ZipFile", "scipy.ndimage.filters.gaussian_filter", "paddle.fluid.layers.data", "numpy.count_nonzero", "numpy.array", "paddle.fluid.Executor", "matplotlib.pyplot.imshow", "paddle.utils.plot.Ploter", "paddle.fluid....
[((431, 442), 'time.time', 'time.time', ([], {}), '()\n', (440, 442), False, 'import time\n'), ((521, 533), 'json.load', 'json.load', (['f'], {}), '(f)\n', (530, 533), False, 'import json\n'), ((1133, 1170), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""data/train_new.zip"""'], {}), "('data/train_new.zip')\n", (1148, 117...
''' FFT curves submodule for the SLab project It requires and imports slab.py History: Version 1.0 : First version (7/4/2017) Version 1.1 : Compatibility with Python 3.x (1/3/2018) ''' from __future__ import print_function import slab import slab_ac as ac import numpy as np # Numpy ...
[ "slab.singleWaveResponse", "numpy.abs", "numpy.sqrt", "slab.tranStore", "numpy.fft.fft", "slab.message", "slab_ac.plotFreq", "slab.plot11", "slab.setWaveFrequency", "slab.waveCosine", "slab.SlabEx" ]
[((3856, 3893), 'slab.message', 'slab.message', (['(1)', '"""SLab FFT Submodule"""'], {}), "(1, 'SLab FFT Submodule')\n", (3868, 3893), False, 'import slab\n'), ((3986, 4005), 'slab.message', 'slab.message', (['(1)', '""""""'], {}), "(1, '')\n", (3998, 4005), False, 'import slab\n'), ((1501, 1519), 'numpy.fft.fft', 'np...
import numpy as np import numba as nb from dataclasses import dataclass from numba import types from numba.typed import Dict from numba import njit import pandas as pd import time import datetime import csv from openpyxl import load_workbook from pyModbusTCP.client import ModbusClient from pyModbusTCP impor...
[ "numpy.sqrt", "numpy.polyfit", "numpy.array", "numpy.where", "numpy.exp", "numpy.maximum", "numpy.abs", "numpy.ones", "pyModbusTCP.utils.word_list_to_long", "numpy.int16", "csv.writer", "pyModbusTCP.utils.decode_ieee", "numba.jit", "pyModbusTCP.client.ModbusClient", "numpy.ones_like", ...
[((25096, 25117), 'numba.jit', 'nb.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (25102, 25117), True, 'import numba as nb\n'), ((32273, 32294), 'numba.jit', 'nb.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (32279, 32294), True, 'import numba as nb\n'), ((33578, 33599), 'numba.jit', 'nb.jit', ([]...
import cv2 import numpy as np def detect(image): """ performs detection of characters from image :param image: numpy.array :return coordinates: list of tuples coordinates of detected elements :return cropped image: list of numpy.arrays bounding boxes of detected elements """ # convert the image to grayscal...
[ "numpy.ones", "cv2.contourArea", "cv2.adaptiveThreshold", "cv2.cvtColor", "numpy.min", "cv2.findContours", "cv2.bitwise_not", "cv2.resize", "cv2.boundingRect" ]
[((336, 375), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (348, 375), False, 'import cv2\n'), ((456, 557), 'cv2.adaptiveThreshold', 'cv2.adaptiveThreshold', (['gray_image', '(255)', 'cv2.ADAPTIVE_THRESH_GAUSSIAN_C', 'cv2.THRESH_BINARY', '(21)', '(9)'], {}), '(...
import math import random import numpy as np from OpenGL.GL import * from OpenGL.GL.ARB.framebuffer_object import * from OpenGL.GL.EXT.framebuffer_object import * from PyEngine3D.Utilities import * from PyEngine3D.Common import logger, COLOR_BLACK from PyEngine3D.OpenGLContext import Texture2D, Texture2DArray, Textu...
[ "PyEngine3D.Common.logger.error", "PyEngine3D.Common.logger.warn", "math.log2", "numpy.zeros", "PyEngine3D.OpenGLContext.CreateTexture", "PyEngine3D.OpenGLContext.RenderBuffer" ]
[((17294, 17323), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'np.float32'}), '(1, dtype=np.float32)\n', (17302, 17323), True, 'import numpy as np\n'), ((4617, 4693), 'PyEngine3D.Common.logger.warn', 'logger.warn', (["('Failed to get temporary %s render target.' % rendertarget_name)"], {}), "('Failed to get temporar...
import os import json import torch import pickle from torch.utils.data import DataLoader from model import KGEModel from dataloader import TrainDataset from dataloader import BidirectionalOneShotIterator from classifier import ClassifierTrainer, LTTrainer, NoiGANTrainer import numpy as np from sklearn.metrics import ac...
[ "classifier.NoiGANTrainer", "numpy.in1d", "torch.LongTensor", "os.path.join", "model.KGEModel", "numpy.random.randint", "numpy.concatenate", "dataloader.TrainDataset.get_true_head_and_tail", "json.load" ]
[((2913, 3193), 'model.KGEModel', 'KGEModel', ([], {'model_name': 'model', 'nentity': 'args.nentity', 'nrelation': 'args.nrelation', 'hidden_dim': 'args.hidden_dim', 'gamma': "argparse_dict['gamma']", 'double_entity_embedding': "argparse_dict['double_entity_embedding']", 'double_relation_embedding': "argparse_dict['dou...
""" Binary Class Transformation --------------------------- The Binary Class Transformation Approach (Influential Marketing, Response Transformation Approach). Based on <NAME>. (2006). “Influential marketing: A new direct marketing strategy addressing the existence of voluntary buyers”. Master of Science thes...
[ "numpy.array" ]
[((2938, 2961), 'numpy.array', 'np.array', (['y_transformed'], {}), '(y_transformed)\n', (2946, 2961), True, 'import numpy as np\n')]
import numpy as np from sequentia.classifiers import HMM # Create some sample data X = [np.random.random((10 * i, 3)) for i in range(1, 4)] # Create and fit a left-right HMM with random transitions and initial state distribution hmm = HMM(label='class1', n_states=5, topology='left-right') hmm.set_random_initial() hmm...
[ "numpy.random.random", "sequentia.classifiers.HMM" ]
[((237, 291), 'sequentia.classifiers.HMM', 'HMM', ([], {'label': '"""class1"""', 'n_states': '(5)', 'topology': '"""left-right"""'}), "(label='class1', n_states=5, topology='left-right')\n", (240, 291), False, 'from sequentia.classifiers import HMM\n'), ((89, 118), 'numpy.random.random', 'np.random.random', (['(10 * i,...
import numpy as np a = [[1,4],[2,5],[3,6]] a = np.array(a) print(a.shape) print(a[0])
[ "numpy.array" ]
[((49, 60), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (57, 60), True, 'import numpy as np\n')]
import torch from torch.utils.data import DataLoader import pathlib import os import numpy as np import dataset from criteria import cal_criteria, bbrebuild def loss_from_log(train_name): with open('../logs/log_%s.txt' % train_name) as f: lines = f.readlines() val_loss = [] train_loss...
[ "os.listdir", "pathlib.Path", "criteria.cal_criteria", "criteria.bbrebuild", "os.path.join", "numpy.argsort", "numpy.array", "torch.no_grad", "numpy.save" ]
[((705, 725), 'numpy.array', 'np.array', (['train_loss'], {}), '(train_loss)\n', (713, 725), True, 'import numpy as np\n'), ((742, 760), 'numpy.array', 'np.array', (['val_loss'], {}), '(val_loss)\n', (750, 760), True, 'import numpy as np\n'), ((1798, 1842), 'os.path.join', 'os.path.join', (['self.output_folder', 'model...
import numpy as np import cv2 from Feature_Matching import initial_guess from velocity import velocity def distance(velocity_estimate,frame_0_time,time_inc,base_frame,curr_frame): ''' function to calculate distance travelled between frames Parameters: ----------- velocity_estimate = Nx2 array of t...
[ "numpy.identity", "numpy.ones", "Feature_Matching.initial_guess", "velocity.velocity", "numpy.asarray", "numpy.array", "numpy.zeros", "cv2.Rodrigues", "numpy.vstack", "cv2.imread" ]
[((7973, 8064), 'numpy.array', 'np.array', (['[[904.04572636, 0, 645.74398382], [0, 907.01811462, 512.14951996], [0, 0, 1]]'], {}), '([[904.04572636, 0, 645.74398382], [0, 907.01811462, 512.14951996],\n [0, 0, 1]])\n', (7981, 8064), True, 'import numpy as np\n'), ((10920, 10942), 'numpy.asarray', 'np.asarray', (['po...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import List, Dict, Callable import numpy as np from allennlp.common.checks import ConfigurationError from kb_utils.kb_context import KBContext from utils import EntityType, Universe class Action: def __init__(self, action_str: ...
[ "numpy.array", "allennlp.common.checks.ConfigurationError" ]
[((4506, 4549), 'numpy.array', 'np.array', (['entity_type_indices'], {'dtype': 'np.int'}), '(entity_type_indices, dtype=np.int)\n', (4514, 4549), True, 'import numpy as np\n'), ((2231, 2297), 'allennlp.common.checks.ConfigurationError', 'ConfigurationError', (['f"""Do not support for main type as {main_type}"""'], {}),...
import numpy as np import scipy.stats as stats E = [] for ch in range(1,17): energy = [] if ch<10: file_name = "20210218-ch0" + str(ch) + ".e.txt" else: file_name = "20210218-ch" + str(ch) + ".e.txt" with open(file_name,"r") as fl: for line in fl: energy.append(floa...
[ "numpy.array", "scipy.stats.ks_2samp" ]
[((344, 360), 'numpy.array', 'np.array', (['energy'], {}), '(energy)\n', (352, 360), True, 'import numpy as np\n'), ((499, 529), 'scipy.stats.ks_2samp', 'stats.ks_2samp', (['E[ch1]', 'E[ch2]'], {}), '(E[ch1], E[ch2])\n', (513, 529), True, 'import scipy.stats as stats\n')]
"""Optimizer for weights of portfolio.""" from datetime import datetime from typing import Optional import numpy as np from scipy.optimize import minimize from mypo.common import safe_cast from mypo.market import Market from mypo.optimizer.base_optimizer import BaseOptimizer from mypo.sampler import Sampler class C...
[ "numpy.ones", "numpy.float64", "mypo.common.safe_cast", "numpy.max", "numpy.sum", "numpy.dot", "numpy.quantile", "mypo.sampler.Sampler" ]
[((2192, 2211), 'mypo.common.safe_cast', 'safe_cast', (['minout.x'], {}), '(minout.x)\n', (2201, 2211), False, 'from mypo.common import safe_cast\n'), ((2227, 2249), 'numpy.float64', 'np.float64', (['minout.fun'], {}), '(minout.fun)\n', (2237, 2249), True, 'import numpy as np\n'), ((1458, 1512), 'mypo.sampler.Sampler',...
import json from os import path from os import mkdir import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np from astropy.time import Time import glob import matplotlib.cm as cm def convert_dict_to_nested_type(report): if type(report) is dict: for k, v in report.items(): ...
[ "matplotlib.pyplot.setp", "numpy.mean", "matplotlib.pyplot.subplot2grid", "json.dump", "json.load", "astropy.time.Time", "numpy.stack", "os.path.isdir", "matplotlib.pyplot.figure", "numpy.array", "numpy.concatenate", "matplotlib.pyplot.tight_layout", "os.mkdir", "numpy.cumsum", "numpy.sh...
[((614, 637), 'astropy.time.Time', 'Time', (['date'], {'format': '"""jd"""'}), "(date, format='jd')\n", (618, 637), False, 'from astropy.time import Time\n'), ((885, 905), 'os.path.isdir', 'path.isdir', (['dir_path'], {}), '(dir_path)\n', (895, 905), False, 'from os import path\n'), ((6679, 6715), 'matplotlib.pyplot.su...
# Copyright (c) 2018 NVIDIA Corporation from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import math import numpy as np import python_speech_features as psf import resampy as rs import scipy.io.wavfile as wave def get_speech_features_from_file(filename, num_fe...
[ "numpy.mean", "numpy.abs", "math.ceil", "numpy.random.rand", "python_speech_features.sigproc.framesig", "python_speech_features.logfbank", "python_speech_features.mfcc", "numpy.random.randint", "python_speech_features.sigproc.logpowspec", "scipy.io.wavfile.read", "numpy.std", "numpy.pad", "n...
[((1419, 1438), 'scipy.io.wavfile.read', 'wave.read', (['filename'], {}), '(filename)\n', (1428, 1438), True, 'import scipy.io.wavfile as wave\n'), ((2559, 2656), 'numpy.random.randint', 'np.random.randint', ([], {'low': "augmentation['noise_level_min']", 'high': "augmentation['noise_level_max']"}), "(low=augmentation[...
''' Design a delivery algorithm where you want to carry as many packages as possible under a weight limit. Assumptions: - Weight is a positive integer - Each item has a price and a weight - Total weight limit is a positive amount - Want to maximize quantity of packages to fit, not necessarily the heaviest item...
[ "numpy.random.choice" ]
[((801, 839), 'numpy.random.choice', 'np.random.choice', (['(10)', '(10)'], {'replace': '(True)'}), '(10, 10, replace=True)\n', (817, 839), True, 'import numpy as np\n')]
""" Expansion and contraction of resource allocation in sensory bottlenecks. <NAME>., <NAME>., <NAME>. Written in 2021 by <NAME>. To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distribut...
[ "numpy.sqrt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.ylim", "matplotlib.pyplot.xlim", "matplotlib.pyplot.legend" ]
[((1221, 1233), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1231, 1233), True, 'import matplotlib.pyplot as plt\n'), ((1715, 1819), 'matplotlib.pyplot.plot', 'plt.plot', (['[0, 100]', '[d_line, d_line]'], {'linestyle': '"""--"""', 'color': '"""#9c2c2c"""', 'label': '"""Proportional density"""'}), "([0,...
import numpy as np import math def grid_reading(key, table): _key = sorted(key) order = [key.index(i) for i in _key] print(list(key)) #print(_key) print('Порядок использования столбцов:', order) m = table.shape[0] res = '' for j in order: for i in range(m): res += ta...
[ "math.ceil", "numpy.roll", "numpy.sqrt", "numpy.array", "numpy.zeros", "numpy.random.randint", "numpy.empty", "numpy.vstack", "numpy.full", "numpy.arange" ]
[((4187, 4199), 'numpy.array', 'np.array', (['ru'], {}), '(ru)\n', (4195, 4199), True, 'import numpy as np\n'), ((732, 752), 'math.ceil', 'math.ceil', (['(t_len / n)'], {}), '(t_len / n)\n', (741, 752), False, 'import math\n'), ((759, 778), 'numpy.full', 'np.full', (['(m, n)', '""""""'], {}), "((m, n), '')\n", (766, 77...
import argparse import numpy as np import os import sys from time import sleep import pandas as pd # running on Mac for testing if 'darwin' in sys.platform: from fake_rpi.RPi import GPIO as GPIO import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 from matplotlib import animation ...
[ "numpy.log10", "RPi.GPIO.output", "time.sleep", "numpy.array", "numpy.arange", "RPi.GPIO.setmode", "numpy.save", "os.path.exists", "RPi.GPIO.cleanup", "argparse.ArgumentParser", "numpy.where", "numpy.max", "matplotlib.pyplot.close", "pandas.DataFrame", "matplotlib.pyplot.cla", "numpy.r...
[((1391, 1447), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['bt_no', 'vis_name', 'time_step']"}), "(columns=['bt_no', 'vis_name', 'time_step'])\n", (1403, 1447), True, 'import pandas as pd\n'), ((344, 367), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (358, 367), False, 'import m...
from typing import Optional, Tuple, Sequence, Type, Union, Dict import numpy as np from anndata import AnnData import scipy.stats from scipy import sparse from scanpy import logging as logg import graph_tool.all as gt import pandas as pd from .._utils import get_cell_loglikelihood, get_cell_back_p, state_from_blocks ...
[ "graph_tool.all.remove_parallel_edges", "graph_tool.all.vertex_similarity", "numpy.sqrt", "numpy.log", "scanpy.preprocessing.neighbors", "scanpy._utils._choose_graph", "numpy.array", "scanpy.tools.pca", "graph_tool.all.BlockState", "pandas.Categorical", "numpy.max", "numpy.dot", "scanpy.exte...
[((11570, 11634), 'numpy.array', 'np.array', (['[(1 - 1 / adata.obsm[x].shape[1]) for x in obsm_names]'], {}), '([(1 - 1 / adata.obsm[x].shape[1]) for x in obsm_names])\n', (11578, 11634), True, 'import numpy as np\n'), ((13210, 13252), 'scanpy.logging.info', 'logg.info', (['"""Adding cell similarity scores"""'], {}), ...
import importlib import datetime import argparse import random import uuid import time import os import numpy as np import torch from torch.autograd import Variable from metrics.metrics import confusion_matrix import matplotlib.pyplot as plt from main import load_datasets # Import saliency methods #from fullgrad_sa...
[ "fullgrad_saliency_master.saliency.gradcam.GradCAM", "fullgrad_saliency_master.saliency.smoothgrad.SmoothGrad", "torch.sum", "matplotlib.pyplot.imshow", "argparse.ArgumentParser", "numpy.random.seed", "matplotlib.pyplot.axis", "torch.abs", "importlib.import_module", "matplotlib.pyplot.gcf", "uui...
[((2135, 2152), 'torch.sum', 'torch.sum', (['scores'], {}), '(scores)\n', (2144, 2152), False, 'import torch\n'), ((2241, 2258), 'torch.abs', 'torch.abs', (['x_grad'], {}), '(x_grad)\n', (2250, 2258), False, 'import torch\n'), ((2305, 2362), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""...
import os from asrlib.utils import base, reader, audio from asrlib.utils.wer import compute_wer import time from collections import OrderedDict import glob import numpy as np from absl import logging, app, flags flags.DEFINE_string('dataset', 'testdata/dataset', 'the dataset dir') flags.DEFINE_string('outdir', '/tmp/...
[ "asrlib.utils.base.StringIO", "collections.OrderedDict", "asrlib.utils.reader.read_txt_to_dict", "numpy.ceil", "absl.flags.DEFINE_bool", "absl.flags.DEFINE_integer", "asrlib.utils.reader.write_dict_to_txt", "os.path.join", "absl.app.run", "time.sleep", "asrlib.utils.audio.parse_wav_line", "asr...
[((214, 283), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset"""', '"""testdata/dataset"""', '"""the dataset dir"""'], {}), "('dataset', 'testdata/dataset', 'the dataset dir')\n", (233, 283), False, 'from absl import logging, app, flags\n'), ((284, 355), 'absl.flags.DEFINE_string', 'flags.DEFINE_string...
# Standard Library import pandas as pd import statistics as st import numpy as np import imdb from datetime import datetime from datetime import timedelta import multiprocessing import json import time import re import random import matplotlib.pyplot as plt # Email Library from email.mime.text import MIMEText as text i...
[ "statistics.stdev", "google.cloud.language.LanguageServiceClient", "smtplib.SMTP_SSL", "multiprocessing.Process", "time.sleep", "random.choices", "pymongo.MongoClient", "datetime.timedelta", "pandas.notnull", "pandas.to_datetime", "numpy.arange", "textblob.TextBlob", "google.oauth2.service_a...
[((2499, 2513), 'urllib.request.urlopen', 'uReq', (['page_url'], {}), '(page_url)\n', (2503, 2513), True, 'from urllib.request import urlopen as uReq\n'), ((3213, 3262), 'pandas.DataFrame', 'pd.DataFrame', (['movie_dates_list'], {'columns': "['dates']"}), "(movie_dates_list, columns=['dates'])\n", (3225, 3262), True, '...
from simulator.utils.basic_utils import * import numpy as np import pandas as pd from operator import itemgetter from itertools import groupby def rmse(x, y): x, y = new_array(x), new_array(y) return np.sqrt(np.mean((x-y)**2)) def row_norm(mat): """ Compute the norm of a set of vectors, each of which is t...
[ "numpy.nanpercentile", "numpy.equal", "numpy.argsort", "numpy.array", "numpy.einsum", "operator.itemgetter", "numpy.arange", "numpy.mean", "numpy.where", "numpy.diff", "numpy.stack", "pandas.DataFrame", "numpy.meshgrid", "numpy.rad2deg", "numpy.round", "numpy.abs", "numpy.atleast_1d"...
[((1044, 1077), 'numpy.einsum', 'np.einsum', (['"""ij,ij->i"""', 'mat1', 'mat2'], {}), "('ij,ij->i', mat1, mat2)\n", (1053, 1077), True, 'import numpy as np\n'), ((4817, 4855), 'numpy.nanpercentile', 'np.nanpercentile', (['data'], {'q': 'q', 'axis': 'axis'}), '(data, q=q, axis=axis)\n', (4833, 4855), True, 'import nump...
""" ### author: <NAME> ### <EMAIL> ### date: 9/10/2018 """ import os import numpy as np sep = os.sep def get_class_weights(y): """ :param y: labels :return: correct weights of each classes for balanced training """ cls, count = np.unique(y, return_counts=True) counter = dict(zip(cls, count)...
[ "numpy.flip", "numpy.unique" ]
[((253, 285), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (262, 285), True, 'import numpy as np\n'), ((547, 576), 'numpy.flip', 'np.flip', (['copy0.working_arr', '(0)'], {}), '(copy0.working_arr, 0)\n', (554, 576), True, 'import numpy as np\n'), ((832, 861), 'numpy.fl...