code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import os
import torch
import torchvision
import torchvision.transforms as T
import numpy as np
from scipy.sparse import coo_matrix
def load_numpy_data(name,
data_path,
logger):
if name == "digits":
data_names = ["mnist", "mnist_m", "svhn", "synth_digits"]
... | [
"numpy.load",
"os.path.exists",
"numpy.arange",
"numpy.random.choice",
"os.path.join",
"numpy.random.shuffle"
] | [((4699, 4721), 'numpy.arange', 'np.arange', (['inputs_size'], {}), '(inputs_size)\n', (4708, 4721), True, 'import numpy as np\n'), ((4730, 4761), 'numpy.random.shuffle', 'np.random.shuffle', (['random_order'], {}), '(random_order)\n', (4747, 4761), True, 'import numpy as np\n'), ((1046, 1081), 'numpy.arange', 'np.aran... |
''' Testing module for nibetaseries.interfaces.nilearn '''
import nibabel as nib
import numpy as np
import pandas as pd
import os
from ..nilearn import AtlasConnectivity, CensorVolumes
def test_censor_volumes(tmp_path, betaseries_file, brainmask_file):
outlier_file = tmp_path / 'betaseries_outlier.nii.gz'
#... | [
"pandas.DataFrame",
"numpy.fill_diagonal",
"os.remove",
"pandas.testing.assert_frame_equal",
"numpy.log",
"nibabel.load",
"pandas.read_csv"
] | [((1173, 1204), 'numpy.fill_diagonal', 'np.fill_diagonal', (['pcorr', 'np.NaN'], {}), '(pcorr, np.NaN)\n', (1189, 1204), True, 'import numpy as np\n'), ((1265, 1316), 'pandas.DataFrame', 'pd.DataFrame', (['pcorr'], {'index': 'regions', 'columns': 'regions'}), '(pcorr, index=regions, columns=regions)\n', (1277, 1316), T... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 7 15:49:19 2020
@author: <NAME>
"""
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
import numpy as np
from functools import reduce
from itertools import combinations
from scipy.optimize import bisect, minimize
f... | [
"sklearn.utils.check_random_state",
"numpy.sum",
"numpy.abs",
"numpy.unique",
"matplotlib.pyplot.close",
"sklearn.metrics.euclidean_distances",
"numpy.max",
"numpy.linspace",
"numpy.random.choice",
"numpy.arccos",
"matplotlib.pyplot.subplots",
"numpy.vectorize",
"numpy.median",
"numpy.min"... | [((940, 986), 'numpy.linspace', 'np.linspace', (['scale_min', 'scale_max', 'granularity'], {}), '(scale_min, scale_max, granularity)\n', (951, 986), True, 'import numpy as np\n'), ((1000, 1031), 'numpy.array', 'np.array', (['([scale] * granularity)'], {}), '([scale] * granularity)\n', (1008, 1031), True, 'import numpy ... |
#! /usr/bin/env python3
"""
Filtering.py COPYRIGHT FUJITSU LIMITED 2021
"""
# -*- coding: utf-8 -*-
import argparse
import os
import sys
import traceback
import json
import os
import re
import logging
import unicodedata
import numpy as np
import pandas as pd
import multiprocessing
import itertools
from gensim.models ... | [
"numpy.load",
"numpy.save",
"json.load",
"argparse.ArgumentParser",
"os.path.basename",
"pandas.read_csv",
"os.path.exists",
"itertools.chain.from_iterable"
] | [((2664, 2708), 'numpy.load', 'np.load', ([], {'file': 'vector_file', 'allow_pickle': '(True)'}), '(file=vector_file, allow_pickle=True)\n', (2671, 2708), True, 'import numpy as np\n'), ((2793, 2826), 'numpy.save', 'np.save', (['output_file', 'filterddata'], {}), '(output_file, filterddata)\n', (2800, 2826), True, 'imp... |
import matplotlib
import numpy as np
def polyfit(dates, levels, p):
"""Returns a tuple (first entry: polynomial of degree p that best fits the data, second entry: shift in dates"""
# Convert dates to floats
x = matplotlib.dates.date2num(dates)
# Find coefficients of best-fit polynomial f(x) of degree... | [
"matplotlib.dates.date2num",
"numpy.poly1d",
"numpy.polyfit"
] | [((225, 257), 'matplotlib.dates.date2num', 'matplotlib.dates.date2num', (['dates'], {}), '(dates)\n', (250, 257), False, 'import matplotlib\n'), ((337, 368), 'numpy.polyfit', 'np.polyfit', (['(x - x[0])', 'levels', 'p'], {}), '(x - x[0], levels, p)\n', (347, 368), True, 'import numpy as np\n'), ((380, 398), 'numpy.poly... |
import os
import sys
from matplotlib import colors
sys.path.append(os.getcwd())
import pickle
import json
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import DivergingNorm
import iris
import iris.plot as iplt
import restools
from papers.none2021_ecrad.data import Summar... | [
"matplotlib.pyplot.tight_layout",
"papers.none2021_ecrad.extensions.get_ifs_rel_diff",
"matplotlib.pyplot.show",
"os.path.join",
"matplotlib.pyplot.get_cmap",
"os.getcwd",
"matplotlib.pyplot.gca",
"matplotlib.ticker.MaxNLocator",
"comsdk.comaux.load_from_json",
"matplotlib.pyplot.colorbar",
"mat... | [((68, 79), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (77, 79), False, 'import os\n'), ((2138, 2181), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""resources/default.mplstyle"""'], {}), "('resources/default.mplstyle')\n", (2151, 2181), True, 'import matplotlib.pyplot as plt\n'), ((2197, 2220), 'comsdk.comaux.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import annotations
from enum import Enum
from typing import Optional
from typing import Union
import numpy as np
import torch.nn.functional as F
from torch import Tensor
from onevision.cv.core.image import get_image_size
from onevision.cv.core.i... | [
"numpy.pad",
"onevision.cv.core.image.is_channel_first",
"onevision.cv.core.image.get_image_size",
"onevision.type.to_size",
"torch.nn.functional.pad"
] | [((3469, 3490), 'onevision.cv.core.image.get_image_size', 'get_image_size', (['image'], {}), '(image)\n', (3483, 3490), False, 'from onevision.cv.core.image import get_image_size\n'), ((3504, 3521), 'onevision.type.to_size', 'to_size', (['pad_size'], {}), '(pad_size)\n', (3511, 3521), False, 'from onevision.type import... |
import numpy as np
import math
import scipy
from autodp import rdp_bank, dp_bank, fdp_bank, utils
from autodp.mechanism_zoo import LaplaceMechanism, LaplaceSVT_Mechanism,StageWiseMechanism
from autodp.transformer_zoo import Composition
import matplotlib.pyplot as plt
from scipy.stats import norm, laplace
from scipy.spe... | [
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.figure",
"numpy.random.normal",
"autodp.mechanism_zoo.GaussianSVT_Mechanism",
"autodp.mechanism_zoo.ExactGaussianMechanism",
"matplotlib.font_manager.FontProperties",
"autodp.mechanism_zoo.StageWiseMechanism",
"matplotlib.pyplot.yticks",
"math.log",
"... | [((1169, 1179), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (1176, 1179), True, 'import numpy as np\n'), ((1627, 1638), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1635, 1638), True, 'import numpy as np\n'), ((1649, 1680), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'sigma_1'}), '(scale=sigma_1... |
################################################################################
################# Model Module Tests #################
################################################################################
import os
import sys
import unittest
import sklearn
import numpy as np
####... | [
"unittest.main",
"sklearn.svm.SVR",
"sklearn.ensemble.AdaBoostRegressor",
"sklearn.ensemble.RandomForestRegressor",
"sklearn.linear_model.Lasso",
"numpy.random.randint",
"sklearn.cross_decomposition.PLSRegression",
"sklearn.base.is_regressor",
"numpy.random.ranf",
"sklearn.ensemble.BaggingRegresso... | [((10482, 10508), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (10495, 10508), False, 'import unittest\n'), ((816, 840), 'numpy.random.ranf', 'np.random.ranf', ([], {'size': '(100)'}), '(size=100)\n', (830, 840), True, 'import numpy as np\n'), ((866, 889), 'numpy.random.ranf', 'np.ra... |
import Sofa
import SofaTest
from SofaTest.Macro import *
import math
from Compliant import Frame, Vec, Tools, Control, StructuralAPI
from SofaPython import Quaternion
import numpy
import random
import sys
class Shared:
pass
global shared
shared = Shared()
dir = Tools.path( __file__ )
def createScene(node):
... | [
"math.atan",
"random.randint",
"SofaPython.Quaternion.from_euler",
"math.tan",
"numpy.allclose",
"Compliant.Frame.Frame",
"Compliant.Tools.path",
"Compliant.Tools.scene",
"Compliant.StructuralAPI.RigidBody"
] | [((272, 292), 'Compliant.Tools.path', 'Tools.path', (['__file__'], {}), '(__file__)\n', (282, 292), False, 'from Compliant import Frame, Vec, Tools, Control, StructuralAPI\n'), ((564, 581), 'Compliant.Tools.scene', 'Tools.scene', (['node'], {}), '(node)\n', (575, 581), False, 'from Compliant import Frame, Vec, Tools, C... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
"""
Example of s... | [
"numpy.random.normal"
] | [((421, 456), 'numpy.random.normal', 'np.random.normal', (['(128)', '(60)', '(20, 20)'], {}), '(128, 60, (20, 20))\n', (437, 456), True, 'import numpy as np\n')] |
import numpy as np
class VolatilityExtractor:
name = "volatility"
def __init__(
self,
dataset: np.ndarray,
price_changes: np.ndarray,
period: int = 60,
) -> None:
self.dataset = dataset
self.period = period
number_of_samples = len(price_changes)
... | [
"numpy.zeros",
"numpy.var"
] | [((342, 372), 'numpy.zeros', 'np.zeros', (['(number_of_samples,)'], {}), '((number_of_samples,))\n', (350, 372), True, 'import numpy as np\n'), ((491, 521), 'numpy.var', 'np.var', (['price_changes[start:i]'], {}), '(price_changes[start:i])\n', (497, 521), True, 'import numpy as np\n')] |
from scipy.io import loadmat, savemat
import matplotlib.pyplot as plt
from FCMyoMapNet import UNet
import torch
from torch.autograd import Variable
import numpy as np
TimeScaling = 1000;
TimeScalingFactor =1/TimeScaling
T1sigNum = 4
T1sigAndTi = T1sigNum*2;
# Select one model
modelName = "MyoMapNet_4PreandPostGd" #M... | [
"scipy.io.loadmat",
"numpy.zeros",
"torch.FloatTensor",
"FCMyoMapNet.UNet",
"torch.device",
"torch.nn.DataParallel",
"matplotlib.pyplot.subplots"
] | [((528, 547), 'FCMyoMapNet.UNet', 'UNet', (['T1sigAndTi', '(1)'], {}), '(T1sigAndTi, 1)\n', (532, 547), False, 'from FCMyoMapNet import UNet\n'), ((2277, 2295), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {}), '(1, 3)\n', (2289, 2295), True, 'import matplotlib.pyplot as plt\n'), ((561, 580), 'torch.d... |
# 打印坐标
from t1 import Test1
import numpy as np
import matplotlib.pyplot as plt
co1 = Test1().nums()
'''随机生成20个数字,调用已经写好的t1模块'''
class Test2:
def col(co):
lst = []
for i in range(0, len(co), 2):
lst.append((co[i], co[i + 1]))
print(lst)
# @staticmethod
def mat(lst1):
... | [
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show",
"numpy.array",
"t1.Test1"
] | [((86, 93), 't1.Test1', 'Test1', ([], {}), '()\n', (91, 93), False, 'from t1 import Test1\n'), ((465, 476), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (473, 476), True, 'import numpy as np\n'), ((490, 501), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (498, 501), True, 'import numpy as np\n'), ((511, 530), 'm... |
import argparse
import multiprocessing
import os.path
import numpy as np
import open3d as o3d
import ast
from pykdtree.kdtree import KDTree
PLANAR_IDS = {
6: 1,
7: 1,
8: 2
}
def visualize_pcd_labels(pcd: o3d.geometry.PointCloud, labels: np.array, filename: str = None):
colors = np.concatenate([np.a... | [
"numpy.load",
"argparse.ArgumentParser",
"numpy.argmax",
"open3d.geometry.PointCloud",
"open3d.visualization.draw_geometries",
"numpy.unique",
"multiprocessing.cpu_count",
"open3d.io.write_point_cloud",
"numpy.apply_along_axis",
"numpy.max",
"numpy.save",
"numpy.asarray",
"open3d.io.read_poi... | [((395, 420), 'open3d.geometry.PointCloud', 'o3d.geometry.PointCloud', ([], {}), '()\n', (418, 420), True, 'import open3d as o3d\n'), ((569, 611), 'open3d.utility.Vector3dVector', 'o3d.utility.Vector3dVector', (['colors[labels]'], {}), '(colors[labels])\n', (595, 611), True, 'import open3d as o3d\n'), ((909, 976), 'num... |
import pdb
import torch
import numpy as np
import torchvision.transforms as T
import scipy.signal as signal
class Normalize(object):
def __init__(self, min_v=None, max_v=None, apply_log=False):
self.fn = lambda x: (isinstance(x, torch.Tensor) and x.log() or np.log(x)) \
... | [
"numpy.quantile",
"numpy.log",
"scipy.signal.wiener",
"numpy.ones",
"numpy.arange"
] | [((794, 830), 'numpy.quantile', 'np.quantile', (['x', '[0.25, 0.75]'], {'axis': '(0)'}), '(x, [0.25, 0.75], axis=0)\n', (805, 830), True, 'import numpy as np\n'), ((2757, 2816), 'numpy.quantile', 'np.quantile', (['x[:, self.num_ids]', '[self.q1, self.q2]'], {'axis': '(0)'}), '(x[:, self.num_ids], [self.q1, self.q2], ax... |
import matplotlib.pyplot as plt
import numpy as np
import codecs
from subprocess import run
import os
import networkx as nx
np.set_printoptions(precision=2, suppress=True)
def run_mfinder(N_nw):
for i in range(N_nw):
fname = 'seed={:02d}.edges'.format(i)
if os.path.isfile(fname):
ru... | [
"matplotlib.pyplot.title",
"subprocess.run",
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"networkx.draw_networkx_edges",
"codecs.open",
"os.getcwd",
"numpy.std",
"os.path.isfile",
"numpy.mean",
"numpy.arange",
"networkx.draw_networkx_nodes",
"numpy.array",
"networkx.DiGraph",
"ma... | [((126, 173), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'suppress': '(True)'}), '(precision=2, suppress=True)\n', (145, 173), True, 'import numpy as np\n'), ((5144, 5155), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5153, 5155), False, 'import os\n'), ((2886, 2914), 'matplotlib.pyplot.... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains utilities to run the test suite.
"""
import numpy as np
import mskpy
class TestInstruments():
def test_irac(self, test=True):
import astropy.units as u
from mskpy.util import planck
from mskpy.instrum... | [
"mskpy.instruments.IRAC",
"numpy.allclose",
"mskpy.util.planck"
] | [((353, 359), 'mskpy.instruments.IRAC', 'IRAC', ([], {}), '()\n', (357, 359), False, 'from mskpy.instruments import IRAC\n'), ((2346, 2375), 'numpy.allclose', 'np.allclose', (['K', 'K0'], {'rtol': 'rtol'}), '(K, K0, rtol=rtol)\n', (2357, 2375), True, 'import numpy as np\n'), ((1071, 1106), 'mskpy.util.planck', 'planck'... |
from __future__ import division
import pandas as pd
from pyteomics import pepxml, achrom, auxiliary as aux, mass, fasta, mzid, parser
import numpy as np
import random
from catboost import CatBoostClassifier
from sklearn.model_selection import train_test_split
import os
from collections import Counter, defaultdict
from ... | [
"os.mkdir",
"numpy.sum",
"numpy.random.seed",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"collections.defaultdict",
"numpy.histogram",
"numpy.arange",
"catboost.CatBoostClassifier",
"os.path.join",
"warnings.simplefilter",
"scipy.stats.scoreatpercentile",
"pyteomics.achro... | [((552, 579), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (569, 579), False, 'import logging\n'), ((1011, 1046), 'pyteomics.auxiliary.qvalues', 'aux.qvalues', (['df'], {'correction': '(1)'}), '(df, correction=1, **kw)\n', (1022, 1046), True, 'from pyteomics import pepxml, achrom, auxil... |
from __future__ import annotations
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import pinv
from IMLearn.metrics.loss_functions import mean_square_error
class LinearRegression(BaseEstimator):
"""
Linear Regression Estimator
Solving Ordinary Least Squa... | [
"numpy.shape",
"numpy.linalg.pinv"
] | [((2221, 2238), 'numpy.linalg.pinv', 'np.linalg.pinv', (['X'], {}), '(X)\n', (2235, 2238), True, 'import numpy as np\n'), ((1938, 1949), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (1946, 1949), True, 'import numpy as np\n')] |
import matplotlib.pyplot as plt
import numpy as np
def grid2contour(grid):
'''
grid--image_grid used to show deform field
type: torch.Tensor, shape: (h, w, 2), value range:(-1, 1)
'''
x = np.arange(-1, 1, 2/ grid.shape[0])
y = np.arange(-1, 1, 2 / grid.shape[1])
X, Y = np.meshgrid(x, y)
... | [
"matplotlib.pyplot.title",
"numpy.stack",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.quiver",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.contour",
"numpy.random.rand",
"matplotlib.pyplot.xticks"
] | [((209, 244), 'numpy.arange', 'np.arange', (['(-1)', '(1)', '(2 / grid.shape[0])'], {}), '(-1, 1, 2 / grid.shape[0])\n', (218, 244), True, 'import numpy as np\n'), ((252, 287), 'numpy.arange', 'np.arange', (['(-1)', '(1)', '(2 / grid.shape[1])'], {}), '(-1, 1, 2 / grid.shape[1])\n', (261, 287), True, 'import numpy as n... |
import numpy as np
from numpy import random as rand
from scipy import sparse as sps
from sklearn.datasets import load_svmlight_file
from sklearn.datasets import dump_svmlight_file
import os
import time as tm
# DO NOT CHANGE THE NAME OF THIS METHOD OR ITS INPUT OUTPUT BEHAVtst_X_Xftst_X_Xftst_X_XfIOR
# INPUT... | [
"sklearn.datasets.dump_svmlight_file",
"numpy.zeros",
"os.system",
"scipy.sparse.csr_matrix",
"sklearn.datasets.load_svmlight_file",
"numpy.vstack"
] | [((1562, 1601), 'os.system', 'os.system', (['"""bash shallow/sample_run.sh"""'], {}), "('bash shallow/sample_run.sh')\n", (1571, 1601), False, 'import os\n'), ((1661, 1746), 'sklearn.datasets.load_svmlight_file', 'load_svmlight_file', (["('%s.txt' % filename)"], {'multilabel': '(True)', 'n_features': 'L', 'offset': '(1... |
# Basic packages
import numpy as np
import scipy as scipy
import os
import sys
import json
import datetime
import skimage.draw
import cv2
import matplotlib.pyplot as plt
from imgaug import augmenters as iaa # For image augmentation
#%cd drive/MyDrive/
# To find the path for Mask_RCNN
sys.path.insert(1, 'drive/My... | [
"numpy.array",
"os.path.join",
"sys.path.insert"
] | [((292, 337), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""drive/MyDrive/Mask_RCNN"""'], {}), "(1, 'drive/MyDrive/Mask_RCNN')\n", (307, 337), False, 'import sys\n'), ((1075, 1108), 'os.path.join', 'os.path.join', (['dataset_dir', 'subset'], {}), '(dataset_dir, subset)\n', (1087, 1108), False, 'import os\n'), ((56... |
from flask import Flask, request, jsonify
from flask_cors import CORS
from tensorflow import keras
import pickle
import json
import numpy as np
app = Flask(__name__)
CORS(app)
with open("intents.json") as file:
data = json.load(file)
@app.post('/predict')
def predict():
userText = request.ge... | [
"json.load",
"tensorflow.keras.models.load_model",
"numpy.argmax",
"flask_cors.CORS",
"flask.Flask",
"flask.jsonify",
"pickle.load",
"numpy.random.choice",
"flask.request.get_json"
] | [((158, 173), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (163, 173), False, 'from flask import Flask, request, jsonify\n'), ((175, 184), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (179, 184), False, 'from flask_cors import CORS\n'), ((235, 250), 'json.load', 'json.load', (['file'], {}), '(fil... |
import numpy as np
import cv2
from numba import njit
@njit
def njit_thin(points, maps):
result = maps.copy()
h, w = maps.shape[:2]
for _ in range(len(points[0])):
x = points[0][_]
y = points[1][_]
if x > 0:
a = maps[x-1, y]
if a > 0:
result[x... | [
"numpy.where"
] | [((886, 907), 'numpy.where', 'np.where', (['(result == 0)'], {}), '(result == 0)\n', (894, 907), True, 'import numpy as np\n')] |
"""Directly copied from the spacy-transformers library https://raw.githubusercontent.com/explosion/spacy-transformers/master/spacy_transformers/align.py
Pasted here to avoid clashing torch versions
"""
import numpy
from typing import cast, Dict, List, Tuple, Callable, Set, Optional
from spacy_alignments.tokenizations ... | [
"spacy_alignments.tokenizations.get_alignments",
"numpy.array"
] | [((1783, 1811), 'numpy.array', 'numpy.array', (['flat'], {'dtype': '"""i"""'}), "(flat, dtype='i')\n", (1794, 1811), False, 'import numpy\n'), ((1813, 1844), 'numpy.array', 'numpy.array', (['lengths'], {'dtype': '"""i"""'}), "(lengths, dtype='i')\n", (1824, 1844), False, 'import numpy\n'), ((4362, 4403), 'spacy_alignme... |
#!/usr/bin/env python
"""Check the WeightedSum transformation"""
import numpy as N
from load import ROOT as R
from gna.constructors import Points, stdvector
from gna.env import env
"""Initialize inpnuts"""
arr1 = N.arange(0, 5)
arr2 = -arr1
print( 'Data1:', arr1 )
print( 'Data2:', arr2 )
labels = [ 'arr1', 'arr2' ]... | [
"gna.constructors.Points",
"gna.env.env.globalns.printparameters",
"gna.env.env.globalns.defparameter",
"gna.constructors.stdvector",
"numpy.arange"
] | [((216, 230), 'numpy.arange', 'N.arange', (['(0)', '(5)'], {}), '(0, 5)\n', (224, 230), True, 'import numpy as N\n'), ((381, 442), 'gna.env.env.globalns.defparameter', 'env.globalns.defparameter', (['weights[0]'], {'central': '(1.0)', 'sigma': '(0.1)'}), '(weights[0], central=1.0, sigma=0.1)\n', (406, 442), False, 'fro... |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 10:43, 08/07/2021 %
# ... | [
"numpy.multiply",
"numpy.maximum",
"numpy.tanh",
"numpy.power",
"numpy.where",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"numpy.concatenate"
] | [((990, 1003), 'numpy.maximum', 'maximum', (['(0)', 'x'], {}), '(0, x)\n', (997, 1003), False, 'from numpy import where, exp, maximum, power, multiply, concatenate, sin, cos, pi\n'), ((1030, 1039), 'numpy.tanh', 'nptanh', (['x'], {}), '(x)\n', (1036, 1039), True, 'from numpy import tanh as nptanh\n'), ((1175, 1201), 'n... |
import numpy as np
from typing import List
from common import almost_equal
def correlation(x: List[int], y: List[int]) -> float:
assert len(x) == len(y)
n = len(x)
x_mean, y_mean = np.mean(x), np.mean(y)
x_std_dev, y_std_dev = np.std(x), np.std(y)
numerator = sum([x_i * y_i for (x_i, y_i) in zi... | [
"numpy.std",
"numpy.corrcoef",
"numpy.mean"
] | [((197, 207), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (204, 207), True, 'import numpy as np\n'), ((209, 219), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (216, 219), True, 'import numpy as np\n'), ((247, 256), 'numpy.std', 'np.std', (['x'], {}), '(x)\n', (253, 256), True, 'import numpy as np\n'), ((258, 267),... |
"""
Combine metric_generator and attract_repel_clusterer to derive a low dimensional layout
"""
from . import local_files
import numpy as np
import jp_proxy_widget
from jp_doodle.data_tables import widen_notebook
from jp_doodle import dual_canvas
from IPython.display import display
required_javascript_modules = [
... | [
"jp_proxy_widget.JSProxyWidget",
"jp_doodle.nd_frame.swatch3d",
"jp_doodle.dual_canvas.load_requirements",
"numpy.zeros",
"jp_doodle.data_tables.widen_notebook",
"IPython.display.display",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.sqrt"
] | [((1140, 1192), 'jp_doodle.dual_canvas.load_requirements', 'dual_canvas.load_requirements', (['widget'], {'silent': 'silent'}), '(widget, silent=silent)\n', (1169, 1192), False, 'from jp_doodle import nd_frame, dual_canvas\n'), ((846, 877), 'jp_proxy_widget.JSProxyWidget', 'jp_proxy_widget.JSProxyWidget', ([], {}), '()... |
from modlamp.core import read_fasta
from scipy.stats import describe
from glob import glob
import numpy as np
import pandas as pd
lens_pos, lens_neg = [], []
data = []
for p in sorted(glob("data/*/seqs.fasta")):
classes_path = p.replace("seqs.fasta", "classes.txt")
with open(classes_path) as f:
classe... | [
"pandas.DataFrame",
"numpy.median",
"modlamp.core.read_fasta",
"glob.glob",
"scipy.stats.describe",
"numpy.round",
"numpy.sqrt"
] | [((1253, 1271), 'scipy.stats.describe', 'describe', (['lens_pos'], {}), '(lens_pos)\n', (1261, 1271), False, 'from scipy.stats import describe\n'), ((1282, 1300), 'scipy.stats.describe', 'describe', (['lens_neg'], {}), '(lens_neg)\n', (1290, 1300), False, 'from scipy.stats import describe\n'), ((1307, 1336), 'scipy.sta... |
# coding: utf-8
import gpflow
import numpy as np
import tensorflow as tf
from gpflow.mean_functions import Zero
from . import pZ_construction_singleBP
class AssignGP(
gpflow.models.model.GPModel, gpflow.models.InternalDataTrainingLossMixin
):
r"""
Gaussian Process regression, but where the index to which... | [
"tensorflow.reduce_sum",
"tensorflow.linalg.triangular_solve",
"tensorflow.print",
"numpy.ones",
"numpy.isnan",
"tensorflow.sqrt",
"tensorflow.math.square",
"gpflow.likelihoods.Gaussian",
"tensorflow.nn.softmax",
"tensorflow.math.log",
"gpflow.default_float",
"numpy.random.randn",
"gpflow.me... | [((2206, 2243), 'numpy.ones', 'np.ones', (['(t.shape[0], t.shape[0] * 3)'], {}), '((t.shape[0], t.shape[0] * 3))\n', (2213, 2243), True, 'import numpy as np\n'), ((3980, 4000), 'numpy.zeros', 'np.zeros', (['(N, 3 * N)'], {}), '((N, 3 * N))\n', (3988, 4000), True, 'import numpy as np\n'), ((5355, 5368), 'numpy.asarray',... |
import multiprocessing
import numpy as np
import pandas as pd
import re
from pathlib import Path
from os import cpu_count
from tables.exceptions import HDF5ExtError
from src.patches import PatchSchema
from src.preset2fxp import *
FXP_CHUNK = 'chunk'
FXP_PARAMS = 'params'
DB_KEY = 'patches'
TAGS_KEY = 'tags'
PATCH_FILE... | [
"pandas.DataFrame",
"pandas.HDFStore",
"sklearn.preprocessing.StandardScaler",
"numpy.logical_and.reduce",
"pandas.Index",
"os.cpu_count",
"sklearn.neighbors.KNeighborsClassifier",
"pandas.Series",
"pandas.Categorical",
"multiprocessing.Pool",
"re.compile"
] | [((345, 356), 'os.cpu_count', 'cpu_count', ([], {}), '()\n', (354, 356), False, 'from os import cpu_count\n'), ((815, 827), 'pandas.Index', 'pd.Index', (['[]'], {}), '([])\n', (823, 827), True, 'import pandas as pd\n'), ((1166, 1202), 're.compile', 're.compile', (['self.schema.file_pattern'], {}), '(self.schema.file_pa... |
import numpy as np
import time
import os
import math
import pickle as pkl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
"""
Author: <NAME>
Description: In this file are implemented some support function to preprocess EUSAR dataset
"""
# ~~~~~~... | [
"numpy.pad",
"numpy.divide",
"numpy.sum",
"numpy.true_divide",
"numpy.abs",
"math.ceil",
"numpy.std",
"numpy.zeros",
"numpy.ones",
"time.time",
"numpy.min",
"numpy.where",
"numpy.max",
"numpy.mean",
"numpy.rollaxis",
"os.path.join",
"numpy.unique"
] | [((1350, 1376), 'numpy.zeros', 'np.zeros', (['label.shape[1:3]'], {}), '(label.shape[1:3])\n', (1358, 1376), True, 'import numpy as np\n'), ((1689, 1739), 'numpy.where', 'np.where', (['(label_values == 0)', '(255)', '(label_values - 1)'], {}), '(label_values == 0, 255, label_values - 1)\n', (1697, 1739), True, 'import ... |
import copy
import json
from argparse import ArgumentParser
from json.decoder import JSONDecoder
from pathlib import Path
from typing import List, Optional, Tuple, Dict, Union
import cv2
from shapely import geometry
import numpy as np
from PIL import Image
def order_points(points):
if len(points) == 4:
re... | [
"copy.deepcopy",
"argparse.ArgumentParser",
"shapely.geometry.Polygon",
"numpy.argmax",
"cv2.getPerspectiveTransform",
"numpy.zeros",
"numpy.argmin",
"shapely.geometry.LineString",
"pathlib.Path",
"numpy.diff",
"numpy.array"
] | [((5891, 5907), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (5905, 5907), False, 'from argparse import ArgumentParser\n'), ((6385, 6407), 'pathlib.Path', 'Path', (['args.region_path'], {}), '(args.region_path)\n', (6389, 6407), False, 'from pathlib import Path\n'), ((6992, 7011), 'pathlib.Path', 'Pat... |
import numpy as np
import numpy.testing as npt
import pytest
import lenstronomy.Plots.plot_util as plot_util
class TestPlotUtil(object):
def setup(self):
pass
def test_sqrt(self):
image = np.random.randn(10, 10)
image_rescaled = plot_util.sqrt(image)
npt.assert_almost_equal... | [
"numpy.random.randn",
"numpy.min",
"lenstronomy.Plots.plot_util.sqrt",
"pytest.main"
] | [((381, 394), 'pytest.main', 'pytest.main', ([], {}), '()\n', (392, 394), False, 'import pytest\n'), ((218, 241), 'numpy.random.randn', 'np.random.randn', (['(10)', '(10)'], {}), '(10, 10)\n', (233, 241), True, 'import numpy as np\n'), ((267, 288), 'lenstronomy.Plots.plot_util.sqrt', 'plot_util.sqrt', (['image'], {}), ... |
import argparse
import sklearn.metrics
import numpy as np
from numba import njit
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'lib'))
import common
import inputparser
import util
import clustermaker
def convert_clustering_to_assignment(clusters):
mapping = {vid: cidx for ... | [
"inputparser.load_read_counts",
"argparse.ArgumentParser",
"numpy.log",
"os.path.dirname",
"inputparser.load_ssms",
"common.extract_vids",
"clustermaker.calc_llh",
"numpy.array",
"inputparser.load_params"
] | [((430, 470), 'numpy.array', 'np.array', (['[mapping[vid] for vid in vids]'], {}), '([mapping[vid] for vid in vids])\n', (438, 470), True, 'import numpy as np\n'), ((541, 574), 'inputparser.load_params', 'inputparser.load_params', (['paramsfn'], {}), '(paramsfn)\n', (564, 574), False, 'import inputparser\n'), ((738, 85... |
#!/usr/bin/env python3
import torch
import os
from typing import List
from advattack.error_handling.exception import DatasetNotFoundError
from advattack.data_handling.dataset import Dataset
import codecs
import numpy as np
import matplotlib.pyplot as plt
import glob
from advattack.util.logger import logger
class MNI... | [
"matplotlib.pyplot.title",
"os.remove",
"advattack.data_handling.dataset.Dataset.extract_gzip",
"torch.cat",
"advattack.error_handling.exception.DatasetNotFoundError",
"matplotlib.pyplot.figure",
"os.path.join",
"codecs.encode",
"matplotlib.pyplot.imshow",
"os.path.dirname",
"torch.load",
"mat... | [((462, 535), 'advattack.util.logger.logger.getChild', 'logger.getChild', (['"""data_handling.dataset.mnist.mnist_dataset.MNISTDataset"""'], {}), "('data_handling.dataset.mnist.mnist_dataset.MNISTDataset')\n", (477, 535), False, 'from advattack.util.logger import logger\n'), ((1071, 1115), 'matplotlib.pyplot.figure', '... |
# Advent of Code 2021
# --- Day 3: Binary Diagnostic ---
# https://adventofcode.com/2021/day/3
#
# Author: NoNonsenseTekkie
import pandas as pd
import numpy as np
def make_headers(n):
return ["c" + str(i+1) for i in range(n)]
def to_binary_matrix(report):
"""
Convert the diagnostic report as list of li... | [
"pandas.DataFrame",
"numpy.array"
] | [((3760, 3804), 'pandas.DataFrame', 'pd.DataFrame', (['binary_arrays'], {'columns': 'headers'}), '(binary_arrays, columns=headers)\n', (3772, 3804), True, 'import pandas as pd\n'), ((544, 560), 'numpy.array', 'np.array', (['arrays'], {}), '(arrays)\n', (552, 560), True, 'import numpy as np\n'), ((1279, 1299), 'numpy.ar... |
from typing import Union
import numpy as np
from casadi import MX, SX, DM
class Mapping:
"""
Mapping of index set to a different index set
Example of use:
- to_map = Mapping([0, 1, 1, 3, -1, 1], [3])
- obj = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])
- mapped_obj = to_map.map(obj)
... | [
"numpy.array"
] | [((1488, 1501), 'numpy.array', 'np.array', (['obj'], {}), '(obj)\n', (1496, 1501), True, 'import numpy as np\n')] |
# import copy
# h, w = list(map(int, input().split()))
# black_list = []
# white_list = []
# for i in range(h):
# for j, val in enumerate(list(input())):
# if val == "#":
# black_list.append([i,j])
# else:
# white_list.append([i,j])
# max_val = 0
# for white in white_list:
# min_val = w*h
# f... | [
"numpy.max",
"numpy.minimum",
"numpy.array"
] | [((763, 782), 'numpy.array', 'numpy.array', (['values'], {}), '(values)\n', (774, 782), False, 'import numpy\n'), ((900, 949), 'numpy.minimum', 'numpy.minimum', (['(values[:, x] + 1)', 'values[:, x + 1]'], {}), '(values[:, x] + 1, values[:, x + 1])\n', (913, 949), False, 'import numpy\n'), ((1016, 1065), 'numpy.minimum... |
from src.modeling.models.BNN import BNN
from src.modeling.trainers.BNN_trainer import BNN_trainer
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
from dotmap import DotMap
from src.modeling.layers.FC_v2 import FC
from src.mode... | [
"dotmap.DotMap",
"numpy.random.random",
"numpy.exp",
"numpy.matmul",
"src.modeling.trainers.BNN_trainer.BNN_trainer"
] | [((515, 559), 'numpy.random.random', 'np.random.random', ([], {'size': '(NUM_SAMPLES, IN_DIM)'}), '(size=(NUM_SAMPLES, IN_DIM))\n', (531, 559), True, 'import numpy as np\n'), ((685, 728), 'numpy.random.random', 'np.random.random', ([], {'size': '(IN_DIM, HIDDEN_DIM)'}), '(size=(IN_DIM, HIDDEN_DIM))\n', (701, 728), True... |
"""
Linear algebra homework problem 1
"""
import numpy as np
A = np.array([[0.780, 0.563], [0.913, 0.659]])
b = np.array([[0.217], [0.254]])
x = np.array([[1], [-1]])
x_a = np.array([[0.999], [-1.001]])
x_b = np.array([[0.341], [-0.087]])
def calc_residual(x_test):
return b - (A @ x_test)
def part_a():
p... | [
"numpy.linalg.solve",
"numpy.linalg.svd",
"numpy.array",
"numpy.linalg.cond"
] | [((68, 109), 'numpy.array', 'np.array', (['[[0.78, 0.563], [0.913, 0.659]]'], {}), '([[0.78, 0.563], [0.913, 0.659]])\n', (76, 109), True, 'import numpy as np\n'), ((115, 143), 'numpy.array', 'np.array', (['[[0.217], [0.254]]'], {}), '([[0.217], [0.254]])\n', (123, 143), True, 'import numpy as np\n'), ((148, 169), 'num... |
import numpy as np
import scipy.misc
from skimage.morphology import skeletonize
def save(sample_at, probabilities, lines, losses, iterations, save_dir='ginn/data'):
# Okay, so this code is a bit weird, but I had to find a work around to saving data for javascript access
# ... Bear with me...
# This mess be... | [
"numpy.nonzero",
"numpy.zeros_like",
"skimage.morphology.skeletonize",
"numpy.logical_and"
] | [((1258, 1302), 'numpy.logical_and', 'np.logical_and', (['(line[0] == li)', '(line[3] == ui)'], {}), '(line[0] == li, line[3] == ui)\n', (1272, 1302), True, 'import numpy as np\n'), ((1494, 1513), 'numpy.zeros_like', 'np.zeros_like', (['prob'], {}), '(prob)\n', (1507, 1513), True, 'import numpy as np\n'), ((1640, 1660)... |
import logging, warnings, json
from abc import ABCMeta, abstractmethod
from os import rename, makedirs
from os.path import join, basename, isfile
from glob import glob
import numpy as np
import torch
import torch.optim as optims
import torch.optim.lr_scheduler as lr_schedulers
from torch.nn import DataPara... | [
"linearlr.LinearLR",
"torch.nn.parallel.distributed.DistributedDataParallel",
"logging.debug",
"os.makedirs",
"torch.optim.lr_scheduler.StepLR",
"logging.warning",
"os.path.basename",
"torch.load",
"numpy.asarray",
"torch.cuda.device_count",
"torch.save",
"logging.info",
"os.path.isfile",
... | [((7027, 7063), 'os.path.join', 'join', (['self.exp_dir', '"""best-model.txt"""'], {}), "(self.exp_dir, 'best-model.txt')\n", (7031, 7063), False, 'from os.path import join, basename, isfile\n'), ((7898, 7928), 'os.path.join', 'join', (['self.exp_dir', '"""temp.pth"""'], {}), "(self.exp_dir, 'temp.pth')\n", (7902, 7928... |
# -*- coding: utf-8 -*-
"""
Trains a MNIST classifier.
"""
import numpy as np
import sys
import os
import pickle
import argparse
import math
import time
from bisect import bisect_left
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as trn
import torchvision.dataset... | [
"torchtext.datasets.SST.splits",
"numpy.random.seed",
"argparse.ArgumentParser",
"torchtext.datasets.WikiText2.splits",
"torchtext.datasets.WikiText103.splits",
"torchtext.data.BPTTIterator.splits",
"torchtext.data.BucketIterator.splits",
"torchtext.data.Field"
] | [((495, 512), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (509, 512), True, 'import numpy as np\n'), ((523, 629), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SST OE"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='SST OE', formatter... |
import numpy as np
import pytest
from gym_gridverse.agent import Agent
from gym_gridverse.envs.reset_functions import empty
from gym_gridverse.geometry import Orientation, Position, Shape
from gym_gridverse.grid import Grid
from gym_gridverse.grid_object import (
Color,
Door,
Exit,
Floor,
Key,
... | [
"gym_gridverse.geometry.Position",
"gym_gridverse.representations.representation.default_convert",
"gym_gridverse.geometry.Shape",
"numpy.testing.assert_array_equal",
"gym_gridverse.grid.Grid.from_shape",
"gym_gridverse.grid_object.Door",
"gym_gridverse.representations.representation.default_representat... | [((719, 736), 'gym_gridverse.grid_object.Door.num_states', 'Door.num_states', ([], {}), '()\n', (734, 736), False, 'from gym_gridverse.grid_object import Color, Door, Exit, Floor, Key, NoneGridObject, Wall\n'), ((1167, 1217), 'numpy.array', 'np.array', (['([[expected_item_space] * width] * height)'], {}), '([[expected_... |
# -*- coding: utf-8 -*-
import numpy as np
from collections import OrderedDict
class Vocab(object):
def __init__(self, vocab_path=None):
# word
self.idx2word = OrderedDict()
self.word2idx = OrderedDict()
self.word_cnt = OrderedDict()
# char
self.idx2char = OrderedD... | [
"numpy.random.rand",
"gensim.models.word2vec.Word2Vec.load",
"numpy.zeros",
"pickle.load",
"collections.OrderedDict"
] | [((182, 195), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (193, 195), False, 'from collections import OrderedDict\n'), ((220, 233), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (231, 233), False, 'from collections import OrderedDict\n'), ((258, 271), 'collections.OrderedDict', 'OrderedDic... |
#!/usr/local/sci/python
#************************************************************************
#
# Plot figures and output numbers for Carbon Monoxide (CMO) section.
# For BAMS SotC 2016
#
#************************************************************************
# SVN Info
# $Rev:: 28 ... | [
"numpy.where",
"numpy.array",
"numpy.genfromtxt",
"utils.Timeseries"
] | [((2747, 2794), 'numpy.array', 'np.array', (['[cube.var_name for cube in cube_list]'], {}), '([cube.var_name for cube in cube_list])\n', (2755, 2794), True, 'import numpy as np\n'), ((2813, 2842), 'numpy.where', 'np.where', (["(names == 'tcco_ano')"], {}), "(names == 'tcco_ano')\n", (2821, 2842), True, 'import numpy as... |
import numpy
import trivial
import logging
import itertools
class FourierBasis(trivial.TrivialBasis):
"""Fourier Basis linear function approximation. Requires the ranges for each dimension, and is thus able to
use only sine or cosine (and uses cosine). So, this has half the coefficients that a full Fourier ap... | [
"numpy.dot",
"numpy.array",
"numpy.ones",
"logging.getLogger"
] | [((660, 708), 'logging.getLogger', 'logging.getLogger', (['"""pyrl.representation.fourier"""'], {}), "('pyrl.representation.fourier')\n", (677, 708), False, 'import logging\n'), ((828, 847), 'numpy.array', 'numpy.array', (['ranges'], {}), '(ranges)\n', (839, 847), False, 'import numpy\n'), ((1143, 1207), 'logging.getLo... |
from sklearn.tree import DecisionTreeClassifier
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
##ensembling method of boosted classification tree
def btc(T, X, y, D):
n = X.shape[0]
f = []
w = [1/n]*n
e = []
alpha = []
for t in range(T):
dtc =... | [
"numpy.sum",
"pandas.read_csv",
"sklearn.tree.DecisionTreeClassifier",
"numpy.array",
"math.log"
] | [((321, 356), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {'max_depth': 'D'}), '(max_depth=D)\n', (343, 356), False, 'from sklearn.tree import DecisionTreeClassifier\n'), ((1152, 1182), 'pandas.read_csv', 'pd.read_csv', (['"""mushrooms_X.csv"""'], {}), "('mushrooms_X.csv')\n", (1163, 1182), Tr... |
# -*- coding: utf-8 -*-
"""Simple example showing the use of start/end time and ping
keyword arguments to ek80.read_raw()
"""
import numpy as np
from echolab2.instruments import EK80
raw_file = 'C:/EK Test Data/EK80/FM/FM_-_70_KHZ_2MS_CAL-Phase0-D20190531-T194722-0.raw'
start_time=np.datetime64('2019-05-31T19:48:35... | [
"numpy.datetime64",
"echolab2.instruments.EK80.EK80"
] | [((286, 328), 'numpy.datetime64', 'np.datetime64', (['"""2019-05-31T19:48:35"""', '"""ms"""'], {}), "('2019-05-31T19:48:35', 'ms')\n", (299, 328), True, 'import numpy as np\n'), ((338, 380), 'numpy.datetime64', 'np.datetime64', (['"""2019-05-31T19:55:00"""', '"""ms"""'], {}), "('2019-05-31T19:55:00', 'ms')\n", (351, 38... |
import numpy as np
d_one = np.array([
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0]
])
d_two = np.array([
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0... | [
"numpy.array"
] | [((29, 209), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0,\n 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0,\n 0, 0, 0, 0]]'], {}), '([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, \n 0], [0, 0, 0, 1, 0, 0, ... |
import numpy
import numpy as np
njobs = 1000
batch_size = 200
nsamples_per_job = 1
def init():
"""
Return an initialization of weights
"""
return np.zeros(10)
def train(data, w, coef_shared):
for i in range(data[0].shape[0]):
idx = int(np.floor(data[0][i] * 10))
coef_shared[i... | [
"numpy.random.rand",
"numpy.floor",
"numpy.zeros",
"numpy.sum"
] | [((164, 176), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (172, 176), True, 'import numpy as np\n'), ((406, 423), 'numpy.zeros', 'np.zeros', (['w.shape'], {}), '(w.shape)\n', (414, 423), True, 'import numpy as np\n'), ((882, 891), 'numpy.sum', 'np.sum', (['w'], {}), '(w)\n', (888, 891), True, 'import numpy as ... |
#!/usr/bin/env python
#
# scene3dpanel.py - The Scene3DPanel class.
#
# Author: <NAME> <<EMAIL>>
#
"""This module provides the :class:`Scene3DPanel` class, a FSLeyes view which
draws the scene in 3D.
"""
import logging
import wx
import numpy as np
import fsl.transform.affine as affine
import fsleyes... | [
"fsl.transform.affine.axisAnglesToRotMat",
"fsleyes.gl.wxglscene3dcanvas.WXGLScene3DCanvas",
"wx.BoxSizer",
"numpy.copy",
"fsl.transform.affine.concat",
"fsleyes.displaycontext.scene3dopts.Scene3DOpts",
"logging.getLogger"
] | [((609, 636), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (626, 636), False, 'import logging\n'), ((2403, 2432), 'fsleyes.displaycontext.scene3dopts.Scene3DOpts', 'scene3dopts.Scene3DOpts', (['self'], {}), '(self)\n', (2426, 2432), True, 'import fsleyes.displaycontext.scene3dopts as sc... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from Utils.CV import PNTripletloss_search
from Utils import utils
import warnings
warnings.filterwarnings("ignore")
utils.set_seed(1)
df = pd.read_table("../../data/curatedMetagenomicData/QinJ_2012/counts/QinJ_2012_counts_species.csv",
... | [
"warnings.filterwarnings",
"Utils.utils.set_seed",
"Utils.CV.PNTripletloss_search",
"numpy.array",
"pandas.read_table"
] | [((155, 188), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (178, 188), False, 'import warnings\n'), ((190, 207), 'Utils.utils.set_seed', 'utils.set_seed', (['(1)'], {}), '(1)\n', (204, 207), False, 'from Utils import utils\n'), ((216, 344), 'pandas.read_table', 'pd.read_... |
from __future__ import print_function, division
import os
import torch
import numpy as np
import pandas as pd
import nibabel as nib
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import torch.nn.functional as F
device = (torch.device('cuda') if torch.cu... | [
"torch.nn.Conv3d",
"numpy.zeros",
"torch.cuda.is_available",
"torch.max",
"torch.nn.Linear",
"torch.device",
"torch.no_grad"
] | [((312, 337), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (335, 337), False, 'import torch\n'), ((288, 308), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (300, 308), False, 'import torch\n'), ((354, 373), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n"... |
# import scholar.scholar as sch
from scipy import spatial
import numpy as np
import pickle as pkl
### Usage from other files ###
# import utils
# v = utils.vecMaster()
# word_list = v.expand(source_words, expansion_method, epsilon)
# def create_vector_object(sourcefile="data/fasttext.wiki.en.vec", destfile="data/fas... | [
"scipy.spatial.distance.cdist",
"pickle.dump",
"numpy.identity",
"numpy.all",
"numpy.argwhere",
"numpy.argsort",
"numpy.min",
"numpy.max",
"numpy.linalg.inv",
"pickle.load",
"numpy.array",
"numpy.mean",
"numpy.squeeze",
"numpy.dot",
"numpy.atleast_1d",
"numpy.cov",
"numpy.fromstring"... | [((1051, 1069), 'numpy.vstack', 'np.vstack', (['vectors'], {}), '(vectors)\n', (1060, 1069), True, 'import numpy as np\n'), ((1184, 1213), 'pickle.dump', 'pkl.dump', (['data', 'f'], {'protocol': '(4)'}), '(data, f, protocol=4)\n', (1192, 1213), True, 'import pickle as pkl\n'), ((784, 821), 'numpy.fromstring', 'np.froms... |
"""
Waterbirds Dataset
- Reference code: https://github.com/kohpangwei/group_DRO/blob/master/data/cub_dataset.py
- See Group DRO, https://arxiv.org/abs/1911.08731 for more details
This waterbirds is in SupContrast and has data augmentations option.
"""
import os
import numpy as np
import pandas as pd
import torch
impo... | [
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"os.path.exists",
"torchvision.transforms.RandomResizedCrop",
"PIL.Image.open",
"numpy.array",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"os.path.join",
"torch.tensor",
"torchvision.trans... | [((7903, 8005), 'torch.utils.data.DataLoader', 'DataLoader', (['train_set'], {'batch_size': 'args.bs_trn', 'shuffle': 'train_shuffle', 'num_workers': 'args.num_workers'}), '(train_set, batch_size=args.bs_trn, shuffle=train_shuffle,\n num_workers=args.num_workers)\n', (7913, 8005), False, 'from torch.utils.data impor... |
import os
import random
import shutil
import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from shutil import copyfile
from os import getcwd
import cv2
from tensorflow.keras.layers import Conv2D, Input, ZeroPadding2D, BatchNormalization, Activation, MaxPooling2D, Flatten, ... | [
"matplotlib.pyplot.title",
"os.mkdir",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dense",
"numpy.argmax",
"matplotlib.pyplot.figure",
"cv2.rectangle",
"cv2.imshow",
"tensorflow.keras.layers.Flatten",
"numpy.reshape"... | [((3913, 4101), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)', 'rotation_range': '(40)', 'width_shift_range': '(0.2)', 'height_shift_range': '(0.2)', 'shear_range': '(0.2)', 'zoom_range': '(0.2)', 'horizontal_flip': '(True)', 'fill_mode': '"""nearest"""'... |
"""
Electrodes define any type of sources and receivers used in a survey.
"""
# Copyright 2018-2022 The emsig community.
#
# This file is part of emg3d.
#
# 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 ... | [
"numpy.stack",
"numpy.atleast_2d",
"copy.deepcopy",
"numpy.sum",
"numpy.angle",
"numpy.asarray",
"numpy.allclose",
"emg3d.fields.get_source_field",
"numpy.diff",
"numpy.array",
"numpy.linalg.norm",
"numpy.unique",
"numpy.sqrt"
] | [((23108, 23136), 'numpy.linalg.norm', 'np.linalg.norm', (['[dx, dy, dz]'], {}), '([dx, dy, dz])\n', (23122, 23136), True, 'import numpy as np\n'), ((23190, 23223), 'numpy.angle', 'np.angle', (['(dx + 1.0j * dy)'], {'deg': 'deg'}), '(dx + 1.0j * dy, deg=deg)\n', (23198, 23223), True, 'import numpy as np\n'), ((23926, 2... |
import os
import numpy as np
from spellbook.ml.learn import stack_arrays
def test_stack_arrays():
data1 = np.random.random((3, 2))
data2 = np.zeros((3, 2))
data3 = np.ones((3, 2))
np.savez("temp.npz", F1=data1, F2=data2, F3=data3)
loaded = np.load("temp.npz")
os.remove("temp.npz")
featur... | [
"numpy.load",
"os.remove",
"numpy.zeros",
"numpy.ones",
"numpy.random.random",
"spellbook.ml.learn.stack_arrays",
"numpy.savez"
] | [((114, 138), 'numpy.random.random', 'np.random.random', (['(3, 2)'], {}), '((3, 2))\n', (130, 138), True, 'import numpy as np\n'), ((151, 167), 'numpy.zeros', 'np.zeros', (['(3, 2)'], {}), '((3, 2))\n', (159, 167), True, 'import numpy as np\n'), ((180, 195), 'numpy.ones', 'np.ones', (['(3, 2)'], {}), '((3, 2))\n', (18... |
from tensorflow import reduce_sum, concat, reduce_max
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
from tensorflow.keras.activations import deserialize
from numpy import newaxis,prod
class L_module(Layer):
def __init__(self, n_L, out_dim = None, hidden_units = [], activation = 'li... | [
"tensorflow.reduce_sum",
"tensorflow.concat",
"numpy.prod",
"tensorflow.reduce_max",
"tensorflow.keras.activations.deserialize"
] | [((590, 611), 'numpy.prod', 'prod', (['input_shape[1:]'], {}), '(input_shape[1:])\n', (594, 611), False, 'from numpy import newaxis, prod\n'), ((1472, 1510), 'tensorflow.keras.activations.deserialize', 'deserialize', (["self.params['activation']"], {}), "(self.params['activation'])\n", (1483, 1510), False, 'from tensor... |
# Following is the 2-D array. Print max from axis 0 and min from axis 1
# My Solution
import numpy as np
sampleArray = np.array([[34, 43, 73], [82, 22, 12], [53, 94, 66]])
print("Printing Original array")
print(sampleArray)
print("\nPrinting amin of Axis 1")
print(np.min(sampleArray, axis=1))
print("\nPrinting ama... | [
"numpy.min",
"numpy.max",
"numpy.array"
] | [((121, 173), 'numpy.array', 'np.array', (['[[34, 43, 73], [82, 22, 12], [53, 94, 66]]'], {}), '([[34, 43, 73], [82, 22, 12], [53, 94, 66]])\n', (129, 173), True, 'import numpy as np\n'), ((269, 296), 'numpy.min', 'np.min', (['sampleArray'], {'axis': '(1)'}), '(sampleArray, axis=1)\n', (275, 296), True, 'import numpy a... |
import torch
from torch.utils.data import Dataset
import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
import h5py
import random
class BSD500(Dataset):
def __init__(self, data_dir, noise):
super(Dataset, self).__init__()
self.data_dir = data_dir
self.noise = noise
... | [
"h5py.File",
"random.shuffle",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((335, 360), 'os.listdir', 'os.listdir', (['self.data_dir'], {}), '(self.data_dir)\n', (345, 360), False, 'import os\n'), ((386, 427), 'os.path.join', 'os.path.join', (['self.data_dir', 'data_file[0]'], {}), '(self.data_dir, data_file[0])\n', (398, 427), False, 'import os\n'), ((442, 472), 'h5py.File', 'h5py.File', ([... |
from typing import Callable, Iterable, Sized
from itertools import product
import numpy as np
def convert_tuple_to_array(elements: Iterable, **kw) -> np.ndarray:
if "dtype" in kw:
dtype = kw["dtype"]
else:
dtype = np.result_type(*elements)
return np.array(elements, dtype=dtype)
def car... | [
"numpy.result_type",
"numpy.array",
"itertools.product"
] | [((279, 310), 'numpy.array', 'np.array', (['elements'], {'dtype': 'dtype'}), '(elements, dtype=dtype)\n', (287, 310), True, 'import numpy as np\n'), ((242, 267), 'numpy.result_type', 'np.result_type', (['*elements'], {}), '(*elements)\n', (256, 267), True, 'import numpy as np\n'), ((885, 901), 'itertools.product', 'pro... |
# 问题一:处理检验数据
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def read_xlsx(path):
df=pd.read_excel(path,sheet_name='Sheet1',header=0)
return df
def read_csv(path):
res = pd.read_csv(path,delimiter=',')
return res
def Bessel(v):
sum=np.sum(v**2)
return np.sqrt(sum/(len(v... | [
"numpy.abs",
"numpy.sum",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"pandas.read_excel",
"numpy.mean",
"numpy.array",
"numpy.where",
"matplotlib.pyplot.xlabel"
] | [((113, 163), 'pandas.read_excel', 'pd.read_excel', (['path'], {'sheet_name': '"""Sheet1"""', 'header': '(0)'}), "(path, sheet_name='Sheet1', header=0)\n", (126, 163), True, 'import pandas as pd\n'), ((207, 239), 'pandas.read_csv', 'pd.read_csv', (['path'], {'delimiter': '""","""'}), "(path, delimiter=',')\n", (218, 23... |
from numpy import sin, cos, pi, fabs, sign, roll, arctan2, diff, cumsum, hypot, logical_and, where, linspace
from scipy import interpolate
import matplotlib.pyplot as plt
# Cross-section class that stores x, y points for the cross-section
# and calculates various geometry data
d = 1000
class CrossSection:
"""
Cla... | [
"numpy.arctan2",
"numpy.logical_and",
"numpy.roll",
"scipy.interpolate.splprep",
"numpy.hypot",
"numpy.cumsum",
"numpy.fabs",
"numpy.where",
"numpy.sin",
"numpy.cos",
"numpy.sign",
"scipy.interpolate.splev"
] | [((5284, 5321), 'numpy.hypot', 'hypot', (['(x[1:] - x[:-1])', '(y[1:] - y[:-1])'], {}), '(x[1:] - x[:-1], y[1:] - y[:-1])\n', (5289, 5321), False, 'from numpy import sin, cos, pi, fabs, sign, roll, arctan2, diff, cumsum, hypot, logical_and, where, linspace\n'), ((5334, 5353), 'numpy.cumsum', 'cumsum', (['sub_lengths'],... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def gold_probability(start_day = 0 ,current_day = 1264):
pd_reader = pd.read_csv("./LBMA-GOLD.csv")
x = [x for x in range(start_day, current_day+1)]
y = pd_reader['USD (PM)'][start_day:current_day+1]
if pd_reader['USD (PM)'][start_d... | [
"matplotlib.pyplot.title",
"numpy.poly1d",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.polyfit",
"pandas.read_csv",
"numpy.polyder",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((145, 175), 'pandas.read_csv', 'pd.read_csv', (['"""./LBMA-GOLD.csv"""'], {}), "('./LBMA-GOLD.csv')\n", (156, 175), True, 'import pandas as pd\n'), ((608, 628), 'numpy.polyfit', 'np.polyfit', (['x', 'y', '(40)'], {}), '(x, y, 40)\n', (618, 628), True, 'import numpy as np\n'), ((644, 660), 'numpy.poly1d', 'np.poly1d',... |
"""
Generate pseudo-data
====================
"""
import numpy as np
from scipy.stats import poisson
# number of pseudo-data sets and channels
n_pseudo = 100000
n_channels = 6
# detector resolution per channel
sigma_gg = 1.5
sigma_bb = 14.
resolutions = [sigma_gg] * 5 + [sigma_bb]
# dummy background model
bins =... | [
"numpy.save",
"numpy.zeros_like",
"numpy.random.seed",
"numpy.linspace"
] | [((321, 346), 'numpy.linspace', 'np.linspace', (['(140)', '(155)', '(15)'], {}), '(140, 155, 15)\n', (332, 346), True, 'import numpy as np\n'), ((360, 379), 'numpy.zeros_like', 'np.zeros_like', (['bins'], {}), '(bins)\n', (373, 379), True, 'import numpy as np\n'), ((449, 468), 'numpy.random.seed', 'np.random.seed', (['... |
from generate_microbench_rates import generate_microbench_rates
import numpy as np
from isolation import get_iso_latency
from lacs import lacs
from mm_default import mm_default
import os
rate1 = 20.0
filenumber = 100
for rate2 in range(26,37):
generate_microbench_rates(filenumber, rate1, rate2)
bandwidth =... | [
"generate_microbench_rates.generate_microbench_rates",
"isolation.get_iso_latency",
"lacs.lacs",
"numpy.zeros",
"mm_default.mm_default",
"numpy.ones"
] | [((251, 302), 'generate_microbench_rates.generate_microbench_rates', 'generate_microbench_rates', (['filenumber', 'rate1', 'rate2'], {}), '(filenumber, rate1, rate2)\n', (276, 302), False, 'from generate_microbench_rates import generate_microbench_rates\n'), ((982, 1032), 'isolation.get_iso_latency', 'get_iso_latency',... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020, University of Southampton
All rights reserved.
Licensed under the BSD 3-Clause License.
See LICENSE.md file in the project root for full license information.
"""
import copy
import math
import numpy as np
from numpy.random import randn, uniform
from auv_nav.sensors imp... | [
"numpy.random.uniform",
"math.exp",
"copy.deepcopy",
"numpy.sum",
"math.sqrt",
"numpy.random.randn",
"numpy.square",
"numpy.zeros",
"math.sin",
"auv_nav.sensors.SyncedOrientationBodyVelocity",
"numpy.mean",
"numpy.array",
"math.cos",
"auv_nav.tools.interpolate.interpolate",
"oplab.Consol... | [((698, 735), 'math.sqrt', 'math.sqrt', (['(2.0 * math.pi * sigma ** 2)'], {}), '(2.0 * math.pi * sigma ** 2)\n', (707, 735), False, 'import math\n'), ((12914, 12937), 'numpy.mean', 'np.mean', (['eastings_error'], {}), '(eastings_error)\n', (12921, 12937), True, 'import numpy as np\n'), ((12959, 12983), 'numpy.mean', '... |
import datetime as dt
import os
import sys
from multiprocessing import Pool
import numpy as np
from scipy.interpolate import griddata
from shutil import copy2, rmtree
import subprocess
#from subprocess import call
from time import time
#import pdb; pdb.set_trace()
#os.environ["OMP_NUM_THREADS"] = "1"
''... | [
"numpy.load",
"os.remove",
"numpy.ones",
"numpy.exp",
"glob.glob",
"shutil.rmtree",
"os.path.join",
"os.chdir",
"psutil.cpu_count",
"os.path.abspath",
"numpy.random.randn",
"os.path.exists",
"numpy.loadtxt",
"numpy.size",
"scipy.interpolate.griddata",
"multiprocessing.Pool",
"os.list... | [((5314, 5340), 'numpy.loadtxt', 'np.loadtxt', (['"""true_all.txt"""'], {}), "('true_all.txt')\n", (5324, 5340), True, 'import numpy as np\n'), ((5432, 5450), 'numpy.load', 'np.load', (['"""xyz.npy"""'], {}), "('xyz.npy')\n", (5439, 5450), True, 'import numpy as np\n'), ((5465, 5486), 'numpy.load', 'np.load', (['"""xyz... |
import pyBigWig
import os
from os import path
import pandas as pd
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from lxml import html
import requests
import statistics
import gzip
import shutil
from Bio import motifs
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import... | [
"Bio.Seq.Seq",
"Bio.SeqIO.write",
"numpy.nan_to_num",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"os.path.exists",
"lxml.html.fromstring",
"matplotlib.pyplot.axvspan",
"requests.get",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.sub... | [((2371, 2429), 'pandas.read_csv', 'pd.read_csv', (['"""external_tracks.db"""'], {'delimiter': '""","""', 'header': '(0)'}), "('external_tracks.db', delimiter=',', header=0)\n", (2382, 2429), True, 'import pandas as pd\n'), ((5765, 5822), 'pandas.read_csv', 'pd.read_csv', (['bed_file'], {'sep': '"""\t"""', 'comment': '... |
import math
import operator
from functools import reduce
import bezier
import cv2
import numpy as np
import pyclipper
from pyclipper import PyclipperOffset
from scipy.interpolate import splprep, splev
from shapely.geometry import Polygon
def compute_two_points_angle(_base_point, _another_point):
"""
以基点作x+延长... | [
"numpy.arctan2",
"numpy.maximum",
"numpy.sum",
"math.atan2",
"numpy.abs",
"numpy.ones",
"numpy.clip",
"numpy.argsort",
"cv2.warpAffine",
"numpy.mean",
"numpy.linalg.norm",
"numpy.sin",
"cv2.minAreaRect",
"bezier.Curve",
"cv2.getRotationMatrix2D",
"numpy.atleast_2d",
"numpy.zeros_like... | [((1231, 1280), 'scipy.interpolate.splprep', 'splprep', (['_points.T'], {'u': 'None', 's': '(1.0)', 'per': '(1)', 'quiet': '(2)'}), '(_points.T, u=None, s=1.0, per=1, quiet=2)\n', (1238, 1280), False, 'from scipy.interpolate import splprep, splev\n'), ((1348, 1372), 'scipy.interpolate.splev', 'splev', (['u_new', 'tck']... |
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
from imblearn.over_sampling import SMOTE
from imblearn.over_sampling import RandomOverSampler
from imblearn.under_sampling import RandomUnderSampler
seed = 0
k_fold=2
def input():
df = pd.read_csv('out.csv')
title = list(df.c... | [
"imblearn.under_sampling.RandomUnderSampler",
"numpy.save",
"numpy.random.seed",
"pandas.read_csv",
"numpy.std",
"numpy.isnan",
"imblearn.over_sampling.RandomOverSampler",
"numpy.mean",
"sklearn.model_selection.StratifiedKFold",
"imblearn.over_sampling.SMOTE"
] | [((614, 651), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', (['k_fold'], {'shuffle': '(True)'}), '(k_fold, shuffle=True)\n', (629, 651), False, 'from sklearn.model_selection import StratifiedKFold\n'), ((659, 675), 'imblearn.over_sampling.SMOTE', 'SMOTE', ([], {'ratio': '(1.0)'}), '(ratio=1.0)\n', (664,... |
import os
import webbrowser
import requests
from bs4 import BeautifulSoup
import pandas as pd
import geocoder
from geopy.geocoders import Nominatim
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as colors
import sklearn
from sklearn.cluster import KMeans
import folium
import numpy a... | [
"matplotlib.pyplot.title",
"fuzzywuzzy.fuzz.token_sort_ratio",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"matplotlib.colors.rgb2hex",
"numpy.arange",
"pandas.DataFrame",
"sklearn.cluster.KMeans",
"pandas.merge",
"requests.get",
"selenium.webdriver.Safari",
"matplotlib.pyplot.show",
"mat... | [((10915, 10943), 'pandas.read_csv', 'pd.read_csv', (['"""hospitals.csv"""'], {}), "('hospitals.csv')\n", (10926, 10943), True, 'import pandas as pd\n'), ((10951, 10983), 'pandas.read_csv', 'pd.read_csv', (['"""hospital_beds.csv"""'], {}), "('hospital_beds.csv')\n", (10962, 10983), True, 'import pandas as pd\n'), ((109... |
import argparse
import os, sys
import numpy as np
import pandas as pd
import pickle as pk
import torch
import torch.nn as nn
from torch.autograd import grad
from torch.utils.data import SubsetRandomSampler
import torchvision.datasets as datasets
import torchvision.transforms as transforms
sys.path.append('../')
from e... | [
"sys.stdout.write",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.cuda.device_count",
"numpy.arange",
"torch.arange",
"sys.stdout.flush",
"os.path.join",
"sys.path.append",
"torch.load",
"numpy.random.choice",
"torch.zeros",
"torchvision.transforms.CenterCrop",
"torch.manual_seed"... | [((291, 313), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (306, 313), False, 'import os, sys\n'), ((382, 531), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Gathers statistics of a model on the testset, and saves these statistics to a pickle file in the model directory"""'], {}... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Load required packages
from psychopy import core, event, misc
from iViewXAPI import*
from iViewXAPIReturnCodes import*
import subprocess
import numpy as np
import os
from threading import Thread
import helpers
import time
# Numbers used by iView X for identify eye tr... | [
"psychopy.event.Mouse",
"threading.Thread.__init__",
"psychopy.core.wait",
"helpers.psychopy2smi",
"helpers.RingBuffer",
"time.sleep",
"numpy.array",
"os.path.splitext",
"os.path.split",
"psychopy.core.Clock"
] | [((1531, 1543), 'psychopy.core.Clock', 'core.Clock', ([], {}), '()\n', (1541, 1543), False, 'from psychopy import core, event, misc\n'), ((1613, 1626), 'psychopy.event.Mouse', 'event.Mouse', ([], {}), '()\n', (1624, 1626), False, 'from psychopy import core, event, misc\n'), ((24008, 24031), 'os.path.split', 'os.path.sp... |
"""Main alignment class"""
import logging
import time
import typing as ty
import warnings
import numpy as np
from .utilities import check_xy, convert_peak_values_to_index, generate_function, shift, time_loop
METHODS = ["pchip", "zero", "slinear", "quadratic", "cubic", "linear"]
LOGGER = logging.getLogger(__name__)
... | [
"numpy.zeros_like",
"numpy.asarray",
"numpy.square",
"numpy.zeros",
"numpy.ones",
"time.time",
"numpy.diff",
"numpy.arange",
"numpy.array",
"numpy.reshape",
"numpy.tile",
"numpy.dot",
"warnings.warn",
"numpy.round",
"logging.getLogger"
] | [((291, 318), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'import logging\n'), ((4288, 4301), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (4298, 4301), True, 'import numpy as np\n'), ((4534, 4559), 'numpy.zeros_like', 'np.zeros_like', (['self.array'], {}), '... |
import os
from glob import glob
import numpy as np
from PIL import Image
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score
from tqdm import tqdm
from jpeg_eigen import jpeg_recompress_pil, jpeg_feature
def main():
# Parameters ---
ps_root = 'data/ps/'
raw_root... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.stack",
"tqdm.tqdm",
"numpy.save",
"numpy.random.seed",
"numpy.load",
"os.path.exists",
"sklearn.metrics.roc_auc_score",
"PIL.Image.open",
"jpeg_eigen.jpeg_recompress_pil",
"jpeg_eigen.jpeg_feature",
"os.path.splitext",
"glob.glob",
"numpy.... | [((459, 483), 'glob.glob', 'glob', (["(raw_root + '*.png')"], {}), "(raw_root + '*.png')\n", (463, 483), False, 'from glob import glob\n'), ((2056, 2075), 'numpy.random.seed', 'np.random.seed', (['(197)'], {}), '(197)\n', (2070, 2075), True, 'import numpy as np\n'), ((2272, 2347), 'numpy.concatenate', 'np.concatenate',... |
from tripletpairs.kineticmodelling import timeresolvedmodels
from tripletpairs.kineticmodelling import KineticSimulation
import numpy as np
from matplotlib import pyplot as plt
###############################################################################
# SET UP THE KINETIC MODEL
#################################... | [
"tripletpairs.kineticmodelling.timeresolvedmodels.Merrifield",
"tripletpairs.kineticmodelling.KineticSimulation",
"numpy.sin",
"numpy.cos",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((372, 403), 'tripletpairs.kineticmodelling.timeresolvedmodels.Merrifield', 'timeresolvedmodels.Merrifield', ([], {}), '()\n', (401, 403), False, 'from tripletpairs.kineticmodelling import timeresolvedmodels\n'), ((950, 974), 'numpy.linspace', 'np.linspace', (['(0)', '(0.25)', '(10)'], {}), '(0, 0.25, 10)\n', (961, 97... |
"""
単変量特徴選択
個々の特徴量とターゲットとの間に統計的に顕著な関係がるかどうかを計算する。
最も高い確信度で関連している特徴量が選択される。
この方法は、計算が高速でモデルを構築する必要がないが、
個々の特徴量を個別に考慮するために他の特徴量と組み合わさって意味のある特徴量は捨てられる。
特徴選択後に使われるモデルとは完全に独立である。
selectPercentile:全部の特徴量に対する上位の割合を指定
selectKBest:使用される上位の特徴量
"""
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_styl... | [
"seaborn.set_style",
"matplotlib.pyplot.show",
"matplotlib.pyplot.yticks",
"numpy.where",
"sklearn.feature_selection.SelectPercentile",
"matplotlib.pyplot.xticks",
"sklearn.feature_selection.SelectKBest"
] | [((308, 334), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (321, 334), True, 'import seaborn as sns\n'), ((1002, 1066), 'sklearn.feature_selection.SelectPercentile', 'SelectPercentile', ([], {'score_func': 'f_regression', 'percentile': 'percentile'}), '(score_func=f_regression, pe... |
"""
bin modis data into regular latitude and longitude bins
"""
import numpy as np
def reproj_L1B(raw_data, raw_x, raw_y, xlim, ylim, res):
'''
=========================================================================================
Reproject MODIS L1B file to a regular grid
---... | [
"numpy.arange",
"numpy.searchsorted"
] | [((1438, 1470), 'numpy.arange', 'np.arange', (['xlim[0]', 'xlim[1]', 'res'], {}), '(xlim[0], xlim[1], res)\n', (1447, 1470), True, 'import numpy as np\n'), ((1483, 1515), 'numpy.arange', 'np.arange', (['ylim[0]', 'ylim[1]', 'res'], {}), '(ylim[0], ylim[1], res)\n', (1492, 1515), True, 'import numpy as np\n'), ((1531, 1... |
import numpy as np
import qutip
from .constants import *
from scipy.linalg import eig
def adiabatic_passage_f_sweep(atom, F, f_res, f_range, B_0, B_rf):
B_homogenous = B_0*1e-4
B_int = B_rf*1e-4
g_F = atom.g_J*(F*(F+1) - atom.I*(atom.I+1) + atom.J*(atom.J+1)) / (2*F*(F+1)) +\
atom.g_I*(F*(F+1) + a... | [
"qutip.jmat",
"scipy.linalg.eig",
"numpy.linspace"
] | [((601, 646), 'numpy.linspace', 'np.linspace', (['(-f_range / 2)', '(f_range / 2)', 'f_res'], {}), '(-f_range / 2, f_range / 2, f_res)\n', (612, 646), True, 'import numpy as np\n'), ((774, 792), 'qutip.jmat', 'qutip.jmat', (['F', '"""x"""'], {}), "(F, 'x')\n", (784, 792), False, 'import qutip\n'), ((1517, 1535), 'qutip... |
# Python modules
import os
import struct
import pprint
pp = pprint.PrettyPrinter(depth=2)
# 3rd party modules
import pydicom
import pydicom.dicomio
import numpy as np
# Our modules
import vespa.analysis.fileio.raw_reader as raw_reader
import vespa.common.util.config as util_config
import vespa.common.util.misc as uti... | [
"vespa.common.util.config.VespaConfig",
"vespa.common.base_transform.transformation_matrix",
"struct.unpack",
"os.path.exists",
"vespa.analysis.fileio.dicom_browser_dialog.SiemensMrsBrowser",
"pydicom.dicomio.read_file",
"vespa.common.mrs_data_raw.DataRaw",
"pprint.PrettyPrinter",
"vespa.analysis.fi... | [((60, 89), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'depth': '(2)'}), '(depth=2)\n', (80, 89), False, 'import pprint\n'), ((9886, 9923), 'numpy.fromiter', 'np.fromiter', (['data'], {'dtype': 'np.complex64'}), '(data, dtype=np.complex64)\n', (9897, 9923), True, 'import numpy as np\n'), ((13380, 13417), 'nu... |
''' PolynomialFiltering.components.EmpFmpPair
(C) Copyright 2019 - Blue Lightning Development, LLC.
<NAME>. <EMAIL>
SPDX-License-Identifier: MIT
See separate LICENSE file for full text
'''
from abc import abstractmethod
from math import isnan;
from numpy import array, diag, zeros, sqrt, transpose
from numpy impo... | [
"polynomialfiltering.components.ExpandingMemoryPolynomialFilter.makeEMP",
"polynomialfiltering.components.FadingMemoryPolynomialFilter.makeFMP",
"numpy.zeros"
] | [((1447, 1466), 'polynomialfiltering.components.ExpandingMemoryPolynomialFilter.makeEMP', 'makeEMP', (['order', 'tau'], {}), '(order, tau)\n', (1454, 1466), False, 'from polynomialfiltering.components.ExpandingMemoryPolynomialFilter import makeEMP, EMPBase\n'), ((1487, 1513), 'polynomialfiltering.components.FadingMemor... |
from collections import namedtuple
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from wind_repower_usa.config import EXTERNAL_DIR
Turbine = namedtuple('Turbine', ('name',
'file_name',
'power_curve',
... | [
"pandas.read_csv",
"numpy.arange",
"collections.namedtuple",
"numpy.linspace",
"scipy.interpolate.interp1d"
] | [((175, 289), 'collections.namedtuple', 'namedtuple', (['"""Turbine"""', "('name', 'file_name', 'power_curve', 'capacity_mw', 'rotor_diameter_m',\n 'hub_height_m')"], {}), "('Turbine', ('name', 'file_name', 'power_curve', 'capacity_mw',\n 'rotor_diameter_m', 'hub_height_m'))\n", (185, 289), False, 'from collectio... |
import numpy as np
from edutorch.nn import Linear
from tests.gradient_check import estimate_gradients
def test_linear_forward() -> None:
input_dim = 2
input_shape = (4, 5, 6)
output_dim = 3
input_size = input_dim * np.prod(input_shape)
weight_size = output_dim * np.prod(input_shape)
x = np.l... | [
"numpy.random.randn",
"numpy.allclose",
"edutorch.nn.Linear",
"numpy.array",
"numpy.linspace",
"numpy.prod",
"tests.gradient_check.estimate_gradients"
] | [((400, 429), 'edutorch.nn.Linear', 'Linear', (['input_dim', 'output_dim'], {}), '(input_dim, output_dim)\n', (406, 429), False, 'from edutorch.nn import Linear\n'), ((554, 592), 'numpy.linspace', 'np.linspace', (['(-0.3)', '(0.1)'], {'num': 'output_dim'}), '(-0.3, 0.1, num=output_dim)\n', (565, 592), True, 'import num... |
# Program 09c: Phase portrait and Poincare section of a nonautonomous ODE.
# See Figure 9.11(b).
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
xmin, xmax = -2, 2
ymin, ymax = -2, 2
k = 0.3
omega = 1.25
gamma = 0.5
def dx_dt(x, t):
return [x[1], x[0] - k*x[1] - x[0]**3 + g... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"scipy.integrate.odeint",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplo... | [((364, 390), 'numpy.linspace', 'np.linspace', (['(0)', '(500)', '(10000)'], {}), '(0, 500, 10000)\n', (375, 390), True, 'import numpy as np\n'), ((396, 420), 'scipy.integrate.odeint', 'odeint', (['dx_dt', '[1, 0]', 't'], {}), '(dx_dt, [1, 0], t)\n', (402, 420), False, 'from scipy.integrate import odeint\n'), ((420, 46... |
import matplotlib.pyplot as plt
import numpy as np
#%%
# 删除文件中的空白行
# 参考:https://www.cnblogs.com/billyzh/p/5851429.html
def delblankline(infile,outfile):
infopen = open(infile,'r')
outfopen = open(outfile,'w')
lines = infopen.readlines()
line_cnt = 0
blank_line = []
for line in lines:
if... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.absolute",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array",
"numpy.loadtxt",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.ylabel",
"matplotlib.... | [((783, 816), 'numpy.loadtxt', 'np.loadtxt', (["(filename + '.del.txt')"], {}), "(filename + '.del.txt')\n", (793, 816), True, 'import numpy as np\n'), ((948, 981), 'numpy.loadtxt', 'np.loadtxt', (["(filename + '.del.txt')"], {}), "(filename + '.del.txt')\n", (958, 981), True, 'import numpy as np\n'), ((988, 1005), 'nu... |
import sys
import os
import argparse
import time
import gensim
import random
sys.path.insert(0, '../markov/')
import markov_python3
import numpy as np
import scipy.spatial.distance
class Sentence(object):
def __init__(self, dirname):
self.dirname = dirname
def __iter__(self):
for fname in os.l... | [
"numpy.divide",
"argparse.ArgumentParser",
"gensim.models.Word2Vec.load_word2vec_format",
"numpy.zeros",
"sys.path.insert",
"random.choice",
"time.time",
"gensim.models.Word2Vec",
"markov_python3.Markov",
"numpy.add",
"os.path.join",
"os.listdir"
] | [((77, 109), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../markov/"""'], {}), "(0, '../markov/')\n", (92, 109), False, 'import sys\n'), ((529, 593), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""configure the irc clients"""'}), "(description='configure the irc clients')\n", (552... |
'''
A* algorithm
use networkx
'''
import networkx as nx
from copy import deepcopy
import numpy as np
from config import CFG
import datetime
import time
import math
class A_star:
def __init__(self, net, A_star_sim = 1024, check_repeat_state = True):
'''
:param net: neural network
:param A_s... | [
"copy.deepcopy",
"networkx.Graph",
"numpy.array",
"numpy.array_equal",
"math.log"
] | [((833, 883), 'copy.deepcopy', 'deepcopy', (["self.G.node[self.selected_node]['state']"], {}), "(self.G.node[self.selected_node]['state'])\n", (841, 883), False, 'from copy import deepcopy\n'), ((2522, 2627), 'numpy.array_equal', 'np.array_equal', (["self.G.node[self.G.node[self.selected_node]['parent_node']]['state']"... |
from tensorflow.keras.applications.imagenet_utils import preprocess_input as efficientnet_preprocess_input
from tensorflow.keras.layers import Activation
from tensorflow.keras.backend import sigmoid, constant
from tensorflow.keras.initializers import Initializer
from torch.nn import ConvTranspose2d, init
from torch im... | [
"scipy.ndimage.filters.gaussian_filter",
"numpy.uint8",
"tensorflow.keras.backend.sigmoid",
"skimage.transform.rescale",
"tensorflow.keras.applications.imagenet_utils.preprocess_input",
"numpy.argmax",
"numpy.asarray",
"skimage.util.pad",
"numpy.zeros",
"math.floor",
"torch.Tensor",
"torch.nn.... | [((5696, 5743), 'skimage.transform.rescale', 'rescale', (['source_array', 'scale'], {'multichannel': '(True)'}), '(source_array, scale, multichannel=True)\n', (5703, 5743), False, 'from skimage.transform import rescale\n'), ((7119, 7162), 'skimage.util.pad', 'padding', (['source_array', 'paddings', '"""constant"""'], {... |
'''
This script creates json files which can be used to render Manhattan plots.
'''
# TODO: combine with QQ.
from ..utils import chrom_order
from ..conf_utils import conf
from ..file_utils import VariantFileReader, write_json, common_filepaths
from .load_utils import MaxPriorityQueue, parallelize_per_pheno
import ... | [
"math.log10",
"numpy.abs",
"numpy.argmin",
"time.time"
] | [((408, 419), 'time.time', 'time.time', ([], {}), '()\n', (417, 419), False, 'import math, time\n'), ((465, 476), 'time.time', 'time.time', ([], {}), '()\n', (474, 476), False, 'import math, time\n'), ((6239, 6265), 'numpy.argmin', 'np.argmin', (['var_array[:, 1]'], {}), '(var_array[:, 1])\n', (6248, 6265), True, 'impo... |
import numpy as np
from bokeh.io import curdoc, show
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Slider
from bokeh.plotting import figure
N = 100
x_ = np.linspace(0, 10, 200)
y_ = np.linspace(0, 10, 200)
z_ = np.linspace(0, 10, N)
x, y, z = np.meshgrid(x_, y_, z_, indexing='xy')
dat... | [
"numpy.meshgrid",
"bokeh.plotting.figure",
"bokeh.models.Slider",
"bokeh.io.show",
"bokeh.io.curdoc",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"bokeh.layouts.column"
] | [((186, 209), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(200)'], {}), '(0, 10, 200)\n', (197, 209), True, 'import numpy as np\n'), ((215, 238), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(200)'], {}), '(0, 10, 200)\n', (226, 238), True, 'import numpy as np\n'), ((244, 265), 'numpy.linspace', 'np.linspa... |
#!/usr/bin/env python
from __future__ import print_function
import os.path as osp
import sys
import itertools, pkg_resources, sys
from distutils.version import LooseVersion
if LooseVersion(pkg_resources.get_distribution("chainer").version) >= LooseVersion('7.0.0') and \
sys.version_info.major == 2:
print('''Pl... | [
"jsk_recognition_utils.rects_msg_to_ndarray",
"jsk_recognition_msgs.msg.RectArray",
"jsk_recognition_msgs.msg.ClassificationResult",
"chainer.no_backprop_mode",
"numpy.exp",
"rospy.get_name",
"os.path.join",
"jsk_recognition_utils.chainermodels.VGG16FastRCNN",
"message_filters.TimeSynchronizer",
"... | [((475, 486), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (483, 486), False, 'import itertools, pkg_resources, sys\n'), ((767, 778), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (775, 778), False, 'import itertools, pkg_resources, sys\n'), ((1681, 1703), 'numpy.min', 'np.min', (['img.shape[0:2]'], {}), '(img.sha... |
import metpy.calc as mpcalc
from metpy.units import units
import numpy as np
import xarray as xr
import os
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import warnings
warnings.simplefilter('ignore')
# open netCDF4 file with xarray and parse data to CF standard using ... | [
"cartopy.crs.LambertConformal",
"warnings.simplefilter",
"matplotlib.pyplot.close",
"xarray.open_dataset",
"matplotlib.pyplot.colorbar",
"metpy.calc.isentropic_interpolation",
"os.path.isfile",
"metpy.calc.lat_lon_grid_deltas",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.arange",
"metpy.... | [((219, 250), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (240, 250), False, 'import warnings\n'), ((758, 797), 'numpy.intersect1d', 'np.intersect1d', (['press', 'u.metpy.vertical'], {}), '(press, u.metpy.vertical)\n', (772, 797), True, 'import numpy as np\n'), ((1424, 1501... |
import sys
import os
HOME=os.environ['HOME']
sys.path.insert(1,HOME+'/github/StreamingSVM')
from operations import LoadLibsvm
import numpy as np
training_filepath = sys.argv[1]
n_features = int(sys.argv[2])
training_loader = LoadLibsvm.LoadLibSVM(filename=training_filepath, n_features=n_features)
x_training, y_traini... | [
"operations.LoadLibsvm.LoadLibSVM",
"numpy.count_nonzero",
"sys.path.insert"
] | [((45, 94), 'sys.path.insert', 'sys.path.insert', (['(1)', "(HOME + '/github/StreamingSVM')"], {}), "(1, HOME + '/github/StreamingSVM')\n", (60, 94), False, 'import sys\n'), ((227, 299), 'operations.LoadLibsvm.LoadLibSVM', 'LoadLibsvm.LoadLibSVM', ([], {'filename': 'training_filepath', 'n_features': 'n_features'}), '(f... |
from numba import i4
from numba.core.types import string
from numba.experimental import jitclass
from numpy import inf, zeros
from numpy.random import randint
# region @jitclass
@jitclass({
'nameAlg': string,
'ts': i4,
'row': i4,
'col': i4,
'param': i4[:],
'current': i4[:],
'total': i4[:],
})
# endregion
class ... | [
"numpy.zeros",
"numpy.random.randint",
"numba.experimental.jitclass"
] | [((180, 295), 'numba.experimental.jitclass', 'jitclass', (["{'nameAlg': string, 'ts': i4, 'row': i4, 'col': i4, 'param': i4[:],\n 'current': i4[:], 'total': i4[:]}"], {}), "({'nameAlg': string, 'ts': i4, 'row': i4, 'col': i4, 'param': i4[:],\n 'current': i4[:], 'total': i4[:]})\n", (188, 295), False, 'from numba.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.