code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
class Metric:
"""
"""
def __init__(self, name):
"""
"""
self.name = name
def __repr__(self):
return self.name
def _check_inputs(self, trues, preds, true_rels):
""" validate inputs and convert to ndarray
TODO: right now it's just... | [
"numpy.array"
] | [((707, 718), 'numpy.array', 'np.array', (['t'], {}), '(t)\n', (715, 718), True, 'import numpy as np\n'), ((749, 760), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (757, 760), True, 'import numpy as np\n'), ((622, 635), 'numpy.array', 'np.array', (['rel'], {}), '(rel)\n', (630, 635), True, 'import numpy as np\n')] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 5 09:54:29 2018
@author: akiranagamori
"""
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy import signal
default_path = '/Users/akiranagamori/Documents/GitHub/python-code/';
save_path = '/Users/akiranagamori/Documents/G... | [
"numpy.load",
"matplotlib.pyplot.plot",
"numpy.std",
"matplotlib.pyplot.figure",
"numpy.mean",
"os.chdir"
] | [((356, 375), 'os.chdir', 'os.chdir', (['save_path'], {}), '(save_path)\n', (364, 375), False, 'import os\n'), ((419, 441), 'os.chdir', 'os.chdir', (['default_path'], {}), '(default_path)\n', (427, 441), False, 'import os\n'), ((466, 506), 'numpy.mean', 'np.mean', (["output['Muscle Force'][4 * Fs:]"], {}), "(output['Mu... |
"""
SIW Data loader, as given in Mnist tutorial
"""
import json
import imageio as io
import matplotlib.pyplot as plt
import torch
import torchvision.utils as v_utils
from torchvision import datasets, transforms
import os
import numpy as np
import random
from torch.utils.data import DataLoader, TensorDataset, Dataset
... | [
"matplotlib.pyplot.show",
"os.path.join",
"imgaug.augmenters.GammaContrast",
"matplotlib.pyplot.imshow",
"random.choices",
"numpy.zeros",
"torchvision.transforms.ToTensor",
"cv2.imread",
"matplotlib.pyplot.figure",
"os.path.splitext",
"imgaug.augmenters.Add",
"torchvision.transforms.Grayscale"... | [((790, 809), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (803, 809), False, 'import os\n'), ((892, 914), 'os.path.splitext', 'os.path.splitext', (['path'], {}), '(path)\n', (908, 914), False, 'import os\n'), ((1828, 1840), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1838, 1840), True... |
from .base import QA
import glob
import os
import collections
import numpy as np
import fitsio
from astropy.table import Table
import desiutil.log
from desispec.qproc.io import read_qframe
from desispec.io import read_fiberflat
from desispec.calibfinder import CalibFinder
class QAFiberflat(QA):
"""docstring """... | [
"desispec.calibfinder.CalibFinder",
"numpy.median",
"desispec.qproc.io.read_qframe",
"collections.OrderedDict",
"os.path.join"
] | [((636, 672), 'os.path.join', 'os.path.join', (['indir', '"""qframe-*.fits"""'], {}), "(indir, 'qframe-*.fits')\n", (648, 672), False, 'import os\n'), ((843, 864), 'desispec.qproc.io.read_qframe', 'read_qframe', (['filename'], {}), '(filename)\n', (854, 864), False, 'from desispec.qproc.io import read_qframe\n'), ((149... |
'''
The contents of this file are focused on the plotting of the Data structure
in various projections and formats
These functions do this in whatever matplotlib instance you've got going on,
unless you toggle <show>
e.g. consider that below each function, I've added
#show: if True, opens a window and shows the pl... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.hist2d",
"matplotlib.pyplot.arrow",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1029, 1091), 'matplotlib.pyplot.scatter', 'plt.scatter', (['t[x]', 't[y]'], {'s': 's', 'c': 'color', 'marker': 'marker'}), '(t[x], t[y], s=s, c=color, marker=marker, **kwargs)\n', (1040, 1091), True, 'import matplotlib.pyplot as plt\n'), ((2860, 2915), 'matplotlib.pyplot.hist', 'plt.hist', (['t[x]', '*args'], {'rang... |
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
from six.moves import xrange
import tensorflow as tf
import tensorflow.contrib.slim as slim
pp = pprint... | [
"os.mkdir",
"tensorflow.trainable_variables",
"tensorflow.ConfigProto",
"numpy.arange",
"numpy.tile",
"glob.glob",
"tensorflow.GPUOptions",
"os.path.join",
"random.randint",
"numpy.random.choice",
"tensorflow.GraphDef",
"math.ceil",
"shutil.copy2",
"tensorflow.Session",
"moviepy.editor.V... | [((314, 336), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (334, 336), False, 'import pprint\n'), ((452, 476), 'tensorflow.trainable_variables', 'tf.trainable_variables', ([], {}), '()\n', (474, 476), True, 'import tensorflow as tf\n'), ((479, 540), 'tensorflow.contrib.slim.model_analyzer.analyze_v... |
import gym
import numpy as np
from models import ActorNetwork,CriticNetwork
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
from torch.distributions.normal import Normal
class learner():
def __init__(
self,
scenario,
seed=1... | [
"torch.dot",
"gym.make",
"numpy.random.randn",
"torch.sqrt",
"torch.autograd.Variable",
"torch.distributions.normal.Normal",
"models.ActorNetwork",
"torch.exp",
"torch.Tensor",
"torch.cuda.is_available",
"numpy.arange",
"numpy.random.choice",
"models.CriticNetwork",
"torch.no_grad",
"tor... | [((7754, 7778), 'numpy.random.randn', 'np.random.randn', (['horizon'], {}), '(horizon)\n', (7769, 7778), True, 'import numpy as np\n'), ((664, 682), 'gym.make', 'gym.make', (['scenario'], {}), '(scenario)\n', (672, 682), False, 'import gym\n'), ((1190, 1276), 'models.ActorNetwork', 'ActorNetwork', (['self.env.observati... |
import sep
import numpy as np
from astropy.io import fits
from scipy.stats import iqr
from sfft.utils.pyAstroMatic.PYSEx import PY_SEx
__author__ = "<NAME> <<EMAIL>>"
__version__ = "v1.0"
class SEx_SkySubtract:
@staticmethod
def SSS(FITS_obj, FITS_skysub=None, GAIN_KEY='GAIN', SATUR_KEY='SATURATE', ESATUR_KEY... | [
"scipy.stats.iqr",
"astropy.io.fits.getdata",
"sfft.utils.pyAstroMatic.PYSEx.PY_SEx.PS",
"numpy.percentile",
"sep.Background",
"astropy.io.fits.open",
"numpy.ascontiguousarray"
] | [((1573, 1600), 'numpy.percentile', 'np.percentile', (['PixA_sky', '(25)'], {}), '(PixA_sky, 25)\n', (1586, 1600), True, 'import numpy as np\n'), ((1614, 1641), 'numpy.percentile', 'np.percentile', (['PixA_sky', '(55)'], {}), '(PixA_sky, 55)\n', (1627, 1641), True, 'import numpy as np\n'), ((1656, 1669), 'scipy.stats.i... |
"""Defines abstract base classes for classifiers and regressors."""
import abc
import numbers
import numpy as np
from .fit import Fittable
from ..utils import validate_samples
from ..utils import validate_int
class Predictor(Fittable, metaclass=abc.ABCMeta):
"""Abstract base class for both classifiers and regr... | [
"numpy.unique",
"numpy.argmax"
] | [((1479, 1512), 'numpy.unique', 'np.unique', (['y'], {'return_inverse': '(True)'}), '(y, return_inverse=True)\n', (1488, 1512), True, 'import numpy as np\n'), ((2503, 2523), 'numpy.argmax', 'np.argmax', (['p'], {'axis': '(1)'}), '(p, axis=1)\n', (2512, 2523), True, 'import numpy as np\n')] |
import os.path as osp
import re
import cv2
import torch
import numpy as np
from PIL import Image
from scipy import interpolate
from torch import from_numpy
# the header of writeFlow()
TAG_CHAR = np.array([202021.25], np.float32)
def make_colorwheel():
"""
Generates a color wheel for optical flow visualizatio... | [
"numpy.load",
"numpy.arctan2",
"numpy.floor",
"numpy.ones",
"numpy.clip",
"numpy.arange",
"numpy.power",
"cv2.imwrite",
"numpy.reshape",
"numpy.stack",
"scipy.interpolate.griddata",
"torch.where",
"numpy.square",
"numpy.flipud",
"numpy.concatenate",
"torch.from_numpy",
"numpy.fromfil... | [((196, 229), 'numpy.array', 'np.array', (['[202021.25]', 'np.float32'], {}), '([202021.25], np.float32)\n', (204, 229), True, 'import numpy as np\n'), ((804, 824), 'numpy.zeros', 'np.zeros', (['(ncols, 3)'], {}), '((ncols, 3))\n', (812, 824), True, 'import numpy as np\n'), ((2235, 2282), 'numpy.zeros', 'np.zeros', (['... |
from pyrfuniverse.envs import RFUniverseGymWrapper
import numpy as np
from gym import spaces
from gym.utils import seeding
class BalanceBallEnv(RFUniverseGymWrapper):
metadata = {'render.modes': ['human']}
def __init__(self, executable_file=None):
super().__init__(
executable_file,
... | [
"numpy.array",
"gym.spaces.Box",
"numpy.random.rand",
"numpy.concatenate",
"gym.utils.seeding.np_random"
] | [((500, 560), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-2.0)', 'high': '(2.0)', 'shape': '(2,)', 'dtype': 'np.float32'}), '(low=-2.0, high=2.0, shape=(2,), dtype=np.float32)\n', (510, 560), False, 'from gym import spaces\n'), ((2340, 2390), 'numpy.array', 'np.array', (['[cube_quaternion[0], cube_quaternion[2]]'],... |
import os
from collections import Counter
import numpy as np
def flow_from_directory(data_generator, path, size, shuffle=True):
return data_generator.flow_from_directory(
path,
target_size=(size, size),
batch_size=32,
class_mode="categorical",
shuffle=shuffle,
seed=42)
def get_classes_to_sizes(path):
cl... | [
"collections.Counter",
"os.walk",
"numpy.argmax",
"os.path.basename"
] | [((369, 382), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (376, 382), False, 'import os\n'), ((795, 821), 'collections.Counter', 'Counter', (['generator.classes'], {}), '(generator.classes)\n', (802, 821), False, 'from collections import Counter\n'), ((478, 500), 'os.path.basename', 'os.path.basename', (['root'],... |
'''
Copyright 2017 <NAME>, <NAME>, <NAME> and the Max Planck Gesellschaft. All rights reserved.
This software is provided for research purposes only.
By using this software you agree to the terms of the MANO/SMPL+H Model license here http://mano.is.tue.mpg.de/license
More information about MANO/SMPL+H is available at... | [
"chumpy.eye",
"cv2.Rodrigues",
"numpy.array",
"numpy.eye"
] | [((792, 816), 'cv2.Rodrigues', 'cv2.Rodrigues', (['self.rt.r'], {}), '(self.rt.r)\n', (805, 816), False, 'import cv2\n'), ((902, 926), 'cv2.Rodrigues', 'cv2.Rodrigues', (['self.rt.r'], {}), '(self.rt.r)\n', (915, 926), False, 'import cv2\n'), ((1287, 1296), 'chumpy.eye', 'ch.eye', (['(3)'], {}), '(3)\n', (1293, 1296), ... |
import numpy as np
import cv2
from skimage.feature import hog
from scipy.ndimage.measurements import label
# Define a function to return HOG features and visualization
def get_hog_features(img, orient, pix_per_cell, cell_per_block,
vis=False, feature_vec=True):
# Call with two outputs if v... | [
"cv2.resize",
"numpy.copy",
"scipy.ndimage.measurements.label",
"skimage.feature.hog",
"numpy.histogram",
"numpy.min",
"numpy.array",
"numpy.max",
"cv2.rectangle",
"numpy.concatenate"
] | [((1593, 1649), 'numpy.histogram', 'np.histogram', (['img[:, :, 0]'], {'bins': 'nbins', 'range': 'bins_range'}), '(img[:, :, 0], bins=nbins, range=bins_range)\n', (1605, 1649), True, 'import numpy as np\n'), ((1668, 1724), 'numpy.histogram', 'np.histogram', (['img[:, :, 1]'], {'bins': 'nbins', 'range': 'bins_range'}), ... |
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Renders mesh using OpenDr / Pytorch-3d for visualization.
Part of code is modified from https://github.com/akanazawa/hmr
"""
import sys
import numpy as np
import cv2
import pdb
from PIL import Image, ImageDraw
from opendr.camera import ProjectPoints
from opendr.r... | [
"numpy.radians",
"opendr.camera.ProjectPoints",
"numpy.ones_like",
"opendr.renderer.ColoredRenderer",
"numpy.zeros",
"numpy.ones",
"numpy.all",
"numpy.min",
"cv2.split",
"numpy.array",
"numpy.sin",
"numpy.cos",
"numpy.max",
"numpy.dot",
"cv2.merge",
"numpy.issubdtype"
] | [((2664, 2675), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (2672, 2675), True, 'import numpy as np\n'), ((2700, 2711), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (2708, 2711), True, 'import numpy as np\n'), ((3012, 3029), 'opendr.renderer.ColoredRenderer', 'ColoredRenderer', ([], {}), '()\n', (3027, 302... |
import pickle
import os.path
import numpy as np
from keras.layers.embeddings import Embedding
from keras.models import Sequential, load_model
from sklearn.metrics import f1_score, accuracy_score
from keras.layers import LSTM, Dense, TimeDistributed, Bidirectional, Dropout
import warnings
warnings.filterwarnings('ignore... | [
"keras.models.load_model",
"keras.layers.embeddings.Embedding",
"numpy.eye",
"warnings.filterwarnings",
"keras.layers.Dropout",
"keras.layers.LSTM",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.f1_score",
"keras.layers.Dense",
"keras.models.Sequential"
] | [((289, 322), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (312, 322), False, 'import warnings\n'), ((992, 1004), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1002, 1004), False, 'from keras.models import Sequential, load_model\n'), ((1019, 1061), 'keras.l... |
#!/usr/bin/env python3
"""
Implements some graphical transforms for images.
"""
import random
from typing import Tuple
import cv2
import numpy as np
def size_from_string(size: str) -> Tuple[int, int]:
msg = None
try:
new_size = tuple(map(int, size.strip().split(",")))
assert len(new_size) =... | [
"cv2.cvtColor",
"random.choice",
"numpy.clip",
"cv2.getGaussianKernel",
"numpy.ones",
"random.random",
"numpy.random.random",
"numpy.linspace"
] | [((1057, 1098), 'numpy.clip', 'np.clip', (['float_img', '(0)', '(255)'], {'out': 'float_img'}), '(float_img, 0, 255, out=float_img)\n', (1064, 1098), True, 'import numpy as np\n'), ((1209, 1246), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (1221, 1246), False, 'im... |
#! /usr/bin/python
import os
import sys
import json
import luigi
import numpy as np
import nifty.tools as nt
import cluster_tools.utils.volume_utils as vu
import cluster_tools.utils.function_utils as fu
from cluster_tools.cluster_tasks import SlurmTask, LocalTask, LSFTask
from cluster_tools.utils.task_utils import D... | [
"cluster_tools.utils.volume_utils.file_reader",
"cluster_tools.cluster_tasks.LocalTask.default_task_config",
"numpy.mean",
"cluster_tools.utils.task_utils.DummyTask",
"cluster_tools.utils.volume_utils.apply_filter",
"cluster_tools.utils.volume_utils.normalize",
"luigi.Parameter",
"os.path.abspath",
... | [((445, 470), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (460, 470), False, 'import os\n'), ((513, 530), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (528, 530), False, 'import luigi\n'), ((547, 564), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (562, 564), False, 'i... |
import numpy as np
class BaselineRegressor:
def __init__(self):
pass
def fit(self, x_train, y_train):
pass
def predict(self, x_test):
return np.zeros([x_test.shape[0]])
| [
"numpy.zeros"
] | [((180, 207), 'numpy.zeros', 'np.zeros', (['[x_test.shape[0]]'], {}), '([x_test.shape[0]])\n', (188, 207), True, 'import numpy as np\n')] |
import numpy as np
from flatland.envs.malfunction_generators import malfunction_from_params
from flatland.envs.observations import GlobalObsForRailEnv, TreeObsForRailEnv
from flatland.envs.predictions import ShortestPathPredictorForRailEnv
from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators i... | [
"flatland.envs.predictions.ShortestPathPredictorForRailEnv",
"flatland.envs.schedule_generators.random_schedule_generator",
"flatland.envs.observations.GlobalObsForRailEnv",
"numpy.random.randint",
"flatland.utils.simple_rail.make_simple_rail2",
"flatland.envs.rail_generators.rail_from_grid_transition_map... | [((586, 605), 'flatland.utils.simple_rail.make_simple_rail2', 'make_simple_rail2', ([], {}), '()\n', (603, 605), False, 'from flatland.utils.simple_rail import make_simple_rail2\n'), ((2126, 2145), 'flatland.utils.simple_rail.make_simple_rail2', 'make_simple_rail2', ([], {}), '()\n', (2143, 2145), False, 'from flatland... |
import numpy as np
import random
from scipy import stats
from scipy.signal import boxcar,convolve,correlate,resample,argrelextrema
from scipy.cluster.vq import kmeans,kmeans2
from scipy.stats import pearsonr
from neuropixels import cleanAxes
from neuropixels import psth_and_raster as psth_
def smooth_boxcar(data,boxca... | [
"numpy.abs",
"numpy.sum",
"numpy.empty",
"numpy.floor",
"numpy.isnan",
"numpy.shape",
"numpy.mean",
"numpy.linalg.norm",
"numpy.inner",
"numpy.unique",
"numpy.nanmean",
"random.expovariate",
"numpy.std",
"neuropixels.psth_and_raster.raster",
"numpy.cumsum",
"numpy.max",
"numpy.median... | [((529, 554), 'numpy.cumsum', 'np.cumsum', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (538, 554), True, 'import numpy as np\n'), ((3096, 3121), 'numpy.array', 'np.array', (['event_precision'], {}), '(event_precision)\n', (3104, 3121), True, 'import numpy as np\n'), ((3369, 3467), 'neuropixels.psth_and_raster.ra... |
import math
import numpy as np
from matplotlib import pyplot as plt
from rlkit.visualization import visualization_util as vu
class Dynamics(object):
def __init__(self, projection, noise):
self.projection = projection
self.noise = noise
def __call__(self, samples):
new_samples = sampl... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplot",
"numpy.maximum",
"rlkit.visualization.visualization_util.save_image",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.random.randn",
"numpy.log",
"numpy.errstate",
"matplotlib.pyplot.figure",
"numpy.ar... | [((679, 691), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (689, 691), True, 'from matplotlib import pyplot as plt\n'), ((870, 879), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (877, 879), True, 'from matplotlib import pyplot as plt\n'), ((890, 908), 'rlkit.visualization.visualization_util.save... |
import textwrap
import numpy as np
from phonopy.phonon.group_velocity import GroupVelocity
from phonopy.harmonic.force_constants import similarity_transformation
from phonopy.phonon.thermal_properties import mode_cv as get_mode_cv
from phonopy.units import THzToEv, EV, THz, Angstrom
from phono3py.file_IO import write_p... | [
"numpy.outer",
"textwrap.fill",
"numpy.eye",
"phono3py.phonon3.triplets.from_coarse_to_dense_grid_points",
"numpy.zeros",
"numpy.unique",
"phonopy.phonon.group_velocity.GroupVelocity",
"phonopy.harmonic.force_constants.similarity_transformation",
"phono3py.phonon3.triplets.get_grid_points_by_rotatio... | [((1679, 1735), 'phono3py.phonon3.triplets.get_all_triplets', 'get_all_triplets', (['grid_point', 'grid_address', 'bz_map', 'mesh'], {}), '(grid_point, grid_address, bz_map, mesh)\n', (1695, 1735), False, 'from phono3py.phonon3.triplets import get_grid_address, reduce_grid_points, get_ir_grid_points, from_coarse_to_den... |
import os, json, glob
import torch
import numpy as np
import src.params as params
import argparse, pdb
from src.model import get_model_or_checkpoint
from scipy.io import wavfile
from collections import defaultdict
from src.dataloader import AudioFileWindower
from pathlib import Path
WAV_SR = 44100
# WAV_SR = params.... | [
"json.dump",
"os.makedirs",
"argparse.ArgumentParser",
"torch.argmax",
"src.dataloader.AudioFileWindower",
"pathlib.Path",
"src.model.get_model_or_checkpoint",
"pdb.set_trace",
"glob.glob",
"numpy.concatenate",
"torch.from_numpy"
] | [((652, 672), 'pathlib.Path', 'Path', (['args.modelPath'], {}), '(args.modelPath)\n', (656, 672), False, 'from pathlib import Path\n'), ((778, 837), 'src.dataloader.AudioFileWindower', 'AudioFileWindower', (['wav_file_paths'], {'mean': 'mean', 'invstd': 'invstd'}), '(wav_file_paths, mean=mean, invstd=invstd)\n', (795, ... |
"""
Benchmarks for the various ways of iterating over the values of an array.
"""
import numpy as np
# This choice of dtype is intentional. It seems to allow better
# vectorization with LLVM 3.7 than either float32 or float64 (at least here
# on SandyBridge), and therefore helps reveal iterator inefficiences.
dtype... | [
"numpy.ndindex",
"numpy.nditer",
"numpy.zeros",
"numba.jit",
"numpy.concatenate"
] | [((365, 393), 'numpy.zeros', 'np.zeros', (['(N * N)'], {'dtype': 'dtype'}), '(N * N, dtype=dtype)\n', (373, 393), True, 'import numpy as np\n'), ((447, 477), 'numpy.concatenate', 'np.concatenate', (['(arr2c, arr2c)'], {}), '((arr2c, arr2c))\n', (461, 477), True, 'import numpy as np\n'), ((602, 634), 'numpy.concatenate'... |
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import os
import cv2
ed = 21
im_train = np.load(os.path.join('..','Data','Classification','im_train.npy'))
im_test = np.load(os.path.join('..','Data','Classification','im_test.npy'))
label_train = np.load(os.path.join('..','Data','Classification'... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.nansum",
"pylab.ion",
"numpy.sum",
"numpy.argmax",
"numpy.zeros",
"numpy.sqrt",
"numpy.ones",
"cv2.fitEllipse",
"numpy.array",
"numpy.round",
"cv2.boundingRect",
"os.path.join",
"pylab.plot",
"cv2.findContours",
"numpy.nanmean"
] | [((459, 501), 'numpy.zeros', 'np.zeros', (['(label_train.shape[0], Nfeature)'], {}), '((label_train.shape[0], Nfeature))\n', (467, 501), True, 'import numpy as np\n'), ((1823, 1909), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': '(1000)', 'max_depth': '(10)', 'random_state':... |
#!/usr/bin/env python
import argparse
import matplotlib.pyplot as plt
import nice
import numpy as np
import torch
import torchvision as tv
import utils
from torch.autograd import Variable
kMNISTInputDim = 784
kMNISTInputSize = 28
kMNISTNumExamples = 100
def ShowImagesInGrid(data, rows, cols, save_path="original_im... | [
"utils.prepare_data",
"argparse.ArgumentParser",
"numpy.ones",
"matplotlib.pyplot.figure",
"torch.device",
"numpy.float64",
"numpy.multiply",
"matplotlib.pyplot.imshow",
"torch.load",
"torch.Tensor",
"numpy.reshape",
"utils.StandardLogistic",
"numpy.random.binomial",
"torch.autograd.Variab... | [((336, 351), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')\n", (344, 351), True, 'import matplotlib.pyplot as plt\n'), ((362, 394), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(rows, cols)'}), '(figsize=(rows, cols))\n', (372, 394), True, 'import matplotlib.pyplot as plt\n'), ((73... |
#!/usr/bin/env python
#file parse.py: parsers for map file, distance matrix file, env file
__author__ = "<NAME>"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["<NAME>", "<NAME>", "<NAME>",
"<NAME>", "<NAME>", "<NAME>"]
__license__ = "BSD"
__version__ = "1.7.0-dev"
__maintainer__ = ... | [
"numpy.asarray"
] | [((8666, 8684), 'numpy.asarray', 'asarray', (['otu_table'], {}), '(otu_table)\n', (8673, 8684), False, 'from numpy import asarray\n'), ((10750, 10765), 'numpy.asarray', 'asarray', (['result'], {}), '(result)\n', (10757, 10765), False, 'from numpy import asarray\n'), ((7263, 7303), 'numpy.asarray', 'asarray', (['fields[... |
#
# Copyright (C) 2000-2008 <NAME>
#
""" Contains the class _NetNode_ which is used to represent nodes in neural nets
**Network Architecture:**
A tacit assumption in all of this stuff is that we're dealing with
feedforward networks.
The network itself is stored as a list of _NetNode_ objects. The list
is ... | [
"numpy.take",
"numpy.array"
] | [((2764, 2784), 'numpy.array', 'numpy.array', (['weights'], {}), '(weights)\n', (2775, 2784), False, 'import numpy\n'), ((1391, 1427), 'numpy.take', 'numpy.take', (['valVect', 'self.inputNodes'], {}), '(valVect, self.inputNodes)\n', (1401, 1427), False, 'import numpy\n'), ((3842, 3862), 'numpy.array', 'numpy.array', ([... |
#!/usr/bin/env python
#===============================================================================
# Copyright 2017 Geoscience Australia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | [
"numpy.isin",
"numpy.power",
"garjmcmctdem_utils.spatial_functions.nearest_neighbours",
"numpy.float",
"numpy.ones",
"garjmcmctdem_utils.misc_utils.pickle2xarray",
"numpy.argsort",
"numpy.where",
"numpy.arange",
"numpy.array",
"numpy.linspace"
] | [((2936, 2981), 'numpy.float', 'np.float', (["rj_dat['easting'][point_index].data"], {}), "(rj_dat['easting'][point_index].data)\n", (2944, 2981), True, 'import numpy as np\n'), ((2997, 3043), 'numpy.float', 'np.float', (["rj_dat['northing'][point_index].data"], {}), "(rj_dat['northing'][point_index].data)\n", (3005, 3... |
from numpy import sqrt, exp, pi, power, tanh, vectorize
# time constants for model: Postnova et al. 2018 - Table 1
tau_v = 50.0 #s
tau_m = tau_v
tau_H = 59.0*3600.0 #s
tau_X = (24.0*3600.0) / (2.0*pi) #s
tau_Y = tau_X
tau_C = 24.2*3600.0 #s
tau_A = 1.5*3600.0 #s # 1.5 hours # Tekieh et al. 2020 - Section 2.3.2, after... | [
"numpy.vectorize",
"numpy.tanh",
"numpy.power",
"numpy.exp",
"numpy.sqrt"
] | [((1333, 1355), 'numpy.vectorize', 'vectorize', (['wake_effort'], {}), '(wake_effort)\n', (1342, 1355), False, 'from numpy import sqrt, exp, pi, power, tanh, vectorize\n'), ((1767, 1795), 'numpy.vectorize', 'vectorize', (['total_sleep_drive'], {}), '(total_sleep_drive)\n', (1776, 1795), False, 'from numpy import sqrt, ... |
#!/usr/bin/env python2
#
# This files can be used to benchmark different classifiers
# on lfw dataset with known and unknown dataset.
# More info at: https://github.com/cmusatyalab/openface/issues/144
# <NAME> & <NAME>
# 2016/06/28
#
# Copyright 2015-2016 Carnegie Mellon University
#
# Licensed under the Apache License... | [
"openface.TorchNeuralNet",
"pickle.dump",
"argparse.ArgumentParser",
"numpy.argmax",
"pandas.read_csv",
"sklearn.tree.DecisionTreeClassifier",
"pickle.load",
"numpy.linalg.norm",
"sklearn.svm.SVC",
"os.path.join",
"shutil.copy",
"sys.path.append",
"numpy.set_printoptions",
"cv2.cvtColor",
... | [((850, 861), 'time.time', 'time.time', ([], {}), '()\n', (859, 861), False, 'import time\n'), ((1041, 1073), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (1060, 1073), True, 'import numpy as np\n'), ((1494, 1531), 'os.path.join', 'os.path.join', (['fileDir', '""".."""... |
'''
Created on Aug 8, 2014
@author: <EMAIL>
'''
import numpy as np
import logging
class F(object):
"""Product function."""
def __init__(self, combo):
self.combo = combo
def __call__(self, *args):
out = 1
for g, arg in zip(self.combo, args):
if isinstance(g, Basis):
... | [
"numpy.size",
"numpy.sum",
"numpy.linalg.lstsq",
"numpy.empty",
"numpy.square",
"numpy.zeros",
"numpy.mean",
"numpy.array",
"itertools.product",
"numpy.dot",
"logging.getLogger"
] | [((4312, 4346), 'numpy.empty', 'np.empty', (['(maxOrd + 1, maxOrd + 1)'], {}), '((maxOrd + 1, maxOrd + 1))\n', (4320, 4346), True, 'import numpy as np\n'), ((4355, 4365), 'numpy.mean', 'np.mean', (['X'], {}), '(X)\n', (4362, 4365), True, 'import numpy as np\n'), ((4374, 4384), 'numpy.size', 'np.size', (['X'], {}), '(X)... |
import numpy as np
from matplotlib import pyplot
def plotData(X, y, grid=False):
"""
Plots the data points X and y into a new figure. Uses `+` for positive examples, and `o` for
negative examples. `X` is assumed to be a Mx2 matrix
Parameters
----------
X : numpy ndarray
X is assumed t... | [
"numpy.stack",
"numpy.meshgrid",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.pcolormesh",
"matplotlib.pyplot.grid"
] | [((705, 766), 'matplotlib.pyplot.plot', 'pyplot.plot', (['X[pos, 0]', 'X[pos, 1]', '"""X"""'], {'mew': '(1)', 'ms': '(10)', 'mec': '"""k"""'}), "(X[pos, 0], X[pos, 1], 'X', mew=1, ms=10, mec='k')\n", (716, 766), False, 'from matplotlib import pyplot\n'), ((771, 841), 'matplotlib.pyplot.plot', 'pyplot.plot', (['X[neg, 0... |
import numpy as np
import argparse, sys, os, time
import progressbar
import tensorflow as tf
if int(tf.__version__.split('.')[1]) >= 14:
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from keras.metrics import categorical_accuracy
import keras.backend as K
from datasets import UT, SBU, NTU
fr... | [
"misc.utils.read_config",
"models.temporal_rn.get_fusion_model",
"numpy.argmax",
"tensorflow.__version__.split",
"models.temporal_rn.get_model",
"datasets.data_generator.DataGeneratorSeq",
"time.time",
"numpy.array",
"tensorflow.compat.v1.logging.set_verbosity"
] | [((142, 204), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (176, 204), True, 'import tensorflow as tf\n'), ((989, 1004), 'numpy.array', 'np.array', (['Y_val'], {}), '(Y_val)\n', (997, 1004), True, 'import nump... |
import matplotlib.pyplot as plt
from matplotlib import patches
import numpy as np
import copy
from mpmath import mpf
from .circle_intersection import Geometry
from .errors import PrecisionError
from .utils import (
mobius,
upper_to_disc,
complex_to_vector,
get_arc
)
class HyperbolicPlane:
def __i... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"mpmath.mpf",
"numpy.array",
"matplotlib.pyplot.Circle",
"numpy.linalg.norm",
"numpy.dot"
] | [((11193, 11203), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (11201, 11203), True, 'import matplotlib.pyplot as plt\n'), ((1124, 1143), 'matplotlib.pyplot.figure', 'plt.figure', (['fig_num'], {}), '(fig_num)\n', (1134, 1143), True, 'import matplotlib.pyplot as plt\n'), ((1425, 1448), 'matplotlib.pyplot.axi... |
import torch.utils.data as data
import numpy as np
import glob
import h5py
import pickle as pkl
import random
import pdb
import matplotlib.pyplot as plt
from torchvision.transforms import Resize
import imp
from torch.utils.data import DataLoader
import os
from classifier_control.classifier.utils.general_utils import A... | [
"h5py.File",
"numpy.ones_like",
"matplotlib.pyplot.show",
"torch.utils.data.DataLoader",
"classifier_control.classifier.utils.general_utils.resize_video",
"random.shuffle",
"numpy.asarray",
"numpy.transpose",
"classifier_control.classifier.utils.general_utils.AttrDict",
"numpy.random.randint",
"... | [((7749, 7792), 'classifier_control.classifier.utils.general_utils.AttrDict', 'AttrDict', ([], {'img_sz': '(48, 64)', 'sel_len': '(-1)', 'T': '(31)'}), '(img_sz=(48, 64), sel_len=-1, T=31)\n', (7757, 7792), False, 'from classifier_control.classifier.utils.general_utils import AttrDict, map_dict\n'), ((1167, 1276), 'tor... |
import numpy as np
import math
from struct import unpack_from
from tifinity.parser.errors import InvalidTiffError
ifdtype = {
1: (1, "read_bytes", "insert_bytes"), # byte - 1 byte
2: (1, "read_bytes", "insert_bytes"), # ascii - 1 byte
3: (2, "read_shorts", "insert_shorts"), ... | [
"tifinity.parser.errors.InvalidTiffError",
"numpy.fromfile",
"numpy.zeros",
"numpy.insert",
"numpy.array",
"struct.unpack_from"
] | [((15194, 15221), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""uint8"""'}), "([], dtype='uint8')\n", (15202, 15221), True, 'import numpy as np\n'), ((17830, 17857), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""uint8"""'}), "([], dtype='uint8')\n", (17838, 17857), True, 'import numpy as np\n'), ((13522, 13559)... |
import numpy as np
from girard import monte_carlo as mc
def get_sample_std(omega, N):
return np.sqrt(omega * (1 - omega) / N)
def get_confidence_interval_prediction(omega, N):
std = get_sample_std(omega, N)
return omega - 2*std, omega + 2*std
def get_sample_distribution_for_solid_angle(cone_vectors, samp... | [
"numpy.std",
"numpy.mean",
"girard.monte_carlo.estimate_solid_angle",
"numpy.sqrt"
] | [((98, 130), 'numpy.sqrt', 'np.sqrt', (['(omega * (1 - omega) / N)'], {}), '(omega * (1 - omega) / N)\n', (105, 130), True, 'import numpy as np\n'), ((479, 498), 'numpy.mean', 'np.mean', (['estimators'], {}), '(estimators)\n', (486, 498), True, 'import numpy as np\n'), ((514, 532), 'numpy.std', 'np.std', (['estimators'... |
# -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import solve, norm, det
import scipy.stats as stats
def norm_cop_pdf(u, mu, sigma2):
"""For details, see here.
Parameters
----------
u : array, shape (n_,)
mu : array, shape (n_,)
sigma2 : array, shape (n_, n_)
R... | [
"numpy.diag",
"numpy.linalg.det",
"numpy.prod"
] | [((441, 456), 'numpy.diag', 'np.diag', (['sigma2'], {}), '(sigma2)\n', (448, 456), True, 'import numpy as np\n'), ((891, 906), 'numpy.prod', 'np.prod', (['pdf_xn'], {}), '(pdf_xn)\n', (898, 906), True, 'import numpy as np\n'), ((618, 629), 'numpy.linalg.det', 'det', (['sigma2'], {}), '(sigma2)\n', (621, 629), False, 'f... |
import pytest
import numpy as np
import tbats.error as error
from tbats import TBATS
class TestTBATS(object):
def test_constant_model(self):
y = [3.2] * 20
estimator = TBATS()
model = estimator.fit(y)
assert np.allclose([0.0] * len(y), model.resid)
assert np.allclose(y, m... | [
"numpy.sum",
"tbats.TBATS",
"pytest.warns",
"numpy.allclose",
"numpy.asarray",
"numpy.isclose",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"numpy.array_equal",
"pytest.mark.parametrize",
"numpy.concatenate"
] | [((4287, 4681), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""seasonal_periods, seasonal_harmonics, starting_values"""', '[[[12], [2], [[1, 2, 0.5, 0.6]]], [[7, 365], [2, 3], [[1, 2, 0.5, 0.6], [\n 0.5, 0.2, 0.4, 0.1, 0.9, 0.3]]], [[7.2, 12.25], [2, 1], [[0.4, 0.7, 0.2,\n 0.1], [0.9, 0.8]]], [[7, 11... |
import numpy as np
import networkx as nx
from numba import njit
from itertools import chain
from time import process_time
from datetime import timedelta
from kmmi.enumeration.graphlet_enumeration import *
from kmmi.utils.utils import *
from kmmi.utils.autoload import *
def prune_by_density(U: np.array, A: np.array, d... | [
"numpy.abs",
"numpy.sum",
"time.process_time",
"numpy.zeros",
"numpy.argsort",
"numpy.max",
"numpy.array",
"numpy.arange",
"datetime.timedelta",
"networkx.DiGraph",
"numpy.round",
"numpy.random.shuffle"
] | [((2795, 2806), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2803, 2806), True, 'import numpy as np\n'), ((2816, 2827), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2824, 2827), True, 'import numpy as np\n'), ((8863, 8875), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (8872, 8875), True, 'import numpy a... |
import functools
import numpy as np
from collections import Container, Mapping
from numpy.testing import assert_equal, assert_allclose
from .misc import settingerr, strenum
__all__ = ['assert_eq',
'assert_in',
'assert_not_in',
'assert_is',
'assert_is_not',
'asser... | [
"nose.plugins.skip.SkipTest",
"numpy.testing.assert_raises",
"numpy.asarray",
"numpy.isfinite",
"numpy.isnan",
"numpy.isinf",
"numpy.any",
"numpy.finfo",
"numpy.mean",
"functools.wraps",
"numpy.testing.assert_equal",
"numpy.testing.assert_allclose",
"numpy.all"
] | [((1114, 1132), 'numpy.asarray', 'np.asarray', (['actual'], {}), '(actual)\n', (1124, 1132), True, 'import numpy as np\n'), ((1147, 1166), 'numpy.asarray', 'np.asarray', (['desired'], {}), '(desired)\n', (1157, 1166), True, 'import numpy as np\n'), ((7249, 7290), 'numpy.testing.assert_raises', 'np.testing.assert_raises... |
"""
Tests thte BLAS capability for the opt_einsum module.
"""
import numpy as np
import pytest
from opt_einsum import blas, helpers, contract
blas_tests = [
# DOT
((['k', 'k'], '', set('k')), 'DOT'), # DDOT
((['ijk', 'ijk'], '', set('ijk')), 'DOT'), # DDOT
# GEMV?
# GEMM
(... | [
"numpy.dot",
"opt_einsum.blas.tensor_blas",
"opt_einsum.helpers.build_views",
"numpy.empty",
"numpy.allclose",
"numpy.einsum",
"opt_einsum.contract",
"opt_einsum.blas.can_blas",
"numpy.random.rand",
"pytest.mark.parametrize"
] | [((3214, 3266), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inp,benchmark"""', 'blas_tests'], {}), "('inp,benchmark', blas_tests)\n", (3237, 3266), False, 'import pytest\n'), ((3369, 3421), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inp,benchmark"""', 'blas_tests'], {}), "('inp,benchmar... |
# multiple classification with Logistic Regression
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.optimize as opt
def importCSV(dir, columns):
data = pd.read_csv(dir, header=None, names=columns)
data.insert(0, 'Ones', 1)
return data
def plot_image(data):
fig, ... | [
"scipy.optimize.minimize",
"matplotlib.pyplot.show",
"numpy.multiply",
"numpy.sum",
"numpy.argmax",
"pandas.read_csv",
"numpy.power",
"numpy.zeros",
"numpy.array",
"numpy.mat",
"numpy.exp",
"matplotlib.pyplot.subplots"
] | [((195, 239), 'pandas.read_csv', 'pd.read_csv', (['dir'], {'header': 'None', 'names': 'columns'}), '(dir, header=None, names=columns)\n', (206, 239), True, 'import pandas as pd\n'), ((325, 354), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (337, 354), True, 'import ... |
# Copyright (c) <NAME>, <NAME>
# All rights reserved
# Modified by <NAME>, April 5, 2021 for use in his thesis; lord help him.
import numpy as np
import matplotlib.pylab as plt
import pickle
import os
from scipy.optimize import minimize, dual_annealing
import subprocess
import random
def kernel_optim_lbfgs_log(inpu... | [
"scipy.optimize.minimize",
"numpy.multiply",
"numpy.sum",
"numpy.random.randn",
"numpy.std",
"random.shuffle",
"numpy.power",
"numpy.zeros",
"numpy.triu_indices",
"numpy.clip",
"numpy.ones",
"numpy.finfo",
"numpy.mean",
"os.path.join"
] | [((1897, 1939), 'numpy.triu_indices', 'np.triu_indices', (['target_data.shape[0]'], {'k': '(1)'}), '(target_data.shape[0], k=1)\n', (1912, 1939), True, 'import numpy as np\n'), ((2000, 2022), 'numpy.mean', 'np.mean', (['target_values'], {}), '(target_values)\n', (2007, 2022), True, 'import numpy as np\n'), ((2040, 2061... |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... | [
"numpy.datetime64",
"climetlab.testing.main",
"climetlab.decorators.normalize",
"climetlab.normalize.EnumNormaliser",
"datetime.datetime",
"climetlab.testing.climetlab_file",
"climetlab.normalize._find_normaliser",
"pytest.raises",
"pytest.mark.skipif",
"climetlab.normalize.DateListNormaliser",
... | [((728, 773), 'climetlab.decorators.normalize', 'normalize', (['"""parameter"""', '"""variable-list(mars)"""'], {}), "('parameter', 'variable-list(mars)')\n", (737, 773), False, 'from climetlab.decorators import normalize\n'), ((828, 871), 'climetlab.decorators.normalize', 'normalize', (['"""parameter"""', '"""variable... |
import numpy as np
import scipy.sparse as sp
import cvxpy as cp
from opymize.linear.diff import GradientOp, LaplacianOp
from opymize.tools.tests import test_adjoint, test_rowwise_lp, test_gpu_op
testfun_domain = np.array([[-np.pi,np.pi],[-np.pi,np.pi]])
def testfun(pts):
x, y = pts[:,0], pts[:,1]
return np.... | [
"opymize.tools.tests.test_rowwise_lp",
"opymize.linear.diff.GradientOp",
"cvxpy.vec",
"opymize.tools.tests.test_gpu_op",
"opymize.linear.diff.LaplacianOp",
"opymize.tools.tests.test_adjoint",
"scipy.sparse.eye",
"numpy.ones",
"numpy.sin",
"numpy.array",
"numpy.linalg.norm",
"numpy.cos",
"cvx... | [((215, 259), 'numpy.array', 'np.array', (['[[-np.pi, np.pi], [-np.pi, np.pi]]'], {}), '([[-np.pi, np.pi], [-np.pi, np.pi]])\n', (223, 259), True, 'import numpy as np\n'), ((888, 908), 'numpy.array', 'np.array', (['[0.3, 0.4]'], {}), '([0.3, 0.4])\n', (896, 908), True, 'import numpy as np\n'), ((964, 1011), 'opymize.li... |
#Xing @ 2018.12.05
import cv2
import numpy as np
import time
import matplotlib.pyplot as plt
# Initialize webcam input
cap = cv2.VideoCapture(1)
# Initialize video input
#cap = cv2.VideoCapture("C:/Users/liangx/Documents/Dunhill Project Data/Single Sign/Pronated Wrist/WATCH2.mp4")
#cap = cv2.VideoCapture("C:/Users/... | [
"matplotlib.pyplot.title",
"cv2.bitwise_and",
"numpy.ones",
"matplotlib.pyplot.gca",
"cv2.rectangle",
"cv2.erode",
"cv2.imshow",
"cv2.inRange",
"cv2.line",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"cv2.drawContours",
"cv2.destroyAllWindows",
"matplotlib.pyplot.show",
"cv2.minEn... | [((128, 147), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(1)'], {}), '(1)\n', (144, 147), False, 'import cv2\n'), ((1135, 1171), 'numpy.array', 'np.array', (['[0, 48, 80]'], {'dtype': '"""uint8"""'}), "([0, 48, 80], dtype='uint8')\n", (1143, 1171), True, 'import numpy as np\n'), ((1189, 1228), 'numpy.array', 'np.array'... |
import numpy as np
from qutip import (sigmax, sigmay, sigmaz, qeye, basis, gate_expand_1toN,
Qobj, tensor, snot)
from scipy import linalg
from scipy.sparse import csc_matrix
import copy
import itertools
from utils import generate_u3
class ProbDist:
"""Base class for generating probability distr... | [
"copy.deepcopy",
"qutip.sigmaz",
"qutip.tensor",
"numpy.abs",
"numpy.transpose",
"qutip.qeye",
"qutip.sigmax",
"qutip.sigmay",
"numpy.real",
"itertools.product",
"qutip.basis",
"numpy.dot",
"numpy.arccos"
] | [((2219, 2253), 'copy.deepcopy', 'copy.deepcopy', (['self.tens_states[i]'], {}), '(self.tens_states[i])\n', (2232, 2253), False, 'import copy\n'), ((2288, 2306), 'copy.deepcopy', 'copy.deepcopy', (['_op'], {}), '(_op)\n', (2301, 2306), False, 'import copy\n'), ((2332, 2357), 'copy.deepcopy', 'copy.deepcopy', (['init_st... |
import numpy as np
from ..bath import PseudomodeBath
from .base import DynamicalModel, SystemOperator
from .liouville_space import matrix_to_ket_vec
class ZOFESpaceOperator(SystemOperator):
"""
Parameters
----------
operator : np.ndarray
Matrix representation of the operator in the Hilbert su... | [
"numpy.tensordot",
"numpy.dot",
"numpy.zeros",
"numpy.einsum"
] | [((1585, 1641), 'numpy.tensordot', 'np.tensordot', (['self.operator', 'rho0'], {'axes': '([0, 1], [1, 0])'}), '(self.operator, rho0, axes=([0, 1], [1, 0]))\n', (1597, 1641), True, 'import numpy as np\n'), ((3566, 3605), 'numpy.zeros', 'np.zeros', (['self.oop_shape'], {'dtype': 'complex'}), '(self.oop_shape, dtype=compl... |
import random
import numpy as np
import torch
from rdkit import Chem
def to_tensor(tensor):
if isinstance(tensor, np.ndarray):
tensor = torch.from_numpy(tensor)
if torch.cuda.is_available():
return torch.autograd.Variable(tensor).cuda()
return torch.autograd.Variable(tensor)
def get_ind... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.autograd.Variable",
"torch.set_default_tensor_type",
"numpy.sort",
"torch.cuda.is_available",
"random.seed",
"rdkit.Chem.MolFromSmiles",
"numpy.unique",
"torch.from_numpy"
] | [((183, 208), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (206, 208), False, 'import torch\n'), ((275, 306), 'torch.autograd.Variable', 'torch.autograd.Variable', (['tensor'], {}), '(tensor)\n', (298, 306), False, 'import torch\n'), ((488, 524), 'numpy.unique', 'np.unique', (['smiles'], {'re... |
#!python
# GL interoperability example, by <NAME>.
# Draws a rotating teapot, using cuda to invert the RGB value
# each frame
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL.ARB.vertex_buffer_object import *
from OpenGL.GL.ARB.pixel_buffer_object import *
import numpy, sys,... | [
"pycuda.compiler.SourceModule",
"traceback.print_exc",
"pycuda.driver.Context.synchronize",
"numpy.zeros",
"time.clock",
"os._exit"
] | [((1035, 1076), 'numpy.zeros', 'numpy.zeros', (['(num_texels, 4)', 'numpy.uint8'], {}), '((num_texels, 4), numpy.uint8)\n', (1046, 1076), False, 'import numpy, sys, time\n'), ((5126, 5159), 'pycuda.driver.Context.synchronize', 'cuda_driver.Context.synchronize', ([], {}), '()\n', (5157, 5159), True, 'import pycuda.drive... |
#import numpy as np
from pylsl import StreamInlet, resolve_stream, local_clock
from DE_viewer_dialog import DialogDE
from qtpy import QtGui, QtCore, QtWidgets, uic
import numpy as np
import os
qtCreatorFile = "viewer.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(os.path.join(os.path.dirname(__fil... | [
"pylsl.local_clock",
"DE_viewer_dialog.DialogDE",
"os.path.dirname",
"qtpy.QtCore.QTimer",
"qtpy.QtWidgets.QApplication.instance",
"numpy.asarray",
"pylsl.resolve_stream",
"pylsl.StreamInlet",
"qtpy.QtWidgets.QMainWindow.__init__",
"qtpy.QtWidgets.QInputDialog",
"qtpy.QtWidgets.QApplication",
... | [((5200, 5216), 'pylsl.resolve_stream', 'resolve_stream', ([], {}), '()\n', (5214, 5216), False, 'from pylsl import StreamInlet, resolve_stream, local_clock\n'), ((5282, 5303), 'DE_viewer_dialog.DialogDE', 'DialogDE', (['listStreams'], {}), '(listStreams)\n', (5290, 5303), False, 'from DE_viewer_dialog import DialogDE\... |
import seaborn as sns
import datetime
import seaborn as sns
import pandas as pd
import pickle as pickle
from scipy.spatial.distance import cdist, pdist, squareform
#import backspinpy
import pandas as pd
from sklearn.linear_model import LogisticRegression, LogisticRegressionCV
from sklearn.model_selection i... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"numpy.log2",
"datetime.datetime.now",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((1000, 1022), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '(**fig_args)\n', (1010, 1022), True, 'import matplotlib.pyplot as plt\n'), ((1211, 1252), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Accuracy Score"""'], {'fontsize': '(15)'}), "('Accuracy Score', fontsize=15)\n", (1221, 1252), True, 'import matp... |
#Data to fit to for each galaxy to be used in workshop
###############################
########## Imports ############
###############################
import sys
sys.path.append('../python/')
import dataPython as dp
import numpy as np
import scipy.interpolate as inter
import matplotlib.pyplot a... | [
"sys.path.append",
"scipy.interpolate.BSpline",
"numpy.asarray",
"dataPython.getXYdata",
"dataPython.getXYdata_wYerr",
"dataPython.getXYdata_wXYerr",
"scipy.interpolate.splrep"
] | [((163, 192), 'sys.path.append', 'sys.path.append', (['"""../python/"""'], {}), "('../python/')\n", (178, 192), False, 'import sys\n'), ((1857, 1899), 'numpy.asarray', 'np.asarray', (["NGC5533['measured_data']['xx']"], {}), "(NGC5533['measured_data']['xx'])\n", (1867, 1899), True, 'import numpy as np\n'), ((1926, 1968)... |
# -*- coding: utf-8 -*-
"""
@FileName : convert_to_pb.py
@Description : None
@Author : 齐鲁桐
@Email : <EMAIL>
@Time : 2019-04-01 19:25
@Modify : None
"""
from __future__ import absolute_import, division, print_function
import tensorflow as tf
model = 'model.pb'
output_graph_def = tf.GraphDef(... | [
"numpy.random.randn",
"tensorflow.GraphDef",
"tensorflow.gfile.GFile",
"tensorflow.Graph",
"tensorflow.import_graph_def"
] | [((308, 321), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (319, 321), True, 'import tensorflow as tf\n'), ((596, 613), 'numpy.random.randn', 'np.random.randn', ([], {}), '()\n', (611, 613), True, 'import numpy as np\n'), ((614, 641), 'tensorflow.gfile.GFile', 'tf.gfile.GFile', (['model', '"""rb"""'], {}), "... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 2 07:53:25 2022
@author: Administrator
"""
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 1 15:18:39 2022
@author: NeoChen
"""
from pathlib import Path
import scipy.io.wavfile
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
from sklearn.d... | [
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"sklearn.preprocessing.MinMaxScaler",
"pathlib.Path",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.models.Sequential",
"numpy.reshape",
"scipy.si... | [((978, 1022), 'scipy.signal.stft', 'signal.stft', (['ref', 'sample_rate1'], {'nperseg': '(1000)'}), '(ref, sample_rate1, nperseg=1000)\n', (989, 1022), False, 'from scipy import signal\n'), ((1038, 1082), 'scipy.signal.stft', 'signal.stft', (['deg', 'sample_rate2'], {'nperseg': '(1000)'}), '(deg, sample_rate2, nperseg... |
import itertools
from collections import Counter
from typing import List, Optional, Dict, Tuple
import copy
import numpy as np
from hotpot.data_handling.dataset import ListBatcher, Dataset, QuestionAndParagraphsSpec, QuestionAndParagraphsDataset, \
Preprocessor, SampleFilter, TrainingDataHandler
from hotpot.data_... | [
"copy.deepcopy",
"hotpot.data_handling.dataset.QuestionAndParagraphsSpec",
"numpy.random.RandomState",
"hotpot.data_handling.relevance_training_data.IterativeQuestionAndParagraphs",
"numpy.random.choice",
"collections.Counter",
"hotpot.data_handling.relevance_training_data.BinaryQuestionAndParagraphs",
... | [((1741, 1780), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'sample_seed'}), '(seed=sample_seed)\n', (1762, 1780), True, 'import numpy as np\n'), ((5599, 5636), 'numpy.random.shuffle', 'np.random.shuffle', (['self.epoch_samples'], {}), '(self.epoch_samples)\n', (5616, 5636), True, 'import numpy a... |
import numpy as np
def machine_learning_TI(x_train, y_train, x_test, y_test, mode, TI_test):
if len(x_train.shape) == 1:
y_train = np.array(y_train).reshape(-1, 1).ravel()
y_test = np.array(y_test).reshape(-1, 1).ravel()
x_train = np.array(x_train).reshape(-1, 1)
x_test = np.array... | [
"pyearth.Earth",
"sklearn.svm.SVR",
"numpy.array",
"sklearn.ensemble.RandomForestRegressor"
] | [((748, 765), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (756, 765), True, 'import numpy as np\n'), ((783, 799), 'numpy.array', 'np.array', (['y_test'], {}), '(y_test)\n', (791, 799), True, 'import numpy as np\n'), ((818, 835), 'numpy.array', 'np.array', (['x_train'], {}), '(x_train)\n', (826, 835), T... |
from __future__ import absolute_import, division, print_function
import os, sys, shutil
import tempfile
import subprocess
import numpy as np
from .linelists import TSLineList, get_default_linelist
from .marcs import MARCSModel, interp_atmosphere
from . import utils
_lpoint_max = 1000000 # hardcoded into turbospectr... | [
"sys.stdout.write",
"os.path.abspath",
"os.remove",
"numpy.ceil",
"os.path.basename",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"sys.stdout.flush",
"numpy.loadtxt",
"os.path.normpath",
"os.path.join",
"os.getenv",
"shutil.copy"
] | [((3671, 3699), 'numpy.ceil', 'np.ceil', (['((wmax - wmin) / dwl)'], {}), '((wmax - wmin) / dwl)\n', (3678, 3699), True, 'import numpy as np\n'), ((8316, 8345), 'os.path.join', 'os.path.join', (['twd', '"""bsyn.par"""'], {}), "(twd, 'bsyn.par')\n", (8328, 8345), False, 'import os, sys, shutil\n'), ((8362, 8391), 'os.pa... |
import numpy as np
import pandas as pd
import os
from download import download
import requests
import json
import time
start = time.time()
def distance():
'''
Cette fonction nous sert à créer le dataframe des distances
'''
# Chargement des données géographiques
url = 'https://raw.githubusercontent... | [
"pandas.DataFrame",
"json.loads",
"pandas.read_csv",
"os.getcwd",
"numpy.zeros",
"time.time",
"requests.get",
"download.download"
] | [((129, 140), 'time.time', 'time.time', ([], {}), '()\n', (138, 140), False, 'import time\n'), ((1988, 1999), 'time.time', 'time.time', ([], {}), '()\n', (1997, 1999), False, 'import time\n'), ((445, 479), 'download.download', 'download', (['url', 'path'], {'replace': '(False)'}), '(url, path, replace=False)\n', (453, ... |
import numpy as np
import perfplot
try:
import cartesio as cs
except ImportError:
import os
import sys
sys.path.insert(
0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
)
import cartesio as cs
# noinspection PyUnresolvedReferences
def run_perf_nms():
... | [
"cartesio.bbox.utils.random",
"numpy.random.seed",
"cartesio.bbox.nms.py_func",
"cartesio.bbox.nms",
"os.path.dirname"
] | [((323, 340), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (337, 340), True, 'import numpy as np\n'), ((436, 459), 'cartesio.bbox.utils.random', 'cs.bbox.utils.random', (['n'], {}), '(n)\n', (456, 459), True, 'import cartesio as cs\n'), ((560, 587), 'cartesio.bbox.nms', 'cs.bbox.nms', (['a'], {'thresh... |
import pandas as pd
import numpy as np
from sklearn import preprocessing
##
class MultiColomnLabelEncoder:
##
def __init__(self):
self.dataTypes = {}
self.__catColumns = []
self.__MultiLE = {}
## Later, self.dataTypes will be used to convert dtypes to the original ones.
def __G... | [
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.preprocessing.LabelEncoder",
"numpy.array",
"pandas.concat"
] | [((341, 355), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (353, 355), True, 'import pandas as pd\n'), ((2046, 2080), 'pandas.concat', 'pd.concat', (['[data, catData]'], {'axis': '(1)'}), '([data, catData], axis=1)\n', (2055, 2080), True, 'import pandas as pd\n'), ((2445, 2459), 'pandas.DataFrame', 'pd.DataFra... |
import numpy as np
import tensorflow as tf
import tensorflow.keras.layers as kl
class ProbabilityDistribution(tf.keras.Model):
def call(self, logits, **kwargs):
# sample a random categorical action from given logits
return tf.squeeze(tf.random.categorical(logits, 1), axis=-1)
class CNNModel(tf.ker... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dense",
"tensorflow.convert_to_tensor",
"tensorflow.random.categorical",
"tensorflow.keras.layers.MaxPool2D",
"numpy.squeeze",
"tensorflow.keras.layers.Flatten"
] | [((428, 464), 'tensorflow.keras.layers.Conv2D', 'kl.Conv2D', (['(128)', '(3)'], {'activation': '"""selu"""'}), "(128, 3, activation='selu')\n", (437, 464), True, 'import tensorflow.keras.layers as kl\n'), ((484, 504), 'tensorflow.keras.layers.MaxPool2D', 'kl.MaxPool2D', (['(5, 5)'], {}), '((5, 5))\n', (496, 504), True,... |
import cv2
import numpy as np
def augment(img, obj, projection, template, color=False, scale=4):
h, w = template.shape
vertices = obj.vertices
img = np.ascontiguousarray(img, dtype=np.uint8)
a = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, h, 0]], np.float64)
imgpts = np.int32(cv2.perspective... | [
"numpy.uint8",
"numpy.zeros",
"cv2.imread",
"numpy.array",
"numpy.int32",
"cv2.fillConvexPoly",
"numpy.ascontiguousarray"
] | [((163, 204), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['img'], {'dtype': 'np.uint8'}), '(img, dtype=np.uint8)\n', (183, 204), True, 'import numpy as np\n'), ((214, 280), 'numpy.array', 'np.array', (['[[0, 0, 0], [w, 0, 0], [w, h, 0], [0, h, 0]]', 'np.float64'], {}), '([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, h... |
import sys
import warnings
from PyQt5.QtWidgets import (QApplication, QMainWindow, QMenu, QVBoxLayout,
QSizePolicy, QMessageBox, QWidget, QPushButton)
#from PyQt5.QtGui import QIcon
from PyQt5 import uic
import numpy as np
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from matpl... | [
"numpy.abs",
"PyQt5.uic.loadUi",
"PyQt5.QtWidgets.QVBoxLayout",
"numpy.imag",
"numpy.sin",
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"PyQt5.QtWidgets.QApplication",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.MultipleLocator",
"numpy.zeros_like",
"numpy.copy",
"numpy.... | [((524, 599), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'matplotlib.cbook.mplDeprecation'}), "('ignore', category=matplotlib.cbook.mplDeprecation)\n", (547, 599), False, 'import warnings\n'), ((1472, 1491), 'numpy.array', 'np.array', (['[0, 0, 1]'], {}), '([0, 0, 1])\n', (148... |
# OpenCV Tutorial from Murtaza's Workshop - Robotics and AI
import numpy as np
import cv2
width = 640
height = 640
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
cap.set(3, width)
cap.set(4, height)
cap.set(10, 150)
def get_contours(img):
biggest = np.array([])
max_area = 0
contours, hierarchy = cv2.findConto... | [
"cv2.GaussianBlur",
"numpy.argmax",
"cv2.getPerspectiveTransform",
"cv2.arcLength",
"cv2.approxPolyDP",
"numpy.ones",
"numpy.argmin",
"cv2.erode",
"cv2.imshow",
"cv2.warpPerspective",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"cv2.drawContours",
"cv2.destroyAllWindows",
"cv2.res... | [((123, 157), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)', 'cv2.CAP_DSHOW'], {}), '(0, cv2.CAP_DSHOW)\n', (139, 157), False, 'import cv2\n'), ((2418, 2441), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2439, 2441), False, 'import cv2\n'), ((251, 263), 'numpy.array', 'np.array', (['[]'], {}),... |
# Conway's Game of Life written by <NAME>
import numpy as np
import os
FAST_IO = [" ", "#"]
IO = [u"\u001b[30m\u001b[40m \u001b[0m", u"\u001b[37;1m\u001b[47;1m \u001b[0m"]\
# Optional Faster Version
IO = FAST_IO
# Main function
def iterate(buffer, w, h):
tmp_buffer = np.empty(shape=(h+2, w+2)) # C... | [
"numpy.sum",
"numpy.empty",
"numpy.zeros",
"os.system",
"numpy.random.randint",
"numpy.where"
] | [((289, 319), 'numpy.empty', 'np.empty', ([], {'shape': '(h + 2, w + 2)'}), '(shape=(h + 2, w + 2))\n', (297, 319), True, 'import numpy as np\n'), ((798, 846), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (807, 846), False, 'import os\n'), ((1... |
import matplotlib
matplotlib.use('agg', warn=False, force=True)
import pytest
import optoanalysis
import numpy as np
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
plot_similarity_tolerance = 30
float_relative_tolerance = 1e-3
def test_load_data():
"""
Tests that lo... | [
"optoanalysis.multi_subplots_time",
"optoanalysis.load_data",
"numpy.testing.assert_array_equal",
"optoanalysis.multi_plot_time",
"optoanalysis.calc_temp",
"optoanalysis.multi_load_data",
"matplotlib.use",
"pytest.mark.mpl_image_compare",
"pytest.approx",
"optoanalysis.multi_plot_PSD"
] | [((18, 63), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {'warn': '(False)', 'force': '(True)'}), "('agg', warn=False, force=True)\n", (32, 63), False, 'import matplotlib\n'), ((1774, 1840), 'pytest.mark.mpl_image_compare', 'pytest.mark.mpl_image_compare', ([], {'tolerance': 'plot_similarity_tolerance'}), '(tole... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
import from 50b745c1d18d5c4b01d9d00e406b5fdaab3515ea @ KamLearn
Compute various statistics between estimated and correct classes in binary
cases
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
#=======... | [
"numpy.sum",
"numpy.log",
"doctest.testmod",
"numpy.ravel",
"numpy.empty",
"numpy.log2",
"numpy.isinf",
"logging.getLogger",
"numpy.isnan",
"numpy.any",
"numpy.max",
"sys.exit",
"numpy.sqrt"
] | [((15532, 15557), 'logging.getLogger', 'logging.getLogger', (['"""fadm"""'], {}), "('fadm')\n", (15549, 15557), False, 'import logging\n'), ((15923, 15940), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (15938, 15940), False, 'import doctest\n'), ((15946, 15957), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n'... |
''' Metric class for tracking correlations by saving predictions '''
import numpy as np
from overrides import overrides
from allennlp.training.metrics.metric import Metric
from sklearn.metrics import matthews_corrcoef, confusion_matrix
from scipy.stats import pearsonr, spearmanr
import torch
@Metric.register("fastMat... | [
"numpy.trace",
"allennlp.training.metrics.metric.Metric.register",
"numpy.zeros",
"numpy.isnan",
"numpy.arange",
"numpy.dot",
"numpy.sqrt"
] | [((296, 327), 'allennlp.training.metrics.metric.Metric.register', 'Metric.register', (['"""fastMatthews"""'], {}), "('fastMatthews')\n", (311, 327), False, 'from allennlp.training.metrics.metric import Metric\n'), ((2497, 2527), 'allennlp.training.metrics.metric.Metric.register', 'Metric.register', (['"""correlation"""... |
from CTL.tests.packedTest import PackedTest
from CTL.tensor.contract.tensorGraph import TensorGraph
from CTL.tensor.tensor import Tensor
from CTL.tensor.contract.link import makeLink
from CTL.tensor.contract.optimalContract import makeTensorGraph, contractWithSequence
import CTL.funcs.funcs as funcs
import numpy as np
... | [
"CTL.funcs.funcs.tupleProduct",
"CTL.tensor.contract.optimalContract.contractWithSequence",
"numpy.ones",
"CTL.tensor.contract.optimalContract.makeTensorGraph"
] | [((1110, 1137), 'CTL.tensor.contract.optimalContract.makeTensorGraph', 'makeTensorGraph', (['tensorList'], {}), '(tensorList)\n', (1125, 1137), False, 'from CTL.tensor.contract.optimalContract import makeTensorGraph, contractWithSequence\n'), ((2035, 2076), 'CTL.tensor.contract.optimalContract.contractWithSequence', 'c... |
#!/usr/bin/env python
"""Tools for CUDA compilation and set-up for Python 3."""
import importlib
import logging
import os
import platform
import re
import shutil
import sys
from distutils.sysconfig import get_python_inc
from subprocess import PIPE, run
from textwrap import dedent
# from pkg_resources import resource_f... | [
"resources.get_setup",
"miutil.cuinfo.compute_capability",
"os.path.join",
"os.chdir",
"sys.path.append",
"os.path.abspath",
"os.path.dirname",
"distutils.sysconfig.get_python_inc",
"os.path.exists",
"miutil.cuinfo.nvcc_flags",
"re.findall",
"numpy.get_include",
"miutil.cuinfo.num_devices",
... | [((475, 502), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (492, 502), False, 'import logging\n'), ((532, 548), 'distutils.sysconfig.get_python_inc', 'get_python_inc', ([], {}), '()\n', (546, 548), False, 'from distutils.sysconfig import get_python_inc\n'), ((431, 446), 'numpy.get_inclu... |
__author__ = 'eric'
import utils
from sklearn import (manifold, datasets, decomposition, ensemble, lda,
random_projection)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import offsetbox
comp_fc7, props, fc7_feats, pool5_feats = utils.load_feature_db()
class_labels = np.zero... | [
"matplotlib.pyplot.title",
"sklearn.datasets.load_digits",
"matplotlib.pyplot.subplot",
"sklearn.lda.LDA",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figure",
"utils.load_db_labels",
"numpy.min",
"numpy.max",
"utils.load_feature_db",
"m... | [((274, 297), 'utils.load_feature_db', 'utils.load_feature_db', ([], {}), '()\n', (295, 297), False, 'import utils\n'), ((547, 570), 'numpy.unique', 'np.unique', (['class_labels'], {}), '(class_labels)\n', (556, 570), True, 'import numpy as np\n'), ((650, 696), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([... |
import os, struct, math
import numpy as np
import torch
from glob import glob
import cv2
import torch.nn.functional as F
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
def get_latest_file(root_dir):
"""Returns path to latest file in a directory."""
list_of_files = gl... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"os.path.join",
"os.makedirs",
"cv2.cvtColor",
"os.path.isdir",
"torch.load",
"numpy.asarray",
"os.path.exists",
"torch.save",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.tight_layout",
"numpy.prod",
"nump... | [((799, 835), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (811, 835), False, 'import cv2\n'), ((1944, 2022), 'numpy.array', 'np.array', (['[[fx, 0.0, cx, 0.0], [0.0, fy, cy, 0], [0.0, 0, 1, 0], [0, 0, 0, 1]]'], {}), '([[fx, 0.0, cx, 0.0], [0.0, fy, cy, 0], [0.0, 0, ... |
"""Example file for testing
This creates a small testnet with ipaddresses from 192.168.0.0/24,
one switch, and three hosts.
"""
import sys, os
import io
import time
import math
import signal
import numpy as np
import fnmatch
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
try:
del os... | [
"os.makedirs",
"argparse.ArgumentParser",
"math.ceil",
"os.path.dirname",
"statistics.stdev",
"time.sleep",
"time.time",
"statistics.mean",
"numpy.linspace",
"fnmatch.fnmatch",
"os.listdir",
"virtnet.Manager"
] | [((630, 655), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (653, 655), False, 'import argparse\n'), ((8439, 8459), 'time.sleep', 'time.sleep', (['opt.time'], {}), '(opt.time)\n', (8449, 8459), False, 'import time\n'), ((5102, 5130), 'statistics.mean', 'statistics.mean', (['ping_output'], {}),... |
import matplotlib.pyplot as plt
import os
import numpy as np
from argparse import ArgumentParser
from functools import partial
from scipy import stats
from collections import namedtuple, OrderedDict, defaultdict
from typing import Any, Dict, List, Optional, DefaultDict
from adaptiveleak.utils.constants import POLICIES... | [
"functools.partial",
"numpy.average",
"argparse.ArgumentParser",
"matplotlib.pyplot.show",
"adaptiveleak.analysis.plot_utils.iterate_policy_folders",
"matplotlib.pyplot.style.context",
"collections.defaultdict",
"adaptiveleak.analysis.plot_utils.to_label",
"matplotlib.pyplot.subplots",
"matplotlib... | [((862, 879), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (873, 879), False, 'from collections import namedtuple, OrderedDict, defaultdict\n'), ((2849, 2865), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (2863, 2865), False, 'from argparse import ArgumentParser\n'), ((3112, 3... |
import os
import numpy as np
import math
import rasterio.features
import shapely.ops
import shapely.wkt
import shapely.geometry
import pandas as pd
import cv2
from scipy import ndimage as ndi
from skimage.morphology import watershed
from tqdm import tqdm
from fire import Fire
import matplotlib.pyplot as plt
import shut... | [
"os.mkdir",
"math.isnan",
"os.makedirs",
"os.path.basename",
"os.path.exists",
"os.system",
"geopandas.GeoDataFrame",
"numpy.max",
"geopandas.read_file",
"multiprocessing.pool.Pool",
"shutil.rmtree",
"os.path.join",
"os.listdir",
"multiprocessing.cpu_count"
] | [((11288, 11299), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (11297, 11299), False, 'from multiprocessing import cpu_count\n'), ((11373, 11415), 'os.path.exists', 'os.path.exists', (['"""/wdata/pred_jsons_match/"""'], {}), "('/wdata/pred_jsons_match/')\n", (11387, 11415), False, 'import os\n'), ((11463... |
from math import ceil
import numpy as np
class GSOM:
def __init__(self, initial_map_size, parent_quantization_error, t1, data_size, weights_map, parent_dataset, neuron_builder):
assert parent_dataset is not None, "Provided dataset is empty"
self.__neuron_builder = neuron_builder
s... | [
"numpy.argmax",
"math.ceil",
"numpy.asarray",
"numpy.zeros",
"numpy.random.RandomState",
"numpy.insert",
"numpy.where",
"numpy.exp",
"numpy.round"
] | [((6445, 6507), 'numpy.zeros', 'np.zeros', ([], {'shape': '(map_rows, self.__data_size)', 'dtype': 'np.float32'}), '(shape=(map_rows, self.__data_size), dtype=np.float32)\n', (6453, 6507), True, 'import numpy as np\n'), ((6538, 6598), 'numpy.insert', 'np.insert', (['self.weights_map[0]', 'new_column_idx', 'line'], {'ax... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import glob
import h5py
import copy
import math
import json
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import r2_score
from util import transform_point_cloud, npmat2... | [
"torch.nn.Dropout",
"torch.eye",
"numpy.abs",
"torch.sqrt",
"sklearn.metrics.r2_score",
"torch.cat",
"util.transform_point_cloud",
"torch.cuda.device_count",
"util.npmat2euler",
"numpy.mean",
"torch.arange",
"torch.device",
"numpy.sqrt",
"os.path.join",
"torch.ones",
"torch.gather",
... | [((690, 715), 'torch.nn.functional.softmax', 'F.softmax', (['scores'], {'dim': '(-1)'}), '(scores, dim=-1)\n', (699, 715), True, 'import torch.nn.functional as F\n'), ((937, 977), 'torch.sum', 'torch.sum', (['(src ** 2)'], {'dim': '(1)', 'keepdim': '(True)'}), '(src ** 2, dim=1, keepdim=True)\n', (946, 977), False, 'im... |
# Imports
import time
import sys
import numpy as np
# %%
def breath_animation(
animation_duration=30,
inhale_symbol="O",
exhale_symbol=".",
inhale_seconds=5,
exhale_seconds=5,
field_width=70,
):
"""
Parameters
----------
animation_duration : int
Number of seconds in th... | [
"sys.stdout.write",
"time.time",
"numpy.where",
"sys.stdout.flush",
"numpy.linspace"
] | [((747, 790), 'numpy.linspace', 'np.linspace', (['(0)', 'inhale_seconds', 'field_width'], {}), '(0, inhale_seconds, field_width)\n', (758, 790), True, 'import numpy as np\n'), ((945, 1018), 'numpy.linspace', 'np.linspace', (['inhale_seconds', '(inhale_seconds + exhale_seconds)', 'field_width'], {}), '(inhale_seconds, i... |
# Lab 4 Multi-variable linear regression
import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
# numpy 내장 함수
xy = np.loadtxt('data-01-test-score.csv', delimiter=',', dtype=np.float32)
x_data = xy[:, 0:-1]
y_data = xy[:, [-1]]
#print(xy)
# shape과 data 확인
print(x_data.shape, x_data, len(x_data)) # 25x3,... | [
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"tensorflow.set_random_seed",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.random_normal",
"numpy.loadtxt",
"tensorflow.square",
"tensorflow.train.GradientDescentOptimizer"
] | [((84, 107), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(777)'], {}), '(777)\n', (102, 107), True, 'import tensorflow as tf\n'), ((128, 197), 'numpy.loadtxt', 'np.loadtxt', (['"""data-01-test-score.csv"""'], {'delimiter': '""","""', 'dtype': 'np.float32'}), "('data-01-test-score.csv', delimiter=',', dtype=n... |
import cv2
import numpy as np
from planarH import computeH
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def compute_extrinsics(K,H):
H_hat = np.matmul(np.linalg.inv(K),H)
rotation_hat = H_hat[:,:2]
[U,S,V] = np.linalg.svd(rotation_hat)
S = np.array([[1,0],[0,1],[0,0]])
new_rotat... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"numpy.cross",
"numpy.append",
"cv2.imread",
"numpy.linalg.svd",
"numpy.array",
"numpy.reshape",
"numpy.loadtxt",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.linalg.det",
"numpy.where",
"plan... | [((241, 268), 'numpy.linalg.svd', 'np.linalg.svd', (['rotation_hat'], {}), '(rotation_hat)\n', (254, 268), True, 'import numpy as np\n'), ((277, 311), 'numpy.array', 'np.array', (['[[1, 0], [0, 1], [0, 0]]'], {}), '([[1, 0], [0, 1], [0, 0]])\n', (285, 311), True, 'import numpy as np\n'), ((374, 422), 'numpy.cross', 'np... |
from warnings import catch_warnings
import numpy as np
import pytest
from pandas import DataFrame, MultiIndex, Series
from pandas.util import testing as tm
@pytest.fixture
def single_level_multiindex():
"""single level MultiIndex"""
return MultiIndex(levels=[['foo', 'bar', 'baz', 'qux']],
... | [
"pandas.DataFrame",
"pandas.util.testing.assert_frame_equal",
"numpy.random.randn",
"pandas.MultiIndex",
"pandas.MultiIndex.from_product",
"pytest.raises",
"numpy.array",
"pandas.Series",
"warnings.catch_warnings",
"numpy.int64",
"numpy.arange",
"pytest.mark.filterwarnings",
"pandas.util.tes... | [((367, 429), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:\\\\n.ix:DeprecationWarning"""'], {}), "('ignore:\\\\n.ix:DeprecationWarning')\n", (393, 429), False, 'import pytest\n'), ((252, 345), 'pandas.MultiIndex', 'MultiIndex', ([], {'levels': "[['foo', 'bar', 'baz', 'qux']]", 'labels': '[[... |
#-------------------------------------#
# 调用摄像头检测
#-------------------------------------#
from yolo import YOLO
from PIL import Image
import numpy as np
import cv2
import time
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(p... | [
"numpy.uint8",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"tensorflow.config.experimental.set_memory_growth",
"time.time",
"cv2.VideoCapture",
"numpy.array",
"cv2.destroyAllWindows",
"tensorflow.config.experimental.list_physical_devices",
"yolo.YOLO"
] | [((226, 277), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (270, 277), True, 'import tensorflow as tf\n'), ((278, 345), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['physical... |
import os
import time
import logging
import argparse
import numpy as np
import torch
from common.logger_utils import initialize_logging
from pytorch.utils import prepare_pt_context, prepare_model
from pytorch.dataset_utils import get_dataset_metainfo
from pytorch.dataset_utils import get_val_data_source
def add_eval_... | [
"numpy.stack",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.transpose",
"numpy.expand_dims",
"pytorch.dataset_utils.get_dataset_metainfo",
"time.time",
"pytorch.utils.prepare_pt_context",
"common.logger_utils.initialize_logging",
"numpy.min",
"numpy.ones",
"numpy.linalg.norm",
"pytorch.dat... | [((2718, 2876), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate a model for image matching (PyTorch/HPatches)"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'Evaluate a model for image matching (PyTorch/HPatches)',\n formatter_class=arg... |
# Pionniers du TJ, benissiez-moi par votre Esprits Saints!
from constraints import generate_pairs
from CPKMeans import CPKMeans
import numpy as np
import csv
def test_dataset(points, labels, num_clust):
must_link, cannot_link = generate_pairs(labels, num_clust, percentage = 0.01)
cpkmeans = CPKMeans(points, num_clust... | [
"numpy.array",
"CPKMeans.CPKMeans",
"csv.reader",
"constraints.generate_pairs"
] | [((229, 279), 'constraints.generate_pairs', 'generate_pairs', (['labels', 'num_clust'], {'percentage': '(0.01)'}), '(labels, num_clust, percentage=0.01)\n', (243, 279), False, 'from constraints import generate_pairs\n'), ((294, 345), 'CPKMeans.CPKMeans', 'CPKMeans', (['points', 'num_clust', 'must_link', 'cannot_link'],... |
#!/usr/bin/env python
# for animation
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np
import distutils.util
# functions defined for model required by fastai
from fastai.vision.all import *
import sys
# Needed to import pycaster from relative path
sys.path.append("../Py... | [
"sys.path.append",
"numpy.arctan2",
"numpy.zeros",
"numpy.array",
"MazeUtils.bfs_dist_maze",
"MazeUtils.read_maze_file",
"pycaster.PycastWorld"
] | [((298, 331), 'sys.path.append', 'sys.path.append', (['"""../PycastWorld"""'], {}), "('../PycastWorld')\n", (313, 331), False, 'import sys\n'), ((378, 406), 'sys.path.append', 'sys.path.append', (['"""../Models"""'], {}), "('../Models')\n", (393, 406), False, 'import sys\n'), ((407, 436), 'sys.path.append', 'sys.path.a... |
# coding: utf-8
""" Neural network with 1 hidden layer for MNIST handwritten digits recognition
===========
PRESENTATION
This Python code is an example of a simple artificial neural network
written from scratch using only :
- the numpy package (for array manipulation)
- the mnist module (to import the databas... | [
"mnist.train_images",
"numpy.full",
"mnist.train_labels",
"numpy.random.uniform",
"numpy.outer",
"numpy.log",
"numpy.zeros",
"mnist.test_labels",
"numpy.exp",
"mnist.test_images",
"numpy.dot",
"numpy.sqrt"
] | [((2136, 2156), 'mnist.train_images', 'mnist.train_images', ([], {}), '()\n', (2154, 2156), False, 'import mnist\n'), ((2172, 2192), 'mnist.train_labels', 'mnist.train_labels', ([], {}), '()\n', (2190, 2192), False, 'import mnist\n'), ((2208, 2227), 'mnist.test_images', 'mnist.test_images', ([], {}), '()\n', (2225, 222... |
#from https://github.com/sklam/numba-example-wavephysics
#setup: N=4000
#run: wave(N)
import numpy as np
from math import ceil
def physics(masspoints, dt, plunk, which):
ppos = masspoints[1]
cpos = masspoints[0]
N = cpos.shape[0]
# apply hooke's law
HOOKE_K = 2100000.
DAMPING = 0.0001
MASS = .01
force... | [
"numpy.array",
"numpy.empty",
"numpy.zeros",
"numpy.sqrt"
] | [((323, 339), 'numpy.zeros', 'np.zeros', (['(N, 2)'], {}), '((N, 2))\n', (331, 339), True, 'import numpy as np\n'), ((1016, 1051), 'numpy.empty', 'np.empty', (['(2, count, 2)', 'np.float64'], {}), '((2, count, 2), np.float64)\n', (1024, 1051), True, 'import numpy as np\n'), ((1066, 1093), 'numpy.zeros', 'np.zeros', (['... |
from torch_geometric.data import Data
import numpy as np
import torch
from tqdm import tqdm
from torch_geometric.data import InMemoryDataset
class EmotionDataset(InMemoryDataset):
def __init__(self, config, stage, root, sub_idx, pos=None, X=None, Y=None, edge_index=None,
transform=None, pre_tran... | [
"torch.load",
"torch.FloatTensor",
"torch.save",
"numpy.shape",
"torch_geometric.data.Data"
] | [((792, 827), 'torch.load', 'torch.load', (['self.processed_paths[0]'], {}), '(self.processed_paths[0])\n', (802, 827), False, 'import torch\n'), ((1813, 1864), 'torch.save', 'torch.save', (['(data, slices)', 'self.processed_paths[0]'], {}), '((data, slices), self.processed_paths[0])\n', (1823, 1864), False, 'import to... |
# Hodographic shaping in SI units
# <NAME>, 2019
# Based on
# Paper: [Gondelach 2015]
# Thesis: [Gondelach 2012]
import time
import numpy as np
import matplotlib as mlt
import matplotlib.pyplot as plt
import pykep as pk
import scipy as sci
from conversions import *
from utils import *
from shapingFunctions import s... | [
"numpy.set_printoptions",
"shapingFunctions.shapeFunctions",
"time.process_time",
"time.time",
"numpy.array",
"numpy.linspace",
"shapingFunctions.shapeFunctionsFree",
"pykep.epoch",
"integration.integrate",
"numpy.linalg.solve"
] | [((2135, 2154), 'time.process_time', 'time.process_time', ([], {}), '()\n', (2152, 2154), False, 'import time\n'), ((4026, 4066), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': 'precision'}), '(precision=precision)\n', (4045, 4066), True, 'import numpy as np\n'), ((7905, 7924), 'time.process_time',... |
from typing import Any, List, Set
import numpy as np
from src.featurizer.client_profile import ClientProfile
from src.featurizer.product_info import ProductInfoMapType
from src.utils import ProductEncoder
class CandidatSelector:
def __init__(
self, model: Any, global_top: Set[str], product_info_map: Pro... | [
"numpy.argsort",
"numpy.array"
] | [((2163, 2182), 'numpy.argsort', 'np.argsort', (['(-scores)'], {}), '(-scores)\n', (2173, 2182), True, 'import numpy as np\n'), ((2215, 2240), 'numpy.array', 'np.array', (['candidates_list'], {}), '(candidates_list)\n', (2223, 2240), True, 'import numpy as np\n')] |
"""
Definition of the controller class for Q learning with
lazy action model.
"""
import pickle
import time
from os import path, mkdir
import tqdm
import numpy as np
import matplotlib.pyplot as plt
from tensorflow import keras
from cvxopt.solvers import qp
from cvxopt import matrix as cvxopt_matrix
class DnnRegressor... | [
"os.mkdir",
"pickle.dump",
"numpy.abs",
"numpy.sum",
"tensorflow.keras.layers.Dense",
"numpy.mean",
"numpy.linalg.norm",
"pickle.load",
"numpy.sin",
"tensorflow.keras.layers.BatchNormalization",
"os.path.exists",
"matplotlib.pyplot.colorbar",
"numpy.max",
"tensorflow.keras.layers.Input",
... | [((1384, 1408), 'tensorflow.keras.layers.Input', 'keras.layers.Input', (['(4,)'], {}), '((4,))\n', (1402, 1408), False, 'from tensorflow import keras\n'), ((2606, 2652), 'tensorflow.keras.models.Model', 'keras.models.Model', ([], {'inputs': 'x_in', 'outputs': 'y_out'}), '(inputs=x_in, outputs=y_out)\n', (2624, 2652), F... |
# Copyright 2018 <NAME> (nikmedoed)
# Licensed under the Apache License, Version 2.0 (the «License»)
import random
from src.localisation import localisation
import os
import matplotlib.pyplot as plt
import numpy as np
import time
def save(name, fold = '', fmt='png'):
pwd = os.getcwd()
if fold != "":
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.tight_layout",
"src.localisation.localisation.loc",
"os.mkdir",
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"os.getcwd",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.legend",
"os.path.exists",
"random.random",
"numpy.arange",
"matplotlib.py... | [((282, 293), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (291, 293), False, 'import os\n'), ((558, 567), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (565, 567), True, 'import matplotlib.pyplot as plt\n'), ((578, 604), 'src.localisation.localisation.loc', 'localisation.loc', (['__file__'], {}), '(__file__)\n'... |
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn.ensemble import IsolationForest
from scipy.stats import multivariate_normal
class Build_Anomaly_Model():
def __init__(self, X, model_name, para, Y = None):
self.X = X
self.Y = Y
self.model_name = model_name
self.para = para
if model_name ... | [
"sklearn.ensemble.IsolationForest",
"numpy.log",
"numpy.argmax",
"numpy.unique",
"numpy.zeros",
"scipy.stats.multivariate_normal",
"numpy.max",
"numpy.mean",
"numpy.squeeze",
"numpy.cov",
"sklearn.cluster.DBSCAN"
] | [((370, 407), 'numpy.unique', 'np.unique', (['self.Y'], {'return_counts': '(True)'}), '(self.Y, return_counts=True)\n', (379, 407), True, 'import numpy as np\n'), ((481, 507), 'numpy.zeros', 'np.zeros', (['(self.k, self.d)'], {}), '((self.k, self.d))\n', (489, 507), True, 'import numpy as np\n'), ((524, 558), 'numpy.ze... |
# -*- coding: utf-8 -*-
import unittest
import numpy as np
import sklearn.metrics as sm
from .context import grouplasso
from grouplasso.util import sigmoid, binary_log_loss, mean_squared_error
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def test_log_loss(self):
np.random.seed(0)... | [
"unittest.main",
"numpy.random.uniform",
"numpy.random.seed",
"numpy.random.randn",
"sklearn.metrics.log_loss",
"grouplasso.util.binary_log_loss",
"numpy.random.randint",
"grouplasso.util.mean_squared_error",
"sklearn.metrics.mean_squared_error"
] | [((1001, 1016), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1014, 1016), False, 'import unittest\n'), ((303, 320), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (317, 320), True, 'import numpy as np\n'), ((362, 401), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)'], {'size': 'n_sam... |
from __future__ import print_function, division
import os
import cv2
import csv
import torch
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchv... | [
"matplotlib.pyplot.show",
"csv.reader",
"torch.utils.data.DataLoader",
"torch.nn.ReLU",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.CrossEntropyLoss",
"torchvision.utils.make_grid",
"cv2.imread",
"torch.nn.BatchNorm2d",
"numpy.random.randint",
"torch.cuda.is_available",
"torch.nn.Linear",
"... | [((621, 644), 'os.listdir', 'os.listdir', (['pathBateaux'], {}), '(pathBateaux)\n', (631, 644), False, 'import os\n'), ((656, 675), 'os.listdir', 'os.listdir', (['pathMer'], {}), '(pathMer)\n', (666, 675), False, 'import os\n'), ((691, 721), 'bateauxCsv.generateCsv', 'bateauxCsv.generateCsv', (['NUMBER'], {}), '(NUMBER... |
import numpy as np
import tensorflow as tf
from tensorflow.feature_column import numeric_column as num
from tensorflow.estimator import RunConfig
from tensorflow.contrib.distribute import MirroredStrategy
def make_tfr_input_fn(filename_pattern, batch_size, board_size, options):
N_p = board_size + 2
fea... | [
"tensorflow.estimator.export.ServingInputReceiver",
"tensorflow.reshape",
"numpy.ones",
"tensorflow.estimator.TrainSpec",
"tensorflow.estimator.Estimator",
"tensorflow.abs",
"tensorflow.data.experimental.make_batched_features_dataset",
"tensorflow.train.get_or_create_global_step",
"tensorflow.placeh... | [((4304, 4361), 'tensorflow.estimator.LatestExporter', 'tf.estimator.LatestExporter', (['"""exporter"""', 'serving_input_fn'], {}), "('exporter', serving_input_fn)\n", (4331, 4361), True, 'import tensorflow as tf\n'), ((4380, 4470), 'tensorflow.estimator.TrainSpec', 'tf.estimator.TrainSpec', ([], {'input_fn': 'train_in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.