code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import torch from torch.utils.data.sampler import Sampler import prototype.spring.linklink as link import math import numpy as np class DistributedSampler(Sampler): def __init__(self, dataset, world_size=None, rank=None, round_up=True): if world_size is None: world_size = link.get_world_size()...
[ "numpy.random.seed", "numpy.concatenate", "prototype.spring.linklink.get_rank", "prototype.spring.linklink.get_world_size", "numpy.arange", "numpy.tile", "torch.Generator", "numpy.random.choice", "numpy.array", "numpy.random.shuffle" ]
[((1030, 1047), 'torch.Generator', 'torch.Generator', ([], {}), '()\n', (1045, 1047), False, 'import torch\n'), ((2616, 2633), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (2630, 2633), True, 'import numpy as np\n'), ((2848, 2876), 'numpy.tile', 'np.tile', (['indices', 'num_repeat'], {}), '(indices, n...
from pathlib import Path import pinocchio as pin import numpy as np from cosypose.config import ASSET_DIR from cosypose.datasets.datasets_cfg import make_urdf_dataset, make_texture_dataset from cosypose.simulator import BaseScene, Body, Camera from cosypose.simulator import BodyCache, TextureCache, apply_random_text...
[ "cosypose.simulator.apply_random_textures", "pinocchio.SE3.Random", "cosypose.simulator.TextureCache", "numpy.zeros", "cosypose.datasets.datasets_cfg.make_urdf_dataset", "numpy.random.RandomState", "numpy.ones", "cosypose.simulator.Body.load", "pathlib.Path", "numpy.mean", "numpy.array", "cosy...
[((1159, 1185), 'cosypose.datasets.datasets_cfg.make_urdf_dataset', 'make_urdf_dataset', (['urdf_ds'], {}), '(urdf_ds)\n', (1176, 1185), False, 'from cosypose.datasets.datasets_cfg import make_urdf_dataset, make_texture_dataset\n'), ((1566, 1598), 'cosypose.datasets.datasets_cfg.make_texture_dataset', 'make_texture_dat...
''' Created on Aug 25, 2016 @author: <NAME> <<EMAIL>> ''' from __future__ import division import collections import unittest import numpy as np import six from .. import stats class TestStats(unittest.TestCase): """ test suite for statistics functions """ _multiprocess_can_split_ = True # let nose kno...
[ "unittest.main", "numpy.isnan", "numpy.random.random", "numpy.random.randint", "collections.Counter", "numpy.bincount" ]
[((3414, 3429), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3427, 3429), False, 'import unittest\n'), ((449, 469), 'numpy.random.random', 'np.random.random', (['(10)'], {}), '(10)\n', (465, 469), True, 'import numpy as np\n'), ((1471, 1498), 'numpy.random.randint', 'np.random.randint', (['(0)', '(5)', '(10)'],...
# Copyright 2020 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 applica...
[ "tensorflow.python.ipu.config.IPUConfig", "tensorflow.python.ops.array_ops.reshape", "numpy.ones", "tensorflow.python.framework.ops.device", "test_utils.ipu_session", "test_utils.ReportHelper", "test_utils.enable_ipu_events", "tensorflow.python.ipu.ipu_compiler.compile", "tensorflow.python.platform....
[((7204, 7221), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (7219, 7221), False, 'from tensorflow.python.platform import googletest\n'), ((1728, 1750), 'tensorflow.python.ipu.config.IPUConfig', 'ipu.config.IPUConfig', ([], {}), '()\n', (1748, 1750), False, 'from tensorflow.python ...
import numpy import theano from blocks_extras.utils import check_valid_permutation from blocks.initialization import NdarrayInitialization class PermutationMatrix(NdarrayInitialization): """Generates a 2-dimensional permutation matrix. Parameters ---------- permutation : ndarray, 1-dimensional, opti...
[ "numpy.eye", "blocks_extras.utils.check_valid_permutation" ]
[((636, 672), 'blocks_extras.utils.check_valid_permutation', 'check_valid_permutation', (['permutation'], {}), '(permutation)\n', (659, 672), False, 'from blocks_extras.utils import check_valid_permutation\n'), ((805, 848), 'numpy.eye', 'numpy.eye', (['size'], {'dtype': 'theano.config.floatX'}), '(size, dtype=theano.co...
import unittest import numpy as np from grizzly.encoders import numpy_to_weld_type import pandas_weld as pdw from lazy_result import LazyResult from pandas_weld.tests.utils import evaluate_if_necessary class IndexTests(unittest.TestCase): # noinspection PyMethodMayBeStatic def test_getitem_slice(self): ...
[ "unittest.main", "pandas_weld.tests.utils.evaluate_if_necessary", "numpy.dtype", "numpy.array" ]
[((1217, 1232), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1230, 1232), False, 'import unittest\n'), ((425, 441), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (433, 441), True, 'import numpy as np\n'), ((443, 461), 'numpy.dtype', 'np.dtype', (['np.int64'], {}), '(np.int64)\n', (451, 461), True, ...
# Copyright (c) Facebook, Inc. and its affiliates. # Code by <NAME> import numpy as np import logging import math import transforms3d.euler as txe import transforms3d.quaternions as txq import argparse import cv2 import matplotlib.pyplot as plt try: from thirdparty.mano.webuser.smpl_handpca_wrapper_HAND_only \ i...
[ "numpy.sum", "argparse.ArgumentParser", "numpy.abs", "numpy.clip", "numpy.mean", "numpy.linalg.norm", "numpy.exp", "utilities.dataset.get_p_nums", "transforms3d.quaternions.quat2mat", "os.path.join", "numpy.round", "transforms3d.euler.axangle2mat", "logging.FileHandler", "matplotlib.pyplot...
[((946, 967), 'numpy.log', 'np.log', (['((1 - y1) / y1)'], {}), '((1 - y1) / y1)\n', (952, 967), True, 'import numpy as np\n'), ((976, 997), 'numpy.log', 'np.log', (['((1 - y2) / y2)'], {}), '((1 - y2) / y2)\n', (982, 997), True, 'import numpy as np\n'), ((1431, 1449), 'numpy.hstack', 'np.hstack', (['(p1, n)'], {}), '(...
""" implements saving and reading of Image types in the framework """ import io import json import struct import bson import numpy from matplotlib import pyplot from PIL import Image from urlpath import URL from cortex.utils import read_all class ColorImage: SupportedSchemes = ['file'] @classmethod def ...
[ "io.BytesIO", "struct.Struct", "matplotlib.pyplot.Figure", "urlpath.URL", "PIL.Image.open", "numpy.array", "PIL.Image.frombytes" ]
[((1194, 1213), 'struct.Struct', 'struct.Struct', (['"""II"""'], {}), "('II')\n", (1207, 1213), False, 'import struct\n'), ((485, 493), 'urlpath.URL', 'URL', (['uri'], {}), '(uri)\n', (488, 493), False, 'from urlpath import URL\n'), ((1413, 1421), 'urlpath.URL', 'URL', (['uri'], {}), '(uri)\n', (1416, 1421), False, 'fr...
import unittest import os import numpy as np import fv3gfs.wrapper import fv3gfs.util from mpi4py import MPI from util import ( get_default_config, get_state_single_variable, main, replace_state_with_random_values, ) test_dir = os.path.dirname(os.path.abspath(__file__)) def select_ocean_values(*fiel...
[ "os.path.abspath", "util.replace_state_with_random_values", "numpy.allclose", "util.get_state_single_variable", "util.main", "numpy.testing.assert_allclose", "mpi4py.MPI.COMM_WORLD.barrier", "util.get_default_config" ]
[((262, 287), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (277, 287), False, 'import os\n'), ((2314, 2334), 'util.get_default_config', 'get_default_config', ([], {}), '()\n', (2332, 2334), False, 'from util import get_default_config, get_state_single_variable, main, replace_state_with_rand...
import time import torch import numpy as np def train(model, dataloader, optimizer, criterion_signal,criterion_label,weight_label, clip,n_elements,len_y): model.train() total_epoch_loss = 0 epoch_loss_signal = 0 epoch_loss_label = 0 correct = 0 for i, batch in enumerate(dataloader): x = batch[0].permu...
[ "torch.ones_like", "numpy.load", "torch.argmax", "numpy.asarray", "torch.load", "time.time", "numpy.append", "torch.cuda.is_available", "torch.max", "numpy.array", "torch.zeros", "numpy.savez", "torch.no_grad", "torch.sum" ]
[((3316, 3341), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3339, 3341), False, 'import torch\n'), ((8667, 8889), 'numpy.asarray', 'np.asarray', (['[[loss_train_history, loss_signal_train_history, loss_label_train_history,\n accuracy_train_history], [loss_valid_history, loss_signal_valid...
from .. import otherm import numpy as np import os here = os.path.dirname(os.path.abspath(__file__)) methane_path = os.path.join(here, 'data', 'methane.out') def test_methane(): methane = otherm.Molecule(methane_path) # ORCA 4.0 defaulted to sigma_r = 4 and 1 atmosphere standard state methane.calculate...
[ "os.path.abspath", "numpy.abs", "numpy.sum", "numpy.array", "os.path.join" ]
[((117, 158), 'os.path.join', 'os.path.join', (['here', '"""data"""', '"""methane.out"""'], {}), "(here, 'data', 'methane.out')\n", (129, 158), False, 'import os\n'), ((74, 99), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (89, 99), False, 'import os\n'), ((1214, 1318), 'numpy.array', 'np.a...
# http://www.wildml.com/2016/08/rnns-in-tensorflow-a-practical-guide-and-undocumented-features/ # http://learningtensorflow.com/index.html # http://suriyadeepan.github.io/2016-12-31-practical-seq2seq/ import tensorflow as tf import numpy as np from tensorflow.contrib import rnn import pprint pp = pprint.PrettyPrinter(...
[ "tensorflow.contrib.rnn.BasicRNNCell", "tensorflow.nn.dynamic_rnn", "tensorflow.global_variables_initializer", "tensorflow.variable_scope", "tensorflow.constant", "pprint.PrettyPrinter", "tensorflow.contrib.rnn.BasicLSTMCell", "numpy.array", "tensorflow.contrib.seq2seq.sequence_loss", "numpy.matmu...
[((299, 329), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (319, 329), False, 'import pprint\n'), ((337, 360), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (358, 360), True, 'import tensorflow as tf\n'), ((5723, 5751), 'numpy.matmul', 'np.matmul...
import os import pickle import numpy as np from PIL import Image from torch.utils.data import Dataset file_dir = os.path.dirname(os.path.abspath(__file__)) + '/KeywordsDataset' class KeywordsDataset(Dataset): """ Keyword Spotting dataset (preprocessed MFCC feature vectors) """ classes = ['0 - unknown'...
[ "os.path.abspath", "numpy.argmax", "os.path.dirname", "os.path.exists", "pickle.load", "os.path.join", "numpy.concatenate" ]
[((130, 155), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (145, 155), False, 'import os\n'), ((389, 409), 'numpy.argmax', 'np.argmax', (['x'], {'axis': '(1)'}), '(x, axis=1)\n', (398, 409), True, 'import numpy as np\n'), ((750, 782), 'os.path.join', 'os.path.join', (['root', '"""IA_DATASET...
# CTOK Converts Celsius to Kelvin import numpy as np def CtoK(C): K = np.array(C) + 273.15 return K
[ "numpy.array" ]
[((74, 85), 'numpy.array', 'np.array', (['C'], {}), '(C)\n', (82, 85), True, 'import numpy as np\n')]
import pynbody import pylab import numpy as np import matplotlib.pylab as plt import astropy.units as u #Now I need a code that will load the simulation (s will stand for simulation) s = pynbody.load('/media/jillian/cptmarvel/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096') h=s.h...
[ "pynbody.filt.Sphere", "pynbody.load", "pynbody.analysis.angmom.faceon", "numpy.array", "pynbody.filt.LowPass" ]
[((190, 324), 'pynbody.load', 'pynbody.load', (['"""/media/jillian/cptmarvel/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096"""'], {}), "(\n '/media/jillian/cptmarvel/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096/cptmarvel.cosmo25cmb.4096g5HbwK1BH.004096'\n )\n", (202, 324), False,...
import pandas as pd import pathlib import imageio import numpy as np import skimage from utils.imaging import get_path, get_image_ids from tqdm import tqdm from scipy import ndimage from skimage.color import rgb2gray from skimage.filters import threshold_otsu def rle_encoding(x): ''' Performs run length enco...
[ "pandas.DataFrame", "skimage.io.imread", "numpy.amax", "numpy.where", "utils.imaging.get_image_ids", "pandas.Series", "utils.imaging.get_path" ]
[((1041, 1062), 'numpy.amax', 'np.amax', (['labels_image'], {}), '(labels_image)\n', (1048, 1062), True, 'import numpy as np\n'), ((1078, 1128), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['ImageId', 'EncodedPixels']"}), "(columns=['ImageId', 'EncodedPixels'])\n", (1090, 1128), True, 'import pandas as pd\n')...
#!/usr/bin/env python3 """ Functions --------- """ import numpy import scipy.linalg from sklearn.preprocessing import normalize def preprocess(*dataSets, p = None, center = True, normalize = True): Ps = [] Ss = [] for i in range(len(dataSets)): if center: # Center before or after PCA? dataSets[i] = dataSet...
[ "numpy.zeros", "numpy.argsort", "sklearn.preprocessing.normalize", "numpy.diag", "numpy.concatenate" ]
[((1258, 1289), 'numpy.concatenate', 'numpy.concatenate', (['rows'], {'axis': '(0)'}), '(rows, axis=0)\n', (1275, 1289), False, 'import numpy\n'), ((1936, 1955), 'numpy.zeros', 'numpy.zeros', (['(m, m)'], {}), '((m, m))\n', (1947, 1955), False, 'import numpy\n'), ((1966, 1985), 'numpy.zeros', 'numpy.zeros', (['(n, n)']...
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # ''' Given coordinates of grids in real space, evaluate the GTO values and MO orbital values on these grids. See also pyscf/examples/dft/30-ao_value_on_grid.py pyscf/examples/pbc/30-ao_value_on_grid.py ''' import numpy from pyscf import lib, gto, scf mol = gto.M(a...
[ "pyscf.scf.RHF", "pyscf.gto.M", "numpy.random.random" ]
[((313, 358), 'pyscf.gto.M', 'gto.M', ([], {'atom': '"""H 0 0 0; F 0 0 1"""', 'basis': '"""sto3g"""'}), "(atom='H 0 0 0; F 0 0 1', basis='sto3g')\n", (318, 358), False, 'from pyscf import lib, gto, scf\n'), ((393, 422), 'numpy.random.random', 'numpy.random.random', (['(100, 3)'], {}), '((100, 3))\n', (412, 422), False,...
import numpy as np from numpy.linalg import norm from math import * from matplotlib import pyplot as plt from matplotlib.patches import Polygon from random import random from scipy.spatial import ConvexHull from matplotlib import path import time from mpl_toolkits import mplot3d from mpl_toolkits.mplot3d.art3d import P...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.axes", "time.time", "random.random", "matplotlib.pyplot.figure", "numpy.array", "numpy.linalg.norm", "numpy.linspace", "tools.init_fonts", "matplotlib.pyplot.pause", "path_shortening.shorten_path" ]
[((3532, 3544), 'tools.init_fonts', 'init_fonts', ([], {}), '()\n', (3542, 3544), False, 'from tools import init_fonts\n'), ((3551, 3579), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 15)'}), '(figsize=(15, 15))\n', (3561, 3579), True, 'from matplotlib import pyplot as plt\n'), ((3584, 3609), 'matpl...
#!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 as cv import numpy as np #import tensorflow as tf import tensorflow.compat.v1 as tf #tf.disable_eager_execution() class IrisLandmark(object): def __init__( self, model_path='iris_landmark/iris_landmark.tflite', num_threads=1, ): ...
[ "cv2.cvtColor", "tensorflow.compat.v1.lite.Interpreter", "tensorflow.compat.v1.convert_to_tensor", "tensorflow.compat.v1.image.resize", "numpy.squeeze" ]
[((347, 389), 'tensorflow.compat.v1.lite.Interpreter', 'tf.lite.Interpreter', ([], {'model_path': 'model_path'}), '(model_path=model_path)\n', (366, 389), True, 'import tensorflow.compat.v1 as tf\n'), ((742, 778), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2RGB'], {}), '(image, cv.COLOR_BGR2RGB)\n', (753, 7...
from abc import ABCMeta, abstractmethod import numpy as np from ezclimate.storage_tree import BigStorageTree, SmallStorageTree np.seterr(all='ignore') class EZUtility(object): """Calculation of Epstein-Zin utility for the EZ-Climate model. The Epstein-Zin utility allows for different rates of substitution a...
[ "numpy.abs", "numpy.seterr", "numpy.ones", "ezclimate.storage_tree.BigStorageTree", "numpy.sign", "ezclimate.storage_tree.SmallStorageTree", "numpy.repeat" ]
[((128, 151), 'numpy.seterr', 'np.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (137, 151), True, 'import numpy as np\n'), ((9348, 9436), 'ezclimate.storage_tree.BigStorageTree', 'BigStorageTree', ([], {'subinterval_len': 'self.period_len', 'decision_times': 'self.decision_times'}), '(subinterval_len=self...
import numpy as np import matplotlib.pyplot as plt import pandas as pd def evaluate(y_test, y_pred): from sklearn.metrics import accuracy_score print("===== Accuracy Score =====") print(accuracy_score(y_test, y_pred)) from sklearn.metrics import classification_report print("===== Accuracy Score =====") ...
[ "matplotlib.pyplot.title", "sklearn.preprocessing.StandardScaler", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "sklearn.metrics.classification_report", "sklearn.tree.DecisionTreeClassifier", "numpy.mean", "sklearn.neural_network.MLPClassifier", "sklearn.svm.SVC", ...
[((1693, 1713), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (1711, 1713), False, 'from sklearn.datasets import load_breast_cancer\n'), ((2517, 2554), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (2533,...
# \MODULE\------------------------------------------------------------------------- # # CONTENTS : STRique # # DESCRIPTION : Raw nanopore signal repeat detection pipeline # # RESTRICTIONS : none # # REQUIRES : none # # --------------------------------------------------------------------------------- # ...
[ "numpy.sum", "argparse.ArgumentParser", "pomegranate.UniformDistribution", "numpy.clip", "STRique_lib.pyseqan.align_raw", "collections.defaultdict", "os.path.isfile", "matplotlib.pyplot.figure", "numpy.argpartition", "numpy.arange", "multiprocessing.Queue", "pomegranate.State", "numpy.random...
[((2317, 2333), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2331, 2333), False, 'import threading, queue\n'), ((2350, 2357), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (2355, 2357), False, 'from multiprocessing import Pool, Process, Event, Value, Queue\n'), ((51538, 51562), 'signal.signal', 'signal'...
# -*- coding: utf-8 -*- import numpy as np import pytest import corner def test_invalid_quantiles_1(seed=42): np.random.seed(seed) with pytest.raises(ValueError): corner.quantile(np.random.rand(100), [-0.1, 5]) def test_invalid_quantiles_2(seed=42): np.random.seed(seed) with pytest.raises(...
[ "numpy.random.seed", "numpy.ones_like", "numpy.allclose", "numpy.percentile", "corner.quantile", "pytest.raises", "numpy.arange", "numpy.array", "numpy.min", "numpy.max", "numpy.random.rand" ]
[((118, 138), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (132, 138), True, 'import numpy as np\n'), ((276, 296), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (290, 296), True, 'import numpy as np\n'), ((426, 446), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(see...
""" Python version of algorithm from Astronomical Algorithms, chapter 26. Only uses the tables that are valid from 1000 AD to 3000 AD (Table 26.B) """ import numpy as np def JDE0(year,season): y=(year-2000)/1000.0 return season[0]+season[1]*y+season[2]*y**2+season[3]*y**3+season[4]*y**4 #polynomia...
[ "numpy.radians" ]
[((1496, 1513), 'numpy.radians', 'np.radians', (['(2 * W)'], {}), '(2 * W)\n', (1506, 1513), True, 'import numpy as np\n'), ((2509, 2530), 'numpy.radians', 'np.radians', (['(B + C * T)'], {}), '(B + C * T)\n', (2519, 2530), True, 'import numpy as np\n'), ((1467, 1480), 'numpy.radians', 'np.radians', (['W'], {}), '(W)\n...
import os import time import numpy as np import scipy as sp import scipy.linalg import matplotlib as mpl import matplotlib.pyplot as plt import pybie2d from ipde.embedded_boundary_standalone import EmbeddedBoundary from ipde.heavisides import SlepianMollifier from ipde.derivatives import fd_x_4, fd_y_4, fourier from ip...
[ "matplotlib.rc", "numpy.abs", "numpy.floor", "personal_utilities.arc_length_reparametrization.arc_length_parameterize", "numpy.sin", "numpy.arange", "matplotlib.colors.LogNorm", "os.chdir", "ipde.solvers.single_boundary.interior.poisson.PoissonSolver", "ipde.heavisides.SlepianMollifier", "numpy....
[((1368, 1395), 'ipde.heavisides.SlepianMollifier', 'SlepianMollifier', (['slepian_r'], {}), '(slepian_r)\n', (1384, 1395), False, 'from ipde.heavisides import SlepianMollifier\n'), ((2149, 2160), 'time.time', 'time.time', ([], {}), '()\n', (2158, 2160), False, 'import time\n'), ((2168, 2238), 'ipde.embedded_boundary_s...
import argparse import json import multiprocessing import os import pickle import random from multiprocessing import Pool, cpu_count import nltk import numpy as np import torch from tqdm import tqdm from src.data_preprocessors.transformations import ( NoTransformation, SemanticPreservingTransformation, BlockS...
[ "numpy.random.uniform", "numpy.random.seed", "argparse.ArgumentParser", "torch.random.manual_seed", "os.makedirs", "torch.manual_seed", "src.data_preprocessors.transformations.SemanticPreservingTransformation", "torch.cuda.manual_seed", "src.data_preprocessors.transformations.NoTransformation", "j...
[((439, 462), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (456, 462), False, 'import torch\n'), ((467, 497), 'torch.random.manual_seed', 'torch.random.manual_seed', (['seed'], {}), '(seed)\n', (491, 497), False, 'import torch\n'), ((502, 522), 'numpy.random.seed', 'np.random.seed', (['seed'], ...
from numpy import unique from numpy import where from sklearn.datasets import make_classification from sklearn.cluster import Birch from matplotlib import pyplot #Synthetic dataset definition X, _ = make_classification(n_samples=1800, n_features=2, n_informative=2, n_redundant=0, n_clusters_per_class=1, random_state=4)...
[ "matplotlib.pyplot.show", "sklearn.cluster.Birch", "matplotlib.pyplot.scatter", "sklearn.datasets.make_classification", "numpy.where", "numpy.unique" ]
[((199, 324), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_samples': '(1800)', 'n_features': '(2)', 'n_informative': '(2)', 'n_redundant': '(0)', 'n_clusters_per_class': '(1)', 'random_state': '(4)'}), '(n_samples=1800, n_features=2, n_informative=2,\n n_redundant=0, n_clusters_per_class=1...
from scipy.io import loadmat import tensorflow as tf import numpy as np from PIL import Image from sklearn.preprocessing import LabelEncoder import os def load_mnist(): mnist = tf.keras.datasets.mnist (mnisTr_X, mnisTr_Y), (mnisTe_X, mnisTe_Y) = mnist.load_data() mnisTr_X, mnisTe_X = mnisTr_X / 255.0, mnis...
[ "numpy.moveaxis", "scipy.io.loadmat", "numpy.asarray", "tensorflow.keras.datasets.cifar100.load_data", "os.walk", "sklearn.preprocessing.LabelEncoder", "PIL.Image.open", "tensorflow.keras.datasets.cifar10.load_data", "numpy.array", "numpy.squeeze", "os.path.join" ]
[((520, 562), 'scipy.io.loadmat', 'loadmat', (['"""data/1_raw/SVHN/train_32x32.mat"""'], {}), "('data/1_raw/SVHN/train_32x32.mat')\n", (527, 562), False, 'from scipy.io import loadmat\n'), ((579, 620), 'scipy.io.loadmat', 'loadmat', (['"""data/1_raw/SVHN/test_32x32.mat"""'], {}), "('data/1_raw/SVHN/test_32x32.mat')\n",...
import os import csv import numpy as np import pandas as pd import matplotlib.pyplot as plt import random as rn import warnings from kneed import KneeLocator class BuildDriftKnowledge(): """ Description : Class to build the pareto knowledge from hyper-parameters configurations evaluated on differents ...
[ "kneed.KneeLocator", "numpy.sum", "csv.reader", "numpy.ones", "numpy.argmin", "numpy.argsort", "numpy.arange", "pandas.DataFrame", "random.randint", "os.sep.join", "matplotlib.pyplot.show", "csv.writer", "matplotlib.pyplot.ylim", "numpy.asarray", "numpy.sort", "matplotlib.pyplot.ylabel...
[((4659, 4692), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (4682, 4692), False, 'import warnings\n'), ((12864, 12890), 'numpy.arange', 'np.arange', (['population_size'], {}), '(population_size)\n', (12873, 12890), True, 'import numpy as np\n'), ((13047, 13083), 'numpy....
import numpy as np class StringEncoder: """ Encodes chars into integers. """ def __init__(self, available_chars): self._available_chars = available_chars def encode_char(self, char: str): return self._available_chars.index(char) def encode(self, string): result = [] ...
[ "numpy.array" ]
[((412, 428), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (420, 428), True, 'import numpy as np\n')]
import os import re import sys import time import json import pkgutil import argparse import collections from tqdm import tqdm import pickle import copy from pprint import pprint import matplotlib.pyplot as plt import seaborn as sns plt.rcParams['figure.facecolor'] = 'white' import numpy as np import pandas as pd imp...
[ "pickle.dump", "argparse.ArgumentParser", "numpy.amin", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.mean", "pickle.load", "pprint.pprint", "xgboost.XGBRegressor", "os.path.join", "pandas.DataFrame", "numpy.std", "numpy.max", "matplotlib.pyplot.rc", "re.sub", "pkgutil.get_data...
[((8445, 8468), 'numpy.concatenate', 'np.concatenate', (['X_array'], {}), '(X_array)\n', (8459, 8468), True, 'import numpy as np\n'), ((14076, 14100), 'numpy.mean', 'np.mean', (['baseline_errors'], {}), '(baseline_errors)\n', (14083, 14100), True, 'import numpy as np\n'), ((18584, 18595), 'time.time', 'time.time', ([],...
from numpy.random import randint default_network = { "type": "DFA", "dataset_name": "mnist", "sequence": "fcReLu", "cost_function": "softmax_cross_entropy", "learning_rate": 0.01, "minimize_manually": True, "gather_stats": False, "save_graph": False, "memory_only": False, "r...
[ "numpy.random.randint" ]
[((563, 584), 'numpy.random.randint', 'randint', (['(1)', '(100000000)'], {}), '(1, 100000000)\n', (570, 584), False, 'from numpy.random import randint\n')]
import numpy as np from matplotlib_scalebar.scalebar import ScaleBar from matplotlib import pyplot as plt def addScaleBar(ax, scale, location='upper right'): """Add a scale bar to an axes. Parameters ---------- ax : matplotlib.axes.Axes Matplotlib axis on which to plot. """ if scale:...
[ "matplotlib_scalebar.scalebar.ScaleBar", "matplotlib.pyplot.subplots", "numpy.isnan", "matplotlib.pyplot.show" ]
[((2820, 2884), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(2)', 'figsize': '(14, 7)', 'sharex': '(True)', 'sharey': '(True)'}), '(ncols=2, figsize=(14, 7), sharex=True, sharey=True)\n', (2832, 2884), True, 'from matplotlib import pyplot as plt\n'), ((3064, 3092), 'matplotlib.pyplot.subplots', 'plt.s...
# plot_mesa_hr.py # plots the output of mesa onto an hr diagram import sys import os import string import numpy as np import pandas as pd from astropy.io import ascii from astropy.io import fits import matplotlib.pyplot as plt from read_mesa import read_history file_loc = '/Users/galaxies-air/Courses/Stars/ps1_mesa/L...
[ "matplotlib.pyplot.xscale", "matplotlib.pyplot.yscale", "matplotlib.pyplot.close", "matplotlib.pyplot.colorbar", "read_mesa.read_history", "numpy.log10", "matplotlib.pyplot.subplots" ]
[((337, 359), 'read_mesa.read_history', 'read_history', (['file_loc'], {}), '(file_loc)\n', (349, 359), False, 'from read_mesa import read_history\n'), ((455, 483), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 7)'}), '(figsize=(8, 7))\n', (467, 483), True, 'import matplotlib.pyplot as plt\n'), ((...
from tensorflow.keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator import matplotlib.pyplot as plt import numpy as np # # 이미지 제네레이터를 선언합니다. # train_datagen = ImageDataGenerator(horizontal_flip=True, # vertical_flip=True, # s...
[ "tensorflow.keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.Dense", "numpy.std", "sklearn.model_selection.train_test_split", "tensorflow.keras.datasets.cifar10.load_data", "numpy.mean", "tensorflo...
[((1507, 1526), 'tensorflow.keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (1524, 1526), False, 'from tensorflow.keras.datasets import cifar10\n'), ((1561, 1593), 'numpy.mean', 'np.mean', (['x_train'], {'axis': '(0, 1, 2)'}), '(x_train, axis=(0, 1, 2))\n', (1568, 1593), True, 'import numpy as...
import time from argparse import Namespace from contextlib import nullcontext from threading import Lock, Thread import ipywidgets as w import numpy as np from IPython.display import clear_output, display class UIView: def __init__(self, container, named_widgets) -> None: self._named_widgets = named_widg...
[ "argparse.Namespace", "bqplot.Figure", "ipywidgets.Text", "bqplot.LinearScale", "ipywidgets.BoundedIntText", "ipywidgets.FloatProgress", "ipywidgets.Button", "bqplot.Axis", "IPython.display.display", "ipywidgets.Label", "ipywidgets.Layout", "contextlib.nullcontext", "threading.Thread", "ip...
[((4944, 4963), 'argparse.Namespace', 'Namespace', ([], {}), '(**params)\n', (4953, 4963), False, 'from argparse import Namespace\n'), ((5076, 5089), 'contextlib.nullcontext', 'nullcontext', ([], {}), '()\n', (5087, 5089), False, 'from contextlib import nullcontext\n'), ((8769, 8782), 'contextlib.nullcontext', 'nullcon...
import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) import numpy as np from nrrd.tests.util import * import nrrd class TestReadingFunctions(unittest.TestCase): def setUp(self): self.expected_header = {u'dimension': 3, u'encodi...
[ "os.path.basename", "numpy.fromfile", "os.path.dirname", "nrrd.read_header", "numpy.array", "warnings.catch_warnings", "numpy.testing.assert_equal", "numpy.arange", "nrrd.read" ]
[((1316, 1369), 'numpy.testing.assert_equal', 'np.testing.assert_equal', (['self.expected_header', 'header'], {}), '(self.expected_header, header)\n', (1339, 1369), True, 'import numpy as np\n'), ((1439, 1475), 'nrrd.read_header', 'nrrd.read_header', (['RAW_NRRD_FILE_PATH'], {}), '(RAW_NRRD_FILE_PATH)\n', (1455, 1475),...
import numpy ar = list(map(int,input().split())) np_ar = numpy.array(ar) print(numpy.reshape(np_ar,(3,3)))
[ "numpy.array", "numpy.reshape" ]
[((57, 72), 'numpy.array', 'numpy.array', (['ar'], {}), '(ar)\n', (68, 72), False, 'import numpy\n'), ((79, 107), 'numpy.reshape', 'numpy.reshape', (['np_ar', '(3, 3)'], {}), '(np_ar, (3, 3))\n', (92, 107), False, 'import numpy\n')]
import numpy as np from scipy.stats import entropy def OHE(val, len_output): val = np.array(val) res = np.eye(len_output)[np.array(val).reshape(-1)] return res.reshape(list(val.shape)+[len_output]) def cross_entropy(predictions, targets): predictions = np.array(predictions)[:, :, 0] return entro...
[ "numpy.eye", "numpy.log", "scipy.stats.entropy", "numpy.clip", "numpy.array", "numpy.diag" ]
[((89, 102), 'numpy.array', 'np.array', (['val'], {}), '(val)\n', (97, 102), True, 'import numpy as np\n'), ((444, 455), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (452, 455), True, 'import numpy as np\n'), ((544, 588), 'numpy.clip', 'np.clip', (['predictions', 'epsilon', '(1.0 - epsilon)'], {}), '(predictions, e...
import unittest import numpy as np from itertools import product from tensornetwork import Node, ncon from tnpy.tsdrg import TreeNode, TensorTree, TSDRG from tnpy.exact_diagonalization import ExactDiagonalization as ED from tnpy.model import RandomHeisenberg, SpectralFoldedRandomHeisenberg class TestTensorTree(unitte...
[ "unittest.main", "tnpy.exact_diagonalization.ExactDiagonalization", "numpy.diagflat", "tnpy.tsdrg.TensorTree", "tnpy.tsdrg.TSDRG", "numpy.identity", "tnpy.model.SpectralFoldedRandomHeisenberg", "numpy.linalg.svd", "numpy.array", "tnpy.tsdrg.TreeNode", "tnpy.model.RandomHeisenberg", "numpy.test...
[((347, 398), 'tnpy.model.RandomHeisenberg', 'RandomHeisenberg', ([], {'N': '(4)', 'h': '(0)', 'penalty': '(0.0)', 's_target': '(0)'}), '(N=4, h=0, penalty=0.0, s_target=0)\n', (363, 398), False, 'from tnpy.model import RandomHeisenberg, SpectralFoldedRandomHeisenberg\n'), ((411, 436), 'tnpy.tsdrg.TreeNode', 'TreeNode'...
import cv2 import numpy as np def skeleton_of_shape(img): thn = cv2.ximgproc.thinning(img, None, thinningType=cv2.ximgproc.THINNING_ZHANGSUEN) w = thn.shape[1] h = thn.shape[0] for y in range(0, h): thn[y, w-1] = 0 thn[y, 0] = 0 for x in range(0, w): thn[h - 1, x] = 0 ...
[ "numpy.uint8", "numpy.zeros_like", "cv2.filter2D", "cv2.ximgproc.thinning", "cv2.bitwise_or" ]
[((70, 148), 'cv2.ximgproc.thinning', 'cv2.ximgproc.thinning', (['img', 'None'], {'thinningType': 'cv2.ximgproc.THINNING_ZHANGSUEN'}), '(img, None, thinningType=cv2.ximgproc.THINNING_ZHANGSUEN)\n', (91, 148), False, 'import cv2\n'), ((433, 447), 'numpy.uint8', 'np.uint8', (['skel'], {}), '(skel)\n', (441, 447), True, '...
"flabel (list of lists) unit tests." import numpy as np from numpy.testing import assert_equal from la.flabel import listmap, listmap_fill # --------------------------------------------------------------------------- # listmap # # test to make sure listmap returns the same output as # # ...
[ "la.flabel.listmap_fill", "la.flabel.listmap", "numpy.random.shuffle" ]
[((2262, 2288), 'la.flabel.listmap_fill', 'listmap_fill', (['list1', 'list2'], {}), '(list1, list2)\n', (2274, 2288), False, 'from la.flabel import listmap, listmap_fill\n'), ((552, 576), 'numpy.random.shuffle', 'np.random.shuffle', (['list2'], {}), '(list2)\n', (569, 576), True, 'import numpy as np\n'), ((631, 652), '...
import numpy as np from ipywidgets import widgets as wdg import matplotlib.pyplot as plt import threading from ipyfilechooser import FileChooser from matplotlib.animation import FuncAnimation import os import plotly.graph_objects as go import pandas as pd import sys import re from scipy import constants as cts from IPy...
[ "ipywidgets.widgets.ToggleButtons", "plotly.graph_objects.FigureWidget", "ipywidgets.widgets.Dropdown", "os.path.abspath", "pyOSA.Yokogawa", "ipywidgets.widgets.Checkbox", "os.path.dirname", "os.path.exists", "re.findall", "numpy.linspace", "ipywidgets.widgets.IntSlider", "plotly.graph_objects...
[((503, 528), 'os.path.abspath', 'os.path.abspath', (['work_dir'], {}), '(work_dir)\n', (518, 528), False, 'import os\n'), ((536, 570), 'os.path.abspath', 'os.path.abspath', (["(work_dir + '/../')"], {}), "(work_dir + '/../')\n", (551, 570), False, 'import os\n'), ((1036, 1073), 'numpy.linspace', 'np.linspace', (['xlim...
""" =========== SVM as CRF =========== A CRF with one node is the same as a multiclass SVM. Evaluation on iris dataset (really easy). """ from time import time import numpy as np from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split from pystruct.models import GraphCRF from py...
[ "sklearn.datasets.load_iris", "sklearn.cross_validation.train_test_split", "numpy.empty", "time.time", "pystruct.learners.NSlackSSVM", "numpy.mean", "pystruct.models.GraphCRF", "numpy.atleast_2d" ]
[((362, 373), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (371, 373), False, 'from sklearn.datasets import load_iris\n'), ((616, 639), 'sklearn.cross_validation.train_test_split', 'train_test_split', (['X_', 'Y'], {}), '(X_, Y)\n', (632, 639), False, 'from sklearn.cross_validation import train_test_spl...
# -*- coding: utf-8 -*- """ Created on Sun Sep 6 18:40:47 2020 @author: benjamin """ from lxml import html import requests import numpy as np import pandas as pd import datetime as dt from time import time as t #Uncomment each block block below one at a time to extract data from each cemetery. #Cem...
[ "pandas.DataFrame", "numpy.stack", "lxml.html.fromstring", "time.time", "numpy.append", "numpy.array", "requests.get" ]
[((1479, 1555), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Block', 'Names', 'Births', 'Deaths', 'Site', 'Link']"}), "(columns=['Block', 'Names', 'Births', 'Deaths', 'Site', 'Link'])\n", (1491, 1555), True, 'import pandas as pd\n'), ((4049, 4052), 'time.time', 't', ([], {}), '()\n', (4050, 4052), True, 'fro...
from sklearn.metrics.pairwise import pairwise_distances from tensorflow.python.platform import gfile import tensorflow as tf import numpy as np import detect_and_align import argparse import time import cv2 import os import datetime import tkinter as tk from tkinter import * from tkinter import Message ,Text import cv...
[ "tensorflow.python.platform.gfile.FastGFile", "numpy.argmin", "os.path.isfile", "cv2.rectangle", "tensorflow.get_default_graph", "cv2.imshow", "os.path.join", "pandas.DataFrame", "sklearn.metrics.pairwise.pairwise_distances", "cv2.cvtColor", "detect_and_align.create_mtcnn", "os.path.dirname", ...
[((4037, 4062), 'os.path.expanduser', 'os.path.expanduser', (['model'], {}), '(model)\n', (4055, 4062), False, 'import os\n'), ((4070, 4095), 'os.path.isfile', 'os.path.isfile', (['model_exp'], {}), '(model_exp)\n', (4084, 4095), False, 'import os\n'), ((2862, 2914), 'sklearn.metrics.pairwise.pairwise_distances', 'pair...
"""PyBoxLib layout class.""" import numpy as np import fboxlib.fcboxlib as fcboxlib class layout(): """BoxLib layout.""" def __init__(self, boxarray=None, cptr=None): if cptr: self.cptr = cptr else: pmask = np.ones(boxarray.dim, np.int32) self.cptr = fcboxlib.layout_create_...
[ "fboxlib.fcboxlib.layout_local", "numpy.ones", "fboxlib.fcboxlib.layout_print", "fboxlib.fcboxlib.layout_get_box", "fboxlib.fcboxlib.layout_nboxes", "fboxlib.fcboxlib.layout_create_from_boxarray" ]
[((439, 472), 'fboxlib.fcboxlib.layout_nboxes', 'fcboxlib.layout_nboxes', (['self.cptr'], {}), '(self.cptr)\n', (461, 472), True, 'import fboxlib.fcboxlib as fcboxlib\n'), ((657, 692), 'fboxlib.fcboxlib.layout_local', 'fcboxlib.layout_local', (['self.cptr', 'n'], {}), '(self.cptr, n)\n', (678, 692), True, 'import fboxl...
""" * Copyright 2019 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing,...
[ "commons.object_saving.object_saver.ObjectSaver", "numpy.random.uniform", "logging.getLogger" ]
[((868, 913), 'logging.getLogger', 'logging.getLogger', (['"""analyzerApp.modelChooser"""'], {}), "('analyzerApp.modelChooser')\n", (885, 913), False, 'import logging\n'), ((1093, 1121), 'commons.object_saving.object_saver.ObjectSaver', 'ObjectSaver', (['self.app_config'], {}), '(self.app_config)\n', (1104, 1121), Fals...
from napari_pssr import ( train_pssr_widget, predict_pssr_widget, ) import numpy as np def test_train_pssr_widget(make_napari_viewer, capsys): viewer = make_napari_viewer() layer = viewer.add_image(np.random.random((100, 100))) my_widget = train_pssr_widget() my_widget(viewer.layers[0]) de...
[ "napari_pssr.predict_pssr_widget", "numpy.random.random", "napari_pssr.train_pssr_widget" ]
[((263, 282), 'napari_pssr.train_pssr_widget', 'train_pssr_widget', ([], {}), '()\n', (280, 282), False, 'from napari_pssr import train_pssr_widget, predict_pssr_widget\n'), ((486, 507), 'napari_pssr.predict_pssr_widget', 'predict_pssr_widget', ([], {}), '()\n', (505, 507), False, 'from napari_pssr import train_pssr_wi...
import gym import numpy as np from collections import deque import sys class Agent: def __init__(self, Q, env, mode, eps=1.0, alpha=0.01, gamma=1.0): self.env = env self.Q = Q self.eps_min = 0.00001 self.eps = eps self.gamma = gamma self.shape = int(np.sqrt(self.en...
[ "numpy.argmax", "numpy.ones", "numpy.max", "numpy.mean", "sys.stdout.flush", "numpy.arange", "collections.deque", "numpy.sqrt" ]
[((1342, 1364), 'numpy.argmax', 'np.argmax', (['self.Q[Q_s]'], {}), '(self.Q[Q_s])\n', (1351, 1364), True, 'import numpy as np\n'), ((1446, 1470), 'collections.deque', 'deque', ([], {'maxlen': 'plot_every'}), '(maxlen=plot_every)\n', (1451, 1470), False, 'from collections import deque\n'), ((1488, 1519), 'collections.d...
import os import rnnSMAP from rnnSMAP import runTrainLSTM from rnnSMAP import runTestLSTM import matplotlib.pyplot as plt import numpy as np import scipy import scipy.stats as stats import matplotlib import matplotlib.gridspec as gridspec import imp imp.reload(rnnSMAP) rnnSMAP.reload() matplotlib.rcParams.update({'f...
[ "imp.reload", "matplotlib.pyplot.tight_layout", "numpy.abs", "matplotlib.pyplot.cm.jet", "matplotlib.rcParams.update", "rnnSMAP.runTestLSTM.runCmdLine", "rnnSMAP.funPost.flatData", "rnnSMAP.reload", "matplotlib.pyplot.subplots", "rnnSMAP.runTrainLSTM.runCmdLine", "numpy.isnan", "rnnSMAP.classL...
[((252, 271), 'imp.reload', 'imp.reload', (['rnnSMAP'], {}), '(rnnSMAP)\n', (262, 271), False, 'import imp\n'), ((272, 288), 'rnnSMAP.reload', 'rnnSMAP.reload', ([], {}), '()\n', (286, 288), False, 'import rnnSMAP\n'), ((290, 335), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 14}"], {}),...
import pyqtgraph as pg import numpy as np from pyqtgraph.Qt import QtGui, QtCore from pyqtgraph import LayoutWidget from .algorithms import de_casteljau from .algorithms import degree_elevation from .utils import construct_arrow from .utils import delete_content from .utils import compute_bbox_of_points from .color ...
[ "pyqtgraph.Qt.QtGui.QIntValidator", "pyqtgraph.Qt.QtGui.QSpacerItem", "pyqtgraph.Qt.QtGui.QLabel", "pyqtgraph.LayoutWidget", "pyqtgraph.Qt.QtGui.QColor", "pyqtgraph.Qt.QtGui.QPushButton", "pyqtgraph.Qt.QtGui.QMenu", "numpy.linspace", "pyqtgraph.Qt.QtGui.QPainterPath", "pyqtgraph.Qt.QtCore.QPointF"...
[((668, 707), 'pyqtgraph.ROI.__init__', 'pg.ROI.__init__', (['self', 'pos'], {'size': '[1, 1]'}), '(self, pos, size=[1, 1])\n', (683, 707), True, 'import pyqtgraph as pg\n'), ((3044, 3064), 'pyqtgraph.Qt.QtGui.QPainterPath', 'QtGui.QPainterPath', ([], {}), '()\n', (3062, 3064), False, 'from pyqtgraph.Qt import QtGui, Q...
import pdb import numpy as np import matplotlib.pyplot as plt import dist import util import pickle from mdp10 import MDP, TabularQ, NNQ, value_iteration, Q_learn, Q_learn_batch, greedy, sim_episode, evaluate class No_Exit(MDP): # Like breakout or pong, but one player, no walls to break out, no # way to win Yo...
[ "matplotlib.pyplot.figure", "mdp10.greedy", "dist.DDist", "numpy.max", "matplotlib.pyplot.pause", "dist.delta_dist", "pickle.dumps", "matplotlib.pyplot.ylim", "matplotlib.pyplot.ion", "numpy.min", "matplotlib.pyplot.subplot", "matplotlib.pyplot.xlim", "mdp10.Q_learn", "numpy.zeros", "mat...
[((5230, 5239), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (5237, 5239), True, 'import matplotlib.pyplot as plt\n'), ((5244, 5273), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'facecolor': '"""white"""'}), "(facecolor='white')\n", (5254, 5273), True, 'import matplotlib.pyplot as plt\n'), ((5283, 5296), '...
""" Utilities and helper functions. These functions can be used to construct 2-sided 1 - alpha confidence bounds for the average treatment effect in a randomized experiment with binary outcomes and two treatments. """ import numpy as np from scipy.stats import hypergeom from itertools import combinations from math im...
[ "numpy.full", "numpy.flip", "scipy.stats.hypergeom.pmf", "scipy.stats.hypergeom.cdf", "numpy.empty", "numpy.flatnonzero", "math.comb", "numpy.zeros", "numpy.floor", "math.floor", "numpy.max", "numpy.min", "numpy.arange", "numpy.array", "numpy.matmul", "numpy.random.choice", "numpy.ro...
[((644, 654), 'math.comb', 'comb', (['n', 'm'], {}), '(n, m)\n', (648, 654), False, 'from math import comb, floor\n'), ((703, 730), 'numpy.zeros', 'np.zeros', (['(c, n)'], {'dtype': 'int'}), '((c, n), dtype=int)\n', (711, 730), True, 'import numpy as np\n'), ((744, 756), 'numpy.arange', 'np.arange', (['c'], {}), '(c)\n...
import numpy as np from mpi4py import MPI import scipy.stats as ss import matplotlib.pyplot as plt comm=MPI.COMM_WORLD rank=comm.Get_rank() size=comm.Get_size() #generate normal distributions numbers n=1000 if rank==0: sendbuf_0 = np.random.normal(0,1, n) comm.Bcast(sendbuf_0, root =0) elif rank==1: sen...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.std", "numpy.empty", "scipy.stats.norm.pdf", "numpy.mean", "numpy.random.normal" ]
[((237, 262), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'n'], {}), '(0, 1, n)\n', (253, 262), True, 'import numpy as np\n'), ((329, 340), 'numpy.empty', 'np.empty', (['n'], {}), '(n)\n', (337, 340), True, 'import numpy as np\n'), ((412, 434), 'scipy.stats.norm.pdf', 'ss.norm.pdf', (['sendbuf_0'], {}), ...
# %% [markdown] # ## import os import warnings from itertools import chain import matplotlib as mpl import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from sc...
[ "src.visualization.remove_spines", "numpy.random.seed", "src.io.savefig", "src.graph.MetaGraph", "numpy.mean", "numpy.arange", "graspy.models.SBMEstimator", "graspy.utils.binarize", "src.io.readcsv", "pandas.DataFrame", "matplotlib.patches.Rectangle", "matplotlib.pyplot.subplots", "seaborn.s...
[((1704, 1773), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'category': 'ConvergenceWarning'}), "(action='ignore', category=ConvergenceWarning)\n", (1727, 1773), False, 'import warnings\n'), ((2067, 2129), 'seaborn.plotting_context', 'sns.plotting_context', ([], {'context': '""...
#import pyglet from pynput import keyboard from datetime import datetime, timedelta from ffpyplayer.player import MediaPlayer import time import cv2 import numpy as np fileName = "darude" player = MediaPlayer("music/" + fileName + ".mp3") val = '' end = False startTime = datetime.now() array = np.zeros(1000) fps = 5 l...
[ "numpy.zeros", "ffpyplayer.player.MediaPlayer", "datetime.datetime.now" ]
[((198, 239), 'ffpyplayer.player.MediaPlayer', 'MediaPlayer', (["('music/' + fileName + '.mp3')"], {}), "('music/' + fileName + '.mp3')\n", (209, 239), False, 'from ffpyplayer.player import MediaPlayer\n'), ((273, 287), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (285, 287), False, 'from datetime import ...
from key import Key from message import Message from key import Key import numpy as np map0 = np.array([1,2,0]) map1 = np.array([0,2,1]) key0 = Key(map0) key1 = Key(map1) key3 = key0.substitute(key1.map) inverted_key0 = key0.invert() assert np.all(key3.map == np.array([2,1,0])) assert np.all(inverted_key0.map == np...
[ "key.Key", "message.Message", "numpy.array" ]
[((95, 114), 'numpy.array', 'np.array', (['[1, 2, 0]'], {}), '([1, 2, 0])\n', (103, 114), True, 'import numpy as np\n'), ((120, 139), 'numpy.array', 'np.array', (['[0, 2, 1]'], {}), '([0, 2, 1])\n', (128, 139), True, 'import numpy as np\n'), ((146, 155), 'key.Key', 'Key', (['map0'], {}), '(map0)\n', (149, 155), False, ...
import numpy as np import random import os from colorama import init, Fore import matplotlib.pyplot as plt import matplotlib.animation as animation import copy import argparse ##### MAZE GENERATOR ##### # https://en.wikipedia.org/wiki/Maze_generation_algorithm # generate a maze using numpy # # Implemented algorithms:...
[ "colorama.init", "numpy.full", "copy.deepcopy", "os.makedirs", "argparse.ArgumentParser", "random.randint", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "matplotlib.animation.ArtistAnimation", "random.random", "matplotlib.pyplot.figure", "matplotlib.pyplot.imsave" ]
[((438, 444), 'colorama.init', 'init', ([], {}), '()\n', (442, 444), False, 'from colorama import init, Fore\n'), ((819, 854), 'numpy.full', 'np.full', (['(height, width)', 'WALL', 'int'], {}), '((height, width), WALL, int)\n', (826, 854), True, 'import numpy as np\n'), ((6401, 6433), 'matplotlib.pyplot.imshow', 'plt.i...
""" Dijkstra 2D @author: <NAME> """ import os import sys import math import heapq import time sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../Search_based_Planning/") from Search_2D import plotting, env from Search_2D.Astar import AStar class Dijkstra(AStar): """Dijkstra s...
[ "Search_2D.plotting.Plotting", "os.path.abspath", "numpy.sum", "heapq.heappush", "time.time", "heapq.heappop", "numpy.array" ]
[((1490, 1524), 'Search_2D.plotting.Plotting', 'plotting.Plotting', (['s_start', 's_goal'], {}), '(s_start, s_goal)\n', (1507, 1524), False, 'from Search_2D import plotting, env\n'), ((1701, 1712), 'time.time', 'time.time', ([], {}), '()\n', (1710, 1712), False, 'import time\n'), ((1912, 1923), 'time.time', 'time.time'...
import numpy as np import pandas as pd from bokeh.plotting import * # Generate some synthetic time series for six different categories cats = list("abcdef") y = np.random.randn(2000) g = np.random.choice(cats, 2000) for i, l in enumerate(cats): y[g == l] += i // 2 df = pd.DataFrame(dict(score=y, group=g)) # Find ...
[ "numpy.random.choice", "numpy.random.randn" ]
[((162, 183), 'numpy.random.randn', 'np.random.randn', (['(2000)'], {}), '(2000)\n', (177, 183), True, 'import numpy as np\n'), ((188, 216), 'numpy.random.choice', 'np.random.choice', (['cats', '(2000)'], {}), '(cats, 2000)\n', (204, 216), True, 'import numpy as np\n')]
import numpy as np import matplotlib.pyplot as plt from MCES import MCES from blackjack_setup import * initial_Q = np.zeros([200,2]) initial_policy = np.ones([200, 2]) / 2 gamma = 1 alpha = 0 num_episodes = 100000 Q,_ = MCES(get_episode_blackjack,initial_Q,initial_policy,gamma,alpha,num_episodes) optimal_actions = Q...
[ "numpy.sum", "matplotlib.pyplot.show", "numpy.zeros", "numpy.ones", "numpy.arange", "MCES.MCES", "matplotlib.pyplot.subplots" ]
[((117, 135), 'numpy.zeros', 'np.zeros', (['[200, 2]'], {}), '([200, 2])\n', (125, 135), True, 'import numpy as np\n'), ((223, 309), 'MCES.MCES', 'MCES', (['get_episode_blackjack', 'initial_Q', 'initial_policy', 'gamma', 'alpha', 'num_episodes'], {}), '(get_episode_blackjack, initial_Q, initial_policy, gamma, alpha,\n ...
import torch import numpy as np import library.inputs as inputs from Utils.flags import FLAGS def test_classifier(netC): device = FLAGS.device loss_func = torch.nn.CrossEntropyLoss() testloader = inputs.get_data_iter_test() correct = 0 total = 0 loss_list = [] with torch.no_grad(): ...
[ "torch.nn.CrossEntropyLoss", "numpy.mean", "torch.max", "torch.no_grad", "library.inputs.get_data_iter_test" ]
[((166, 193), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (191, 193), False, 'import torch\n'), ((211, 238), 'library.inputs.get_data_iter_test', 'inputs.get_data_iter_test', ([], {}), '()\n', (236, 238), True, 'import library.inputs as inputs\n'), ((297, 312), 'torch.no_grad', 'torch.no...
''' Base class for bipartite networks in long or collapsed long form ''' import numpy as np import pandas as pd import bipartitepandas as bpd class BipartiteLongBase(bpd.BipartiteBase): ''' Base class for BipartiteLong and BipartiteLongCollapsed, where BipartiteLong and BipartiteLongCollapsed give a bipartite ...
[ "numpy.stack", "bipartitepandas.recollapse_loop", "numpy.roll", "bipartitepandas.update_dict", "numpy.where", "bipartitepandas.to_list", "bipartitepandas.compare_frames", "pandas.concat", "numpy.concatenate" ]
[((31607, 31633), 'bipartitepandas.recollapse_loop', 'bpd.recollapse_loop', (['(False)'], {}), '(False)\n', (31626, 31633), True, 'import bipartitepandas as bpd\n'), ((33726, 33752), 'bipartitepandas.recollapse_loop', 'bpd.recollapse_loop', (['(False)'], {}), '(False)\n', (33745, 33752), True, 'import bipartitepandas a...
from scipy.sparse import csr_matrix, csc_matrix, coo_matrix, lil_matrix import numpy as np import scipy.sparse as sps from tqdm import tqdm from course_lib.Data_manager.IncrementalSparseMatrix import IncrementalSparseMatrix def mix_URM(URM_positive: csr_matrix, URM_negative: csr_matrix): return sps.vstack([URM_p...
[ "tqdm.tqdm", "numpy.in1d", "numpy.concatenate", "scipy.sparse.vstack", "numpy.log2", "numpy.zeros", "numpy.ones", "numpy.equal", "course_lib.Data_manager.IncrementalSparseMatrix.IncrementalSparseMatrix", "scipy.sparse.coo_matrix", "numpy.arange", "numpy.array", "numpy.random.randint", "num...
[((303, 357), 'scipy.sparse.vstack', 'sps.vstack', (['[URM_positive, URM_negative]'], {'format': '"""csr"""'}), "([URM_positive, URM_negative], format='csr')\n", (313, 357), True, 'import scipy.sparse as sps\n'), ((464, 502), 'course_lib.Data_manager.IncrementalSparseMatrix.IncrementalSparseMatrix', 'IncrementalSparseM...
import pandas as pd import numpy as np import re from scipy.sparse import csr_matrix import sparse_dot_topn.sparse_dot_topn as ct from string import punctuation import spacy from collections import defaultdict chars_to_remove = ['"', "'", "[", "]"] def clean_element(element): """Removes unwanted characters from ...
[ "numpy.asarray", "numpy.zeros", "collections.defaultdict", "scipy.sparse.csr_matrix", "pandas.isna", "re.sub" ]
[((1582, 1599), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1593, 1599), False, 'from collections import defaultdict\n'), ((2041, 2056), 'pandas.isna', 'pd.isna', (['string'], {}), '(string)\n', (2048, 2056), True, 'import pandas as pd\n'), ((2352, 2374), 're.sub', 're.sub', (['rx', '""""""',...
""" Module for splitting data into train/validation/test sets """ import numpy as np import pandas as pd def splitting_functions_factory(function_name): """Returns splitting function based on name""" if function_name == "by_time": return split_by_time def split_by_time(interactions, fraction_test,...
[ "numpy.percentile", "pandas.merge", "numpy.random.seed" ]
[((438, 466), 'numpy.random.seed', 'np.random.seed', (['random_state'], {}), '(random_state)\n', (452, 466), True, 'import numpy as np\n'), ((493, 560), 'numpy.percentile', 'np.percentile', (["interactions['timestamp']", '(100 * (1 - fraction_test))'], {}), "(interactions['timestamp'], 100 * (1 - fraction_test))\n", (5...
from flask import url_for, request from util import json_response import requests import urllib import sys from datetime import datetime, timedelta import pandas as pd from time import sleep import ccxt from Trade import get_bitfinex_candle_data,transfer_to_period_data,calcBolling,calcSince,calcEMA from utility import ...
[ "pprint.pformat", "util.json_response", "Trade.calcBolling", "flask.request.args.get", "Trade.calcEMA", "pandas.read_csv", "Trade.transfer_to_period_data", "pandas.to_datetime", "pytz.timezone", "numpy.array", "Trade.get_bitfinex_candle_data", "echarts_data.get_echarts_html", "configparser.C...
[((569, 596), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (594, 596), False, 'import configparser\n'), ((628, 658), 'pytz.timezone', 'pytz.timezone', (['"""Asia/Shanghai"""'], {}), "('Asia/Shanghai')\n", (641, 658), False, 'import pytz\n'), ((673, 699), 'TradeClient.TradeClient', 'TradeC...
import collections import logging import numpy as np import PIL.ImageColor as ImageColor import PIL.ImageDraw as ImageDraw import PIL.ImageFont as ImageFont import tensorflow as tf from google.protobuf import text_format import string_int_label_map_pb2 from PIL import Image STANDARD_COLORS = [ 'Alice...
[ "numpy.uint8", "numpy.ones_like", "numpy.ceil", "numpy.logical_and", "PIL.ImageFont.load_default", "PIL.Image.composite", "PIL.ImageColor.getrgb", "collections.defaultdict", "PIL.ImageFont.truetype", "string_int_label_map_pb2.StringIntLabelMap", "logging.info", "numpy.array", "google.protobu...
[((2789, 2813), 'PIL.ImageColor.getrgb', 'ImageColor.getrgb', (['color'], {}), '(color)\n', (2806, 2813), True, 'import PIL.ImageColor as ImageColor\n'), ((2829, 2851), 'PIL.Image.fromarray', 'Image.fromarray', (['image'], {}), '(image)\n', (2844, 2851), False, 'from PIL import Image\n'), ((3119, 3172), 'PIL.Image.comp...
# -*- coding: utf-8 -*- """ Created on Sun Aug 2 20:46:53 2020 @author: Daniel """ import pandas as pd import scanpy as sc import matplotlib.pyplot as plt import seaborn as sns import numpy as np import statsmodels.api as sm #from pyglmnet import GLM, simulate_glm from sklearn import linear_model, model_selection p...
[ "statsmodels.api.GLM", "numpy.random.seed", "pandas.read_csv", "scanpy.read_h5ad", "matplotlib.pyplot.subplots", "numpy.random.choice", "statsmodels.api.families.Poisson", "scanpy.pp.log1p", "seaborn.set", "pandas.concat" ]
[((357, 473), 'seaborn.set', 'sns.set', ([], {'context': '"""paper"""', 'style': '"""whitegrid"""', 'palette': '"""colorblind"""', 'font': '"""Arial"""', 'font_scale': '(2)', 'color_codes': '(True)'}), "(context='paper', style='whitegrid', palette='colorblind', font=\n 'Arial', font_scale=2, color_codes=True)\n", (3...
import torch import torch.nn.functional as F import cv2 as cv import numpy as np import os from glob import glob from icecream import ic from scipy.spatial.transform import Rotation as Rot from scipy.spatial.transform import Slerp import imageio import pdb # This function is borrowed from IDR: https://github.com/liory...
[ "numpy.stack", "torch.stack", "torch.sum", "numpy.asarray", "imageio.imread", "cv2.imread", "numpy.array", "numpy.linalg.inv", "torch.device", "numpy.eye", "torch.inverse", "os.path.join", "cv2.decomposeProjectionMatrix", "cv2.resize", "torch.from_numpy" ]
[((648, 679), 'cv2.decomposeProjectionMatrix', 'cv.decomposeProjectionMatrix', (['P'], {}), '(P)\n', (676, 679), True, 'import cv2 as cv\n'), ((763, 772), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (769, 772), True, 'import numpy as np\n'), ((812, 839), 'numpy.eye', 'np.eye', (['(4)'], {'dtype': 'np.float32'}), '(4...
from random import randrange,seed import numpy as np import pandas as pd from copy import deepcopy from numpy import array,var,mean from numpy import polyfit import json #parameter set up start_ind = 20000 col_sample_lim = 10 row_sample_lim = 800 err_thres = 1e-7 forest_num = 150 max_depth = 100 D_array = [] tree_arra...
[ "copy.deepcopy", "numpy.abs", "numpy.sum", "numpy.polyfit", "pandas.read_csv", "json.dumps", "numpy.mean", "numpy.array", "pandas.factorize", "numpy.var" ]
[((448, 455), 'numpy.mean', 'mean', (['D'], {}), '(D)\n', (452, 455), False, 'from numpy import array, var, mean\n'), ((6187, 6219), 'pandas.read_csv', 'pd.read_csv', (['"""data/training.csv"""'], {}), "('data/training.csv')\n", (6198, 6219), True, 'import pandas as pd\n'), ((6231, 6262), 'pandas.read_csv', 'pd.read_cs...
import numpy as np import pandas as pd import time from typing import Any, Dict, List, Tuple, NoReturn class EKF(object): def __init__(self): self.init() def init(self): #state vector self.X = np.array([[0], # x [0], # y [0], # v_x [0], # v_y [0], # a_x...
[ "numpy.eye", "numpy.asarray", "numpy.transpose", "numpy.random.randint", "numpy.array", "numpy.linalg.inv", "numpy.dot" ]
[((209, 259), 'numpy.array', 'np.array', (['[[0], [0], [0], [0], [0], [0], [0], [0]]'], {}), '([[0], [0], [0], [0], [0], [0], [0], [0]])\n', (217, 259), True, 'import numpy as np\n'), ((420, 429), 'numpy.eye', 'np.eye', (['(8)'], {}), '(8)\n', (426, 429), True, 'import numpy as np\n'), ((506, 605), 'numpy.array', 'np.a...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Author: kerlomz <<EMAIL>> import time import random import numpy as np import tensorflow as tf import framework import utils from config import * from tensorflow.python.framework.graph_util import convert_variables_to_constants from PIL import ImageFile ImageFile.LOAD_TR...
[ "tensorflow.logging.info", "tensorflow.global_variables_initializer", "utils.accuracy_calculation", "tensorflow.Session", "framework.GraphOCR", "tensorflow.logging.set_verbosity", "utils.DataIterator", "time.time", "tensorflow.global_variables", "tensorflow.python.framework.graph_util.convert_vari...
[((342, 383), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (366, 383), True, 'import tensorflow as tf\n'), ((428, 438), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (436, 438), True, 'import tensorflow as tf\n'), ((450, 479), 'tensorflow.Session'...
""" Voronoi Kivy App =================== Runs the voronoi GUI app. """ from kivy.support import install_twisted_reactor install_twisted_reactor() from itertools import cycle import logging import os import numpy as np import json import csv import math from functools import cmp_to_key from kivy.uix.widget import Wi...
[ "distopia.app.voronoi_data.GeoDataPrecinct2017", "kivy.clock.Clock.create_trigger", "distopia.app.voronoi_data.GeoDataCounty", "kivy.clock.Clock.schedule_once", "kivy.graphics.context_instructions.Scale", "kivy.graphics.Color", "kivy.graphics.vertex_instructions.Mesh", "os.path.dirname", "os.path.ex...
[((122, 147), 'kivy.support.install_twisted_reactor', 'install_twisted_reactor', ([], {}), '()\n', (145, 147), False, 'from kivy.support import install_twisted_reactor\n'), ((32025, 32101), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['"""\n<SizedLabel@Label>:\n size: self.texture_size\n"""'], {}), '(""...
import numpy as np import pandas as pd import scanpy as sc import scanpy.external as sce def create_cluster_annotation_overview( adata, n_levels, cluster_label, min_fraction_for_dominancy=0.80, min_fraction_annotated=0.5, compartment_of_interest=None, ): """Function to calculate for each ...
[ "scanpy.tl.pca", "scanpy.pp.neighbors", "pandas.isnull", "numpy.argsort", "scanpy.external.tl.phenograph", "scanpy.tl.leiden", "scanpy.tl.rank_genes_groups", "pandas.Categorical" ]
[((6743, 6828), 'pandas.Categorical', 'pd.Categorical', (['adata.obs[cluster_label_new]'], {'categories': 'cluster_numbers_ordered'}), '(adata.obs[cluster_label_new], categories=cluster_numbers_ordered\n )\n', (6757, 6828), True, 'import pandas as pd\n'), ((10366, 10451), 'pandas.Categorical', 'pd.Categorical', (['a...
import numpy as np import cv2 import torch import torch.nn as nn def remap_using_flow_fields(image, disp_x, disp_y, interpolation=cv2.INTER_LINEAR, border_mode=cv2.BORDER_CONSTANT): """ Opencv remap map_x contains the index of the matching horizontal position of each pixel [i,j] while map_y contains the ...
[ "torch.nn.functional.grid_sample", "torch.cat", "cv2.remap", "torch.arange", "numpy.linspace" ]
[((1040, 1128), 'cv2.remap', 'cv2.remap', (['image', 'map_x', 'map_y'], {'interpolation': 'interpolation', 'borderMode': 'border_mode'}), '(image, map_x, map_y, interpolation=interpolation, borderMode=\n border_mode)\n', (1049, 1128), False, 'import cv2\n'), ((1850, 1938), 'cv2.remap', 'cv2.remap', (['image', 'map_x...
""" Example network for the living machines paper <NAME> January 27th 2022 """ import numpy as np import matplotlib.pyplot as plt from sns_toolbox.design.neurons import NonSpikingNeuron from sns_toolbox.design.connections import NonSpikingSynapse from sns_toolbox.design.networks import Network from sns_toolbox.simula...
[ "sns_toolbox.design.neurons.NonSpikingNeuron", "sns_toolbox.design.connections.NonSpikingSynapse", "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.arange", "sns_toolbox.design.networks.Network", "sns_toolbox.simulate.backends.SNS_Numpy" ]
[((393, 411), 'sns_toolbox.design.neurons.NonSpikingNeuron', 'NonSpikingNeuron', ([], {}), '()\n', (409, 411), False, 'from sns_toolbox.design.neurons import NonSpikingNeuron\n'), ((431, 474), 'sns_toolbox.design.neurons.NonSpikingNeuron', 'NonSpikingNeuron', ([], {'membrane_capacitance': '(50.0)'}), '(membrane_capacit...
# read in all LAMOST labels import numpy as np from matplotlib import rc from matplotlib import cm import matplotlib as mpl rc('font', family='serif') rc('text', usetex=True) import matplotlib.pyplot as plt from matplotlib.colors import LogNorm direc = "/home/annaho/aida41040/annaho/TheCannon/examples" teff = np.loa...
[ "matplotlib.rc", "numpy.load", "matplotlib.pyplot.close", "matplotlib.pyplot.colorbar", "matplotlib.colors.LogNorm", "numpy.where", "numpy.loadtxt", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((125, 151), 'matplotlib.rc', 'rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (127, 151), False, 'from matplotlib import rc\n'), ((152, 175), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (154, 175), False, 'from matplotlib import rc\n'), ((3...
import sys import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm file = sys.argv[1] bins = int(sys.argv[2]) npix = int(sys.argv[3]) psf = np.zeros( [ bins, npix ] ) prow, pcol, pval = np.loadtxt( file, usecols=(0,1,2), unpack=True ) for vals in zip ( prow, pcol, pval ): psf[vals[0],vals[...
[ "matplotlib.pyplot.clf", "matplotlib.pyplot.imshow", "matplotlib.pyplot.close", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.loadtxt", "matplotlib.pyplot.savefig" ]
[((164, 186), 'numpy.zeros', 'np.zeros', (['[bins, npix]'], {}), '([bins, npix])\n', (172, 186), True, 'import numpy as np\n'), ((211, 259), 'numpy.loadtxt', 'np.loadtxt', (['file'], {'usecols': '(0, 1, 2)', 'unpack': '(True)'}), '(file, usecols=(0, 1, 2), unpack=True)\n', (221, 259), True, 'import numpy as np\n'), ((3...
from src.utils.pose import Pose2D, PoseConfig import random import cv2 import numpy as np class DataAugmentation: def __init__(self): self.sym_permutation = [i for i in range(len(PoseConfig.NAMES))] self.sym_permutation[PoseConfig.L_SHOULDER] = PoseConfig.R_SHOULDER self.sym_permutatio...
[ "random.randint", "random.uniform", "cv2.cvtColor", "numpy.clip", "random.random", "cv2.flip", "src.utils.pose.Pose2D", "cv2.resize" ]
[((1775, 1795), 'random.uniform', 'random.uniform', (['(1)', 's'], {}), '(1, s)\n', (1789, 1795), False, 'import random\n'), ((1947, 1985), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_RGB2HSV'], {}), '(image, cv2.COLOR_RGB2HSV)\n', (1959, 1985), False, 'import cv2\n'), ((2298, 2320), 'numpy.clip', 'np.clip', ...
# Modified version of scikit-learn's DictVectorizer from array import array from collections import Mapping from operator import itemgetter import numpy as np import scipy.sparse as sp from sklearn.base import BaseEstimator, TransformerMixin from sklearn.externals import six from sklearn.externals.six.moves import xr...
[ "numpy.frombuffer", "sklearn.utils.fixes.frombuffer_empty", "scipy.sparse.csr_matrix", "numpy.where", "array.array", "sklearn.externals.six.iteritems", "operator.itemgetter" ]
[((6245, 6255), 'array.array', 'array', (['"""i"""'], {}), "('i')\n", (6250, 6255), False, 'from array import array\n'), ((6273, 6288), 'array.array', 'array', (['"""i"""', '[0]'], {}), "('i', [0])\n", (6278, 6288), False, 'from array import array\n'), ((8263, 8303), 'sklearn.utils.fixes.frombuffer_empty', 'frombuffer_...
# -*- coding: utf-8 -*- # Import modules import pytest import numpy as np from matplotlib import animation # Import from package from seagull import lifeforms as lf import seagull as sg def test_simulator_run(): """Test if the run() method returns the computed statistics""" board = sg.Board(size=(10, 10)) ...
[ "seagull.lifeforms.Glider", "seagull.lifeforms.Blinker", "seagull.Simulator", "pytest.raises", "numpy.array_equal", "pytest.mark.parametrize", "seagull.Board" ]
[((491, 545), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exclude_init"""', '[True, False]'], {}), "('exclude_init', [True, False])\n", (514, 545), False, 'import pytest\n'), ((296, 319), 'seagull.Board', 'sg.Board', ([], {'size': '(10, 10)'}), '(size=(10, 10))\n', (304, 319), True, 'import seagull as s...
""" Implementation of global motion estimators. """ import numpy as np import os import scipy.ndimage import scipy.spatial from ..utils import * def _hausdorff_distance(E_1, E_2): # binary structure diamond = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]]) # extract only 1-pixel border line of objects ...
[ "numpy.ravel", "numpy.roll", "numpy.argmin", "numpy.max", "numpy.array" ]
[((222, 265), 'numpy.array', 'np.array', (['[[0, 1, 0], [1, 1, 1], [0, 1, 0]]'], {}), '([[0, 1, 0], [1, 1, 1], [0, 1, 0]])\n', (230, 265), True, 'import numpy as np\n'), ((659, 673), 'numpy.max', 'np.max', (['(A, B)'], {}), '((A, B))\n', (665, 673), True, 'import numpy as np\n'), ((2886, 2906), 'numpy.argmin', 'np.argm...
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------------ import math import numpy as np import torchvision import cv2 im...
[ "matplotlib.pyplot.subplot", "os.makedirs", "os.path.basename", "cv2.imwrite", "os.path.dirname", "matplotlib.pyplot.close", "numpy.zeros", "os.path.exists", "torchvision.utils.make_grid", "matplotlib.pyplot.figure", "matplotlib.use", "cv2.applyColorMap", "matplotlib.pyplot.subplots_adjust",...
[((346, 367), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (360, 367), False, 'import matplotlib\n'), ((1048, 1109), 'torchvision.utils.make_grid', 'torchvision.utils.make_grid', (['batch_image', 'nrow', 'padding', '(True)'], {}), '(batch_image, nrow, padding, True)\n', (1075, 1109), False, 'im...
from itertools import product from typing import IO, AnyStr, Generator, Set, Tuple import matplotlib.axes._axes import numpy as np import pandas as pd from sequencing_tools.stats_tools import hamming_distance class IUPAC: """ Working with IUPAC bases Usage:: iupac = IUPAC() iupac.check_...
[ "pandas.DataFrame", "sequencing_tools.stats_tools.hamming_distance", "numpy.array", "itertools.product", "numpy.unique" ]
[((1734, 1759), 'itertools.product', 'product', (['*expandable_list'], {}), '(*expandable_list)\n', (1741, 1759), False, 'from itertools import product\n'), ((9628, 9686), 'pandas.DataFrame', 'pd.DataFrame', (['pairwise'], {'columns': "['id1', 'id2', 'distance']"}), "(pairwise, columns=['id1', 'id2', 'distance'])\n", (...
from keras.models import Sequential from keras.layers import Dense from keras.layers import Conv2D from keras.models import model_from_json from sklearn.model_selection import train_test_split import keras import numpy import pickle import nltk from nltk.corpus import stopwords from nltk.tokenize import w...
[ "numpy.load", "pickle.dump", "keras.layers.Cropping2D", "numpy.argmax", "sklearn.model_selection.train_test_split", "pdfminer.layout.LAParams", "keras.models.Model", "pickle.load", "keras.layers.Input", "keras.layers.concatenate", "os.path.join", "pdfminer.pdfinterp.PDFPageInterpreter", "ker...
[((20609, 20677), 'os.path.join', 'os.path.join', (['"""C:\\\\Users\\\\Zach\\\\Downloads\\\\Text\\\\DCDC"""', "(loc + '.pdf')"], {}), "('C:\\\\Users\\\\Zach\\\\Downloads\\\\Text\\\\DCDC', loc + '.pdf')\n", (20621, 20677), False, 'import os\n'), ((21168, 21196), 'numpy.array', 'numpy.array', (['double_final[1]'], {}), '...
from scipy.stats import norm, randint import pandas as pd import numpy as np import json from datetime import datetime import tempfile from itertools import islice, cycle import pytest from thermostat_nw.multiple import ( multiple_thermostat_calculate_epa_field_savings_metrics, ) from thermostat_nw.exporters imp...
[ "pandas.DataFrame", "thermostat_nw.stats.compute_summary_statistics", "tempfile.mkstemp", "pandas.read_csv", "scipy.stats.norm.rvs", "thermostat_nw.stats.combine_output_dataframes", "thermostat_nw.multiple.multiple_thermostat_calculate_epa_field_savings_metrics", "scipy.stats.randint.rvs", "numpy.is...
[((12410, 12445), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'columns'}), '(data, columns=columns)\n', (12422, 12445), True, 'import pandas as pd\n'), ((12754, 12791), 'thermostat_nw.stats.combine_output_dataframes', 'combine_output_dataframes', (['dataframes'], {}), '(dataframes)\n', (12779, 12791), Fa...
# -*- coding: utf-8 -*- __author__ = 'carlos.diaz' # Density estimation in spectropolarimetric inversions import numpy as np import matplotlib.pyplot as plt from torch import nn import torch import time import os import nde_utils import nde_nflow from tqdm import tqdm import sys from ipdb import set_trace as stop # =...
[ "numpy.load", "numpy.ones", "numpy.argmin", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "nde_utils.basicLoader", "matplotlib.pyplot.axvline", "numpy.copy", "matplotlib.pyplot.close", "torch.load", "os.path.exists", "numpy.random.shuffle", "matplotlib.pyplot.axhline", "nde_n...
[((889, 928), 'numpy.delete', 'np.delete', (['samples', 'final_index'], {'axis': '(0)'}), '(samples, final_index, axis=0)\n', (898, 928), True, 'import numpy as np\n'), ((1442, 1461), 'nde_utils.dotdict', 'nde_utils.dotdict', ([], {}), '()\n', (1459, 1461), False, 'import nde_utils\n'), ((2234, 2272), 'numpy.load', 'np...
import time import sys def get_close_matches_Levenshtein( word, possibilities, n=3, cutoff=0.6, full=False): '''Replaces difflib.get_close_matches with faster algortihm based on Levenshtein.ratio. HINT: Similarity increase significatively after lower() and uni...
[ "pandas.DataFrame", "numpy.concatenate", "time.time", "pandas.read_excel", "numpy.random.randint", "numpy.array", "Levenshtein.ratio", "requests.get", "sys.exit" ]
[((537, 551), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (549, 551), True, 'import pandas as pd\n'), ((2522, 2552), 'pandas.read_excel', 'pd.read_excel', (['*args'], {}), '(*args, **kwargs)\n', (2535, 2552), True, 'import pandas as pd\n'), ((7225, 7239), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', ...
#!/usr/bin/env python # -*- coding: utf-8 -*-- # Copyright (c) 2021, 2022 Oracle and/or its affiliates. # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ from numbers import Integral, Number from time import time import numpy as np from optuna import TrialPruned...
[ "sklearn.model_selection.cross_validate", "numpy.empty", "numpy.nanstd", "numpy.zeros", "time.time", "sklearn.utils.metaestimators._safe_split", "sklearn.base.is_classifier", "sklearn.base.clone", "numpy.unique", "numpy.nanmean" ]
[((4141, 4158), 'sklearn.base.clone', 'clone', (['self.model'], {}), '(self.model)\n', (4146, 4158), False, 'from sklearn.base import BaseEstimator, clone, is_classifier\n'), ((5490, 5514), 'sklearn.base.is_classifier', 'is_classifier', (['estimator'], {}), '(estimator)\n', (5503, 5514), False, 'from sklearn.base impor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 25 13:04:43 2021 Three-state two-mode linear vibronic model of pyrazine (S0/S1/S2) @author: bing """ import numpy as np import numba from scipy.sparse import identity, coo_matrix, lil_matrix, csr_matrix, kron import sys # sys.path.append(r'C:\Us...
[ "mayavi.mlab.figure", "scipy.sparse.kron", "numpy.diagflat", "matplotlib.pyplot.figure", "numpy.meshgrid", "lime.style.set_style", "mayavi.mlab.axes", "mayavi.mlab.surf", "lime.phys.boson", "scipy.sparse.identity", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "...
[((603, 627), 'numpy.zeros', 'np.zeros', (['(n_vib, n_vib)'], {}), '((n_vib, n_vib))\n', (611, 627), True, 'import numpy as np\n'), ((1347, 1361), 'scipy.sparse.identity', 'identity', (['n_el'], {}), '(n_el)\n', (1355, 1361), False, 'from scipy.sparse import identity, coo_matrix, lil_matrix, csr_matrix, kron\n'), ((139...
import pandas as pd import numpy as np import re import os from pandas import json_normalize import json from alive_progress import alive_bar class PrepareNSMCLogs: def __init__(self, config): self.raw_logs_dir = config.raw_logs_dir self.prepared_logs_dir = config.prepared_logs_dir self.fi...
[ "json.loads", "pandas.read_csv", "pandas.json_normalize", "numpy.savetxt", "re.match", "pandas.isnull", "os.path.join", "pandas.concat", "re.sub", "re.compile" ]
[((419, 477), 're.compile', 're.compile', (['"""^(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2})"""'], {}), "('^(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2})')\n", (429, 477), False, 'import re\n'), ((940, 954), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (949, 954), True, 'import pandas a...
import re, string import numpy as np import pandas as pd import pickle from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score, precision_score, recall_score, f1...
[ "pickle.dump", "numpy.log", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "sklearn.metrics.recall_score", "sklearn.linear_model.LogisticRegression", "sklearn.metrics.f1_score", "sklearn.metrics.precision_score", "re.compile" ]
[((341, 398), 're.compile', 're.compile', (['f"""([{string.punctuation}“”¨«»®´·º½¾¿¡§£₤‘’])"""'], {}), "(f'([{string.punctuation}“”¨«»®´·º½¾¿¡§£₤‘’])')\n", (351, 398), False, 'import re, string\n'), ((2285, 2339), 'pandas.read_csv', 'pd.read_csv', (['"""../datasets/Kaggle_Toxic/data/train.csv"""'], {}), "('../datasets/...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 31 10:11:15 2018 @author: nsde """ #%% from dlmnn.helper.neighbor_funcs import findTargetNeighbours, knnClassifier from dlmnn.helper.tf_funcs import tf_makePairwiseFunc, tf_findImposters from dlmnn.helper.tf_funcs import tf_LMNN_loss, tf_featureExt...
[ "tensorflow.reduce_sum", "tensorflow.get_collection", "dlmnn.helper.tf_funcs.tf_LMNN_loss", "numpy.argsort", "tensorflow.Variable", "numpy.mean", "numpy.unique", "tensorflow.less", "os.path.exists", "tensorflow.placeholder", "dlmnn.helper.tf_funcs.tf_findImposters", "tensorflow.summary.FileWri...
[((1007, 1019), 'tensorflow.python.keras.Sequential', 'Sequential', ([], {}), '()\n', (1017, 1019), False, 'from tensorflow.python.keras import Sequential\n'), ((1990, 2021), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'trainable': '(False)'}), '(0, trainable=False)\n', (2001, 2021), True, 'import tensorflow as tf...
import os from scipy.stats import truncnorm os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "-1" import cv2 from skimage import transform import numpy as np import matplotlib.pyplot as plt import loadModel import tensorflow as tf import math import OpenEXR import Imath import exr2p...
[ "scipy.stats.truncnorm", "numpy.ones", "numpy.random.randint", "skimage.transform.resize", "numpy.exp", "tensorflow.stack", "cv2.split", "numpy.reshape", "math.log", "Imath.PixelType", "math.sqrt", "tensorflow.constant", "cv2.merge", "os.listdir", "numpy.random.uniform", "OpenEXR.Input...
[((446, 466), 'cv2.imread', 'cv2.imread', (['maskPath'], {}), '(maskPath)\n', (456, 466), False, 'import cv2\n'), ((484, 522), 'skimage.transform.resize', 'transform.resize', (['maskImage', '(64, 128)'], {}), '(maskImage, (64, 128))\n', (500, 522), False, 'from skimage import transform, data\n'), ((702, 716), 'cv2.spli...
''' /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2018, STEREOLABS. // // All rights reserved. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRA...
[ "numpy.load", "argparse.ArgumentParser", "cv2.bitwise_and", "cv2.stereoRectify", "cv2.remap", "reachy.parts.LeftArm", "os.path.isfile", "cv2.rectangle", "cv2.imshow", "numpy.round", "reachy.trajectory.player.TrajectoryPlayer", "websocket.WebSocketApp", "cv2.line", "json.loads", "math.rad...
[((10556, 10586), 'numpy.load', 'np.load', (["(hold_button + '1.npz')"], {}), "(hold_button + '1.npz')\n", (10563, 10586), True, 'import numpy as np\n'), ((10611, 10657), 'reachy.trajectory.player.TrajectoryPlayer', 'TrajectoryPlayer', (['reachy', 'my_loaded_trajectory'], {}), '(reachy, my_loaded_trajectory)\n', (10627...
"""Testing things.""" import os import shutil import uuid import difflib import importlib import contextlib import warnings import unittest import numpy as np import pandas as pd import threading import psutil import copy import pprint from yggdrasil.config import ygg_cfg, cfg_logging from yggdrasil import tools, backw...
[ "threading.active_count", "pprint.pformat", "difflib.Differ", "yggdrasil.communication.DefaultComm.DefaultComm._reset_alias", "yggdrasil.units.has_units", "os.path.isfile", "yggdrasil.tools.check_environ_bool", "unittest.util.safe_repr", "os.path.join", "unittest.skipIf", "warnings.simplefilter"...
[((2237, 2286), 'yggdrasil.tools.check_environ_bool', 'tools.check_environ_bool', (['"""YGG_ENABLE_LONG_TESTS"""'], {}), "('YGG_ENABLE_LONG_TESTS')\n", (2261, 2286), False, 'from yggdrasil import tools, backwards, platform, units\n'), ((2309, 2360), 'yggdrasil.tools.check_environ_bool', 'tools.check_environ_bool', (['"...
import pybullet as p import os from Buggy_cloth_contact.helper import create_spheres, get_quaternion import numpy as np width = height = 720 hz = 480 gravity = 9.8 simulation_steps = 1000 contact_visual_sphere_num = 500 # basic pybullet initialization p_id = p.connect(p.GUI, options='--background_color_red=0.8 -...
[ "pybullet.loadSoftBody", "pybullet.resetSimulation", "pybullet.resetDebugVisualizerCamera", "numpy.linalg.norm", "pybullet.connect", "pybullet.setRealTimeSimulation", "pybullet.setGravity", "pybullet.getSoftBodyData", "pybullet.setTimeStep", "pybullet.resetBasePositionAndOrientation", "Buggy_clo...
[((261, 423), 'pybullet.connect', 'p.connect', (['p.GUI'], {'options': "('--background_color_red=0.8 --background_color_green=0.9 --background_color_blue=1.0 --width=%d --height=%d'\n % (width, height))"}), "(p.GUI, options=\n '--background_color_red=0.8 --background_color_green=0.9 --background_color_blue=1.0 -...