code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: UTF-8 -*-
from sympde.topology import Mapping
from sympde.calculus import grad, dot
from sympde.calculus import laplace
from sympde.topology import ScalarFunctionSpace
from sympde.topology import elements_of
from sympde.topology import NormalVector
from sympde.topology import Cube, Derham
from sympde.top... | [
"numpy.meshgrid",
"sympde.topology.elements_of",
"psydac.linalg.utilities.array_to_stencil",
"sympde.calculus.dot",
"psydac.fem.basic.FemField",
"scipy.sparse.linalg.splu",
"sympde.topology.Derham",
"sympde.expr.integral",
"psydac.linalg.iterative_solvers.cg",
"numpy.array",
"numpy.linspace",
... | [((1090, 1115), 'scipy.sparse.linalg.splu', 'sc.sparse.linalg.splu', (['M1'], {}), '(M1)\n', (1111, 1115), True, 'import scipy as sc\n'), ((2471, 2485), 'sympde.topology.Derham', 'Derham', (['domain'], {}), '(domain)\n', (2477, 2485), False, 'from sympde.topology import Cube, Derham\n'), ((2500, 2538), 'sympde.topology... |
#-*- coding:utf-8 -*-
import numpy as np
from constant import input_cnt, output_cnt, RND_MEAN, RND_STD, LEARNING_RATE
class Perceptron:
'''
loss func = square(y - y`)
model param derivative = dL/d(w, b)
dL/dy * dy/dw = 2(y - y`) * x
dL/dy = d(square(y - y`))/dy = 2(y - y`) * d(y - y`)... | [
"numpy.sum",
"numpy.square",
"numpy.zeros",
"numpy.ones",
"numpy.mean",
"numpy.matmul",
"numpy.random.normal",
"numpy.prod"
] | [((767, 827), 'numpy.random.normal', 'np.random.normal', (['RND_MEAN', 'RND_STD', '[input_cnt, output_cnt]'], {}), '(RND_MEAN, RND_STD, [input_cnt, output_cnt])\n', (783, 827), True, 'import numpy as np\n'), ((847, 869), 'numpy.zeros', 'np.zeros', (['[output_cnt]'], {}), '([output_cnt])\n', (855, 869), True, 'import nu... |
#!/usr/bin/env python
import os
import platform
import numpy as np
from numpy import random as rd
class Class_Script:
@staticmethod
def Say_Hi():
try:
message = f'Hi from {Class_Script.Say_Hi.__name__} in {Class_Script.__name__}'
return message
except Exception:
... | [
"os.getcwd",
"numpy.random.randint",
"numpy.array",
"platform.uname"
] | [((457, 468), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (466, 468), False, 'import os\n'), ((667, 683), 'platform.uname', 'platform.uname', ([], {}), '()\n', (681, 683), False, 'import platform\n'), ((1016, 1033), 'numpy.random.randint', 'rd.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (1026, 1033), True, 'from nump... |
import numpy as np
import matplotlib.pyplot as plt
def travelwave_solve(mx, mt, L, T, h_sb, u_I, v_I, output='plot'):
'''
Solver for 1D wave equation with variable wave speed
using finite difference method (especially to solve the motion
of a tsunami in the open ocean)
param mx: ... | [
"numpy.full",
"matplotlib.pyplot.show",
"numpy.ceil",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.tight_layout"
] | [((1785, 1810), 'numpy.linspace', 'np.linspace', (['(0)', 'L', '(mx + 1)'], {}), '(0, L, mx + 1)\n', (1796, 1810), True, 'import numpy as np\n'), ((1844, 1869), 'numpy.linspace', 'np.linspace', (['(0)', 'T', '(mt + 1)'], {}), '(0, T, mt + 1)\n', (1855, 1869), True, 'import numpy as np\n'), ((3166, 3182), 'numpy.zeros',... |
# Homework from week 8
# a programme that displays a plot of the functions f(x)=x, g(x)=x2 and h(x)=x3 in the range [0, 4] on the one set of axes
import numpy as np
# import numpy
import matplotlib.pyplot as plt
# import matplotlib
x = np.arange(0.0, 4.0, 0.05)
# define x as a list and decided to use 0.05 as interva... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((239, 264), 'numpy.arange', 'np.arange', (['(0.0)', '(4.0)', '(0.05)'], {}), '(0.0, 4.0, 0.05)\n', (248, 264), True, 'import numpy as np\n'), ((440, 471), 'matplotlib.pyplot.plot', 'plt.plot', (['f', 'f', '"""g."""'], {'label': '"""x"""'}), "(f, f, 'g.', label='x')\n", (448, 471), True, 'import matplotlib.pyplot as p... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 00:11:49 2020
@author: arslan
"""
from pyit2fls import IT2Mamdani, IT2FS_Gaussian_UncertStd, IT2FS_plot, \
min_t_norm, max_s_norm, crisp
from numpy import linspace, meshgrid, zeros
from mpl_toolkits import mplot3d
import mat... | [
"numpy.meshgrid",
"matplotlib.pyplot.show",
"pyit2fls.crisp",
"pyit2fls.IT2Mamdani",
"matplotlib.pyplot.figure",
"matplotlib.ticker.LinearLocator",
"matplotlib.ticker.FormatStrFormatter",
"pyit2fls.IT2FS_plot",
"numpy.linspace",
"pyit2fls.IT2FS_Gaussian_UncertStd"
] | [((491, 514), 'numpy.linspace', 'linspace', (['(1.0)', '(2.0)', '(100)'], {}), '(1.0, 2.0, 100)\n', (499, 514), False, 'from numpy import linspace, meshgrid, zeros\n'), ((572, 595), 'numpy.linspace', 'linspace', (['(2.0)', '(3.0)', '(100)'], {}), '(2.0, 3.0, 100)\n', (580, 595), False, 'from numpy import linspace, mesh... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | [
"numpy.power",
"numpy.log10"
] | [((1582, 1606), 'numpy.power', 'power', (['(10.0)', '(mag - 4.185)'], {}), '(10.0, mag - 4.185)\n', (1587, 1606), False, 'from numpy import power, log10\n'), ((3188, 3212), 'numpy.power', 'power', (['(10.0)', '(mag - 3.995)'], {}), '(10.0, mag - 3.995)\n', (3193, 3212), False, 'from numpy import power, log10\n'), ((172... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import bases
from ..utils import PanoUpsampleW
''' Dense (per-pixel) depth estimation '''
class DepthBase(nn.Module):
def __init__(self):
super(DepthBase, self).__init__()
def infer(self, x_emb):
de... | [
"torch.nn.Parameter",
"torch.nn.UpsamplingBilinear2d",
"torch.nn.ReLU",
"torch.where",
"torch.nn.Conv1d",
"torch.nn.BatchNorm1d",
"torch.nn.functional.mse_loss",
"torch.nn.functional.l1_loss",
"torch.full",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.einsum",
"torch.max",
"torch.no_g... | [((1312, 1343), 'torch.nn.functional.l1_loss', 'F.l1_loss', (['pred[mask]', 'gt[mask]'], {}), '(pred[mask], gt[mask])\n', (1321, 1343), True, 'import torch.nn.functional as F\n'), ((1382, 1414), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['pred[mask]', 'gt[mask]'], {}), '(pred[mask], gt[mask])\n', (1392, 1414), Tru... |
from biocrnpyler import *
import numpy as np
#Parameters
kb, ku, ktx, ktl, kdeg = 200, 10, 2.0, 50.0, 1.5
#(mechanism.name, part_id, param_name)
parameters = {"kb":kb, "ku":ku, "ktx":ktx, "ktl":ktl, "kdeg":kdeg,
"cooperativity":4,
('translation_mm', 'BCD', 'ku'):ku, ('translation_mm', 'BCD',... | [
"pylab.show",
"pylab.plot",
"numpy.arange",
"pylab.figure",
"pylab.legend"
] | [((1602, 1624), 'numpy.arange', 'np.arange', (['(0)', '(20)', '(0.01)'], {}), '(0, 20, 0.01)\n', (1611, 1624), True, 'import numpy as np\n'), ((2335, 2347), 'pylab.figure', 'plt.figure', ([], {}), '()\n', (2345, 2347), True, 'import pylab as plt\n'), ((2348, 2425), 'pylab.plot', 'plt.plot', (['time', "R_const['protein_... |
import numpy as np
from rlkit.envs.ant_multitask_base import MultitaskAntEnv
from . import register_env
# Copy task structure from https://github.com/jonasrothfuss/ProMP/blob/master/meta_policy_search/envs/mujoco_envs/ant_rand_goal.py
@register_env("ant-vel")
class AntVelEnv(MultitaskAntEnv):
# Note that goal he... | [
"numpy.random.uniform",
"numpy.random.seed",
"numpy.abs",
"numpy.square",
"numpy.isfinite",
"numpy.clip",
"numpy.array"
] | [((445, 462), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (459, 462), True, 'import numpy as np\n'), ((2322, 2363), 'numpy.random.uniform', 'np.random.uniform', (['(0.0)', '(3.0)', '(num_tasks,)'], {}), '(0.0, 3.0, (num_tasks,))\n', (2339, 2363), True, 'import numpy as np\n'), ((3173, 3198), 'numpy.a... |
#!/usr/bin/python3
"""
probability distributions.
"""
import sys
import numpy as np
import scipy as sp
from scipy.stats import binom
def main(args):
n = 17
dist = binom(n, .765)
print("Mean =", dist.mean())
print("Var =", dist.var())
print("Std =", dist.std())
x = np.array([0,1,2,3,4,5,6]... | [
"numpy.array",
"scipy.stats.binom"
] | [((176, 191), 'scipy.stats.binom', 'binom', (['n', '(0.765)'], {}), '(n, 0.765)\n', (181, 191), False, 'from scipy.stats import binom\n'), ((296, 327), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6]'], {}), '([0, 1, 2, 3, 4, 5, 6])\n', (304, 327), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-0.x/blob/master/LICENSE
import codecs
import json
import numpy
import awkward0.array.base
import awkward0.array.chunked
import awkward0.array.indexed
import awkward0.array.jagged
import awkward0.array.masked
import awkward0.arra... | [
"pyarrow.RecordBatch.from_arrays",
"pyarrow.py_buffer",
"pyarrow.Table.from_batches",
"codecs.lookup",
"numpy.dtype",
"json.dumps",
"pyarrow.large_string",
"pyarrow.bool_",
"pyarrow.binary",
"pyarrow.array",
"pyarrow.large_binary",
"pyarrow.parquet.ParquetWriter",
"pyarrow.parquet.ParquetFil... | [((8399, 8434), 'pyarrow.Table.from_batches', 'pyarrow.Table.from_batches', (['batches'], {}), '(batches)\n', (8425, 8434), False, 'import pyarrow\n'), ((21302, 21342), 'pyarrow.parquet.ParquetWriter', 'pyarrow.parquet.ParquetWriter', ([], {}), '(**options)\n', (21331, 21342), False, 'import pyarrow\n'), ((23172, 23276... |
import numpy as np
from sklearn.decomposition import PCA, FactorAnalysis
from sklearn.manifold import TSNE, SpectralEmbedding
import matplotlib.pyplot as plt
loc_emb_file = 'experiments/randomtests/t_sse_del_2020-06-26_0/models/user_embedding.npy'
u_emb = np.load(loc_emb_file)
print('User embedding size:', str(u_emb.... | [
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"sklearn.manifold.TSNE"
] | [((258, 279), 'numpy.load', 'np.load', (['loc_emb_file'], {}), '(loc_emb_file)\n', (265, 279), True, 'import numpy as np\n'), ((444, 510), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)', 'init': '"""random"""', 'random_state': '(0)', 'perplexity': '(50)'}), "(n_components=2, init='random', random_state=0,... |
from moviepy import editor as med
import numpy as np
import cv2
from scipy.io import wavfile
import imageio
import subprocess
from librosa.output import write_wav
class AudioSignal:
def __init__(self, data, sample_rate):
self._data = np.copy(data)
self._sample_rate = sample_rate
@staticmethod... | [
"numpy.abs",
"numpy.concatenate",
"numpy.copy",
"numpy.resize",
"moviepy.editor.VideoFileClip",
"cv2.cvtColor",
"moviepy.editor.ImageClip",
"numpy.iinfo",
"scipy.io.wavfile.read",
"numpy.split",
"numpy.array",
"moviepy.editor.concatenate_videoclips",
"imageio.get_reader",
"imageio.get_writ... | [((9281, 9332), 'moviepy.editor.concatenate_videoclips', 'med.concatenate_videoclips', (['clips'], {'method': '"""compose"""'}), "(clips, method='compose')\n", (9307, 9332), True, 'from moviepy import editor as med\n'), ((9475, 9489), 'numpy.array', 'np.array', (['imgs'], {}), '(imgs)\n', (9483, 9489), True, 'import nu... |
import numpy as np
import pytest
from numba import jit
from scipy.stats import norm
from respy.conditional_draws import kalman_update
@jit(nopython=True)
def numpy_array_qr(arr):
"""QR decomposition for each matrix in a 3d array."""
out = np.zeros_like(arr)
nind = len(arr)
for i in range(nind):
... | [
"numpy.tril_indices",
"numpy.random.uniform",
"numpy.zeros_like",
"numpy.random.seed",
"numpy.eye",
"numpy.abs",
"numpy.argmax",
"numpy.linalg.qr",
"numpy.zeros",
"numpy.transpose",
"respy.conditional_draws.kalman_update",
"numba.jit",
"numpy.random.normal",
"numpy.dot",
"numpy.testing.a... | [((138, 156), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (141, 156), False, 'from numba import jit\n'), ((250, 268), 'numpy.zeros_like', 'np.zeros_like', (['arr'], {}), '(arr)\n', (263, 268), True, 'import numpy as np\n'), ((1529, 1553), 'numpy.dot', 'np.dot', (['states', 'loadings'], {}), '... |
import json
import pickle
import random
from collections import Counter, defaultdict
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples
from Levenshtein import distanc... | [
"pandas.DataFrame",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.cluster.KMeans",
"Levenshtein.distance",
"numpy.argsort",
"numpy.argwhere",
"pandas.concat"
] | [((572, 602), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'skill_nums'}), '(index=skill_nums)\n', (584, 602), True, 'import pandas as pd\n'), ((2035, 2072), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': 'k', 'random_state': '(42)'}), '(n_clusters=k, random_state=42)\n', (2041, 2072), False, 'from sklea... |
"""
Licensed Materials - Property of IBM
Restricted Materials of IBM
20190891
© Copyright IBM Corp. 2021 All Rights Reserved.
"""
import logging
import numpy as np
from ibmfl.data.data_handler import DataHandler
from ibmfl.util.datasets import load_mnist
logger = logging.getLogger(__name__)
class MnistPytorchDataHan... | [
"ibmfl.util.datasets.load_mnist",
"numpy.load",
"logging.getLogger"
] | [((265, 292), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (282, 292), False, 'import logging\n'), ((1792, 1804), 'ibmfl.util.datasets.load_mnist', 'load_mnist', ([], {}), '()\n', (1802, 1804), False, 'from ibmfl.util.datasets import load_mnist\n'), ((2109, 2132), 'numpy.load', 'np.load... |
# from meshStats import readMeshStats
import sys
import os
import numpy as np
import math
import scipy.integrate as integrate
# from scipy import integrate as I
import matplotlib.pyplot as plt
import os
from printInflow import printInflowSurface
def readMeshStats():
# Run check mesh, dump output in to a log file.
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"numpy.cross",
"os.system",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"scipy.integrate.trapezoid",
"printInflow.printInflowSurface",
"numpy.sqrt"
] | [((323, 361), 'os.system', 'os.system', (['"""checkMesh > log.checkMesh"""'], {}), "('checkMesh > log.checkMesh')\n", (332, 361), False, 'import os\n'), ((963, 992), 'os.system', 'os.system', (['"""rm log.checkMesh"""'], {}), "('rm log.checkMesh')\n", (972, 992), False, 'import os\n'), ((6977, 6999), 'numpy.array', 'np... |
#!/usr/bin/env python3
import itertools
from typing import Optional, Union
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, clone
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler, PolynomialFeatures, StandardScaler
from sklearn.utils.validation import ... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.MinMaxScaler",
"numpy.ones",
"numpy.isnan",
"numpy.arange",
"datafold.pcfold.timeseries.collection.TSCException.not_const_delta_time",
"sklearn.base.clone",
"sklearn.utils.validation.check_scalar",
"pandas.DataFrame",
"numpy.append",
... | [((3287, 3339), 'sklearn.base.clone', 'clone', ([], {'estimator': 'self.sklearn_transformer', 'safe': '(True)'}), '(estimator=self.sklearn_transformer, safe=True)\n', (3292, 3339), False, 'from sklearn.base import BaseEstimator, clone\n'), ((3897, 3946), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', ([... |
"""LMM testing code"""
import unittest
import scipy as SP
import numpy as np
import sys
from limix.core.covar import FreeFormCov
from limix.utils.check_grad import mcheck_grad
class TestFreeForm(unittest.TestCase):
def setUp(self):
SP.random.seed(1)
self.n=4
self.C = FreeFormCov(self.n)
... | [
"unittest.main",
"scipy.randn",
"numpy.testing.assert_almost_equal",
"limix.utils.check_grad.mcheck_grad",
"scipy.random.seed",
"numpy.array",
"limix.core.covar.FreeFormCov"
] | [((1655, 1670), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1668, 1670), False, 'import unittest\n'), ((245, 262), 'scipy.random.seed', 'SP.random.seed', (['(1)'], {}), '(1)\n', (259, 262), True, 'import scipy as SP\n'), ((297, 316), 'limix.core.covar.FreeFormCov', 'FreeFormCov', (['self.n'], {}), '(self.n)\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of sierras (https://github.com/fernandezfran/sierras/).
# Copyright (c) 2021, <NAME>
# License: MIT
# Full Text: https://github.com/fernandezfran/sierras/blob/master/LICENSE
# ==========================================================================... | [
"pandas.testing.assert_frame_equal",
"numpy.log",
"numpy.testing.assert_almost_equal",
"os.path.dirname",
"numpy.array",
"matplotlib.testing.decorators.check_figures_equal"
] | [((12526, 12583), 'matplotlib.testing.decorators.check_figures_equal', 'check_figures_equal', ([], {'extensions': "['png', 'pdf']", 'tol': '(0.005)'}), "(extensions=['png', 'pdf'], tol=0.005)\n", (12545, 12583), False, 'from matplotlib.testing.decorators import check_figures_equal\n'), ((3823, 3897), 'numpy.testing.ass... |
import tensorflow as tf
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Conv2D, MaxPooling2D, Reshape,\
BatchNormalization, LeakyReLU, Dropout
from keras.models import load_model
from keras.models import model_from_json
from keras.callbacks import History, ModelCheckpoi... | [
"keras.models.load_model",
"keras.optimizers.Adadelta",
"tensorflow.reshape",
"keras.optimizers.Adagrad",
"keras.models.Model",
"tensorflow.Variable",
"keras.layers.Input",
"keras.layers.Reshape",
"tensorflow.sqrt",
"keras.initializers.RandomNormal",
"keras.optimizers.Adamax",
"keras.optimizer... | [((548, 560), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (558, 560), True, 'import tensorflow as tf\n'), ((561, 580), 'keras.backend.set_session', 'K.set_session', (['sess'], {}), '(sess)\n', (574, 580), True, 'from keras import backend as K\n'), ((1633, 1642), 'keras.callbacks.History', 'History', ([], {}),... |
import pickle
import numpy as np
from collections import defaultdict
def save_pickle(obj, FILEPATH):
f = open(FILEPATH, 'wb')
pickle.dump(obj, f)
f.close()
def open_pickle(FILEPATH):
f = open(FILEPATH, 'rb')
obj = pickle.load(f)
f.close()
return obj
def save_arrays(FILEPATH, exp_num, orde... | [
"numpy.mean",
"collections.defaultdict",
"pickle.dump",
"pickle.load"
] | [((135, 154), 'pickle.dump', 'pickle.dump', (['obj', 'f'], {}), '(obj, f)\n', (146, 154), False, 'import pickle\n'), ((236, 250), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (247, 250), False, 'import pickle\n'), ((683, 701), 'numpy.mean', 'np.mean', (['X_metrics'], {}), '(X_metrics)\n', (690, 701), True, 'impo... |
# T-Test Assignment
import numpy as np
"""
1.Certain refined edible oil is packed in tins holding 16 kg each. The filling machine can maintain this but with a standard deviation of 0.5 kg. Samples of 25 are taken from the production line. If a sample means is (i)16.35kg (ii)15.8kg, Can we be 95 percent sure that the ... | [
"scipy.stats.ttest_1samp",
"scipy.stats.ttest_ind",
"numpy.array",
"scipy.stats.t.ppf",
"numpy.sqrt"
] | [((568, 595), 'scipy.stats.t.ppf', 't.ppf', ([], {'q': '(0.05 / 2)', 'df': '(n - 1)'}), '(q=0.05 / 2, df=n - 1)\n', (573, 595), False, 'from scipy.stats import t\n'), ((911, 938), 'scipy.stats.t.ppf', 't.ppf', ([], {'q': '(0.05 / 2)', 'df': '(n - 1)'}), '(q=0.05 / 2, df=n - 1)\n', (916, 938), False, 'from scipy.stats i... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 21 13:34:22 2020
@author: josep
Helper functions for the recordlinkage script
"""
import pandas as pd
import re
import unicodedata
from numpy import cos, sin, arcsin, sqrt
from math import radians
def strip_accents(text):
text=str(text)
try:
text = unic... | [
"unicodedata.normalize",
"re.escape",
"numpy.sin",
"numpy.cos",
"re.sub",
"numpy.sqrt"
] | [((4258, 4279), 're.sub', 're.sub', (['expr', 'j', 'text'], {}), '(expr, j, text)\n', (4264, 4279), False, 'import re\n'), ((4370, 4391), 're.sub', 're.sub', (['expr', 'j', 'text'], {}), '(expr, j, text)\n', (4376, 4391), False, 'import re\n'), ((838, 851), 'numpy.sin', 'sin', (['(dlat / 2)'], {}), '(dlat / 2)\n', (841... |
import os
import torch
import numpy as np
from config import get_config
from src.Learner import face_learner
from src.models.efficientnet import EfficientNet
# 재현을 위해 seed 고정하기
import random
def seed_everything(seed):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
tor... | [
"os.mkdir",
"numpy.random.seed",
"os.path.isdir",
"torch.manual_seed",
"torch.cuda.manual_seed",
"random.seed",
"config.get_config",
"src.Learner.face_learner"
] | [((225, 242), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (236, 242), False, 'import random\n'), ((292, 312), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (306, 312), True, 'import numpy as np\n'), ((317, 340), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (33... |
import numpy as np
import torch
from PIL import Image
import os
import pandas as pd
from torchvision.datasets.folder import default_loader
from torchvision.datasets.utils import download_url
from torch.utils.data import Dataset
import scipy.io as sio
class Cub2011(Dataset):
base_folder = 'CUB_200_2011... | [
"pandas.DataFrame",
"os.path.join",
"scipy.io.loadmat",
"numpy.asarray",
"PIL.Image.open",
"torchvision.datasets.utils.download_url",
"os.path.isfile",
"torch.is_tensor",
"os.path.expanduser"
] | [((843, 867), 'os.path.expanduser', 'os.path.expanduser', (['root'], {}), '(root)\n', (861, 867), False, 'import os\n'), ((3914, 3976), 'torchvision.datasets.utils.download_url', 'download_url', (['self.url', 'self.root', 'self.filename', 'self.tgz_md5'], {}), '(self.url, self.root, self.filename, self.tgz_md5)\n', (39... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import json
import numpy as np
from logging import getLogger
from .model import update_predictions, flip_attributes
from .util... | [
"numpy.mean",
"numpy.array",
"logging.getLogger",
"json.dumps"
] | [((357, 368), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (366, 368), False, 'from logging import getLogger\n'), ((1395, 1409), 'numpy.mean', 'np.mean', (['costs'], {}), '(costs)\n', (1402, 1409), True, 'import numpy as np\n'), ((8863, 8873), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (8870, 8873), True, 'i... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 11 14:32:42 2021
@author: 91960
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import csv
# Read the learned parameters of the best model
#mean_rating = np.float(pd.read_csv('../Weights/Mean_Rating/Weight_lr0.01_reg0.2_factor40... | [
"csv.reader",
"numpy.concatenate",
"pandas.read_csv",
"pandas.unique",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.argwhere",
"numpy.dot",
"numpy.unique"
] | [((922, 1013), 'pandas.read_csv', 'pd.read_csv', (['"""../Data/u.data"""'], {'delimiter': '"""\t"""', 'names': "['User', 'Item', 'Rating', 'Time']"}), "('../Data/u.data', delimiter='\\t', names=['User', 'Item',\n 'Rating', 'Time'])\n", (933, 1013), True, 'import pandas as pd\n'), ((1431, 1468), 'csv.reader', 'csv.re... |
"""
Framingham Risk Score Calculation
Code borrowed from
https://github.com/fonnesbeck/framingham_risk
"""
import numpy as np
from cvdm.score import cox_surv, BaseRisk
from cvdm.score import clean_bp, clean_bmi, clean_tot_chol, clean_hdl, clean_age
NONLAB_WOMEN = {
"coef": np.array([2.72107, # log age
... | [
"numpy.log",
"cvdm.score.clean_tot_chol",
"cvdm.score.clean_hdl",
"cvdm.score.cox_surv",
"numpy.array",
"cvdm.score.clean_bmi",
"cvdm.score.clean_bp",
"cvdm.score.clean_age"
] | [((283, 347), 'numpy.array', 'np.array', (['[2.72107, 0.51125, 2.81291, 2.88267, 0.61868, 0.77763]'], {}), '([2.72107, 0.51125, 2.81291, 2.88267, 0.61868, 0.77763])\n', (291, 347), True, 'import numpy as np\n'), ((631, 694), 'numpy.array', 'np.array', (['[3.11296, 0.79277, 1.85508, 1.92672, 0.70953, 0.5316]'], {}), '([... |
__all__ = ['mollview', 'projplot']
import numpy as np
from .pixelfunc import ang2pix, npix2nside
from .rotator import Rotator
from matplotlib.projections.geo import GeoAxes
###### WARNING #################
# this module is work in progress, the aim is to reimplement the healpy
# plot functions using the new features ... | [
"numpy.meshgrid",
"matplotlib.pyplot.plot",
"numpy.asarray",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.pcolormesh",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.grid"
] | [((3317, 3358), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(width, width * 0.63)'}), '(figsize=(width, width * 0.63))\n', (3327, 3358), True, 'import matplotlib.pyplot as plt\n'), ((3606, 3671), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'left': '(0.02)', 'right': '(0.98)', 'top'... |
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister
from qiskit.circuit import Instruction
from compiler import composer
from optimizer import Optimizer
import numpy as np
import toml
def is_unitary(operator, tolerance=0.0001):
h, w = operator.shape
if not h == w:
return False
a... | [
"numpy.sum",
"numpy.eye",
"compiler.composer.CircuitComposer",
"numpy.allclose",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"optimizer.Optimizer",
"numpy.dot"
] | [((1587, 1653), 'numpy.array', 'np.array', (['[[0, 1, 1, 0], [0, 0, 0, 1], [0, 0, 0, 1], [0, 1, 1, 0]]'], {}), '([[0, 1, 1, 0], [0, 0, 0, 1], [0, 0, 0, 1], [0, 1, 1, 0]])\n', (1595, 1653), True, 'import numpy as np\n'), ((379, 404), 'numpy.dot', 'np.dot', (['operator', 'adjoint'], {}), '(operator, adjoint)\n', (385, 40... |
from sklearn.exceptions import NotFittedError
import logging
import numpy as np
from qiskit.providers import BaseBackend, Backend
from qiskit.utils import QuantumInstance
from typing import Optional, Union
from sklearn.base import RegressorMixin
from .qknn_base import QNeighborsBase
from ...encodings import Encodin... | [
"sklearn.exceptions.NotFittedError",
"numpy.mean",
"logging.getLogger"
] | [((335, 362), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (352, 362), False, 'import logging\n'), ((1662, 1810), 'sklearn.exceptions.NotFittedError', 'NotFittedError', (['"""This QKNeighborsRegressor instance is not fitted yet. Call \'fit\' with appropriate arguments before using this ... |
import numpy as np
from evaluate.bbox import bbox_overlaps
def evaluate_recall(roidb, thresholds=None,
area='all',
limit=None):
"""Evaluate detection proposal recall metrics.
Returns:
results: dictionary of results with keys
'ar': average recall
'recalls'... | [
"numpy.zeros_like",
"evaluate.bbox.bbox_overlaps",
"numpy.zeros",
"numpy.hstack",
"numpy.sort",
"numpy.arange"
] | [((1214, 1225), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (1222, 1225), True, 'import numpy as np\n'), ((3301, 3321), 'numpy.sort', 'np.sort', (['gt_overlaps'], {}), '(gt_overlaps)\n', (3308, 3321), True, 'import numpy as np\n'), ((3438, 3463), 'numpy.zeros_like', 'np.zeros_like', (['thresholds'], {}), '(thres... |
import copy
from typing import Dict, FrozenSet, List, Tuple
import jax
import networkx as nx
import numpy as np
def get_interaction_graph_from_feature_activations(
feature_activations: np.ndarray,
pools_to_laterals_list: List[
List[Dict[FrozenSet[Tuple[int, int, int, int]], np.ndarray]]
],
te... | [
"numpy.array",
"networkx.Graph",
"jax.tree_util.tree_leaves",
"copy.copy"
] | [((4967, 4977), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (4975, 4977), True, 'import networkx as nx\n'), ((3199, 3227), 'copy.copy', 'copy.copy', (['pools_to_laterals'], {}), '(pools_to_laterals)\n', (3208, 3227), False, 'import copy\n'), ((5365, 5422), 'jax.tree_util.tree_leaves', 'jax.tree_util.tree_leaves', (... |
#!/usr/bin/env python3
import argparse
import datetime
import logging
import numpy as np
from aiohttp import ClientConnectionError
from pyModbusTCP.client import ModbusClient
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
import asyncio
from aioinflux import InfluxDBClient, Inf... | [
"asyncio.get_event_loop",
"pyModbusTCP.client.ModbusClient",
"logging.basicConfig",
"aioinflux.InfluxDBClient",
"argparse.ArgumentParser",
"asyncio.sleep",
"datetime.datetime.utcnow",
"numpy.int16",
"logging.getLogger"
] | [((442, 472), 'logging.getLogger', 'logging.getLogger', (['"""solaredge"""'], {}), "('solaredge')\n", (459, 472), False, 'import logging\n'), ((17601, 17626), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (17624, 17626), False, 'import argparse\n'), ((18275, 18296), 'logging.basicConfig', 'log... |
"""Vessel segmentation"""
import os
from typing import Optional
import itk
import numpy as np
import nibabel as nib
import skimage.morphology as morph
from tqdm import tqdm
from scipy.ndimage import affine_transform
from util.nifti import load_nifti
def backup_result(image: itk.Image, aff: np.ndarray,
... | [
"itk.GetImageFromArray",
"os.mkdir",
"numpy.moveaxis",
"numpy.shape",
"numpy.mean",
"itk.laplacian_image_filter",
"os.path.join",
"skimage.morphology.closing",
"os.path.exists",
"nibabel.save",
"util.nifti.load_nifti",
"nibabel.Nifti1Image",
"tqdm.tqdm",
"itk.sigmoid_image_filter",
"nump... | [((683, 713), 'nibabel.save', 'nib.save', (['nii_backup', 'filename'], {}), '(nii_backup, filename)\n', (691, 713), True, 'import nibabel as nib\n'), ((1190, 1217), 'numpy.asarray', 'np.asarray', (['intensity_image'], {}), '(intensity_image)\n', (1200, 1217), True, 'import numpy as np\n'), ((1235, 1258), 'numpy.asarray... |
from __future__ import division
import time
import train
import option_parse
from numpy.random import uniform, randint, choice
import torch
def check_params(opts, prev_opts):
stds = {'dropout': .02, 'lr': 10**-6, 'lr_decay': .1, 'start_decay_at': 5, 'attn': 0,
'cat_mo_spec': 0, 'mem_slots': 10, 'mem_s... | [
"numpy.random.uniform",
"option_parse.get_parser",
"torch.load",
"train.main",
"torch.save",
"numpy.random.randint",
"numpy.random.choice"
] | [((1439, 1464), 'option_parse.get_parser', 'option_parse.get_parser', ([], {}), '()\n', (1462, 1464), False, 'import option_parse\n'), ((3805, 3817), 'train.main', 'train.main', ([], {}), '()\n', (3815, 3817), False, 'import train\n'), ((1757, 1782), 'torch.load', 'torch.load', (['opt.prev_opts'], {}), '(opt.prev_opts)... |
from __future__ import (division, print_function, absolute_import,
unicode_literals)
import os.path as path
import time
from Corrfunc import _countpairs
from Corrfunc.utils import read_catalog
import numpy as np
# --- Local ---
# --- halotools ---
from halotools.sim_manager import CachedHaloCa... | [
"matplotlib.pyplot.loglog",
"numpy.diag",
"matplotlib.pyplot.savefig",
"os.path.abspath",
"halotools.empirical_models.PrebuiltHodModelFactory",
"time.time",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array",
"numpy.loadtxt",
"halotools.empirical_models.factories.mock_helpers.three_dim_pos_... | [((952, 1014), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/wpxicov_dr72_bright0_mr21.0_z0.159_nj400"""'], {}), "('../data/wpxicov_dr72_bright0_mr21.0_z0.159_nj400')\n", (962, 1014), True, 'import numpy as np\n'), ((1048, 1097), 'halotools.empirical_models.PrebuiltHodModelFactory', 'PrebuiltHodModelFactory', (['"""zhen... |
# Copyright 2016-2022 Bitmain Technologies Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"numpy.array",
"sophon.auto_runner.api.infer",
"numpy.ndarray",
"sophon.auto_runner.api.load"
] | [((3951, 3975), 'sophon.auto_runner.api.load', 'load', (['self.subgraph_path'], {}), '(self.subgraph_path)\n', (3955, 3975), False, 'from sophon.auto_runner.api import load\n'), ((3988, 4012), 'sophon.auto_runner.api.infer', 'infer', (['model', 'input_data'], {}), '(model, input_data)\n', (3993, 4012), False, 'from sop... |
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import os
import pytest
import torch
import numpy as np
import torchvision.models.video as models
from torchvision import transforms
from jina import Document, DocumentArray
try:
from video_torch_encoder ... | [
"os.path.abspath",
"os.path.join",
"torchvision.transforms.ConvertImageDtype",
"pytest.fixture",
"video_torch_encoder.ConvertFCHWtoCFHW",
"torch.Tensor",
"video_torch_encoder.ConvertFHWCtoFCHW",
"numpy.random.random",
"torchvision.transforms.CenterCrop",
"pytest.mark.parametrize",
"torchvision.t... | [((543, 617), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model_name"""', "['r3d_18', 'mc3_18', 'r2plus1d_18']"], {}), "('model_name', ['r3d_18', 'mc3_18', 'r2plus1d_18'])\n", (566, 617), False, 'import pytest\n'), ((952, 1001), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""batch_size"""',... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 13:56:53 2020
@author: dcmccal
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 6 13:53:11 2020
@author: dave
"""
# -*- coding: utf-8 -*-
"""
This looks at 25 degrees Li on Au. I'm looking at making this code shorter.
"""
from scipy.optimize import curve_fit... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"scipy.optimize.curve_fit",
"scipy.signal.find_peaks",
"numpy.array",
"numpy.exp",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.diag"
] | [((8878, 8890), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (8888, 8890), True, 'import matplotlib.pyplot as plt\n'), ((8891, 8916), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Energy (eV)"""'], {}), "('Energy (eV)')\n", (8901, 8916), True, 'import matplotlib.pyplot as plt\n'), ((8917, 8946), 'matpl... |
from queue import Queue
from threading import Thread
import sys
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import pyaudio
from somnus.models import BaseModel
from somnus.preprocess_audio import melnormalize
class Somnus():
"""
Args:
model (string): The file containing the... | [
"somnus.models.BaseModel",
"numpy.argmax",
"numpy.frombuffer",
"numpy.zeros",
"numpy.expand_dims",
"numpy.append",
"pyaudio.PyAudio",
"queue.Queue",
"sys.exit",
"somnus.preprocess_audio.melnormalize"
] | [((1200, 1211), 'somnus.models.BaseModel', 'BaseModel', ([], {}), '()\n', (1209, 1211), False, 'from somnus.models import BaseModel\n'), ((1757, 1799), 'numpy.zeros', 'np.zeros', (['self.feed_samples'], {'dtype': '"""int16"""'}), "(self.feed_samples, dtype='int16')\n", (1765, 1799), True, 'import numpy as np\n'), ((434... |
from __future__ import division
import numpy as np
def net_input(xi, weights):
return np.dot(xi, weights[1:]) + weights[0]
def predict(xi, weights):
return np.where(net_input(xi, weights) >= 0, 1, -1)
def fit(X, y, learning_rate=0.01, iterations=10):
number_of_features = X.shape[1]
weights = np.zeros... | [
"numpy.dot",
"numpy.zeros"
] | [((312, 344), 'numpy.zeros', 'np.zeros', (['(number_of_features + 1)'], {}), '(number_of_features + 1)\n', (320, 344), True, 'import numpy as np\n'), ((91, 114), 'numpy.dot', 'np.dot', (['xi', 'weights[1:]'], {}), '(xi, weights[1:])\n', (97, 114), True, 'import numpy as np\n')] |
#!/usr/bin/env python
import numpy as np
from base import Experiment, FilteredRankingEval
from skge import TransE, PairwiseStochasticTrainer
class TransEEval(FilteredRankingEval):
def prepare(self, mdl, p):
self.ER = mdl.E + mdl.R[p]
def scores_o(self, mdl, s, p):
return -np.sum(np.abs(self... | [
"skge.TransE",
"numpy.abs",
"skge.PairwiseStochasticTrainer"
] | [((723, 771), 'skge.TransE', 'TransE', (['sz', 'self.args.ncomp'], {'init': 'self.args.init'}), '(sz, self.args.ncomp, init=self.args.init)\n', (729, 771), False, 'from skge import TransE, PairwiseStochasticTrainer\n'), ((790, 985), 'skge.PairwiseStochasticTrainer', 'PairwiseStochasticTrainer', (['model'], {'nbatches':... |
"""An exact Riemann solver for the Euler equations with a gamma-law
gas. The left and right states are stored as State objects. We then
create a RiemannProblem object with the left and right state:
> rp = RiemannProblem(left_state, right_state)
Next we solve for the star state:
> rp.find_star_state()
Finally, we ... | [
"matplotlib.pyplot.xlim",
"numpy.zeros_like",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.text",
"numpy.max",
"numpy.where",
"numpy.array",
"matplotlib.pyplot.Line2D",
"numpy.linspace",
"numpy.sign",
"numpy.min",
"matplotlib.pyplot.... | [((1554, 1595), 'numpy.sqrt', 'np.sqrt', (['(self.gamma * state.p / state.rho)'], {}), '(self.gamma * state.p / state.rho)\n', (1561, 1595), True, 'import numpy as np\n'), ((3234, 3275), 'numpy.sqrt', 'np.sqrt', (['(self.gamma * state.p / state.rho)'], {}), '(self.gamma * state.p / state.rho)\n', (3241, 3275), True, 'i... |
# SOCIAL NETWORK ANALYSIS PACKAGE
# AUTHORS: <NAME>, <NAME>, <NAME>
# LAST MODIFIED: 08/07/2020
# REQUIRED MODULES
import sys, os # Utils
import pandas as pd # Data wrangling
import numpy as np # Data wrangling
import math as math ... | [
"matplotlib.pyplot.yscale",
"pandas.read_csv",
"random.shuffle",
"numpy.random.multinomial",
"powerlaw.pdf",
"collections.defaultdict",
"networkx.closeness_centrality",
"networkx.betweenness_centrality",
"numpy.geomspace",
"matplotlib.pyplot.yticks",
"collections.Counter",
"matplotlib.pyplot.x... | [((1903, 1930), 'numpy.zeros', 'np.zeros', (['(n_bins + 1)', 'float'], {}), '(n_bins + 1, float)\n', (1911, 1930), True, 'import numpy as np\n'), ((2114, 2141), 'numpy.zeros', 'np.zeros', (['(n_bins + 1)', 'float'], {}), '(n_bins + 1, float)\n', (2122, 2141), True, 'import numpy as np\n'), ((2156, 2183), 'numpy.zeros',... |
import argparse
import pandas as pd
import numpy as np
import commons
from get_statistics import get_statistics
def predict_popular(train_tracks, train_tags, test_tracks, test_tags, tags_order):
tags_popular = {}
for category in commons.CATEGORIES:
stats, _ = get_statistics(category, train_tracks, t... | [
"numpy.save",
"argparse.ArgumentParser",
"commons.read_file",
"pandas.read_csv",
"get_statistics.get_statistics"
] | [((1871, 1971), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generates predictions based on naive baseline algorithms"""'}), "(description=\n 'Generates predictions based on naive baseline algorithms')\n", (1894, 1971), False, 'import argparse\n'), ((2505, 2539), 'commons.read_file'... |
import logging
import numpy as np
# Logger
def get_logger(file_path):
""" Make python logger """
logger = logging.getLogger("darts")
log_format = "%(asctime)s | %(message)s"
formatter = logging.Formatter(log_format, datefmt="%m/%d %I:%M:%S %p")
file_handler = logging.FileHandler(file_path, mode="a"... | [
"logging.FileHandler",
"logging.StreamHandler",
"logging.Formatter",
"numpy.argsort",
"logging.getLogger"
] | [((115, 141), 'logging.getLogger', 'logging.getLogger', (['"""darts"""'], {}), "('darts')\n", (132, 141), False, 'import logging\n'), ((203, 261), 'logging.Formatter', 'logging.Formatter', (['log_format'], {'datefmt': '"""%m/%d %I:%M:%S %p"""'}), "(log_format, datefmt='%m/%d %I:%M:%S %p')\n", (220, 261), False, 'import... |
# coding=utf-8
"""
train bert model
"""
import modeling
import tensorflow as tf
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Describe your program')
parser.add_argument('-batch_size', '--batch_size', type=int,default=128)
args = parser.parse_args()
batch_size=args.batch_size
print("... | [
"tensorflow.nn.softmax",
"argparse.ArgumentParser",
"modeling.BertModel",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"numpy.ones",
"tensorflow.variable_scope",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.reduce_mean",
"tensorflow.placeholder",
"tensorflow... | [((125, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Describe your program"""'}), "(description='Describe your program')\n", (148, 185), False, 'import argparse\n'), ((525, 661), 'modeling.BertConfig', 'modeling.BertConfig', ([], {'vocab_size': '(21128)', 'hidden_size': 'hidden_s... |
"""
What is desteaking?
When computing inverse Radon transform using Filter back projection,
streaks (line artifacts) would appear if information from some angles are
missing. A popular way to remove them is to optimize some loss function
in the image and Radon transform domain, such loss functions are exquisitely
stu... | [
"skimage.transform.iradon",
"nnimgproc.util.parameters.Parameters",
"numpy.expand_dims",
"skimage.color.rgb2grey",
"skimage.transform.radon"
] | [((1137, 1149), 'nnimgproc.util.parameters.Parameters', 'Parameters', ([], {}), '()\n', (1147, 1149), False, 'from nnimgproc.util.parameters import Parameters\n'), ((2431, 2468), 'skimage.transform.radon', 'radon', (['img'], {'theta': 'theta', 'circle': '(False)'}), '(img, theta=theta, circle=False)\n', (2436, 2468), F... |
import os
import sys
import argparse
import dolfin as dlf
import fenicsmechanics as fm
from fenicsmechanics.dolfincompat import MPI_COMM_WORLD
# Parse through the arguments provided at the command line.
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--dim',
help='dimension',
... | [
"dolfin.MPI.size",
"fenicsmechanics.SolidMechanicsSolver",
"argparse.ArgumentParser",
"dolfin.TrialFunction",
"dolfin.solve",
"dolfin.TestFunction",
"dolfin.ALE",
"fenicsmechanics.SolidMechanicsProblem",
"dolfin.Function",
"dolfin.plot",
"os.path.isfile",
"dolfin.Constant",
"fenicsmechanics.... | [((214, 239), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (237, 239), False, 'import argparse\n'), ((2195, 2286), 'fenicsmechanics.get_mesh_file_names', 'fm.get_mesh_file_names', (['"""unit_domain"""'], {'ret_facets': '(True)', 'refinements': 'mesh_dims', 'ext': 'ext'}), "('unit_domain', ret... |
#Noise Simulator
import numpy as np
import matplotlib.pyplot as plt
def noise(num_samples = 10000, alpha = None, noise_type = 'pink', to_plot = 'False'):
"""
:type num_samples: int
:type alpha: float
:type noise_type: str
:rtype: List[float]
"""
if alpha is None:
if noise_type ... | [
"numpy.fft.ifft",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"numpy.random.normal",
"numpy.concatenate",
"numpy.sqrt"
] | [((482, 517), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'num_samples'], {}), '(0, 1, num_samples)\n', (498, 517), True, 'import numpy as np\n'), ((534, 551), 'numpy.fft.fft', 'np.fft.fft', (['samps'], {}), '(samps)\n', (544, 551), True, 'import numpy as np\n'), ((814, 842), 'numpy.concatenate', 'np.con... |
import os
import sys
import yaml
import logging
import pickle
import numpy as np
import time
from datetime import datetime
from rdkit import Chem
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
import torch_geometric as pyg
import utils.graph_utils as... | [
"yaml.load",
"pickle.dump",
"numpy.random.seed",
"utils.graph_utils.mol_to_pyg_graph",
"yaml.dump",
"torch.cat",
"pickle.load",
"numpy.arange",
"torch.autograd.set_detect_anomaly",
"os.path.join",
"torch.nn.MSELoss",
"torch.multiprocessing.set_sharing_strategy",
"torch.utils.data.DataLoader"... | [((423, 480), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (465, 480), False, 'import torch\n'), ((2144, 2156), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (2153, 2156), True, 'import numpy as np\n'), ((2226, 2268), ... |
import matplotlib.pyplot as plt
import numpy as np
import api.spotify as spotify
import api.utils as utils
from api.spotify import FeatureType, FeatureFilter
def plot_all_features(tracks, overlay_tracks=None):
fig0, axs0 = double_plot()
histogram(fig0, axs0[0], "Danceability", spotify.get_feature_values(trac... | [
"api.spotify.get_feature_values",
"matplotlib.pyplot.subplots",
"numpy.linspace"
] | [((3390, 3408), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (3402, 3408), True, 'import matplotlib.pyplot as plt\n'), ((3500, 3518), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {}), '(1, 2)\n', (3512, 3518), True, 'import matplotlib.pyplot as plt\n'), ((289, 349), ... |
# -*- coding: utf-8 -*-
'''
┌┬──────────────────────────────────┬┐
└┤ OCD ANALYSIS SOFTWARE ├┘
┌┤ <NAME> - Huang Lab ├┐
└┤ Rice Univ - 2017 ├┘
┌┤ <EMAIL> ├┐
└┴──────────────────────────────────┴┘
'''
import sys
import os
import numpy as np
import matplotlib as mpl
if sys.pla... | [
"matplotlib.pyplot.title",
"numpy.kaiser",
"os.popen",
"dialog.Dialog",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axvline",
"numpy.append",
"numpy.loadtxt",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.flipud",
"matplotlib.use",
"wx.App",
"matplotlib.pyplot.ylabel",
... | [((340, 356), 'matplotlib.use', 'mpl.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (347, 356), True, 'import matplotlib as mpl\n'), ((753, 780), 'numpy.kaiser', 'np.kaiser', (['window_len', 'beta'], {}), '(window_len, beta)\n', (762, 780), True, 'import numpy as np\n'), ((5081, 5109), 'matplotlib.pyplot.figure', 'plt.fig... |
import numpy as np
import pandas as pd
from pywt import wavedec
from zipfile import ZipFile
from statsmodels.robust.scale import mad as medianAD
def get_class_and_frequence(path: str) -> (int, int):
'''
`path` é uma str no modelo: 'pasta/subpasta/arquivo'.
O retorno é uma tupla contendo `(classe, frequência)`... | [
"pandas.DataFrame",
"pywt.wavedec",
"numpy.square",
"statsmodels.robust.scale.mad"
] | [((1303, 1317), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1315, 1317), True, 'import pandas as pd\n'), ((1386, 1427), 'pywt.wavedec', 'wavedec', ([], {'data': 'vec', 'wavelet': '"""db2"""', 'level': '(5)'}), "(data=vec, wavelet='db2', level=5)\n", (1393, 1427), False, 'from pywt import wavedec\n'), ((1751,... |
# Copyright (c) 2021, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root
# or https://opensource.org/licenses/BSD-3-Clause
#
"""
The Fully Connected Network class
"""
import numpy as np
import torch.nn as nn
import torch.nn... | [
"torch.nn.ReLU",
"torch.nn.ModuleList",
"numpy.zeros",
"warp_drive.utils.data_feed.DataFeed",
"torch.nn.ModuleDict",
"torch.nn.Linear",
"numpy.prod"
] | [((1210, 1272), 'numpy.prod', 'np.prod', (['self.env.env.observation_space[sample_agent_id].shape'], {}), '(self.env.env.observation_space[sample_agent_id].shape)\n', (1217, 1272), True, 'import numpy as np\n'), ((1734, 1749), 'torch.nn.ModuleDict', 'nn.ModuleDict', ([], {}), '()\n', (1747, 1749), True, 'import torch.n... |
#!/usr/bin/env python3
"""
histogram: plot a histogram of a file of numbers. Numbers can be floats, one per
line. Lines with two numbers are interpreted as pre-counted, with the number of
repeats of the first being given by the second.
Multiple instances of the same value in a category will be merged by adding
weights... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.argmin",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.histogram",
"matplotlib.pyplot.gca",
"itertools.cycle",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.axvline",... | [((973, 985), 'matplotlib.pyplot.gca', 'pyplot.gca', ([], {}), '()\n', (983, 985), False, 'from matplotlib import pyplot\n'), ((2558, 2661), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=__doc__, formatter... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 15:26:13 2019
@author: Tang
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
def get_noise(img,value=10):
'''
#生成噪声图像
>>> 输入: img图像
value= 大小控制雨滴的多少
>>> 返回图像大小的模糊噪声图像
'''
noise = np.rand... | [
"cv2.GaussianBlur",
"numpy.load",
"numpy.ones",
"cv2.warpAffine",
"cv2.normalize",
"cv2.imshow",
"cv2.getRotationMatrix2D",
"cv2.filter2D",
"matplotlib.pyplot.imshow",
"cv2.destroyAllWindows",
"numpy.repeat",
"cv2.waitKey",
"numpy.hstack",
"cv2.addWeighted",
"numpy.savez",
"numpy.conca... | [((2722, 2747), 'cv2.imread', 'cv2.imread', (['"""ori_img.png"""'], {}), "('ori_img.png')\n", (2732, 2747), False, 'import cv2\n'), ((2952, 2991), 'numpy.hstack', 'np.hstack', (['(rain_result1, rain_result2)'], {}), '((rain_result1, rain_result2))\n', (2961, 2991), True, 'import numpy as np\n'), ((2993, 3032), 'cv2.ims... |
"""Unit tests for representations module."""
import pathlib
import tempfile
from ldp.parse import representations
import h5py
import numpy as np
import pytest
import torch
REP_LAYERS = 3
REP_DIMENSION = 1024
SEQ_LENGTHS = (1, 2, 3)
@pytest.fixture
def reps():
"""Returns fake representations for testing."""
... | [
"h5py.File",
"tempfile.TemporaryDirectory",
"numpy.random.randn",
"ldp.parse.representations.RepresentationDataset",
"pytest.raises",
"ldp.parse.representations.RepresentationLayerDataset",
"pathlib.Path",
"torch.tensor"
] | [((993, 1036), 'ldp.parse.representations.RepresentationDataset', 'representations.RepresentationDataset', (['path'], {}), '(path)\n', (1030, 1036), False, 'from ldp.parse import representations\n'), ((2442, 2515), 'ldp.parse.representations.RepresentationLayerDataset', 'representations.RepresentationLayerDataset', (['... |
import numpy as np
import glob
from numpy.linalg import eig as npeig
import matplotlib.pyplot as plt
from scipy.io import loadmat
from scipy import signal
from numpy.linalg import inv as npinv
def correlate():
target_chips = glob.glob('../data/train/chips20x40/targets/' + '*.mat')
clutter_chips = glob.glob('.... | [
"numpy.load",
"numpy.save",
"matplotlib.pyplot.show",
"scipy.signal.convolve2d",
"scipy.io.loadmat",
"numpy.column_stack",
"numpy.zeros",
"numpy.ones",
"numpy.linalg.eig",
"numpy.fliplr",
"numpy.cumsum",
"numpy.arange",
"numpy.matmul",
"glob.glob",
"numpy.real",
"matplotlib.pyplot.subp... | [((3349, 3396), 'numpy.load', 'np.load', (['"""./weights_filters/target_filters.npy"""'], {}), "('./weights_filters/target_filters.npy')\n", (3356, 3396), True, 'import numpy as np\n'), ((3415, 3463), 'numpy.load', 'np.load', (['"""./weights_filters/clutter_filters.npy"""'], {}), "('./weights_filters/clutter_filters.np... |
import pandas as pd
import time
import seaborn
import numpy as np
from matplotlib import pyplot as plt
from sklearn import linear_model
import kernelml
from scipy import stats
train=pd.read_csv("data/kc_house_train_data.csv",dtype = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade'... | [
"scipy.stats.norm",
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"scipy.stats.norm.pdf",
"numpy.histogram",
"numpy.diff",
"numpy.max",
"kernelml.KernelML",
"numpy.mean",
"numpy.min"
] | [((183, 620), 'pandas.read_csv', 'pd.read_csv', (['"""data/kc_house_train_data.csv"""'], {'dtype': "{'bathrooms': float, 'waterfront': int, 'sqft_above': int, 'sqft_living15':\n float, 'grade': int, 'yr_renovated': int, 'price': float, 'bedrooms':\n float, 'zipcode': str, 'long': float, 'sqft_lot15': float,\n ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import glob
from os import listdir
import os
import scipy.io
import csv
import numpy as np
import tensorflow as tf
import tensorflow_compression as tfc
import sys
def load_image(filename):
... | [
"argparse.ArgumentParser",
"tensorflow.clip_by_value",
"tensorflow.write_file",
"tensorflow.reset_default_graph",
"tensorflow.image.psnr",
"tensorflow.logging.set_verbosity",
"tensorflow.train.latest_checkpoint",
"tensorflow.train.NanTensorHook",
"glob.glob",
"tensorflow.train.MonitoredTrainingSes... | [((366, 388), 'tensorflow.read_file', 'tf.read_file', (['filename'], {}), '(filename)\n', (378, 388), True, 'import tensorflow as tf\n'), ((401, 442), 'tensorflow.image.decode_image', 'tf.image.decode_image', (['string'], {'channels': '(3)'}), '(string, channels=3)\n', (422, 442), True, 'import tensorflow as tf\n'), ((... |
import cv2
import numpy as np
img = cv2.imread('dataset/train/1/1.png')
img_bw = 255*(cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)>5).astype('uint8')
se1 = cv2.getStructuringElement(cv2.MORPH_RECT, (5,5))
se2 = cv2.getStructuringElement(cv2.MORPH_RECT,(2,2))
mask = cv2.morphologyEx(img_bw, cv2.MORPH_CLOSE, se1)
mask = cv2.mo... | [
"numpy.dstack",
"cv2.bitwise_and",
"cv2.medianBlur",
"cv2.waitKey",
"cv2.morphologyEx",
"cv2.getStructuringElement",
"cv2.threshold",
"cv2.destroyAllWindows",
"cv2.imwrite",
"cv2.cvtColor",
"cv2.imread",
"cv2.imshow",
"cv2.Laplacian"
] | [((38, 73), 'cv2.imread', 'cv2.imread', (['"""dataset/train/1/1.png"""'], {}), "('dataset/train/1/1.png')\n", (48, 73), False, 'import cv2\n'), ((150, 199), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_RECT', '(5, 5)'], {}), '(cv2.MORPH_RECT, (5, 5))\n', (175, 199), False, 'import cv2\n'), ((2... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import pandas as pd
import requests
import sys
#Download data file if it does not exist
if (not os.path.exists('communities.data')):
print('Data set does not exist in current f... | [
"os.mkdir",
"numpy.logical_and",
"numpy.std",
"pandas.read_csv",
"numpy.zeros",
"os.path.exists",
"numpy.searchsorted",
"numpy.random.default_rng",
"numpy.mean",
"numpy.arange",
"requests.get",
"sys.exit"
] | [((1600, 1622), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'int'}), '(N, dtype=int)\n', (1608, 1622), True, 'import numpy as np\n'), ((1689, 1711), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'int'}), '(N, dtype=int)\n', (1697, 1711), True, 'import numpy as np\n'), ((1879, 1903), 'numpy.random.default_rng', 'np.rand... |
""" Dynamic components of a multialgorithm simulation
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Date: 2018-02-07
:Copyright: 2017-2019, Karr Lab
:License: MIT
"""
from enum import Enum, auto
from pprint import pformat
import collections
import inspect
import itertools
import math
import networkx
import num... | [
"math.isnan",
"pprint.pformat",
"wc_sim.multialgorithm_errors.MultialgorithmError",
"wc_utils.util.ontology.are_terms_equivalent",
"inspect.isclass",
"numpy.isnan",
"wc_lang.Species.gen_id",
"collections.defaultdict",
"wc_sim.model_utilities.ModelUtilities.non_neg_normal_sample",
"collections.name... | [((1148, 1226), 'collections.namedtuple', 'collections.namedtuple', (['"""WcSimToken"""', '"""code, token_string, dynamic_expression"""'], {}), "('WcSimToken', 'code, token_string, dynamic_expression')\n", (1170, 1226), False, 'import collections\n'), ((56532, 56538), 'enum.auto', 'auto', ([], {}), '()\n', (56536, 5653... |
from __future__ import print_function
###########################################
# SVHN dataset #
# http://ufldl.stanford.edu/housenumbers/ #
###########################################
import os
import numpy as np
import scipy.io
import tensorflow as tf
from .tfrecords_utils import *
from ... | [
"numpy.argsort",
"os.path.getsize",
"os.path.isfile",
"os.path.join"
] | [((718, 762), 'os.path.join', 'os.path.join', (['data_dir', "('%s_32x32.mat' % key)"], {}), "(data_dir, '%s_32x32.mat' % key)\n", (730, 762), False, 'import os\n'), ((782, 802), 'os.path.isfile', 'os.path.isfile', (['data'], {}), '(data)\n', (796, 802), False, 'import os\n'), ((1474, 1500), 'numpy.argsort', 'np.argsort... |
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import os
from pathlib import Path
from typing import Union
import numpy as np
from tqdm import tqdm
def scatter_mean(data, indices):
inverse, counts = np.unique(indices, return_inverse=True, return_counts=True)[1:3]
idx_sorted = np.argsort(i... | [
"numpy.load",
"numpy.zeros_like",
"os.path.isabs",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.floor",
"os.symlink",
"numpy.add.reduceat",
"numpy.argsort",
"numpy.max",
"numpy.min",
"os.path.relpath",
"numpy.add.accumulate",
"os.path.join",
"os.scandir",
"numpy.unique"
] | [((308, 327), 'numpy.argsort', 'np.argsort', (['inverse'], {}), '(inverse)\n', (318, 327), True, 'import numpy as np\n'), ((392, 442), 'numpy.add.accumulate', 'np.add.accumulate', (['counts[:-1]'], {'out': 'reduce_idx[1:]'}), '(counts[:-1], out=reduce_idx[1:])\n', (409, 442), True, 'import numpy as np\n'), ((866, 885),... |
import caffe2.python.onnx.backend as backend
import numpy as np
import onnx
# Load the ONNX model
model = onnx.load("alexnet.onnx")
# Check that the IR is well formed
onnx.checker.check_model(model)
# Print a human readable representation of the graph
onnx.helper.printable_graph(model.graph)
rep = backend.prepare(m... | [
"numpy.random.randn",
"onnx.helper.printable_graph",
"caffe2.python.onnx.backend.prepare",
"onnx.checker.check_model",
"onnx.load"
] | [((107, 132), 'onnx.load', 'onnx.load', (['"""alexnet.onnx"""'], {}), "('alexnet.onnx')\n", (116, 132), False, 'import onnx\n'), ((169, 200), 'onnx.checker.check_model', 'onnx.checker.check_model', (['model'], {}), '(model)\n', (193, 200), False, 'import onnx\n'), ((255, 295), 'onnx.helper.printable_graph', 'onnx.helpe... |
# IMPORT MODULES
import numpy as np
from scipy import optimize
from scipy import special
from reported_statistics import get_p
from typing import List
import time
class BinaryOutcomeModel(object):
"""
A binary outcome model class that Logit and Probit are built on.
:param add_intercept: If T... | [
"numpy.diag",
"scipy.optimize.minimize",
"numpy.outer",
"numpy.log",
"numpy.zeros",
"numpy.ones",
"numpy.identity",
"time.time",
"numpy.transpose",
"numpy.where",
"numpy.array",
"numpy.exp",
"numpy.reshape",
"reported_statistics.get_p",
"numpy.var",
"numpy.unique",
"numpy.sqrt"
] | [((2219, 2236), 'numpy.zeros', 'np.zeros', ([], {'shape': 'k'}), '(shape=k)\n', (2227, 2236), True, 'import numpy as np\n'), ((2253, 2363), 'scipy.optimize.minimize', 'optimize.minimize', (['self.objective_function', 'beta_0'], {'method': '"""BFGS"""', 'jac': 'self.score', 'options': "{'disp': True}"}), "(self.objectiv... |
from __future__ import print_function
from __future__ import division
from random import shuffle
# Written by <NAME>
# Updated 11.28.2016
from optparse import OptionParser
from collections import Counter
import array
import itertools
import math
import sys,re
import os
import logging
from scipy.stats import binom as ... | [
"numpy.linalg.eigvals",
"numpy.sum",
"scipy.stats.invgamma.logpdf",
"scipy.stats.invgamma.rvs",
"numpy.random.randint",
"numpy.mean",
"numpy.random.normal",
"numpy.matlib.eye",
"scipy.stats.multivariate_normal.logpdf",
"numpy.power",
"numpy.finfo",
"numpy.max",
"numpy.random.dirichlet",
"n... | [((486, 510), 'logging.getLogger', 'logging.getLogger', (['"""Log"""'], {}), "('Log')\n", (503, 510), False, 'import logging\n'), ((595, 619), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""warn"""'}), "(divide='warn')\n", (604, 619), True, 'import numpy as np\n'), ((657, 669), 'numpy.matrix', 'np.matrix', (['x'], {}... |
# -*- coding: utf-8 -*-
from sklearn import svm
import numpy as np
import matplotlib.pyplot as plt
from utils.FScore import F1Score
from Identification.LoadDescriptors import loadAllDescriptors
from Identification.PreprocessingDescriptors import preprocessDescriptors
from Identification.TrainCvTest import separateDat... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"utils.FScore.F1Score",
"matplotlib.pyplot.text",
"Identification.TrainCvTest.separateDatabases",
"Identification.PreprocessingDescriptors.preprocessDescriptors",
"numpy.linspace",
"sklearn.svm.SVC",
"matplotlib.pyplot.tick_params",
"matplotlib.p... | [((342, 374), 'Identification.LoadDescriptors.loadAllDescriptors', 'loadAllDescriptors', ([], {'reverbs': '(True)'}), '(reverbs=True)\n', (360, 374), False, 'from Identification.LoadDescriptors import loadAllDescriptors\n'), ((421, 455), 'Identification.PreprocessingDescriptors.preprocessDescriptors', 'preprocessDescri... |
# System libs
import os
import argparse
from distutils.version import LooseVersion
from multiprocessing import Queue, Process
# Numerical libs
import numpy as np
import math
import torch
import torch.nn as nn
from scipy.io import loadmat
# Our libs
from lib.nn.dataset_for_eval import ValDataset
from lib.mo... | [
"argparse.ArgumentParser",
"scipy.io.loadmat",
"lib.modeling.semseg_heads",
"torch.nn.NLLLoss",
"multiprocessing.Queue",
"lib.nn.utils_for_eval.accuracy",
"torch.no_grad",
"os.path.join",
"torch.load",
"lib.nn.utils_for_eval.colorEncode",
"lib.nn.parallel.data_parallel_for_eval.async_copy_to",
... | [((772, 808), 'scipy.io.loadmat', 'loadmat', (['"""lib/datasets/color150.mat"""'], {}), "('lib/datasets/color150.mat')\n", (779, 808), False, 'from scipy.io import loadmat\n'), ((2615, 2639), 'lib.nn.utils_for_eval.colorEncode', 'colorEncode', (['seg', 'colors'], {}), '(seg, colors)\n', (2626, 2639), False, 'from lib.n... |
from base.base_evaluater import BaseEvaluater
from utils.uts_classification.utils import save_evaluating_result
import numpy as np
class UtsClassificationEvaluater(BaseEvaluater):
def __init__(self,model,data,nb_classes,config):
super(UtsClassificationEvaluater,self).__init__(model,data,config)
self... | [
"utils.uts_classification.utils.save_evaluating_result",
"numpy.array",
"numpy.unique",
"numpy.argmax"
] | [((695, 720), 'numpy.argmax', 'np.argmax', (['y_pred'], {'axis': '(1)'}), '(y_pred, axis=1)\n', (704, 720), True, 'import numpy as np\n'), ((1373, 1452), 'utils.uts_classification.utils.save_evaluating_result', 'save_evaluating_result', (['self.config.result_dir', 'y_pred', 'y_true', 'self.nb_classes'], {}), '(self.con... |
# py_rfq_utils.py
# Written by <NAME> in August 2018
#
# Contains the PyRfqUtils class designed to work in tandem with the RFQ object from
# the py_rfq_module (py_rfq_designer), and a corresponding WARP simulation.
#
from warp import *
import numpy as np
import pickle
import os
import matplotlib.pyplot as plt
import b... | [
"itertools.chain.from_iterable",
"pyqtgraph.Qt.QtGui.QApplication.processEvents",
"numpy.around",
"numpy.mean",
"pyqtgraph.ScatterPlotItem",
"numpy.full",
"os.path.exists",
"numpy.linspace",
"pyqtgraph.mkPen",
"dans_pymodules.MyColors",
"h5py.File",
"datetime.datetime.today",
"pyqtgraph.mkQA... | [((631, 641), 'dans_pymodules.MyColors', 'MyColors', ([], {}), '()\n', (639, 641), False, 'from dans_pymodules import MyColors\n'), ((895, 924), 'numpy.array', 'np.array', (['self._velocityarray'], {}), '(self._velocityarray)\n', (903, 924), True, 'import numpy as np\n'), ((1288, 1299), 'pyqtgraph.mkQApp', 'pg.mkQApp',... |
""" Example of ordinary Monte Carlo random sampling a 1-dimensional gaussian model """
import numpy as np
import scipy.stats
from matplotlib.colors import Normalize
from pylab import *; ion()
import probayes as pb
# Settings
rand_size = 60
rand_mean = 50.
rand_stdv = 10.
mu_lims = (40, 60)
sigma_lims = (5, 20.)
n_samp... | [
"probayes.SP",
"probayes.RF",
"numpy.min",
"numpy.max",
"numpy.random.normal",
"probayes.RV"
] | [((355, 419), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'rand_mean', 'scale': 'rand_stdv', 'size': 'rand_size'}), '(loc=rand_mean, scale=rand_stdv, size=rand_size)\n', (371, 419), True, 'import numpy as np\n'), ((440, 478), 'probayes.RV', 'pb.RV', (['"""mu"""'], {'vtype': 'float', 'vset': 'mu_lims'}), "('... |
# Partially based on codebase by <NAME> (https://github.com/lmcinnes/umap)
from __future__ import print_function
import numpy as np
import numba
import scipy
from scipy.optimize import curve_fit
from sklearn.neighbors import KDTree
from sklearn.metrics import pairwise_distances
import warnings
#INT32_MIN = ... | [
"numpy.abs",
"numpy.sum",
"numpy.empty",
"scipy.sparse.issparse",
"numba.njit",
"numpy.floor",
"numpy.ones",
"numpy.clip",
"numpy.iinfo",
"numpy.argsort",
"numpy.sin",
"numpy.arange",
"numpy.mean",
"numpy.exp",
"numba.prange",
"scipy.sparse.csgraph.connected_components",
"scipy.spati... | [((641, 681), 'locale.setlocale', 'locale.setlocale', (['locale.LC_NUMERIC', '"""C"""'], {}), "(locale.LC_NUMERIC, 'C')\n", (657, 681), False, 'import locale\n'), ((723, 842), 'collections.namedtuple', 'namedtuple', (['"""RandomProjectionTreeNode"""', "['indices', 'is_leaf', 'hyperplane', 'offset', 'left_child', 'right... |
# /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2017-2018, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | [
"aimet_common.utils.AimetLogger.get_area_logger",
"tensorflow.matmul",
"aimet_tensorflow.common.core.OpQuery",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"aimet_common.statistics_util.SvdStatistics.PerRankIndex",
"os.path.dirname",
"os.path.exists",
"numpy.transpose",
"tensorflow.compat.v1.Ses... | [((2354, 2407), 'aimet_common.utils.AimetLogger.get_area_logger', 'AimetLogger.get_area_logger', (['AimetLogger.LogAreas.Svd'], {}), '(AimetLogger.LogAreas.Svd)\n', (2381, 2407), False, 'from aimet_common.utils import AimetLogger\n'), ((6460, 6488), 'os.path.dirname', 'os.path.dirname', (['output_file'], {}), '(output_... |
# Module that contains the necessary functions to implement the ALCOVE model
# Author: <NAME>
import numpy as np
def hidden_layer_activations(current_stimulus, stimulus_representation, hidden_representation, alpha, r, q, c):
"""
Function that calculates the hidden layer activations (equation 1 in [Krus92]_)
... | [
"numpy.shape",
"numpy.zeros",
"numpy.exp"
] | [((5053, 5088), 'numpy.exp', 'np.exp', (['(phi * output_activations[K])'], {}), '(phi * output_activations[K])\n', (5059, 5088), True, 'import numpy as np\n'), ((7562, 7625), 'numpy.zeros', 'np.zeros', (['[num_hidden_layer_nodes, num_categories]'], {'dtype': 'float'}), '([num_hidden_layer_nodes, num_categories], dtype=... |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
class NTM_Memory(nn.Module):
def __init__(self, address_count, address_dimension, batch_size):
super(NTM_Memory, self).__init__()
self.initial_memory = nn.Parameter(torch.zeros(1, address_count, address_dimension... | [
"torch.cat",
"torch.nn.functional.softmax",
"torch.zeros",
"torch.nn.init.uniform",
"numpy.sqrt"
] | [((546, 597), 'torch.nn.init.uniform', 'nn.init.uniform', (['self.initial_memory', '(-stdev)', 'stdev'], {}), '(self.initial_memory, -stdev, stdev)\n', (561, 597), True, 'import torch.nn as nn\n'), ((975, 1003), 'torch.nn.functional.softmax', 'F.softmax', (['(β * result)'], {'dim': '(1)'}), '(β * result, dim=1)\n', (98... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import sys
class Gaussian_Process_Regression():
def __init__(self):
self.K = None
self.kernel_name1 = 'RBF'
self.a1_1 = 200.0
self.a2_1 = 20.0
self.a3_1 = 0.0
def xx2K(self,xn,xm):
... | [
"numpy.outer",
"scipy.stats.norm.pdf",
"sys.exit",
"scipy.stats.norm.cdf",
"numpy.exp",
"numpy.dot",
"numpy.linalg.solve",
"numpy.linalg.cholesky",
"numpy.diag",
"numpy.sqrt"
] | [((751, 777), 'numpy.linalg.cholesky', 'np.linalg.cholesky', (['self.K'], {}), '(self.K)\n', (769, 777), True, 'import numpy as np\n'), ((911, 939), 'numpy.linalg.solve', 'np.linalg.solve', (['L', '_ysample'], {}), '(L, _ysample)\n', (926, 939), True, 'import numpy as np\n'), ((952, 975), 'numpy.linalg.solve', 'np.lina... |
from __future__ import absolute_import
import os
import numpy as np
import contextlib
import warnings
import tempfile
import shutil
import argparse
import json
@contextlib.contextmanager
def fixed_seed(seed, strict=False):
"""Fix random seed to improve the reproducibility.
Args:
seed (float): Random... | [
"json.dump",
"numpy.random.seed",
"os.makedirs",
"shutil.rmtree",
"torch.manual_seed",
"torch.cuda.manual_seed",
"copy.copy",
"tempfile.mkdtemp",
"torch.cuda.is_available",
"random.seed",
"shutil.move",
"warnings.warn",
"os.path.join",
"os.listdir"
] | [((761, 778), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (772, 778), False, 'import random\n'), ((783, 803), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (797, 803), True, 'import numpy as np\n'), ((808, 831), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (82... |
import numpy as np
from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score
nmi = normalized_mutual_info_score
ari = adjusted_rand_score
def acc(y_true, y_pred):
"""
Calculate clustering accuracy. Require scikit-learn installed
# Arguments
y: true labels, numpy.array with sh... | [
"numpy.zeros"
] | [((587, 619), 'numpy.zeros', 'np.zeros', (['(D, D)'], {'dtype': 'np.int64'}), '((D, D), dtype=np.int64)\n', (595, 619), True, 'import numpy as np\n'), ((1026, 1058), 'numpy.zeros', 'np.zeros', (['(D, D)'], {'dtype': 'np.int64'}), '((D, D), dtype=np.int64)\n', (1034, 1058), True, 'import numpy as np\n')] |
#!/usr/bin/env python
from MonotonicTime import monotonic_time
import numpy as np
_current_time = monotonic_time
class PID(object):
def __init__(self, kp=0.3, ki=0.5, kd=0.002):
self.kp = kp # Constants (kp, ki, kd)
self.ki = ki
self.kd = kd
# Storing the errors
self.p... | [
"numpy.where",
"numpy.array"
] | [((330, 368), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {'dtype': 'float'}), '([0.0, 0.0, 0.0], dtype=float)\n', (338, 368), True, 'import numpy as np\n'), ((447, 485), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {'dtype': 'float'}), '([0.0, 0.0, 0.0], dtype=float)\n', (455, 485), True, 'import numpy as np\... |
import time
import cv2
import numpy as np
import tensorflow.compat.v1 as tf
import os
import sys
import argparse
import matplotlib.pyplot as plt
from sys import platform
from scipy.optimize import curve_fit
import json
from math import pi
from ball import balls
tf.disable_v2_behavior()
##### ball detection function... | [
"sys.path.append",
"cv2.line",
"json.load",
"cv2.circle",
"numpy.degrees",
"numpy.zeros",
"Release.pyopenpose.WrapperPython",
"numpy.mean",
"numpy.linalg.norm",
"numpy.array",
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.dot",
"cv2.perspectiveTransform",
"numpy.arccos",
"Release.py... | [((265, 289), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (287, 289), True, 'import tensorflow.compat.v1 as tf\n'), ((2312, 2333), 'numpy.linalg.norm', 'np.linalg.norm', (['(x - y)'], {}), '(x - y)\n', (2326, 2333), True, 'import numpy as np\n'), ((19798, 19836), 'numpy.conca... |
#!/usr/bin/env python3
import sys
import os
import itertools
import numpy as np
from scipy import signal, constants, fftpack
import pyaudio
from pydub import AudioSegment, exceptions
from pydub.utils import make_chunks
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.bac... | [
"PyQt5.QtCore.pyqtSignal",
"numpy.absolute",
"PyQt5.QtCore.QMutex",
"numpy.maximum",
"numpy.empty",
"numpy.allclose",
"os.walk",
"pydub.utils.make_chunks",
"numpy.linalg.norm",
"scipy.signal.fftconvolve",
"pydub.AudioSegment.from_file",
"PyQt5.QtCore.QWaitCondition",
"os.path.join",
"numpy... | [((958, 975), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['float'], {}), '(float)\n', (968, 975), False, 'from PyQt5.QtCore import Qt, QThread, pyqtSignal, QMutex, QWaitCondition\n'), ((998, 1010), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (1008, 1010), False, 'from PyQt5.QtCore import Qt, QThread, pyqt... |
import numpy as np
def tensorize(x):
return np.squeeze(np.asfarray(x))
# ####### HELPER METHODS #########
# implement Stochastic Gradient Descent to be used by our Network for training
def sgd(net, loss, T, batch_size=1, max_iter=1, learning_rate_init=1e-3,
tol=1e-6, n_iter_no_change=10):
N = len(T['... | [
"numpy.asfarray",
"numpy.random.random",
"numpy.zeros"
] | [((612, 630), 'numpy.zeros', 'np.zeros', (['max_iter'], {}), '(max_iter)\n', (620, 630), True, 'import numpy as np\n'), ((60, 74), 'numpy.asfarray', 'np.asfarray', (['x'], {}), '(x)\n', (71, 74), True, 'import numpy as np\n'), ((346, 365), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (362, 365), Tru... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Utilities for spectral processing'''
import warnings
import numpy as np
import scipy
import six
from . import time_frequency
from .fft import get_fftlib
from .._cache import cache
from .. import util
from ..util.exceptions import ParameterError
from ..filters import ge... | [
"numpy.abs",
"numpy.maximum",
"numpy.power",
"numpy.asarray",
"numpy.square",
"numpy.zeros",
"numpy.angle",
"six.callable",
"warnings.warn",
"numpy.issubdtype"
] | [((8875, 8917), 'numpy.zeros', 'np.zeros', (['expected_signal_len'], {'dtype': 'dtype'}), '(expected_signal_len, dtype=dtype)\n', (8883, 8917), True, 'import numpy as np\n'), ((13171, 13180), 'numpy.abs', 'np.abs', (['D'], {}), '(D)\n', (13177, 13180), True, 'import numpy as np\n'), ((15913, 15926), 'numpy.asarray', 'n... |
"""
@brief test log(time=1s)
"""
import os
import unittest
import pandas
import numpy
from pyquickhelper.loghelper import fLOG, CustomLog
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyquickhelper.pycode import fix_tkinter_issues_virtualenv
from pyensae.graphhelper import Corrplot
class Tes... | [
"unittest.main",
"matplotlib.pyplot.show",
"os.path.join",
"matplotlib.pyplot.close",
"pyensae.graphhelper.Corrplot",
"pyquickhelper.loghelper.fLOG",
"numpy.random.random",
"pyquickhelper.pycode.fix_tkinter_issues_virtualenv",
"pyquickhelper.loghelper.CustomLog",
"matplotlib.pyplot.subplots",
"p... | [((1586, 1601), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1599, 1601), False, 'import unittest\n'), ((385, 457), 'pyquickhelper.loghelper.fLOG', 'fLOG', (['__file__', 'self._testMethodName'], {'OutputPrint': "(__name__ == '__main__')"}), "(__file__, self._testMethodName, OutputPrint=__name__ == '__main__')\n... |
import torch
import torch.nn as nn
from torch.optim import SGD, Adam
from torch.optim.lr_scheduler import LambdaLR, StepLR
from pytorch_lightning.core import LightningModule
import MinkowskiEngine as ME
from examples.minkunet_sparse import MinkUNet34C, MinkUNet14A, MinkUNet34CShallow
# from examples.minkunetodd import... | [
"examples.BaseSegLightning.BaseSegmentationModule.add_argparse_args",
"examples.minkunet_sparse.MinkUNet34C",
"torch.bmm",
"torch.nn.Sequential",
"examples.basic_blocks.norm_layer",
"torch.load",
"torch.nn.Conv1d",
"torch.cat",
"numpy.array",
"examples.basic_blocks.MLP",
"MinkowskiEngine.TensorF... | [((1547, 1576), 'torch.nn.Sequential', 'nn.Sequential', (['*seg_head_list'], {}), '(*seg_head_list)\n', (1560, 1576), True, 'import torch.nn as nn\n'), ((2356, 2564), 'MinkowskiEngine.TensorField', 'ME.TensorField', ([], {'features': 'lats', 'coordinates': 'coords', 'quantization_mode': 'ME.SparseTensorQuantizationMode... |
import logging
import cv2
import math
import random
import numpy as np
from collections import defaultdict
from itertools import combinations
from opensfm.unionfind import UnionFind
logger = logging.getLogger(__name__)
def load_pairwise_transforms(dataset, images):
pairs = {}
for im1 in images:
tr... | [
"opensfm.unionfind.UnionFind",
"numpy.asarray",
"random.choices",
"numpy.identity",
"collections.defaultdict",
"itertools.combinations",
"cv2.Rodrigues",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot",
"logging.getLogger"
] | [((195, 222), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (212, 222), False, 'import logging\n'), ((13083, 13094), 'opensfm.unionfind.UnionFind', 'UnionFind', ([], {}), '()\n', (13092, 13094), False, 'from opensfm.unionfind import UnionFind\n'), ((25233, 25245), 'numpy.array', 'np.arra... |
"""
Based on HybridZonotope from DfifAI (https://github.com/eth-sri/diffai/blob/master/ai.py)
"""
import numpy as np
import torch
import torch.nn.functional as F
def clamp_image(x, eps):
min_x = torch.clamp(x-eps, min=0)
max_x = torch.clamp(x+eps, max=1)
x_center = 0.5 * (max_x + min_x)
x_beta = 0.5 *... | [
"torch.isnan",
"torch.eye",
"torch.where",
"torch.nn.functional.avg_pool2d",
"torch.nn.functional.conv2d",
"torch.nn.functional.cross_entropy",
"torch.cat",
"torch.clamp",
"torch.max",
"torch.arange",
"numpy.arange",
"torch.nn.functional.relu",
"torch.zeros",
"torch.abs",
"torch.min"
] | [((201, 228), 'torch.clamp', 'torch.clamp', (['(x - eps)'], {'min': '(0)'}), '(x - eps, min=0)\n', (212, 228), False, 'import torch\n'), ((239, 266), 'torch.clamp', 'torch.clamp', (['(x + eps)'], {'max': '(1)'}), '(x + eps, max=1)\n', (250, 266), False, 'import torch\n'), ((4848, 4892), 'torch.nn.functional.avg_pool2d'... |
# Copyright 2021 <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 applicable law or agreed to in writing, software... | [
"matplotlib.pylab.savefig",
"scipy.optimize.minimize",
"nltk.stem.porter.PorterStemmer",
"matplotlib.pylab.ylabel",
"matplotlib.pylab.plot",
"numpy.array",
"matplotlib.pylab.tight_layout",
"glob.glob",
"collections.Counter",
"matplotlib.pylab.xlabel",
"matplotlib.pylab.grid",
"microtc.textmode... | [((879, 1123), 'microtc.textmodel.TextModel', 'TextModel', ([], {'num_option': 'OPTION_NONE', 'usr_option': 'OPTION_NONE', 'url_option': 'OPTION_NONE', 'emo_option': 'OPTION_NONE', 'hashtag_option': 'OPTION_NONE', 'ent_option': 'OPTION_NONE', 'lc': '(False)', 'del_dup': '(False)', 'del_punc': '(False)', 'del_diac': '(F... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 27 13:57:14 2021
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from dataclasses import dataclass, field
class Tensor:
""" Creates a tensor object with apropriate 3x3 size. It Starts with 3x3 zeros,
if only on... | [
"numpy.trace",
"matplotlib.pyplot.plot",
"numpy.deg2rad",
"numpy.zeros",
"numpy.ones",
"dataclasses.field",
"numpy.tan",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"numpy.linalg.det"
] | [((1818, 1845), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (1823, 1845), False, 'from dataclasses import dataclass, field\n'), ((1923, 1939), 'numpy.deg2rad', 'np.deg2rad', (['beta'], {}), '(beta)\n', (1933, 1939), True, 'import numpy as np\n'), ((446, 468), 'numpy.zero... |
# coding: utf-8
import os
import cv2
import warnings
import numpy as np
from .drawing import cv2WHITE
from ..utils.generic_utils import filenaming
from ..utils._colorings import toBLUE
def cv2paste(bg_img, fg_img, points=(0,0), inplace=False):
"""Pastes ``fg_image`` into ``bg_image``
Args:
bg_img... | [
"cv2.resize",
"numpy.zeros_like",
"cv2.imwrite",
"numpy.asarray",
"cv2.threshold",
"cv2.fillPoly",
"numpy.insert",
"cv2.imread",
"os.path.splitext",
"warnings.warn",
"cv2.findContours"
] | [((4151, 4212), 'cv2.resize', 'cv2.resize', ([], {'src': 'src', 'dsize': 'dsize', 'interpolation': 'interpolation'}), '(src=src, dsize=dsize, interpolation=interpolation)\n', (4161, 4212), False, 'import cv2\n'), ((5763, 5819), 'cv2.imread', 'cv2.imread', ([], {'filename': 'in_path', 'flags': 'cv2.IMREAD_UNCHANGED'}), ... |
""" Tests for molecule creation and file i/o
"""
import io
import os
import subprocess
from future.utils import PY2, native_str
from builtins import str
import collections
import pathlib
import gzip
import bz2
import pickle
import numpy
import pytest
import moldesign as mdt
mdt.compute.config.engine_type = 'docker'
... | [
"moldesign.from_inchi",
"moldesign.interfaces.mol_to_pybel",
"pytest.xfail",
"moldesign.interfaces.mol_to_parmed",
"moldesign.build_assembly",
"pytest.mark.parametrize",
"pytest.mark.skip",
"moldesign.from_name",
"moldesign.Molecule",
"moldesign.read",
"numpy.identity",
"future.utils.native_st... | [((3216, 3264), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""suffix"""', "['gz', 'bz2']"], {}), "('suffix', ['gz', 'bz2'])\n", (3239, 3264), False, 'import pytest\n'), ((5030, 5085), 'pytest.mark.skip', 'pytest.mark.skip', (['"""Takes over 10 minutes right now ..."""'], {}), "('Takes over 10 minutes righ... |
from qiskit import *
from qiskit.circuit.library.standard_gates import SwapGate,CU1Gate,XGate,U1Gate
from math import pi,sqrt
from qiskit.quantum_info.operators import Operator
import numpy as np
def ini(circ,qr,ipt):
# Input binary form, and append [0] ahead for qr1 block.
for i in range(len(ipt)):
... | [
"qiskit.circuit.library.standard_gates.SwapGate",
"qiskit.circuit.library.standard_gates.XGate",
"math.sqrt",
"numpy.identity",
"qiskit.circuit.library.standard_gates.U1Gate",
"qiskit.circuit.library.standard_gates.CU1Gate",
"qiskit_code.Grover.check"
] | [((1794, 1828), 'qiskit_code.Grover.check', 'check', (['query', 'criteria', 'ancilla', 'n'], {}), '(query, criteria, ancilla, n)\n', (1799, 1828), False, 'from qiskit_code.Grover import check\n'), ((538, 552), 'numpy.identity', 'np.identity', (['N'], {}), '(N)\n', (549, 552), True, 'import numpy as np\n'), ((834, 847),... |
import abc
import typing
import numpy as np
from src.utils.utilities import rolling_window
from src.pose_estimation import PoseEstimation
class Feature(abc.ABC):
"""
Abstract Base Class to define a common interface for classes that implement
one or more related features
"""
# each subclass need... | [
"numpy.full",
"numpy.pad",
"numpy.zeros_like",
"numpy.isnan",
"numpy.errstate",
"numpy.ma.masked_array"
] | [((4442, 4476), 'numpy.full', 'np.full', (['self._poses.num_frames', '(1)'], {}), '(self._poses.num_frames, 1)\n', (4449, 4476), True, 'import numpy as np\n'), ((5720, 5749), 'numpy.zeros_like', 'np.zeros_like', (['feature_values'], {}), '(feature_values)\n', (5733, 5749), True, 'import numpy as np\n'), ((7654, 7683), ... |
import numpy as np
from cifar_loader import cifar10
from solver.solvers import CNN
import atexit
import matplotlib.pyplot as plt
def exit_handler():
print("Saving weights...")
print(weights["W1"][0,0,0,0])
np.save('train_weights.npy',weights)
def main():
train = True
# Set weights to the name of the ... | [
"cifar_loader.cifar10.load_training_data",
"solver.solvers.CNN",
"numpy.save",
"atexit.register",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"cifar_loader.cifar10.load_class_names",
"matplotlib.pyplot.barh",
"numpy.max",
"numpy.mean",
"numpy.min",
"matplotlib.pyplot.figure",
"nump... | [((219, 256), 'numpy.save', 'np.save', (['"""train_weights.npy"""', 'weights'], {}), "('train_weights.npy', weights)\n", (226, 256), True, 'import numpy as np\n'), ((430, 466), 'cifar_loader.cifar10.maybe_download_and_extract', 'cifar10.maybe_download_and_extract', ([], {}), '()\n', (464, 466), False, 'from cifar_loade... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.