code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
# coding: utf-8
"""
Version 2.1nrt (NEAR REAL TIME IMPLEMENTATION)
Updated: 12/02/2021
Description
-Refactored from version 1 to accommodate calls from near-real-time processor and wrapper script
-__main__ functionality allows it to be run alone in batch over specified date range to generate map... | [
"Temp_linear.extract_predictors",
"pandas.read_csv",
"affine.Affine.translation",
"Temp_linear.get_temperature_date",
"matplotlib.pyplot.figure",
"Temp_linear.extract_temp_input",
"numpy.arange",
"osgeo.gdal.GetDriverByName",
"numpy.round",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.pa... | [((852, 873), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (866, 873), False, 'import matplotlib\n'), ((3398, 3527), 'pyproj.Transformer.from_proj', 'Transformer.from_proj', (['"""EPSG:4326"""', '"""+proj=longlat +datum=WGS84 +no_defs +type=crs"""'], {'always_xy': '(True)', 'skip_equivalent': '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This software is under a BSD license. See LICENSE.txt for details.
# NB: loading all of the bridged modules up front results in a
# pretty huge performance hit (~ 1 second just in importing).
import numpy as np
def __interleaved_rgb_from_planes(red, green, blue):
... | [
"AppKit.NSBitmapImageRep.alloc",
"Quartz.CGImageCreate",
"Quartz.CGDataProviderCreateWithCFData",
"numpy.asarray",
"Quartz.CGRectMake",
"Quartz.CGColorSpaceCreateWithName",
"numpy.zeros",
"datatank_py.DTBitmap2D.DTBitmap2D",
"AppKit.NSGraphicsContext.graphicsContextWithBitmapImageRep_",
"Quartz.CI... | [((332, 347), 'numpy.asarray', 'np.asarray', (['red'], {}), '(red)\n', (342, 347), True, 'import numpy as np\n'), ((360, 377), 'numpy.asarray', 'np.asarray', (['green'], {}), '(green)\n', (370, 377), True, 'import numpy as np\n'), ((389, 405), 'numpy.asarray', 'np.asarray', (['blue'], {}), '(blue)\n', (399, 405), True,... |
from typing import Tuple, Mapping, Any, Callable
import importlib
import functools
import torch as tc
import numpy as np
def get_initializer(
init_spec: Tuple[str, Mapping[str,
Any]]) -> Callable[[tc.Tensor], None]:
"""
Args:
init_spec (Tuple[str, Mapping... | [
"functools.partial",
"importlib.import_module",
"numpy.square",
"numpy.random.normal",
"numpy.eye",
"torch.no_grad",
"torch.tensor"
] | [((790, 830), 'importlib.import_module', 'importlib.import_module', (['"""torch.nn.init"""'], {}), "('torch.nn.init')\n", (813, 830), False, 'import importlib\n'), ((882, 920), 'functools.partial', 'functools.partial', (['initializer'], {}), '(initializer, **args)\n', (899, 920), False, 'import functools\n'), ((1808, 1... |
from pathlib import Path
from bisect import bisect
import re
from collections import defaultdict
from .log import get_logger
from .io import mkdir
def now_str():
"""String representation of the current datetime."""
from datetime import datetime
return datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
def a... | [
"numpy.isnan",
"collections.defaultdict",
"pathlib.Path",
"glob.glob",
"pandas.DataFrame",
"traceback.print_exc",
"sys.stderr.isatty",
"re.escape",
"contextlib.nullcontext",
"datetime.datetime.now",
"IPython.core.ultratb.FormattedTB",
"sys.__excepthook__",
"git.Repo",
"time.sleep",
"bise... | [((555, 568), 'git.Repo', 'Repo', (['repodir'], {}), '(repodir)\n', (559, 568), False, 'from git import Repo\n'), ((581, 625), 'glob.glob', 'glob.glob', (['glob_pattern'], {'recursive': 'recursive'}), '(glob_pattern, recursive=recursive)\n', (590, 625), False, 'import glob\n'), ((2401, 2414), 'pathlib.Path', 'Path', ([... |
import GPy
import numpy as np
# Before running this test, ensure jura_sample.dat and jura_validation.dat,
# downloaded from https://sites.google.com/site/goovaertspierre/pierregoovaertswebsite/download/jura-data are in this folder.
# Run this test from the command line as
# `python3 slfm_experiment.py`
def make_da... | [
"numpy.log",
"numpy.std",
"numpy.zeros",
"numpy.ones",
"numpy.isnan",
"GPy.util.multioutput.LCM",
"numpy.mean",
"numpy.exp",
"GPy.kern.RBF",
"GPy.models.GPCoregionalizedRegression",
"numpy.sqrt"
] | [((335, 353), 'numpy.zeros', 'np.zeros', (['(359, 5)'], {}), '((359, 5))\n', (343, 353), True, 'import numpy as np\n'), ((996, 1014), 'numpy.zeros', 'np.zeros', (['(251, 2)'], {}), '((251, 2))\n', (1004, 1014), True, 'import numpy as np\n'), ((1022, 1035), 'numpy.zeros', 'np.zeros', (['(251)'], {}), '(251)\n', (1030, 1... |
#util.py
from jax import numpy as jnp, jit, custom_jvp, grad
from jax.experimental import optimizers
import jax
import numpy as np
from deltapv import simulator,spline
from scipy.optimize import minimize
import matplotlib.pyplot as plt
import logging
logger = logging.getLogger("deltapv")
Array = jnp.ndarray
f64 = jnp.... | [
"jax.numpy.array",
"numpy.abs",
"jax.numpy.arange",
"jax.numpy.linspace",
"jax.numpy.argmax",
"jax.numpy.abs",
"numpy.append",
"jax.numpy.round",
"deltapv.spline.qinterp",
"jax.numpy.cos",
"jax.numpy.arctan2",
"jax.jacobian",
"jax.value_and_grad",
"numpy.linspace",
"numpy.array",
"jax.... | [((260, 288), 'logging.getLogger', 'logging.getLogger', (['"""deltapv"""'], {}), "('deltapv')\n", (277, 288), False, 'import logging\n'), ((890, 907), 'jax.numpy.arctan2', 'jnp.arctan2', (['x', 'y'], {}), '(x, y)\n', (901, 907), True, 'from jax import numpy as jnp, jit, custom_jvp, grad\n'), ((916, 941), 'jax.numpy.sqr... |
#!/usr/bin/env python
# coding: utf-8
# In[9]:
from sklearn import datasets
import numpy as np
iris = datasets.load_iris()
X = iris.data[:, [2, 3]]
y = iris.target
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
from sklear... | [
"matplotlib.pyplot.xscale",
"sklearn.datasets.load_iris",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"numpy.arange",
... | [((105, 125), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (123, 125), False, 'from sklearn import datasets\n'), ((255, 308), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.3)', 'random_state': '(0)'}), '(X, y, test_size=0.3, random_state=0)\n', (... |
#! /usr/bin/env python
import subprocess
from shutil import copyfile
import numpy as np
import random
from scipy.optimize import minimize
from multiprocessing import Process
import matplotlib.pyplot as plt
DATASET = "ikeda"
TMPD = DATASET + "_tmp"
best=[100]
best_params=None
def get_error(output):
FIND=["Test d... | [
"subprocess.Popen",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.colorbar",
"numpy.linspace",
"shutil.copyfile"
] | [((1413, 1456), 'shutil.copyfile', 'copyfile', (["(DATASET + '.data')", "(TMPD + '.data')"], {}), "(DATASET + '.data', TMPD + '.data')\n", (1421, 1456), False, 'from shutil import copyfile\n'), ((1453, 1496), 'shutil.copyfile', 'copyfile', (["(DATASET + '.test')", "(TMPD + '.test')"], {}), "(DATASET + '.test', TMPD + '... |
"Tests non-array linked functions & subs in a vectorization environment"
import numpy as np
from gpkit import Variable, Model, ConstraintSet, Vectorize
class Vehicle(Model):
"Vehicle model"
def setup(self):
self.a = a = Variable("a")
constraints = [a >= 1]
return constraints
class Syst... | [
"gpkit.Variable",
"numpy.ones",
"gpkit.Vectorize",
"gpkit.ConstraintSet"
] | [((237, 250), 'gpkit.Variable', 'Variable', (['"""a"""'], {}), "('a')\n", (245, 250), False, 'from gpkit import Variable, Model, ConstraintSet, Vectorize\n'), ((640, 653), 'gpkit.Variable', 'Variable', (['"""x"""'], {}), "('x')\n", (648, 653), False, 'from gpkit import Variable, Model, ConstraintSet, Vectorize\n'), ((8... |
import pytest
import numpy as np
from rollo.special_variables import SpecialVariables
poly_dict = {
"name": "triso",
"order": 3,
"min": 1,
"max": 1,
"radius": 4235e-5,
"volume": 10,
"slices": 10,
"height": 10,
}
def test_polynomial_triso_num():
sv = SpecialVariables()
assert s... | [
"rollo.special_variables.SpecialVariables",
"numpy.linspace"
] | [((289, 307), 'rollo.special_variables.SpecialVariables', 'SpecialVariables', ([], {}), '()\n', (305, 307), False, 'from rollo.special_variables import SpecialVariables\n'), ((647, 665), 'rollo.special_variables.SpecialVariables', 'SpecialVariables', ([], {}), '()\n', (663, 665), False, 'from rollo.special_variables im... |
#!/usr/bin/env python3
import numpy as np
FILE='test.txt' # sol: 9*14*9=1134
FILE='input.txt' # sol: 98*94*93=856716
def parse_input(file):
board = []
with open(file, 'r') as f:
for line in f:
line = line.rstrip()
#print(f'{line}')
board.append([int(i) for i in line... | [
"numpy.prod"
] | [((2055, 2067), 'numpy.prod', 'np.prod', (['out'], {}), '(out)\n', (2062, 2067), True, 'import numpy as np\n')] |
from pymatgen.ext.matproj import MPRester
import csv
import numpy as np
import multiprocessing as mp
from tqdm import tqdm
import random
import pickle as pkl
from sklearn.mixture import GaussianMixture
np.random.seed(19)
random.seed(19)
dist = pkl.load(open('dists.pkl','rb'))
dists = []
for d in dist:
for v in d:... | [
"numpy.random.seed",
"csv.writer",
"numpy.random.randn",
"sklearn.mixture.GaussianMixture",
"numpy.random.randint",
"random.seed",
"numpy.linalg.norm",
"numpy.array",
"multiprocessing.Pool",
"pymatgen.ext.matproj.MPRester",
"numpy.random.shuffle"
] | [((203, 221), 'numpy.random.seed', 'np.random.seed', (['(19)'], {}), '(19)\n', (217, 221), True, 'import numpy as np\n'), ((222, 237), 'random.seed', 'random.seed', (['(19)'], {}), '(19)\n', (233, 237), False, 'import random\n'), ((1148, 1174), 'numpy.random.shuffle', 'np.random.shuffle', (['results'], {}), '(results)\... |
from django.core.management.base import BaseCommand
from django.db import connection
import contactnetwork.pdb as pdb
from structure.models import Structure, StructureVectors
from residue.models import Residue
from angles.models import ResidueAngle as Angle
import Bio.PDB
import copy
import freesasa
import io
import ... | [
"contactnetwork.pdb.HSExposure.HSExposureCB",
"contactnetwork.pdb.rotaxis",
"os.remove",
"multiprocessing.Lock",
"multiprocessing.Value",
"numpy.linalg.norm",
"multiprocessing.Queue",
"structure.models.StructureVectors.objects.all",
"django.db.connection.close",
"numpy.set_printoptions",
"traceb... | [((2434, 2468), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (2453, 2468), True, 'import numpy as np\n'), ((2482, 2509), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2499, 2509), False, 'import logging\n'), ((2838, 2845), 'multipro... |
import pandas as pd
import numpy as np
from pandas import Series
def revenue(target, predictions, count, additional_multiplier=1):
predict_sorted = predictions.sort_values(ascending=False)
selected = target[predict_sorted.index][:count]
return additional_multiplier * selected.sum()
def get_mean_and_qua... | [
"pandas.Series",
"numpy.random.RandomState"
] | [((521, 549), 'numpy.random.RandomState', 'np.random.RandomState', (['(12345)'], {}), '(12345)\n', (542, 549), True, 'import numpy as np\n'), ((858, 875), 'pandas.Series', 'pd.Series', (['values'], {}), '(values)\n', (867, 875), True, 'import pandas as pd\n')] |
##############################################
#
# Tests of things that don't work
#
##############################################
import numpy as np
y = np.empty([2])
x = np.append(y, [2, 3])
print(x)
| [
"numpy.empty",
"numpy.append"
] | [((157, 170), 'numpy.empty', 'np.empty', (['[2]'], {}), '([2])\n', (165, 170), True, 'import numpy as np\n'), ((176, 196), 'numpy.append', 'np.append', (['y', '[2, 3]'], {}), '(y, [2, 3])\n', (185, 196), True, 'import numpy as np\n')] |
import numpy as np
import _pickle as pickle
import operator
import os
from scipy.sparse import load_npz, hstack, csr_matrix
from xclib.utils import sparse as sp
import scipy.sparse as sx
import pdb
class ShortlistHandlerBase(object):
"""Base class for ShortlistHandler
- support for partitioned classifier
... | [
"numpy.asarray",
"operator.itemgetter",
"os.path.join"
] | [((4861, 4882), 'numpy.asarray', 'np.asarray', (['shortlist'], {}), '(shortlist)\n', (4871, 4882), True, 'import numpy as np\n'), ((4884, 4907), 'numpy.asarray', 'np.asarray', (['labels_mask'], {}), '(labels_mask)\n', (4894, 4907), True, 'import numpy as np\n'), ((4909, 4925), 'numpy.asarray', 'np.asarray', (['dist'], ... |
"""### Model Developing"""
# Importing Modules
import pandas as pd
import numpy as np
import time
from tqdm import tqdm
import matplotlib
import matplotlib.pyplot as plt
#libraries for preprocessing
from sklearn import preprocessing
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import ... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.r2_score",
"xgboost.XGBRegressor",
"numpy.exp",
"pandas.DataFrame",
"sklearn.preprocessing.LabelEncoder",
"sklearn.ensemble.RandomForestRegressor",
"... | [((1058, 1091), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1081, 1091), False, 'import warnings\n'), ((1116, 1162), 'pandas.read_csv', 'pd.read_csv', (['"""data/vehicles_Manheim_Final.csv"""'], {}), "('data/vehicles_Manheim_Final.csv')\n", (1127, 1162), True, 'import ... |
import numpy as np
import matplotlib.pyplot as plt
w = np.array([0.15, 0.6])
eta = 0.01
print(w, eta)
all_weights = []
energy = []
while (w[0]+w[1]) < 1 and w[0] > 0 and w[1] > 0 :
f_w = - np.log(1 - w[0] - w[1]) - np.log(w[0]) - np.log(w[1])
energy.append(f_w)
all_weights.append(w)
grad =... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"numpy.empty",
"numpy.array",
"numpy.linalg.norm",
"numpy.linalg.inv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((56, 77), 'numpy.array', 'np.array', (['[0.15, 0.6]'], {}), '([0.15, 0.6])\n', (64, 77), True, 'import numpy as np\n'), ((563, 584), 'numpy.array', 'np.array', (['all_weights'], {}), '(all_weights)\n', (571, 584), True, 'import numpy as np\n'), ((586, 638), 'matplotlib.pyplot.plot', 'plt.plot', (['all_weights[:, 0]',... |
import gym
import random
import numpy as np
from collections import defaultdict
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import LinearLocator, FormatStrFormatter, MaxNLocator
#%matplotlib inline
matplotlib.style.use('ggplot')
def get_epsilon(N_s... | [
"gym.make",
"random.randint",
"matplotlib.style.use",
"numpy.argmax",
"numpy.zeros",
"collections.defaultdict",
"numpy.random.choice"
] | [((268, 298), 'matplotlib.style.use', 'matplotlib.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (288, 298), False, 'import matplotlib\n'), ((458, 492), 'random.randint', 'random.randint', (['(0)', '(action_size - 1)'], {}), '(0, action_size - 1)\n', (472, 492), False, 'import random\n'), ((508, 527), 'numpy.argma... |
import math
import numpy as np
from saltfit import Parameter, fit
from scipy import optimize
class FPRing:
"""This is a general class describing a ring. As of now, we will define
a ring to be defined as being described as an ellipse with an Gaussian
profile around the central line
A ring i... | [
"numpy.indices",
"math.exp",
"numpy.exp",
"scipy.optimize.leastsq"
] | [((1773, 1795), 'numpy.indices', 'np.indices', (['data.shape'], {}), '(data.shape)\n', (1783, 1795), True, 'import numpy as np\n'), ((2129, 2170), 'scipy.optimize.leastsq', 'optimize.leastsq', (['erf', 'param'], {'args': '(x, y)'}), '(erf, param, args=(x, y))\n', (2145, 2170), False, 'from scipy import optimize\n'), ((... |
import struct
import numpy as np
from hashlib import sha1
from rdkit.Chem import AllChem
class MHFPEncoder:
"""A class for encoding SMILES and RDKit molecule instances as MHFP fingerprints.
"""
prime = (1 << 61) - 1
max_hash = (1 << 32) - 1
def __init__(self, n_permutations=2048, se... | [
"numpy.minimum",
"numpy.count_nonzero",
"numpy.amin",
"rdkit.Chem.AllChem.MolFromSmiles",
"numpy.remainder",
"hashlib.sha1",
"rdkit.Chem.AllChem.PathToSubmol",
"rdkit.Chem.AllChem.MolToSmiles",
"numpy.zeros",
"rdkit.Chem.AllChem.FindAtomEnvironmentOfRadiusN",
"numpy.random.RandomState",
"numpy... | [((748, 791), 'numpy.zeros', 'np.zeros', (['[n_permutations]'], {'dtype': 'np.uint32'}), '([n_permutations], dtype=np.uint32)\n', (756, 791), True, 'import numpy as np\n'), ((823, 866), 'numpy.zeros', 'np.zeros', (['[n_permutations]'], {'dtype': 'np.uint32'}), '([n_permutations], dtype=np.uint32)\n', (831, 866), True, ... |
#!/usr/bin/env python
import numpy as np
from hdphmm.generate_timeseries import GenARData
from hdphmm.utils import timeseries as ts
import matplotlib.pyplot as plt
T = np.array([[0.995, 0.005], [0.005, 0.995]])
phis = np.array([[[0.5, 0.1], [0.2, -0.3]],
[[0.5, 0.1], [0.2, -0.3]]])[:, np.newaxis, ...]
cov = np.... | [
"hdphmm.utils.timeseries.switch_points",
"matplotlib.pyplot.show",
"numpy.zeros",
"hdphmm.generate_timeseries.GenARData",
"numpy.array",
"numpy.random.choice",
"matplotlib.pyplot.subplots"
] | [((170, 212), 'numpy.array', 'np.array', (['[[0.995, 0.005], [0.005, 0.995]]'], {}), '([[0.995, 0.005], [0.005, 0.995]])\n', (178, 212), True, 'import numpy as np\n'), ((317, 385), 'numpy.array', 'np.array', (['[[[1, 0.005], [0.005, 1]], [[0.01, 0.005], [0.005, 0.02]]]'], {}), '([[[1, 0.005], [0.005, 1]], [[0.01, 0.005... |
from torch.autograd.variable import Variable
import scipy.misc as sm
import scipy.io as si
import sys
import os
import torch
import numpy as np
from torchvision.models import resnet152, alexnet, resnet34
from util.utils import load_data_from_file
resnet = resnet34(pretrained=True)
# resnet = resnet.cuda()
new_classifi... | [
"util.utils.load_data_from_file",
"numpy.vstack",
"torchvision.models.resnet34",
"numpy.concatenate",
"torch.from_numpy"
] | [((257, 282), 'torchvision.models.resnet34', 'resnet34', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (265, 282), False, 'from torchvision.models import resnet152, alexnet, resnet34\n'), ((602, 655), 'util.utils.load_data_from_file', 'load_data_from_file', (['f', '(2)'], {'target_shape': '(256, 256, 3)'}), '(... |
#!/usr/bin/env python3
import sys
import numpy as np
from PIL import Image
def julia(z, c, max_iterations):
"""
Julia set function to be vectorized. Inspired by Mayavi documentation.
"""
# Calculate the divergence over the requested number of iterations.
n = 0
while n < max_iterations and n... | [
"numpy.zeros",
"numpy.abs",
"numpy.vectorize"
] | [((467, 486), 'numpy.vectorize', 'np.vectorize', (['julia'], {}), '(julia)\n', (479, 486), True, 'import numpy as np\n'), ((1238, 1283), 'numpy.zeros', 'np.zeros', (['(width, height)'], {'dtype': 'np.complex64'}), '((width, height), dtype=np.complex64)\n', (1246, 1283), True, 'import numpy as np\n'), ((319, 328), 'nump... |
from __future__ import absolute_import
# -- EXTERN IMPORT -- #
import numpy as np
import keras.backend as K
# -- IMPORT -- #
from .. import __verbose__ as vrb
from ..utils.data import load_image, deprocess_image, visualize_heatmap
from ..utils.interfaces import Method
from ..utils.exceptions import TensorNotValidExce... | [
"keras.backend.gradients",
"numpy.mean",
"keras.backend.mean",
"numpy.sum"
] | [((1140, 1166), 'keras.backend.mean', 'K.mean', (['outputLayer.output'], {}), '(outputLayer.output)\n', (1146, 1166), True, 'import keras.backend as K\n'), ((1716, 1743), 'numpy.sum', 'np.sum', (['gradImg[0]'], {'axis': '(-1)'}), '(gradImg[0], axis=-1)\n', (1722, 1743), True, 'import numpy as np\n'), ((1773, 1789), 'nu... |
from bpy.props import (BoolProperty,
FloatProperty,
StringProperty,
EnumProperty,
)
from bpy_extras.io_utils import (ImportHelper,
ExportHelper,
unpack_list,
... | [
"numpy.asarray",
"numpy.cross",
"bpy.types.TOPBAR_MT_file_export.remove",
"numpy.identity",
"bpy.types.TOPBAR_MT_file_export.append",
"numpy.finfo",
"bpy.utils.unregister_class",
"numpy.linalg.norm",
"bpy.props.StringProperty",
"numpy.asmatrix",
"bpy.ops.object.mode_set",
"numpy.array",
"num... | [((1187, 1238), 'bpy.props.StringProperty', 'StringProperty', ([], {'default': '"""*.amo"""', 'options': "{'HIDDEN'}"}), "(default='*.amo', options={'HIDDEN'})\n", (1201, 1238), False, 'from bpy.props import BoolProperty, FloatProperty, StringProperty, EnumProperty\n'), ((1618, 1674), 'bpy.types.TOPBAR_MT_file_export.a... |
import numpy as np
from copy import deepcopy
class Noble_Gas_Model:
def __init__(self, gas_type):
if ( gas_type == 'Argon' ):
self.model_parameters = {
'r_hop' : 3.1810226927827516,
't_ss' : 0.03365982238611262,
't_sp' : -0.029154833035109226,
... | [
"copy.deepcopy",
"numpy.size",
"numpy.zeros",
"numpy.einsum",
"numpy.linalg.eigh",
"numpy.linalg.norm",
"numpy.array",
"numpy.exp",
"numpy.dot"
] | [((20498, 20542), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [3.0, 4.0, 5.0]]'], {}), '([[0.0, 0.0, 0.0], [3.0, 4.0, 5.0]])\n', (20506, 20542), True, 'import numpy as np\n'), ((3524, 3543), 'copy.deepcopy', 'deepcopy', (['gas_model'], {}), '(gas_model)\n', (3532, 3543), False, 'from copy import deepcopy\n'), ((452... |
from flask import Flask, render_template, request, jsonify, abort
import json
import numpy as np
from sklearn.externals import joblib
with open('app/objects/user_profiles.json', 'r') as f:
USER_PROFILES = json.load(f)
POSTERS = joblib.load('app/objects/posters.pkl.gz')
MODEL = joblib.load('app/objects/fm.pkl.gz')
... | [
"numpy.random.choice",
"json.load",
"flask.Flask",
"flask.jsonify",
"flask.render_template",
"sklearn.externals.joblib.load",
"flask.request.get_json"
] | [((233, 274), 'sklearn.externals.joblib.load', 'joblib.load', (['"""app/objects/posters.pkl.gz"""'], {}), "('app/objects/posters.pkl.gz')\n", (244, 274), False, 'from sklearn.externals import joblib\n'), ((283, 319), 'sklearn.externals.joblib.load', 'joblib.load', (['"""app/objects/fm.pkl.gz"""'], {}), "('app/objects/f... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 16:08:12 2021
Compute validation/test metrics for each model
@author: jpeeples
"""
## Python standard libraries
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import os
from operator import itemgetter
from sklearn.metrics impor... | [
"pandas.DataFrame",
"os.makedirs",
"Demo_Parameters.Parameters",
"numpy.nanstd",
"os.path.exists",
"pickle.load",
"pandas.ExcelWriter",
"numpy.nanmean"
] | [((1604, 1626), 'pickle.load', 'pickle.load', (['temp_file'], {}), '(temp_file)\n', (1615, 1626), False, 'import pickle\n'), ((2763, 2779), 'Demo_Parameters.Parameters', 'Parameters', (['args'], {}), '(args)\n', (2773, 2779), False, 'from Demo_Parameters import Parameters\n'), ((3347, 3412), 'pandas.ExcelWriter', 'pd.E... |
#-*- coding: UTF-8 -*-
"""
# WANGZHE12
"""
import numpy as np
def load_planar_dataset():
np.random.seed(1)
m = 400 # 样本数量
N = int(m / 2) # 每个类别的样本量
D = 2 # 维度数
X = np.zeros((m, D)) # 初始化X
Y = np.zeros((m, 1), dtype='uint8') # 初始化Y
a = 4 # 花儿的最大长度
for j in range(2):
ix = r... | [
"numpy.random.seed",
"numpy.random.randn",
"numpy.zeros",
"numpy.sin",
"numpy.linspace",
"numpy.cos"
] | [((94, 111), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (108, 111), True, 'import numpy as np\n'), ((188, 204), 'numpy.zeros', 'np.zeros', (['(m, D)'], {}), '((m, D))\n', (196, 204), True, 'import numpy as np\n'), ((221, 252), 'numpy.zeros', 'np.zeros', (['(m, 1)'], {'dtype': '"""uint8"""'}), "((m, ... |
# type: ignore
from typing import Dict, List, Optional, Tuple, Union
from shapely.geometry import Polygon
from itertools import product
import numpy as np
from collections import defaultdict
from ..annotation_types import (Label, ObjectAnnotation,
ClassificationAnnotation, Mask, Geometr... | [
"collections.defaultdict",
"numpy.mean",
"numpy.sum",
"itertools.product"
] | [((5057, 5085), 'numpy.mean', 'np.mean', (['solution_agreements'], {}), '(solution_agreements)\n', (5064, 5085), True, 'import numpy as np\n'), ((9314, 9331), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9325, 9331), False, 'from collections import defaultdict\n'), ((9848, 9883), 'itertools.pr... |
import numpy as np
from . basic import solve_L, solve_U
#eps = np.finfo(np.float64).eps
def transform_Householder(x):
# H @ x = [1, 0, 0, ...]
# H = I - beta @ v @ v.T
n = x.shape[0]
v = np.copy(x)
v = v / np.max(np.abs(v))
sigma = v[1:].T @ v[1:]
if sigma == 0:
beta = 0
... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.copy",
"numpy.zeros",
"numpy.hstack",
"numpy.eye",
"numpy.sqrt"
] | [((206, 216), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (213, 216), True, 'import numpy as np\n'), ((674, 688), 'numpy.eye', 'np.eye', (['length'], {}), '(length)\n', (680, 688), True, 'import numpy as np\n'), ((697, 731), 'numpy.hstack', 'np.hstack', (['[[0] * (length - n), v]'], {}), '([[0] * (length - n), v])\n... |
import pyclesperanto_prototype as cle
import numpy as np
def test_label_label_maximum_extension_map_2d():
labels = cle.push(np.asarray([
[1, 1, 2],
[1, 0, 0],
[3, 3, 0]
]))
reference = cle.push(np.asarray([
[0.74535596, 0.74535596, 0],
[0.74535596, 0, 0],
[... | [
"numpy.asarray",
"numpy.allclose",
"pyclesperanto_prototype.pull",
"pyclesperanto_prototype.label_maximum_extension_map"
] | [((360, 399), 'pyclesperanto_prototype.label_maximum_extension_map', 'cle.label_maximum_extension_map', (['labels'], {}), '(labels)\n', (391, 399), True, 'import pyclesperanto_prototype as cle\n'), ((409, 425), 'pyclesperanto_prototype.pull', 'cle.pull', (['result'], {}), '(result)\n', (417, 425), True, 'import pyclesp... |
from __future__ import division
import numpy as np
from astropy import units as u
from astropy.coordinates import Longitude, Latitude, Angle
from sunpy.time import parse_time, julian_day
from sunpy.wcs import convert_hpc_hg, convert_hg_hpc
from sunpy.sun import constants, sun
__author__ = ["<NAME>", "<NAME>", "<NAME... | [
"astropy.coordinates.Longitude",
"sunpy.time.julian_day",
"astropy.units.quantity_input",
"numpy.deg2rad",
"numpy.arcsin",
"numpy.mod",
"sunpy.sun.sun.sunearth_distance",
"numpy.sin",
"numpy.array",
"numpy.round",
"astropy.coordinates.Angle",
"sunpy.time.parse_time",
"astropy.coordinates.Lat... | [((361, 410), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'duration': 'u.s', 'latitude': 'u.degree'}), '(duration=u.s, latitude=u.degree)\n', (377, 410), True, 'from astropy import units as u\n'), ((3095, 3135), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'x': 'u.arcsec', 'y': 'u.arcsec'}), ... |
import os
import librosa
import numpy as np
import yaml
import sys
import pdb
# import config
with open('config.yaml', 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
class SingleFile(object):
def __init__(self, name, path):
self.name = name
self.path = path
def init_all_specs(
... | [
"yaml.load",
"numpy.abs",
"os.path.isdir",
"numpy.floor",
"librosa.load",
"numpy.exp",
"librosa.feature.melspectrogram",
"os.listdir"
] | [((144, 180), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.FullLoader'}), '(f, Loader=yaml.FullLoader)\n', (153, 180), False, 'import yaml\n'), ((844, 868), 'os.listdir', 'os.listdir', (['input_folder'], {}), '(input_folder)\n', (854, 868), False, 'import os\n'), ((2152, 2175), 'librosa.load', 'librosa.load', (['... |
import numpy as np
import json
import os
from scipy.stats import spearmanr as correlation_func_atten
from statsmodels.stats.weightstats import ztest
import math
import cv2
import sys
sys.path.append("models/VQA")
import db as db
from torch.utils.data import Dataset, DataLoader
import torch
import models.attention_refi... | [
"torch.device",
"numpy.prod",
"sys.path.append",
"cv2.imwrite",
"torch.load",
"numpy.max",
"scripts.pytorchgradcam.gradcam.GradCam",
"cv2.resize",
"math.isnan",
"numpy.uint8",
"numpy.average",
"numpy.min",
"os.listdir",
"models.attention_refine.atten_refine_network.uncertainatt_refinedatt_... | [((184, 213), 'sys.path.append', 'sys.path.append', (['"""models/VQA"""'], {}), "('models/VQA')\n", (199, 213), False, 'import sys\n'), ((5829, 5858), 'numpy.average', 'np.average', (['avg_feats'], {'axis': '(0)'}), '(avg_feats, axis=0)\n', (5839, 5858), True, 'import numpy as np\n'), ((9858, 9878), 'torch.device', 'to... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Problem 091
Arrays
Source : https://www.hackerrank.com/challenges/np-arrays/problem
"""
import numpy
def arrays(arr):
return numpy.array(arr, float)[::-1]
arr = input().strip().split(' ')
result = arrays(arr)
print(result)
| [
"numpy.array"
] | [((183, 206), 'numpy.array', 'numpy.array', (['arr', 'float'], {}), '(arr, float)\n', (194, 206), False, 'import numpy\n')] |
""" ``xrview.handlers`` """
import asyncio
import numpy as np
import pandas as pd
from bokeh.document import without_document_lock
from bokeh.models import ColumnDataSource
from pandas.core.indexes.base import InvalidIndexError
from tornado import gen
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
# TO... | [
"bokeh.models.ColumnDataSource",
"numpy.abs",
"numpy.ceil",
"tornado.platform.asyncio.AnyThreadEventLoopPolicy",
"scipy.signal.filtfilt",
"numpy.where",
"pandas.to_datetime",
"pandas.concat",
"scipy.signal.butter"
] | [((521, 547), 'tornado.platform.asyncio.AnyThreadEventLoopPolicy', 'AnyThreadEventLoopPolicy', ([], {}), '()\n', (545, 547), False, 'from tornado.platform.asyncio import AnyThreadEventLoopPolicy\n'), ((708, 730), 'bokeh.models.ColumnDataSource', 'ColumnDataSource', (['data'], {}), '(data)\n', (724, 730), False, 'from b... |
from sklearn.neighbors import NearestNeighbors
import numpy as np
try:
import pynndescent
index = pynndescent.NNDescent(np.random.random((100, 3)), n_jobs=2)
del index
ANN = True
except ImportError:
ANN = False
def knn_query(X, Y, k=1, return_distance=False, use_ANN=False, n_jobs=1):
"""
... | [
"pynndescent.NNDescent",
"numpy.random.random",
"sklearn.neighbors.NearestNeighbors"
] | [((129, 155), 'numpy.random.random', 'np.random.random', (['(100, 3)'], {}), '((100, 3))\n', (145, 155), True, 'import numpy as np\n'), ((964, 1003), 'pynndescent.NNDescent', 'pynndescent.NNDescent', (['X'], {'n_jobs': 'n_jobs'}), '(X, n_jobs=n_jobs)\n', (985, 1003), False, 'import pynndescent\n'), ((1084, 1170), 'skle... |
from sub_units.bayes_model import BayesModel
from scipy.integrate import odeint
import numpy as np
import datetime
from sub_units.utils import ApproxType
class ConvolutionModel(BayesModel):
# add model_type_str to kwargs when instantiating super
def __init__(self,
*args,
opt... | [
"numpy.zeros_like",
"numpy.log",
"scipy.integrate.odeint",
"numpy.array",
"numpy.exp",
"numpy.squeeze"
] | [((2297, 2369), 'scipy.integrate.odeint', 'odeint', (['self._ODE_system', "[params['I_0']]", 'self.t_vals'], {'args': 'param_tuple'}), "(self._ODE_system, [params['I_0']], self.t_vals, args=param_tuple)\n", (2303, 2369), False, 'from scipy.integrate import odeint\n'), ((2475, 2495), 'numpy.array', 'np.array', (['contag... |
import pytest
try:
import dask
except ImportError:
dask = None
import xarray.testing as xrt
import numpy as np
import fpipy.conventions as c
import fpipy.raw as fpr
from fpipy.data import house_raw, house_radiance
rasterio = pytest.importorskip('rasterio')
@pytest.fixture(scope="session")
def rad_ENVI():
... | [
"pytest.importorskip",
"fpipy.data.house_radiance",
"fpipy.raw.raw_to_radiance",
"pytest.fixture",
"fpipy.data.house_raw",
"xarray.testing.assert_allclose",
"xarray.testing.assert_identical",
"numpy.all"
] | [((235, 266), 'pytest.importorskip', 'pytest.importorskip', (['"""rasterio"""'], {}), "('rasterio')\n", (254, 266), False, 'import pytest\n'), ((270, 301), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (284, 301), False, 'import pytest\n'), ((433, 464), 'pytest.fixture', '... |
from config import general_config, umap_config, spec_config
from utils import plot_melspec, pad_zeros, sung_with_female
import pickle as pkl
from BirdSongToolbox.import_data import ImportData
import librosa, librosa.display
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import noisereduce as nr... | [
"numpy.abs",
"numpy.log",
"utils.sung_with_female",
"noisereduce.reduce_noise",
"BirdSongToolbox.import_data.ImportData",
"librosa.feature.melspectrogram",
"librosa.stft"
] | [((1551, 1662), 'BirdSongToolbox.import_data.ImportData', 'ImportData', ([], {'bird_id': "general_config['bird']", 'session': 'rec_days[rec_ind]', 'location': "general_config['data_path']"}), "(bird_id=general_config['bird'], session=rec_days[rec_ind],\n location=general_config['data_path'])\n", (1561, 1662), False,... |
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
from tqdm import tqdm
tf.compat.v1.enable_v2_behavior()
from tf_agents.agents.reinforce import reinforce_agent
from tf_agents.drivers import dynamic_step_driver
from tf_agents.environments import suite_gym
from tf_agents.environments impo... | [
"tensorflow.compat.v1.enable_v2_behavior",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.Input",
"numpy.asarray",
"numpy.zeros",
"tensorflow.keras.Model",
"numpy.array",
"numpy.linalg.norm",
"tf_agents.trajectories.time_step.TimeStep"
] | [((103, 136), 'tensorflow.compat.v1.enable_v2_behavior', 'tf.compat.v1.enable_v2_behavior', ([], {}), '()\n', (134, 136), True, 'import tensorflow as tf\n'), ((1050, 1063), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (1058, 1063), True, 'import numpy as np\n'), ((4452, 4486), 'tensorflow.keras.Input', 'tf.kera... |
import numpy as np
from abc import ABC, abstractmethod
from skimage.draw import circle, rectangle
def circular_mask(shape):
mask = np.zeros(shape, dtype=np.uint8)
rr, cc = circle(shape[0]/2, shape[1]/2, radius=shape[0] / 3, shape=shape)
mask[rr, cc] = 1
return mask
def striped_mask(shape):
... | [
"numpy.zeros",
"numpy.ones",
"skimage.draw.rectangle",
"skimage.draw.circle"
] | [((137, 168), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'np.uint8'}), '(shape, dtype=np.uint8)\n', (145, 168), True, 'import numpy as np\n'), ((182, 250), 'skimage.draw.circle', 'circle', (['(shape[0] / 2)', '(shape[1] / 2)'], {'radius': '(shape[0] / 3)', 'shape': 'shape'}), '(shape[0] / 2, shape[1] / 2, radius=... |
import os
import numpy
import subprocess
import glob
import logging
from pprint import pprint
import inspect
from pathlib import Path
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
MNLI_DATA_PATH = os.getenv("MNLI_PATH", "~/workspace/data/multinli_1.0")
FEVER_DATA_PATH = os.getenv("FEVE... | [
"pandas.DataFrame",
"pickle.dump",
"fire.Fire",
"logging.basicConfig",
"pandas.read_csv",
"utils_forgetting.compute_forgetting",
"os.system",
"models_weak.extract_subset_from_glove",
"numpy.argsort",
"numpy.min",
"numpy.where",
"numpy.array",
"pprint.pprint",
"pathlib.Path",
"os.getenv",... | [((136, 175), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (155, 175), False, 'import logging\n'), ((185, 212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'import logging\n'), ((231, 286), 'os.getenv', 'os.... |
"""
import libraries
"""
import pandas as pd
import numpy as np
import os
"""
input/output paths and
file naming
"""
path = r'C:\Users\<user_name>'
path = input("Give the path for the output csv file if you leave it blank it will go to: C:\\Users")
name = input("Give the name of the output csv file:")
file_loc = in... | [
"pandas.read_csv",
"numpy.select",
"os.path.join"
] | [((406, 427), 'pandas.read_csv', 'pd.read_csv', (['file_loc'], {}), '(file_loc)\n', (417, 427), True, 'import pandas as pd\n'), ((1155, 1202), 'numpy.select', 'np.select', (['conditions', 'choices'], {'default': '"""black"""'}), "(conditions, choices, default='black')\n", (1164, 1202), True, 'import numpy as np\n'), ((... |
#
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# beverageclassifier.py
# This lambda function demonstrates the use of the AWS IoT Greengrass Image Classification
# Connector. It will capture an image using a Raspberry Pi PiCamera, make an
# inference using the IoT Greengrass Image Cl... | [
"os.remove",
"time.time",
"logging.info",
"greengrasssdk.client",
"greengrass_machine_learning_sdk.client",
"numpy.fromstring",
"picamera.PiCamera"
] | [((1026, 1058), 'greengrasssdk.client', 'greengrasssdk.client', (['"""iot-data"""'], {}), "('iot-data')\n", (1046, 1058), False, 'import greengrasssdk\n'), ((1071, 1093), 'greengrass_machine_learning_sdk.client', 'ml.client', (['"""inference"""'], {}), "('inference')\n", (1080, 1093), True, 'import greengrass_machine_l... |
from pathlib import Path
import pandas as pd
import numpy as np
import torch
from tqdm.auto import tqdm
from diskcache import Cache
cache = Cache(".cache")
def npsample_batch(x, y, size=None, sort=True):
"""Sample from numpy arrays along 2nd dim."""
inds = np.random.choice(range(x.shape[1]), size=size, repla... | [
"numpy.stack",
"numpy.log",
"pandas.read_csv",
"torch.cat",
"tqdm.auto.tqdm",
"pathlib.Path",
"numpy.random.randint",
"numpy.diff",
"pandas.concat",
"diskcache.Cache",
"torch.from_numpy"
] | [((142, 157), 'diskcache.Cache', 'Cache', (['""".cache"""'], {}), "('.cache')\n", (147, 157), False, 'from diskcache import Cache\n'), ((3782, 3818), 'pandas.read_csv', 'pd.read_csv', (['infile'], {'parse_dates': '[3]'}), '(infile, parse_dates=[3])\n', (3793, 3818), True, 'import pandas as pd\n'), ((4944, 4981), 'pathl... |
from CHECLabPy.core.io.waveform import WaveformReader, Waveform
from CHECLabPy.utils.mapping import get_clp_mapping_from_tc_mapping, \
get_row_column
import numpy as np
import pandas as pd
import struct
import gzip
class SimtelWaveform(Waveform):
@property
def t_cpu(self):
return self._t_cpu_conta... | [
"gzip.open",
"ctapipe.coordinates.EngineeringCameraFrame",
"struct.unpack",
"numpy.zeros",
"CHECLabPy.utils.mapping.get_row_column",
"target_calib.CameraConfiguration",
"ctapipe.io.SimTelEventSource",
"numpy.arange",
"pandas.to_datetime",
"ctapipe.io.EventSeeker",
"CHECLabPy.utils.mapping.get_cl... | [((1411, 1487), 'ctapipe.io.SimTelEventSource', 'SimTelEventSource', ([], {'input_url': 'path', 'max_events': 'max_events', 'back_seekable': '(True)'}), '(input_url=path, max_events=max_events, back_seekable=True)\n', (1428, 1487), False, 'from ctapipe.io import SimTelEventSource, EventSeeker\n'), ((1532, 1551), 'ctapi... |
import numpy as np
import pickle
import argparse
from sklearn.model_selection import train_test_split
import os
from scipy import interpolate
import argparse
import estimator_pipeline as ep
import data_utils as du
class InterpolateLinear(object):
def __init__(self, samplesStatsMap, model_count=13):
super(I... | [
"estimator_pipeline.load_ichi_test_data",
"os.path.basename",
"estimator_pipeline.ModelTrainer",
"numpy.zeros",
"estimator_pipeline.load_ichi_data",
"numpy.isnan",
"pickle.load",
"estimator_pipeline.ModelTester",
"scipy.interpolate.interp1d",
"data_utils.parse_args"
] | [((2714, 2765), 'estimator_pipeline.load_ichi_data', 'ep.load_ichi_data', ([], {'data_file': '"""ICHI_training_data.p"""'}), "(data_file='ICHI_training_data.p')\n", (2731, 2765), True, 'import estimator_pipeline as ep\n'), ((2921, 2999), 'estimator_pipeline.ModelTrainer', 'ep.ModelTrainer', (['estimator', 'X', 'y', 'X_... |
#!/usr/bin/env python
"""
Copyright (c) 2018 Intel Corporation
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 l... | [
"argparse.ArgumentParser",
"os.walk",
"numpy.argsort",
"os.path.join",
"cv2.cvtColor",
"PIL.ImageDraw.Draw",
"cv2.resize",
"os.path.basename",
"numpy.asarray",
"multiprocessing.Pool",
"openvino.inference_engine.IENetwork.from_ir",
"logging.basicConfig",
"numpy.zeros",
"PIL.Image.open",
"... | [((1724, 1740), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1738, 1740), False, 'from argparse import ArgumentParser\n'), ((3007, 3028), 'PIL.Image.open', 'Image.open', (['imagePath'], {}), '(imagePath)\n', (3017, 3028), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((3475, 3496), 'cv2.im... |
import keras
from keras.models import Model
from keras.layers import Input,Dense, Dropout, Activation, Flatten,Reshape,concatenate,LSTM,Bidirectional, Average
from keras.layers import Conv2D, MaxPooling2D,Conv1D,MaxPooling1D,AveragePooling2D
from keras.layers import Lambda, dot
import tensorflow as tf
#import str... | [
"keras.regularizers.l2",
"keras.layers.dot",
"keras.layers.Activation",
"keras.layers.Dropout",
"tensorflow.device",
"keras.initializers.VarianceScaling",
"keras.layers.Flatten",
"keras.models.Model",
"keras.layers.AveragePooling2D",
"keras.utils.plot_model",
"keras.layers.Dense",
"keras.layer... | [((1408, 1475), 'keras.layers.dot', 'dot', (['[score_first_part, h_t]', '[2, 1]'], {'name': "(name + 'attention_score')"}), "([score_first_part, h_t], [2, 1], name=name + 'attention_score')\n", (1411, 1475), False, 'from keras.layers import Lambda, dot\n'), ((1683, 1760), 'keras.layers.dot', 'dot', (['[hidden_states, a... |
"""
All rights reserved to cnvrg.io
http://www.cnvrg.io
SKTrainer.py
==============================================================================
"""
import os
import pickle
import numpy as np
import pandas as pd
from cnvrg import Experiment
from cnvrg.charts import Bar, MatrixHeatmap, Scatterplot
from sklea... | [
"sklearn.model_selection.cross_validate",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.r2_score",
"sklearn.metrics.mean_absolute_error",
"cnvrg.charts.Bar",
"os.environ.get",
"numpy.exp",
"numpy.linspace",
"cnvrg.Experiment",
"pandas.concat",
"numpy.round",
"sklearn.metrics.mean_squared_... | [((1206, 1218), 'cnvrg.Experiment', 'Experiment', ([], {}), '()\n', (1216, 1218), False, 'from cnvrg import Experiment\n'), ((2226, 2469), 'sklearn.model_selection.cross_validate', 'cross_validate', ([], {'estimator': 'self.__model', 'X': 'self.__x_train', 'y': 'self.__y_train', 'cv': 'self.__cross_val_folds', 'return_... |
"""
State-Space Pade approximation of time delays
Copyright 2016 <NAME>
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 applicabl... | [
"numpy.abs",
"numpy.isnan",
"numpy.imag",
"numpy.arange",
"numpy.diag",
"numpy.linalg.solve",
"numpy.atleast_2d",
"numpy.meshgrid",
"numpy.multiply",
"numpy.transpose",
"numpy.real",
"numpy.divide",
"numpy.conj",
"numpy.ones_like",
"numpy.asarray",
"numpy.hstack",
"numpy.matrix",
"... | [((2272, 2287), 'numpy.array', 'np.array', (['poles'], {}), '(poles)\n', (2280, 2287), True, 'import numpy as np\n'), ((2523, 2535), 'numpy.matrix', 'np.matrix', (['T'], {}), '(T)\n', (2532, 2535), True, 'import numpy as np\n'), ((2752, 2767), 'numpy.ones_like', 'np.ones_like', (['B'], {}), '(B)\n', (2764, 2767), True,... |
import argparse
import datetime
import itertools
import os
import pickle
import gym
import numpy as np
import torch
import tqdm
from torch.utils.tensorboard import SummaryWriter
from sumoProject.SAC.replay_memory import ReplayMemory
from sumoProject.SAC.sac import SAC
import SUMO.sumoGym
parser = argparse.ArgumentPa... | [
"numpy.stack",
"pickle.dump",
"numpy.random.seed",
"gym.make",
"argparse.ArgumentParser",
"sumoProject.SAC.replay_memory.ReplayMemory",
"os.path.join",
"torch.manual_seed",
"tqdm.trange",
"itertools.count",
"sumoProject.SAC.sac.SAC",
"torch.utils.tensorboard.SummaryWriter",
"torch.no_grad",
... | [((301, 370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Soft Actor-Critic Args"""'}), "(description='PyTorch Soft Actor-Critic Args')\n", (324, 370), False, 'import argparse\n'), ((3430, 3459), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {'log_dir': 'logdi... |
"""Basic physics in Sapien.
This script provides an example where an object is sliding down the slope and bouncing on the ground.
The user can modify physical properties, like static and dynamic friction, to see different behaviors.
The default physical properties can be modified through sapien.SceneConfig.
The physic... | [
"transforms3d.euler.euler2quat",
"sapien.core.SceneConfig",
"numpy.arctan2",
"argparse.ArgumentParser",
"numpy.deg2rad",
"pygifsicle.optimize",
"transforms3d.quaternions.axangle2quat",
"numpy.sin",
"numpy.array",
"numpy.cos",
"sapien.utils.viewer.Viewer",
"sapien.core.Engine",
"imageio.mimsa... | [((1597, 1616), 'numpy.array', 'np.array', (['half_size'], {}), '(half_size)\n', (1605, 1616), True, 'import numpy as np\n'), ((2605, 2630), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2628, 2630), False, 'import argparse\n'), ((3761, 3776), 'sapien.core.Engine', 'sapien.Engine', ([], {}), ... |
import numpy as np
import cv2
from scipy import ndimage
from pathlib import Path
from PIL import Image
import numpy as np
""" Steps to prepare the training data (MoNuSeg Challenge data) for the segmentation network
1) Download training and test data from https://monuseg.grand-challenge.org/Data/
2) Unpack train data t... | [
"numpy.pad",
"numpy.maximum",
"numpy.ones",
"scipy.ndimage.binary_closing",
"PIL.Image.open",
"PIL.Image.fromarray",
"pathlib.Path.cwd"
] | [((1269, 1306), 'numpy.ones', 'np.ones', ([], {'shape': '(3, 3)', 'dtype': 'np.uint8'}), '(shape=(3, 3), dtype=np.uint8)\n', (1276, 1306), True, 'import numpy as np\n'), ((2089, 2135), 'scipy.ndimage.binary_closing', 'ndimage.binary_closing', (['border_adapted', 'kernel'], {}), '(border_adapted, kernel)\n', (2111, 2135... |
import perfplot
import numpy
import pyheap
def heap_sort(arg):
x, y = arg
h = pyheap.Heap(size = len(x))
for xi in x:
h.insert(xi)
i = 0
while True:
try:
y[i] = h.extract()
except pyheap.Empty:
break
i += 1
return y
def list_sort(arg):
x, y = arg
y = x[:]
y.sort()
return y
def numpy_sort(ar... | [
"numpy.random.rand",
"numpy.sort",
"numpy.zeros"
] | [((344, 357), 'numpy.sort', 'numpy.sort', (['x'], {}), '(x)\n', (354, 357), False, 'import numpy\n'), ((387, 407), 'numpy.random.rand', 'numpy.random.rand', (['n'], {}), '(n)\n', (404, 407), False, 'import numpy\n'), ((413, 427), 'numpy.zeros', 'numpy.zeros', (['n'], {}), '(n)\n', (424, 427), False, 'import numpy\n')] |
import numpy as np
from ..layers.GATEConv import Deep_GATE_Conv
from ..layers.utils import PositionalEncoding
from ..utils.misc import get_middle_features
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter, Linear, Sequential, Dropout,BatchNorm1d,ModuleList, ReLU
from ... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.ModuleList",
"torch.manual_seed",
"torch.nn.BatchNorm1d",
"torch.cat",
"numpy.arange",
"torch_geometric.utils.dropout_adj",
"torch.arange",
"torch.nn.Linear",
"torch.isnan"
] | [((1428, 1452), 'torch.manual_seed', 'torch.manual_seed', (['(12345)'], {}), '(12345)\n', (1445, 1452), False, 'import torch\n'), ((2365, 2399), 'torch.arange', 'torch.arange', (['(embedding_layers - 1)'], {}), '(embedding_layers - 1)\n', (2377, 2399), False, 'import torch\n'), ((2766, 2787), 'torch.nn.ModuleList', 'Mo... |
from typing import List, Tuple, Union
import numpy as np
from common.exceptionmanager import catch_error_exception
from common.functionutil import is_exist_file
from dataloaders.imagefilereader import ImageFileReader
class ImageDataLoader(object):
@classmethod
def load_1file(cls, filename: str) -> np.ndarr... | [
"common.exceptionmanager.catch_error_exception",
"numpy.concatenate",
"common.functionutil.is_exist_file",
"dataloaders.imagefilereader.ImageFileReader.get_image",
"numpy.arange",
"numpy.array",
"numpy.random.shuffle"
] | [((494, 529), 'dataloaders.imagefilereader.ImageFileReader.get_image', 'ImageFileReader.get_image', (['filename'], {}), '(filename)\n', (519, 529), False, 'from dataloaders.imagefilereader import ImageFileReader\n'), ((1045, 1082), 'dataloaders.imagefilereader.ImageFileReader.get_image', 'ImageFileReader.get_image', ([... |
import numpy as np
from utils.utils import print_verbose
from GPyOpt.methods import BayesianOptimization
from sklearn.metrics.pairwise import cosine_similarity
import utils.constraint as constraint
def cosine_bayes_clustering(data, clustering, constraint_matrix, bayes_iter = 1000, verbose = 0):
"""
Bayesia... | [
"numpy.nanargmin",
"sklearn.metrics.pairwise.cosine_similarity",
"utils.constraint.kta_score",
"GPyOpt.methods.BayesianOptimization",
"numpy.array",
"numpy.sqrt"
] | [((2800, 2879), 'GPyOpt.methods.BayesianOptimization', 'BayesianOptimization', ([], {'f': 'objective_KTA_sparse', 'de_duplication': '(True)', 'domain': 'space'}), '(f=objective_KTA_sparse, de_duplication=True, domain=space)\n', (2820, 2879), False, 'from GPyOpt.methods import BayesianOptimization\n'), ((3096, 3118), 'n... |
from src.environement.TexasHoldemLimit.TexasHoldemState import TexasHoldemState
from ..Agent import Agent
from .TexasHoldemDealer import FullDeckCard
from typing import List, Tuple
import pokercfr
import numpy as np
def formatCards(cards: List[FullDeckCard]) -> str:
return ''.join([str(c) for c in cards])
def run... | [
"numpy.array"
] | [((806, 827), 'numpy.array', 'np.array', (['equilibrium'], {}), '(equilibrium)\n', (814, 827), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# !pytest pygemmes/tests/test_01_Hub.py -v
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import os
import numpy as np
import pygemmes as pgm
from pygemmes import _plots as plots
def groupofvariables(hub):
''' Gives from the hub a dictionnary of all the variables that sh... | [
"pygemmes.Hub",
"pygemmes._plots.Var",
"pygemmes.get_available_solvers",
"pygemmes._plots.phasespace",
"pygemmes._plots.ForEachUnitsGroup",
"pygemmes.get_available_models",
"numpy.linspace"
] | [((659, 724), 'pygemmes.get_available_models', 'pgm.get_available_models', ([], {'returnas': 'dict', 'details': '(False)', 'verb': '(True)'}), '(returnas=dict, details=False, verb=True)\n', (683, 724), True, 'import pygemmes as pgm\n'), ((872, 924), 'pygemmes.get_available_solvers', 'pgm.get_available_solvers', ([], {'... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#django
# - - -
#python
import cv2
from pyModelChecking import *
from pyModelChecking.LTL import *
import os
import numpy as np
from . import ransac
from . import ClassyVirtualReferencePoint as ClassyVirtualReferencePoint
from decimal import Decimal
import... | [
"cv2.GaussianBlur",
"numpy.sum",
"numpy.abs",
"numpy.ones",
"cv2.xfeatures2d.SURF_create",
"numpy.histogram",
"numpy.arange",
"cv2.rectangle",
"numpy.round",
"eyedetector.models.XYPupilFrame.objects.all",
"numpy.multiply",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.dirname",
"eyedetector.mo... | [((452, 477), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (467, 477), False, 'import os\n'), ((1662, 1747), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (["(BASE_DIR + '/haarcascades/haarcascade_frontalface_alt.xml')"], {}), "(BASE_DIR +\n '/haarcascades/haarcascade_frontalface_alt... |
import numpy as np
import torch
import os
import matplotlib.pyplot as plt
from PIL import Image
import cv2
import imageio
from tqdm import tqdm
def weights_init_normal(layer, mean = 0.0, std = 0.02):
layer_name = layer.__class__.__name__
if layer_name in ['Conv2d', 'Linear']:
layer.weight.data.normal_(... | [
"matplotlib.pyplot.show",
"cv2.VideoWriter_fourcc",
"os.path.isdir",
"matplotlib.pyplot.imshow",
"numpy.asarray",
"os.walk",
"imageio.imread",
"PIL.Image.open",
"cv2.imread",
"matplotlib.pyplot.figure",
"os.path.splitext",
"cv2.VideoWriter",
"os.path.join",
"matplotlib.pyplot.savefig"
] | [((435, 448), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (442, 448), False, 'import os\n'), ((1463, 1499), 'os.path.isdir', 'os.path.isdir', (['combined_image_folder'], {}), '(combined_image_folder)\n', (1476, 1499), False, 'import os\n'), ((1535, 1565), 'os.walk', 'os.walk', (['combined_image_folder'], {}), '(c... |
import numpy as np
import matplotlib.pyplot as plt
from acrolib.plotting import get_default_axes3d, plot_reference_frame
from acrobotics.tool_examples import torch, torch2, torch3
def test_torch_model():
fig, ax = get_default_axes3d([-0.10, 0.20], [0, 0.30], [-0.15, 0.15])
plot_reference_frame(ax, torch.tf_... | [
"numpy.eye",
"acrolib.plotting.get_default_axes3d",
"acrolib.plotting.plot_reference_frame"
] | [((222, 278), 'acrolib.plotting.get_default_axes3d', 'get_default_axes3d', (['[-0.1, 0.2]', '[0, 0.3]', '[-0.15, 0.15]'], {}), '([-0.1, 0.2], [0, 0.3], [-0.15, 0.15])\n', (240, 278), False, 'from acrolib.plotting import get_default_axes3d, plot_reference_frame\n'), ((286, 329), 'acrolib.plotting.plot_reference_frame', ... |
import os
import warnings
import cv2
from six import raise_from
import xml.etree.ElementTree as ET
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import tqdm
import pandas as pd
from generators.common import Generator
from generators.pascal import _findNode
CLASS_NAME = {
"u": 0,
... | [
"tensorflow.train.Int64List",
"numpy.empty",
"tensorflow.reshape",
"numpy.clip",
"tensorflow.data.Options",
"tensorflow.train.FloatList",
"tensorflow.io.encode_png",
"os.path.join",
"numpy.pad",
"tensorflow.sparse.to_dense",
"tensorflow.io.decode_png",
"cv2.resize",
"tensorflow.io.gfile.glob... | [((9862, 9907), 'tensorflow.io.parse_single_example', 'tf.io.parse_single_example', (['example', 'features'], {}), '(example, features)\n', (9888, 9907), True, 'import tensorflow as tf\n'), ((10059, 10093), 'tensorflow.io.decode_png', 'tf.io.decode_png', (["example['image']"], {}), "(example['image'])\n", (10075, 10093... |
import unittest
import numpy
import numpy.testing.utils
import cmepy.ode_solver as ode_solver
class OdeSolverTests(unittest.TestCase):
def test_init(self):
def dy_dt(t, y):
return 0.0
solver = ode_solver.Solver(dy_dt, y_0 = 1.0)
assert solver is not None
... | [
"numpy.testing.utils.assert_almost_equal",
"cmepy.ode_solver.Solver",
"numpy.ravel",
"numpy.zeros",
"numpy.ones",
"numpy.shape",
"unittest.run",
"numpy.reshape",
"numpy.linspace",
"unittest.TestLoader"
] | [((3869, 3897), 'unittest.run', 'unittest.run', (['OdeSolverTests'], {}), '(OdeSolverTests)\n', (3881, 3897), False, 'import unittest\n'), ((242, 275), 'cmepy.ode_solver.Solver', 'ode_solver.Solver', (['dy_dt'], {'y_0': '(1.0)'}), '(dy_dt, y_0=1.0)\n', (259, 275), True, 'import cmepy.ode_solver as ode_solver\n'), ((514... |
import numpy as np
import joblib
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.model_selection import train_test_split
from common.util import Util
class FeatureExtractor(object):
LABEL_SEPRATOR = "@@@@"
LABEL_POSITIVE = "P... | [
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.model_selection.train_test_split",
"joblib.dump",
"numpy.array",
"joblib.load",
"sklearn.feature_extraction.text.TfidfTransformer"
] | [((430, 486), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': 'split', 'random_state': '(12)'}), '(x, y, test_size=split, random_state=12)\n', (446, 486), False, 'from sklearn.model_selection import train_test_split\n'), ((596, 684), 'sklearn.feature_extraction.text.CountVecto... |
import numpy as np
import cv2
import time
# Identify pixels above the threshold
# Threshold of RGB > 160 does a nice job of identifying ground pixels only
def color_thresh(img, rgb_thresh=(160, 160, 160), is_above_threshold=True):
# Create an array of zeros same xy size as img, but single channel
color_select... | [
"cv2.warpPerspective",
"numpy.zeros_like",
"numpy.arctan2",
"numpy.int_",
"numpy.ones_like",
"cv2.cvtColor",
"cv2.getPerspectiveTransform",
"numpy.float32",
"time.time",
"numpy.sin",
"numpy.array",
"numpy.cos",
"cv2.inRange",
"numpy.sqrt"
] | [((323, 350), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 0]'], {}), '(img[:, :, 0])\n', (336, 350), True, 'import numpy as np\n'), ((1253, 1292), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2HSV', '(3)'], {}), '(img, cv2.COLOR_RGB2HSV, 3)\n', (1265, 1292), False, 'import cv2\n'), ((1362, 1401), 'numpy... |
import pandas as pd
#import geopandas as gpd
import numpy as np
import os
#from sqlalchemy import create_engine
from scipy import stats
from sklearn.preprocessing import MinMaxScaler
import math
#from shapely import wkt
from datetime import datetime, timedelta, date
import time
from sklearn.ensemble import RandomForest... | [
"pandas.read_csv",
"sklearn.metrics.r2_score",
"sklearn.metrics.mean_absolute_error",
"numpy.sin",
"pandas.DataFrame",
"pyspark.sql.SparkSession.builder.getOrCreate",
"pandas.merge",
"datetime.timedelta",
"requests.get",
"pandas.Timedelta",
"pandas.DateOffset",
"pandas.concat",
"sklearn.metr... | [((591, 625), 'pyspark.sql.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (623, 625), False, 'from pyspark.sql import SparkSession\n'), ((5038, 5063), 'pandas.read_csv', 'pd.read_csv', (['dir'], {'sep': '""";"""'}), "(dir, sep=';')\n", (5049, 5063), True, 'import pandas as pd\n... |
#!/usr/bin/env python
#inverse kinematics stuff
import grip_and_record.inverse_kin
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
Quaternion,
)
from grip_and_record.robot_utils import Orientations
import rospy
import intera_interface
from intera_interface import CHECK_VERSION
from intera_int... | [
"logging.FileHandler",
"intera_interface.RobotEnable",
"intera_interface.RobotParams",
"intera_interface.Limb",
"rospy.signal_shutdown",
"time.sleep",
"rospy.loginfo",
"rospy.on_shutdown",
"rospy.is_shutdown",
"numpy.array",
"rospy.init_node",
"logging.getLogger"
] | [((510, 529), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (527, 529), False, 'import logging\n'), ((581, 627), 'logging.FileHandler', 'logging.FileHandler', (['"""demo_run_experiment.log"""'], {}), "('demo_run_experiment.log')\n", (600, 627), False, 'import logging\n'), ((831, 861), 'intera_interface.Ro... |
#!/usr/bin/env python
import rospy
import cv2
import numpy as np
from nav_msgs.srv import GetMap
from libbehaviors import occupancy_grid_to_maze, brushfire
from astar import pfind_new
def meter_to_cells(arg):
x_m = arg[0]
y_m = arg[1]
resolution = 0.1
corner_x = -8.98
corner_y = -3.68
x_cell ... | [
"libbehaviors.occupancy_grid_to_maze",
"rospy.ServiceProxy",
"rospy.loginfo",
"numpy.amax",
"cv2.flip",
"numpy.array",
"numpy.loadtxt",
"rospy.init_node",
"numpy.reshape",
"rospy.wait_for_service",
"astar.pfind_new",
"libbehaviors.brushfire"
] | [((452, 480), 'rospy.init_node', 'rospy.init_node', (['"""brushfire"""'], {}), "('brushfire')\n", (467, 480), False, 'import rospy\n'), ((508, 551), 'rospy.wait_for_service', 'rospy.wait_for_service', (["(prefix + '/get_map')"], {}), "(prefix + '/get_map')\n", (530, 551), False, 'import rospy\n'), ((762, 891), 'rospy.l... |
"""
Linear algebra utilities
"""
import numpy as np
import scipy.linalg.lapack as lapack
EPS = {
np.float32: np.finfo(np.float32).eps,
np.float64: np.finfo(np.float64).eps
}
def _svd(a, full_matrices, dtype):
"""
Type dependent Lapack routine
"""
if dtype == np.float32:
return lapack... | [
"numpy.finfo",
"scipy.linalg.lapack.sgesvd",
"scipy.linalg.lapack.dgesvd",
"numpy.diag"
] | [((115, 135), 'numpy.finfo', 'np.finfo', (['np.float32'], {}), '(np.float32)\n', (123, 135), True, 'import numpy as np\n'), ((157, 177), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (165, 177), True, 'import numpy as np\n'), ((314, 359), 'scipy.linalg.lapack.sgesvd', 'lapack.sgesvd', (['a'], {'ful... |
import argparse
import pickle
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from nltk.translate.bleu_score import SmoothingFunction
from nltk.translate.bleu_score import sentence_bleu
import re
from tqdm import tqdm
def finding_topK(cosine_sim, topK):
cosine_sim = list(cosine_sim)
... | [
"tqdm.tqdm",
"sklearn.metrics.pairwise.cosine_similarity",
"argparse.ArgumentParser",
"numpy.reshape",
"nltk.translate.bleu_score.SmoothingFunction",
"nltk.translate.bleu_score.sentence_bleu"
] | [((979, 998), 'nltk.translate.bleu_score.SmoothingFunction', 'SmoothingFunction', ([], {}), '()\n', (996, 998), False, 'from nltk.translate.bleu_score import SmoothingFunction\n'), ((2651, 2676), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2674, 2676), False, 'import argparse\n'), ((1013, 1... |
import poker_bot
import time
import numpy as np
import random
import itertools
# runtime of preflop_action
def test_preflop():
positions = ["bb", "sb", "btn", "co", "hj", "lj", "utg2", "utg1", "utg"]
numbers = ['A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2']
bets = [2, 6, 20]
no_limper... | [
"random.randint",
"poker_bot.betting_round_2",
"numpy.std",
"poker_bot.preflop_action",
"time.time",
"itertools.combinations",
"poker_bot.betting_round_1",
"numpy.mean",
"poker_bot.river_action"
] | [((1590, 1604), 'numpy.mean', 'np.mean', (['times'], {}), '(times)\n', (1597, 1604), True, 'import numpy as np\n'), ((1652, 1665), 'numpy.std', 'np.std', (['times'], {}), '(times)\n', (1658, 1665), True, 'import numpy as np\n'), ((4570, 4584), 'numpy.mean', 'np.mean', (['times'], {}), '(times)\n', (4577, 4584), True, '... |
"""PATE-GAN: Generating Synthetic Data with Differential Privacy Guarantees Codebase.
Reference: <NAME>, <NAME>, <NAME>,
"PATE-GAN: Generating Synthetic Data with Differential Privacy Guarantees,"
International Conference on Learning Representations (ICLR), 2019.
Paper link: https://openreview.net/forum?id=S1zk9iRqF... | [
"numpy.random.uniform",
"numpy.zeros",
"numpy.transpose",
"numpy.min",
"numpy.max",
"numpy.reshape",
"numpy.random.normal",
"numpy.matmul",
"numpy.concatenate"
] | [((878, 913), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '[dim, dim]'], {}), '(0, 1, [dim, dim])\n', (895, 913), True, 'import numpy as np\n'), ((1215, 1245), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '[dim]'], {}), '(0, 1, [dim])\n', (1232, 1245), True, 'import numpy as np\n'), ((1... |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import cv2 as cv
import numpy as np
import os
def gftt(imagefile, output, featurecount=25, minquality=0.01, mindist=10):
img = cv.imread(imagefile)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
corners = cv.goodFeaturesToTrack(gray, featurecount, minquality, min... | [
"os.path.abspath",
"cv2.circle",
"numpy.int0",
"argparse.ArgumentParser",
"os.makedirs",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.isdir",
"cv2.imread",
"cv2.goodFeaturesToTrack",
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((180, 200), 'cv2.imread', 'cv.imread', (['imagefile'], {}), '(imagefile)\n', (189, 200), True, 'import cv2 as cv\n'), ((212, 247), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), '(img, cv.COLOR_BGR2GRAY)\n', (223, 247), True, 'import cv2 as cv\n'), ((262, 325), 'cv2.goodFeaturesToTrack', 'cv.goodF... |
from __future__ import division, print_function
import unittest
import numpy as np
from rvseg import dataset
class TestDataset(unittest.TestCase):
def test_generator(self):
self._test_generator(mask='inner')
self._test_generator(mask='outer')
self._test_generator(mask='both')
def tes... | [
"numpy.std",
"numpy.testing.assert_array_equal",
"numpy.mean",
"rvseg.dataset.create_generators"
] | [((828, 926), 'rvseg.dataset.create_generators', 'dataset.create_generators', (['data_dir', 'batch_size'], {'validation_split': 'validation_split', 'mask': 'mask'}), '(data_dir, batch_size, validation_split=\n validation_split, mask=mask)\n', (853, 926), False, 'from rvseg import dataset\n'), ((1669, 1767), 'rvseg.d... |
import itertools, time, pickle, pprint
from pathlib import Path
import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm
import utils
from loader.dataloader import get_dataset, visualize_Dataset
from torch.utils.data import DataLoader
from network import Discr... | [
"pickle.dump",
"pprint.pformat",
"torch.cuda.device_count",
"pathlib.Path",
"numpy.mean",
"loader.dataloader.visualize_Dataset",
"torch.no_grad",
"torch.ones",
"torch.nn.MSELoss",
"torch.nn.BCELoss",
"torch.zeros",
"loader.dataloader.get_dataset",
"time.localtime",
"tqdm.tqdm",
"network.... | [((1364, 1379), 'pathlib.Path', 'Path', (['args.load'], {}), '(args.load)\n', (1368, 1379), False, 'from pathlib import Path\n'), ((2660, 2785), 'model.GD_seadain.Generator', 'Generator', ([], {'luma_size': 'args.input_size', 'chroma_size': '(32)', 'luma_dim': '(1)', 'output_dim': '(2)', 'layers': 'args.layers', 'net_o... |
"""description: tests for importance nets
"""
import pytest
import numpy as np
import tensorflow as tf
from tronn.nets.importance_nets import InputxGrad
from tronn.nets.importance_nets import DeltaFeatureImportanceMapper
from tronn.nets.importance_nets import filter_by_importance
from tronn.util.utils import DataKeys... | [
"numpy.sum",
"numpy.arange",
"tensorflow.test.main",
"numpy.zeros_like",
"numpy.multiply",
"numpy.copy",
"tronn.nets.importance_nets.filter_by_importance",
"numpy.equal",
"numpy.reshape",
"numpy.random.choice",
"numpy.stack",
"pytest.fixture",
"tronn.nets.importance_nets.DeltaFeatureImportan... | [((507, 536), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (521, 536), False, 'import pytest\n'), ((905, 948), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""one_hot_sequence"""'], {}), "('one_hot_sequence')\n", (928, 948), False, 'import pytest\n'), ((7278, 7321... |
'''
单线程瞄准射击代码
'''
from __future__ import absolute_import #绝对引用
from __future__ import division
from __future__ import print_function
import torch
import pyautogui
from input_controllers.native_win32_input_controller import NativeWin32InputController
from win32dll_input import Mouse
import mss
import time
import nump... | [
"opts.opts",
"cv2.putText",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.getTextSize",
"win32dll_input.Mouse",
"time.sleep",
"time.time",
"mss.mss",
"numpy.array",
"pyautogui.move",
"cv2.rectangle",
"cv2.moveWindow",
"cv2.imshow",
"cv2.namedWindow",
"input_controllers.native_win32_inpu... | [((2646, 2674), 'input_controllers.native_win32_input_controller.NativeWin32InputController', 'NativeWin32InputController', ([], {}), '()\n', (2672, 2674), False, 'from input_controllers.native_win32_input_controller import NativeWin32InputController\n'), ((2687, 2694), 'win32dll_input.Mouse', 'Mouse', ([], {}), '()\n'... |
#import sys
from os import listdir
from os.path import isfile, join
import re
import numpy as np
import collections
# full articles
article_path = "../res/full-papers_txt/"
article_names = [f for f in listdir(article_path) if isfile(join(article_path, f))]
article_1 = [re.search(r"#[0-9]+", a) for a in article_names]
... | [
"numpy.setdiff1d",
"re.search",
"collections.Counter",
"os.path.join",
"os.listdir"
] | [((1128, 1163), 'numpy.setdiff1d', 'np.setdiff1d', (['article_2', 'abstract_2'], {}), '(article_2, abstract_2)\n', (1140, 1163), True, 'import numpy as np\n'), ((1179, 1214), 'numpy.setdiff1d', 'np.setdiff1d', (['abstract_2', 'article_2'], {}), '(abstract_2, article_2)\n', (1191, 1214), True, 'import numpy as np\n'), (... |
"""
Use one tone on-resonance and one off-resonance per LO frequency.
"""
import time
import numpy as np
try:
from tqdm import tqdm as progress
except ImportError:
progress = list
from kid_readout.roach import hardware_tools, analog
from kid_readout.measurement import acquire, basic
from kid_readout.equipment... | [
"tqdm.tqdm",
"kid_readout.measurement.acquire.new_nc_file",
"kid_readout.settings.CRYOSTAT.lower",
"kid_readout.roach.analog.HeterodyneMarkII",
"kid_readout.equipment.hardware.Thing",
"kid_readout.equipment.hardware.Hardware",
"time.time",
"kid_readout.roach.hardware_tools.r2_with_mk2",
"numpy.array... | [((662, 720), 'numpy.array', 'np.array', (['[2201.8, 2378.8, 2548.9, 2731.5, 2905.1, 3416.0]'], {}), '([2201.8, 2378.8, 2548.9, 2731.5, 2905.1, 3416.0])\n', (670, 720), True, 'import numpy as np\n'), ((911, 972), 'numpy.linspace', 'np.linspace', (['minimum_MHz', '(minimum_MHz + span_MHz)', 'num_offsets'], {}), '(minimu... |
import tensorflow as tf
import numpy as np
import math
def masked_softmax_cross_entropy(preds, labels, mask):
"""Softmax cross-entropy loss with masking."""
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
... | [
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.argmax",
"tensorflow.reduce_mean",
"math.log",
"tensorflow.cast",
"numpy.where",
"numpy.intersect1d"
] | [((174, 242), 'tensorflow.nn.softmax_cross_entropy_with_logits', 'tf.nn.softmax_cross_entropy_with_logits', ([], {'logits': 'preds', 'labels': 'labels'}), '(logits=preds, labels=labels)\n', (213, 242), True, 'import tensorflow as tf\n'), ((254, 285), 'tensorflow.cast', 'tf.cast', (['mask'], {'dtype': 'tf.float32'}), '(... |
"""Generates Figure6.pdf
To get this, you have to generate test data first,
and also run custom matlab scripts to get the DANCo results first.
0.0. Generate the data
navigate into the ./benchmark_data/ folder and run the data generating script with GNU octave
$ octave gen_benchmark_data.m
0.1. G... | [
"numpy.load",
"cmfsapy.evaluation.mpe.compute_pe",
"matplotlib.pyplot.show",
"cmfsapy.evaluation.mpe.compute_mpe",
"scipy.io.loadmat",
"cmfsapy.evaluation.mpe.compute_p_error",
"numpy.arange",
"numpy.array",
"numpy.round",
"numpy.sqrt",
"matplotlib.pyplot.subplots",
"numpy.nanmean"
] | [((992, 1015), 'numpy.load', 'np.load', (['(load_path + fn)'], {}), '(load_path + fn)\n', (999, 1015), True, 'import numpy as np\n'), ((1403, 1436), 'numpy.load', 'np.load', (['(load_path + corrected_fn)'], {}), '(load_path + corrected_fn)\n', (1410, 1436), True, 'import numpy as np\n'), ((1450, 1468), 'numpy.round', '... |
# -*- coding: utf-8 -*-
"""
Code for aligning images of a given target (Supernova) and plotting the alligned images allong
with a given dataset for teh purpose of creating a short video clip.
Created <NAME>
"""
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import astropy.io.fits a... | [
"matplotlib.pyplot.xlim",
"numpy.nanpercentile",
"matplotlib.pyplot.show",
"numpy.log",
"astroscrappy.detect_cosmics",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.subplot2grid",
"numpy.shape",
"matplotlib.pyplot.figure",
"reproject.reproject_interp",
"numpy.loadtx... | [((892, 913), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (902, 913), False, 'import os\n'), ((1019, 1072), 'numpy.loadtxt', 'np.loadtxt', (['data_to_plot'], {'delimiter': '""","""', 'dtype': 'object'}), "(data_to_plot, delimiter=',', dtype=object)\n", (1029, 1072), True, 'import numpy as np\n'), ... |
from utils_yolo import *
from cfg_yolo import parse_cfg
from region_loss import RegionLoss
from darknet import Darknet
import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Variable
import torch.optim as optim
from torch.autograd import Function
import math
from torchvision... | [
"numpy.load",
"numpy.random.seed",
"skimage.transform.rescale",
"segment.parse_args",
"models.FlowNet2CSS",
"numpy.clip",
"numpy.mean",
"sys.stdout.flush",
"os.path.join",
"torch.nn.functional.pad",
"torch.nn.functional.grid_sample",
"darknet.Darknet",
"torch.load",
"os.path.exists",
"nu... | [((892, 909), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (906, 909), True, 'import numpy as np\n'), ((930, 1272), 'numpy.asarray', 'np.asarray', (['[[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156], [190, 153, \n 153], [153, 153, 153], [250, 170, 30], [220, 220, 0], [107, 142, 35], [... |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import itertools
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import canopy
import canopy.sandbox.datasets
fX = theano.config.floatX
BATCH_SIZE = 256
train, ... | [
"canopy.handlers.call_after_every",
"canopy.handlers.chunk_variables",
"treeano.inits.OrthogonalInit",
"numpy.argmax",
"treeano.nodes.DropoutNode",
"canopy.handlers.batch_pad",
"treeano.nodes.ReferenceNode",
"treeano.nodes.InputNode",
"treeano.nodes.ReLUNode",
"canopy.sandbox.datasets.cifar10",
... | [((334, 367), 'canopy.sandbox.datasets.cifar10', 'canopy.sandbox.datasets.cifar10', ([], {}), '()\n', (365, 367), False, 'import canopy\n'), ((3008, 3040), 'numpy.argmax', 'np.argmax', (['probabilities'], {'axis': '(1)'}), '(probabilities, axis=1)\n', (3017, 3040), True, 'import numpy as np\n'), ((2464, 2507), 'canopy.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 7 14:53:52 2021
@author: ml
"""
import ast
from code.feature_extraction.feature_extractor import FeatureExtractor
from code.util import COLUMN_CONTAINED_EMOJI
import nltk
import numpy as np
import re
class HasMostCommonEmojis(FeatureExtractor):
... | [
"code.util.COLUMN_CONTAINED_EMOJI.format",
"re.findall",
"numpy.array",
"ast.literal_eval",
"nltk.FreqDist",
"re.compile"
] | [((1284, 1303), 'numpy.array', 'np.array', (['inputs[0]'], {}), '(inputs[0])\n', (1292, 1303), True, 'import numpy as np\n'), ((1945, 1970), 'nltk.FreqDist', 'nltk.FreqDist', (['all_emojis'], {}), '(all_emojis)\n', (1958, 1970), False, 'import nltk\n'), ((3473, 3509), 'numpy.array', 'np.array', (['list_of_most_common_e... |
from jbdl.experimental.math import subtract, compute_eccentric_anomaly
from jbdl.experimental import math
from jbdl.experimental import tools
from jbdl.experimental.tools import multiply
from jbdl.experimental.tools import Pet
from jbdl.experimental import qpoases
from jbdl.experimental.qpoases import QProblem
# from j... | [
"jax.lib.xla_bridge.get_backend",
"jbdl.experimental.math.subtract",
"jbdl.experimental.custom_ops.lcp.lcp",
"numpy.array",
"jbdl.experimental.tools.Pet",
"jbdl.experimental.tools.multiply",
"jbdl.experimental.qpoases.QProblem",
"jbdl.experimental.math.compute_eccentric_anomaly"
] | [((811, 826), 'jbdl.experimental.tools.Pet', 'Pet', (['"""Pluto"""', '(5)'], {}), "('Pluto', 5)\n", (814, 826), False, 'from jbdl.experimental.tools import Pet\n'), ((942, 956), 'jbdl.experimental.qpoases.QProblem', 'QProblem', (['(2)', '(1)'], {}), '(2, 1)\n', (950, 956), False, 'from jbdl.experimental.qpoases import ... |
import numpy as np
from muvimaker import main_logger
from .meta_polygon import MetaPolygon
from .base_picture import BasePicture
logger = main_logger.getChild(__name__)
@BasePicture.register_subclass('meta_regular_polygon')
class MetaRegularPolygon(MetaPolygon):
def __init__(self, sound_dictionary, param_info... | [
"numpy.sin",
"numpy.array",
"numpy.cos",
"muvimaker.main_logger.getChild"
] | [((141, 171), 'muvimaker.main_logger.getChild', 'main_logger.getChild', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from muvimaker import main_logger\n'), ((1151, 1194), 'numpy.array', 'np.array', (['([self.meta_length] * self.N_sides)'], {}), '([self.meta_length] * self.N_sides)\n', (1159, 1194), True, 'im... |
import numpy as np
a = np.array([[1,-3,-2],[0,2,4],[0,0,-10]])
print("A :",a)
b = np.array([7,4,12])
c = np.linalg.solve(a,b)
print("C :",c)
| [
"numpy.linalg.solve",
"numpy.array"
] | [((24, 71), 'numpy.array', 'np.array', (['[[1, -3, -2], [0, 2, 4], [0, 0, -10]]'], {}), '([[1, -3, -2], [0, 2, 4], [0, 0, -10]])\n', (32, 71), True, 'import numpy as np\n'), ((84, 104), 'numpy.array', 'np.array', (['[7, 4, 12]'], {}), '([7, 4, 12])\n', (92, 104), True, 'import numpy as np\n'), ((107, 128), 'numpy.linal... |
import math
import numpy as np
# ======================================================================================================================
# Cumulative Inverse Tranforms
# ======================================================================================================================
def stn... | [
"numpy.count_nonzero",
"math.sqrt",
"numpy.asarray",
"numpy.zeros",
"numpy.isnan",
"numpy.percentile",
"numpy.where",
"numpy.exp",
"math.log",
"numpy.sqrt"
] | [((593, 632), 'numpy.where', 'np.where', (['(b > a)', '((c - a) / (b - a))', '(0.0)'], {}), '(b > a, (c - a) / (b - a), 0.0)\n', (601, 632), True, 'import numpy as np\n'), ((1474, 1503), 'numpy.where', 'np.where', (['(x >= 0.0)', '(1.0)', '(-1.0)'], {}), '(x >= 0.0, 1.0, -1.0)\n', (1482, 1503), True, 'import numpy as n... |
'''
@author: Professor
'''
# import RootFinders as R
from numpy import ceil, log2
from math import fabs
# -------------------------------------------
def bisection(f,a,b,tol=1e-9):
fa, fb = f(a), f(b)
N = int( ceil( log2((b-a)/tol ) ) )
x = [] # empty list
for i in range(N):
c = (b+a)/2
x.append(c)
fc... | [
"numpy.log2",
"math.fabs"
] | [((221, 240), 'numpy.log2', 'log2', (['((b - a) / tol)'], {}), '((b - a) / tol)\n', (225, 240), False, 'from numpy import ceil, log2\n'), ((599, 607), 'math.fabs', 'fabs', (['dx'], {}), '(dx)\n', (603, 607), False, 'from math import fabs\n'), ((615, 623), 'math.fabs', 'fabs', (['fx'], {}), '(fx)\n', (619, 623), False, ... |
"""
Image IO
"""
__all__ = ['image_header_info',
'image_clone',
'image_read',
'image_write',
'make_image',
'matrix_to_images',
'images_from_matrix',
'images_to_matrix',
'matrix_from_images',
'from_numpy']
import os
impo... | [
"numpy.sum",
"numpy.empty",
"os.path.exists",
"numpy.zeros",
"numpy.array",
"numpy.eye",
"os.path.expanduser"
] | [((2637, 2651), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (2645, 2651), True, 'import numpy as np\n'), ((5433, 5449), 'numpy.sum', 'np.sum', (['mask_arr'], {}), '(mask_arr)\n', (5439, 5449), True, 'import numpy as np\n'), ((5469, 5503), 'numpy.empty', 'np.empty', (['(num_images, num_voxels)'], {}), '((num_... |
#Incomplete environment
#TODO: This environment is an extension to the balance task in which the robot is
# subjected to uniformly sampled forces at random timesteps.
# This is to ensure the robot is subjected to disturbances during training.
#TODO: This environment provides rewards the AI for balancing the robot
f... | [
"numpy.matrix",
"numpy.asarray",
"numpy.linalg.norm",
"numpy.hstack"
] | [((832, 926), 'numpy.linalg.norm', 'np.linalg.norm', (['[self.goal[0] - self.observation[9], self.goal[1] - self.observation[10]]'], {}), '([self.goal[0] - self.observation[9], self.goal[1] - self.\n observation[10]])\n', (846, 926), True, 'import numpy as np\n'), ((1351, 1403), 'numpy.asarray', 'np.asarray', (['[se... |
import numpy as np
import pytest
import shetar
# =================== Test input paramaters ===================
@pytest.fixture(scope='module', params=[3, 5])
def input_order(request):
return request.param
@pytest.fixture(scope='module', params=[3, 5])
def output_order(request):
return request.param
@pytes... | [
"shetar.translations.ExteriorInteriorTranslation",
"numpy.shape",
"numpy.ndim",
"shetar.bases.DualRadialBase",
"numpy.reshape",
"numpy.linspace",
"shetar.rotations.ColatitudeRotation",
"shetar.bases.RegularBase",
"shetar.bases.DualBase",
"numpy.size",
"shetar.translations.ExteriorCoaxialTranslat... | [((114, 159), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': '[3, 5]'}), "(scope='module', params=[3, 5])\n", (128, 159), False, 'import pytest\n'), ((214, 259), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': '[3, 5]'}), "(scope='module', params=[3, 5])\n", (2... |
"""
functions.py
Author: <NAME>
Email: <EMAIL>
Module contains the functions for processing signals.
"""
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import pandas as pd
from biosppy.signals import tools
def sinewave(amp=1, freq=1, time=10, fs=1000, phi=0, offset=0, plot='no', tarr='no'):
... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"numpy.abs",
"numpy.sum",
"numpy.polyfit",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.acorr",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.xlabel",
"numpy.fft.fft",
"panda... | [((2436, 2462), 'numpy.arange', 'np.arange', (['(0)', 'time', '(1 / fs)'], {}), '(0, time, 1 / fs)\n', (2445, 2462), True, 'import numpy as np\n'), ((5342, 5368), 'numpy.arange', 'np.arange', (['(0)', 'time', '(1 / fs)'], {}), '(0, time, 1 / fs)\n', (5351, 5368), True, 'import numpy as np\n'), ((5371, 5396), 'numpy.ran... |
import sys
sys.path.insert(0, "..")
import numpy as np
import constants as k
import math
def getInverse(x,y,z):
l1 = k.linkLength[0] #5.5
l01= k.linkLength[1] #0
l2 = k.linkLength[2] #~
l3 = k.linkLength[3] #~
r1 = l01
r2 = l2
r3 = l3
z+=l1 #Shift of Origin
#p... | [
"numpy.matrix",
"math.pow",
"math.atan2",
"sys.path.insert",
"numpy.sin",
"numpy.cos"
] | [((11, 35), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (26, 35), False, 'import sys\n'), ((1319, 1384), 'numpy.matrix', 'np.matrix', (['[x, 0, 0, 0]', '[0, y, 0, 0]', '[0, 0, z, 0]', '[0, 0, 0, 1]'], {}), '([x, 0, 0, 0], [0, y, 0, 0], [0, 0, z, 0], [0, 0, 0, 1])\n', (1328, 1384), Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.