code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
try: import wfdb import numpy as np except ImportError: import pip pip.main(['install','matplotlib','wfdb']) import wfdb record = wfdb.rdrecord('european-st-t-database/e0104') wfdb.plot_wfdb(record=record, title='Record e0104 from European st-t') #display(record.__dict__) #print(record.p_signal[:2...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "pip.main", "wfdb.plot_wfdb", "numpy.array", "wfdb.rdrecord" ]
[((150, 195), 'wfdb.rdrecord', 'wfdb.rdrecord', (['"""european-st-t-database/e0104"""'], {}), "('european-st-t-database/e0104')\n", (163, 195), False, 'import wfdb\n'), ((197, 267), 'wfdb.plot_wfdb', 'wfdb.plot_wfdb', ([], {'record': 'record', 'title': '"""Record e0104 from European st-t"""'}), "(record=record, title='...
# -*- coding: utf-8 -*- """ Created on Tue Feb 2 10:44:37 2021 @author: Parthe Vector Approximate Message Passing for LASSO problem """ import numpy as np from numpy.linalg import svd, norm, inv from numpy.random import randn import matplotlib.pyplot as plt from denoisers import prox_l1, prox_ridge, Track_variable...
[ "matplotlib.pyplot.title", "numpy.random.seed", "numpy.abs", "matplotlib.pyplot.figure", "numpy.linalg.svd", "numpy.linalg.norm", "matplotlib.pyplot.hlines", "numpy.random.randn", "sklearn.linear_model.Lasso", "functools.partial", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplo...
[((516, 533), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (530, 533), True, 'import numpy as np\n'), ((563, 574), 'numpy.random.randn', 'randn', (['n', 'p'], {}), '(n, p)\n', (568, 574), False, 'from numpy.random import randn\n'), ((736, 747), 'numpy.random.randn', 'randn', (['p', '(1)'], {}), '(p, 1...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 14 23:45:22 2018 @author: asadm2 """ from cosmo_utils.utils.stats_funcs import Stats_one_arr from cosmo_utils.utils import work_paths as cwpaths import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt from matplotlib import rc impo...
[ "matplotlib.rc", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "cosmo_utils.utils.work_paths.cookiecutter_paths", "numpy.unique", "pandas.DataFrame", "numpy.std", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.subplots", "matplotlib.pyplot.errorbar", "cosmo_u...
[((4797, 4873), 'matplotlib.rc', 'rc', (['"""font"""'], {'size': '(20)'}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']}, size=20)\n", (4799, 4873), False, 'from matplotlib import rc\n'), ((4870, 4893), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (4872, ...
# <NAME> [11/30/2018] Enabled threshold of probobility, change to use 20180402-114759-CASIA-WebFace//20180402-114759.pb SavedModel and set GPU gpu_memory_fraction = 0.4 # <NAME> [01/21/2019] Changed input:0 to batch_join:0 for embedding and set GPU gpu_memory_fraction = 0.3 # <NAME> [01/25/2019] Added workaround to fix...
[ "numpy.maximum", "numpy.random.random_sample", "numpy.argmax", "tensorflow.reset_default_graph", "tensorflow.ConfigProto", "pickle.load", "tensorflow.GPUOptions", "os.path.dirname", "facenet.load_model", "tensorflow.data.Dataset.from_tensors", "facenet.prewhiten", "numpy.minimum", "numpy.asa...
[((2359, 2384), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2374, 2384), False, 'import os\n'), ((2584, 2609), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2599, 2609), False, 'import os\n'), ((3539, 3550), 'time.time', 'time.time', ([], {}), '()\n', (3548, 3...
from __future__ import absolute_import from numpy import arange import sympy as sym from sympy import geometry as geo def add_geometry(drawing, g, move_to=False, step=1): ''' draw sympy equations ''' if isinstance(g, geo.Ellipse): drawing.ellipse(g.center.x, g.center.y, g.hradius, g.vradius) elif h...
[ "numpy.arange" ]
[((1609, 1651), 'numpy.arange', 'arange', (['g.limits[1]', '(g.limits[2] + 1)', 'step'], {}), '(g.limits[1], g.limits[2] + 1, step)\n', (1615, 1651), False, 'from numpy import arange\n')]
#coding=utf-8 import pandas as pd from sklearn import linear_model import numpy as np from numpy import * import matplotlib.pyplot as plt from scipy import stats import os def predictTests(ROOT): arrwaveRate = [] arrSkew = [] arrKurtosis = [] # arrCategory = [] arrMaxWL = [] arrPVR = [] da...
[ "pandas.DataFrame", "pandas.read_csv", "numpy.std", "scipy.stats.skew", "numpy.mean", "numpy.array", "scipy.stats.kurtosis", "numpy.var" ]
[((325, 342), 'pandas.read_csv', 'pd.read_csv', (['ROOT'], {}), '(ROOT)\n', (336, 342), True, 'import pandas as pd\n'), ((467, 478), 'numpy.var', 'np.var', (['abs'], {}), '(abs)\n', (473, 478), True, 'import numpy as np\n'), ((517, 536), 'numpy.std', 'np.std', (['abs'], {'ddof': '(1)'}), '(abs, ddof=1)\n', (523, 536), ...
import json import numpy as np import math class Frame: def __init__(self, label_file, transformation): self.z_objects = [] for o in json.load(open(label_file, 'r'))['children']: if '3dp' in o: self.z_objects.append(Object(o, transformation)) class Object: def _...
[ "math.atan2", "numpy.deg2rad" ]
[((1957, 1984), 'numpy.deg2rad', 'np.deg2rad', (['obj_orientation'], {}), '(obj_orientation)\n', (1967, 1984), True, 'import numpy as np\n'), ((2022, 2062), 'math.atan2', 'math.atan2', (['obj_middle[0]', 'obj_middle[2]'], {}), '(obj_middle[0], obj_middle[2])\n', (2032, 2062), False, 'import math\n')]
import json import os import numpy as np import umap.umap_ as umap from sklearn.decomposition import PCA from sklearn.manifold import TSNE def list_chunks(lst, n): """Yield successive n-sized chunks from lst.""" for i in range(0, len(lst), n): yield lst[i : i + n] def get_sub(x, rev=False): nor...
[ "json.dump", "numpy.save", "sklearn.manifold.TSNE", "umap.umap_.UMAP", "sklearn.decomposition.PCA", "os.path.split" ]
[((1633, 1672), 'sklearn.decomposition.PCA', 'PCA', (['output_dimensions'], {'random_state': '(42)'}), '(output_dimensions, random_state=42)\n', (1636, 1672), False, 'from sklearn.decomposition import PCA\n'), ((1921, 1986), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': 'output_dimensions', 'init': '"""pca"""'...
import numpy as np from mlp.activation_functions import sigmoid from mlp.initializer import GaussianNormalScaled from mlp.loss_functions import MeanSquaredError from mlp.network import Input, Dense, Output, Network from mlp.optimizer import GradientDescent class Tuner: def __init__(self, learning_rates): ...
[ "numpy.load", "mlp.initializer.GaussianNormalScaled", "mlp.optimizer.GradientDescent", "numpy.argmax", "mlp.network.Output", "mlp.network.Network", "mlp.network.Dense", "mlp.network.Input", "numpy.random.shuffle" ]
[((721, 743), 'mlp.initializer.GaussianNormalScaled', 'GaussianNormalScaled', ([], {}), '()\n', (741, 743), False, 'from mlp.initializer import GaussianNormalScaled\n'), ((796, 805), 'mlp.network.Input', 'Input', (['(70)'], {}), '(70)\n', (801, 805), False, 'from mlp.network import Input, Dense, Output, Network\n'), ((...
""" ============================================================================== Tecplot I/O Functions ============================================================================== @File : TecplotIO.py @Date : 2021/04/02 @Author : <NAME> @Description : Functions for reading and writing tecplot files """...
[ "numpy.copy", "numpy.savetxt", "numpy.zeros", "re.match", "numpy.shape", "numpy.max", "numpy.array" ]
[((3787, 3806), 'numpy.copy', 'np.copy', (['nodeCoords'], {}), '(nodeCoords)\n', (3794, 3806), True, 'import numpy as np\n'), ((1803, 1851), 're.match', 're.match', (['"""TITLE = (.*$)"""', 'lines[0]', '(re.M | re.I)'], {}), "('TITLE = (.*$)', lines[0], re.M | re.I)\n", (1811, 1851), False, 'import re\n'), ((1968, 2030...
import matplotlib.pyplot as plt import numpy as np import GenerateData as generate def plot_waiting_time(mode,High_priority,Low_priority,H_numerical,L_numerical): """plot the result of mean waiting time in system Args: mode (str): Indicate waiting time in queue or system. High_priority (list)...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.yticks", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xticks", "matplotlib.pyplot.grid", "matplotlib.pyplot.xlabel" ]
[((838, 860), 'numpy.arange', 'np.arange', (['(0)', '(1.1)', '(0.1)'], {}), '(0, 1.1, 0.1)\n', (847, 860), True, 'import numpy as np\n'), ((1032, 1095), 'matplotlib.pyplot.plot', 'plt.plot', (['probability', 'High_priority'], {'color': '"""green"""', 'marker': '"""*"""'}), "(probability, High_priority, color='green', m...
import torch import torch.nn as nn from torch.distributions import MultivariateNormal import gym import numpy as np from datetime import datetime from PIL import Image import sys from collections import namedtuple sys.path.insert(0, '../../metaworld') sys.path.insert(0, '../supervised') from metaworld.envs.mujoco.sawye...
[ "numpy.random.seed", "argparse.ArgumentParser", "ppo.PPO", "torch.manual_seed", "metaworld.envs.mujoco.sawyer_xyz.sawyer_random.SawyerRandomEnv", "ppo.Memory", "sys.path.insert", "model.Predict", "torch.Tensor", "PIL.Image.fromarray", "datetime.datetime.now" ]
[((214, 251), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../metaworld"""'], {}), "(0, '../../metaworld')\n", (229, 251), False, 'import sys\n'), ((252, 287), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../supervised"""'], {}), "(0, '../supervised')\n", (267, 287), False, 'import sys\n'), ((3537, 3545)...
# -*- coding: utf-8 -*- """ /*************************************************************************** dataplotDialog A QGIS plugin PLot data from layer using matplotlib Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ ------...
[ "qgis.core.QgsFeatureRequest", "qgis.PyQt.QtCore.pyqtSlot", "qgis.PyQt.QtWidgets.QMessageBox.question", "qgis.PyQt.QtWidgets.QMessageBox.warning", "os.path.dirname", "matplotlib.dates.num2date", "numpy.dtype", "matplotlib.pyplot.ion", "numpy.sort", "matplotlib.use", "numpy.arange", "matplotlib...
[((1272, 1296), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (1286, 1296), False, 'import matplotlib\n'), ((2648, 2661), 'qgis.PyQt.QtCore.pyqtSlot', 'pyqtSlot', (['str'], {}), '(str)\n', (2656, 2661), False, 'from qgis.PyQt.QtCore import Qt, QVariant, pyqtSlot\n'), ((2960, 2970), 'qgis.P...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019-07-24 18:29:48 # @Author : <NAME> (<EMAIL>) # @Link : http://iridescent.ink # @Version : $1.0$ import torch as th from torchlib.utils.const import EPS def true_positive(X, Y): """Find true positive elements true_positive(X, Y) returns those...
[ "torchlib.accuracy", "torch.Tensor", "numpy.array", "torch.zeros", "torch.sum", "torchlib.precision" ]
[((8026, 8058), 'numpy.array', 'np.array', (['[[1, 1, 1], [0, 1, 0]]'], {}), '([[1, 1, 1], [0, 1, 0]])\n', (8034, 8058), True, 'import numpy as np\n'), ((8067, 8099), 'numpy.array', 'np.array', (['[[0, 0, 1], [0, 0, 1]]'], {}), '([[0, 0, 1], [0, 0, 1]])\n', (8075, 8099), True, 'import numpy as np\n'), ((8108, 8144), 'n...
#!/usr/bin/env python3 # Copyright 2021 Modern Electron import numpy as np ref_density = np.array([ 1.29556695e+14, 2.24358819e+14, 2.55381744e+14, 2.55655005e+14, 2.55796267e+14, 2.55819109e+14, 2.55819687e+14, 2.55751184e+14, 2.55920806e+14, 2.56072344e+14, 2.55937266e+14, 2.55849080e+14, 2.5591898...
[ "numpy.load", "numpy.array", "numpy.allclose" ]
[((92, 2763), 'numpy.array', 'np.array', (['[129556695000000.0, 224358819000000.0, 255381744000000.0, 255655005000000.0,\n 255796267000000.0, 255819109000000.0, 255819687000000.0, \n 255751184000000.0, 255920806000000.0, 256072344000000.0, \n 255937266000000.0, 255849080000000.0, 255918981000000.0, \n 25598...
import cv2 import numpy as np cap = cv2.VideoCapture(0) ret, frame1 = cap.read() prvs = cv2.cvtColor(frame1, cv2.COLOR_BGR2GRAY) hsv = np.zeros_like(frame1) hsv[..., 1] = 255 while(cap): ret, frame2 = cap.read() next = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY) flow...
[ "numpy.zeros_like", "cv2.cartToPolar", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.calcOpticalFlowFarneback", "cv2.normalize", "cv2.destroyAllWindows" ]
[((36, 55), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (52, 55), False, 'import cv2\n'), ((88, 128), 'cv2.cvtColor', 'cv2.cvtColor', (['frame1', 'cv2.COLOR_BGR2GRAY'], {}), '(frame1, cv2.COLOR_BGR2GRAY)\n', (100, 128), False, 'import cv2\n'), ((155, 176), 'numpy.zeros_like', 'np.zeros_like', (['fra...
# -*- coding: utf-8 -*- from __future__ import division import numpy as np from math import exp import matplotlib.pyplot as plt from scipy.integrate import odeint plt.ion() """ Created on Fri Jan 8 10:33:56 2016 @author: nano Model """ # Define varialbes and functions year = 31104000 # seconds in a year mon...
[ "math.exp", "matplotlib.pyplot.plot", "scipy.integrate.odeint", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "numpy.linspace" ]
[((163, 172), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (170, 172), True, 'import matplotlib.pyplot as plt\n'), ((3055, 3083), 'numpy.linspace', 'np.linspace', (['(0)', '(216000)', '(1000)'], {}), '(0, 216000, 1000)\n', (3066, 3083), True, 'import numpy as np\n'), ((3132, 3148), 'scipy.integrate.odeint', 'o...
import restraints import mdtraj as md import meld.vault as vault import numpy as np import os import multiprocessing import functools import argparse parser = argparse.ArgumentParser() parser.add_argument('fraction', type=float) args = parser.parse_args() fraction = args.fraction RESTRAINT_FILES = [ "c13_restrai...
[ "functools.partial", "numpy.save", "meld.vault.DataStore.load_data_store", "argparse.ArgumentParser", "os.path.exists", "restraints.get_traces", "mdtraj.load", "restraints.load", "restraints.System", "multiprocessing.Pool", "restraints.find_missing_residues", "numpy.vstack" ]
[((160, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (183, 185), False, 'import argparse\n'), ((471, 496), 'mdtraj.load', 'md.load', (['"""renumbered.pdb"""'], {}), "('renumbered.pdb')\n", (478, 496), True, 'import mdtraj as md\n'), ((505, 538), 'meld.vault.DataStore.load_data_store', '...
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import ptitprince as pt def dist_splits(key, data): data = data.assign(joiner=0) fig = plt.figure(figsize=[15, 5]) gs = mpl.gridspec.GridSpec(2, 7, figure=fig) ax0 = fig.add_subplot(gs[:, 0:3]) ax1 = fig.add_sub...
[ "numpy.meshgrid", "numpy.ravel", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.rc", "ptitprince.RainCloud", "matplotlib.pyplot.subplots_adjust", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.subplots" ]
[((181, 208), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '[15, 5]'}), '(figsize=[15, 5])\n', (191, 208), True, 'import matplotlib.pyplot as plt\n'), ((219, 258), 'matplotlib.gridspec.GridSpec', 'mpl.gridspec.GridSpec', (['(2)', '(7)'], {'figure': 'fig'}), '(2, 7, figure=fig)\n', (240, 258), True, 'impor...
import numpy as np from cartopy import crs as ccrs from shapely.geometry import (MultiLineString, LineString, MultiPolygon, Polygon) def wrap_lons(lons, base, period): """ Wrap longitude values into the range between base and base+period. """ lons = lons.astype(np.float64) return ((lons - base + ...
[ "shapely.geometry.MultiLineString", "shapely.geometry.Polygon", "shapely.geometry.MultiPolygon", "numpy.append", "shapely.geometry.LineString", "numpy.array", "numpy.ma.concatenate", "numpy.linspace", "numpy.column_stack", "numpy.concatenate" ]
[((952, 1011), 'shapely.geometry.Polygon', 'Polygon', (['[[x1, y1], [x2, y1], [x2, y2], [x1, y2], [x1, y1]]'], {}), '([[x1, y1], [x2, y1], [x2, y2], [x1, y2], [x1, y1]])\n', (959, 1011), False, 'from shapely.geometry import MultiLineString, LineString, MultiPolygon, Polygon\n'), ((1100, 1126), 'shapely.geometry.Polygon...
#!/usr/bin/env python """ Python utilities. """ import six import numpy as np def iterable(obj): """return true if *obj* is iterable""" try: iter(obj) except TypeError: return False return True def isstring(obj): """Python 2/3 compatible string check""" return isinstance(obj, s...
[ "numpy.recarray" ]
[((1488, 1526), 'numpy.recarray', 'np.recarray', (['rec.shape'], {'dtype': 'newdtype'}), '(rec.shape, dtype=newdtype)\n', (1499, 1526), True, 'import numpy as np\n')]
from __future__ import annotations import numpy as np import pandas as pd from typing import Dict, List from collections import Counter from sklearn.base import TransformerMixin from src.data.logparser import load_drain3 class FeatureExtractor(TransformerMixin): def __init__(self, method: str = None, preprocess...
[ "collections.Counter", "numpy.sum", "src.data.logparser.load_drain3" ]
[((2149, 2223), 'src.data.logparser.load_drain3', 'load_drain3', (['"""../../data/interim/HDFS1/val-data-Drain3-HDFS1-cv1-1.binlog"""'], {}), "('../../data/interim/HDFS1/val-data-Drain3-HDFS1-cv1-1.binlog')\n", (2160, 2223), False, 'from src.data.logparser import load_drain3\n'), ((656, 690), 'collections.Counter', 'Co...
# Improvement of the Gym environment with universe import cv2 import gym import numpy as np from gym.spaces.box import Box from gym import wrappers # Taken from https://github.com/openai/universe-starter-agent def create_atari_env(env_id, video=False): env = gym.make(env_id) if video: env = wrappe...
[ "gym.make", "numpy.expand_dims", "gym.wrappers.Monitor", "gym.spaces.box.Box", "cv2.resize" ]
[((269, 285), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (277, 285), False, 'import gym\n'), ((704, 731), 'cv2.resize', 'cv2.resize', (['frame', '(80, 80)'], {}), '(frame, (80, 80))\n', (714, 731), False, 'import cv2\n'), ((744, 771), 'cv2.resize', 'cv2.resize', (['frame', '(42, 42)'], {}), '(frame, (42, 4...
import pytest import numpy as np import numpy.testing as npt from apl.acquisitions import UpperConfidenceBound, ExpectedImprovement @pytest.mark.parametrize( "kappa,mu,s2,expected", [ ( 1.0, np.asarray([1.5, 0.7, 2.1], dtype=np.float32), np.asarray([1.0, 0.0, 4.0], ...
[ "numpy.asarray", "apl.acquisitions.UpperConfidenceBound" ]
[((473, 506), 'apl.acquisitions.UpperConfidenceBound', 'UpperConfidenceBound', ([], {'kappa': 'kappa'}), '(kappa=kappa)\n', (493, 506), False, 'from apl.acquisitions import UpperConfidenceBound, ExpectedImprovement\n'), ((233, 278), 'numpy.asarray', 'np.asarray', (['[1.5, 0.7, 2.1]'], {'dtype': 'np.float32'}), '([1.5, ...
#!/usr/bin/env python """ run and store data in file """ from classes.md_system import MDSystem import numpy as np def simulate_system(init_vel): """ simulate the system for init_vel and take temp. and energy""" # initial data size = 30 num_particle = 100 xs = np.repeat(np.linspace(0.1, 0.45, 10...
[ "numpy.save", "numpy.std", "classes.md_system.MDSystem", "numpy.zeros", "numpy.mean", "numpy.linspace", "numpy.vstack" ]
[((390, 423), 'numpy.vstack', 'np.vstack', (['(xs * size, ys * size)'], {}), '((xs * size, ys * size))\n', (399, 423), True, 'import numpy as np\n'), ((591, 608), 'classes.md_system.MDSystem', 'MDSystem', ([], {}), '(**kargs)\n', (599, 608), False, 'from classes.md_system import MDSystem\n'), ((774, 788), 'numpy.zeros'...
# -*- coding: utf-8 -*- from __future__ import print_function import os import glob import sys from tempfile import mkdtemp import numpy as np from sklearn.decomposition import PCA from sklearn.manifold import TSNE from sklearn.metrics.pairwise import pairwise_distances import dendropy from dendropy.calculate.treesum...
[ "sklearn.metrics.pairwise.pairwise_distances", "numpy.random.seed", "dendropy.Tree.get", "sklearn.manifold.TSNE", "dendropy.calculate.treesum.TreeSummarizer", "dendropy.SplitDistribution", "tempfile.mkdtemp", "sklearn.decomposition.PCA", "numpy.random.randint", "glob.glob", "dendropy.TaxonNamesp...
[((1421, 1452), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'nb_dimensions'}), '(n_components=nb_dimensions)\n', (1424, 1452), False, 'from sklearn.decomposition import PCA\n'), ((2651, 2683), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': 'nb_dimensions'}), '(n_components=nb_dimensions)\n', (2655...
# Copyright 2022 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
[ "numpy.random.seed", "constrained_optidice.tabular.mdp_util.solve_mdp", "constrained_optidice.tabular.mdp_util.generate_random_cmdp", "constrained_optidice.tabular.mdp_util.policy_evaluation", "numpy.ones", "constrained_optidice.tabular.offline_cmdp.conservative_constrained_optidice", "time.time", "ab...
[((912, 1009), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""cost_thresholds"""', '(0.1)', '"""The cost constraint threshold of the true CMDP."""'], {}), "('cost_thresholds', 0.1,\n 'The cost constraint threshold of the true CMDP.')\n", (930, 1009), False, 'from absl import flags\n'), ((1025, 1214), 'absl.f...
from arc23.data import retrieval as rt import numpy as np metadata_path = './preprocessed_data.csv' COL_TYPE = 1 COL_IMG_WEB = 0 metadata, len_metadata, metadata_headers, class_to_index, index_to_class, num_classes = rt.load_metadata( metadata_path, cols=(COL_IMG_WEB, COL_TYPE), class_cols=(C...
[ "arc23.data.retrieval.load_metadata", "numpy.array", "numpy.unique" ]
[((220, 310), 'arc23.data.retrieval.load_metadata', 'rt.load_metadata', (['metadata_path'], {'cols': '(COL_IMG_WEB, COL_TYPE)', 'class_cols': '(COL_TYPE,)'}), '(metadata_path, cols=(COL_IMG_WEB, COL_TYPE), class_cols=(\n COL_TYPE,))\n', (236, 310), True, 'from arc23.data import retrieval as rt\n'), ((348, 366), 'num...
# -*- coding: utf-8 -*- import os import copy import codecs import numpy as np from collections import defaultdict class WPE(object): # Word Pair Encoding. Most ideas were borrowed from https://github.com/rsennrich/subword-nmt/blob/master/learn_bpe.py PRUNE_EVERY = 100 PAD = 10000 def ...
[ "os.mkdir", "copy.deepcopy", "os.path.join", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "os.path.isdir", "collections.defaultdict", "matplotlib.use", "numpy.array", "matplotlib.pyplot.grid" ]
[((997, 1013), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1008, 1013), False, 'from collections import defaultdict\n'), ((1430, 1455), 'copy.deepcopy', 'copy.deepcopy', (['self.stats'], {}), '(self.stats)\n', (1443, 1455), False, 'import copy\n'), ((2314, 2330), 'collections.defaultdict', 'def...
# -*- coding: utf-8 -*- """ Copyright Netherlands eScience Center Function : Calculate Meridional Energy Transport in the Atmosphere with Reanalysis Author : <NAME> (<EMAIL>) First Built : 2020.07.03 Last Update : 2020.07.03 Contributor : Description : This module provides a meth...
[ "numpy.sum", "numpy.abs", "numpy.zeros", "logging.info", "numpy.arange", "numpy.cos" ]
[((3312, 3347), 'numpy.zeros', 'np.zeros', (['(t, h, y, x)'], {'dtype': 'float'}), '((t, h, y, x), dtype=float)\n', (3320, 3347), True, 'import numpy as np\n'), ((3367, 3379), 'numpy.arange', 'np.arange', (['h'], {}), '(h)\n', (3376, 3379), True, 'import numpy as np\n'), ((3770, 3838), 'logging.info', 'logging.info', (...
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn import datasets from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from perceptron_ga import PerceptronGA import ti...
[ "sklearn.datasets.load_iris", "perceptron_ga.PerceptronGA", "matplotlib.pyplot.show", "sklearn.preprocessing.StandardScaler", "numpy.std", "sklearn.model_selection.train_test_split", "numpy.zeros", "matplotlib.pyplot.ylabel", "mlxtend.plotting.plot_confusion_matrix", "numpy.mean", "numpy.where",...
[((415, 435), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (433, 435), False, 'from sklearn import datasets\n'), ((463, 507), 'numpy.zeros', 'np.zeros', (['(iris_datasets.target.shape[0], 1)'], {}), '((iris_datasets.target.shape[0], 1))\n', (471, 507), True, 'import numpy as np\n'), ((586, 603)...
# coding:utf-8 import os import json import numpy as np import glob import shutil from labelme import utils from sklearn.model_selection import train_test_split np.random.seed(41) classname_to_id = {'BowenPress_1': 1, 'BowenPress_2': 2, 'FTchinese': 3, 'Formosa TV News network': 4, 'RFA': 5, 'apol...
[ "labelme.utils.img_b64_to_arr", "numpy.random.seed", "os.makedirs", "json.load", "os.path.basename", "sklearn.model_selection.train_test_split", "numpy.asarray", "os.path.exists", "glob.glob" ]
[((163, 181), 'numpy.random.seed', 'np.random.seed', (['(41)'], {}), '(41)\n', (177, 181), True, 'import numpy as np\n'), ((4441, 4477), 'glob.glob', 'glob.glob', (["(labelme_path + '*/*.json')"], {}), "(labelme_path + '*/*.json')\n", (4450, 4477), False, 'import glob\n'), ((4506, 4554), 'sklearn.model_selection.train_...
import keras import numpy as np from keras.layers import Input, Convolution2D, MaxPooling2D, Dropout, BatchNormalization, Activation from keras.models import Model from keras import backend as K import tensorflow as tf from keras.engine import Layer # class 상속을 위한 클래스 ########################################## # Fract...
[ "keras.layers.Convolution2D", "keras.layers.Activation", "keras.backend.random_binomial", "keras.layers.Dropout", "keras.backend.sum", "keras.backend.any", "keras.layers.BatchNormalization", "numpy.random.randint", "keras.backend.zeros", "tensorflow.random_shuffle", "keras.backend.variable", "...
[((557, 585), 'tensorflow.random_shuffle', 'tf.random_shuffle', (['arr', 'seed'], {}), '(arr, seed)\n', (574, 585), True, 'import tensorflow as tf\n'), ((768, 800), 'numpy.random.randint', 'np.random.randint', (['(1)', '(10000000.0)'], {}), '(1, 10000000.0)\n', (785, 800), True, 'import numpy as np\n'), ((1605, 1637), ...
#! /usr/bin/env python3 """ creates an (d2, w1, w2) "movie" scan of a TRIVE process. This script utilizes ffmpeg and celluloid to snap frames of w1, w2 as a function of d2. The frames are then added and saved as a viewable movie in an MP4 container. ffmpeg and celluloid must be installed. The MP4 file named at th...
[ "matplotlib.pyplot.subplot", "WrightSim.hamiltonian.Hamiltonian", "numpy.sum", "numpy.log", "celluloid.Camera", "WrightTools.artists.create_figure", "matplotlib.pyplot.close", "os.path.dirname", "time.perf_counter", "WrightSim.experiment.builtin", "numpy.linspace", "WrightTools.artists.plot_co...
[((1145, 1170), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1160, 1170), False, 'import os\n'), ((1501, 1528), 'WrightSim.experiment.builtin', 'experiment.builtin', (['"""trive"""'], {}), "('trive')\n", (1519, 1528), True, 'from WrightSim import experiment as experiment\n'), ((1736, 1768)...
from pykalman import AdditiveUnscentedKalmanFilter from scipy.stats import multivariate_normal from tracking.utils import confidence_from_multivariate_distribution, FramesWithInfo from tools.optical_flow import compute_flow from collections import defaultdict import pickle import numpy as np from numpy import ma from ...
[ "numpy.load", "tqdm.tqdm", "argparse.ArgumentParser", "numpy.eye", "numpy.expand_dims", "scipy.stats.multivariate_normal", "numpy.ma.empty", "collections.defaultdict", "tools.optical_flow.compute_flow", "pickle.load", "numpy.array", "numpy.loadtxt", "tracking.utils.FramesWithInfo", "tracki...
[((2031, 2073), 'numpy.loadtxt', 'np.loadtxt', (['args.input_file'], {'delimiter': '""","""'}), "(args.input_file, delimiter=',')\n", (2041, 2073), True, 'import numpy as np\n'), ((2169, 2186), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2180, 2186), False, 'from collections import defaultdic...
import unittest import dolfin as df import numpy as np from fenics_helpers import boundary import constitutive as c def law(prm): return c.LinearElastic(prm.E, prm.nu, prm.constraint) class TestUniaxial(unittest.TestCase): def test_mismatch(self): prm = c.Parameters(c.Constraint.PLANE_STRAIN) ...
[ "unittest.main", "dolfin.UnitIntervalMesh", "dolfin.UnitSquareMesh", "constitutive.Parameters", "constitutive.LinearElastic", "dolfin.UnitCubeMesh", "fenics_helpers.boundary.plane_at", "numpy.linspace" ]
[((142, 188), 'constitutive.LinearElastic', 'c.LinearElastic', (['prm.E', 'prm.nu', 'prm.constraint'], {}), '(prm.E, prm.nu, prm.constraint)\n', (157, 188), True, 'import constitutive as c\n'), ((2965, 2980), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2978, 2980), False, 'import unittest\n'), ((272, 311), 'co...
import cv2 from sympy import Point, Ellipse import numpy as np x1='blobs2.jpg' image = cv2.imread(x1,0) image1 = cv2.imread(x1,1) x,y=image.shape median = cv2.GaussianBlur(image,(9,9),0) median1 = cv2.GaussianBlur(image,(21,21),0) a = cv2.Canny(median1, 10, 7) cv2.imshow("weird", a) cv2.waitKey(0) c=255-a ret,thresh1 =...
[ "cv2.GaussianBlur", "cv2.Canny", "numpy.size", "numpy.uint8", "cv2.dilate", "cv2.waitKey", "cv2.morphologyEx", "cv2.threshold", "numpy.zeros", "numpy.ones", "cv2.imread", "cv2.fitEllipse", "cv2.drawContours", "cv2.imshow", "cv2.findContours", "numpy.sqrt" ]
[((87, 104), 'cv2.imread', 'cv2.imread', (['x1', '(0)'], {}), '(x1, 0)\n', (97, 104), False, 'import cv2\n'), ((113, 130), 'cv2.imread', 'cv2.imread', (['x1', '(1)'], {}), '(x1, 1)\n', (123, 130), False, 'import cv2\n'), ((155, 189), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['image', '(9, 9)', '(0)'], {}), '(image, (9,...
# -*- coding: utf-8 -*- # # Filename: PRML_Neural_Networks.py # Author: <NAME> # Created: 2015-06-05 15:41:09(+0800) # # Last-Updated: 2017-05-05 21:57:19(+0800) [by <NAME>] # Update #: 461 # # Commentary: # # # # Change Log: # # # from __future__ import print_function import numpy as np import scipy.io as sio f...
[ "matplotlib.pyplot.gray", "numpy.abs", "scipy.io.loadmat", "numpy.argmax", "numpy.ones", "matplotlib.pyplot.figure", "numpy.mean", "numpy.sin", "numpy.zeros_like", "matplotlib.pyplot.imshow", "numpy.linspace", "numpy.random.shuffle", "matplotlib.pyplot.show", "numpy.asarray", "numpy.vsta...
[((6964, 6995), 'scipy.io.loadmat', 'sio.loadmat', (['"""PRML_NN_data.mat"""'], {}), "('PRML_NN_data.mat')\n", (6975, 6995), True, 'import scipy.io as sio\n'), ((7080, 7111), 'numpy.random.shuffle', 'np.random.shuffle', (['rand_indices'], {}), '(rand_indices)\n', (7097, 7111), True, 'import numpy as np\n'), ((7312, 734...
import glob import gzip import pickle import matplotlib.pyplot as plt import numpy as np from multiprocessing import Pool from pathlib import Path import re import os class FitnessPlot: def __init__(self, num_threads=1, folder_prefix='data', plot_max_score=False, max_score=3186): self.num_threads = num...
[ "pickle.dump", "os.remove", "matplotlib.pyplot.show", "gzip.open", "re.split", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "pickle.load", "multiprocessing.Pool", "numpy.array_split", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((1899, 1942), 'numpy.array_split', 'np.array_split', (['file_list', 'self.num_threads'], {}), '(file_list, self.num_threads)\n', (1913, 1942), True, 'import numpy as np\n'), ((1955, 1987), 'multiprocessing.Pool', 'Pool', ([], {'processes': 'self.num_threads'}), '(processes=self.num_threads)\n', (1959, 1987), False, '...
"""Implements training procedure for MFAS.""" from utils.AUPRC import AUPRC import torch import torch.optim as op import numpy as np import utils.surrogate as surr import utils.search_tools as tools import fusions.searchable as avm # from eval_scripts.performance import AUPRC from eval_scripts.complexity import all_i...
[ "torch.nn.MSELoss", "tqdm.tqdm", "utils.search_tools.sample_k_configurations", "eval_scripts.robustness.effective_robustness", "utils.search_tools.merge_unfolded_with_sampled", "utils.AUPRC.AUPRC", "utils.search_tools.train_surrogate", "utils.surrogate.SurrogateDataloader", "eval_scripts.robustness....
[((14346, 14384), 'eval_scripts.complexity.all_in_one_test', 'all_in_one_test', (['_testprocess', '[model]'], {}), '(_testprocess, [model])\n', (14361, 14384), False, 'from eval_scripts.complexity import all_in_one_train, all_in_one_test\n'), ((5290, 5308), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (530...
import sys,json import numpy as np def f_xy(x,y): f1x = (np.sin(5.1 * np.pi * x + 0.5))**6 f2x = np.exp(-4*np.log(2) * (x - 0.0667)**2/0.64) f1y = (np.sin(5.1 * np.pi * y + 0.5))**6 f2y = np.exp(-4*np.log(2) * (y - 0.0667)**2/0.64) return f1x*f2x*f1y*f2y if __name__ == '__main__': # Readi...
[ "numpy.sin", "numpy.log", "json.dumps" ]
[((62, 91), 'numpy.sin', 'np.sin', (['(5.1 * np.pi * x + 0.5)'], {}), '(5.1 * np.pi * x + 0.5)\n', (68, 91), True, 'import numpy as np\n'), ((161, 190), 'numpy.sin', 'np.sin', (['(5.1 * np.pi * y + 0.5)'], {}), '(5.1 * np.pi * y + 0.5)\n', (167, 190), True, 'import numpy as np\n'), ((814, 832), 'json.dumps', 'json.dump...
# Copyright (c) Gorilla-Lab. All rights reserved. from typing import Optional, List import torch import torch.nn.functional as F import numpy as np from scipy.sparse import coo_matrix from torch_scatter import scatter_add from treelib import Tree import htree from cluster.hierarchy import linkage class Node: de...
[ "numpy.isin", "torch.eye", "numpy.argmax", "torch.cat", "torch_scatter.scatter_add", "torch.nn.functional.normalize", "numpy.unique", "htree.Tree", "scipy.sparse.coo_matrix", "torch.Tensor", "numpy.stack", "numpy.ones_like", "torch.unique", "torch.where", "cluster.hierarchy.linkage", "...
[((1768, 1792), 'torch.unique', 'torch.unique', (['batch_idxs'], {}), '(batch_idxs)\n', (1780, 1792), False, 'import torch\n'), ((7797, 7835), 'torch_scatter.scatter_add', 'scatter_add', (['property_gain', 'ids'], {'dim': '(0)'}), '(property_gain, ids, dim=0)\n', (7808, 7835), False, 'from torch_scatter import scatter_...
# -*- coding: utf-8 -*- """ Created on Fri Oct 29 09:32:34 2021 @author: <NAME> """ import napari from napari_plugin_engine import napari_hook_implementation from qtpy.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QLineEdit, QListWidget, QListWidgetItem, QLabel, QFileDialog, QCheckBox from qtpy.Qt...
[ "magicgui.widgets.ComboBox", "numpy.minimum", "magicgui.widgets.LiteralEvalLineEdit", "numpy.copy", "qtpy.QtWidgets.QHBoxLayout", "numpy.asarray", "qtpy.QtWidgets.QVBoxLayout", "napari.layers.Layer.create", "packaging.version.Version", "qtpy.QtWidgets.QWidget", "qtpy.QtWidgets.QPushButton", "n...
[((1351, 1379), 'numpy.copy', 'np.copy', (['self.layer_sel.data'], {}), '(self.layer_sel.data)\n', (1358, 1379), True, 'import numpy as np\n'), ((1418, 1447), 'numpy.copy', 'np.copy', (['self.layer_sel.scale'], {}), '(self.layer_sel.scale)\n', (1425, 1447), True, 'import numpy as np\n'), ((1486, 1519), 'numpy.copy', 'n...
""" """ # Handle imports import numpy as np from LoadTilesets import get_tileset_by_id, get_id_of_tileset, get_tileset from LoadTilesets import num_tilesets from LoadTilesets import image_to_array from LoadTilesets import largest_tile_dims, smallest_tile_dims from LoadTilesets import hash_tile from LoadTilesets import...
[ "numpy.abs", "numpy.sum", "numpy.argmax", "LoadTilesets.smallest_tile_dims", "LoadTilesets.hash_tile", "numpy.ones", "numpy.clip", "numpy.argsort", "scipy.misc.imsave", "LoadTilesets.load_tileset_info", "LoadTilesets.entropy_image", "sklearn.cluster.KMeans", "numpy.max", "LoadTilesets.get_...
[((531, 550), 'LoadTilesets.load_tileset_info', 'load_tileset_info', ([], {}), '()\n', (548, 550), False, 'from LoadTilesets import load_tileset_info\n'), ((1839, 1872), 'LoadTilesets.get_tileset_by_id', 'get_tileset_by_id', (['old_tileset_id'], {}), '(old_tileset_id)\n', (1856, 1872), False, 'from LoadTilesets import ...
from django.views.generic import TemplateView, CreateView import pandas as pd import numpy as np ###importing surprise library to implement the recommending systems needed from surprise import NMF, SVD, SVDpp, KNNBasic, KNNWithMeans, KNNWithZScore, CoClustering from surprise.model_selection import cross_validate from s...
[ "pandas.DataFrame", "surprise.Dataset.load_from_df", "pandas.read_csv", "surprise.Reader", "pandas.merge", "numpy.setdiff1d", "django.shortcuts.render", "surprise.SVD" ]
[((1005, 1064), 'pandas.read_csv', 'pd.read_csv', (['"""main/ml-100k/u.data"""'], {'sep': '"""\t"""', 'names': 'columns'}), "('main/ml-100k/u.data', sep='\\t', names=columns)\n", (1016, 1064), True, 'import pandas as pd\n'), ((1400, 1478), 'pandas.read_csv', 'pd.read_csv', (['"""main/ml-100k/u.item"""'], {'sep': '"""|"...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import glob import os import os.path as osp import pickle import re import matplotlib.pyplot as plt import numpy as np import plyvel import scipy.ndimage as ndi from skimage.color import label2rgb import skima...
[ "pickle.loads", "matplotlib.pyplot.show", "skimage.color.label2rgb", "os.path.basename", "matplotlib.pyplot.imshow", "plyvel.DB", "os.path.realpath", "numpy.zeros", "re.match", "numpy.random.RandomState", "numpy.where", "numpy.array", "scipy.ndimage.imread", "os.path.splitext", "os.path....
[((429, 451), 'os.path.realpath', 'osp.realpath', (['__file__'], {}), '(__file__)\n', (441, 451), True, 'import os.path as osp\n'), ((505, 1559), 'numpy.array', 'np.array', (["['background', 'barkely_hide_bones', 'cherokee_easy_tee_shirt',\n 'clorox_utility_brush', 'cloud_b_plush_bear', 'command_hooks',\n 'cool_s...
# https://github.com/microsoft/CameraTraps/blob/master/research/active_learning/data_preprocessing/crop_images_from_coco_bboxes.py ''' Produces a directory of crops from a COCO-annotated .json full of bboxes. ''' import numpy as np import argparse, ast, csv, json, pickle, os, sys, time, tqdm, uuid from PIL import Im...
[ "json.dump", "tqdm.tqdm", "os.mkdir", "numpy.maximum", "os.path.exists", "time.time", "numpy.hstack", "numpy.max", "numpy.mean", "PIL.Image.fromarray", "os.path.join", "numpy.vstack" ]
[((2919, 2930), 'time.time', 'time.time', ([], {}), '()\n', (2928, 2930), False, 'import argparse, ast, csv, json, pickle, os, sys, time, tqdm, uuid\n'), ((2946, 2981), 'tqdm.tqdm', 'tqdm', (["coco_json_data['annotations']"], {}), "(coco_json_data['annotations'])\n", (2950, 2981), False, 'from tqdm import tqdm\n'), ((6...
import numpy as np # pythran export slg(complex128[:], float64[:], float64[:], complex128[:, :, :] order(C), complex128[:, :, :, :] order(C), complex128[:, :, :] order(C), int64[:], int64[:], float, float, float) def slg( w_l, f_n, E_n, r_vnn, rd_vvnn, D_vnn, pol_v, band_n=None, ft...
[ "numpy.abs", "numpy.imag", "numpy.zeros", "numpy.real" ]
[((1001, 1040), 'numpy.zeros', 'np.zeros', (['w_l.size'], {'dtype': 'np.complex128'}), '(w_l.size, dtype=np.complex128)\n', (1009, 1040), True, 'import numpy as np\n'), ((1054, 1093), 'numpy.zeros', 'np.zeros', (['w_l.size'], {'dtype': 'np.complex128'}), '(w_l.size, dtype=np.complex128)\n', (1062, 1093), True, 'import ...
#!/usr/bin/env python """Stellar parameterization using flux ratios from optical spectra. This is the main routine of ATHOS responsible for reading the necessary parameters from 'parameters.py' and loading the spectrum information from the file 'input_specs'. Subsequently, depending on the settings, the workflow is ...
[ "numpy.array", "athos_utils.analyze_spectrum", "joblib.Parallel", "joblib.delayed", "multiprocessing.cpu_count" ]
[((2142, 2153), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (2151, 2153), False, 'from multiprocessing import cpu_count\n'), ((2613, 2639), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': 'n_threads'}), '(n_jobs=n_threads)\n', (2621, 2639), False, 'from joblib import Parallel, delayed\n'), ((1869, 2075),...
from ase.calculators.calculator import all_changes from ase.atoms import Atoms from finetuna.ml_potentials.ml_potential_calc import MLPCalc from torch.utils.data import Dataset from ocpmodels.preprocessing import AtomsToGraphs import sys, os import yaml from finetuna.job_creator import merge_dict import copy import tim...
[ "torch.cuda.amp.autocast", "copy.deepcopy", "numpy.zeros_like", "ocpmodels.common.distutils.is_master", "ocpmodels.preprocessing.AtomsToGraphs", "ocpmodels.datasets.lmdb_dataset.data_list_collater", "logging.warning", "ocpmodels.common.utils.setup_imports", "time.time", "torch.set_num_threads", ...
[((4288, 4318), 'finetuna.job_creator.merge_dict', 'merge_dict', (['config', 'mlp_params'], {}), '(config, mlp_params)\n', (4298, 4318), False, 'from finetuna.job_creator import merge_dict\n'), ((4328, 4369), 'finetuna.ml_potentials.ml_potential_calc.MLPCalc.__init__', 'MLPCalc.__init__', (['self'], {'mlp_params': 'con...
import numpy as np from scipy.misc import imresize import matplotlib.pyplot as plt import matplotlib.image as mpimg from matplotlib.patches import Rectangle from sklearn_theano.feature_extraction import OverfeatLocalizer from sklearn_theano.datasets import load_sample_image from sklearn.mixture import GMM """ pip inst...
[ "matplotlib.image.imread", "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.patches.Rectangle", "matplotlib.pyplot.gca", "matplotlib.pyplot.imshow", "sklearn_theano.feature_extraction.OverfeatLocalizer", "sklearn.mixture.GMM", "numpy.zeros", "sklearn_theano.datasets.load_sample_image", "m...
[((883, 901), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {}), '(2, 2)\n', (895, 901), True, 'import matplotlib.pyplot as plt\n'), ((1042, 1058), 'scipy.misc.imresize', 'imresize', (['X', '(0.4)'], {}), '(X, 0.4)\n', (1050, 1058), False, 'from scipy.misc import imresize\n'), ((1131, 1220), 'numpy.zer...
import numpy as np import utils def expanded_indexer(key, ndim): """Given a key for indexing an ndarray, return an equivalent key which is a tuple with length equal to the number of dimensions. The expansion is done by replacing all `Ellipsis` items with the right number of full slices and then paddi...
[ "numpy.asarray", "numpy.any", "numpy.nonzero", "numpy.arange", "numpy.asscalar" ]
[((4746, 4763), 'numpy.asarray', 'np.asarray', (['label'], {}), '(label)\n', (4756, 4763), True, 'import numpy as np\n'), ((8197, 8232), 'numpy.asarray', 'np.asarray', (['self.values'], {'dtype': 'None'}), '(self.values, dtype=None)\n', (8207, 8232), True, 'import numpy as np\n'), ((1484, 1503), 'numpy.asarray', 'np.as...
import pickle import numpy as np import cv2 import mediapipe as mp import pandas as pd from collections import Counter def action_detect(if_show_video=False): mp_drawing = mp.solutions.drawing_utils # Drawing helpers mp_holistic = mp.solutions.holistic # Mediapipe Solutions body_list = [] with ope...
[ "pandas.DataFrame", "cv2.putText", "cv2.VideoWriter_fourcc", "numpy.argmax", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "pickle.load", "numpy.array", "cv2.rectangle", "collections.Counter", "cv2.destroyAllWindows" ]
[((429, 457), 'cv2.VideoCapture', 'cv2.VideoCapture', (['str_source'], {}), '(str_source)\n', (445, 457), False, 'import cv2\n'), ((472, 503), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'mp4v'"], {}), "(*'mp4v')\n", (494, 503), False, 'import cv2\n'), ((6046, 6069), 'cv2.destroyAllWindows', 'cv2.destroyAll...
# -*- coding: utf-8 -*- # Copyright (c) St. Anne's University Hospital in Brno. International Clinical # Research Center, Biomedical Engineering. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # Std imports # Third pary imports import pytest import pandas as pd import ...
[ "numpy.array", "pytest.fixture", "pandas.DataFrame" ]
[((352, 382), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (366, 382), False, 'import pytest\n'), ((468, 558), 'numpy.array', 'np.array', (['[[10, 20, 80, 5], [30, 50, 100, 10], [60, 70, 150, 15], [80, 110, 200, 20]]'], {}), '([[10, 20, 80, 5], [30, 50, 100, 10], [60, 70, 1...
"""Basic tests for polytopes.""" import unittest import numpy as np from hitandrun.hitandrun import HitAndRun from hitandrun.polytope import Polytope class TestHitAndRun(unittest.TestCase): """Basic tests for hit and run.""" def test_hitandrun_instantiate(self): """Test if HitAndRun object can be cr...
[ "hitandrun.polytope.Polytope", "numpy.array", "hitandrun.hitandrun.HitAndRun", "numpy.alltrue" ]
[((342, 404), 'numpy.array', 'np.array', (['[[1, 0], [-1, 0], [0, 1], [0, -1]]'], {'dtype': 'np.float64'}), '([[1, 0], [-1, 0], [0, 1], [0, -1]], dtype=np.float64)\n', (350, 404), True, 'import numpy as np\n'), ((483, 523), 'numpy.array', 'np.array', (['[1, 1, 1, 1]'], {'dtype': 'np.float64'}), '([1, 1, 1, 1], dtype=np...
""" Module for managing WavFromGeneralMidi dataset """ from functools import partial import numpy as np import tensorflow as tf from datasets.AudioDataset import AudioDataset from .Dataset import TRAIN, VALIDATION, TEST ALL_LABELS = ["instrument_family", "instrument_name", "pitch", "vol", "audio"] PITCH = "pitch" ...
[ "functools.partial", "tensorflow.data.TFRecordDataset", "tensorflow.concat", "tensorflow.parse_single_example", "tensorflow.FixedLenFeature", "numpy.intersect1d" ]
[((2966, 2999), 'numpy.intersect1d', 'np.intersect1d', (['ALL_LABELS', 'param'], {}), '(ALL_LABELS, param)\n', (2980, 2999), True, 'import numpy as np\n'), ((3603, 3651), 'tensorflow.parse_single_example', 'tf.parse_single_example', (['example_proto', 'features'], {}), '(example_proto, features)\n', (3626, 3651), True,...
import pandas as pd from utils.metrics import * from tqdm import tqdm import numpy as np from scipy import sparse import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from utils.definitions import ROOT_DIR from utils.datareader import Datareader import utils.post_processing as post class Evaluator(...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "matplotlib.use", "numpy.arange", "scipy.sparse.csr_matrix", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.pyplot.subplots_adjust", "numpy.mean", "matplotlib.pyplot.xlabel", "matplotlib...
[((139, 153), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (146, 153), True, 'import matplotlib as mpl\n'), ((6343, 6477), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'evaluation_cat', 'index': "['cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6', 'cat7', 'cat8', 'cat9',\n 'cat10', 'mean']"}), "(...
import os import sys import numpy as np import matplotlib as plt from keras.preprocessing import sequence from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.layers import Dense, Embedding, LSTM, SpatialDropout1D from keras.models import Sequential import ker...
[ "numpy.argmax", "keras.preprocessing.sequence.pad_sequences", "keras.layers.LSTM", "keras.layers.SpatialDropout1D", "keras.preprocessing.text.Tokenizer", "keras.layers.Embedding", "keras.models.Sequential" ]
[((1674, 1718), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'max_features', 'split': '""" """'}), "(num_words=max_features, split=' ')\n", (1683, 1718), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1799, 1815), 'keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['...
""" Define a suite of tests for the odict """ import numpy as np import sciris as sc def printexamples(examples): for v,val in enumerate(examples): print('Example %s:' % (v+1)) print(val) print('') return None def test_main(): sc.heading('Main tests:') foo = sc.odict({'ah':3...
[ "sciris.toc", "sciris.heading", "sciris.odict", "sciris.tic", "numpy.array", "sciris.objdict" ]
[((268, 293), 'sciris.heading', 'sc.heading', (['"""Main tests:"""'], {}), "('Main tests:')\n", (278, 293), True, 'import sciris as sc\n'), ((304, 356), 'sciris.odict', 'sc.odict', (["{'ah': 3, 'boo': 4, 'cough': 6, 'dill': 8}"], {}), "({'ah': 3, 'boo': 4, 'cough': 6, 'dill': 8})\n", (312, 356), True, 'import sciris as...
import numpy as np import netomaton as ntm from .rule_test import * class TestSmallWorldDensityClassification(RuleTest): def test_small_world_density_classification(self): np.random.seed(0) network = ntm.topology.watts_strogatz_graph(n=149, k=8, p=0.5, seed=0) initial_conditions = np.r...
[ "numpy.random.seed", "netomaton.topology.watts_strogatz_graph", "netomaton.evolve", "netomaton.get_activities_over_time_as_list", "numpy.random.randint", "numpy.testing.assert_equal" ]
[((188, 205), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (202, 205), True, 'import numpy as np\n'), ((225, 285), 'netomaton.topology.watts_strogatz_graph', 'ntm.topology.watts_strogatz_graph', ([], {'n': '(149)', 'k': '(8)', 'p': '(0.5)', 'seed': '(0)'}), '(n=149, k=8, p=0.5, seed=0)\n', (258, 285),...
## # @author : <NAME> # @brief : A set of generic functions for data management ## # Input List input_list = [1,2,3,4,-7] # AVERAGING : # average_above_zero function declaration # @param input_list : the input list to be scanned. # @throws an exception (ValueError) on an empty list def average_above_zero(input_list)...
[ "numpy.full", "numpy.zeros", "random.randint", "numpy.array" ]
[((3226, 3272), 'numpy.zeros', 'numpy.zeros', (['[size_rows, size_cols]'], {'dtype': 'int'}), '([size_rows, size_cols], dtype=int)\n', (3237, 3272), False, 'import numpy\n'), ((5191, 5226), 'numpy.full', 'numpy.full', (['[5, 5]', '""""""'], {'dtype': '"""str"""'}), "([5, 5], '', dtype='str')\n", (5201, 5226), False, 'i...
"""Numpy's new DType""" import os from setuptools import setup, Extension import numpy as np # pylint: disable=invalid-name version = "0.0.1" extra_compile_args = ["-O3", "-w"] extensions = [ Extension( name="npdt.customfloat", sources=["src/customfloat.c"], include_dirs=[np.get_include()...
[ "setuptools.setup", "numpy.get_include", "os.system" ]
[((781, 831), 'os.system', 'os.system', (['"""export NUMPY_EXPERIMENTAL_DTYPE_API=1"""'], {}), "('export NUMPY_EXPERIMENTAL_DTYPE_API=1')\n", (790, 831), False, 'import os\n'), ((836, 859), 'setuptools.setup', 'setup', ([], {}), '(**setup_metadata)\n', (841, 859), False, 'from setuptools import setup, Extension\n'), ((...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ # Written by <NAME> <<EMAIL>> # import re import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, pack_sequence, pad_s...
[ "torch.nn.Dropout", "torch.nn.Parameter", "re.split", "torch.nn.ModuleList", "torch.nn.Embedding", "torch.Tensor", "torch.nn.RNN", "torch.nn.utils.rnn.pad_packed_sequence", "torch.nn.utils.rnn.pack_padded_sequence", "numpy.prod" ]
[((1402, 1429), 'torch.nn.Dropout', 'nn.Dropout', (['hparams.dropout'], {}), '(hparams.dropout)\n', (1412, 1429), True, 'import torch.nn as nn\n'), ((1485, 1500), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1498, 1500), True, 'import torch.nn as nn\n'), ((1527, 1542), 'torch.nn.ModuleList', 'nn.ModuleLis...
# Copyright 2018 <NAME> (Alvipe) # This file is part of Open Myo. # Open Myo is distributed under a GPL 3.0 license import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.preprocessing import MinMaxScaler from sklearn.pipeline import make_pipeline def segmentati...
[ "numpy.abs", "numpy.power", "numpy.floor", "sklearn.preprocessing.MinMaxScaler", "numpy.zeros", "numpy.nonzero", "numpy.diff", "numpy.array", "sklearn.discriminant_analysis.LinearDiscriminantAnalysis", "numpy.var" ]
[((457, 490), 'numpy.zeros', 'np.zeros', (['(n_samples, n_segments)'], {}), '((n_samples, n_segments))\n', (465, 490), True, 'import numpy as np\n'), ((1003, 1018), 'numpy.var', 'np.var', (['segment'], {}), '(segment)\n', (1009, 1018), True, 'import numpy as np\n'), ((3321, 3340), 'sklearn.discriminant_analysis.LinearD...
import numpy as np from haralick import haralick_labeling def main(): np.random.seed(123) # Create a random binary image to test the labeling process img_h, img_w = 8, 8 image = np.random.choice((0, 0, 1), size=(img_h, img_w)).astype(np.uint8) haralick_labeling(image, display=True) if __name_...
[ "numpy.random.choice", "numpy.random.seed", "haralick.haralick_labeling" ]
[((77, 96), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (91, 96), True, 'import numpy as np\n'), ((269, 307), 'haralick.haralick_labeling', 'haralick_labeling', (['image'], {'display': '(True)'}), '(image, display=True)\n', (286, 307), False, 'from haralick import haralick_labeling\n'), ((198, 24...
""" <NAME> Heinz-Nixdorf Chair for Distributed Information Systems Friedrich Schiller University Jena, Germany Email: <EMAIL> Website: https://github.com/Sheeba-Samuel """ from reproducemegit import settings import pandas as pd from reproducemegit.jupyter_reproducibility.db import connect, Repository, Notebook, Query,...
[ "reproducemegit.jupyter_reproducibility.db.connect", "json.dumps", "reproducemegit.jupyter_reproducibility.utils.human_readable_duration", "numpy.bitwise_and", "matplotlib.pyplot.gcf", "pandas.concat" ]
[((8334, 8376), 'pandas.concat', 'pd.concat', (['[installed_dp, non_declared_dp]'], {}), '([installed_dp, non_declared_dp])\n', (8343, 8376), True, 'import pandas as pd\n'), ((1142, 1151), 'reproducemegit.jupyter_reproducibility.db.connect', 'connect', ([], {}), '()\n', (1149, 1151), False, 'from reproducemegit.jupyter...
import numpy as np def goal_distance(goal_a, goal_b, distance_threshold=0.05): return np.linalg.norm(goal_a - goal_b, ord=2, axis=-1) def goal_distance_obs(obs, distance_threshold=0.05): return goal_distance( obs["achieved_goal"], obs["desired_goal"], distance_threshold=distance_threshold ) de...
[ "numpy.square", "numpy.linalg.norm" ]
[((92, 139), 'numpy.linalg.norm', 'np.linalg.norm', (['(goal_a - goal_b)'], {'ord': '(2)', 'axis': '(-1)'}), '(goal_a - goal_b, ord=2, axis=-1)\n', (106, 139), True, 'import numpy as np\n'), ((566, 592), 'numpy.square', 'np.square', (['(achieved - goal)'], {}), '(achieved - goal)\n', (575, 592), True, 'import numpy as ...
# Copyright: (c) 2021, <NAME> import sys sys.path.append('../') from __global__ import * import numpy as np import logging import time #import cProfile import modulator.encoders.encoder_base import modulator.modulators.baseLUT #from profilehooks import profile """ For some reason the GRC and the B210 behave unreliabl...
[ "sys.path.append", "numpy.save", "numpy.random.randn", "logging.getLogger", "time.time", "numpy.concatenate" ]
[((42, 64), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (57, 64), False, 'import sys\n'), ((587, 631), 'logging.getLogger', 'logging.getLogger', (["(LOG_NAME + '.' + __name__)"], {}), "(LOG_NAME + '.' + __name__)\n", (604, 631), False, 'import logging\n'), ((2981, 2992), 'time.time', 'time.t...
''' Contains classes for creating simple baseline forecasts These methods might serve as the forecast themselves, but are more likely to be used as a baseline to determine if more complex models are good enough to employ. Naive1: Carry last value forward across forecast horizon (random walk) SNaive: Carry forward val...
[ "scipy.stats.norm.ppf", "pandas.DataFrame", "numpy.full", "numpy.asarray", "numpy.isnan", "numpy.percentile", "numpy.cumsum", "numpy.array", "numpy.arange", "numpy.random.choice", "numpy.sqrt" ]
[((627, 656), 'scipy.stats.norm.ppf', 'norm.ppf', (['(1 - (1 - level) / 2)'], {}), '(1 - (1 - level) / 2)\n', (635, 656), False, 'from scipy.stats import norm\n'), ((15044, 15090), 'numpy.random.choice', 'np.random.choice', (['resid'], {'size': '(boots, horizon)'}), '(resid, size=(boots, horizon))\n', (15060, 15090), T...
import copy import logging import warnings import networkx as nx import numpy as np import tensorflow as tf from deephyper.core.exceptions.nas.space import ( InputShapeOfWrongType, WrongSequenceToSetOperations, ) from deephyper.nas._nx_search_space import NxSearchSpace from deephyper.nas.node import ConstantNo...
[ "copy.deepcopy", "tensorflow.python.keras.utils.vis_utils.model_to_dot", "numpy.random.RandomState", "tensorflow.keras.Model", "tensorflow.keras.backend.is_keras_tensor", "deephyper.core.exceptions.nas.space.InputShapeOfWrongType", "tensorflow.keras.layers.Input", "networkx.algorithms.dag.dag_longest_...
[((470, 497), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (487, 497), False, 'import logging\n'), ((2378, 2405), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (2399, 2405), True, 'import numpy as np\n'), ((4233, 4277), 'networkx.algorithms.dag.dag_lon...
import numpy as np class Ellipse: """ Ellipse class, stores coords and style props. Attributes: x, y: center coords rx, ry: ellipse dimensions fill_color: 3-int tuple representing rgb color stroke_color: 3-int tuple representing rgb color stroke_width: int represen...
[ "numpy.arange" ]
[((3985, 4006), 'numpy.arange', 'np.arange', (['(-rx)', 'rx', '(1)'], {}), '(-rx, rx, 1)\n', (3994, 4006), True, 'import numpy as np\n'), ((4721, 4769), 'numpy.arange', 'np.arange', (['(self.x - self.rx)', '(self.x + self.rx)', '(1)'], {}), '(self.x - self.rx, self.x + self.rx, 1)\n', (4730, 4769), True, 'import numpy ...
import numpy class Moon: def __init__(self, x, y, z): self.p = [x, y, z] self.v = [0, 0, 0] def move(self): p = self.p v = self.v self.p = [p[0]+v[0], p[1]+v[1], p[2]+v[2]] def energy(self): p = self.p v = self.v return (abs(p[0])+abs(p...
[ "numpy.lcm" ]
[((2542, 2569), 'numpy.lcm', 'numpy.lcm', (['Xperiod', 'Yperiod'], {}), '(Xperiod, Yperiod)\n', (2551, 2569), False, 'import numpy\n')]
import numpy as np import json r = np.linspace(0, 1, 101) th = np.linspace(0, np.pi * 2.0, 100, endpoint=True) rr, tth = np.meshgrid(r, th) n = 1.94 mux = -0.08 muy = 0.08 Rmin = np.sqrt(muy * muy + (1.0 - mux)**2.0) Rmax = 10.0 zzeta = (mux + (Rmin * (1.0 - rr) + Rmax * rr) * np.cos(tth)) + \ 1.0j * (muy + (Rmin ...
[ "numpy.meshgrid", "numpy.imag", "numpy.sin", "numpy.cos", "numpy.linspace", "numpy.real", "numpy.sqrt" ]
[((36, 58), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(101)'], {}), '(0, 1, 101)\n', (47, 58), True, 'import numpy as np\n'), ((64, 111), 'numpy.linspace', 'np.linspace', (['(0)', '(np.pi * 2.0)', '(100)'], {'endpoint': '(True)'}), '(0, np.pi * 2.0, 100, endpoint=True)\n', (75, 111), True, 'import numpy as np\n...
import time import numpy as np import numpy.random as nr from common import * from streamlines import * from datoviz import canvas, run, colormap """ def plot_panel(panel, paths): assert paths.ndim == 3 n, l, _ = paths.shape assert _ == 3 length = l * np.ones(n) # length of each path color = n...
[ "datoviz.canvas", "datoviz.run", "numpy.ones", "datoviz.colormap", "numpy.linspace" ]
[((7021, 7042), 'datoviz.canvas', 'canvas', ([], {'show_fps': '(True)'}), '(show_fps=True)\n', (7027, 7042), False, 'from datoviz import canvas, run, colormap\n'), ((7218, 7223), 'datoviz.run', 'run', ([], {}), '()\n', (7221, 7223), False, 'from datoviz import canvas, run, colormap\n'), ((6257, 6313), 'datoviz.colormap...
#!/usr/bin/python """ recall.py: version 0.1.0 History: 2017/06/19: Initial version converted to a class """ # import some useful function import numpy as np import random # Define a class that will handle remembering features and # steering angles to be learn by the model. class Recall: def __init__(self, maxm...
[ "random.random", "numpy.array" ]
[((1197, 1218), 'numpy.array', 'np.array', (['[self.y[i]]'], {}), '([self.y[i]])\n', (1205, 1218), True, 'import numpy as np\n'), ((1107, 1122), 'random.random', 'random.random', ([], {}), '()\n', (1120, 1122), False, 'import random\n')]
import numpy as np def sigmoid(x): return 1.0/(1+ np.exp(-x)) def sigmoid_derivative(x): return x * (1.0 - x) class NeuralNetwork: def __init__(self, x, y): self.input = x self.weights1 = np.random.rand(self.input.shape[1], 6) self.weights2 = np.random.rand(6,1) ...
[ "numpy.zeros", "numpy.array", "numpy.exp", "numpy.random.rand", "numpy.dot" ]
[((1223, 1367), 'numpy.array', 'np.array', (['[[False, True, False], [False, True, True], [True, True, False], [True, \n False, True], [False, True, False], [True, False, False]]'], {}), '([[False, True, False], [False, True, True], [True, True, False], [\n True, False, True], [False, True, False], [True, False, ...
from random import random, randrange, randint, choice import numpy as np from person import Person np.set_printoptions(threshold=np.inf) class Grid: """ Represents the place where people live and contact with each other. Attributes: size - tuple with the length and width of the grid ...
[ "numpy.set_printoptions", "random.randint", "person.Person", "numpy.zeros", "random.choice", "random.random", "random.randrange" ]
[((100, 137), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (119, 137), True, 'import numpy as np\n'), ((11234, 11278), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.size[0], self.size[1])'}), '(shape=(self.size[0], self.size[1]))\n', (11242, 11278), True, 'i...
# Copyright 2021 (c) Aalto University - All Rights Reserved # Author: <NAME> <<EMAIL>> # import abc import igraph import pickle import numpy as np from scipy.spatial import KDTree class Graph: def __init__(self, nodes, edges, edge_weights=None, e_rcvs=None, e_send=None): self.nodes = nodes sel...
[ "numpy.stack", "numpy.load", "numpy.array2string", "igraph.Graph", "numpy.zeros", "numpy.hstack", "pickle.load", "numpy.array", "scipy.spatial.KDTree", "igraph.plot" ]
[((458, 472), 'igraph.Graph', 'igraph.Graph', ([], {}), '()\n', (470, 472), False, 'import igraph\n'), ((1085, 1117), 'numpy.array', 'np.array', (['adj_list'], {'dtype': 'object'}), '(adj_list, dtype=object)\n', (1093, 1117), True, 'import numpy as np\n'), ((1373, 1408), 'igraph.plot', 'igraph.plot', (['self.ig'], {'la...
import numpy as np from finetune.encoding.input_encoder import EncodedOutput from finetune.encoding.target_encoders import ( SequenceLabelingEncoder, ) def test_sequence_label_encoder(): encoder = SequenceLabelingEncoder(pad_token="<PAD>") labels = [{'start': 13, 'end': 17, 'label': 'z', 'text': '(5%)'}] ...
[ "numpy.array", "finetune.encoding.target_encoders.SequenceLabelingEncoder" ]
[((207, 249), 'finetune.encoding.target_encoders.SequenceLabelingEncoder', 'SequenceLabelingEncoder', ([], {'pad_token': '"""<PAD>"""'}), "(pad_token='<PAD>')\n", (230, 249), False, 'from finetune.encoding.target_encoders import SequenceLabelingEncoder\n'), ((920, 962), 'finetune.encoding.target_encoders.SequenceLabeli...
import math import pickle import numpy as np import torch import torch.nn as nn from torch.autograd import Variable class WaveletTransform(nn.Module): def __init__(self, scale=1, dec=True, params_path='wavelet_weights_c2.pkl', transpose=True, groups=1): super(WaveletTransform, self).__init__() ...
[ "numpy.stack", "torch.nn.ConvTranspose2d", "math.pow", "torch.nn.Conv2d", "numpy.zeros", "torch.cat", "torch.Tensor", "torch.max", "numpy.repeat", "pickle.load", "numpy.arange", "torch.abs", "torch.from_numpy" ]
[((450, 473), 'math.pow', 'math.pow', (['(2)', 'self.scale'], {}), '(2, self.scale)\n', (458, 473), False, 'import math\n'), ((556, 671), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'groups', 'out_channels': 'nc', 'kernel_size': 'ks', 'stride': 'ks', 'padding': '(0)', 'groups': 'groups', 'bias': '(False)'}), '...
import numpy as np from .preprocess import preprocess from .postprocess import postprocess from .settings import MwGlobalExp from .deploy_util import demo_postprocess class SubDetector: def __init__(self, exp: MwGlobalExp, backend: str='openvino'): self.inode, self.onode, self.input_shape, self.model = ex...
[ "numpy.expand_dims" ]
[((889, 921), 'numpy.expand_dims', 'np.expand_dims', (['img_feed'], {'axis': '(0)'}), '(img_feed, axis=0)\n', (903, 921), True, 'import numpy as np\n')]
import numpy as np import matplotlib.pyplot as plt rc = {"pdf.fonttype": 42, 'text.usetex': True, 'font.size': 14, 'xtick.labelsize': 12, 'ytick.labelsize': 12, 'text.latex.preview': True} plt.rcParams.update(rc) def f(eps, w): return np.exp(-.5 / eps) * (np.cos(w) + np.sinc(w) /eps) eps_grid = np.logs...
[ "numpy.logspace", "matplotlib.pyplot.figure", "matplotlib.pyplot.rcParams.update", "numpy.sinc", "numpy.exp", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.semilogx", "matplotlib.pyplot.savefig" ]
[((197, 220), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['rc'], {}), '(rc)\n', (216, 220), True, 'import matplotlib.pyplot as plt\n'), ((313, 336), 'numpy.logspace', 'np.logspace', (['(-2)', '(2)', '(100)'], {}), '(-2, 2, 100)\n', (324, 336), True, 'import numpy as np\n'), ((347, 374), 'numpy.linspac...
# Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "unittest.main", "makani.analysis.util.simdata_analysis.statistic.Statistic", "makani.analysis.util.simdata_analysis.bootstrap.bootstrap", "numpy.array" ]
[((1749, 1764), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1762, 1764), False, 'import unittest\n'), ((1012, 1044), 'makani.analysis.util.simdata_analysis.bootstrap.bootstrap', 'bootstrap.bootstrap', (['data', '(10)', '(5)'], {}), '(data, 10, 5)\n', (1031, 1044), False, 'from makani.analysis.util.simdata_anal...
# use 'orthogonal indexing' feature to subselect data over CONUS. import netCDF4 import numpy as np import matplotlib.pyplot as plt # use real data from CFS reanlysis. # note: we're reading GRIB2 data! # URL="http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_flxf/2010/201007/20100701/flxf00.gdas.2010070100.grb2...
[ "netCDF4.Dataset", "numpy.logical_and" ]
[((408, 428), 'netCDF4.Dataset', 'netCDF4.Dataset', (['URL'], {}), '(URL)\n', (423, 428), False, 'import netCDF4\n'), ((533, 567), 'numpy.logical_and', 'np.logical_and', (['(lat > 25)', '(lat < 50)'], {}), '(lat > 25, lat < 50)\n', (547, 567), True, 'import numpy as np\n'), ((575, 611), 'numpy.logical_and', 'np.logical...
from numba import jit from numpy import diag, ones, kron, eye @jit def laplacian_1d(n): return diag(-2 * ones(n - 2)) + \ diag(ones(n - 3), 1) + \ diag(ones(n - 3), -1) @jit def laplacian_2d(n): return kron(eye(n - 2), laplacian_1d(n)) + \ kron(laplacian_1d(n), ey...
[ "numpy.eye", "numpy.ones" ]
[((180, 191), 'numpy.ones', 'ones', (['(n - 3)'], {}), '(n - 3)\n', (184, 191), False, 'from numpy import diag, ones, kron, eye\n'), ((252, 262), 'numpy.eye', 'eye', (['(n - 2)'], {}), '(n - 2)\n', (255, 262), False, 'from numpy import diag, ones, kron, eye\n'), ((318, 328), 'numpy.eye', 'eye', (['(n - 2)'], {}), '(n -...
import pandas as pd import numpy as np from sklearn.model_selection import StratifiedKFold import lightgbm as lgb import config import os def gini(actual, pred): assert (len(actual) == len(pred)) all = np.asarray(np.c_[actual, pred, np.arange(len(actual))], dtype=np.float) all = all[np.lexsort((all[:, 2], ...
[ "lightgbm.train", "pandas.read_csv", "numpy.lexsort", "lightgbm.Dataset", "numpy.zeros", "sklearn.model_selection.StratifiedKFold", "os.path.join" ]
[((1931, 1975), 'pandas.read_csv', 'pd.read_csv', (['"""./data/train.csv"""'], {'index_col': '(0)'}), "('./data/train.csv', index_col=0)\n", (1942, 1975), True, 'import pandas as pd\n'), ((1986, 2029), 'pandas.read_csv', 'pd.read_csv', (['"""./data/test.csv"""'], {'index_col': '(0)'}), "('./data/test.csv', index_col=0)...
from psecas.grids.grid import Grid class LegendreExtremaGrid(Grid): """ This grid uses the Legendre extrema and endpoints grid on z ∈ [zmin, zmax] to discretize the system. This grid is also known as the Gauss-Lobatto grid. Implementation follows Boyd Appendix F.10 on page 572. N: The number of g...
[ "numpy.polynomial.legendre.legfit", "numpy.eye", "numpy.zeros", "numpy.diag_indices", "numpy.errstate", "numpy.polynomial.legendre.legroots", "numpy.array", "numpy.polynomial.legendre.legval", "numpy.dot", "numpy.polynomial.legendre.legder" ]
[((874, 898), 'numpy.zeros', 'np.zeros', (['(N + 1, N + 1)'], {}), '((N + 1, N + 1))\n', (882, 898), True, 'import numpy as np\n'), ((913, 934), 'numpy.polynomial.legendre.legder', 'legder', (['([0] * N + [1])'], {}), '([0] * N + [1])\n', (919, 934), False, 'from numpy.polynomial.legendre import legder, legroots, legva...
import numpy as np import matplotlib.pyplot as plt name010 = "/mnt/hdd02/res-bagnet/synthetic-2d/transfer/stb-resnet50-transfer-pretrained/train.log" name011 = "/mnt/hdd02/res-bagnet/synthetic-2d-bg/transfer/stb-resnet50-transfer-pretrained/train.log" name012 = "/mnt/hdd02/res-bagnet/synthetic/transfer/stb-resnet50-tr...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig" ]
[((1740, 1755), 'numpy.array', 'np.array', (['s2_tr'], {}), '(s2_tr)\n', (1748, 1755), True, 'import numpy as np\n'), ((1764, 1779), 'numpy.array', 'np.array', (['s2_vl'], {}), '(s2_vl)\n', (1772, 1779), True, 'import numpy as np\n'), ((2137, 2153), 'numpy.array', 'np.array', (['s2b_tr'], {}), '(s2b_tr)\n', (2145, 2153...
"""Abstract class for UMCD dataset loader""" import os import numpy as np import torch from PIL import Image, ImageDraw from pycocotools.coco import COCO class UMCDDataset(torch.utils.data.Dataset): """Abstract for UMCD dataset loader. Args :root: The root directory. :transforms: The transform object...
[ "PIL.Image.new", "PIL.Image.open", "pycocotools.coco.COCO", "numpy.array", "torch.as_tensor", "os.path.join", "PIL.ImageDraw.ImageDraw", "torch.tensor" ]
[((515, 530), 'pycocotools.coco.COCO', 'COCO', (['anno_path'], {}), '(anno_path)\n', (519, 530), False, 'from pycocotools.coco import COCO\n'), ((1060, 1104), 'os.path.join', 'os.path.join', (['self.image_dir', 'image_filename'], {}), '(self.image_dir, image_filename)\n', (1072, 1104), False, 'import os\n'), ((2129, 21...
import argparse from tqdm import tqdm import os import cv2 import numpy as np import random from PIL import Image def motion_blur(img): size_list = [9, 11, 13, 15, 17, 19, 21, 23] size = random.choice(size_list) kernel_motion_blur = np.zeros((size, size)) kernel_motion_blur[int((size-1)/2), :] = np.o...
[ "tqdm.tqdm", "argparse.ArgumentParser", "numpy.zeros", "numpy.ones", "random.choice", "numpy.array", "PIL.Image.fromarray", "os.path.join", "os.listdir" ]
[((197, 221), 'random.choice', 'random.choice', (['size_list'], {}), '(size_list)\n', (210, 221), False, 'import random\n'), ((248, 270), 'numpy.zeros', 'np.zeros', (['(size, size)'], {}), '((size, size))\n', (256, 270), True, 'import numpy as np\n'), ((316, 329), 'numpy.ones', 'np.ones', (['size'], {}), '(size)\n', (3...
#!/usr/bin/env python # %% """ Unit tests for skcuda.cublas """ from ctypes import create_string_buffer from unittest import main, makeSuite, TestCase, TestSuite import pycuda.driver as drv import pycuda.gpuarray as gpuarray from pycuda.tools import clear_context_caches, make_default_context import numpy as np import...
[ "numpy.einsum", "numpy.ones", "numpy.complex64", "pycuda.gpuarray.arange", "sys.path.append", "skcuda.cublas.cublasCgemmEx", "skcuda.cublas.cublasCreate", "pycuda.tools.make_default_context", "pycuda.gpuarray.empty", "skcuda.cublas.cublasGemmEx", "numpy.finfo", "skcuda.cublas.cublasCgemmBatche...
[((351, 406), 'sys.path.append', 'sys.path.append', (['"""/home/hongy0a/seismicapp/scikit-cuda"""'], {}), "('/home/hongy0a/seismicapp/scikit-cuda')\n", (366, 406), False, 'import sys\n'), ((408, 418), 'pycuda.driver.init', 'drv.init', ([], {}), '()\n', (416, 418), True, 'import pycuda.driver as drv\n'), ((3796, 3818), ...
# Standard imports from os.path import dirname # Third party imports from teacher.utils import recognize_features_type, set_discrete_continuous, label_encode import pandas as pd import numpy as np MODULE_PATH = dirname(__file__) def generate_dataset(df, columns, class_name, discrete, name): """Generate the dat...
[ "numpy.abs", "teacher.utils.set_discrete_continuous", "pandas.read_csv", "os.path.dirname", "teacher.utils.label_encode", "pandas.to_datetime", "teacher.utils.recognize_features_type" ]
[((214, 231), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (221, 231), False, 'from os.path import dirname\n'), ((1826, 1865), 'teacher.utils.recognize_features_type', 'recognize_features_type', (['df', 'class_name'], {}), '(df, class_name)\n', (1849, 1865), False, 'from teacher.utils import recogn...
import numpy as np import pandas as pd import matplotlib.pyplot as plt #%matplotlib inline import cv2 import shutil import os, random, sys import datetime import csv import glob from sklearn.model_selection import train_test_split # dataset names dataset = glob.glob(f'{TRAINING_DIR}/*/*') print(dataset[11029].split('...
[ "numpy.save", "sklearn.model_selection.train_test_split", "cv2.imread", "numpy.array", "glob.glob", "cv2.resize" ]
[((259, 291), 'glob.glob', 'glob.glob', (['f"""{TRAINING_DIR}/*/*"""'], {}), "(f'{TRAINING_DIR}/*/*')\n", (268, 291), False, 'import glob\n'), ((734, 771), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (750, 771), False, 'from sklearn.mo...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Originally created on Tue Mar 24 12:49:47 2020 @author: mubariz """ from vpr_system import compute_image_descriptors from vpr_system import place_match import cv2 import os import glob import numpy as np def evaluate_vpr_techniques(dataset_dir,precomputed_directory,t...
[ "vpr_system.place_match", "vpr_system.compute_image_descriptors", "numpy.save", "os.makedirs", "os.path.basename", "os.getcwd", "numpy.asarray", "os.path.exists", "cv2.imread", "glob.glob", "cv2.resize" ]
[((847, 866), 'os.path.basename', 'os.path.basename', (['x'], {}), '(x)\n', (863, 866), False, 'import os\n'), ((934, 953), 'os.path.basename', 'os.path.basename', (['x'], {}), '(x)\n', (950, 953), False, 'import os\n'), ((1211, 1243), 'cv2.imread', 'cv2.imread', (['(ref_dir + image_name)'], {}), '(ref_dir + image_name...
# 15/07/2020, <NAME>, Postdoc, Edinburgh # Read in shear data for KiDS-1000 and perform spherical harmonic transform # to get kappa maps. Also do a series of noise realisations to make # signal/noise maps. import sys import numpy as np import healpy as hp from matplotlib import rcParams from astropy.io import fits imp...
[ "numpy.load", "numpy.random.seed", "healpy.sphtfunc.alm2map", "healpy.mollview", "healpy.graticule", "healpy.pixelfunc.ang2pix", "matplotlib.pyplot.figure", "numpy.arange", "healpy.pixelfunc.get_all_neighbours", "healpy.write_map", "numpy.zeros_like", "numpy.copy", "numpy.std", "healpy.que...
[((12317, 12328), 'time.time', 'time.time', ([], {}), '()\n', (12326, 12328), False, 'import time\n'), ((17253, 17276), 'numpy.arange', 'np.arange', (['(140)', '(220)', '(10)'], {}), '(140, 220, 10)\n', (17262, 17276), True, 'import numpy as np\n'), ((17515, 17537), 'numpy.arange', 'np.arange', (['(-20)', '(70)', '(10)...
import sys,os from .Qt import QtWidgets,QtGui,QtCore from . templates import ui_spectrumHistory import pyqtgraph as pg from .fileBrowser import PQG_ImageExporter from . import plot3DTools,fitting from collections import OrderedDict import numpy as np def htmlfy_fit(vals): cols = ['#77cfbb','#b0e0e6','#98fb98','#fa...
[ "pyqtgraph.PlotCurveItem", "os.path.join", "numpy.column_stack", "numpy.zeros", "pyqtgraph.ImageView", "numpy.random.normal", "numpy.linspace", "os.path.expanduser", "pyqtgraph.PlotWidget" ]
[((2076, 2091), 'pyqtgraph.PlotWidget', 'pg.PlotWidget', ([], {}), '()\n', (2089, 2091), True, 'import pyqtgraph as pg\n'), ((2105, 2123), 'pyqtgraph.PlotCurveItem', 'pg.PlotCurveItem', ([], {}), '()\n', (2121, 2123), True, 'import pyqtgraph as pg\n'), ((2421, 2435), 'pyqtgraph.ImageView', 'pg.ImageView', ([], {}), '()...
from __future__ import division import pickle import numpy import time import random def run_tti_sim(model, T, intervention_start_pct_infected=0, average_introductions_per_day=0, testing_cadence='everyday', pct_tested_per_day=1.0, test_falseneg_rate='temporal', testi...
[ "numpy.full", "numpy.sum", "random.randint", "numpy.random.shuffle", "numpy.power", "numpy.argwhere", "numpy.random.poisson", "numpy.random.rand", "numpy.concatenate" ]
[((36617, 36649), 'random.randint', 'random.randint', (['(0)', '(frequency - 1)'], {}), '(0, frequency - 1)\n', (36631, 36649), False, 'import random\n'), ((36487, 36509), 'random.randint', 'random.randint', (['(0)', 'end'], {}), '(0, end)\n', (36501, 36509), False, 'import random\n'), ((3289, 3334), 'numpy.full', 'num...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import os import math import argparse import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from utils import util_data as utils from net.config import RNNConfig, CNNConfig...
[ "tensorflow.train.Coordinator", "numpy.abs", "argparse.ArgumentParser", "tensorflow.trainable_variables", "tensorflow.contrib.slim.initializers.xavier_initializer", "tensorflow.identity", "tensorflow.print", "utils.util_data.get_learning_rate_from_file", "tensorflow.nn.l2_normalize", "tensorflow.r...
[((2193, 2204), 'time.time', 'time.time', ([], {}), '()\n', (2202, 2204), False, 'import time\n'), ((3491, 3503), 'tensorflow.Summary', 'tf.Summary', ([], {}), '()\n', (3501, 3503), True, 'import tensorflow as tf\n'), ((3892, 3903), 'net.config.CNNConfig', 'CNNConfig', ([], {}), '()\n', (3901, 3903), False, 'from net.c...
# -*- coding: utf-8 -*- import copy import numbers import numpy as np from .instrument import save_instrument from .loaders import DcsMslice, Grasp, Ice, Icp, Mad, Neutronpy, Spice def load_data(files, filetype='auto', tols=1e-4, build_hkl=True, load_instrument=False): r"""Loads one or more files and creates a ...
[ "copy.deepcopy", "h5py.File", "pickle.dump", "numpy.savetxt", "datetime.datetime.now" ]
[((4257, 4319), 'numpy.savetxt', 'np.savetxt', (["(filename + '.npy')", 'output'], {'header': 'header'}), "(filename + '.npy', output, header=header, **kwargs)\n", (4267, 4319), True, 'import numpy as np\n'), ((2564, 2596), 'copy.deepcopy', 'copy.deepcopy', (['_data_object_temp'], {}), '(_data_object_temp)\n', (2577, 2...
import numpy as np from scipy.stats import ttest_ind import matplotlib.pyplot as plt from matplotlib.lines import Line2D # helper function to output plot and write summary data def plot_results(results, random_counterpart=None, random_concepts=None, num_random_exp=100, min_p_val=0.05): """Helper ...
[ "matplotlib.pyplot.show", "matplotlib.lines.Line2D", "numpy.std", "scipy.stats.ttest_ind", "numpy.mean", "numpy.arange", "matplotlib.pyplot.subplots" ]
[((4625, 4639), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (4637, 4639), True, 'import matplotlib.pyplot as plt\n'), ((5855, 5865), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5863, 5865), True, 'import matplotlib.pyplot as plt\n'), ((5652, 5729), 'matplotlib.lines.Line2D', 'Line2D', (...