code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# coding: utf-8
import chainer
import chainer.links as L
from chainer import serializers
class A(chainer.Chain):
def __init__(self):
super(A, self).__init__()
with self.init_scope():
# TODO Add more tests
self.l1 = L.Convolution2D(None, 6, (5, 7), stride=(2, 3))
def f... | [
"numpy.random.rand",
"numpy.random.seed",
"chainer_compiler.elichika.testtools.generate_testcase",
"chainer.links.Convolution2D"
] | [((808, 827), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (822, 827), True, 'import numpy as np\n'), ((890, 929), 'chainer_compiler.elichika.testtools.generate_testcase', 'testtools.generate_testcase', (['model', '[x]'], {}), '(model, [x])\n', (917, 929), False, 'from chainer_compiler.elichika im... |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"numpy.dtype",
"dm_robotics.moma.sensors.robot_tcp_sensor.RobotTCPSensor",
"dm_robotics.moma.models.end_effectors.robot_hands.robotiq_2f85.Robotiq2F85",
"dm_robotics.moma.effectors.arm_effector.ArmEffector",
"dm_robotics.moma.scene_initializer.CompositeSceneInitializer",
"dm_robotics.moma.sensors.robot_ar... | [((6122, 6137), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (6135, 6137), False, 'from absl.testing import absltest\n'), ((1497, 1522), 'dm_robotics.moma.models.arenas.empty.Arena', 'empty.Arena', (['"""test_arena"""'], {}), "('test_arena')\n", (1508, 1522), False, 'from dm_robotics.moma.models.are... |
import cv2
import itertools, os, time
import numpy as np
from Model import get_Model
from parameter import letters
import argparse
from keras import backend as K
K.set_learning_phase(0)
def decode_label(out):
# out : (1, 32, 42)
out_best = list(np.argmax(out[0, 2:], axis=1)) # get max index -> len = 32
... | [
"os.listdir",
"itertools.groupby",
"argparse.ArgumentParser",
"Model.get_Model",
"numpy.argmax",
"numpy.expand_dims",
"time.time",
"cv2.resize",
"keras.backend.set_learning_phase",
"cv2.imread"
] | [((162, 185), 'keras.backend.set_learning_phase', 'K.set_learning_phase', (['(0)'], {}), '(0)\n', (182, 185), True, 'from keras import backend as K\n'), ((531, 556), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (554, 556), False, 'import argparse\n'), ((864, 889), 'Model.get_Model', 'get_Mode... |
from __future__ import annotations # noqa: F401
import re
import warnings
import numpy as np
import pandas as pd
import xarray as xr
from .config import config
from .grid import _wrf_grid_from_dataset
def _decode_times(ds: xr.Dataset) -> xr.Dataset:
"""
Decode the time variable to datetime64.
"""
... | [
"warnings.warn",
"numpy.issubdtype",
"pandas.to_datetime"
] | [((800, 844), 'numpy.issubdtype', 'np.issubdtype', (['ds.XTIME.dtype', 'np.datetime64'], {}), '(ds.XTIME.dtype, np.datetime64)\n', (813, 844), True, 'import numpy as np\n'), ((4319, 4443), 'warnings.warn', 'warnings.warn', (['"""Unable to create coordinate values and CRS due to insufficient dimensions or projection met... |
import unittest
import cellpylib as cpl
import numpy as np
import os
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
class TestHopfieldNet(unittest.TestCase):
def test_hopfield_net(self):
np.random.seed(0)
# patterns for training
zero = [
0, 1, 1, 1, 0,
1, ... | [
"numpy.testing.assert_equal",
"cellpylib.HopfieldNet",
"cellpylib.evolve",
"os.path.join",
"numpy.array",
"numpy.random.seed",
"os.path.abspath"
] | [((97, 122), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (112, 122), False, 'import os\n'), ((210, 227), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (224, 227), True, 'import numpy as np\n'), ((1164, 1193), 'cellpylib.HopfieldNet', 'cpl.HopfieldNet', ([], {'num_cells': '... |
# !/usr/bin/env python
# coding=utf-8
"""
Make a graph for lecture 2, hippo digestion
"""
from __future__ import print_function
import sys
import numpy as np
from scipy import interpolate
from common import make_fig, GOOD_RET
__author__ = 'hbmayes'
def graph_alg_eq():
"""
Given a simple algebraic equation, ... | [
"common.make_fig",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.linspace",
"scipy.interpolate.splrep",
"scipy.interpolate.splev",
"sys.exit",
"numpy.divide"
] | [((578, 616), 'numpy.linspace', 'np.linspace', (['x_start', 'x_end', 'num_steps'], {}), '(x_start, x_end, num_steps)\n', (589, 616), True, 'import numpy as np\n'), ((647, 726), 'numpy.divide', 'np.divide', (['(1.0 + 16.5 * (1.0 - conversion_scale))', '(1.75 * (1 - conversion_scale))'], {}), '(1.0 + 16.5 * (1.0 - conver... |
import numpy as np
from astropy.io import fits
def stitch_all_images(all_hdus,date):
stitched_hdu_dict = {}
hdu_opamp_dict = {}
for (camera, filenum, imtype, opamp),hdu in all_hdus.items():
if (camera, filenum, imtype) not in hdu_opamp_dict.keys():
hdu_opamp_dict[(camera, filenum, imty... | [
"astropy.io.fits.PrimaryHDU",
"numpy.flipud",
"numpy.fliplr",
"numpy.ndarray",
"numpy.sign"
] | [((1388, 1408), 'numpy.fliplr', 'np.fliplr', (["img['br']"], {}), "(img['br'])\n", (1397, 1408), True, 'import numpy as np\n'), ((1427, 1447), 'numpy.flipud', 'np.flipud', (["img['ul']"], {}), "(img['ul'])\n", (1436, 1447), True, 'import numpy as np\n'), ((1882, 1926), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(y_... |
import unittest
import numpy as np
from ssvm.utils import item_2_idc
class Test_item_2_idc(unittest.TestCase):
def test_correctness(self):
l_Y = [[], ["A", "B", "C"], ["A"], ["D", "E"], ["D"], [], ["A", "X", "Z", "Y"], []]
X = np.array([2, 2, 2, 3, 4, 4, 5, 7, 7, 7, 7])
out = item_2_idc(... | [
"unittest.main",
"numpy.array",
"numpy.all",
"ssvm.utils.item_2_idc"
] | [((506, 521), 'unittest.main', 'unittest.main', ([], {}), '()\n', (519, 521), False, 'import unittest\n'), ((250, 293), 'numpy.array', 'np.array', (['[2, 2, 2, 3, 4, 4, 5, 7, 7, 7, 7]'], {}), '([2, 2, 2, 3, 4, 4, 5, 7, 7, 7, 7])\n', (258, 293), True, 'import numpy as np\n'), ((309, 324), 'ssvm.utils.item_2_idc', 'item_... |
"""
DeepLabCut Toolbox
https://github.com/AlexEMG/DeepLabCut
<NAME>, <EMAIL>
<NAME>, <EMAIL>
This script analyzes videos based on a trained network (as specified in myconfig_analysis.py)
You need tensorflow for evaluation. Run by:
CUDA_VISIBLE_DEVICES=0 python3 AnalyzeVideos.py
"""
###############################... | [
"dlct.load_configuration_file",
"pandas.MultiIndex.from_product",
"os.path.exists",
"numpy.ceil",
"dlct.file_name_without_extension_from_path",
"nnet.predict.setup_pose_prediction",
"nnet.predict.extract_cnn_output",
"os.path.join",
"dlct.replace_extension",
"os.path.split",
"os.path.dirname",
... | [((493, 518), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (508, 518), False, 'import os\n'), ((547, 583), 'os.path.dirname', 'os.path.dirname', (['path_to_this_script'], {}), '(path_to_this_script)\n', (562, 583), False, 'import os\n'), ((602, 648), 'os.path.join', 'os.path.join', (['path_... |
#!/usr/bin/python
# make code as python 3 compatible as possible
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
import ast
import json
import logging
import sys
from io import BytesIO
import numpy
LOGGER = logging.getLogger()
def get_nam... | [
"logging.getLogger",
"logging.basicConfig",
"pandas.io.json.read_json",
"argparse.ArgumentParser",
"pandas.DataFrame.from_csv",
"io.BytesIO",
"json.dumps",
"ast.Module",
"numpy.array",
"autopep8.fix_code",
"numpy.savetxt",
"ast.parse",
"sys.stdout.flush",
"numpy.genfromtxt",
"ast.Express... | [((288, 307), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (305, 307), False, 'import logging\n'), ((341, 356), 'ast.parse', 'ast.parse', (['expr'], {}), '(expr)\n', (350, 356), False, 'import ast\n'), ((2857, 2956), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""npcli"""', 'desc... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
uniform_var = np.random.uniform(-5,5,100)
target_val = 0.1 * (uniform_var**3) + 3
noise = np.random.normal(size=100)
noisy_obs = target_val + noise
# plotting
fig_noisy_data = plt.figure()
plot = fig_noisy_data.add_subplot... | [
"numpy.random.normal",
"matplotlib.pyplot.figure",
"numpy.random.uniform"
] | [((112, 141), 'numpy.random.uniform', 'np.random.uniform', (['(-5)', '(5)', '(100)'], {}), '(-5, 5, 100)\n', (129, 141), True, 'import numpy as np\n'), ((188, 214), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(100)'}), '(size=100)\n', (204, 214), True, 'import numpy as np\n'), ((274, 286), 'matplotlib.pyp... |
"""
Functionality to perform inference. Acts as runner between image queue and
GPU cluster containing trained models.
inference_runner.py
"""
import os
import os.path as op
import time
import base64
import json
import tempfile
from io import BytesIO
from functools import partial
import logging
import requests
import ... | [
"requests.post",
"rasterio.Affine.identity",
"io.BytesIO",
"absl.logging.info",
"time.sleep",
"numpy.array",
"os.remove",
"os.path.exists",
"sqlalchemy.orm.sessionmaker",
"google.oauth2.service_account.Credentials.from_service_account_file",
"osgeo.gdal.Warp",
"divdet.inference.utils_inference... | [((990, 1058), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""gcp_project"""', 'None', '"""Google cloud project ID."""'], {}), "('gcp_project', None, 'Google cloud project ID.')\n", (1009, 1058), False, 'from absl import app, logging, flags\n'), ((1059, 1168), 'absl.flags.DEFINE_string', 'flags.DEFINE_string'... |
#!/usr/bin/env python
import os, io, random
import string
import numpy as np
from Bio.Seq import Seq
from Bio.Align import MultipleSeqAlignment
from Bio import AlignIO, SeqIO
from io import StringIO
import panel as pn
import panel.widgets as pnw
import pandas as pd
pn.extension()
from bokeh.plotting import figure
... | [
"Bio.pairwise2.align.globalms",
"Bio.AlignIO.read",
"bokeh.plotting.figure",
"pandas.read_csv",
"random.shuffle",
"tqdm.tqdm",
"bokeh.models.Range1d",
"random.seed",
"panel.extension",
"bokeh.layouts.gridplot",
"Bio.Align.Applications.MuscleCommandline",
"bokeh.io.export_svgs",
"bokeh.models... | [((270, 284), 'panel.extension', 'pn.extension', ([], {}), '()\n', (282, 284), True, 'import panel as pn\n'), ((4193, 4229), 'pandas.read_csv', 'pd.read_csv', (['"""sp_top_100_scores.csv"""'], {}), "('sp_top_100_scores.csv')\n", (4204, 4229), True, 'import pandas as pd\n'), ((4241, 4267), 'pandas.read_csv', 'pd.read_cs... |
import numpy as np
from rlscore.learner import LeaveOneOutRLS
from rlscore.measure import sqerror
from housing_data import load_housing
def train_rls():
#Selects both the gamma parameter for Gaussian kernel, and regparam with loocv
X_train, Y_train, X_test, Y_test = load_housing()
regparams = [2.**i for ... | [
"rlscore.measure.sqerror",
"housing_data.load_housing",
"rlscore.learner.LeaveOneOutRLS",
"numpy.min"
] | [((278, 292), 'housing_data.load_housing', 'load_housing', ([], {}), '()\n', (290, 292), False, 'from housing_data import load_housing\n'), ((566, 661), 'rlscore.learner.LeaveOneOutRLS', 'LeaveOneOutRLS', (['X_train', 'Y_train'], {'kernel': '"""GaussianKernel"""', 'gamma': 'gamma', 'regparams': 'regparams'}), "(X_train... |
"""
Gaussian Transformation with Scikit-learn
- Scikit-learn has recently released transformers to do Gaussian mappings as they call the variable transformations.
The PowerTransformer allows to do Box-Cox and Yeo-Johnson transformation.
With the FunctionTransformer, we can specify any function we... | [
"pandas.read_csv",
"numpy.where",
"sklearn.preprocessing.PowerTransformer",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"sklearn.preprocessing.FunctionTransformer",
"scipy.stats.probplot",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((1400, 1476), 'pandas.read_csv', 'pd.read_csv', (['"""dataset/house-prices-advanced-regression-techniques/train.csv"""'], {}), "('dataset/house-prices-advanced-regression-techniques/train.csv')\n", (1411, 1476), True, 'import pandas as pd\n'), ((3426, 3436), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (34... |
"""
.. versionadded:: 0.4
This function generates Uniform white noise series. This function uses
`numpy.random.uniform`.
Function Documentation
======================================
"""
import numpy as np
def uniform_white_noise(n, minimum=-1, maximum=1):
"""
Random values with uniform distribution.
**... | [
"numpy.random.uniform"
] | [((632, 684), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'minimum', 'high': 'maximum', 'size': 'n'}), '(low=minimum, high=maximum, size=n)\n', (649, 684), True, 'import numpy as np\n')] |
import json
import numpy as np
import itertools
import sys
path_name = sys.argv[1] + "/" + sys.argv[2]
pred_labels = np.load("./tmp/" + path_name + "/pred_labels_valid.npy")
num_classes = int(sys.argv[3])
num_layers = int(sys.argv[4])
total_layers = [x for x in range(num_layers)]
print("path_name: {}, num_classes: {... | [
"numpy.mean",
"numpy.where",
"numpy.argmax",
"itertools.combinations",
"numpy.sum",
"numpy.zeros",
"json.load",
"numpy.load",
"json.dump"
] | [((119, 175), 'numpy.load', 'np.load', (["('./tmp/' + path_name + '/pred_labels_valid.npy')"], {}), "('./tmp/' + path_name + '/pred_labels_valid.npy')\n", (126, 175), True, 'import numpy as np\n'), ((449, 497), 'numpy.zeros', 'np.zeros', (['[pred_label_idx.shape[0], num_classes]'], {}), '([pred_label_idx.shape[0], num_... |
from typing import Optional
import numpy as np
import skimage.draw as skdraw
from gdsfactory.component import Component
from gdsfactory.types import Floats, Layers
def to_np(
component: Component,
nm_per_pixel: int = 20,
layers: Layers = ((1, 0),),
values: Optional[Floats] = None,
pad_width: int... | [
"numpy.ceil",
"matplotlib.pyplot.show",
"gdsfactory.c.bend_circular",
"matplotlib.pyplot.colorbar",
"numpy.zeros",
"skimage.draw.polygon",
"numpy.pad",
"gdsfactory.c.straight"
] | [((941, 969), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'float'}), '(shape, dtype=float)\n', (949, 969), True, 'import numpy as np\n'), ((1526, 1558), 'numpy.pad', 'np.pad', (['img'], {'pad_width': 'pad_width'}), '(img, pad_width=pad_width)\n', (1532, 1558), True, 'import numpy as np\n'), ((1690, 1705), 'gdsfact... |
#!/usr/bin/env python3
# Copyright 2019 <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... | [
"mnets.classifier_interface.Classifier.softmax_and_cross_entropy",
"mnist.train_args.parse_cmd_arguments",
"torch.max",
"mnets.classifier_interface.Classifier.knowledge_distillation_loss",
"copy.deepcopy",
"torch.nn.functional.softmax",
"mnist.train_utils.generate_classifier",
"mnist.train_args_defaul... | [((1176, 1197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1190, 1197), False, 'import matplotlib\n'), ((2663, 2704), 'utils.misc.list_to_str', 'misc.list_to_str', (['config.overall_acc_list'], {}), '(config.overall_acc_list)\n', (2679, 2704), False, 'from utils import misc\n'), ((2733, 2775... |
################################################################
# The contents of this file are subject to the BSD 3Clause (New) License
# you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://directory.fsf.org/wiki/License:BSD_3Clause
# Software distribut... | [
"sklearn.model_selection.LeaveOneOut",
"numpy.sqrt",
"numpy.random.rand",
"re.compile",
"numpy.where",
"numpy.log",
"math.float",
"sklearn.neighbors.KernelDensity",
"math.floor_",
"numpy.zeros",
"numpy.linspace",
"numpy.isnan",
"numpy.random.randn",
"re.sub",
"numpy.zeros_like"
] | [((4176, 4195), 'numpy.isnan', 'np.isnan', (['bandwidth'], {}), '(bandwidth)\n', (4184, 4195), True, 'import numpy as np\n'), ((5252, 5270), 'numpy.zeros_like', 'np.zeros_like', (['x_d'], {}), '(x_d)\n', (5265, 5270), True, 'import numpy as np\n'), ((18241, 18259), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "(... |
import pypsa, os
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
network = pypsa.Network()
folder_name = "ac-dc-data"
network.import_from_csv_folder(folder_name)
network.lopf(network.snapshots)
fig, ax = plt.subplots(subplot_kw={'projection': ccrs.EqualEarth()},
... | [
"os.path.join",
"cartopy.crs.EqualEarth",
"numpy.testing.assert_allclose",
"pypsa.Network"
] | [((106, 121), 'pypsa.Network', 'pypsa.Network', ([], {}), '()\n', (119, 121), False, 'import pypsa, os\n'), ((1949, 1990), 'os.path.join', 'os.path.join', (['folder_name', '"""results-lopf"""'], {}), "(folder_name, 'results-lopf')\n", (1961, 1990), False, 'import pypsa, os\n'), ((1769, 1836), 'numpy.testing.assert_allc... |
import numpy as np
import torch
"""
this file contains various functions for point cloud transformation,
some of which are not used in the clean version of code,
but feel free to use them if you have different forms of point clouds.
"""
def swap_axis(input_np, swap_mode='n210'):
"""
swap axis for point clouds... | [
"numpy.mean",
"numpy.abs",
"numpy.random.shuffle",
"torch.from_numpy",
"numpy.max",
"numpy.stack",
"torch.norm",
"numpy.sum",
"numpy.random.seed",
"pdb.set_trace",
"numpy.min",
"torch.where"
] | [((4191, 4208), 'numpy.stack', 'np.stack', (['pcd_new'], {}), '(pcd_new)\n', (4199, 4208), True, 'import numpy as np\n'), ((4394, 4417), 'numpy.mean', 'np.mean', (['pc_CRN'], {'axis': '(0)'}), '(pc_CRN, axis=0)\n', (4401, 4417), True, 'import numpy as np\n'), ((4639, 4665), 'torch.norm', 'torch.norm', (['partial'], {'d... |
import numpy as np
from web.evaluate import calculate_purity, evaluate_categorization
from web.embedding import Embedding
from web.datasets.utils import _fetch_file
from web.datasets.categorization import fetch_ESSLI_2c
def test_purity():
y_true = np.array([1,1,2,2,3])
y_pred = np.array([2,2,2,2,1])
assert... | [
"web.datasets.categorization.fetch_ESSLI_2c",
"web.datasets.utils._fetch_file",
"web.evaluate.calculate_purity",
"numpy.array",
"web.evaluate.evaluate_categorization",
"web.embedding.Embedding.from_word2vec"
] | [((253, 278), 'numpy.array', 'np.array', (['[1, 1, 2, 2, 3]'], {}), '([1, 1, 2, 2, 3])\n', (261, 278), True, 'import numpy as np\n'), ((288, 313), 'numpy.array', 'np.array', (['[2, 2, 2, 2, 1]'], {}), '([2, 2, 2, 2, 1])\n', (296, 313), True, 'import numpy as np\n'), ((412, 428), 'web.datasets.categorization.fetch_ESSLI... |
import argparse
import numpy as np
from squeezenet import SqueezeNet
import os
from keras.preprocessing import image
from keras.applications.imagenet_utils import preprocess_input
SIZE = 227
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--checkpoint-path', required=True)
parser.add_a... | [
"keras.preprocessing.image.img_to_array",
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.array",
"keras.applications.imagenet_utils.preprocess_input",
"squeezenet.SqueezeNet",
"keras.preprocessing.image.load_img"
] | [((218, 243), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (241, 243), False, 'import argparse\n'), ((475, 525), 'squeezenet.SqueezeNet', 'SqueezeNet', ([], {'weights': 'None', 'classes': 'args.num_classes'}), '(weights=None, classes=args.num_classes)\n', (485, 525), False, 'from squeezenet i... |
import numpy as np
import pandas as pd
from rbergomi.rbergomi_utils import *
class rBergomi(object):
"""
Class for generating paths of the rBergomi model.
Integral equations for reference:
Y(t) := sqrt(2a + 1) int 0,t (t - u)^a dW(u)
V(t) := xi exp(eta Y - 0.5 eta^2 t^(2a + 1))
S(t) := S0 int ... | [
"numpy.random.normal",
"numpy.mean",
"numpy.convolve",
"numpy.sqrt",
"numpy.squeeze",
"numpy.exp",
"numpy.linalg.cholesky",
"numpy.zeros",
"numpy.linspace",
"numpy.matmul",
"numpy.random.seed",
"pandas.DataFrame",
"numpy.cumsum",
"numpy.maximum",
"numpy.zeros_like",
"numpy.arange",
"... | [((1276, 1296), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1290, 1296), True, 'import numpy as np\n'), ((1322, 1360), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(self.N, 4 * s)'}), '(size=(self.N, 4 * s))\n', (1338, 1360), True, 'import numpy as np\n'), ((1602, 1629), 'numpy.zero... |
'''
Created on 2014-8-28
@author: xiajie
'''
import numpy as np
def centering(X):
N = len(X)
D = len(X[0])
centered = np.zeros((N, D))
mean = np.mean(X, axis=0)
for i in range(N):
centered[i] = X[i] - mean
return centered
def eigen_decomposition(X):
cov = X.dot(np.transpose(X))
... | [
"numpy.mean",
"numpy.zeros",
"numpy.transpose",
"numpy.linalg.eig"
] | [((132, 148), 'numpy.zeros', 'np.zeros', (['(N, D)'], {}), '((N, D))\n', (140, 148), True, 'import numpy as np\n'), ((160, 178), 'numpy.mean', 'np.mean', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (167, 178), True, 'import numpy as np\n'), ((329, 347), 'numpy.linalg.eig', 'np.linalg.eig', (['cov'], {}), '(cov)\n', (342... |
import os
import glob
import pickle
from functools import wraps
from concurrent import futures
import cv2
import numpy as np
from PIL import Image
import yaml
from matplotlib import pyplot as plt
import layoutparser as lp
from tqdm import tqdm
def detect_wrapper(fn):
@wraps(fn)
def wrap(parser, im, *args, **... | [
"cv2.rectangle",
"matplotlib.pyplot.imshow",
"os.path.exists",
"os.listdir",
"os.makedirs",
"concurrent.futures.ThreadPoolExecutor",
"os.path.join",
"functools.wraps",
"numpy.ndarray",
"os.path.basename",
"layoutparser.draw_box",
"layoutparser.Detectron2LayoutModel",
"cv2.imread",
"os.walk... | [((276, 285), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (281, 285), False, 'from functools import wraps\n'), ((5933, 5955), 'os.listdir', 'os.listdir', (['models_dir'], {}), '(models_dir)\n', (5943, 5955), False, 'import os\n'), ((1103, 1117), 'cv2.imread', 'cv2.imread', (['im'], {}), '(im)\n', (1113, 1117), ... |
import argparse
import re
import os
import json
import numpy as np
import pickle as pkl
"""
for extracting word embedding yourself, please download pretrained model from one of the following links.
"""
url = {'glove': 'http://nlp.stanford.edu/data/glove.6B.zip',
'google': 'https://drive.google.com/file/d/0B7Xk... | [
"re.split",
"os.path.exists",
"pickle.dump",
"argparse.ArgumentParser",
"gensim.models.keyedvectors.KeyedVectors.load_word2vec_format",
"os.path.join",
"numpy.array",
"numpy.zeros",
"os.path.dirname",
"numpy.linalg.norm",
"json.load"
] | [((1563, 1582), 'numpy.array', 'np.array', (['all_feats'], {}), '(all_feats)\n', (1571, 1582), True, 'import numpy as np\n'), ((2632, 2674), 'os.path.join', 'os.path.join', (['txt_dir', '"""glove.6B.300d.txt"""'], {}), "(txt_dir, 'glove.6B.300d.txt')\n", (2644, 2674), False, 'import os\n'), ((2705, 2723), 'numpy.zeros'... |
import dateutil
from typing import List
import numpy as np
import pandas as pd
from macpie._config import get_option
from macpie import lltools, strtools
def add_diff_days(
df: pd.DataFrame, col_start: str, col_end: str, diff_days_col: str = None, inplace=False
):
"""Adds a column to DataFrame called ``_dif... | [
"macpie._config.get_option",
"macpie.strtools.strip_suffix",
"pandas.merge",
"macpie.lltools.list_like_str_equal",
"macpie.lltools.is_list_like",
"macpie.strtools.str_equals",
"numpy.invert",
"numpy.timedelta64",
"pandas.to_datetime",
"pandas.api.types.is_datetime64_any_dtype"
] | [((5815, 5840), 'numpy.invert', 'np.invert', (['cols_match_pat'], {}), '(cols_match_pat)\n', (5824, 5840), True, 'import numpy as np\n'), ((8547, 8577), 'macpie.lltools.is_list_like', 'lltools.is_list_like', (['col_name'], {}), '(col_name)\n', (8567, 8577), False, 'from macpie import lltools, strtools\n'), ((10178, 102... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 3 21:06:23 2018
@author: <NAME>
"""
import numpy as np
from metodos_numericos.LU import LU
from metodos_numericos.Gauss import Gauss
#from Utils import Utils
#from TabelaGauss import TabelaGauss
from TabelaGaussLegendre import TabelaGaussLegendre
... | [
"numpy.float64",
"numpy.zeros",
"metodos_numericos.LU.LU",
"TabelaGaussLegendre.TabelaGaussLegendre"
] | [((467, 505), 'numpy.zeros', 'np.zeros', (['(tam, tam)'], {'dtype': 'np.float64'}), '((tam, tam), dtype=np.float64)\n', (475, 505), True, 'import numpy as np\n'), ((517, 551), 'numpy.zeros', 'np.zeros', (['(tam,)'], {'dtype': 'np.float64'}), '((tam,), dtype=np.float64)\n', (525, 551), True, 'import numpy as np\n'), ((1... |
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.clip",
"numpy.hstack",
"numpy.argsort",
"numpy.array",
"shapely.geometry.Polygon",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"math.atan",
"numpy.atleast_2d",
"numpy.mean",
"numpy.reshape",
"numpy.where",
"numpy.putmask",
"numpy.max",
"cv2.minAreaRect",
"numpy.stack",
... | [((1237, 1286), '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', (1244, 1286), False, 'from scipy.interpolate import splprep, splev\n'), ((1354, 1378), 'scipy.interpolate.splev', 'splev', (['u_new', 'tck']... |
# -*- coding: UTF-8 -*-
"""
spanning_tree
=============
Script: spanning_tree.py
Author: <EMAIL>
Modified: 2018-06-13
Original: ... mst.py in my github
extensive documentation is there.
Purpose:
--------
Produce a spanning tree from a point set. I have yet to confirm
whether it constitutes ... | [
"numpy.prod",
"arcpytools_pnt.fc_info",
"arcpy.CopyFeatures_management",
"textwrap.dedent",
"numpy.set_printoptions",
"arcpy.Point",
"arcpy.da.FeatureClassToNumPyArray",
"arcpytools_pnt.tweet",
"numpy.lexsort",
"numpy.zeros",
"arcpy.Exists",
"numpy.einsum",
"numpy.vstack",
"arcpy.Delete_ma... | [((4260, 4369), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'edgeitems': '(10)', 'linewidth': '(100)', 'precision': '(2)', 'suppress': '(True)', 'threshold': '(120)', 'formatter': 'ft'}), '(edgeitems=10, linewidth=100, precision=2, suppress=True,\n threshold=120, formatter=ft)\n', (4279, 4369), True, 'imp... |
from contextlib import suppress
from typing import Callable, Union, Iterable, List, Optional, Tuple
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import zfit
from zfit import ztf
from zfit.core.interfaces import ZfitPDF
from zfit.util import ztyping
from zfit.util.exception import Sh... | [
"tensorflow.shape",
"tensorflow.boolean_mask",
"tensorflow.assert_greater_equal",
"tensorflow.control_dependencies",
"tensorflow.Session",
"tensorflow.random.shuffle",
"tensorflow_probability.mcmc.HamiltonianMonteCarlo",
"tensorflow.concat",
"tensorflow_probability.distributions.Normal",
"numpy.av... | [((6198, 6212), 'tensorflow.to_int64', 'tf.to_int64', (['n'], {}), '(n)\n', (6209, 6212), True, 'import tensorflow as tf\n'), ((12919, 12945), 'tensorflow.concat', 'tf.concat', (['samples'], {'axis': '(0)'}), '(samples, axis=0)\n', (12928, 12945), True, 'import tensorflow as tf\n'), ((673, 702), 'zfit.ztf.constant', 'z... |
'''
do not directly run this script, you should execute the unit test
by launching the "run_test.sh"
'''
import libqpsolver
import os
import time
import progressbar
import numpy as np
from random import random
from cvxopt import matrix, solvers
#show detailed unit test message
verbose = False
#unit test run time and... | [
"numpy.identity",
"progressbar.Bar",
"numpy.multiply",
"numpy.ones",
"numpy.random.rand",
"numpy.nditer",
"numpy.array",
"numpy.zeros",
"numpy.matmul",
"progressbar.Percentage",
"cvxopt.matrix",
"libqpsolver.quadprog",
"cvxopt.solvers.qp",
"random.random",
"numpy.transpose",
"time.time... | [((1597, 1640), 'cvxopt.solvers.qp', 'solvers.qp', (['P', 'q', 'A', 'b', 'A_eq', 'b_eq', 'options'], {}), '(P, q, A, b, A_eq, b_eq, options)\n', (1607, 1640), False, 'from cvxopt import matrix, solvers\n'), ((1653, 1671), 'numpy.array', 'np.array', (["sol['x']"], {}), "(sol['x'])\n", (1661, 1671), True, 'import numpy a... |
#! /usr/bin/env python
# Copyright 2021 <NAME>
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
import os
import sys
import yt
sys.path.insert(1, '../../../../warpx/Regression/Checksum/')
import checksumAPI
import numpy as np
import scipy.constants as scc
## This script performs various checks for the... | [
"numpy.clip",
"sys.path.insert",
"numpy.sqrt",
"numpy.arange",
"numpy.histogram",
"numpy.select",
"numpy.exp",
"numpy.empty",
"yt.load",
"numpy.amin",
"numpy.average",
"numpy.isclose",
"numpy.unique",
"os.getcwd",
"checksumAPI.evaluate_checksum",
"numpy.sum",
"numpy.array_equal",
"... | [((144, 204), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../../../../warpx/Regression/Checksum/"""'], {}), "(1, '../../../../warpx/Regression/Checksum/')\n", (159, 204), False, 'import sys\n'), ((4774, 4818), 'numpy.isclose', 'np.isclose', (['val1', 'val2'], {'rtol': 'rtol', 'atol': 'atol'}), '(val1, val2, rtol... |
#%%
import matplotlib.pyplot as plt
import numpy as np
x = [1,2,3,4]
y = [4,8,1,2]
plt.plot(x,y,'b')
plt.title('Gráfico.')
plt.ylabel('Eixo Y')
plt.xlabel('Eixo X')
plt.yticks(y)
plt.xticks(x)
plt.grid(axis = 'y', linestyle = ':')
plt.show()
#%%
import matplotlib.pyplot as plt
import numpy as... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.sc... | [((92, 111), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""b"""'], {}), "(x, y, 'b')\n", (100, 111), True, 'import matplotlib.pyplot as plt\n'), ((113, 134), 'matplotlib.pyplot.title', 'plt.title', (['"""Gráfico."""'], {}), "('Gráfico.')\n", (122, 134), True, 'import matplotlib.pyplot as plt\n'), ((136, 156), '... |
from __future__ import (absolute_import, division, print_function)
from collections import Iterable, OrderedDict
import wrapt
import numpy as np
import numpy.ma as ma
from .units import do_conversion, check_units, dealias_and_clean_unit
from .util import iter_left_indexes, from_args, to_np, combine_dims
from .py3co... | [
"numpy.empty"
] | [((6435, 6463), 'numpy.empty', 'np.empty', (['outdims', 'alg_dtype'], {}), '(outdims, alg_dtype)\n', (6443, 6463), True, 'import numpy as np\n')] |
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis import given, settings
import hypothesis.strategies as st
import numpy as np
import unittest
class TestGroupNormOp(serial.SerializedTestCase):
de... | [
"numpy.mean",
"hypothesis.strategies.sampled_from",
"hypothesis.strategies.integers",
"numpy.arange",
"hypothesis.strategies.floats",
"hypothesis.settings",
"caffe2.python.core.CreateOperator",
"unittest.main",
"numpy.random.randn",
"numpy.var",
"numpy.random.shuffle"
] | [((4406, 4430), 'hypothesis.settings', 'settings', ([], {'deadline': '(10000)'}), '(deadline=10000)\n', (4414, 4430), False, 'from hypothesis import given, settings\n'), ((5236, 5251), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5249, 5251), False, 'import unittest\n'), ((533, 571), 'numpy.mean', 'np.mean', ([... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by <NAME>
# 2017-03-03
"""論文[1]に従い六角格子内の1点をその六角格子セルを代表する点とみなし,
隣接する6つのセルを代表する点を繋ぐことでランダムな三角格子を生成する
[1] https://www.jstage.jst.go.jp/article/journalcpij/44.3/0/44.3_799/_pdf
"""
import numpy as np
def pick_param():
"""Pick up random point from hex region"""... | [
"numpy.sqrt",
"numpy.random.rand",
"matplotlib.tri.Triangulation",
"numpy.zeros",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1126, 1140), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1138, 1140), True, 'import matplotlib.pyplot as plt\n'), ((1717, 1756), 'matplotlib.tri.Triangulation', 'tri.Triangulation', (['lattice_X', 'lattice_Y'], {}), '(lattice_X, lattice_Y)\n', (1734, 1756), True, 'import matplotlib.tri as tri\n'... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import range
from past.utils import old_div
from .tesisfunctions import Plotim,overlay,padVH
import cv2
import numpy as np
#from invariantMoments import centroid,invmoments,normalizedinvariantmome... | [
"cv2.convexityDefects",
"past.utils.old_div",
"numpy.array",
"builtins.range",
"cv2.ellipse",
"cv2.fitEllipse",
"cv2.threshold",
"cv2.line",
"cv2.contourArea",
"cv2.drawContours",
"numpy.ones",
"cv2.circle",
"cv2.moments",
"cv2.resize",
"cv2.imread",
"cv2.convexHull",
"cv2.imwrite",
... | [((781, 796), 'cv2.imread', 'cv2.imread', (['fn1'], {}), '(fn1)\n', (791, 796), False, 'import cv2\n'), ((804, 832), 'cv2.resize', 'cv2.resize', (['fore', '(300, 300)'], {}), '(fore, (300, 300))\n', (814, 832), False, 'import cv2\n'), ((1683, 1742), 'cv2.threshold', 'cv2.threshold', (['P', '(0)', '(1)', '(cv2.THRESH_BI... |
import numpy as np
import os
import pandas as pd
import micro_dl.utils.tile_utils as tile_utils
import micro_dl.utils.aux_utils as aux_utils
import micro_dl.utils.image_utils as image_utils
import micro_dl.utils.mp_utils as mp_utils
class ImageTilerUniform:
"""Tiles all images in a dataset"""
def __init__(s... | [
"micro_dl.utils.mp_utils.mp_crop_save",
"micro_dl.utils.aux_utils.validate_metadata_indices",
"micro_dl.utils.aux_utils.read_meta",
"numpy.unique",
"os.makedirs",
"micro_dl.utils.aux_utils.get_meta_idx",
"micro_dl.utils.image_utils.preprocess_imstack",
"os.path.join",
"numpy.any",
"micro_dl.utils.... | [((3507, 3551), 'os.path.join', 'os.path.join', (['output_dir', 'self.str_tile_step'], {}), '(output_dir, self.str_tile_step)\n', (3519, 3551), False, 'import os\n'), ((4556, 4591), 'micro_dl.utils.aux_utils.read_meta', 'aux_utils.read_meta', (['self.input_dir'], {}), '(self.input_dir)\n', (4575, 4591), True, 'import m... |
import musket_core.generic_config as generic
import musket_core.datasets as datasets
import musket_core.configloader as configloader
import musket_core.utils as utils
import musket_core.context as context
import numpy as np
import keras
import musket_core.net_declaration as net
import musket_core.quasymodels as qm
impo... | [
"sys.path.insert",
"musket_core.datasets.BufferedWriteableDS",
"musket_core.utils.save",
"musket_core.datasets.generic_batch_generator",
"numpy.array",
"musket_core.context.isTrainMode",
"numpy.load",
"os.path.exists",
"os.listdir",
"musket_core.configloader.parse",
"os.path.isdir",
"musket_co... | [((9086, 9128), 'musket_core.configloader.parse', 'configloader.parse', (['"""generic"""', 'path', 'extra'], {}), "('generic', path, extra)\n", (9104, 9128), True, 'import musket_core.configloader as configloader\n'), ((841, 879), 'musket_core.utils.load_yaml', 'utils.load_yaml', (["(self.path + '.shapes')"], {}), "(se... |
import pandas as pd
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import seaborn as sns
def plot_3d_with_hue(df, cols = ['x','y','z'], hue_col='hue', title='', \
xlabel='X', ylabel='Y', zlabel='Z', figsize=(8,8), hue_color_dict={},\
fig_filepath=None):
'''
... | [
"seaborn.set",
"matplotlib.pyplot.savefig",
"seaborn.diverging_palette",
"numpy.triu_indices_from",
"seaborn.heatmap",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.figure",
"numpy.zeros_like",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((835, 862), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (845, 862), True, 'from matplotlib import pyplot as plt\n'), ((872, 883), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}), '(fig)\n', (878, 883), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((132... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
# vids = np.load('data/mnist_training_fast_videos.npy')
# bbox = np.load('data/mnist_training_fast_trajectories.npy')
# bbox[:, :, :, 3] = vids.shape[2] - bbox[:, :, :, 3]
# bbox[:, :, :, 1] = vids.shape[2] - bbox[:, :, :, 1]
# bbox = bbox.swapaxes(1, 2)
... | [
"numpy.eye",
"numpy.ones",
"numpy.random.choice",
"numpy.where",
"numpy.zeros",
"cv2.resize",
"numpy.load",
"numpy.save",
"numpy.random.permutation"
] | [((2227, 2273), 'numpy.load', 'np.load', (['"""data/icons8_testing_fast_videos.npy"""'], {}), "('data/icons8_testing_fast_videos.npy')\n", (2234, 2273), True, 'import numpy as np\n'), ((2281, 2333), 'numpy.load', 'np.load', (['"""data/icons8_testing_fast_trajectories.npy"""'], {}), "('data/icons8_testing_fast_trajector... |
from minisom import MiniSom
from numpy import genfromtxt,array,linalg,zeros,mean,std,apply_along_axis
"""
This script shows how to use MiniSom on the Iris dataset.
In partucular it shows how to train MiniSom and how to visualize the result.
ATTENTION: pylab is required for the visualization.
"""
#... | [
"pylab.axis",
"pylab.bone",
"pylab.plot",
"minisom.MiniSom",
"pylab.colorbar",
"numpy.linalg.norm",
"numpy.genfromtxt",
"pylab.show"
] | [((437, 496), 'numpy.genfromtxt', 'genfromtxt', (['"""iris.csv"""'], {'delimiter': '""","""', 'usecols': '(0, 1, 2, 3)'}), "('iris.csv', delimiter=',', usecols=(0, 1, 2, 3))\n", (447, 496), False, 'from numpy import genfromtxt, array, linalg, zeros, mean, std, apply_along_axis\n'), ((616, 662), 'minisom.MiniSom', 'Mini... |
# -*- coding: utf-8 -*-
"""Provides functions for handling images."""
import pygame
try:
import numpy
HAS_NUMPY = True
except ImportError:
HAS_NUMPY = False
from thorpy import miscgui
def detect_frame(surf, vacuum=(255, 255, 255)):
"""Returns a Rect of the minimum size to contain all that is not <v... | [
"PIL.Image.open",
"pygame.surfarray.array3d",
"pygame.Surface",
"numpy.array",
"pygame.PixelArray",
"thorpy.miscgui.application._loaded.get",
"thorpy.miscgui.functions.debug_msg",
"pygame.image.load",
"pygame.Rect",
"pygame.transform.scale"
] | [((575, 594), 'numpy.array', 'numpy.array', (['vacuum'], {}), '(vacuum)\n', (586, 594), False, 'import numpy\n'), ((607, 637), 'pygame.surfarray.array3d', 'pygame.surfarray.array3d', (['surf'], {}), '(surf)\n', (631, 637), False, 'import pygame\n'), ((1217, 1274), 'pygame.Rect', 'pygame.Rect', (['first_x', 'miny', '(la... |
import pandas as pd
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torch import nn
from torchvision import transforms
import matplotlib.pyplot as plt
import torch
import random
import torch.nn.functional as F
from torch.utils.data.sampler import SubsetRandomSampler
random_seed = 1234
torch.ma... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"pandas.read_csv",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.BatchNorm2d",
"numpy.asarray",
"numpy.random.seed",
"torchvision.transforms.ToTensor",
"torch.argmax",
"torch.utils.data.sampler.SubsetRandomSampler",
"torch.save",
"torch.cud... | [((312, 342), 'torch.manual_seed', 'torch.manual_seed', (['random_seed'], {}), '(random_seed)\n', (329, 342), False, 'import torch\n'), ((343, 378), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['random_seed'], {}), '(random_seed)\n', (365, 378), False, 'import torch\n'), ((379, 418), 'torch.cuda.manual_seed_al... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 8 23:53:36 2020
@author: <NAME>
"""
import os
import numpy as np
import matplotlib.pyplot as plt
from numpy import trapz
#https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html
os.getcwd()
#q = variable de posición, dq0 = \dot{q}(0) = valor inicial de la derivada... | [
"numpy.log10",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.max",
"numpy.linspace",
"numpy.empty",
"matplotlib.pyplot.ylim",
"numpy.abs",
"numpy.trapz",
"numpy.around",
"matplotlib.pyplot.xlim",
"numpy.int",
"matplotlib.pyplot.get_cmap",
"numpy.insert",... | [((233, 244), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (242, 244), False, 'import os\n'), ((1878, 1907), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12, 5)'}), '(figsize=(12, 5))\n', (1890, 1907), True, 'import matplotlib.pyplot as plt\n'), ((1907, 1926), 'matplotlib.pyplot.ylim', 'plt.ylim', ([... |
#import director
from director import cameraview
from director import transformUtils
from director import visualization as vis
from director import objectmodel as om
from director.ikparameters import IkParameters
from director.ikplanner import ConstraintSet
from director import polarisplatformplanner
from director imp... | [
"director.visualization.updateFrame",
"director.getDRCBaseDir",
"numpy.array",
"director.visualization.FrameSync",
"director.visualization.showPolyData",
"vtkAll.vtkTransform"
] | [((1181, 1242), 'director.visualization.showPolyData', 'vis.showPolyData', (['self.pointcloud', '"""coursemodel"""'], {'parent': 'None'}), "(self.pointcloud, 'coursemodel', parent=None)\n", (1197, 1242), True, 'from director import visualization as vis\n'), ((1641, 1728), 'director.visualization.updateFrame', 'vis.upda... |
import abc
from typing import Dict, List, Deque
import datetime
import numpy
from agnes.algos.base import _BaseAlgo
from agnes.common import logger
from agnes.common.schedules import Saver
from agnes.nns.initializer import _BaseChooser
from agnes.common.envs_prep import DummyVecEnv
class BaseRunner(abc.ABC):
lo... | [
"agnes.common.schedules.Saver",
"numpy.asarray",
"agnes.common.logger.safemean",
"agnes.common.logger.ListLogger"
] | [((327, 346), 'agnes.common.logger.ListLogger', 'logger.ListLogger', ([], {}), '()\n', (344, 346), False, 'from agnes.common import logger\n'), ((366, 373), 'agnes.common.schedules.Saver', 'Saver', ([], {}), '()\n', (371, 373), False, 'from agnes.common.schedules import Saver\n'), ((1269, 1293), 'agnes.common.logger.Li... |
from sklearn.preprocessing import OneHotEncoder
import numpy as np
fuel = ['Diesel', 'Petrol', 'LPG', 'CNG']
seller_type = ['Individual', 'Dealer', 'Trustmark Dealer']
transmission = ['Manual', 'Automatic']
owner = ['First Owner', 'Second Owner', 'Third Owner', 'Fourth & Above Owner', 'Test Drive Car']
enc1 = OneHo... | [
"numpy.append",
"sklearn.preprocessing.OneHotEncoder",
"numpy.array"
] | [((315, 353), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'handle_unknown': '"""ignore"""'}), "(handle_unknown='ignore')\n", (328, 353), False, 'from sklearn.preprocessing import OneHotEncoder\n'), ((401, 439), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'handle_unknown': '"""ignore"... |
import numpy as np
from matplotlib import pyplot as plt
def plot_interval(X,Y,ratio=1):
m = int(len(X) * ratio)
X = X[0:m]
Y = Y[0:m]
c = list()
for idx in range(m):
if Y[idx]==1:
c.append('r')
else:
c.append('b')
fig = plt.figure()
plt.scatter(X,Y,c=... | [
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.savefig",
"numpy.where",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis"
] | [((285, 297), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (295, 297), True, 'from matplotlib import pyplot as plt\n'), ((302, 324), 'matplotlib.pyplot.scatter', 'plt.scatter', (['X', 'Y'], {'c': 'c'}), '(X, Y, c=c)\n', (313, 324), True, 'from matplotlib import pyplot as plt\n'), ((327, 360), 'matplotlib... |
import numpy as np
from math import pi
from os.path import join
import matplotlib.pyplot as plt
from src import MLEnergy, list_tl_files
plt.ion()
source_depth = 'shallow'
#source_depth = 'deep'
def one_freq(fc):
tl_list = list_tl_files(fc, source_depth=source_depth)
x_s = []
e_ri = []
e_ri_0 = []
... | [
"numpy.savez",
"src.MLEnergy",
"numpy.array",
"matplotlib.pyplot.ion",
"src.list_tl_files"
] | [((138, 147), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (145, 147), True, 'import matplotlib.pyplot as plt\n'), ((1245, 1319), 'numpy.savez', 'np.savez', (["('data/processed/bg_ri_eng_' + source_depth + '.npz')"], {}), "('data/processed/bg_ri_eng_' + source_depth + '.npz', **save_dict)\n", (1253, 1319), Tru... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import numpy as np
import cntk as C
import pytest
def test_slice_stride():
c... | [
"cntk.internal.sanitize_value",
"numpy.ones",
"cntk.constant",
"cntk.parameter"
] | [((438, 457), 'cntk.constant', 'C.constant', ([], {'value': '(2)'}), '(value=2)\n', (448, 457), True, 'import cntk as C\n'), ((677, 720), 'cntk.internal.sanitize_value', 'sanitize_value', (['(2, 3)', '(1)', 'np.float32', 'None'], {}), '((2, 3), 1, np.float32, None)\n', (691, 720), False, 'from cntk.internal import sani... |
# -*- coding: utf-8 -*-
import unittest
import io
import numpy as np
from itertools import islice
from xnmt.input import PlainTextReader
from xnmt.embedder import PretrainedSimpleWordEmbedder
from xnmt.model_context import ModelContext, PersistentParamCollection
import xnmt.events
class PretrainedSimpleWordEmbedde... | [
"xnmt.embedder.PretrainedSimpleWordEmbedder",
"itertools.islice",
"xnmt.model_context.PersistentParamCollection",
"io.open",
"numpy.array",
"xnmt.input.PlainTextReader",
"xnmt.model_context.ModelContext"
] | [((419, 436), 'xnmt.input.PlainTextReader', 'PlainTextReader', ([], {}), '()\n', (434, 436), False, 'from xnmt.input import PlainTextReader\n'), ((551, 565), 'xnmt.model_context.ModelContext', 'ModelContext', ([], {}), '()\n', (563, 565), False, 'from xnmt.model_context import ModelContext, PersistentParamCollection\n'... |
"""Hierarchical clustering of the data"""
from functools import partial
import logging
import os
import pickle
from typing import Callable, Dict, NamedTuple, NewType
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.cluster.hierarchy as hcl
import scipy.io as sio
from skimage.io impor... | [
"pickle.dump",
"spdivik._scripting.initialize",
"spdivik.visualize.visualize",
"scipy.cluster.hierarchy.to_mlab_linkage",
"typing.NewType",
"numpy.max",
"spdivik.kmeans._scripting.parsers.assert_configured",
"matplotlib.pyplot.close",
"scipy.cluster.hierarchy.fcluster",
"functools.partial",
"log... | [((503, 539), 'typing.NewType', 'NewType', (['"""LinkageMatrix"""', 'np.ndarray'], {}), "('LinkageMatrix', np.ndarray)\n", (510, 539), False, 'from typing import Callable, Dict, NamedTuple, NewType\n'), ((605, 632), 'typing.NewType', 'NewType', (['"""Dendrogram"""', 'Dict'], {}), "('Dendrogram', Dict)\n", (612, 632), F... |
import os
import numpy as np
from sklearn.utils import shuffle
from keras.utils import to_categorical
__author__ = '<NAME>'
def get_risk_group(x_trn, c_trn, s_trn, high_risk_th, low_risk_th):
hg = []
lg = []
for n,os in enumerate(s_trn):
if os <= high_risk_th and c_trn[n] == 0:
hg.appe... | [
"sklearn.utils.shuffle",
"numpy.asarray",
"numpy.concatenate",
"keras.utils.to_categorical"
] | [((498, 522), 'numpy.concatenate', 'np.concatenate', (['[hg, lg]'], {}), '([hg, lg])\n', (512, 522), True, 'import numpy as np\n'), ((592, 620), 'numpy.concatenate', 'np.concatenate', (['[hg_y, lg_y]'], {}), '([hg_y, lg_y])\n', (606, 620), True, 'import numpy as np\n'), ((727, 767), 'sklearn.utils.shuffle', 'shuffle', ... |
#!/usr/bin/env python3
# Copyright 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.
"""Full DrQA pipeline."""
import heapq
import logging
import math
import time
from multiprocessing import Pool... | [
"logging.getLogger",
"numpy.mean",
"heapq.heappushpop",
"numpy.std",
"regex.split",
"numpy.array",
"heapq.heappop",
"multiprocessing.Pool",
"torch.utils.data.DataLoader",
"multiprocessing.util.Finalize",
"heapq.heappush",
"time.time"
] | [((603, 630), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (620, 630), False, 'import logging\n'), ((1087, 1148), 'multiprocessing.util.Finalize', 'Finalize', (['PROCESS_TOK', 'PROCESS_TOK.shutdown'], {'exitpriority': '(100)'}), '(PROCESS_TOK, PROCESS_TOK.shutdown, exitpriority=100)\n',... |
import os
import sys
import csv
import json
import math
import enum
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
from os import listdir
from os.path import isfile, join
from skimage import measure
from skimage import filters
from scipy import ndimage
class OutputShapeType(enum.Enum... | [
"matplotlib.pyplot.hist",
"numpy.array",
"numpy.arctan2",
"matplotlib.pyplot.imshow",
"os.listdir",
"matplotlib.colors.ListedColormap",
"numpy.exp",
"numpy.dot",
"matplotlib.pyplot.axis",
"numpy.hypot",
"scipy.ndimage.filters.convolve",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.show"... | [((16786, 16824), 'matplotlib.pyplot.hist', 'plt.hist', (['densities'], {'bins': 'density_bins'}), '(densities, bins=density_bins)\n', (16794, 16824), True, 'import matplotlib.pyplot as plt\n'), ((16827, 16837), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (16835, 16837), True, 'import matplotlib.pyplot as p... |
import warnings
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pyDeltaRCM
# filter out the warning raised about no netcdf being found
warnings.filterwarnings("ignore", category=UserWarning)
n = 10
cm = matplotlib.cm.get_cmap('tab10')
# init delta model
with pyDeltaRCM.shared_tools._... | [
"warnings.filterwarnings",
"pyDeltaRCM.DeltaModel",
"matplotlib.cm.get_cmap",
"pyDeltaRCM.debug_tools.plot_domain",
"pyDeltaRCM.shared_tools.custom_unravel",
"numpy.random.randint",
"pyDeltaRCM.shared_tools._docs_temp_directory",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"mat... | [((167, 222), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (190, 222), False, 'import warnings\n'), ((237, 268), 'matplotlib.cm.get_cmap', 'matplotlib.cm.get_cmap', (['"""tab10"""'], {}), "('tab10')\n", (259, 268), False, 'i... |
import matplotlib as mpl
import uproot3 as uproot
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator)
import scipy
import numpy as np
import math
import pandas as pd
import seaborn as sns
import mplhep as hep
#import zfit
import inspect
import sys
... | [
"matplotlib.ticker.NullFormatter",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"math.cos",
"math.sinh",
"numpy.arange",
"numpy.histogram",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"numpy.diff",
"math.fabs",
"matplotlib.pyplot.axis",
"matplotlib.py... | [((389, 419), 'matplotlib.pyplot.style.use', 'plt.style.use', (['hep.style.ATLAS'], {}), '(hep.style.ATLAS)\n', (402, 419), True, 'import matplotlib.pyplot as plt\n'), ((421, 578), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.sans-serif': 'Arial', 'font.family': 'sans-serif', 'font.size': 30,\n... |
import setuptools
from typing import List
import glob
from Cython.Build import cythonize
import numpy as np
def get_scripts_from_bin() -> List[str]:
"""Get all local scripts from bin so they are included in the package."""
return glob.glob("bin/*")
def get_package_description() -> str:
"""Returns a desc... | [
"Cython.Build.cythonize",
"setuptools.find_packages",
"glob.glob",
"numpy.get_include"
] | [((240, 258), 'glob.glob', 'glob.glob', (['"""bin/*"""'], {}), "('bin/*')\n", (249, 258), False, 'import glob\n'), ((822, 867), 'Cython.Build.cythonize', 'cythonize', (['"""my_ml/model/_split_data_fast.pyx"""'], {}), "('my_ml/model/_split_data_fast.pyx')\n", (831, 867), False, 'from Cython.Build import cythonize\n'), (... |
import numpy as np
class NN_Model:
LEARNING_RATE = 0.1
LAYERS = 2
@staticmethod
def cost_mse(prediction: float):
return (prediction - NN_Model.TARGET) ** 2
@staticmethod
def sigmoid(x: float):
return 1 / (1 + np.exp(-x))
@staticmethod
def sigmoid_deriv(x: float)... | [
"numpy.exp",
"numpy.array"
] | [((385, 397), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (393, 397), True, 'import numpy as np\n'), ((258, 268), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (264, 268), True, 'import numpy as np\n')] |
"""
Various functions for model evaluation.
"""
import numpy as np
import pandas as pd
from utils.load_data_raw import DataGenerator_raw
from utils.custom_loss import angle_diff_deg
from utils.plot import plot_history
def model_complete_eval(model, history, part_test, params, batch_size=1024,
... | [
"utils.plot.plot_history",
"utils.custom_loss.angle_diff_deg",
"numpy.max",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.square",
"numpy.min",
"utils.load_data_raw.DataGenerator_raw",
"numpy.arange"
] | [((1809, 1847), 'utils.load_data_raw.DataGenerator_raw', 'DataGenerator_raw', (['part_test'], {}), '(part_test, **params)\n', (1826, 1847), False, 'from utils.load_data_raw import DataGenerator_raw\n'), ((3489, 3506), 'numpy.min', 'np.min', (['part_test'], {}), '(part_test)\n', (3495, 3506), True, 'import numpy as np\n... |
"""
Created by <NAME>
"""
import numpy as np
from scipy.stats import truncnorm
import statsmodels.api as sm
from py4etrics.base_for_models import GenericLikelihoodModel_TobitTruncreg
class Truncreg(GenericLikelihoodModel_TobitTruncreg):
"""
Method 1:
Truncreg(endog, exog, left=<-np.inf>, right=<np.inf>).f... | [
"numpy.append",
"numpy.exp",
"numpy.dot",
"numpy.std",
"statsmodels.api.OLS"
] | [((1308, 1323), 'numpy.dot', 'np.dot', (['x', 'beta'], {}), '(x, beta)\n', (1314, 1323), True, 'import numpy as np\n'), ((1981, 2002), 'numpy.std', 'np.std', (['res_ols.resid'], {}), '(res_ols.resid)\n', (1987, 2002), True, 'import numpy as np\n'), ((2064, 2096), 'numpy.append', 'np.append', (['params_ols', 'sigma_ols'... |
import os
import shutil
import numpy as np
import pandas as pd
import pytest
from .. import misc
class _FakeTable(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
@pytest.fixture
def fta():
return _FakeTable('a', ['aa', 'ab', 'ac'])
@pytest.fixture
def ... | [
"pandas.Series",
"numpy.array",
"os.path.isdir",
"pytest.raises",
"shutil.rmtree",
"pandas.DataFrame"
] | [((1466, 1565), 'pandas.DataFrame', 'pd.DataFrame', (["{'to_zone_id': [2, 3, 4], 'from_zone_id': [1, 1, 1], 'distance': [0.1, 0.2,\n 0.9]}"], {}), "({'to_zone_id': [2, 3, 4], 'from_zone_id': [1, 1, 1],\n 'distance': [0.1, 0.2, 0.9]})\n", (1478, 1565), True, 'import pandas as pd\n'), ((1722, 1771), 'pandas.Series'... |
import unittest
import numpy as np
import scipy.stats
import sys
from kldmwr import bivar
from kldmwr import distributions2d
def bvnrm_pdf(x, p):
mu = [0, 0]
sgm = [[p[0], p[1]], [p[1], p[2]]]
return scipy.stats.multivariate_normal.pdf(x, mean=mu, cov=sgm)
def bvnrm_cdf(x, p):
mu = [0, 0]
sgm = [... | [
"kldmwr.bivar.order_stats",
"kldmwr.bivar.find_relvts_in",
"numpy.testing.assert_equal",
"numpy.reshape",
"kldmwr.bivar.mle",
"kldmwr.bivar.find_boundary_bbs",
"kldmwr.bivar.find_relbbs",
"numpy.array",
"numpy.testing.assert_almost_equal",
"kldmwr.bivar.zbce",
"unittest.main",
"kldmwr.bivar.fi... | [((6865, 6880), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6878, 6880), False, 'import unittest\n'), ((789, 906), 'numpy.array', 'np.array', (['[[-1.797, -0.648], [0.436, 0.812], [0.436, 0.812], [-0.044, -0.884], [-\n 0.064, -0.884], [1.886, 0.957]]'], {}), '([[-1.797, -0.648], [0.436, 0.812], [0.436, 0.81... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 21 11:28:21 2019
@author: keelin
"""
from numpy import fliplr, flipud
from opencxr.utils.resize_rescale import rescale_to_min_max
from skimage import util
from skimage.transform import rotate
def invert_grayscale(np_array_in, preserve_dtype=True):
"""
A method ... | [
"skimage.util.invert",
"numpy.flipud",
"skimage.transform.rotate",
"numpy.fliplr",
"opencxr.utils.resize_rescale.rescale_to_min_max"
] | [((691, 715), 'skimage.util.invert', 'util.invert', (['np_array_in'], {}), '(np_array_in)\n', (702, 715), False, 'from skimage import util\n'), ((1486, 1516), 'skimage.transform.rotate', 'rotate', (['np_array_in', 'rot_angle'], {}), '(np_array_in, rot_angle)\n', (1492, 1516), False, 'from skimage.transform import rotat... |
###Package Importing
import numpy as np
import pandas as pd
from sklearn import metrics
import logging
from sklearn.externals import joblib
from sklearn.metrics import f1_score
import matplotlib.pyplot as plt
import os
from datetime import datetime
from preprocessing import hash_col
from preprocessing import on... | [
"logging.getLogger",
"model.machine_learning.LR",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.roc_curve",
"numpy.mean",
"model.machine_learning.RF",
"numpy.float64",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"model.machine_learni... | [((825, 852), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (842, 852), False, 'import logging\n'), ((909, 939), 'logging.FileHandler', 'logging.FileHandler', (['"""log.txt"""'], {}), "('log.txt')\n", (928, 939), False, 'import logging\n'), ((991, 1064), 'logging.Formatter', 'logging.For... |
# -*- coding: utf-8 -*-
import math
import random
import torch
import numpy as np
class BucketIterator(object):
def __init__(self, data, batch_size, shuffle=True, sort=True):
self.shuffle = shuffle
self.sort = sort
self.batches, self.max_doc_len, self.num_batch = self.sort_and_p... | [
"torch.tensor",
"numpy.pad",
"random.shuffle"
] | [((3191, 3219), 'random.shuffle', 'random.shuffle', (['self.batches'], {}), '(self.batches)\n', (3205, 3219), False, 'import random\n'), ((2480, 2568), 'numpy.pad', 'np.pad', (['y_pair', '((0, max_doc_len - doc_len), (0, max_doc_len - doc_len))', '"""constant"""'], {}), "(y_pair, ((0, max_doc_len - doc_len), (0, max_do... |
import numpy as np
from scipy.signal import savgol_filter
from qube.postprocess.dataset import Axis
def create_name(name, suffix=None, prefix=None):
elements = []
if prefix:
elements.append(str(prefix))
elements.append(str(name))
if suffix:
elements.append(str(suffix))
name = '_'.j... | [
"numpy.less_equal",
"scipy.signal.savgol_filter",
"qube.postprocess.dataset.Axis",
"numpy.nanmean",
"numpy.array",
"numpy.count_nonzero",
"numpy.argsort",
"numpy.moveaxis",
"numpy.gradient",
"numpy.greater_equal",
"numpy.mean",
"numpy.histogram",
"numpy.less",
"numpy.greater",
"numpy.sor... | [((1153, 1253), 'numpy.histogram', 'np.histogram', (['ds.value'], {'bins': 'bins', 'range': 'range', 'normed': 'normed', 'weights': 'weights', 'density': 'density'}), '(ds.value, bins=bins, range=range, normed=normed, weights=\n weights, density=density)\n', (1165, 1253), True, 'import numpy as np\n'), ((1367, 1418)... |
from typing import Tuple
import numpy as np
from keras import Input, Model
from keras.callbacks import History
from keras.engine.saving import load_model
from keras.layers import Dense, regularizers, Dropout, BatchNormalization
from keras.optimizers import Optimizer
class MLP:
def __init__(self, input_size: Tupl... | [
"keras.Model",
"keras.Input",
"numpy.empty",
"keras.layers.Dense",
"keras.engine.saving.load_model",
"keras.layers.BatchNormalization",
"keras.layers.Dropout",
"keras.layers.regularizers.l1_l2"
] | [((730, 753), 'keras.Input', 'Input', ([], {'shape': 'input_size'}), '(shape=input_size)\n', (735, 753), False, 'from keras import Input, Model\n'), ((1382, 1423), 'keras.Model', 'Model', ([], {'inputs': 'inputs', 'outputs': 'predictions'}), '(inputs=inputs, outputs=predictions)\n', (1387, 1423), False, 'from keras imp... |
from tensorflow import keras
from tqdm import tqdm
import os
import matplotlib.pyplot as plt
import cv2
from skimage.color import rgb2gray, gray2rgb, rgb2lab, lab2rgb
import numpy as np
from inception_embeddings import inception_embedding
import json
with open('parameters.json') as f:
data = json.load... | [
"skimage.color.rgb2gray",
"os.listdir",
"skimage.color.rgb2lab",
"cv2.imread",
"skimage.color.lab2rgb",
"inception_embeddings.inception_embedding",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"tensorflow.keras.models.load_model",
"matplotlib.pyplot.tight_layout",
"cv2.cvtColor",
... | [((368, 401), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['filepath'], {}), '(filepath)\n', (391, 401), False, 'from tensorflow import keras\n'), ((793, 816), 'inception_embeddings.inception_embedding', 'inception_embedding', (['im'], {}), '(im)\n', (812, 816), False, 'from inception_embeddings i... |
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import binascii
import numpy as np
import random
import argparse
import time
from lxml import etree
from lm_scorer import LMScorer
from utils import _load_config, _remove_outliner
from pdfalto.alto_parser import filter_text
from pdfalto.wrapper import PdfAltoWrapper
... | [
"utils._load_config",
"pdfalto.wrapper.PdfAltoWrapper",
"numpy.array",
"xgboost.Booster",
"lxml.etree.fromstring",
"xgboost.DMatrix",
"logging.info",
"logging.error",
"lxml.etree.tostring",
"os.remove",
"numpy.mean",
"os.listdir",
"argparse.ArgumentParser",
"numpy.max",
"pdfalto.alto_par... | [((420, 497), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""client.log"""', 'filemode': '"""w"""', 'level': 'logging.DEBUG'}), "(filename='client.log', filemode='w', level=logging.DEBUG)\n", (439, 497), False, 'import logging\n'), ((14206, 14337), 'argparse.ArgumentParser', 'argparse.ArgumentParse... |
# ----------------------------------------------------------------------------------------------
# CoFormer Official Code
# Copyright (c) <NAME>. All Rights Reserved
# Licensed under the Apache License 2.0 [see LICENSE for details]
# -------------------------------------------------------------------------------------... | [
"cv2.rectangle",
"nltk.download",
"torch.from_numpy",
"util.misc.get_sha",
"numpy.array",
"argparse.ArgumentParser",
"pathlib.Path",
"models.build_model",
"numpy.random.seed",
"util.misc.init_distributed_mode",
"torch.topk",
"re.match",
"cv2.putText",
"util.misc.nested_tensor_from_tensor_l... | [((1315, 1337), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (1325, 1337), False, 'import cv2\n'), ((3134, 3169), 'numpy.array', 'np.array', (['[[[0.485, 0.456, 0.406]]]'], {}), '([[[0.485, 0.456, 0.406]]])\n', (3142, 3169), True, 'import numpy as np\n'), ((3180, 3215), 'numpy.array', 'np.array',... |
# -------------------------------------------------------
# CSCI 561, Spring 2021
# Homework 1
# The Oregon Trail
# Author: <NAME>
# This creates a Node class,
# representing the node in search space
# -------------------------------------------------------
import numpy as np
class Node:
def __init__(self, xy, h)... | [
"numpy.array2string"
] | [((614, 661), 'numpy.array2string', 'np.array2string', (['xy'], {'precision': '(0)', 'separator': '""","""'}), "(xy, precision=0, separator=',')\n", (629, 661), True, 'import numpy as np\n')] |
"""
Internal tools needed to query the index based on rectangles
and position/radius. Based on tools in argodata:
https://github.com/ArgoCanada/argodata/blob/master/R/utils.R#L54-L165
"""
import warnings
import numpy as np
def geodist_rad(long1, lat1, long2, lat2, R=6371.010):
delta_long = long2 - long1
delt... | [
"numpy.sqrt",
"numpy.minimum",
"numpy.sin",
"warnings.catch_warnings",
"numpy.asarray",
"numpy.asfarray",
"numpy.cos",
"warnings.simplefilter",
"numpy.maximum",
"numpy.isinf"
] | [((760, 794), 'numpy.maximum', 'np.maximum', (["r1['xmin']", "r2['xmin']"], {}), "(r1['xmin'], r2['xmin'])\n", (770, 794), True, 'import numpy as np\n'), ((812, 846), 'numpy.minimum', 'np.minimum', (["r1['xmax']", "r2['xmax']"], {}), "(r1['xmax'], r2['xmax'])\n", (822, 846), True, 'import numpy as np\n'), ((864, 898), ... |
# -*- coding: utf-8 -*-
import os
import gzip
import tarfile
import numpy as np
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
from astropy import wcs
from astropy.coordinates import SkyCoord
from pymoc import MOC
from pymoc.io.fits import read_moc_fits
def downloadFile(url, dest_... | [
"tarfile.open",
"pymoc.MOC",
"gzip.open",
"os.path.join",
"astropy.coordinates.SkyCoord",
"urllib.request.urlopen",
"os.path.isfile",
"numpy.array",
"os.path.basename",
"astropy.wcs.WCS",
"os.remove"
] | [((976, 1000), 'tarfile.open', 'tarfile.open', (['input_file'], {}), '(input_file)\n', (988, 1000), False, 'import tarfile\n'), ((1209, 1236), 'gzip.open', 'gzip.open', (['input_file', '"""rb"""'], {}), "(input_file, 'rb')\n", (1218, 1236), False, 'import gzip\n'), ((3586, 3602), 'astropy.wcs.WCS', 'wcs.WCS', ([], {'na... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**Licensing:** AG... | [
"log.warning",
"log.notice",
"getpath.getSysDataPath",
"log.error",
"log.debug",
"numpy.zeros",
"debugdump.dump.appendMessage",
"time.time",
"log.message",
"image.Image"
] | [((1331, 1378), 'getpath.getSysDataPath', 'getSysDataPath', (['"""textures/texture_notfound.png"""'], {}), "('textures/texture_notfound.png')\n", (1345, 1378), False, 'from getpath import getSysDataPath\n'), ((9761, 9798), 'log.message', 'log.message', (['"""Reloading all textures"""'], {}), "('Reloading all textures')... |
from dask.distributed import Client
import dask.array as da
import dask_ml
import dask_bigquery
import numpy as np
client = Client("localhost:8786")
x = da.sum(np.ones(5))
x.compute()
| [
"dask.distributed.Client",
"numpy.ones"
] | [((126, 150), 'dask.distributed.Client', 'Client', (['"""localhost:8786"""'], {}), "('localhost:8786')\n", (132, 150), False, 'from dask.distributed import Client\n'), ((163, 173), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (170, 173), True, 'import numpy as np\n')] |
from openmdao.api import ExplicitComponent
import numpy as np
import os
import sys
from wisdem.pymap import pyMAP
from wisdem.commonse import gravity, Enum
from wisdem.commonse.utilities import assembleI, unassembleI
Anchor = Enum('DRAGEMBEDMENT SUCTIONPILE')
NLINES_MAX = 15
NPTS_PLOT = 20
class MapMooring(Explic... | [
"numpy.mean",
"numpy.eye",
"numpy.trapz",
"numpy.sqrt",
"wisdem.pymap.pyMAP",
"numpy.array",
"wisdem.commonse.Enum",
"numpy.zeros",
"numpy.linspace",
"numpy.cos",
"numpy.dot",
"numpy.outer",
"numpy.sin",
"numpy.deg2rad",
"numpy.gradient",
"numpy.arange"
] | [((231, 264), 'wisdem.commonse.Enum', 'Enum', (['"""DRAGEMBEDMENT SUCTIONPILE"""'], {}), "('DRAGEMBEDMENT SUCTIONPILE')\n", (235, 264), False, 'from wisdem.commonse import gravity, Enum\n'), ((19924, 19931), 'wisdem.pymap.pyMAP', 'pyMAP', ([], {}), '()\n', (19929, 19931), False, 'from wisdem.pymap import pyMAP\n'), ((2... |
import json
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import csv
import time
import copy
import os
from datetime import datetime
import error_metrics
global gld_num
gld_num = '1'
os.chdir('/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process')
# discard_time = 3600*4
#... | [
"numpy.abs",
"json.loads",
"error_metrics.calculate",
"numpy.sqrt",
"numpy.imag",
"datetime.datetime.strptime",
"numpy.where",
"os.chdir",
"numpy.array",
"numpy.real",
"numpy.sum",
"csv.reader",
"copy.deepcopy",
"numpy.nonzero",
"time.time",
"matplotlib.pyplot.subplots",
"matplotlib.... | [((214, 299), 'os.chdir', 'os.chdir', (['"""/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process"""'], {}), "('/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process'\n )\n", (222, 299), False, 'import os\n'), ((400, 414), 'json.loads', 'json.loads', (['lp'], {}), '(lp)\n', (410, 414), ... |
from __future__ import print_function
import sys, os.path as path
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
from summarizer.utils.reader import read_csv
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import os
import argparse
from sets import S... | [
"matplotlib.pyplot.hist",
"numpy.sqrt",
"numpy.array",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.subplot2grid",
"sets.Set",
"numpy.arange",
"numpy.mean",
"matplotlib.mlab.normpdf",
"os.listdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.linspace",
"nu... | [((348, 362), 'matplotlib.use', 'mpl.use', (['"""pgf"""'], {}), "('pgf')\n", (355, 362), True, 'import matplotlib as mpl\n'), ((12684, 12741), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Results Aggregator"""'}), "(description='Results Aggregator')\n", (12707, 12741), False, 'import a... |
from pylagrit import PyLaGriT
import numpy
x = numpy.arange(0,10.1,1)
y = x
z = [0,1]
lg = PyLaGriT()
mqua = lg.gridder(x,y,z,elem_type='hex',connect=True)
mqua.rotateln([mqua.xmin-0.1,0,0],[mqua.xmax+0.1,0,0],25)
mqua.dump_exo('rotated.exo')
mqua.dump_ats_xml('rotated.xml','rotated.exo')
mqua.paraview()
| [
"pylagrit.PyLaGriT",
"numpy.arange"
] | [((48, 72), 'numpy.arange', 'numpy.arange', (['(0)', '(10.1)', '(1)'], {}), '(0, 10.1, 1)\n', (60, 72), False, 'import numpy\n'), ((93, 103), 'pylagrit.PyLaGriT', 'PyLaGriT', ([], {}), '()\n', (101, 103), False, 'from pylagrit import PyLaGriT\n')] |
## interaction / scripts / create_translation_repository.py
'''
This script will pre-calculate the translation operators for a given bounding
box, max level, and frequency steps for a multi-level fast multipole algorithm.
This can take hours to days depending on the number of threads available, size
of bounding box, n... | [
"interaction3.bem.core.db_functions.get_order",
"multiprocessing.cpu_count",
"numpy.array",
"numpy.arange",
"itertools.repeat",
"os.remove",
"os.path.exists",
"argparse.ArgumentParser",
"pandas.DataFrame",
"numpy.meshgrid",
"interaction3.bem.core.fma_functions.fft_quadrule",
"interaction3.bem.... | [((907, 946), 'sqlite3.register_adapter', 'sql.register_adapter', (['np.float64', 'float'], {}), '(np.float64, float)\n', (927, 946), True, 'import sqlite3 as sql\n'), ((947, 986), 'sqlite3.register_adapter', 'sql.register_adapter', (['np.float32', 'float'], {}), '(np.float32, float)\n', (967, 986), True, 'import sqlit... |
import pandas as pd
import numpy as np
import umap
import sklearn.cluster as cluster
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
import spacy
import unicodedata
import matplotlib.pyplot as plt
import logging
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
logging.getL... | [
"logging.basicConfig",
"logging.getLogger",
"sklearn.cluster.KMeans",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"spacy.load",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"sklearn.cluster.DBSCAN",
"matplotlib.pyplot.figure",
"numpy.sign",
"uma... | [((234, 307), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s %(message)s', level=logging.INFO)\n", (253, 307), False, 'import logging\n'), ((784, 812), 'spacy.load', 'spacy.load', (['"""en_core_web_md"""'], {}), "('en_core_... |
# Copyright 2019 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"PIL.Image.fromarray",
"tensorflow.shape",
"tensorflow.saved_model.loader.load",
"numpy.array",
"delf.feature_extractor.DelfFeaturePostProcessing"
] | [((2438, 2460), 'PIL.Image.fromarray', 'Image.fromarray', (['image'], {}), '(image)\n', (2453, 2460), False, 'from PIL import Image\n'), ((2933, 3055), 'tensorflow.saved_model.loader.load', 'tf.saved_model.loader.load', (['sess', '[tf.saved_model.tag_constants.SERVING]', 'config.model_path'], {'import_scope': 'import_s... |
"""This module contains functions that visualise solar agent control."""
from __future__ import annotations
from typing import Tuple, Dict, List
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
from solara.plot.constants import COLORS, LABELS, MARKERS
def default_setup(figs... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"seaborn.set_context",
"seaborn.set_style",
"matplotlib.pyplot.figure",
"matplotlib.rc",
"matplotlib.patches.Patch",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.subplots",
"numpy.ara... | [((439, 494), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize', 'dpi': '(100)', 'tight_layout': '(True)'}), '(figsize=figsize, dpi=100, tight_layout=True)\n', (449, 494), True, 'import matplotlib.pyplot as plt\n'), ((499, 540), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""', "{'dashes': False... |
"""Tests for plotting."""
import contextlib
import io
import warnings
import matplotlib.axes
import matplotlib.collections
import matplotlib.figure
import matplotlib.legend
import matplotlib.lines
import matplotlib.pyplot as plt
import numpy as np
import os
import unittest
import aspecd.exceptions
from aspecd import ... | [
"numpy.random.rand",
"aspecd.plotting.MultiPlotter",
"aspecd.plotting.Caption",
"aspecd.plotting.SinglePlotProperties",
"aspecd.plotting.SinglePlotter1D",
"aspecd.dataset.Dataset",
"os.remove",
"os.path.exists",
"aspecd.plotting.GridProperties",
"aspecd.plotting.Plotter",
"aspecd.plotting.Compos... | [((429, 447), 'aspecd.plotting.Plotter', 'plotting.Plotter', ([], {}), '()\n', (445, 447), False, 'from aspecd import plotting, utils, dataset\n'), ((523, 552), 'os.path.isfile', 'os.path.isfile', (['self.filename'], {}), '(self.filename)\n', (537, 552), False, 'import os\n'), ((941, 976), 'aspecd.utils.full_class_name... |
import cv2
import numpy as np
import socket
# Define IP Address for Arduinos and PORT Number
Arduino_1 = '192.168.100.16'
Arduino_2 = '192.168.100.17'
Server_Result = '192.168.100.13'
PORT_1 = 8888
MONITORING_PORT = 4500
class Connection:
def __init__(self, HOST, PORT):
self.HOST = HOST
... | [
"cv2.rectangle",
"socket.socket",
"cv2.imshow",
"numpy.array",
"cv2.dnn_DetectionModel",
"cv2.VideoCapture",
"cv2.dnn.NMSBoxes",
"cv2.waitKey"
] | [((2136, 2183), 'cv2.dnn_DetectionModel', 'cv2.dnn_DetectionModel', (['weightsPath', 'configPath'], {}), '(weightsPath, configPath)\n', (2158, 2183), False, 'import cv2\n'), ((3073, 3124), 'cv2.dnn.NMSBoxes', 'cv2.dnn.NMSBoxes', (['bbox', 'confs', 'thres', 'nms_threshold'], {}), '(bbox, confs, thres, nms_threshold)\n',... |
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
import xml.etree.ElementTree as ET
from os.path import isfile, join
from os import getcwd
from scipy.spatial import distance
##############################
# MACROS
############################... | [
"numpy.radians",
"numpy.sqrt",
"numpy.polyfit",
"numpy.argsort",
"numpy.array",
"numpy.linalg.norm",
"numpy.poly1d",
"numpy.sin",
"scipy.spatial.distance",
"numpy.max",
"numpy.linspace",
"numpy.dot",
"numpy.matmul",
"numpy.vstack",
"numpy.min",
"numpy.degrees",
"numpy.reciprocal",
... | [((1825, 1841), 'numpy.array', 'np.array', (['center'], {}), '(center)\n', (1833, 1841), True, 'import numpy as np\n'), ((2123, 2146), 'numpy.polyfit', 'np.polyfit', (['xs', 'ys', 'deg'], {}), '(xs, ys, deg)\n', (2133, 2146), True, 'import numpy as np\n'), ((2472, 2489), 'numpy.poly1d', 'np.poly1d', (['coeffs'], {}), '... |
from CHECLabPy.plotting.setup import Plotter
from sstcam_sandbox import get_plot
from CHECLabPy.core.io import HDF5Reader
from os.path import join
import numpy as np
from matplotlib.colors import LogNorm
from IPython import embed
class Hist2D(Plotter):
def __init__(self, xlabel, ylabel):
super().__init__(... | [
"sstcam_sandbox.get_plot",
"numpy.logical_and",
"os.path.join",
"CHECLabPy.core.io.HDF5Reader",
"matplotlib.colors.LogNorm"
] | [((584, 635), 'sstcam_sandbox.get_plot', 'get_plot', (['"""d190524_time_gradient/correlations/data"""'], {}), "('d190524_time_gradient/correlations/data')\n", (592, 635), False, 'from sstcam_sandbox import get_plot\n'), ((646, 662), 'CHECLabPy.core.io.HDF5Reader', 'HDF5Reader', (['path'], {}), '(path)\n', (656, 662), F... |
# <NAME> <<EMAIL>>
import argparse
import logging
import torch
from torch.utils.data import TensorDataset, DataLoader, SequentialSampler
from transformers import BertTokenizer, BertForSequenceClassification
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
class Example:
def __init__(self, sent0, ... | [
"logging.basicConfig",
"torch.manual_seed",
"argparse.ArgumentParser",
"pandas.read_csv",
"transformers.BertTokenizer.from_pretrained",
"torch.utils.data.SequentialSampler",
"torch.utils.data.TensorDataset",
"pandas.DataFrame.from_dict",
"torch.tensor",
"transformers.BertForSequenceClassification.... | [((881, 944), 'torch.tensor', 'torch.tensor', (['[x.input_ids for x in features]'], {'dtype': 'torch.long'}), '([x.input_ids for x in features], dtype=torch.long)\n', (893, 944), False, 'import torch\n'), ((963, 1027), 'torch.tensor', 'torch.tensor', (['[x.input_mask for x in features]'], {'dtype': 'torch.bool'}), '([x... |
import argparse
import numpy as np
from matplotlib import pyplot as plt
def main(FLAGS):
some_data = np.random.rand(256, 256)
print(FLAGS.data_dir)
plt.matshow(some_data)
plt.show()
if __name__ == '__main__':
# Instantiates an arg parser
parser = argparse.ArgumentParser()
# Estab... | [
"matplotlib.pyplot.matshow",
"numpy.random.rand",
"argparse.ArgumentParser",
"matplotlib.pyplot.show"
] | [((110, 134), 'numpy.random.rand', 'np.random.rand', (['(256)', '(256)'], {}), '(256, 256)\n', (124, 134), True, 'import numpy as np\n'), ((167, 189), 'matplotlib.pyplot.matshow', 'plt.matshow', (['some_data'], {}), '(some_data)\n', (178, 189), True, 'from matplotlib import pyplot as plt\n'), ((195, 205), 'matplotlib.p... |
import numpy as np
_dtype = np.dtype([("x", np.uint16), ("y", np.uint16), ("p", np.bool_), ("ts", np.uint64)])
class DVSSpikeTrain(np.recarray):
"""Common type for event based vision datasets"""
__name__ = "SparseVisionSpikeTrain"
def __new__(cls, nb_of_spikes, *args, width=-1, height=-1, duration=-1, ... | [
"numpy.dtype"
] | [((29, 116), 'numpy.dtype', 'np.dtype', (["[('x', np.uint16), ('y', np.uint16), ('p', np.bool_), ('ts', np.uint64)]"], {}), "([('x', np.uint16), ('y', np.uint16), ('p', np.bool_), ('ts', np.\n uint64)])\n", (37, 116), True, 'import numpy as np\n')] |
#!/usr/bin/env python
#
# Copyright 2016-present <NAME>.
#
# Licensed under the MIT License.
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://opensource.org/licenses/mit-license.html
#
# Unless required by applicable law or agreed to in writing, sof... | [
"npcore.layer.objectives.MAELoss",
"numpy.random.rand",
"npcore.layer.gates.ReLU",
"numpy.array",
"numpy.random.seed",
"unittest.main",
"npcore.layer.link.Link",
"npcore.layer.objectives.SoftmaxCrossentropyLoss",
"npcore.layer.gates.Linear"
] | [((1256, 1273), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (1270, 1273), True, 'import numpy as np\n'), ((3483, 3498), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3496, 3498), False, 'import unittest\n'), ((1582, 1602), 'numpy.random.rand', 'np.random.rand', (['(3)', '(3)'], {}), '(3, 3)\n'... |
import sys
import numpy as np
sys.path.append('..')
from Game import Game
from .QubicLogic import Board
import itertools
class QubicGame(Game):
"""
Connect4 Game class implementing the alpha-zero-general Game interface.
"""
def __init__(self, depth = None, height=None, width=None, win_length=None, n... | [
"numpy.copy",
"numpy.unique",
"Game.Game.__init__",
"numpy.zeros",
"numpy.transpose",
"sys.path.append"
] | [((31, 52), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (46, 52), False, 'import sys\n'), ((344, 363), 'Game.Game.__init__', 'Game.__init__', (['self'], {}), '(self)\n', (357, 363), False, 'from Game import Game\n'), ((2164, 2211), 'numpy.zeros', 'np.zeros', (['((6, 2, 2, 2) + a.shape)'], {'dt... |
import imageio
# imageio.plugins.ffmpeg.download()
import numpy as np
import os
import argparse
import process_anno
from tqdm import tqdm
import torch
import torchvision.transforms as trn
from spatial_transforms import (
Compose,ToTensor)
import json
def extract_frames(output, dirname, filenames, frame_num, anno):
tr... | [
"os.path.exists",
"os.listdir",
"numpy.repeat",
"torchvision.transforms.ToPILImage",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.round",
"os.path.join",
"numpy.linspace",
"spatial_transforms.ToTensor",
"json.load",
"torch.cat"
] | [((2076, 2101), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2099, 2101), False, 'import argparse\n'), ((2534, 2546), 'json.load', 'json.load', (['f'], {}), '(f)\n', (2543, 2546), False, 'import json\n'), ((2624, 2669), 'os.path.join', 'os.path.join', (['opt.file_path', 'opt.dataset_name'], ... |
"""
tSNE analysis for glbase expression objects.
This should really be merged with MDS and inherited...
"""
from operator import itemgetter
import numpy, random
import matplotlib.pyplot as plot
import matplotlib.patches
from mpl_toolkits.mplot3d import Axes3D, art3d
import scipy.cluster.vq
from sklearn.decompositi... | [
"sklearn.cluster.AgglomerativeClustering",
"scipy.cluster.hierarchy.dendrogram",
"sklearn.cluster.MiniBatchKMeans",
"numpy.column_stack",
"random.seed",
"sklearn.neighbors.NearestCentroid",
"sklearn.neighbors.kneighbors_graph",
"numpy.zeros"
] | [((2912, 2942), 'random.seed', 'random.seed', (['self.random_state'], {}), '(self.random_state)\n', (2923, 2942), False, 'import numpy, random\n'), ((9775, 9827), 'numpy.zeros', 'numpy.zeros', (['self.__full_model_fp.children_.shape[0]'], {}), '(self.__full_model_fp.children_.shape[0])\n', (9786, 9827), False, 'import ... |
import numpy as np
class RunningScore(object):
def __init__(self, n_classes):
self.n_classes = n_classes
self.confusion_matrix = np.zeros((n_classes, n_classes))
@staticmethod
def _fast_hist(label_true, label_pred, n_class):
mask = (label_true >= 0) & (label_true < n_class)
... | [
"numpy.diag",
"numpy.array",
"numpy.zeros",
"numpy.nanmean",
"numpy.finfo"
] | [((1789, 1829), 'numpy.array', 'np.array', (['[1, 0, 0, 1, 1, 0, 1, 0, 1, 0]'], {}), '([1, 0, 0, 1, 1, 0, 1, 0, 1, 0])\n', (1797, 1829), True, 'import numpy as np\n'), ((1847, 1887), 'numpy.array', 'np.array', (['[1, 1, 0, 1, 0, 0, 1, 1, 0, 0]'], {}), '([1, 1, 0, 1, 0, 0, 1, 1, 0, 0])\n', (1855, 1887), True, 'import nu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.