code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import pyspark.sql.functions as F import pyspark.sql.types as T from pyspark.ml.feature import IDF, Tokenizer, CountVectorizer def isin(element, test_elements, assume_unique=False, invert=False): """ Impliments the numpy function isin() for legacy versions of the library """ ele...
[ "pyspark.ml.feature.IDF", "pyspark.ml.feature.Tokenizer", "numpy.in1d", "numpy.asarray", "pyspark.ml.feature.CountVectorizer", "pyspark.sql.functions.col" ]
[((327, 346), 'numpy.asarray', 'np.asarray', (['element'], {}), '(element)\n', (337, 346), True, 'import numpy as np\n'), ((2063, 2114), 'pyspark.ml.feature.Tokenizer', 'Tokenizer', ([], {'inputCol': '"""__input"""', 'outputCol': '"""__tokens"""'}), "(inputCol='__input', outputCol='__tokens')\n", (2072, 2114), False, '...
import math, pickle from copy import deepcopy from itertools import count from functools import reduce import numpy as np # from qiskit import QuantumCircuit, QuantumRegister, execute # # from qiskit.extensions import Initialize # from qiskit.circuit.library import Diagonal, GroverOperator #from tqdm.notebook import...
[ "pickle.dump", "functools.reduce", "numpy.random.choice", "numpy.where", "pickle.load", "math.sqrt", "numpy.max", "numpy.exp", "numpy.sum", "numpy.random.randint", "itertools.count", "numpy.empty", "numpy.append", "math.cos", "math.sin", "numpy.arange" ]
[((4782, 4789), 'itertools.count', 'count', ([], {}), '()\n', (4787, 4789), False, 'from itertools import count\n'), ((5104, 5148), 'functools.reduce', 'reduce', (['(lambda e, i: e + prob[i])', 'flags', '(0.0)'], {}), '(lambda e, i: e + prob[i], flags, 0.0)\n', (5110, 5148), False, 'from functools import reduce\n'), ((...
from raytracing import * import numpy import matplotlib.pyplot as plt from matplotlib import pyplot as plt import signal import os def sig(a, b): print("got sigint, exitting!") os._exit(0) def timercb(e): print("timer") signal.signal(signal.SIGINT, sig) f = 50 f_obj = 5 f_tube = 100 f_galvo = 100 f_pol...
[ "signal.signal", "matplotlib.pyplot.plot", "numpy.linspace", "os._exit", "matplotlib.pyplot.show" ]
[((235, 268), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'sig'], {}), '(signal.SIGINT, sig)\n', (248, 268), False, 'import signal\n'), ((348, 375), 'numpy.linspace', 'numpy.linspace', (['(-20)', '(20)', '(21)'], {}), '(-20, 20, 21)\n', (362, 375), False, 'import numpy\n'), ((978, 992), 'matplotlib.pyplot.plot...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/9/21 14:06 # @Author : ganliang # @File : ndcopy.py # @Desc : 数据复制 import numpy as np a = np.arange(10) b = np.copy(a) print ("修改之前:") print (a) print (id(a)) print (b) print (id(b)) a[0] = 100 print ("修改之后:") print (a) print (id(a)) print (b) pr...
[ "numpy.copy", "numpy.arange" ]
[((163, 176), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (172, 176), True, 'import numpy as np\n'), ((181, 191), 'numpy.copy', 'np.copy', (['a'], {}), '(a)\n', (188, 191), True, 'import numpy as np\n')]
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import math """ ############# GENERAL GAS CLASS ########### """ class Gas(): def __init__(self,T,P,R_u=8.31447): self.T = T self.P = P self.R_u=R_u self.normalshock=self.Shock(s...
[ "matplotlib.pyplot.cm.get_cmap", "numpy.sqrt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.plot", "matplotlib.pyplot.style.use", "numpy.log", "matplotlib.pyplot.figure", "numpy.linspace", "numpy.concatenate", "numpy.sin", "matplotl...
[((1554, 1579), 'numpy.sqrt', 'np.sqrt', (['(4 / np.pi * area)'], {}), '(4 / np.pi * area)\n', (1561, 1579), True, 'import numpy as np\n'), ((5698, 5742), 'numpy.concatenate', 'np.concatenate', (['(area_upward, area_downward)'], {}), '((area_upward, area_downward))\n', (5712, 5742), True, 'import numpy as np\n'), ((663...
import numpy as np import numpy.random as rnd import simple_optimise as mlopt vec = rnd.randn(10) mat = rnd.randn(10, 10) mat += mat.T # Single output, single input def f1_1(x): return x**2.0 def fD_1(x): return vec * x def f1_D(x): return x.dot(mat.dot(x)) def f1_DD(x): return vec.dot(x.dot(v...
[ "simple_optimise.finite_difference", "numpy.random.randn" ]
[((86, 99), 'numpy.random.randn', 'rnd.randn', (['(10)'], {}), '(10)\n', (95, 99), True, 'import numpy.random as rnd\n'), ((106, 123), 'numpy.random.randn', 'rnd.randn', (['(10)', '(10)'], {}), '(10, 10)\n', (115, 123), True, 'import numpy.random as rnd\n'), ((368, 402), 'simple_optimise.finite_difference', 'mlopt.fini...
import natsort import numpy as np import pandas as pd import plotly.io as pio import plotly.express as px import plotly.graph_objects as go import plotly.figure_factory as ff import re import traceback from io import BytesIO from sklearn.decomposition import PCA from sklearn.metrics import pairwise as pw import json im...
[ "numpy.prod", "plotly.graph_objects.layout.YAxis", "matplotlib.pyplot.Figure", "io.BytesIO", "numpy.isfinite", "pandas.MultiIndex.from_tuples", "statistics.harmonic_mean", "plotly.express.box", "plotly.graph_objects.Bar", "plotly.graph_objects.Heatmap", "plotly.express.scatter", "sklearn.decom...
[((182063, 182074), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (182072, 182074), True, 'import plotly.graph_objects as go\n'), ((633, 652), 'numpy.unique', 'np.unique', (['x.values'], {}), '(x.values)\n', (642, 652), True, 'import numpy as np\n'), ((779, 791), 'numpy.unique', 'np.unique', (['x'], {})...
import matplotlib.pyplot as plt import numpy as np # データ生成 x = np.linspace(0, 10, 100) y1 = np.sin(x) y2 = np.cos(x) # プロット領域(Figure, Axes)の初期化 plt.figure(figsize=(12, 8)) fig1=plt.subplot(131) fig2=plt.subplot(132) fig3=plt.subplot(133) # 棒グラフの作成 fig1.bar([1,2,3],[3,4,5]) fig1.set_xlabel("x") fig1.set_ylabel("y") f...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.cos", "numpy.sin", "matplotlib.pyplot.ylim", "matplotlib.pyplot.xlim", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show" ]
[((64, 87), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (75, 87), True, 'import numpy as np\n'), ((93, 102), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (99, 102), True, 'import numpy as np\n'), ((108, 117), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (114, 117), True, 'import n...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import cv2, numpy as np parser = argparse.ArgumentParser() parser.add_argument('--path', default='../data/Lena.png', help='Image path.') params = parser.parse_args() image = cv2.imread(params.path) image_to_show = np.copy(image) mouse_pressed = False s_x...
[ "cv2.setMouseCallback", "numpy.copy", "cv2.rectangle", "argparse.ArgumentParser", "cv2.imshow", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread", "cv2.namedWindow" ]
[((98, 123), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (121, 123), False, 'import argparse\n'), ((239, 262), 'cv2.imread', 'cv2.imread', (['params.path'], {}), '(params.path)\n', (249, 262), False, 'import cv2, numpy as np\n'), ((279, 293), 'numpy.copy', 'np.copy', (['image'], {}), '(image...
#!/usr/bin/env /usr/bin/python3 import sys import numpy as np import pymesh import matplotlib matplotlib.use('Qt5Agg') from matplotlib import cm from matplotlib import pyplot as plt from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QT as NavigationToolb...
[ "matplotlib.backends.backend_qt5agg.NavigationToolbar2QT", "numpy.sqrt", "numpy.log", "numpy.logical_not", "matplotlib.collections.LineCollection", "numpy.count_nonzero", "numpy.array", "matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.updateGeometry", "PyQt5.QtWidgets.QApplication", "PyQt5.Qt...
[((95, 119), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (109, 119), False, 'import matplotlib\n'), ((881, 914), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (904, 914), False, 'import warnings\n'), ((2165, 2185), 'numpy.cross', 'np.cross'...
import matplotlib.pyplot as plt import numpy as np import pymc3 import scipy.stats as stats plt.style.use("ggplot") # Parameter values for prior and analytic posterior n = 50 z = 10 alpha = 12 beta = 12 alpha_post = 22 beta_post = 52 # How many samples to carry out for MCMC iterations = 100000 # Use PyMC3 to constr...
[ "pymc3.Metropolis", "matplotlib.pyplot.hist", "pymc3.find_MAP", "matplotlib.pyplot.ylabel", "pymc3.traceplot", "matplotlib.pyplot.xlabel", "pymc3.Beta", "matplotlib.pyplot.style.use", "pymc3.Binomial", "numpy.linspace", "pymc3.sample", "scipy.stats.beta.pdf", "pymc3.Model", "matplotlib.pyp...
[((93, 116), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (106, 116), True, 'import matplotlib.pyplot as plt\n'), ((354, 367), 'pymc3.Model', 'pymc3.Model', ([], {}), '()\n', (365, 367), False, 'import pymc3\n'), ((1078, 1182), 'matplotlib.pyplot.hist', 'plt.hist', (["trace['t...
import os import unittest import numpy as np from pyNastran.bdf.bdf import BDF, BDFCard, CBAR, PBAR, PBARL, GRID, MAT1 from pyNastran.bdf.field_writer_8 import print_card_8 from pyNastran.bdf.mesh_utils.mass_properties import ( mass_properties, mass_properties_nsm) #mass_properties_breakdown from pyNastran.bdf.c...
[ "pyNastran.op2.op2.OP2", "pyNastran.bdf.bdf.GRID", "numpy.array", "unittest.main", "os.remove", "os.path.exists", "pyNastran.bdf.bdf.MAT1", "pyNastran.bdf.field_writer_8.print_card_8", "pyNastran.bdf.mesh_utils.loads.sum_forces_moments", "numpy.allclose", "pyNastran.bdf.cards.test.utils.save_loa...
[((25633, 25648), 'unittest.main', 'unittest.main', ([], {}), '()\n', (25646, 25648), False, 'import unittest\n'), ((902, 922), 'pyNastran.bdf.field_writer_8.print_card_8', 'print_card_8', (['fields'], {}), '(fields)\n', (914, 922), False, 'from pyNastran.bdf.field_writer_8 import print_card_8\n'), ((959, 979), 'pyNast...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 24 10:45:47 2020 @author: ben05 """ import ATL11 import numpy as np from scipy import stats import sys, os, h5py, glob, csv import io import pointCollection as pc import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.colors impor...
[ "csv.DictReader", "argparse.ArgumentParser", "os.getcwd", "os.path.isfile", "h5py.File", "numpy.array", "os.path.basename", "numpy.dtype", "os.remove" ]
[((4048, 4071), 'os.path.isfile', 'os.path.isfile', (['fileout'], {}), '(fileout)\n', (4062, 4071), False, 'import sys, os, h5py, glob, csv\n'), ((8659, 8684), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8682, 8684), False, 'import argparse\n'), ((4081, 4099), 'os.remove', 'os.remove', (['f...
#!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2018 <NAME> <<EMAIL>> # # 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 ...
[ "numpy.arange", "os.path.exists", "numpy.mean", "argparse.ArgumentParser", "sklearn.decomposition.PCA", "tensorflow.Session", "numpy.max", "tensorflow.ConfigProto", "time.localtime", "tensorflow.one_hot", "tensorflow.device", "sklearn.svm.LinearSVC", "numpy.argmax", "time.time", "utils.m...
[((1630, 1664), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""features"""'], {}), "(BASE_DIR, 'features')\n", (1642, 1664), False, 'import os\n'), ((1592, 1617), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1607, 1617), False, 'import os\n'), ((2238, 2265), 'sklearn.decomposition.PCA',...
''' Forecast time series ''' import random import sys import argparse import numpy as np import tensorflow as tf from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error def build_lstm_graph(n_features, n_targets, quantiles, burn_in, num_units, input_k...
[ "numpy.sqrt", "tensorflow.shape", "numpy.column_stack", "tensorflow.contrib.rnn.LSTMCell", "tensorflow.reduce_mean", "tensorflow.variables_initializer", "numpy.repeat", "numpy.isscalar", "argparse.ArgumentParser", "tensorflow.Session", "tensorflow.placeholder", "tensorflow.nn.dynamic_rnn", "...
[((3917, 3939), 'numpy.isscalar', 'np.isscalar', (['quantiles'], {}), '(quantiles)\n', (3928, 3939), True, 'import numpy as np\n'), ((4581, 4645), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.GLOBAL_VARIABLES', 'variable_scope'], {}), '(tf.GraphKeys.GLOBAL_VARIABLES, variable_scope)\n', (4598, 4645...
from math import * import numpy as np def f(x, a=1): return sin(exp(a * x)) def generate(fileName, start=0, end=2, n=20): X = np.linspace(start, end, n) Y = list() for a in range(1, n+1): Y.append([f(x, a) for x in X]) with open('test/X.csv', 'w') as fs: line = X.join(',') ...
[ "numpy.linspace" ]
[((136, 162), 'numpy.linspace', 'np.linspace', (['start', 'end', 'n'], {}), '(start, end, n)\n', (147, 162), True, 'import numpy as np\n')]
from time import time from os import path, listdir from datetime import timedelta from datetime import date as dt_date from datetime import datetime as dt from numpy import cumprod from pandas import DataFrame, read_sql_query, read_csv, concat from functions import psqlEngine class Investments(): def __init__(se...
[ "os.listdir", "pandas.read_csv", "datetime.datetime.strptime", "os.path.join", "datetime.timedelta", "functions.psqlEngine", "time.time", "pandas.DataFrame", "datetime.date.today", "pandas.concat", "numpy.cumprod" ]
[((3407, 3418), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (3416, 3418), False, 'from pandas import DataFrame, read_sql_query, read_csv, concat\n'), ((3469, 3494), 'functions.psqlEngine', 'psqlEngine', (['self.database'], {}), '(self.database)\n', (3479, 3494), False, 'from functions import psqlEngine\n'), ((13...
import torch import shutil import numpy as np import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt # import cv2 from skimage.transform import resize import torchvision.transforms as transforms from sklearn.metrics import precision_score, recall_score, f1_score, roc_auc_score class AverageMeter(obje...
[ "torchvision.transforms.ToPILImage", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "numpy.array", "torchvision.transforms.ColorJitter", "sklearn.metrics.roc_auc_score", "matplotlib.pyplot.imshow", "matplotlib.pyplot.plot", "numpy.max", "numpy.stack", "numpy.min", "matplotl...
[((64, 85), 'matplotlib.use', 'matplotlib.use', (['"""pdf"""'], {}), "('pdf')\n", (78, 85), False, 'import matplotlib\n'), ((773, 800), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (783, 800), False, 'import torch\n'), ((2629, 2674), 'sklearn.metrics.precision_score', 'precision_score...
# coding: utf-8 __author__ = 'ZFTurbo: https://kaggle.com/zfturbo' import os import time import pickle import numpy as np import pandas as pd from multiprocessing import Pool, cpu_count from itertools import repeat from ensemble_boxes import * from map_boxes import * def save_in_file_fast(arr, file_name): pickl...
[ "pandas.read_csv", "multiprocessing.cpu_count", "numpy.array", "numpy.zeros", "multiprocessing.Pool", "numpy.concatenate", "os.path.basename", "pandas.DataFrame", "time.time", "itertools.repeat" ]
[((479, 496), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (490, 496), True, 'import pandas as pd\n'), ((1336, 1378), 'pandas.DataFrame', 'pd.DataFrame', (['ImageID'], {'columns': "['ImageId']"}), "(ImageID, columns=['ImageId'])\n", (1348, 1378), True, 'import pandas as pd\n'), ((6280, 6324), 'numpy.ar...
#!/usr/local/bin/python import torch import torch.nn as nn from torch.autograd import Variable import numpy as np from PIL import Image import os, glob, argparse, tqdm from data_loader import get_data from model import get_model #==========================================================================# def create_fol...
[ "torch.nn.CrossEntropyLoss", "argparse.ArgumentParser", "os.makedirs", "torch.load", "os.path.join", "os.path.dirname", "numpy.array", "torch.cuda.is_available", "os.path.isdir", "os.path.basename", "data_loader.get_data", "model.get_model" ]
[((1364, 1389), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1387, 1389), False, 'import torch\n'), ((1722, 1743), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1741, 1743), True, 'import torch.nn as nn\n'), ((4232, 4257), 'argparse.ArgumentParser', 'argparse.Argumen...
""" eep_functions.py (C) <NAME> Institute for Astronomy University of Hawaiʻi 2019 July 1 Python utilities to convert stellar evolution tracks to downsampled tracks based on Equivalent Evolutionary Phases (EEPs) according to the method of Dotter (2016). """ from multiprocessing import Pool import numpy as np from sc...
[ "numpy.log10", "numpy.sqrt", "matplotlib.pyplot.gca", "tqdm.tqdm", "scipy.interpolate.interp1d", "numpy.zeros", "matplotlib.pyplot.figure", "multiprocessing.Pool", "pandas.DataFrame", "matplotlib.pyplot.show" ]
[((2461, 2507), 'pandas.DataFrame', 'pd.DataFrame', (['eep_track'], {'columns': 'track.columns'}), '(eep_track, columns=track.columns)\n', (2473, 2507), True, 'import pandas as pd\n'), ((10987, 11012), 'numpy.log10', 'np.log10', (["track['L/Lsun']"], {}), "(track['L/Lsun'])\n", (10995, 11012), True, 'import numpy as np...
import math import numpy as np def quaternion_to_rotation_matrix(q): # Original C++ Method defined in pba/src/pba/DataInterface.h qq = math.sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]) qw = qx = qy = qz = 0 if qq > 0: # NORMALIZE THE QUATERNION qw = q[0] / qq qx = q[1]...
[ "numpy.identity", "numpy.isclose", "numpy.ones", "numpy.hstack", "numpy.delete", "math.sqrt", "numpy.linalg.det", "numpy.array", "numpy.zeros", "numpy.dot", "numpy.zeros_like" ]
[((146, 210), 'math.sqrt', 'math.sqrt', (['(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3])'], {}), '(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3])\n', (155, 210), False, 'import math\n'), ((431, 460), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {'dtype': 'float'}), '((3, 3), dtype=float)\n', (439, 460), Tr...
import numpy as np import matplotlib.pyplot as plt fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True, figsize=(8,12)) # Plot pow with different settings t = 1e-2 rcut = 5 settings = [ [2, rcut/(1/t*(1-t)) ** (1 / 2), 1], [4, rcut/(1/t*(1-t)) ** (1 / 4), 1], [8, rcut/(1/t*(1-t)) ** (1 / 8), 1], ] rmin...
[ "matplotlib.pyplot.subplots_adjust", "numpy.log", "numpy.exp", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((76, 124), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {'sharex': '(True)', 'figsize': '(8, 12)'}), '(3, 1, sharex=True, figsize=(8, 12))\n', (88, 124), True, 'import matplotlib.pyplot as plt\n'), ((2438, 2502), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'left': '(0.1)', 'rig...
import numpy as np import keras from keras.models import Model from keras.layers import Input, Dense, Activation, Dropout, BatchNormalization, LeakyReLU from keras.optimizers import Adam from keras import backend as K # 今更きけないGAN # https://qiita.com/triwave33/items/1890ccc71fab6cbca87e # https://qiita.com/p...
[ "numpy.random.rand", "keras.backend.gradients", "numpy.array", "keras.layers.Activation", "keras.layers.Dense", "keras.backend.square", "keras.backend.placeholder", "keras.models.Model", "numpy.random.permutation", "keras.optimizers.Adam", "numpy.random.normal", "numpy.ones", "numpy.add", ...
[((1635, 1666), 'keras.layers.Input', 'Input', ([], {'shape': '(self.latent_dim,)'}), '(shape=(self.latent_dim,))\n', (1640, 1666), False, 'from keras.layers import Input, Dense, Activation, Dropout, BatchNormalization, LeakyReLU\n'), ((2075, 2115), 'keras.models.Model', 'Model', ([], {'input': 'latent_inputs', 'output...
__author__ = '<NAME>' __copyright__ = 'Copyright 2017, Profactor GmbH' __license__ = 'BSD' import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import cv2 def crop(img, border): return img[border[1]:-border[1], border[0]:-border[0]] if __name__ == '__main__': import argparse ...
[ "numpy.mean", "numpy.savez", "argparse.ArgumentParser", "pandas.DataFrame.from_csv", "numpy.stack", "os.path.dirname", "cv2.imread" ]
[((329, 451), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create mean depth images for RGB/IR by averaging over redundant captures."""'}), "(description=\n 'Create mean depth images for RGB/IR by averaging over redundant captures.'\n )\n", (352, 451), False, 'import argparse\n')...
import abc import numpy as np from sklearn.metrics import accuracy_score class BaseMetric(): def __init__(self): self.preds = [] self.targets = [] def append(self, preds, targets): self.preds.extend(preds.data.cpu().numpy()) self.targets.extend(targets.data.cpu().numpy()) ...
[ "sklearn.metrics.accuracy_score", "numpy.argmax" ]
[((713, 742), 'numpy.argmax', 'np.argmax', (['self.preds'], {'axis': '(1)'}), '(self.preds, axis=1)\n', (722, 742), True, 'import numpy as np\n'), ((758, 793), 'sklearn.metrics.accuracy_score', 'accuracy_score', (['preds', 'self.targets'], {}), '(preds, self.targets)\n', (772, 793), False, 'from sklearn.metrics import ...
import os import tensorflow as tf from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as viz_utils from object_detection.builders import model_builder from object_detection.utils import config_util import cv2 import numpy as np from matplotlib import pyplot as plt f...
[ "imutils.video.VideoStream", "object_detection.builders.model_builder.build", "object_detection.utils.visualization_utils.visualize_boxes_and_labels_on_image_array", "os.path.join", "imutils.video.FPS", "numpy.array", "cv2.circle", "cv2.destroyAllWindows", "object_detection.utils.label_map_util.crea...
[((1681, 1766), 'object_detection.utils.config_util.get_configs_from_pipeline_file', 'config_util.get_configs_from_pipeline_file', (['"""detect_soldiers_v5/pipeline.config"""'], {}), "('detect_soldiers_v5/pipeline.config'\n )\n", (1723, 1766), False, 'from object_detection.utils import config_util\n'), ((1780, 1849)...
# coding: utf8 from skimage.io import imread from skimage.measure import label from openslide import OpenSlide import numpy import sys from skimage.morphology import dilation import os import pickle slidename = str(sys.argv[1]) probapath = str(sys.argv[2]) offsetx = 0 offsety = 0 slide = OpenSlide(slidename) prob...
[ "os.path.exists", "pickle.dump", "numpy.where", "skimage.io.imread", "numpy.zeros", "openslide.OpenSlide" ]
[((294, 314), 'openslide.OpenSlide', 'OpenSlide', (['slidename'], {}), '(slidename)\n', (303, 314), False, 'from openslide import OpenSlide\n'), ((329, 346), 'skimage.io.imread', 'imread', (['probapath'], {}), '(probapath)\n', (335, 346), False, 'from skimage.io import imread\n'), ((424, 452), 'numpy.where', 'numpy.whe...
""" Author: <NAME> Construct paper sequence for papers/authors predict_paper. """ import sys import os BASE_PATH = os.path.abspath(os.path.join(os.getcwd())) sys.path.append(BASE_PATH) import pickle import random import numpy as np import config dataset_ids = dict() min_citations = config.min_citations seed = 1234 #...
[ "pickle.dump", "random.shuffle", "pickle.load", "random.seed", "os.getcwd", "numpy.concatenate", "sys.path.append" ]
[((158, 184), 'sys.path.append', 'sys.path.append', (['BASE_PATH'], {}), '(BASE_PATH)\n', (173, 184), False, 'import sys\n'), ((785, 802), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (796, 802), False, 'import random\n'), ((803, 820), 'random.shuffle', 'random.shuffle', (['l'], {}), '(l)\n', (817, 820), F...
import numpy as np import pandas as pd from collections import Counter from skmultilearn.model_selection.measures import get_combination_wise_output_matrix from skmultilearn.model_selection import iterative_train_test_split from tqdm import tqdm def get_section(report, section_name, section_status = False): if rep...
[ "pandas.read_csv", "numpy.where", "numpy.squeeze", "numpy.count_nonzero", "numpy.array", "skmultilearn.model_selection.measures.get_combination_wise_output_matrix", "skmultilearn.model_selection.iterative_train_test_split", "numpy.expand_dims", "pandas.DataFrame", "numpy.nan_to_num" ]
[((2700, 2788), 'pandas.read_csv', 'pd.read_csv', (['"""physionet.org/files/mimic-cxr-jpg/2.0.0/mimic-cxr-2.0.0-chexpert.csv"""'], {}), "(\n 'physionet.org/files/mimic-cxr-jpg/2.0.0/mimic-cxr-2.0.0-chexpert.csv')\n", (2711, 2788), True, 'import pandas as pd\n'), ((2793, 2881), 'pandas.read_csv', 'pd.read_csv', (['""...
import torch import torch.nn as nn import torch.sparse from torch.autograd import Variable import numpy as np import sys from torch.autograd import Function import math import h5py import json # from . import resnet1 import matplotlib.pyplot as plt from skimage.transform import resize #################################...
[ "torch.mul", "torch.nn.ReLU", "torch.nn.Dropout", "torch.nn.Sequential", "torch.pow", "torch.exp", "numpy.array", "torch.cuda.is_available", "torch.sum", "torch.squeeze", "sys.exit", "numpy.arange", "torch.nn.Sigmoid", "torch.nn.parallel.data_parallel", "torch.mean", "torch.floor", "...
[((1208, 1233), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1231, 1233), False, 'import torch\n'), ((3377, 3402), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3400, 3402), False, 'import torch\n'), ((4437, 4455), 'torch.mm', 'torch.mm', (['S', 'input'], {}), '(S,...
import gym import numpy as np import tensorflow as tf from tensorflow import saved_model as sm from easy_rl.utils.window_stat import WindowStat from easy_rl.utils.gym_wrapper.atari_wrapper import make_atari, wrap_deepmind import time def main(): gym_env = gym.make("CartPole-v0") atari_env = make_atari("PongN...
[ "tensorflow.Session", "numpy.asarray", "easy_rl.utils.gym_wrapper.atari_wrapper.wrap_deepmind", "tensorflow.saved_model.loader.load", "tensorflow.saved_model.utils.get_tensor_from_tensor_info", "time.sleep", "easy_rl.utils.gym_wrapper.atari_wrapper.make_atari", "easy_rl.utils.window_stat.WindowStat", ...
[((262, 285), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (270, 285), False, 'import gym\n'), ((303, 335), 'easy_rl.utils.gym_wrapper.atari_wrapper.make_atari', 'make_atari', (['"""PongNoFrameskip-v4"""'], {}), "('PongNoFrameskip-v4')\n", (313, 335), False, 'from easy_rl.utils.gym_wrapper....
""" Optimal binning algorithm for continuous target. """ # <NAME> <<EMAIL>> # Copyright (C) 2019 import numbers import time from sklearn.utils import check_array import numpy as np from ..information import solver_statistics from ..logging import Logger from .auto_monotonic import auto_monotonic_continuous from .a...
[ "numpy.ceil", "numpy.digitize", "numpy.asarray", "time.perf_counter", "numpy.min", "numpy.max", "numpy.count_nonzero", "numpy.sum", "numpy.array", "numpy.argsort", "numpy.empty", "sklearn.utils.check_array", "numpy.std", "numpy.full", "numpy.round" ]
[((21227, 21246), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (21244, 21246), False, 'import time\n'), ((21733, 21752), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (21750, 21752), False, 'import time\n'), ((23696, 23715), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (23713...
from numpy import exp, pi from ....Classes.Arc1 import Arc1 from ....Classes.Arc3 import Arc3 from ....Functions.Geometry.merge_notch_list import merge_notch_list def get_yoke_desc(self, sym=1, is_reversed=False, prop_dict=None): """This method returns an ordered description of the elements that defines the ...
[ "numpy.exp" ]
[((2967, 3003), 'numpy.exp', 'exp', (["(1.0j * yoke_dict['begin_angle'])"], {}), "(1.0j * yoke_dict['begin_angle'])\n", (2970, 3003), False, 'from numpy import exp, pi\n'), ((3031, 3065), 'numpy.exp', 'exp', (["(1.0j * yoke_dict['end_angle'])"], {}), "(1.0j * yoke_dict['end_angle'])\n", (3034, 3065), False, 'from numpy...
# Naive bayes and XGBoost with Tfidf vectorization used as benchmarks from utils import * from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectorizer from nltk import word_tokenize from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet from n...
[ "sklearn.feature_extraction.text.CountVectorizer", "numpy.array", "sklearn.naive_bayes.MultinomialNB", "sklearn.ensemble.GradientBoostingClassifier", "time.time" ]
[((1950, 2005), 'numpy.array', 'np.array', (['[item[1] for item in train_ls]'], {'dtype': 'np.long'}), '([item[1] for item in train_ls], dtype=np.long)\n', (1958, 2005), True, 'import numpy as np\n'), ((2018, 2071), 'numpy.array', 'np.array', (['[item[1] for item in dev_ls]'], {'dtype': 'np.long'}), '([item[1] for item...
''' prep_dev_notebook: pred_newshapes_dev: Runs against new_shapes ''' import os import sys import random import math import re import gc import time import numpy as np import cv2 import matplotlib import matplotlib.pyplot as plt import tensorflow as tf import keras import keras.backend as KB import mrcnn.model_mod ...
[ "mrcnn.new_shapes.NewShapesDataset", "mrcnn.datagen.data_generator", "mrcnn.new_shapes.NewShapesConfig", "os.path.join", "mrcnn.model_mod.MaskRCNN", "os.getcwd", "platform.system", "mrcnn.shapes.ShapesConfig", "mrcnn.shapes.ShapesDataset", "pprint.PrettyPrinter", "keras.backend.clear_session", ...
[((597, 614), 'platform.system', 'platform.system', ([], {}), '()\n', (612, 614), False, 'import platform\n'), ((2144, 2185), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(2)', 'width': '(100)'}), '(indent=2, width=100)\n', (2164, 2185), False, 'import pprint\n'), ((2186, 2264), 'numpy.set_printopti...
import numpy as np import datetime from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import SVC from sklearn.neural_network import MLPClassifier import sklearn.metrics from ops import add_features, augment_data from sklearn.model_selection import tra...
[ "numpy.diagonal", "numpy.reshape", "ops.augment_data", "sklearn.neural_network.MLPClassifier", "sklearn.model_selection.train_test_split", "numpy.asarray", "numpy.column_stack", "ops.add_features", "sklearn.preprocessing.StandardScaler", "numpy.sum", "numpy.zeros", "datetime.datetime.now", "...
[((463, 496), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (486, 496), False, 'import warnings\n'), ((497, 531), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (516, 531), True, 'import numpy as np\n'), ((798, 814), 's...
import numpy as np import matplotlib.pyplot as plt from matplotlib import patches #################### # 8 custom methods # #################### def plot_custom_bar_chart_with_error(input_data, input_names=None, fig_tag=1, ...
[ "matplotlib.pyplot.setp", "numpy.mean", "matplotlib.patches.Rectangle", "numpy.round", "matplotlib.pyplot.figure", "numpy.around", "matplotlib.pyplot.subplot", "matplotlib.pyplot.subplot2grid", "numpy.arange" ]
[((842, 928), 'matplotlib.pyplot.figure', 'plt.figure', (['fig_tag'], {'figsize': 'input_fig_size', 'dpi': '(100)', 'facecolor': '"""w"""', 'edgecolor': '"""k"""'}), "(fig_tag, figsize=input_fig_size, dpi=100, facecolor='w',\n edgecolor='k')\n", (852, 928), True, 'import matplotlib.pyplot as plt\n'), ((1062, 1116), ...
# <NAME>, Nov 2018 # # This script analyzes the data and makes predictions. # It creates a decision tree classifier with ideal hyperparameters # (maximum depth and minimum samples split). These hyperparameters # are calculated over the 80% training data using 3-fold cross validation. # The predictions are made on the 2...
[ "argparse.ArgumentParser", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.tree.DecisionTreeClassifier", "numpy.argmax", "numpy.linspace", "numpy.vstack", "sklearn.model_selection.cross_val_score" ]
[((900, 925), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (923, 925), False, 'import argparse\n'), ((1137, 1165), 'pandas.read_csv', 'pd.read_csv', (['args.input_file'], {}), '(args.input_file)\n', (1148, 1165), True, 'import pandas as pd\n'), ((1437, 1474), 'sklearn.model_selection.train_te...
import numpy as np def _sum_by_group_sorted(indices, *values): """ Auxiliary function to sum up values by some given indices (both as numpy arrays). Expects the indices and values to already be sorted. :param indices: :type indices: :param values: :type values: :return: :rtype: ...
[ "numpy.argsort", "numpy.cumsum" ]
[((1261, 1280), 'numpy.argsort', 'np.argsort', (['indices'], {}), '(indices)\n', (1271, 1280), True, 'import numpy as np\n'), ((830, 859), 'numpy.cumsum', 'np.cumsum', (['val[i]'], {'out': 'val[i]'}), '(val[i], out=val[i])\n', (839, 859), True, 'import numpy as np\n')]
import argparse import pdb import laspy import os import shutil import numpy as np from tqdm import tqdm from semantics_recovery import all_path, mkdir def config_parser(): parser = argparse.ArgumentParser( description='Semantic label recovery script.', formatter_class=argparse.ArgumentDefaultsHel...
[ "os.path.exists", "os.listdir", "numpy.minimum", "argparse.ArgumentParser", "numpy.logical_and", "numpy.unique", "os.path.join", "semantics_recovery.mkdir", "numpy.logical_or", "numpy.stack", "numpy.zeros", "shutil.copy", "os.path.abspath", "numpy.maximum", "semantics_recovery.all_path",...
[((188, 318), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Semantic label recovery script."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Semantic label recovery script.',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (211, 318), F...
"""util functions # many old functions, need to clean up # homography --> homography # warping # loss --> delete if useless """ import numpy as np import torch from pathlib import Path import datetime import datetime from collections import OrderedDict import torch.nn.functional as F import torch.nn as nn ###### check...
[ "scipy.io.savemat", "tensorflow.shape", "numpy.random.rand", "yaml.load", "numpy.argsort", "numpy.array", "utils.utils.warp_points", "torch.sum", "torch.nn.functional.softmax", "numpy.arange", "torch.arange", "matplotlib.pyplot.imshow", "torch.nn.functional.grid_sample", "os.listdir", "n...
[((682, 736), 'numpy.concatenate', 'np.concatenate', (['(img_gray, img_gray, img_gray)'], {'axis': '(0)'}), '((img_gray, img_gray, img_gray), axis=0)\n', (696, 736), True, 'import numpy as np\n'), ((1100, 1109), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (1104, 1109), False, 'from pathlib import Path\n'), ((...
# Author: <NAME> (<EMAIL>) 05/31/2018 # Modified by <NAME> 07/12/2020 import bpy import mathutils import numpy as np import os import sys import time import pdb import argparse def setup_blender(width, height, focal_length, output_dir): # camera #bpy.ops.object.delete() for m in bpy.data.meshes: ...
[ "bpy.data.meshes.remove", "mathutils.Vector", "os.makedirs", "bpy.ops.transform.rotate", "os.path.join", "numpy.array", "bpy.data.materials.remove", "bpy.ops.import_scene.obj", "numpy.loadtxt", "numpy.arctan" ]
[((2388, 2414), 'numpy.loadtxt', 'np.loadtxt', (['viewspace_path'], {}), '(viewspace_path)\n', (2398, 2414), True, 'import numpy as np\n'), ((2434, 2465), 'numpy.loadtxt', 'np.loadtxt', (['test_predicted_path'], {}), '(test_predicted_path)\n', (2444, 2465), True, 'import numpy as np\n'), ((2614, 2682), 'numpy.array', '...
import pytest import os import numpy as np import dxx @pytest.fixture(scope="module") def mock_data_file() -> str: mock_file_name = "mock.DSB" sampling_freq = 48000 mock_data = np.arange(5 * sampling_freq, dtype=np.int16) dxx.write(mock_file_name, mock_data) yield mock_file_name os.remove(mo...
[ "pytest.fixture", "dxx.write", "numpy.arange", "os.remove" ]
[((59, 89), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (73, 89), False, 'import pytest\n'), ((193, 237), 'numpy.arange', 'np.arange', (['(5 * sampling_freq)'], {'dtype': 'np.int16'}), '(5 * sampling_freq, dtype=np.int16)\n', (202, 237), True, 'import numpy as np\n'), ((24...
import numpy as np import argparse import os import random from tensorflow.python.training.tracking.util import Checkpoint os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import time import json import tensorflow as tf from tensorflow.keras import optimizers from tensorflow.keras.layers import * from tensorflow.keras.models ...
[ "train_tf.train_model", "model_tf.TrajPreLocalAttnLong", "train_tf.generate_input_history", "model_tf.TrajPreAttnAvgLongUser", "argparse.ArgumentParser", "tensorflow.keras.callbacks.ReduceLROnPlateau", "train_tf.markov", "numpy.random.seed", "random.sample", "tensorflow.keras.losses.SparseCategori...
[((946, 1588), 'train_tf.RnnParameterData', 'RnnParameterData', ([], {'loc_emb_size': 'args.loc_emb_size', 'uid_emb_size': 'args.uid_emb_size', 'voc_emb_size': 'args.voc_emb_size', 'tim_emb_size': 'args.tim_emb_size', 'hidden_size': 'args.hidden_size', 'dropout_p': 'args.dropout_p', 'data_name': 'args.data_name', 'lr':...
import os import numpy as np import json from detectron2.structures import BoxMode import itertools from detectron2.data import DatasetCatalog, MetadataCatalog from detectron2.data.datasets import register_coco_instances, load_coco_json from detectron2.data import detection_utils as utils import detectron2.data.transf...
[ "detectron2.data.detection_utils.filter_empty_instances", "detectron2.modeling.build_model", "detectron2.config.get_cfg", "cv2.imread", "os.path.join", "detectron2.data.DatasetMapper", "detectron2.data.detection_utils.annotations_to_instances", "detectron2.data.detection_utils.transform_instance_annot...
[((1570, 1597), 'copy.deepcopy', 'copy.deepcopy', (['dataset_list'], {}), '(dataset_list)\n', (1583, 1597), False, 'import copy\n'), ((1674, 1730), 'detectron2.data.detection_utils.read_image', 'utils.read_image', (["dataset_list['file_name']"], {'format': 'None'}), "(dataset_list['file_name'], format=None)\n", (1690, ...
from tkinter import * from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from matplotlib.backend_bases import key_press_handler import numpy as np #commandline import argparse #visualization import matplotlib.pyplot as plt #font import matplotlib.font_manager as fm # import pyglet #...
[ "matplotlib.pyplot.text", "matplotlib.backends.backend_tkagg.NavigationToolbar2Tk", "importlib.import_module", "argparse.ArgumentParser", "matplotlib.font_manager.FontProperties", "matplotlib.pyplot.gca", "numpy.array", "matplotlib.pyplot.annotate", "sklearn.neighbors.DistanceMetric.get_metric", "...
[((469, 507), 'sklearn.neighbors.DistanceMetric.get_metric', 'DistanceMetric.get_metric', (['"""euclidean"""'], {}), "('euclidean')\n", (494, 507), False, 'from sklearn.neighbors import DistanceMetric\n'), ((628, 669), 'importlib.import_module', 'importlib.import_module', (['PLUGIN_NAME', '"""."""'], {}), "(PLUGIN_NAME...
import numpy as np a = np.arange(10) * 10 print(a) # [ 0 10 20 30 40 50 60 70 80 90] print(a[5]) # 50 print(a[8]) # 80 print(a[[5, 8]]) # [50 80] print(a[[5, 4, 8, 0]]) # [50 40 80 0] print(a[[5, 5, 5, 5]]) # [50 50 50 50] idx = np.array([[5, 4], [8, 0]]) print(idx) # [[5 4] # [8 0]] print(a[idx]) # [[50 40] ...
[ "numpy.array", "numpy.ix_", "numpy.arange" ]
[((237, 263), 'numpy.array', 'np.array', (['[[5, 4], [8, 0]]'], {}), '([[5, 4], [8, 0]])\n', (245, 263), True, 'import numpy as np\n'), ((1410, 1432), 'numpy.ix_', 'np.ix_', (['[0, 2]', '[1, 3]'], {}), '([0, 2], [1, 3])\n', (1416, 1432), True, 'import numpy as np\n'), ((24, 37), 'numpy.arange', 'np.arange', (['(10)'], ...
import os import numpy as np from PIL import Image from eratosthenes.generic.mapping_io import read_geo_image from eratosthenes.preprocessing.shadow_transforms import mat_to_gray, gamma_adjustment, log_adjustment rgi_id = 'RGI60-01.19773' # Red Glacier bbox = (4353, 5279, 9427, 10980) # 1000 m buffer f2018 = "T05VM...
[ "numpy.uint8", "numpy.dstack", "PIL.Image.fromarray", "os.path.join", "eratosthenes.preprocessing.shadow_transforms.log_adjustment", "eratosthenes.preprocessing.shadow_transforms.mat_to_gray" ]
[((1160, 1179), 'eratosthenes.preprocessing.shadow_transforms.mat_to_gray', 'mat_to_gray', (['I_18_r'], {}), '(I_18_r)\n', (1171, 1179), False, 'from eratosthenes.preprocessing.shadow_transforms import mat_to_gray, gamma_adjustment, log_adjustment\n'), ((1189, 1208), 'eratosthenes.preprocessing.shadow_transforms.mat_to...
# program to extract data from FITS files into files to # represent a box of the stellar atmosphere import numpy as np import os.path import os import sys import time import glob from astropy.io import fits from tqdm import tqdm import importlib import phys importlib.reload(phys) def getdata(f): hdulist = fit...
[ "numpy.swapaxes", "numpy.exp", "numpy.zeros", "numpy.concatenate", "importlib.reload", "astropy.io.fits.open", "numpy.loadtxt", "numpy.broadcast_to", "numpy.arange" ]
[((262, 284), 'importlib.reload', 'importlib.reload', (['phys'], {}), '(phys)\n', (278, 284), False, 'import importlib\n'), ((1051, 1087), 'numpy.loadtxt', 'np.loadtxt', (['"""dims.inp"""'], {'comments': '"""!"""'}), "('dims.inp', comments='!')\n", (1061, 1087), True, 'import numpy as np\n'), ((1488, 1533), 'numpy.broa...
from __future__ import print_function, division from argparse import ArgumentParser import yaml import logging import os import sys import time from subprocess import call from marmot.experiment.import_utils import build_objects, build_object, call_for_each_element, import_class from marmot.experiment.preprocessing_u...
[ "logging.getLogger", "sklearn.metrics.precision_score", "marmot.experiment.import_utils.build_object", "sklearn.metrics.recall_score", "marmot.experiment.context_utils.create_contexts_ngram", "sys.exit", "argparse.ArgumentParser", "marmot.experiment.learning_utils.map_classifiers", "marmot.experimen...
[((768, 863), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (787, 863), False, 'import logging\n'), ((869, 907), 'logging.getLogger', 'logging....
import math import random import numpy from dataclasses import dataclass @dataclass class NetworkParams: """ Parameters to tweak the network """ A: int B: int C: int D: int sigma: float alpha: int = 50 class MatcherNetwork: """ The mathcer network """ SIZE = 10 ...
[ "random.shuffle", "numpy.random.rand", "numpy.tanh", "numpy.sum", "random.random" ]
[((609, 648), 'numpy.random.rand', 'numpy.random.rand', (['self.SIZE', 'self.SIZE'], {}), '(self.SIZE, self.SIZE)\n', (626, 648), False, 'import numpy\n'), ((1061, 1092), 'numpy.sum', 'numpy.sum', (['self.neurons'], {'axis': '(1)'}), '(self.neurons, axis=1)\n', (1070, 1092), False, 'import numpy\n'), ((1111, 1142), 'nu...
""" Test the infrastructure for building a state by projection onto the +1 eigenspace of a set of generators or stabilizers """ import numpy as np from referenceqvm.stabilizer_utils import (compute_action, project_stabilized_state, binary_stabilizer_to_pauli_stabilizer, ...
[ "numpy.allclose", "numpy.sqrt", "numpy.isclose", "pyquil.paulis.sY", "pyquil.paulis.sZ", "referenceqvm.stabilizer_utils.pauli_stabilizer_to_binary_stabilizer", "referenceqvm.stabilizer_utils.compute_action", "pyquil.paulis.sI", "numpy.array", "numpy.zeros", "pytest.raises", "pyquil.paulis.sX",...
[((1212, 1266), 'referenceqvm.stabilizer_utils.pauli_stabilizer_to_binary_stabilizer', 'pauli_stabilizer_to_binary_stabilizer', (['bell_stabilizer'], {}), '(bell_stabilizer)\n', (1249, 1266), False, 'from referenceqvm.stabilizer_utils import compute_action, project_stabilized_state, binary_stabilizer_to_pauli_stabilize...
import numpy as np import scipy as sp import pandas as pd from scipy import stats def get_ecdf(series_): return lambda x: (series_.sort_values() < x).astype(int).mean() def get_sample_acvf(x, h): """ x: series h: shift param return: autocovariance estimator """ n = x.shape[0] shift_x...
[ "numpy.abs", "scipy.stats.ccf", "numpy.sqrt", "scipy.stats.norm.cdf", "scipy.stats.norm.ppf", "numpy.array", "pandas.DataFrame", "scipy.stats.spearmanr" ]
[((1203, 1220), 'numpy.array', 'np.array', (['results'], {}), '(results)\n', (1211, 1220), True, 'import numpy as np\n'), ((1849, 1879), 'numpy.sqrt', 'np.sqrt', (['(gamma_x_0 * gamma_y_0)'], {}), '(gamma_x_0 * gamma_y_0)\n', (1856, 1879), True, 'import numpy as np\n'), ((2515, 2532), 'numpy.array', 'np.array', (['resu...
# coding=UTF-8 """Tests for Urban Flood Risk Mitigation Model.""" import unittest import tempfile import shutil import os from osgeo import gdal from osgeo import osr from osgeo import ogr import numpy import pygeoprocessing import shapely.geometry class UFRMTests(unittest.TestCase): """Tests for...
[ "pygeoprocessing.reclassify_raster", "pygeoprocessing.shapely_geometry_to_vector", "numpy.isclose", "pandas.read_csv", "osgeo.osr.SpatialReference", "natcap.invest.urban_flood_risk_mitigation._calculate_damage_to_infrastructure_in_aoi", "numpy.testing.assert_allclose", "os.path.join", "natcap.invest...
[((593, 621), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'suffix': '"""😎"""'}), "(suffix='😎')\n", (609, 621), False, 'import tempfile\n'), ((750, 783), 'shutil.rmtree', 'shutil.rmtree', (['self.workspace_dir'], {}), '(self.workspace_dir)\n', (763, 783), False, 'import shutil\n'), ((875, 900), 'os.path.dirname', 'o...
from agents import * from models import * import numpy as np import matplotlib matplotlib.use('tkagg') import matplotlib.pyplot as plt import sys import pickle # end class world def speed_profile(file_names): """ This function is to plot speed profiles for several evaluation results. Args: file_nam...
[ "matplotlib.use", "pickle.load", "matplotlib.pyplot.figure", "numpy.linspace", "numpy.linalg.norm", "numpy.shape", "matplotlib.pyplot.subplot", "numpy.arange" ]
[((79, 102), 'matplotlib.use', 'matplotlib.use', (['"""tkagg"""'], {}), "('tkagg')\n", (93, 102), False, 'import matplotlib\n'), ((732, 744), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (742, 744), True, 'import matplotlib.pyplot as plt\n'), ((754, 774), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2...
# -*- coding: utf-8 -*- """Data association solver module. Data association is the key to match a list of observed objects and the list of currently tracked items. It can be reduced to linear assignment problem and solved by Hungarian algorithm (or Kuhn–Munkres algorithm). `scipy` package already implements this alg...
[ "tracker.tracker.get_est_dict", "scipy.optimize.linear_sum_assignment", "tracker.tracker", "absl.flags.DEFINE_integer", "tracker.tracker.get_bbox", "absl.logging.info", "absl.app.run", "numpy.array", "numpy.random.randint", "numpy.empty", "absl.logging.set_verbosity" ]
[((1987, 2023), 'scipy.optimize.linear_sum_assignment', 'linear_sum_assignment', (['(-match_matrix)'], {}), '(-match_matrix)\n', (2008, 2023), False, 'from scipy.optimize import linear_sum_assignment\n'), ((2646, 2674), 'numpy.array', 'np.array', (['unmatched_bbox_idx'], {}), '(unmatched_bbox_idx)\n', (2654, 2674), Tru...
from sklearn.neural_network import MLPRegressor import numpy as np import matplotlib.pyplot as plt x = np.arange(0.0, 1, 0.01).reshape(-1, 1) y = np.sinc(x).ravel() nn = MLPRegressor(hidden_layer_sizes=(3), activation='tanh', solver='lbfgs') n = nn.fit(x, y) test_x = np.arange(-0.1, 1.1, 0.01).re...
[ "sklearn.neural_network.MLPRegressor", "numpy.arange", "numpy.sinc", "matplotlib.pyplot.figure", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((172, 241), 'sklearn.neural_network.MLPRegressor', 'MLPRegressor', ([], {'hidden_layer_sizes': '(3)', 'activation': '"""tanh"""', 'solver': '"""lbfgs"""'}), "(hidden_layer_sizes=3, activation='tanh', solver='lbfgs')\n", (184, 241), False, 'from sklearn.neural_network import MLPRegressor\n'), ((368, 380), 'matplotlib....
import numpy as np import cv2 import socketserver from threading import Thread cap = cv2.VideoCapture(0) cv2.namedWindow('frame') def nothing(x): pass lowh = 0 lowl = 0 lows = 0 highh = 255 highl = 255 highs = 255 cv2.createTrackbar('lowh', 'frame', 0, 255, nothing) cv2.createTrackbar('lowl', 'frame', 0, 255, not...
[ "cv2.inRange", "cv2.contourArea", "cv2.imshow", "numpy.array", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.getTrackbarPos", "cv2.cvtColor", "cv2.findContours", "cv2.moments", "cv2.createTrackbar", "cv2.namedWindow", "cv2.boundingRect" ]
[((86, 105), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (102, 105), False, 'import cv2\n'), ((106, 130), 'cv2.namedWindow', 'cv2.namedWindow', (['"""frame"""'], {}), "('frame')\n", (121, 130), False, 'import cv2\n'), ((220, 272), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""lowh"""', '"""frame...
r"""This module implements the RichardGrowth class. Inheriting from the base Growth class, this class implements a Richard (1959) growth model. """ from growth_modeling import Growth import numpy as np class RichardGrowth(Growth): r"""Implement the Richard's equation growth model. Attributes -------...
[ "numpy.exp" ]
[((3190, 3211), 'numpy.exp', 'np.exp', (['(d - a * b * t)'], {}), '(d - a * b * t)\n', (3196, 3211), True, 'import numpy as np\n')]
import tkinter as tk #possibly nessesary unsure import cv2 import numpy as np import matplotlib.pyplot as plt import time import sys import os import re SCALEDOWNFACTOR = 0.2 #This is a magic number but what can ya do. I dont have a good way of getting image resolution. SCALEUPFACTOR = 2.0 GAIN = 13.2 DIST...
[ "cv2.normalize", "matplotlib.pyplot.ylabel", "numpy.log", "cv2.imshow", "cv2.destroyAllWindows", "sys.exit", "numpy.genfromtxt", "numpy.arange", "cv2.threshold", "matplotlib.pyplot.xlabel", "numpy.asarray", "numpy.exp", "numpy.linspace", "numpy.dot", "numpy.empty", "numpy.vstack", "m...
[((3702, 3725), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (3713, 3725), True, 'import numpy as np\n'), ((3738, 3840), 'numpy.genfromtxt', 'np.genfromtxt', (['"""GAUSS-24.dat"""'], {'skip_header': '(1)', 'skip_footer': '(1)', 'names': '(True)', 'dtype': 'None', 'delimiter': '""" ...
#!/usr/bin/env python # coding: utf-8 # In[24]: import json import random import numpy as np from pathlib import Path from typing import Tuple, List import math import matplotlib.pyplot as plt #get_ipython().run_line_magic('matplotlib', 'inline') from tensorflow.keras.layers import Input, Dense, Conv2D, MaxPooling2...
[ "matplotlib.pyplot.hist", "tensorflow.keras.callbacks.EarlyStopping", "numpy.array", "tensorflow.keras.layers.Dense", "numpy.arange", "matplotlib.pyplot.imshow", "tensorflow.keras.layers.Input", "pathlib.Path", "tensorflow.keras.callbacks.ReduceLROnPlateau", "tensorflow.Session", "json.dumps", ...
[((1099, 1115), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (1113, 1115), True, 'import tensorflow as tf\n'), ((1165, 1190), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (1175, 1190), True, 'import tensorflow as tf\n'), ((1191, 1228), 'tensorflow.keras.backend.s...
import numpy as np import pp def test_connect_bundle_optical2(): """FIXME. Actual length of the route = 499 for some reason the route length is 10um shorter than the layout. b = 15.708 route_length = 10+35+95.05+35+b+35+208+35+b+15 print(route_length) = 499.46 route_length = 10+t+89.55+t+b+...
[ "pp.Component", "numpy.isclose", "pp.routing.link_optical_ports", "pp.c.waveguide_array", "pp.show", "pp.c.nxn" ]
[((386, 400), 'pp.Component', 'pp.Component', ([], {}), '()\n', (398, 400), False, 'import pp\n'), ((687, 765), 'pp.routing.link_optical_ports', 'pp.routing.link_optical_ports', (['ports1', 'ports2'], {'sort_ports': '(True)', 'bend_radius': '(10)'}), '(ports1, ports2, sort_ports=True, bend_radius=10)\n', (716, 765), Fa...
import os import tensorflow_datasets as tfds import tensorflow as tf import numpy as np from common.inputs.data_input import DataInfo bxs_m2 = [[1, 1], [1, -1], [-1, 1], [-1, -1]] def parse_multi_mnist1(serialized_example): """ Data parsing function. """ features = tf.io.parse_single_example(serialized...
[ "tensorflow.one_hot", "tensorflow.data.TFRecordDataset", "matplotlib.pyplot.imshow", "os.path.join", "numpy.squeeze", "tensorflow.concat", "matplotlib.pyplot.figure", "tensorflow.io.FixedLenFeature", "tensorflow_datasets.features.ClassLabel", "tensorflow.argmax", "tensorflow.io.decode_raw", "t...
[((1229, 1280), 'tensorflow.io.decode_raw', 'tf.io.decode_raw', (["features['image_raw_1']", 'tf.uint8'], {}), "(features['image_raw_1'], tf.uint8)\n", (1245, 1280), True, 'import tensorflow as tf\n'), ((1299, 1341), 'tensorflow.reshape', 'tf.reshape', (['image_raw_1'], {'shape': '[36, 36, 1]'}), '(image_raw_1, shape=[...
#!/usr/bin/env python # coding=utf-8 import numpy as np import os import site site.addsitedir('../lib/') import htools import hdm ########################################################################### class parameters: def __init__(self): self.N = 10 self.d = 4 self.n_del = 0 s...
[ "hdm.sensitivity", "numpy.linspace", "htools.edgeCnt", "hdm.FindMaxSprs", "site.addsitedir" ]
[((78, 104), 'site.addsitedir', 'site.addsitedir', (['"""../lib/"""'], {}), "('../lib/')\n", (93, 104), False, 'import site\n'), ((1518, 1549), 'hdm.sensitivity', 'hdm.sensitivity', (['param', 'K', 'M', 'R'], {}), '(param, K, M, R)\n', (1533, 1549), False, 'import hdm\n'), ((720, 745), 'numpy.linspace', 'np.linspace', ...
from agent import agent from trade_env import StockTradingEnv import numpy as np from datetime import datetime import matplotlib.pyplot as plt if __name__=='__main__': """ 流通股本1亿,初始价格10元 100个agent,每个agent 20万现金,100万股 """ agent_count = 100 ep = 20 env = StockTradingEnv(1e9,10,0.1,0.01,0.01,6...
[ "trade_env.StockTradingEnv", "matplotlib.pyplot.ylabel", "numpy.delete", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "datetime.datetime.now", "matplotlib.pyplot.title", "agent.agent", "matplotlib.pyplot.show" ]
[((282, 338), 'trade_env.StockTradingEnv', 'StockTradingEnv', (['(1000000000.0)', '(10)', '(0.1)', '(0.01)', '(0.01)', '(6)', '(4)'], {}), '(1000000000.0, 10, 0.1, 0.01, 0.01, 6, 4)\n', (297, 338), False, 'from trade_env import StockTradingEnv\n'), ((1977, 2002), 'matplotlib.pyplot.plot', 'plt.plot', (['index_', 'price...
import copy from dataclasses import dataclass from typing import Any, Dict, List, Optional, Tuple import numpy import torch import torch.nn as nn import torch.nn.functional as F from allennlp.modules import FeedForward, InputVariationalDropout from allennlp.modules.matrix_attention.bilinear_matrix_attention import \ ...
[ "torch.nn.EmbeddingBag", "torch.nn.functional.nll_loss", "allennlp.nn.Activation.by_name", "allennlp.nn.util.get_device_of", "torch.nn.modules.Bilinear", "torch.cat", "numpy.stack", "torch.nn.Linear", "copy.deepcopy", "allennlp.nn.util.masked_log_softmax", "allennlp.modules.InputVariationalDropo...
[((1234, 1296), 'torch.nn.Linear', 'nn.Linear', (['config.decoder_config.output_dim', 'config.num_labels'], {}), '(config.decoder_config.output_dim, config.num_labels)\n', (1243, 1296), True, 'import torch.nn as nn\n'), ((1954, 1979), 'torch.nn.functional.nll_loss', 'F.nll_loss', (['logits', 'label'], {}), '(logits, la...
import numpy as np from .layer_base import LayerBase class ReluLayer(LayerBase): def __init__(self): super().__init__() self.cache = {} def id(self): return "Relu" def forward(self, x): y = np.maximum(x, 0) self.cache["is_negative"] = (x < 0) return y ...
[ "numpy.power", "numpy.log", "numpy.tanh", "numpy.max", "numpy.exp", "numpy.maximum" ]
[((240, 256), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (250, 256), True, 'import numpy as np\n'), ((1014, 1024), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (1021, 1024), True, 'import numpy as np\n'), ((1441, 1450), 'numpy.max', 'np.max', (['x'], {}), '(x)\n', (1447, 1450), True, 'import numpy...
# Copyright 2019 The TensorNetwork Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
[ "numpy.abs", "tensornetwork.matrixproductstates.base_mps.BaseMPS", "numpy.ones", "tensornetwork.contract_between", "numpy.testing.assert_allclose", "numpy.tensordot", "tensorflow.compat.v1.enable_v2_behavior", "tensornetwork.backends.backend_factory.get_backend", "pytest.fixture", "numpy.array", ...
[((930, 967), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (943, 967), False, 'from jax.config import config\n'), ((968, 1001), 'tensorflow.compat.v1.enable_v2_behavior', 'tf.compat.v1.enable_v2_behavior', ([], {}), '()\n', (999, 1001), True, 'impo...
import hsmm4acc.hsmm as hsmm import numpy as np def test_initialize_model(): Nmax = 2 dim = 3 model = hsmm.initialize_model(Nmax, dim) assert len(model.obs_distns) == Nmax def test_colormap(): num_states = 5 colormap, cmap = hsmm.get_color_map(num_states) assert len(colormap.keys()) == n...
[ "hsmm4acc.hsmm.initialize_model", "numpy.random.normal", "numpy.random.rand", "numpy.zeros", "numpy.random.randint", "hsmm4acc.hsmm.get_color_map", "hsmm4acc.hsmm.train_hsmm" ]
[((116, 148), 'hsmm4acc.hsmm.initialize_model', 'hsmm.initialize_model', (['Nmax', 'dim'], {}), '(Nmax, dim)\n', (137, 148), True, 'import hsmm4acc.hsmm as hsmm\n'), ((253, 283), 'hsmm4acc.hsmm.get_color_map', 'hsmm.get_color_map', (['num_states'], {}), '(num_states)\n', (271, 283), True, 'import hsmm4acc.hsmm as hsmm\...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ pandas 学习 字典形式的numpy """ from __future__ import print_function import numpy as np import pandas as pd dates = pd.date_range('20130101', periods=6) df = pd.DataFrame(np.arange(24).reshape((6,4)),index=dates, columns=['A','B','C','D']) """ A B C ...
[ "pandas.date_range", "numpy.arange" ]
[((166, 202), 'pandas.date_range', 'pd.date_range', (['"""20130101"""'], {'periods': '(6)'}), "('20130101', periods=6)\n", (179, 202), True, 'import pandas as pd\n'), ((221, 234), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (230, 234), True, 'import numpy as np\n')]
"""This module contains njitted routines and data structures to: - Find the best possible split of a node. For a given node, a split is characterized by a feature and a bin. - Apply a split to a node, i.e. split the indices of the samples at the node into the newly created left and right childs. """ import numpy a...
[ "numpy.int64", "numpy.full", "numba.njit", "numba.jitclass", "numpy.zeros", "numpy.empty", "numpy.cumsum", "numpy.empty_like", "numba.prange", "numpy.zeros_like", "numpy.arange" ]
[((566, 1016), 'numba.jitclass', 'jitclass', (["[('gain', float32), ('feature_idx', uint32), ('bin_idx', uint8), (\n 'left_g_hf', float32), ('left_gx_hfx', float32), ('left_h', float32), (\n 'left_hx', float32), ('left_hx2', float32), ('if_left_linear', boolean),\n ('right_g_hf', float32), ('right_gx_hfx', flo...
import matplotlib.pyplot as plt import numpy as np def load_values(filename): values = [] with open(filename) as file: lines = file.readlines() values = [list(map(float, line.split(','))) for line in lines] return np.array(values).mean(axis=0) if __name__ == "__main__": fi...
[ "numpy.array", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((329, 363), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'figsize': '(8, 8)'}), '(2, 1, figsize=(8, 8))\n', (341, 363), True, 'import matplotlib.pyplot as plt\n'), ((1143, 1153), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1151, 1153), True, 'import matplotlib.pyplot as plt\n'), ((255,...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ================ Network Rewiring ================ :Author: <NAME> :Date: 2011-03-01 :Copyright: Copyright(c) 2011 Jacobs University of Bremen. All rights reserved. :File: randomisation.py """ import numpy import networkx as nx def standard_direct...
[ "numpy.array", "numpy.zeros", "networkx.NetworkXError", "numpy.nonzero" ]
[((570, 634), 'networkx.NetworkXError', 'nx.NetworkXError', (['"""the standard setup does not allow self-links"""'], {}), "('the standard setup does not allow self-links')\n", (586, 634), True, 'import networkx as nx\n'), ((6617, 6660), 'numpy.zeros', 'numpy.zeros', ([], {'shape': '(len_sets, 4)', 'dtype': 'int'}), '(s...
# # Copyright (c) 2021 The GPflux Contributors. # # 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 agr...
[ "gpflow.default_float", "gpflow.utilities.deepcopy", "inspect.getmembers", "gpflow.mean_functions.Linear", "gpflow.inducing_variables.SeparateIndependentInducingVariables", "gpflow.inducing_variables.InducingPoints", "warnings.warn", "gpflow.mean_functions.Identity", "gpflow.kernels.SharedIndependen...
[((11766, 11778), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (11773, 11778), False, 'from typing import List, Optional, Type, TypeVar, Union\n'), ((2923, 2951), 'gpflow.kernels.SeparateIndependent', 'SeparateIndependent', (['kernels'], {}), '(kernels)\n', (2942, 2951), False, 'from gpflow.kernels import...
import os import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class ReplayBuffer: def __init__(self, state_dim, action_dim,max_size=1e6, device = torch.device('cpu')): self.state_dim = state_dim self.action_dim = action_dim self.max_size = max_size ...
[ "os.path.exists", "torch.nn.ReLU", "torch.as_tensor", "numpy.sqrt", "torch.rand_like", "torch.nn.functional.mse_loss", "os.makedirs", "torch.load", "os.path.join", "numpy.random.randint", "numpy.zeros", "torch.cuda.is_available", "torch.nn.Linear", "torch.no_grad", "torch.empty", "torc...
[((6024, 6039), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6037, 6039), False, 'import torch\n'), ((185, 204), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (197, 204), False, 'import torch\n'), ((367, 437), 'torch.empty', 'torch.empty', (['(max_size, state_dim)'], {'dtype': 'torch.float32...
import ipopt ipopt.setLoggingLevel(50) import numpy as np from collections import namedtuple from pycalphad.core.constants import MIN_SITE_FRACTION SolverResult = namedtuple('SolverResult', ['converged', 'x', 'chemical_potentials']) class SolverBase(object): """"Base class for solvers.""" ignore_convergence =...
[ "ipopt.setLoggingLevel", "collections.namedtuple", "numpy.abs", "ipopt.problem" ]
[((13, 38), 'ipopt.setLoggingLevel', 'ipopt.setLoggingLevel', (['(50)'], {}), '(50)\n', (34, 38), False, 'import ipopt\n'), ((164, 233), 'collections.namedtuple', 'namedtuple', (['"""SolverResult"""', "['converged', 'x', 'chemical_potentials']"], {}), "('SolverResult', ['converged', 'x', 'chemical_potentials'])\n", (17...
import unittest import os import numpy as np from platform import python_implementation from sentinelhub import read_data, write_data, TestSentinelHub class TestIO(TestSentinelHub): class IOTestCase: def __init__(self, filename, mean, shape=(2048, 2048, 3)): self.filename = filename ...
[ "platform.python_implementation", "numpy.mean", "os.path.join", "numpy.array_equal", "unittest.main", "sentinelhub.write_data", "sentinelhub.read_data" ]
[((2033, 2048), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2046, 2048), False, 'import unittest\n'), ((1000, 1051), 'os.path.join', 'os.path.join', (['self.INPUT_FOLDER', 'test_case.filename'], {}), '(self.INPUT_FOLDER, test_case.filename)\n', (1012, 1051), False, 'import os\n'), ((1074, 1094), 'sentinelhub.r...
"""Performs vector and matrix operations. 2020, <NAME> <<EMAIL>> """ import numpy as np from mathstuff import root_finding from typing import Callable, Tuple def legendre_polynomial(x: float, n: int) -> float: """Evaluate n-order Legendre polynomial. Args: x: Abscissa to evaluate. n: Poly...
[ "numpy.linspace", "mathstuff.root_finding.hybrid_secant_bisection" ]
[((1020, 1049), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(k * n + 1)'], {}), '(-1, 1, k * n + 1)\n', (1031, 1049), True, 'import numpy as np\n'), ((1822, 1939), 'mathstuff.root_finding.hybrid_secant_bisection', 'root_finding.hybrid_secant_bisection', ([], {'x_left': 'bound[0]', 'x_right': 'bound[1]', 'func': ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from wbia_cnn import utils from wbia_cnn import ingest_helpers from wbia_cnn import ingest_wbia from wbia_cnn.dataset import DataSet from os.path import join, basename, splitext import utool as ut print, rrr, profile = ut.inject2(...
[ "utool.dict_str", "utool.grab_zipped_url", "wbia_cnn.dataset.DataSet.from_alias_key", "utool.doctest_funcs", "numpy.array", "wbia_cnn.dataset.DataSet.new_training_set", "multiprocessing.freeze_support", "wbia_cnn.utils.convert_cv2_images_to_theano_images", "wbia_cnn.ingest_helpers.extract_liberty_st...
[((309, 329), 'utool.inject2', 'ut.inject2', (['__name__'], {}), '(__name__)\n', (319, 329), True, 'import utool as ut\n'), ((350, 404), 'utool.get_argflag', 'ut.get_argflag', (["('--nocache-cnn', '--nocache-dataset')"], {}), "(('--nocache-cnn', '--nocache-dataset'))\n", (364, 404), True, 'import utool as ut\n'), ((761...
from openrec import ModelTrainer from openrec.utils import Dataset from openrec.recommenders import YouTubeRec from openrec.utils.evaluators import AUC, Recall from openrec.utils.samplers import YouTubeSampler, YouTubeEvaluationSampler import numpy as np train_data = np.load('dataset/lastfm/lastfm_train.npy') test_dat...
[ "openrec.utils.samplers.YouTubeEvaluationSampler", "openrec.utils.evaluators.Recall", "openrec.utils.evaluators.AUC", "openrec.utils.samplers.YouTubeSampler", "openrec.utils.Dataset", "numpy.load", "openrec.ModelTrainer", "openrec.recommenders.YouTubeRec" ]
[((269, 311), 'numpy.load', 'np.load', (['"""dataset/lastfm/lastfm_train.npy"""'], {}), "('dataset/lastfm/lastfm_train.npy')\n", (276, 311), True, 'import numpy as np\n'), ((324, 365), 'numpy.load', 'np.load', (['"""dataset/lastfm/lastfm_test.npy"""'], {}), "('dataset/lastfm/lastfm_test.npy')\n", (331, 365), True, 'imp...
import numpy as np import mxnet as mx from mxnet import gluon import gluoncv as gcv from .nets import * from .dataset import * __all__ = ['get_data_loader', 'get_network', 'imagenet_batch_fn', 'default_batch_fn', 'default_val_fn', 'default_train_fn'] def get_data_loader(dataset, input_size, batch_size, num...
[ "mxnet.autograd.record", "mxnet.gluon.utils.split_and_load", "mxnet.autograd.pause", "mxnet.gluon.data.DataLoader", "numpy.random.shuffle" ]
[((2204, 2273), 'mxnet.gluon.utils.split_and_load', 'gluon.utils.split_and_load', (['batch.data[0]'], {'ctx_list': 'ctx', 'batch_axis': '(0)'}), '(batch.data[0], ctx_list=ctx, batch_axis=0)\n', (2230, 2273), False, 'from mxnet import gluon\n'), ((2286, 2356), 'mxnet.gluon.utils.split_and_load', 'gluon.utils.split_and_l...
''' ''' # # Adapted from MATLAB code written by <NAME> (see Nishimoto, et al., 2011). # <NAME> (Jan, 2016) # # Updates: # <NAME> (Apr, 2020) # import itertools from PIL import Image import numpy as np from moten.utils import (DotDict, iterator_func, log_compress, ...
[ "numpy.product", "numpy.abs", "numpy.ceil", "itertools.product", "numpy.asarray", "numpy.floor", "numpy.exp", "numpy.zeros", "numpy.linspace", "scipy.stats.zscore", "numpy.cos", "numpy.sin", "numpy.meshgrid", "numpy.zeros_like", "numpy.arange" ]
[((1666, 1708), 'numpy.zeros', 'np.zeros', (['(nimages, nfilters)'], {'dtype': 'dtype'}), '((nimages, nfilters), dtype=dtype)\n', (1674, 1708), True, 'import numpy as np\n'), ((1729, 1771), 'numpy.zeros', 'np.zeros', (['(nimages, nfilters)'], {'dtype': 'dtype'}), '((nimages, nfilters), dtype=dtype)\n', (1737, 1771), Tr...
# Copyright 2018 The dm_control Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "collections.namedtuple", "numpy.sign" ]
[((782, 909), 'collections.namedtuple', 'collections.namedtuple', (['"""ObservableSpec"""', "['enabled', 'update_interval', 'buffer_size', 'delay', 'aggregator',\n 'corruptor']"], {}), "('ObservableSpec', ['enabled', 'update_interval',\n 'buffer_size', 'delay', 'aggregator', 'corruptor'])\n", (804, 909), False, '...
""" Unit tests for scCODA """ import unittest import numpy as np import scanpy as sc import tensorflow as tf import pandas as pd import os import sys sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('..')) from sccoda.util import cell_composition_data as dat from sccoda.util import comp_ana...
[ "numpy.mean", "numpy.abs", "sccoda.util.data_generation.b_w_from_abs_change", "tensorflow.random.set_seed", "scanpy.datasets.pbmc3k_processed", "sccoda.util.data_generation.counts_from_first", "sccoda.util.cell_composition_data.from_pandas", "unittest.main", "pandas.set_option", "numpy.array", "...
[((376, 417), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (389, 417), True, 'import pandas as pd\n'), ((418, 456), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (431, 456), True, '...
# -*— coding: utf-8 -*- import numpy as np import operator ''' 函数说明:knn算法,分类器 parameters: inX - 用于分类的数据(测试集) dataset - 用于训练的数据(训练集) labels - 分类标签 k - knn算法参数, 选择距离最小的k个点 returns: sortedClassCount[0][0] - 分类结果 ''' def classfy0(inX, dataSet, labels, k): # numpy函数shape[0...
[ "numpy.array", "numpy.tile", "operator.itemgetter" ]
[((1286, 1335), 'numpy.array', 'np.array', (['[[1, 101], [5, 89], [108, 5], [115, 8]]'], {}), '([[1, 101], [5, 89], [108, 5], [115, 8]])\n', (1294, 1335), True, 'import numpy as np\n'), ((439, 469), 'numpy.tile', 'np.tile', (['inX', '(dataSetSize, 1)'], {}), '(inX, (dataSetSize, 1))\n', (446, 469), True, 'import numpy ...
# coding: utf-8 # In[1]: import sklearn import numpy as np from glob import glob from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.linear_model import...
[ "numpy.sqrt", "keras.utils.vis_utils.plot_model", "numpy.array", "keras.layers.Dense", "keras.preprocessing.sequence.pad_sequences", "keras.layers.merge.concatenate", "gensim.models.Word2Vec.load", "keras.layers.convolutional.Conv1D", "keras.layers.LSTM", "keras.models.Model", "numpy.concatenate...
[((4615, 4683), 'gensim.models.Word2Vec.load', 'Word2Vec.load', (['"""C:/Users/admin-karim/Desktop/BengWord2Vec/posts.bin"""'], {}), "('C:/Users/admin-karim/Desktop/BengWord2Vec/posts.bin')\n", (4628, 4683), False, 'from gensim.models import Word2Vec\n'), ((4804, 4846), 'numpy.zeros', 'np.zeros', (['(vocabulary_size, E...
import datetime as dt import hydra import logging import numpy as np import os import time import torch import torch.distributed as dist from hydra.utils import instantiate from ignite.contrib.handlers import ProgressBar from ignite.engine import Engine, Events from ignite.handlers import Checkpoint, TerminateOnNan fr...
[ "utils.train.resume_from_checkpoint", "apex.parallel.distributed.DistributedDataParallel", "apex.amp.scale_loss", "logging.debug", "torch.distributed.destroy_process_group", "torch.nn.utils.clip_grad_norm_", "ignite.engine.Engine", "torch.cuda.synchronize", "apex.amp.initialize", "torch.cuda.is_av...
[((11371, 11417), 'hydra.main', 'hydra.main', ([], {'config_path': '"""../config/train.yaml"""'}), "(config_path='../config/train.yaml')\n", (11381, 11417), False, 'import hydra\n'), ((1068, 1079), 'time.time', 'time.time', ([], {}), '()\n', (1077, 1079), False, 'import time\n'), ((1491, 1502), 'time.time', 'time.time'...
""" evaluation.py ------------- This module provides classes and functions for evaluating a model. By: <NAME>, Ph.D., 2018 """ # Compatibility imports from __future__ import absolute_import, division, print_function # 3rd party imports import numpy as np import itertools import matplotlib.pylab as plt from sklearn.me...
[ "matplotlib.pylab.xticks", "matplotlib.pylab.ylabel", "matplotlib.pylab.figure", "matplotlib.pylab.tight_layout", "matplotlib.pylab.xlabel", "matplotlib.pylab.imshow", "matplotlib.pylab.show", "matplotlib.pylab.yticks", "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.round", "sklea...
[((568, 600), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (584, 600), False, 'from sklearn.metrics import confusion_matrix\n'), ((713, 798), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', (['"""laussen_labs_green"...
#!/usr/bin/env python ''' Filename: test_equally_space.py Description: unit tests to test equally_space_old.py ''' __author__ = '<NAME>' __email__ = '<EMAIL>' __status__ = 'prototype' # standard imports import unittest from equally_space import * import matplotlib.pyplot as plt import numpy as np class TestEqually...
[ "numpy.arange", "numpy.random.random", "matplotlib.pyplot.plot", "numpy.linspace", "unittest.main", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((3034, 3049), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3047, 3049), False, 'import unittest\n'), ((2061, 2088), 'numpy.linspace', 'np.linspace', (['(0)', 'tot_dist', 'N'], {}), '(0, tot_dist, N)\n', (2072, 2088), True, 'import numpy as np\n'), ((2123, 2180), 'matplotlib.pyplot.plot', 'plt.plot', (['test_p...
"""Module for interfacing with power factory.""" import os import itertools import numpy as np import pandas as pd import powerfactory as pf from sinfactory.line import Line from sinfactory.generator import Generator from sinfactory.load import Load from sinfactory.area import Area from sinfactory.bus import Bus from ...
[ "sinfactory.pfresults.PFResults", "sinfactory.eigenresults.EigenValueResults", "sinfactory.area.Area", "numpy.sqrt", "pandas.read_csv", "powerfactory.GetApplication", "sinfactory.load.Load", "numpy.column_stack", "numpy.count_nonzero", "numpy.array", "sinfactory.line.Line", "pandas.DataFrame",...
[((628, 647), 'powerfactory.GetApplication', 'pf.GetApplication', ([], {}), '()\n', (645, 647), True, 'import powerfactory as pf\n'), ((8173, 8244), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'sep': '""","""', 'decimal': '"""."""', 'header': '[0, 1]', 'index_col': '(0)'}), "(filepath, sep=',', decimal='.', heade...
#!/usr/bin/env python from __future__ import division """@package etddf ROS interface script for delta tiering filter Filter operates in ENU """ from etddf.delta_tier import DeltaTier import rospy import threading from minau.msg import ControlStatus from etddf.msg import Measurement, MeasurementPackage, NetworkEsti...
[ "rospy.logerr", "geometry_msgs.msg.Vector3", "rospy.init_node", "numpy.array", "copy.deepcopy", "numpy.sin", "etddf.delta_tier.DeltaTier", "etddf.msg.PositionVelocity", "nav_msgs.msg.Odometry", "threading.Lock", "rospy.Service", "geometry_msgs.msg.Quaternion", "rospy.spin", "numpy.concaten...
[((448, 482), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (467, 482), True, 'import numpy as np\n'), ((17586, 17613), 'rospy.get_param', 'rospy.get_param', (['"""~my_name"""'], {}), "('~my_name')\n", (17601, 17613), False, 'import rospy\n'), ((17629, 17663), 'rosp...
import numpy as np from xwavecal.utils.correlate import correlate2d def test_correlate2d(): arr = np.ones((5, 5)) arr[1:4, 1:4] = 2 sig = correlate2d(arr, 2 * np.ones((3, 3)), max_lag=1) assert sig[2, 2] == np.max(sig)
[ "numpy.ones", "numpy.max" ]
[((105, 120), 'numpy.ones', 'np.ones', (['(5, 5)'], {}), '((5, 5))\n', (112, 120), True, 'import numpy as np\n'), ((226, 237), 'numpy.max', 'np.max', (['sig'], {}), '(sig)\n', (232, 237), True, 'import numpy as np\n'), ((174, 189), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (181, 189), True, 'import numpy...
""" Machine learning layer class definition module """ import numpy as np import tensorflow as tf rng = np.random.RandomState(1000) class Dense(object): """ Dense layer class """ def __init__(self): self.W = 0 self.b = 0 self.name_W = 'hoge' self.name_b = 'hoge' ...
[ "numpy.random.RandomState" ]
[((106, 133), 'numpy.random.RandomState', 'np.random.RandomState', (['(1000)'], {}), '(1000)\n', (127, 133), True, 'import numpy as np\n')]
"""Custom utilities for interacting with the Materials Project. Mostly for getting and manipulating structures. With all of the function definitions and docstrings, these are more verbose """ import fnmatch import os from pymatgen.ext.matproj import MPRester, Structure from pymatgen.io.vasp.inputs import Incar, Posc...
[ "pymatgen.io.vasp.inputs.Incar.from_file", "fireworks.LaunchPad.from_file", "numpy.array", "fireworks.LaunchPad.auto_load", "os.walk", "os.path.exists", "re.split", "pymatgen.io.vasp.outputs.Outcar", "atomate.vasp.database.VaspCalcDb.from_db_file", "dfttk.ftasks.ModifyKpoints", "pymatgen.io.vasp...
[((5504, 5518), 'os.walk', 'os.walk', (['start'], {}), '(start)\n', (5511, 5518), False, 'import os\n'), ((24194, 24299), 'atomate.utils.utils.get_fws_and_tasks', 'get_fws_and_tasks', (['original_wf'], {'fw_name_constraint': 'fw_name_constraint', 'task_name_constraint': '"""RunVasp"""'}), "(original_wf, fw_name_constra...
import imageProcess import numpy from skimage.measure import label, regionprops def areaFilter(bImg): labelImg = label(bImg) numLabel = labelImg.max() props = regionprops(labelImg) bImg[:] = False areaList = [] for i in range(numLabel): areaList.append(props[i].area) areaList =...
[ "numpy.logical_or", "skimage.measure.label", "skimage.measure.regionprops" ]
[((118, 129), 'skimage.measure.label', 'label', (['bImg'], {}), '(bImg)\n', (123, 129), False, 'from skimage.measure import label, regionprops\n'), ((172, 193), 'skimage.measure.regionprops', 'regionprops', (['labelImg'], {}), '(labelImg)\n', (183, 193), False, 'from skimage.measure import label, regionprops\n'), ((549...
#! /usr/bin/env python # coding: utf-8 """ This is Ros node for pwm control rc car """ import RPi.GPIO as GPIO import pigpio import time import numpy as np import math import tf from enum import Enum import rospy from geometry_msgs.msg import Twist, TwistStamped, PoseStamped from ackermann_msgs.msg import AckermannDr...
[ "numpy.clip", "rospy.init_node", "time.sleep", "math.cos", "numpy.array", "rospy.Rate", "rc_car_msgs.msg.CarPwmContol", "math.atan", "RPi.GPIO.cleanup", "geometry_msgs.msg.TwistStamped", "rospy.Service", "dynamic_reconfigure.server.Server", "numpy.dot", "pigpio.pi", "rospy.Subscriber", ...
[((1335, 1340), 'PID.PID', 'PID', ([], {}), '()\n', (1338, 1340), False, 'from PID import PID\n'), ((1893, 1904), 'pigpio.pi', 'pigpio.pi', ([], {}), '()\n', (1902, 1904), False, 'import pigpio\n'), ((2139, 2153), 'geometry_msgs.msg.TwistStamped', 'TwistStamped', ([], {}), '()\n', (2151, 2153), False, 'from geometry_ms...
""" ================================================================================ Utilities for handling data types and transformations ================================================================================ **<NAME>** 4/18/2018 """ #########################################################################...
[ "pyUSID.dtype_utils.flatten_complex_to_real", "numpy.random.rand", "pyUSID.dtype_utils.is_complex_dtype", "pyUSID.dtype_utils.contains_integers", "os.remove", "pyUSID.dtype_utils.stack_real_to_complex", "os.path.exists", "numpy.random.random", "subprocess.call", "warnings.warn", "pyUSID.dtype_ut...
[((5144, 5233), 'numpy.dtype', 'np.dtype', (["{'names': ['r', 'g', 'b'], 'formats': [np.float32, np.uint16, np.float64]}"], {}), "({'names': ['r', 'g', 'b'], 'formats': [np.float32, np.uint16, np.\n float64]})\n", (5152, 5233), True, 'import numpy as np\n'), ((5759, 5813), 'pyUSID.dtype_utils.get_compound_sub_dtypes...
# Copyright 2021 The Distla 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 applicable ...
[ "distla_core.analysis.pmaps.frobdiff", "distla_core.analysis.pmaps.frobnorm", "numpy.linalg.qr", "numpy.arccos", "distla_core.analysis.pmaps.eye", "functools.reduce", "distla_core.utils.pops.undistribute", "distla_core.analysis.pmaps.matmul", "functools.partial", "distla_core.analysis.pmaps.transp...
[((1793, 1827), 'distla_core.analysis.pmaps.frobdiff', 'pmaps.frobdiff', (['matrix_a', 'matrix_b'], {}), '(matrix_a, matrix_b)\n', (1807, 1827), False, 'from distla_core.analysis import pmaps\n'), ((3329, 3380), 'distla_core.analysis.pmaps.eye', 'pmaps.eye', (['should_be_eye.shape', 'should_be_eye.dtype'], {}), '(shoul...
# Copyright (c) 2014, <NAME> (<EMAIL>) # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # - Redistributions of source code must retain the above copyright notice, # this list of conditions and ...
[ "numpy.zeros", "csv.writer", "numpy.genfromtxt", "numpy.hstack" ]
[((1882, 1903), 'numpy.zeros', 'np.zeros', (['(79975, 37)'], {}), '((79975, 37))\n', (1890, 1903), True, 'import numpy as np\n'), ((2149, 2260), 'numpy.genfromtxt', 'np.genfromtxt', (['"""./raw_data/kaggle_submission.csv"""'], {'dtype': 'np.int32', 'delimiter': '""","""', 'skip_header': '(1)', 'usecols': '(0)'}), "('./...