code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegressionCV
from sklearn.decomposition import DictionaryLearning, NMF, PCA
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.preprocessing import scale, normalize
from sklearn.model_selection import G... | [
"sklearn.model_selection.GridSearchCV",
"json.loads",
"sklearn.svm.SVC",
"numpy.mean",
"numpy.shape",
"sklearn.metrics.classification_report",
"numpy.squeeze",
"numpy.array",
"sklearn.preprocessing.normalize",
"ENWrapper.ENSim",
"numpy.random.shuffle"
] | [((5401, 5467), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""', 'C': '(10)', 'verbose': '(False)', 'class_weight': '"""balanced"""'}), "(kernel='linear', C=10, verbose=False, class_weight='balanced')\n", (5404, 5467), False, 'from sklearn.svm import SVC\n'), ((1643, 1663), 'json.loads', 'json.loads', (['json_... |
# -*- coding: utf-8 -*-
"""
convert compas dataset into S, X1, X2, y quadraple
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import time
import datetime
import sys
import os
import copy
import itertools
from sklearn import svm
from sklearn import tree
from sklearn import ensemble
from sklear... | [
"pandas.read_csv",
"numpy.corrcoef",
"os.path.join",
"io.open",
"numpy.array",
"pandas.get_dummies",
"pandas.concat",
"pandas.to_datetime"
] | [((697, 770), 'os.path.join', 'os.path.join', (['conf.datadir', '"""compas-analysis/compas-scores-two-years.csv"""'], {}), "(conf.datadir, 'compas-analysis/compas-scores-two-years.csv')\n", (709, 770), False, 'import os\n'), ((956, 975), 'io.open', 'open', (['filename', '"""w"""'], {}), "(filename, 'w')\n", (960, 975),... |
# Copyright 2017 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.ops.distributions.util.gen_new_seed",
"numpy.log",
"numpy.int32",
"tensorflow.python.ops.math_ops.equal",
"tensorflow.python.ops.math_ops.range",
"tensorflow.python.framework.ops.name_scope",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.ops.array_ops.ones_like",
"... | [((1535, 1763), 'collections.namedtuple', 'collections.namedtuple', (['"""KernelResults"""', "['log_accept_ratio', 'current_grads_target_log_prob',\n 'current_target_log_prob', 'is_accepted',\n 'proposed_grads_target_log_prob', 'proposed_state',\n 'proposed_target_log_prob']"], {}), "('KernelResults', ['log_ac... |
import argparse
import logging
import os
import json
import pickle
import random
import time
import numpy as np
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler, Dataset
from transformers import AdamW, get_linear_schedule_with_warmup, set_seed
from utils import set_l... | [
"logging.getLogger",
"os.path.exists",
"utils.set_logger",
"argparse.ArgumentParser",
"os.makedirs",
"train_and_eval.train",
"os.path.join",
"processor.sentiment_convert_examples_to_features",
"numpy.array",
"torch.cuda.is_available",
"time.time",
"processor.SentimentDataset",
"logging.info"... | [((956, 983), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (973, 983), False, 'import logging\n'), ((1381, 1406), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1404, 1406), False, 'import argparse\n'), ((3947, 4014), 'os.path.join', 'os.path.join', (['args.out... |
"""The classic exhibitor of chaos, consisting of 3 coupled ODEs.
The ODEs are derived by modelling, with many simplifications,
the fluid convection between horizontal plates with different temperatures.
Its phase-plot (with typical param settings) looks like a butterfly.
See demo.py for more info.
"""
import numpy... | [
"numpy.array",
"dapper.mods.with_rk4"
] | [((478, 510), 'numpy.array', 'np.array', (['[1.509, -1.531, 25.46]'], {}), '([1.509, -1.531, 25.46])\n', (486, 510), True, 'import numpy as np\n'), ((760, 798), 'dapper.mods.with_rk4', 'modelling.with_rk4', (['dxdt'], {'autonom': '(True)'}), '(dxdt, autonom=True)\n', (778, 798), True, 'import dapper.mods as modelling\n... |
import matplotlib
#matplotlib.use('TkAgg')
from config import *
from plot_utils import *
from shared_utils import *
import pickle as pkl
import numpy as np
from collections import OrderedDict
from matplotlib import pyplot as plt
from pymc3.stats import quantiles
import os
import pandas as pd
from pathlib import Path
#... | [
"numpy.mean",
"numpy.reshape",
"pandas.DataFrame",
"matplotlib.pyplot.xticks",
"pathlib.Path",
"pandas.Timedelta",
"pickle.load",
"matplotlib.pyplot.close",
"matplotlib.pyplot.GridSpec",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"pymc3.stats.quantiles",
"pandas.Timestamp"... | [((2132, 2159), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (2142, 2159), True, 'from matplotlib import pyplot as plt\n'), ((2171, 2263), 'matplotlib.pyplot.GridSpec', 'plt.GridSpec', (['(1)', '(1)'], {'top': '(0.9)', 'bottom': '(0.2)', 'left': '(0.07)', 'right': '(0.9... |
from sklearn.decomposition import PCA
import numpy as np
import matplotlib.pyplot as plt
from .img_util import avg_spectra
def normalize(data):
""" Normalizes data by shifting origin to mean"""
orig_mean = np.mean(data, axis=0)
norm_data = data - orig_mean
return norm_data
def get_PC(im, show_plo... | [
"numpy.mean",
"numpy.abs",
"numpy.reshape",
"numpy.arange",
"sklearn.decomposition.PCA",
"numpy.argsort",
"numpy.dot",
"numpy.round"
] | [((215, 236), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (222, 236), True, 'import numpy as np\n'), ((999, 1055), 'numpy.reshape', 'np.reshape', (['im', '(im.shape[0] * im.shape[1], im.shape[2])'], {}), '(im, (im.shape[0] * im.shape[1], im.shape[2]))\n', (1009, 1055), True, 'import numpy ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 15:37:07 2020
@author: aoust
"""
import numpy as np
import math
class QuadraticPolynomial():
def __init__(self,n,tuples, coefs):
self.n = n
assert(len(tuples)==len(coefs))
self.tuples = tuples
self.coefs = coefs
... | [
"numpy.array",
"numpy.linalg.norm"
] | [((544, 564), 'numpy.array', 'np.array', (['self.coefs'], {}), '(self.coefs)\n', (552, 564), True, 'import numpy as np\n'), ((1071, 1100), 'numpy.linalg.norm', 'np.linalg.norm', (['self.coefs', '(2)'], {}), '(self.coefs, 2)\n', (1085, 1100), True, 'import numpy as np\n'), ((1174, 1203), 'numpy.linalg.norm', 'np.linalg.... |
from mwa_pb import config
from mwa_pb.beam_full_EE import ApertureArray
from mwa_pb.beam_full_EE import Beam
from pyrem.radiotelescope import ideal_gaussian_beam
import numpy as np
from scipy.constants import c
def mwa_fee_model(theta, phi, nu = 150e6):
h5filepath = config.h5file # recent version was MWA_embedde... | [
"numpy.ones",
"mwa_pb.beam_full_EE.ApertureArray",
"mwa_pb.beam_full_EE.Beam",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.isnan",
"pyrem.radiotelescope.ideal_gaussian_beam"
] | [((356, 385), 'mwa_pb.beam_full_EE.ApertureArray', 'ApertureArray', (['h5filepath', 'nu'], {}), '(h5filepath, nu)\n', (369, 385), False, 'from mwa_pb.beam_full_EE import ApertureArray\n'), ((433, 450), 'numpy.zeros', 'np.zeros', (['[2, 16]'], {}), '([2, 16])\n', (441, 450), True, 'import numpy as np\n'), ((475, 491), '... |
import warnings
import cv2
import imageio
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision
from PIL import Image
import model
import opt
import train
import pdb
def set_deterministic():
import random
import numpy
import torch
torch.manual_seed(0)
random.seed(... | [
"cv2.applyColorMap",
"torch.manual_seed",
"opt.get_opts",
"torch.load",
"imageio.mimwrite",
"random.seed",
"numpy.max",
"train.NeuralDiffSystem",
"numpy.random.seed",
"numpy.min",
"model.load_state_dict",
"torchvision.transforms.ToTensor",
"numpy.nan_to_num"
] | [((283, 303), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (300, 303), False, 'import torch\n'), ((308, 322), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (319, 322), False, 'import random\n'), ((327, 347), 'numpy.random.seed', 'numpy.random.seed', (['(0)'], {}), '(0)\n', (344, 347), False... |
import tensorflow as tf
import os
import zipfile
from os import path, getcwd, chdir
import os
train_happy_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/happy/') # the zip file had the folders called horses and humans
train_sad_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/sad/')
... | [
"keras.preprocessing.image.img_to_array",
"os.listdir",
"tensorflow.keras.optimizers.RMSprop",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"os.path.join",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.Dense",
"numpy.vstack",
"nump... | [((114, 180), 'os.path.join', 'os.path.join', (['"""/Users/seanjudelyons/Downloads/happy-or-sad/happy/"""'], {}), "('/Users/seanjudelyons/Downloads/happy-or-sad/happy/')\n", (126, 180), False, 'import os\n'), ((255, 319), 'os.path.join', 'os.path.join', (['"""/Users/seanjudelyons/Downloads/happy-or-sad/sad/"""'], {}), ... |
import numpy as np
import time
import math
# from cassie_env import CassieEnv
from cassiemujoco import *
from trajectory.trajectory import CassieTrajectory
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
from mpl_too... | [
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.load"
] | [((437, 455), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (444, 455), True, 'import numpy as np\n'), ((1148, 1160), 'matplotlib.pyplot.plot', 'plt.plot', (['[]'], {}), '([])\n', (1156, 1160), True, 'import matplotlib.pyplot as plt\n'), ((1165, 1176), 'matplotlib.pyplot.close', 'plt.close', ([], {}), ... |
from deepspeech import Model
import gradio as gr
import numpy as np
model_file_path = "deepspeech-0.8.2-models.pbmm"
lm_file_path = "deepspeech-0.8.2-models.scorer"
beam_width = 100
lm_alpha = 0.93
lm_beta = 1.18
model = Model(model_file_path)
model.enableExternalScorer(lm_file_path)
model.setScorerAlphaBeta(lm_alpha... | [
"gradio.Interface",
"deepspeech.Model",
"numpy.max"
] | [((223, 245), 'deepspeech.Model', 'Model', (['model_file_path'], {}), '(model_file_path)\n', (228, 245), False, 'from deepspeech import Model\n'), ((987, 1066), 'gradio.Interface', 'gr.Interface', (['transcribe', "['microphone', 'state']", "['text', 'state']"], {'live': '(True)'}), "(transcribe, ['microphone', 'state']... |
#!/usr/bin/python
import sys
from os.path import join,exists,dirname
import numpy as np
from numpy.random import randint
from sklearn.datasets import load_svmlight_file
from torch.autograd import Function, Variable
import torch.nn as nn
import torch.optim as optim
import torch
from torch import FloatTensor
from uda_c... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"sklearn.datasets.load_svmlight_file",
"torch.nn.Sequential",
"numpy.exp",
"sys.stderr.write",
"torch.nn.BCELoss",
"torch.cuda.is_available",
"numpy.sum",
"os.path.dirname",
"torch.nn.Linear",
"sys.exit",
"numpy.random.randint",
"torch.nn.LogSoftmax",
... | [((2921, 2946), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2944, 2946), False, 'import torch\n'), ((3248, 3307), 'sys.stderr.write', 'sys.stderr.write', (["('Reading source data from %s\\n' % args[0])"], {}), "('Reading source data from %s\\n' % args[0])\n", (3264, 3307), False, 'import sy... |
import numpy as np
def dist(x, y, norm=2):
# x: N x D
# y: M x D
n = x.shape[0]
m = y.shape[0]
d = x.shape[1]
assert d == y.shape[1]
x = np.expand_dims(x, axis=1) # (n,d)->(n,1,d)
y = np.expand_dims(y, axis=0) # (m,d)->(1,m,d)
# x = np.repeat(x, m, axis=1) # (n,1,d)->(n,m,d)
... | [
"numpy.abs",
"numpy.power",
"numpy.argmax",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.expand_dims",
"numpy.arange"
] | [((167, 192), 'numpy.expand_dims', 'np.expand_dims', (['x'], {'axis': '(1)'}), '(x, axis=1)\n', (181, 192), True, 'import numpy as np\n'), ((219, 244), 'numpy.expand_dims', 'np.expand_dims', (['y'], {'axis': '(0)'}), '(y, axis=0)\n', (233, 244), True, 'import numpy as np\n'), ((1145, 1170), 'numpy.zeros', 'np.zeros', (... |
# -*- coding: utf-8 -*-
from .Qt import QtCore, QtGui
from .Vector import Vector
from .SRTTransform import SRTTransform
import pyqtgraph as pg
import numpy as np
import scipy.linalg
class SRTTransform3D(pg.Transform3D):
"""4x4 Transform matrix that can always be represented as a combination of 3 matrices: scale * ... | [
"numpy.abs",
"pyqtgraph.Transform3D.__init__",
"GraphicsView.GraphicsView",
"numpy.cross",
"pyqtgraph.Transform3D.translate",
"pyqtgraph.Transform3D.setToIdentity",
"pyqtgraph.Vector",
"widgets.TestROI",
"pyqtgraph.Transform3D.scale",
"numpy.dot",
"pyqtgraph.Transform3D.rotate",
"numpy.arctan2... | [((8374, 8401), 'GraphicsView.GraphicsView', 'GraphicsView.GraphicsView', ([], {}), '()\n', (8399, 8401), False, 'import GraphicsView\n'), ((10192, 10244), 'widgets.TestROI', 'widgets.TestROI', (['(19, 19)', '(22, 22)'], {'invertible': '(True)'}), '((19, 19), (22, 22), invertible=True)\n', (10207, 10244), False, 'impor... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 12 12:22:38 2020
@author: emc1977
"""
import math as math
def function ( x ):
import numpy as np
#Note that here I have negatived all terms, converting the minimiser into a maximiser.
#The functino value is returned as a negative, though in reality it ... | [
"time.ctime",
"numpy.sqrt",
"math.sin",
"time.time",
"platform.python_version"
] | [((3104, 3119), 'numpy.sqrt', 'np.sqrt', (['machep'], {}), '(machep)\n', (3111, 3119), True, 'import numpy as np\n'), ((3130, 3145), 'numpy.sqrt', 'np.sqrt', (['machep'], {}), '(machep)\n', (3137, 3145), True, 'import numpy as np\n'), ((3881, 3892), 'time.time', 'time.time', ([], {}), '()\n', (3890, 3892), False, 'impo... |
import json
import numpy
import time
import pyspark
from azureml.core.model import Model
from pyspark.ml import PipelineModel
from azureml.monitoring import ModelDataCollector
from mmlspark import LightGBMRegressor
from mmlspark import LightGBMRegressionModel
def init():
try:
# One-time initialization of ... | [
"json.loads",
"pyspark.ml.PipelineModel.load",
"azureml.monitoring.ModelDataCollector",
"json.dumps",
"time.strftime",
"azureml.core.model.Model.get_model_path",
"numpy.array",
"pyspark.sql.SparkSession.builder.appName"
] | [((2187, 2217), 'json.dumps', 'json.dumps', (["{'result': result}"], {}), "({'result': result})\n", (2197, 2217), False, 'import json\n'), ((512, 603), 'azureml.monitoring.ModelDataCollector', 'ModelDataCollector', (['model_name'], {'identifier': '"""inputs"""', 'feature_names': "['json_input_data']"}), "(model_name, i... |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from distutils.version import LooseVersion
import numpy as np
import pytest
from common.layer_test_class import check_ir_version
from common.tf_layer_test_class import CommonTFLayerTest
from common.utils.tf_utils import permute_nchw_to_... | [
"tensorflow.compat.v1.placeholder",
"numpy.copy",
"common.layer_test_class.check_ir_version",
"distutils.version.LooseVersion",
"pytest.mark.skip",
"tensorflow.nn.log_softmax",
"pytest.mark.parametrize",
"openvino.tools.mo.front.common.partial_infer.utils.int64_array",
"unit_tests.utils.graph.build_... | [((5612, 5666), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params"""', 'test_data_precommit'], {}), "('params', test_data_precommit)\n", (5635, 5666), False, 'import pytest\n'), ((6395, 6439), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params"""', 'test_data'], {}), "('params', test_da... |
#! /usr/bin/env python
# Author: <NAME> (srinivas . zinka [at] gmail . com)
# Copyright (c) 2014 <NAME>
# License: New BSD License.
import numpy as np
# from mayavi import mlab
from scipy import integrate
from scipy.special import sph_harm
# adjusting "matplotlib" label fonts
from matplotlib import rc
rc('text', u... | [
"numpy.reshape",
"scipy.integrate.quad",
"numpy.array",
"numpy.zeros",
"matplotlib.rc",
"numpy.cos",
"numpy.sin"
] | [((308, 331), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (310, 331), False, 'from matplotlib import rc\n'), ((619, 652), 'numpy.zeros', 'np.zeros', (['(N, 1)'], {'dtype': '"""complex"""'}), "((N, 1), dtype='complex')\n", (627, 652), True, 'import numpy as np\n'), ((983, 10... |
import gym
from gym import core, spaces
from .gol import utils
import argparse
import itertools
import cv2
import numpy as np
import torch
from torch import ByteTensor, Tensor
from torch.nn import Conv2d, Parameter
from torch.nn.init import zeros_
from .world import World
class GameOfLifeEnv(core.Env):
def ... | [
"numpy.ones",
"gym.spaces.Discrete",
"numpy.zeros",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow"
] | [((3262, 3285), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3283, 3285), False, 'import cv2\n'), ((636, 681), 'gym.spaces.Discrete', 'spaces.Discrete', (['(self.num_tools * size * size)'], {}), '(self.num_tools * size * size)\n', (651, 681), False, 'from gym import core, spaces\n'), ((1779, 182... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"numpy.mean",
"plano.error",
"plano.stop_process",
"shlex.split",
"plano.unique_id",
"time.sleep",
"resource.getpagesize",
"numpy.array",
"plano.call",
"plano.file_size",
"os.sysconf",
"plano.start_process",
"numpy.percentile",
"time.time",
"json.dump"
] | [((16552, 16575), 'resource.getpagesize', '_resource.getpagesize', ([], {}), '()\n', (16573, 16575), True, 'import resource as _resource\n'), ((16487, 16531), 'os.sysconf', '_os.sysconf', (["_os.sysconf_names['SC_CLK_TCK']"], {}), "(_os.sysconf_names['SC_CLK_TCK'])\n", (16498, 16531), True, 'import os as _os\n'), ((481... |
import logging
import numpy as np
from numpy.linalg import norm
from scipy.stats import moment
from scipy.special import cbrt
def common_usr(molecule, ctd=None, cst=None, fct=None, ftf=None, atoms_type=None):
"""Function used in USR and USRCAT function
Parameters
----------
molecule : oddt.toolkit.M... | [
"numpy.hstack",
"numpy.column_stack",
"numpy.array",
"numpy.linalg.norm",
"numpy.mean",
"numpy.cross",
"numpy.abs",
"numpy.amin",
"numpy.nan_to_num",
"scipy.stats.moment",
"logging.warning",
"numpy.isnan",
"numpy.std",
"numpy.fabs",
"numpy.append",
"numpy.sum",
"numpy.zeros",
"nump... | [((1859, 1884), 'numpy.linalg.norm', 'norm', (['(atoms - ctd)'], {'axis': '(1)'}), '(atoms - ctd, axis=1)\n', (1863, 1884), False, 'from numpy.linalg import norm\n'), ((1970, 1995), 'numpy.linalg.norm', 'norm', (['(atoms - cst)'], {'axis': '(1)'}), '(atoms - cst, axis=1)\n', (1974, 1995), False, 'from numpy.linalg impo... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 10 13:24:45 2021
@author: admin
"""
import numpy as np
import struct
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
# 测试集文件
test_images_file = 'MNIST/t10k-images.idx3-ubyte'
# 测试集标签文件
test_labels_file = 'MNIS... | [
"struct.calcsize",
"numpy.eye",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.load",
"torch.max",
"torch.from_numpy",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"numpy.empty",
"torch.nn.Linear",
"struct.unpack_from"
] | [((727, 775), 'struct.unpack_from', 'struct.unpack_from', (['fmt_header', 'bin_data', 'offset'], {}), '(fmt_header, bin_data, offset)\n', (745, 775), False, 'import struct\n'), ((932, 959), 'struct.calcsize', 'struct.calcsize', (['fmt_header'], {}), '(fmt_header)\n', (947, 959), False, 'import struct\n'), ((1253, 1295)... |
import math
import hydrostats as hs
import hydrostats.data as hd
import numpy as np
import pandas as pd
def solve_gumbel1(std, xbar, rp):
"""
Solves the Gumbel Type I pdf = exp(-exp(-b))
where b is the covariate
"""
# xbar = statistics.mean(year_max_flow_list)
# std = statistics.stdev(year_ma... | [
"numpy.nanpercentile",
"pandas.merge",
"math.log",
"hydrostats.make_table",
"hydrostats.data.merge_data",
"pandas.DataFrame",
"numpy.transpose"
] | [((595, 643), 'hydrostats.data.merge_data', 'hd.merge_data', ([], {'sim_df': 'simulated', 'obs_df': 'observed'}), '(sim_df=simulated, obs_df=observed)\n', (608, 643), True, 'import hydrostats.data as hd\n'), ((665, 713), 'hydrostats.data.merge_data', 'hd.merge_data', ([], {'sim_df': 'corrected', 'obs_df': 'observed'}),... |
import numpy as np
from typing import Callable
from ..problem import Problem
def rescale(points, lb: np.ndarray, ub: np.ndarray) -> np.ndarray:
"""
Rescale points from [0, 1] to [lb, ub].
Parameters
----------
points: ndarray, shape=(n_starts, dim)
Points in bounds [lb, ub]
lb, ub: n... | [
"numpy.argsort",
"numpy.zeros",
"numpy.zeros_like",
"numpy.empty"
] | [((1425, 1450), 'numpy.zeros', 'np.zeros', (['(n_starts, dim)'], {}), '((n_starts, dim))\n', (1433, 1450), True, 'import numpy as np\n'), ((2119, 2145), 'numpy.zeros_like', 'np.zeros_like', (['startpoints'], {}), '(startpoints)\n', (2132, 2145), True, 'import numpy as np\n'), ((2243, 2264), 'numpy.empty', 'np.empty', (... |
import logging
import numpy as np
from luigi.util import requires
from netCDF4 import Dataset, Group, Variable
from iasi.file import CopyNetcdfFile, MoveVariables
from iasi.quadrant import Quadrant
from iasi.util import root_group_of
logger = logging.getLogger(__name__)
class CompositionException(Exception):
... | [
"logging.getLogger",
"numpy.ma.is_masked",
"iasi.quadrant.Quadrant.for_disassembly",
"iasi.util.root_group_of"
] | [((247, 274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (264, 274), False, 'import logging\n'), ((964, 989), 'iasi.util.root_group_of', 'root_group_of', (['self.group'], {}), '(self.group)\n', (977, 989), False, 'from iasi.util import root_group_of\n'), ((1727, 1790), 'iasi.quadrant.... |
import os
import cv2
import sys
import math
import pyprind
import torch
import numpy as np
import torch.tensor as Tensor
# import torch.nn.functional as F
import torchvision.transforms as transforms
import dl_modules.dataset as ds
epsilon = 0.008
def enhance_images(folder: str, denoise_strength: int,
... | [
"cv2.calcHist",
"pyprind.ProgBar",
"torch.abs",
"os.makedirs",
"numpy.ones",
"numpy.random.rand",
"torch.stack",
"cv2.filter2D",
"cv2.addWeighted",
"os.path.isdir",
"dl_modules.dataset.Dataset",
"cv2.cvtColor",
"torch.utils.data.DataLoader",
"torch.no_grad",
"torchvision.transforms.ToTen... | [((624, 703), 'dl_modules.dataset.Dataset', 'ds.Dataset', (['folder'], {'scale': 'ds.scale', 'normalization': 'transform', 'downscaling': '"""none"""'}), "(folder, scale=ds.scale, normalization=transform, downscaling='none')\n", (634, 703), True, 'import dl_modules.dataset as ds\n'), ((742, 844), 'torch.utils.data.Data... |
from typing import Tuple, List
import argparse
import random
from pathlib import Path
from itertools import chain
from functools import reduce
import cv2
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.utils import Sequence
from tensorflow.keras import optimizers as op... | [
"numpy.random.rand",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.average",
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Conv2D",
"argparse.ArgumentParser",
"tensorflow.keras.datasets.cifar10.load_data",
"numpy.empty",
"numpy.random.seed",
"tensorflow.keras.m... | [((477, 494), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (488, 494), False, 'import random\n'), ((499, 519), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (513, 519), True, 'import numpy as np\n'), ((8822, 8885), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descriptio... |
import cv2
import json
import numpy as np
from rich import print
from PIL import ImageFile
import torch
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
from constants import NORM_MEAN, NORM_STD, DPAC_AGE_LABEL_TO_IDX, DPAC_GENDER_LABEL_TO_IDX, \
DPAC_EMOTION_LABEL_TO_IDX, IMG_H... | [
"torch.manual_seed",
"numpy.reshape",
"torchvision.transforms.ToPILImage",
"torchvision.transforms.RandomHorizontalFlip",
"torch.tensor",
"torchvision.transforms.ColorJitter",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"json.load",
"cv2.resize",
"torchvision.transforms.To... | [((447, 467), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (464, 467), False, 'import torch\n'), ((6901, 7003), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'pin_memory': '(True)', 'batch_size': 'batch_size', 'shuffle': '(True)', 'num_workers': 'NUM_WORKERS'}), '(dataset, pin_memory=... |
import torch
from copy import deepcopy
import numpy as np
from .torch_triggered_dataset import TorchTriggeredDataset
from .dataset_preprocessor import datasetPreprocessor
class SCDatasetPreprocessor(datasetPreprocessor):
def __init__(self, dataset, trigger, trigger_models, tokenizer):
super().__init__(dat... | [
"numpy.unique",
"torch.stack",
"torch.exp",
"numpy.isin",
"numpy.array",
"torch.tensor",
"numpy.argwhere",
"torch.sum",
"copy.deepcopy",
"torch.no_grad",
"torch.zeros_like",
"torch.cat"
] | [((5558, 5573), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5571, 5573), False, 'import torch\n'), ((5656, 5671), 'copy.deepcopy', 'deepcopy', (['batch'], {}), '(batch)\n', (5664, 5671), False, 'from copy import deepcopy\n'), ((6169, 6195), 'torch.stack', 'torch.stack', (['probabilities'], {}), '(probabilities... |
import cv2
import time
import sys
import numpy as np
class ObjectDetection():
def __init__(self):
self.INPUT_WIDTH = 640
self.INPUT_HEIGHT = 640
self.SCORE_THRESHOLD = 0.2
self.NMS_THRESHOLD = 0.4
self.CONFIDENCE_THRESHOLD = 0.4
self.class_list = self.load_classes()... | [
"cv2.dnn.blobFromImage",
"cv2.rectangle",
"cv2.putText",
"time.time_ns",
"cv2.minMaxLoc",
"numpy.zeros",
"numpy.array",
"cv2.VideoCapture",
"cv2.dnn.NMSBoxes",
"cv2.dnn.readNet"
] | [((462, 476), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (474, 476), False, 'import time\n'), ((606, 654), 'cv2.VideoCapture', 'cv2.VideoCapture', (['self.cap_device', 'cv2.CAP_DSHOW'], {}), '(self.cap_device, cv2.CAP_DSHOW)\n', (622, 654), False, 'import cv2\n'), ((829, 947), 'cv2.dnn.readNet', 'cv2.dnn.readNet... |
# <NAME> 2014-2020
# mlxtend Machine Learning Library Extensions
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import pytest
import numpy as np
from mlxtend.externals.estimator_checks import NotFittedError
from mlxtend.utils import assert_raises
from mlxtend.regressor import StackingRegressor
from sklearn.linea... | [
"sklearn.model_selection.GridSearchCV",
"numpy.random.rand",
"sklearn.linear_model.Lasso",
"numpy.array",
"mlxtend.utils.assert_raises",
"numpy.sin",
"sklearn.ensemble.RandomForestRegressor",
"numpy.random.random",
"numpy.testing.assert_almost_equal",
"numpy.random.seed",
"scipy.sparse.csr_matri... | [((745, 762), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (759, 762), True, 'import numpy as np\n'), ((927, 937), 'numpy.sin', 'np.sin', (['X2'], {}), '(X2)\n', (933, 937), True, 'import numpy as np\n'), ((942, 962), 'numpy.random.random', 'np.random.random', (['(40)'], {}), '(40)\n', (958, 962), Tru... |
""" Features selection
- select_features (func) : features selection following method
"""
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import pandas as pd
import numpy as np
class FeatSelector(object):
"""features selection following method
- pca : use pca to redu... | [
"sklearn.decomposition.PCA",
"numpy.cumsum",
"sklearn.preprocessing.StandardScaler"
] | [((6398, 6403), 'sklearn.decomposition.PCA', 'PCA', ([], {}), '()\n', (6401, 6403), False, 'from sklearn.decomposition import PCA\n'), ((2112, 2117), 'sklearn.decomposition.PCA', 'PCA', ([], {}), '()\n', (2115, 2117), False, 'from sklearn.decomposition import PCA\n'), ((6251, 6267), 'sklearn.preprocessing.StandardScale... |
#!/usr/bin/env python
#
# Copyright 2016-present <NAME>.
#
# Licensed under the MIT License.
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://opensource.org/licenses/mit-license.html
#
# Unless required by applicable law or agreed to in writing, sof... | [
"numpy.abs",
"numpy.multiply",
"numpy.sqrt",
"json.dumps",
"util.validation.OneOfType",
"numpy.tanh",
"util.validation.MShape",
"numpy.square",
"numpy.logaddexp",
"numpy.log",
"numpy.exp",
"numpy.cosh",
"copy.deepcopy",
"warnings.warn",
"util.validation.MType",
"numpy.vectorize",
"nu... | [((1900, 1940), 'util.validation.MType', 'MType', ([], {'size': 'int', 'name': 'str', 'metric': '(str,)'}), '(size=int, name=str, metric=(str,))\n', (1905, 1940), False, 'from util.validation import MShape, MType, OneOfType\n'), ((4842, 4881), 'util.validation.MType', 'MType', ([], {'as_json': 'bool', 'beautify_json': ... |
import time
import math
from typing import Any, Dict, Sequence
from coba.utilities import PackageChecker
from coba.simulations import Context, Action
from coba.learners.core import Learner, Key
class RegCBLearner(Learner):
"""A learner using the RegCB algorithm by Foster et al.
and the online bin search ... | [
"coba.utilities.PackageChecker.sklearn",
"sklearn.preprocessing.PolynomialFeatures",
"scipy.sparse.issparse",
"math.log",
"numpy.array",
"numpy.dot",
"numpy.outer",
"numpy.char.array",
"time.time",
"sklearn.feature_extraction.FeatureHasher"
] | [((1651, 1689), 'coba.utilities.PackageChecker.sklearn', 'PackageChecker.sklearn', (['"""RegCBLearner"""'], {}), "('RegCBLearner')\n", (1673, 1689), False, 'from coba.utilities import PackageChecker\n'), ((2615, 2701), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': 'max_x_term', 'incl... |
# -*- coding: utf-8 -*-
"""
SUMMER RESEARCH 2016/2017/2018
ASSIGNMENT: Plot correlations
AUTHOR: <NAME> (<EMAIL>)
SUPERVISOR: <NAME>
VERSION: 2019-Mar-25
PURPOSE: Plot various parameters from multiple data tables while
calculating Spearman rank correlations and ... | [
"numpy.log10",
"numpy.column_stack",
"numpy.count_nonzero",
"time.ctime",
"scipy.linalg.lstsq",
"numpy.where",
"numpy.delete",
"matplotlib.pyplot.xlabel",
"numpy.asarray",
"numpy.ma.compressed",
"scipy.stats.spearmanr",
"numpy.ones",
"numpy.ma.array",
"numpy.isnan",
"warnings.filterwarni... | [((811, 869), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (834, 869), False, 'import warnings\n'), ((935, 967), 'astropy.io.ascii.read', 'ascii.read', (['"""accept_catalog.csv"""'], {}), "('accept_catalog.csv')\n", (9... |
import os
import pandas_datareader
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from tensorflow import keras
import pandas
import pandas as pd
import plotly.express as px
import pandas_datareader.data as web
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
... | [
"tensorflow.keras.layers.Input",
"numpy.reshape",
"tensorflow.keras.Model",
"pandas_datareader.data.DataReader",
"sklearn.model_selection.train_test_split",
"tensorflow.keras.layers.LSTM",
"plotly.express.line",
"tensorflow.keras.layers.Dense",
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScal... | [((3244, 3278), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (3256, 3278), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((3650, 3689), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'train_size': '(0.65... |
#!/usr/bin/python3
"""Analyse metadynamics trajectories from xtb."""
import argparse
import numpy as np
import matplotlib.pyplot as plt
import MDAnalysis as mda
import MDAnalysis.analysis.pca as pca
from MDAnalysis.lib import distances
from scipy.constants import calorie
from scipy.constants import kilo
from scipy.c... | [
"MDAnalysis.lib.distances.calc_dihedrals",
"rmsd.read_xyz",
"argparse.ArgumentParser",
"numpy.where",
"MDAnalysis.analysis.pca.PCA",
"numpy.flatnonzero",
"MDAnalysis.lib.distances.calc_bonds",
"MDAnalysis.lib.distances.calc_angles",
"numpy.array",
"numpy.isnan",
"MDAnalysis.analysis.pca.cosine_c... | [((853, 897), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (876, 897), False, 'import argparse\n'), ((1409, 1427), 'numpy.array', 'np.array', (['energies'], {}), '(energies)\n', (1417, 1427), True, 'import numpy as np\n'), ((1136, 1155), 'rmsd.read_x... |
import cv2
import tensorflow as tf
import numpy as np
OUTPUT_PATH = "../events/"
NUM_FILTERS = 10
FILTER_SIZE = (3, 3)
STRIDES = (1, 1)
def nn(input_node):
with tf.variable_scope('nn'):
w = tf.get_variable(
name='weight',
shape=[FILTER_SIZE[0], FILTER_SIZE[1], 3, NUM_FILTERS],
... | [
"tensorflow.nn.conv2d",
"tensorflow.local_variables_initializer",
"tensorflow.variable_scope",
"tensorflow.get_variable",
"tensorflow.keras.layers.Conv2D",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.layers.conv2d",
"numpy.expand_dims",
... | [((645, 750), 'tensorflow.layers.conv2d', 'tf.layers.conv2d', (['input_node', 'NUM_FILTERS', 'FILTER_SIZE'], {'strides': 'STRIDES', 'padding': '"""same"""', 'name': '"""layer"""'}), "(input_node, NUM_FILTERS, FILTER_SIZE, strides=STRIDES,\n padding='same', name='layer')\n", (661, 750), True, 'import tensorflow as tf... |
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# This python file is a library of python functions which provides modular
# common set-up commands for solving a problem in OpenCMISS.
# Each function has a range of input options and calls the appropriate
# OpenCMISS linked command... | [
"opencmiss.iron.iron.ComputationalNodeNumberGet",
"opencmiss.iron.iron.GeneratedMesh",
"opencmiss.iron.iron.CellMLEquations",
"numpy.array",
"opencmiss.iron.iron.Fields",
"os.path.exists",
"opencmiss.iron.iron.Equations",
"opencmiss.iron.iron.Region",
"opencmiss.iron.iron.Mesh",
"opencmiss.iron.ir... | [((1233, 1269), 'opencmiss.iron.iron.ComputationalNumberOfNodesGet', 'iron.ComputationalNumberOfNodesGet', ([], {}), '()\n', (1267, 1269), False, 'from opencmiss.iron import iron\n'), ((1300, 1333), 'opencmiss.iron.iron.ComputationalNodeNumberGet', 'iron.ComputationalNodeNumberGet', ([], {}), '()\n', (1331, 1333), Fals... |
# (C) <NAME>, November 2013
# License: BSD 3 clause
import numpy as np
import os
class DCG:
def __init__(self, config, n_queries, split, rank=25, relevance_methods=['rougeL']):
self.rank = rank
self.relevance_methods = relevance_methods
relevance_dir = os.path.join(config['dataset']['data'... | [
"numpy.unique",
"sklearn.metrics.average_precision_score",
"numpy.memmap",
"numpy.asarray",
"os.path.join",
"numpy.take",
"numpy.sum",
"numpy.argsort"
] | [((2287, 2304), 'numpy.unique', 'np.unique', (['y_true'], {}), '(y_true)\n', (2296, 2304), True, 'import numpy as np\n'), ((2442, 2469), 'numpy.sum', 'np.sum', (['(y_true == pos_label)'], {}), '(y_true == pos_label)\n', (2448, 2469), True, 'import numpy as np\n'), ((2522, 2548), 'numpy.take', 'np.take', (['y_true', 'or... |
"""
Copyright (c) 2016, Granular, Inc.
All rights reserved.
License: BSD 3-Clause ("BSD New" or "BSD Simplified")
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above cop... | [
"setuptools.find_packages",
"os.path.join",
"os.environ.get",
"os.path.dirname",
"numpy.get_include"
] | [((2137, 2173), 'os.environ.get', 'os.environ.get', (['"""READTHEDOCS"""', '(False)'], {}), "('READTHEDOCS', False)\n", (2151, 2173), False, 'import os\n'), ((2378, 2403), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2393, 2403), False, 'import os\n'), ((3047, 3062), 'setuptools.find_packa... |
"""A module containing functions to run MCMC using emcee."""
import numpy as np
import emcee
from eztao.ts import carma_fit, neg_param_ll, neg_fcoeff_ll
from eztao.carma import CARMA_term
from celerite import GP
def mcmc(t, y, yerr, p, q, n_walkers=32, burn_in=500, n_samples=2000, init_param=None):
"""
A sim... | [
"eztao.ts.neg_fcoeff_ll",
"numpy.median",
"numpy.hstack",
"celerite.GP",
"numpy.log",
"emcee.EnsembleSampler",
"numpy.exp",
"numpy.array",
"numpy.random.randn",
"eztao.ts.neg_param_ll",
"numpy.vectorize",
"eztao.ts.carma_fit"
] | [((2065, 2152), 'numpy.vectorize', 'np.vectorize', (['CARMA_term.fcoeffs2carma_log'], {'excluded': '[1]', 'signature': '"""(n)->(m),(k)"""'}), "(CARMA_term.fcoeffs2carma_log, excluded=[1], signature=\n '(n)->(m),(k)')\n", (2077, 2152), True, 'import numpy as np\n'), ((2377, 2395), 'celerite.GP', 'GP', (['kernel'], {... |
import os
import numpy as np
import torch
from torch.utils.data import DataLoader,TensorDataset
DATA_DIR="./dataset"
WALK=["35_01","35_02","35_03","35_04","35_05","35_06","35_07","35_08","35_09","35_10",
"35_11","35_12","35_13","35_14","35_15","35_16"]
RUN=["35_17","35_18","35_19","35_20","35_21","35_22",... | [
"numpy.ceil",
"numpy.ones",
"os.path.join",
"torch.Tensor",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"numpy.transpose",
"numpy.arange"
] | [((773, 793), 'numpy.array', 'np.array', (['timeseries'], {}), '(timeseries)\n', (781, 793), True, 'import numpy as np\n'), ((1318, 1365), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""other"""', '"""49_02.amc.4d"""'], {}), "(DATA_DIR, 'other', '49_02.amc.4d')\n", (1330, 1365), False, 'import os\n'), ((1622, 1653),... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 16 17:58:52 2018
@author: Zhaoyi.Shen
"""
import sys
sys.path.append('/home/z1s/py/lib/')
from signal_processing import lfca
import numpy as np
import scipy as sp
from scipy import io
from matplotlib import pyplot as plt
filename = '/home/z1s/rese... | [
"numpy.sqrt",
"scipy.io.loadmat",
"numpy.nanmean",
"sys.path.append",
"numpy.arange",
"numpy.mean",
"numpy.reshape",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.meshgrid",
"numpy.abs",
"numpy.ones",
"numpy.size",
"numpy.squeeze",
"numpy.cos",
"numpy.transpose",
"numpy.sum",
"nu... | [((125, 161), 'sys.path.append', 'sys.path.append', (['"""/home/z1s/py/lib/"""'], {}), "('/home/z1s/py/lib/')\n", (140, 161), False, 'import sys\n'), ((373, 393), 'scipy.io.loadmat', 'io.loadmat', (['filename'], {}), '(filename)\n', (383, 393), False, 'from scipy import io\n'), ((534, 568), 'numpy.arange', 'np.arange',... |
import torch
import numpy as np
from onnx import numpy_helper
from thop.vision.basic_hooks import zero_ops
from .counter import counter_matmul, counter_zero_ops,\
counter_conv, counter_mul, counter_norm, counter_pow,\
counter_sqrt, counter_div, counter_softmax, counter_avgpool
def onnx_counter_matmul(diction,... | [
"numpy.append",
"numpy.prod",
"numpy.array",
"numpy.delete"
] | [((463, 506), 'numpy.append', 'np.append', (['input1_dim[0:-1]', 'input2_dim[-1]'], {}), '(input1_dim[0:-1], input2_dim[-1])\n', (472, 506), True, 'import numpy as np\n'), ((2135, 2161), 'numpy.append', 'np.append', (['output_size', 'hw'], {}), '(output_size, hw)\n', (2144, 2161), True, 'import numpy as np\n'), ((8204,... |
# -*- coding: utf-8 -*-
"""
Module to simulate OH sky lines spectra.
"""
import numpy as np
import pandas as pd
from pathlib import Path
from .constants import Constants as cs
from .spectra import Spectra
from .simSpec import SpecUtil as spec_util
_PARENT_DIR = Path(__file__).resolve().parents[1]
class SkyLines(ob... | [
"pandas.Series",
"pandas.read_csv",
"pathlib.Path",
"numpy.where",
"numpy.isnan",
"pandas.DataFrame",
"numpy.zeros_like",
"numpy.arange"
] | [((977, 991), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (989, 991), True, 'import pandas as pd\n'), ((1119, 1133), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1131, 1133), True, 'import pandas as pd\n'), ((1405, 1468), 'pandas.read_csv', 'pd.read_csv', (['data_file_path'], {'delim_whitespace': '(... |
# Copyright 2021 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... | [
"numpy.ones",
"scipy.stats.norm.ppf",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"scipy.stats.norm.pdf",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((7707, 7721), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (7719, 7721), True, 'import matplotlib.pyplot as plt\n'), ((7982, 7992), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (7990, 7992), True, 'import matplotlib.pyplot as plt\n'), ((12182, 12285), 'numpy.linspace', 'np.linspace', (["... |
import typing
import numpy as np
import numba as nb
@nb.njit
def tree_bfs(
g: np.ndarray,
edge_idx: np.ndarray,
root: int,
) -> typing.Tuple[(np.ndarray, ) * 2]:
n = g[:, :2].max() + 1
parent = np.full(n, -1, np.int64)
depth = np.zeros(n, np.int64)
fifo_que = [root]
for u in fifo_que:
for v in g[e... | [
"numpy.full",
"numpy.zeros"
] | [((206, 230), 'numpy.full', 'np.full', (['n', '(-1)', 'np.int64'], {}), '(n, -1, np.int64)\n', (213, 230), True, 'import numpy as np\n'), ((241, 262), 'numpy.zeros', 'np.zeros', (['n', 'np.int64'], {}), '(n, np.int64)\n', (249, 262), True, 'import numpy as np\n')] |
'''
This demo shows how to create variable size dataset and then it creates mini-batches from this dataset so that it
calculates the likelihood of each observation sequence in every batch using vmap.
Author : <NAME> (@karalleyna)
'''
from jax import vmap, jit
from jax.random import split, randint, PRNGKey
import jax.... | [
"hmm_discrete_lib.hmm_loglikelihood_numpy",
"jax.random.PRNGKey",
"hmm_utils.hmm_sample_minibatches",
"hmm_utils.pad_sequences",
"numpy.allclose",
"jax.numpy.array",
"numpy.array",
"hmm_discrete_lib.HMMJax",
"hmm_utils.hmm_sample_n",
"jax.vmap",
"jax.random.split"
] | [((836, 873), 'jax.numpy.array', 'jnp.array', (['[[0.95, 0.05], [0.1, 0.9]]'], {}), '([[0.95, 0.05], [0.1, 0.9]])\n', (845, 873), True, 'import jax.numpy as jnp\n'), ((912, 1021), 'jax.numpy.array', 'jnp.array', (['[[1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6], [1 / 10, 1 / 10, 1 / 10, 1 / \n 10, 1 / 10, 5 / 10]]'], {... |
import torch # torch 1.9.0+cu111
import numpy as np
from compare import *
OC = 3
IN = 2
IC = 2
IH = 4
IW = 4
KH = 3
KW = 3
weight = torch.ones([OC, IC, KH, KW], dtype=torch.float32, requires_grad=False)
print(weight)
input_np = np.arange(1, IN * IC * IH * IW + 1).reshape(IN, IC, IH, IW)
input = torch.from_numpy(inpu... | [
"numpy.fromfile",
"torch.from_numpy",
"torch.nn.Conv2d",
"torch.nn.Parameter",
"numpy.arange",
"torch.ones"
] | [((134, 204), 'torch.ones', 'torch.ones', (['[OC, IC, KH, KW]'], {'dtype': 'torch.float32', 'requires_grad': '(False)'}), '([OC, IC, KH, KW], dtype=torch.float32, requires_grad=False)\n', (144, 204), False, 'import torch\n'), ((392, 452), 'torch.nn.Conv2d', 'torch.nn.Conv2d', (['IC', 'OC', '(KH, KH)'], {'stride': '(1, ... |
# This is python script for Metashape Pro. Scripts repository: https://github.com/agisoft-llc/metashape-scripts
#
# Based on https://colab.research.google.com/github/tensorflow/lucid/blob/master/notebooks/differentiable-parameterizations/style_transfer_3d.ipynb
# Modifications:
# 1. Taking into account cameras position... | [
"Metashape.app.getOpenFileName",
"lucid.modelzoo.vision_models.InceptionV1",
"lucid.optvis.style.mean_l1_loss",
"lucid.misc.io.save",
"OpenGL.GL.glGetString",
"Metashape.app.messageBox",
"io.BytesIO",
"lucid.misc.tfutil.create_session",
"Metashape.app.getExistingDirectory",
"math.atan",
"lucid.m... | [((22210, 22264), 'Metashape.app.addMenuItem', 'Metashape.app.addMenuItem', (['label', 'model_style_transfer'], {}), '(label, model_style_transfer)\n', (22235, 22264), False, 'import Metashape\n'), ((22058, 22091), 'PySide2.QtWidgets.QApplication.instance', 'QtWidgets.QApplication.instance', ([], {}), '()\n', (22089, 2... |
##
# Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved.
#
# File: lownerjohn_ellipsoid.py
#
# Purpose:
# Computes the Lowner-John inner and outer ellipsoidal
# approximations of a polytope.
#
#
# Note:
# To plot the solution the Python package pyx is required.
#
#
# References:
# [1] ... | [
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"math.log"
] | [((6568, 6583), 'numpy.array', 'numpy.array', (['Po'], {}), '(Po)\n', (6579, 6583), False, 'import numpy\n'), ((6596, 6616), 'numpy.linalg.inv', 'numpy.linalg.inv', (['Po'], {}), '(Po)\n', (6612, 6616), False, 'import numpy\n'), ((6629, 6644), 'numpy.array', 'numpy.array', (['co'], {}), '(co)\n', (6640, 6644), False, '... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import initExample
import numpy as np
from numpy import linspace
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
from pyqtgraph import MultiPlotWidget
try:
from pyqtgraph.metaarray import *
exce... | [
"numpy.random.normal",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"numpy.array",
"pyqtgraph.mkQApp",
"numpy.linspace",
"pyqtgraph.MultiPlotWidget",
"pyqtgraph.Qt.QtGui.QMainWindow"
] | [((445, 482), 'pyqtgraph.mkQApp', 'pg.mkQApp', (['"""MultiPlot Widget Example"""'], {}), "('MultiPlot Widget Example')\n", (454, 482), True, 'import pyqtgraph as pg\n'), ((488, 507), 'pyqtgraph.Qt.QtGui.QMainWindow', 'QtGui.QMainWindow', ([], {}), '()\n', (505, 507), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ... |
# get overview of data
# read data from given files, and produce a reduced image of each data file
import argparse
import logging
import math
import os
import shutil
import subprocess
from typing import Any, Dict, List, Optional
import h5py
import nibabel as nib
import numpy as np
from PIL import Image
from tqdm impo... | [
"math.floor",
"numpy.array",
"logging.info",
"numpy.arange",
"os.path.exists",
"argparse.ArgumentParser",
"AssistedVolumeSegmentation.common.get_file_list",
"AssistedVolumeSegmentation.common.init_logging",
"subprocess.run",
"numpy.stack",
"numpy.min",
"AssistedVolumeSegmentation.common.get_fu... | [((4654, 4668), 'numpy.min', 'np.min', (['ratios'], {}), '(ratios)\n', (4660, 4668), True, 'import numpy as np\n'), ((4717, 4754), 'math.ceil', 'math.ceil', (['(input_count * reduce_ratio)'], {}), '(input_count * reduce_ratio)\n', (4726, 4754), False, 'import math\n'), ((5088, 5259), 'logging.info', 'logging.info', (["... |
# -*- coding: utf-8 -*-
' a module for conducting the statistical analysis '
__author__ = '<NAME>'
import numpy as np
from scipy.stats import ttest_1samp, ttest_rel, ttest_ind
from neurora.stuff import permutation_test
' a function for conducting the statistical analysis for results of EEG-like data '
def stats(c... | [
"neurora.stuff.permutation_test",
"numpy.log",
"numpy.zeros",
"scipy.stats.ttest_rel",
"scipy.stats.ttest_ind",
"scipy.stats.ttest_1samp",
"numpy.shape"
] | [((1693, 1732), 'numpy.zeros', 'np.zeros', (['[chls, ts, 2]'], {'dtype': 'np.float'}), '([chls, ts, 2], dtype=np.float)\n', (1701, 1732), True, 'import numpy as np\n'), ((3838, 3882), 'numpy.zeros', 'np.zeros', (['[n_x, n_y, n_z, 2]'], {'dtype': 'np.float'}), '([n_x, n_y, n_z, 2], dtype=np.float)\n', (3846, 3882), True... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from extensions.ops.elementwise import Round
from mo.graph.graph import Node
from unit_tests.utils.graph import build_graph
def round_test_graph(nodes_attributes, value, mode: str):
graph = build... | [
"numpy.array",
"extensions.ops.elementwise.Round.infer",
"mo.graph.graph.Node",
"unit_tests.utils.graph.build_graph"
] | [((315, 531), 'unit_tests.utils.graph.build_graph', 'build_graph', (['nodes_attributes', "[('node_1', 'elementwise_node'), ('elementwise_node', 'node_3')]", "{'node_1': {'value': value}, 'elementwise_node': {'op': 'Round', 'mode':\n mode}, 'node_3': {'value': None}}"], {}), "(nodes_attributes, [('node_1', 'elementwi... |
from typing import Dict, List
from dataclasses import dataclass, field
import tvm
from tvm import relay
import pickle
import random
import numpy as np
import random
from copy import deepcopy
from .tvmpass import PassDependenceGraph, PassNode
# TODO: Add parameters.
# TODO: Add more passes.
_RELAY_FUNCTION_HARD_PASSE... | [
"tvm.parser.fromtext",
"tvm.rocm",
"tvm.relay.TensorType",
"tvm.cpu",
"pickle.dump",
"numpy.random.chisquare",
"tvm.nd.array",
"pickle.load",
"tvm.relay.ty.is_dynamic",
"tvm.relay.frontend.from_keras",
"numpy.zeros",
"numpy.random.uniform",
"copy.deepcopy",
"tvm.cuda",
"tvm.target.Target... | [((1532, 1557), 'tvm.target.Target', 'tvm.target.Target', (['"""llvm"""'], {}), "('llvm')\n", (1549, 1557), False, 'import tvm\n'), ((4246, 4273), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (4251, 4273), False, 'from dataclasses import dataclass, field\n'), ((2968, 2977... |
import os
import argparse
import matplotlib.pyplot as plt
from datetime import datetime, timedelta, date
import nottingham_covid_modelling.lib.priors as priors
import numpy as np
import pints
from nottingham_covid_modelling import MODULE_DIR
# Load project modules
from nottingham_covid_modelling.lib._command_line_args... | [
"nottingham_covid_modelling.lib.priors.get_good_starting_point",
"pints.OptimisationController",
"numpy.ones",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"nottingham_covid_modelling.lib.settings.Params",
"numpy.asarray",
"numpy.max",
"numpy.argsort",
"numpy.errstate",
"pints.Rec... | [((1714, 1739), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1737, 1739), False, 'import argparse\n'), ((3547, 3566), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (3561, 3566), True, 'import numpy as np\n'), ((3651, 3659), 'nottingham_covid_modelling.lib.settings.Params... |
# ライブラリのインポート
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import gym
from gym import spaces
# gym.Envを継承したEasyMazeクラス
class EasyMaze(gym.Env):
# この環境ではrenderのモードとしてrgb_arrayのみを用意していることを宣言しておく
# GymのWrapperなどから参照される可能性がある
metadata = {'render.modes': ['rgb_array']}... | [
"matplotlib.patches.Rectangle",
"numpy.roll",
"gym.spaces.Discrete",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes"
] | [((2840, 2862), 'gym.spaces.Discrete', 'gym.spaces.Discrete', (['(4)'], {}), '(4)\n', (2859, 2862), False, 'import gym\n'), ((2933, 2956), 'gym.spaces.Discrete', 'gym.spaces.Discrete', (['(12)'], {}), '(12)\n', (2952, 2956), False, 'import gym\n'), ((3973, 4008), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize... |
#
# Copyright 1993-2017 NVIDIA Corporation. All rights reserved.
#
# NOTICE TO LICENSEE:
#
# This source code and/or documentation ("Licensed Deliverables") are
# subject to NVIDIA intellectual property rights under U.S. and
# international Copyright laws.
#
# These Licensed Deliverables contained herein is PROPRIETAR... | [
"pycuda.driver.mem_alloc",
"pycuda.driver.pagelocked_empty",
"pycuda.driver.Stream",
"tensorrt.infer.ConsoleLogger",
"tensorrt.parsers.uffparser.create_uff_parser",
"lenet5.learn",
"pycuda.driver.memcpy_htod_async",
"numpy.argmax",
"os.path.realpath",
"uff.from_tensorflow",
"tensorrt.utils.uff_t... | [((3442, 3493), 'tensorrt.infer.ConsoleLogger', 'trt.infer.ConsoleLogger', (['trt.infer.LogSeverity.INFO'], {}), '(trt.infer.LogSeverity.INFO)\n', (3465, 3493), True, 'import tensorrt as trt\n'), ((4073, 4123), 'pycuda.driver.pagelocked_empty', 'cuda.pagelocked_empty', (['elt_count'], {'dtype': 'np.float32'}), '(elt_co... |
'''
This file contains a set of functions to plot models for Matisse. Including
- Map of ScS, SKS and SKKS data
- Global map of the Trigonal domains
- Regional view showing phases and domains
- Global view showing Reciever Side corrections
- Regional map showing the number of ScS, SKS and SKKS paths in each domain f... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"cartopy.crs.PlateCarree",
"numpy.isin",
"matplotlib.collections.PatchCollection",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.colorbar.make_axes",
"numpy.zeros",
"numpy.loadtxt",
"numpy.rad2deg",
"cartopy.feature.GSHHSFeature",
... | [((698, 716), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (714, 716), True, 'import cartopy.crs as ccrs\n'), ((1609, 1641), 'matplotlib.collections.PatchCollection', 'PatchCollection', (['trig'], {'alpha': '(0.6)'}), '(trig, alpha=0.6)\n', (1624, 1641), False, 'from matplotlib.collections import Pa... |
# -*- coding: utf-8 -*-
import warnings
from contextlib import redirect_stderr, redirect_stdout, suppress
from copy import deepcopy
from logging import Logger, LogRecord
from os import devnull
from typing import Optional, Sequence, Sized, Tuple, TypeVar
import numpy as np
import pandas as pd
import sklearn.datasets
fr... | [
"pandas.Series",
"contextlib.redirect_stdout",
"copy.deepcopy",
"pada.utils.log.logger.addFilter",
"numpy.asarray",
"numpy.ndim",
"numpy.any",
"warnings.catch_warnings",
"contextlib.redirect_stderr",
"warnings.simplefilter",
"numpy.isnan",
"contextlib.suppress",
"pada.utils.log.logger.remove... | [((2642, 2655), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (2649, 2655), False, 'from typing import Optional, Sequence, Sized, Tuple, TypeVar\n'), ((3522, 3539), 'funcy.complement', 'complement', (['falsy'], {}), '(falsy)\n', (3532, 3539), False, 'from funcy import complement, decorator, lfilter\n'), ... |
"""Create example plot with different metrics.
Example
-------
python docs/stats_explainer.py
"""
import matplotlib.pyplot as plt
import numpy as np
from asreviewcontrib.insights.plot import _fix_start_tick
# The recall at a given number of documents read is the fraction of the
# relevant records found at that mo... | [
"numpy.sum",
"numpy.linspace",
"asreviewcontrib.insights.plot._fix_start_tick",
"numpy.cumsum",
"matplotlib.pyplot.subplots",
"numpy.round"
] | [((919, 953), 'numpy.round', 'np.round', (['(percentages * n_pos_docs)'], {}), '(percentages * n_pos_docs)\n', (927, 953), True, 'import numpy as np\n'), ((1135, 1149), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1147, 1149), True, 'import matplotlib.pyplot as plt\n'), ((2102, 2121), 'asreviewcontr... |
# Lint as: python3
# Copyright 2018 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 ... | [
"lingvo.core.optimizer.Adam.Params",
"lingvo.compat.zeros",
"lingvo.core.optimizer.Accumulator.Params",
"lingvo.core.layers.ProjectionLayer.Params",
"lingvo.core.optimizer.RMSProp.Params",
"lingvo.core.py_utils.GetOrCreateGlobalStepVar",
"lingvo.core.py_utils.ComputeGradients",
"numpy.random.seed",
... | [((7285, 7312), 'lingvo.core.py_utils.SetEagerMode', 'py_utils.SetEagerMode', (['(True)'], {}), '(True)\n', (7306, 7312), False, 'from lingvo.core import py_utils\n'), ((7315, 7329), 'lingvo.compat.test.main', 'tf.test.main', ([], {}), '()\n', (7327, 7329), True, 'import lingvo.compat as tf\n'), ((1068, 1111), 'lingvo.... |
from os import urandom
import numpy as np
s1 = '''
11111
19991
19191
19991
11111'''
sampleIn = '''
5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526'''
realIn = '''
4438624262
6263251864
2618812434
2134264565
1815131247
2612457325
8585767584
7217134556
2825... | [
"numpy.count_nonzero",
"numpy.array",
"numpy.copy",
"numpy.where"
] | [((478, 489), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (486, 489), True, 'import numpy as np\n'), ((1925, 1936), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (1933, 1936), True, 'import numpy as np\n'), ((656, 669), 'numpy.copy', 'np.copy', (['newA'], {}), '(newA)\n', (663, 669), True, 'import numpy as np\n... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
Authors: <NAME> | https://parshanpakiman.github.io/homepage/
<NAME> | https://selvan.people.uic.edu/
Licensing Information: The MIT License
----------------... | [
"utils.mean_confidence_interval",
"numpy.less_equal",
"utils.make_text_bold",
"numpy.zeros_like",
"numpy.empty",
"numpy.linalg.lstsq",
"numpy.nonzero",
"warnings.simplefilter",
"numpy.maximum",
"time.time",
"utils.output_handler_option_pricing"
] | [((649, 714), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {'category': 'NumbaDeprecationWarning'}), "('ignore', category=NumbaDeprecationWarning)\n", (670, 714), False, 'import warnings\n'), ((715, 787), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {'category': 'NumbaPen... |
import logging
import os
import numpy as np
import pandas as pd
import sqlalchemy
from cached_property import cached_property
from scipy.interpolate import interp1d
from aqueduct.errors import Error
class RiskService(object):
def __init__(self, user_selections):
# DB Connection
self.engine = sql... | [
"pandas.Series",
"sqlalchemy.Table",
"os.getenv",
"numpy.flipud",
"numpy.where",
"scipy.interpolate.interp1d",
"numpy.append",
"sqlalchemy.MetaData",
"numpy.array",
"numpy.linspace",
"pandas.concat",
"pandas.melt",
"pandas.DataFrame",
"logging.info",
"numpy.atleast_1d"
] | [((393, 430), 'sqlalchemy.MetaData', 'sqlalchemy.MetaData', ([], {'bind': 'self.engine'}), '(bind=self.engine)\n', (412, 430), False, 'import sqlalchemy\n'), ((6995, 7027), 'logging.info', 'logging.info', (['"""[RISK]: lp_curve"""'], {}), "('[RISK]: lp_curve')\n", (7007, 7027), False, 'import logging\n'), ((9216, 9261)... |
"""Schefel26 1981 dataset tests.
Scientific Machine Learning Benchmark:
A benchmark of regression models in chem- and materials informatics.
(c) <NAME> 2020, Citrine Informatics.
"""
import pytest
import numpy as np
import smlb
def test_schwefel26_1981_examples():
"""Tests instantiating and evaluating Schwef... | [
"numpy.asfarray",
"datasets.synthetic.schwefel26_1981.schwefel26_1981.Schwefel261981Data",
"pytest.raises"
] | [((442, 474), 'datasets.synthetic.schwefel26_1981.schwefel26_1981.Schwefel261981Data', 'Schwefel261981Data', ([], {'dimensions': '(1)'}), '(dimensions=1)\n', (460, 474), False, 'from datasets.synthetic.schwefel26_1981.schwefel26_1981 import Schwefel261981Data\n'), ((484, 516), 'datasets.synthetic.schwefel26_1981.schwef... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Evaluate the logs of a random run."""
import json
from pathlib import Path
import humanize
import numpy as np
from absl import app, flags
... | [
"absl.app.UsageError",
"compiler_gym.util.logs.ProgressLogEntry.from_csv",
"pathlib.Path",
"compiler_gym.util.statistics.geometric_mean",
"absl.app.run",
"numpy.array",
"humanize.naturaldelta",
"json.load",
"humanize.intcomma",
"compiler_gym.util.tabulate.tabulate"
] | [((3583, 3596), 'absl.app.run', 'app.run', (['main'], {}), '(main)\n', (3590, 3596), False, 'from absl import app, flags\n'), ((1303, 1345), 'compiler_gym.util.logs.ProgressLogEntry.from_csv', 'logs.ProgressLogEntry.from_csv', (['final_line'], {}), '(final_line)\n', (1333, 1345), False, 'from compiler_gym.util import l... |
"""
Objetivo: Resolver questão 1 do segundo laboratorio.
"""
from math import exp
import matplotlib.pyplot as plt
import numpy as np
def f(n): #Calcula o valor de um I passado
e = exp(1)
I = (1 / e) * (e - 1) #I0
soma = 0
for c in range(0, n + 1): #Calcula cada I ate In de maneira sucessiva
... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"math.exp",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((485, 505), 'numpy.arange', 'np.arange', (['(0)', '(301)', '(1)'], {}), '(0, 301, 1)\n', (494, 505), True, 'import numpy as np\n'), ((609, 632), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (622, 632), True, 'import matplotlib.pyplot as plt\n'), ((633, 659), 'matplotlib.pypl... |
import numpy as np
import pandas as pd
from tensorflow import keras
from ENUtransform import WGS84toENU, ENUtoWGS84
from PythonCode.Trajectory_Prediction.process import scale_data, reshape_data, get_inverse_transform
tREF = {"lon": 12.114733,
"lat": 54.145409,
"ECEF": np.array([[3660725], [7857... | [
"ENUtransform.WGS84toENU",
"PythonCode.Trajectory_Prediction.process.get_inverse_transform",
"pandas.read_csv",
"numpy.array",
"tensorflow.keras.models.load_model",
"PythonCode.Trajectory_Prediction.process.scale_data",
"numpy.full",
"numpy.transpose"
] | [((600, 723), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (["('/home/sing_sd/Desktop/anomaly_detection/PythonCode/Trajectory_Prediction/' +\n model_name)"], {}), "(\n '/home/sing_sd/Desktop/anomaly_detection/PythonCode/Trajectory_Prediction/'\n + model_name)\n", (623, 723), False, 'from t... |
import unittest
import numpy as np
import matplotlib
matplotlib.use('Agg')
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal
from openmdao.utils.testing_utils import use_tempdirs
import dymos as dm
class _BrachistochroneTestODE(om.ExplicitComponent):
def initialize(self):
... | [
"numpy.reshape",
"numpy.ones",
"matplotlib.use",
"dymos.Phase",
"unittest.main",
"dymos.GaussLobatto",
"openmdao.api.Group",
"openmdao.api.DirectSolver",
"numpy.zeros",
"numpy.cos",
"openmdao.utils.assert_utils.assert_near_equal",
"openmdao.api.ScipyOptimizeDriver",
"numpy.sin",
"dymos.Rad... | [((54, 75), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (68, 75), False, 'import matplotlib\n'), ((9739, 9754), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9752, 9754), False, 'import unittest\n'), ((1538, 1574), 'numpy.arange', 'np.arange', (["self.options['num_nodes']"], {}), "(self... |
#!/usr/bin/env python3
# Author: <NAME> (<EMAIL>)
# License: BSD-3-Clause
import logging, os, time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy.time import Time
from astropy import constants as const
from astropy import units as u
from astropy.cosmology import FlatLambdaCDM
imp... | [
"logging.getLogger",
"numpy.log10",
"matplotlib.pyplot.savefig",
"matplotlib.rcParams.update",
"pandas.read_csv",
"os.path.join",
"astropy.cosmology.FlatLambdaCDM",
"os.path.dirname",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.subplot",... | [((443, 481), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (['nice_fonts'], {}), '(nice_fonts)\n', (469, 481), False, 'import matplotlib\n'), ((503, 532), 'astropy.cosmology.FlatLambdaCDM', 'FlatLambdaCDM', ([], {'H0': '(70)', 'Om0': '(0.3)'}), '(H0=70, Om0=0.3)\n', (516, 532), False, 'from astropy.cosmo... |
"""
Tests the Critical Line Algorithm (CLA).
"""
import unittest
import os
import numpy as np
import pandas as pd
from mlfinlab.portfolio_optimization.cla import CLA
from mlfinlab.portfolio_optimization.returns_estimators import ReturnsEstimation
class TestCLA(unittest.TestCase):
# pylint: disable=too-many-publi... | [
"pandas.read_csv",
"mlfinlab.portfolio_optimization.cla.CLA",
"os.path.dirname",
"numpy.sum",
"mlfinlab.portfolio_optimization.returns_estimators.ReturnsEstimation"
] | [((513, 538), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (528, 538), False, 'import os\n'), ((624, 682), 'pandas.read_csv', 'pd.read_csv', (['data_path'], {'parse_dates': '(True)', 'index_col': '"""Date"""'}), "(data_path, parse_dates=True, index_col='Date')\n", (635, 682), True, 'import ... |
"""MolecularAI Implementation of sample generation, randomizing scaffolds as well as fetching unique sample sequences
The source of this file is
https://raw.githubusercontent.com/MolecularAI/Reinvent/982b26dd6cfeb8aa84b6d7e4a8c2a7edde2bad36/running_modes/lib_invent/rl_actions/sample_model.py
and it was only minimally ... | [
"logging.getLogger",
"logging.NullHandler",
"reinvent_chemistry.library_design.AttachmentPoints",
"numpy.array",
"reinvent_models.lib_invent.models.dataset.Dataset",
"reinvent_chemistry.library_design.BondMaker",
"reinvent_chemistry.utils.get_indices_of_unique_smiles",
"reinvent_chemistry.Conversions"... | [((800, 827), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (817, 827), False, 'import logging\n'), ((846, 867), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (865, 867), False, 'import logging\n'), ((1400, 1411), 'reinvent_chemistry.library_design.BondMaker', 'BondMake... |
import itertools
import logging
import numpy as np
import pandas as pd
import scipy.stats
def create_regression_dataset(metafeatures, experiments):
X = []
X_indices = []
Y = []
for dataset_name in experiments:
experiment = experiments[dataset_name]
mf = metafeatures.loc[dataset_name]
... | [
"pandas.Series",
"numpy.hstack",
"itertools.combinations_with_replacement",
"numpy.isfinite",
"pandas.DataFrame",
"itertools.permutations",
"logging.info",
"numpy.random.RandomState"
] | [((655, 687), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'index': 'X_indices'}), '(X, index=X_indices)\n', (667, 687), True, 'import pandas as pd\n'), ((696, 728), 'pandas.DataFrame', 'pd.DataFrame', (['Y'], {'index': 'X_indices'}), '(Y, index=X_indices)\n', (708, 728), True, 'import pandas as pd\n'), ((733, 768), 'l... |
"""
Copyright (c) 2018, National Institute of Informatics
All rights reserved.
Author: <NAME>
-----------------------------------------------------
Script for evaluating the network on full-size dataset using the LDA classifier
"""
import argparse
import os
import random
import torch
import torch.nn as... | [
"torch.nn.ReLU",
"torchvision.models.vgg19",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.BatchNorm2d",
"argparse.ArgumentParser",
"torch.mean",
"numpy.vstack",
"numpy.concatenate",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable",
"torchvision.transforms.Normalize",
"torc... | [((863, 888), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (886, 888), False, 'import argparse\n'), ((1901, 1933), 'os.path.join', 'os.path.join', (['opt.outf', 'opt.name'], {}), '(opt.outf, opt.name)\n', (1913, 1933), False, 'import os\n'), ((3101, 3130), 'torchvision.models.vgg19', 'models.... |
#!/usr/bin/env python3
# encoding: utf-8
# Copyright 2020 Nagoya University (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
# Calculate MCD using converted waveform.
import argparse
import fnmatch
import multiprocessing as mp
import os
import numpy as np
import pysptk
import pyworld as pw
impor... | [
"numpy.log10",
"numpy.sqrt",
"multiprocessing.Process",
"numpy.log",
"numpy.array_split",
"numpy.array",
"os.walk",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.where",
"os.path.split",
"pyworld.d4c",
"scipy.signal.firwin",
"pyworld.harvest",
"scipy.io.wavfile.read",
"multiprocessin... | [((805, 840), 'os.walk', 'os.walk', (['root_dir'], {'followlinks': '(True)'}), '(root_dir, followlinks=True)\n', (812, 840), False, 'import os\n'), ((1464, 1505), 'scipy.signal.firwin', 'firwin', (['(255)', 'norm_cutoff'], {'pass_zero': '(False)'}), '(255, norm_cutoff, pass_zero=False)\n', (1470, 1505), False, 'from sc... |
#!/usr/bin/env python
# coding: utf-8
import logging
import os
import pickle
import shutil
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from lightautoml.automl.presets.text_presets import TabularNLPAutoML
from lightautoml.ta... | [
"logging.basicConfig",
"lightautoml.automl.presets.text_presets.TabularNLPAutoML",
"lightautoml.tasks.Task",
"pickle.dump",
"logging.debug",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"pickle.load",
"sklearn.metrics.mean_squared_error",
"numpy.isnan",
"numpy.random.seed",
"... | [((365, 383), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (379, 383), True, 'import numpy as np\n'), ((388, 485), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s] (%(levelname)s): %(message)s"""', 'level': 'logging.DEBUG'}), "(format='[%(asctime)s] (%(levelname)s): %(... |
import tensorflow as tf
import cv2
import time
import argparse
import torch
from omegaconf import OmegaConf
from models.networks.LSTM import LSTM
import numpy as np
import posenet
#csvへの書き込み
import csv
import pprint
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=int, default=101)
parser.add_a... | [
"argparse.ArgumentParser",
"posenet.draw_skel_and_kp",
"tensorflow.Session",
"csv.writer",
"posenet.read_cap",
"omegaconf.OmegaConf.load",
"cv2.imshow",
"posenet.load_model",
"cv2.waitKey",
"numpy.array",
"cv2.VideoCapture",
"models.networks.LSTM.LSTM",
"time.time"
] | [((228, 253), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (251, 253), False, 'import argparse\n'), ((695, 743), 'omegaconf.OmegaConf.load', 'OmegaConf.load', (['"""./configs/project/default.yaml"""'], {}), "('./configs/project/default.yaml')\n", (709, 743), False, 'from omegaconf import Omeg... |
import numpy as np
from neural import LSTM_WindTurbine
from neural import LSTM_PvSystem
from neural import LSTM_LedSystem
from neural import LSTM_LoadStationSystem
from neural.example import LSTM
# WIND TURBINE SYSTEM functions
def predictPw(forecastHours, visualize):
val = LSTM_WindTurbine.LSTM_RUN(
"dat... | [
"numpy.random.rand",
"neural.example.LSTM.LSTM_RUN",
"neural.LSTM_PvSystem.LSTM_RUN",
"neural.LSTM_LoadStationSystem.LSTM_RUN",
"neural.LSTM_LedSystem.LSTM_RUN",
"numpy.random.randint",
"neural.LSTM_WindTurbine.LSTM_RUN"
] | [((281, 366), 'neural.LSTM_WindTurbine.LSTM_RUN', 'LSTM_WindTurbine.LSTM_RUN', (['"""data/dummy/WindTurbine.csv"""', 'forecastHours', 'visualize'], {}), "('data/dummy/WindTurbine.csv', forecastHours,\n visualize)\n", (306, 366), False, 'from neural import LSTM_WindTurbine\n'), ((430, 485), 'neural.LSTM_WindTurbine.L... |
import unittest
import numpy as np
from audiomentations.augmentations.transforms import Mp3Compression
from audiomentations.core.composition import Compose
class TestMp3Compression(unittest.TestCase):
def test_apply_mp3_compression_pydub(self):
sample_len = 44100
samples_in = np.random.normal(0,... | [
"audiomentations.augmentations.transforms.Mp3Compression",
"numpy.random.normal"
] | [((2606, 2654), 'audiomentations.augmentations.transforms.Mp3Compression', 'Mp3Compression', ([], {'min_bitrate': '(400)', 'max_bitrate': '(800)'}), '(min_bitrate=400, max_bitrate=800)\n', (2620, 2654), False, 'from audiomentations.augmentations.transforms import Mp3Compression\n'), ((2720, 2764), 'audiomentations.augm... |
import numpy as np
import tensorflow as tf
class Model:
"""Model class
Used for storing methods that generalize to all models.
"""
def __init__(
self,
initial_conditions=None,
model_parameters=None,
final_time=None,
time_steps=None):
... | [
"tensorflow.unstack",
"tensorflow.tensor",
"tensorflow.tanh",
"tensorflow.Session",
"numpy.array",
"numpy.linspace",
"tensorflow.constant",
"tensorflow.cosh",
"tensorflow.exp",
"tensorflow.stack"
] | [((1080, 1115), 'tensorflow.constant', 'tf.constant', (['arg1'], {'dtype': 'tf.float64'}), '(arg1, dtype=tf.float64)\n', (1091, 1115), True, 'import tensorflow as tf\n'), ((2002, 2054), 'numpy.linspace', 'np.linspace', (['(0)', 'self.final_time'], {'num': 'self.time_steps'}), '(0, self.final_time, num=self.time_steps)\... |
import numpy as np
def load_synth_spectra(regridded=True, small=False, npca=10,\
noise=False, SN=10, datapath=None,\
wave_split=None, boss=False, hetsced=False,
bossnoise=False, test=False):
if datapath is None:
datapath = "/net/vdesk/d... | [
"sklearn.model_selection.train_test_split",
"numpy.median",
"numpy.load",
"numpy.zeros"
] | [((5769, 5786), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (5776, 5786), True, 'import numpy as np\n'), ((6135, 6209), 'sklearn.model_selection.train_test_split', 'train_test_split', (['attributes', 'targets'], {'test_size': 'rest_size', 'random_state': '(0)'}), '(attributes, targets, test_size=rest_s... |
import argparse
import configparser
import torch
import os
import numpy as np
import matplotlib.animation as animation
import matplotlib.pyplot as plt
from model import ValueNetwork
from env import ENV
from train import run_one_episode
def visualize(model_config, env_config, weight_path, case, save):
state_dim = ... | [
"matplotlib.pyplot.Rectangle",
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"train.run_one_episode",
"torch.load",
"numpy.sin",
"os.path.join",
"env.ENV",
"matplotlib.pyplot.Line2D",
"numpy.cos",
"model.ValueNetwork",
"configparser.RawConfigParser",
"mat... | [((1020, 1039), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (1032, 1039), False, 'import torch\n'), ((1055, 1091), 'env.ENV', 'ENV', ([], {'config': 'env_config', 'phase': '"""test"""'}), "(config=env_config, phase='test')\n", (1058, 1091), False, 'from env import ENV\n'), ((1129, 1215), 'model.Va... |
# -*- coding: utf-8 -*-
"""
Created on Tue 26 March 18:44:45 2020
@author: Mnemosyne
Vocal learning model results (plots of)
"""
import os
import time
import glob
import pickle
import numpy as np
import matplotlib
import librosa
from matplotlib import rcParams, cm, colors
import matplotlib.pyplot as plt
import matpl... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.sin",
"numpy.arange",
"librosa.load",
"numpy.mean",
"numpy.histogram",
"argparse.ArgumentParser",
"numpy.where",
"matplotlib.pyplot.xlabel",
"songbird_data_analysis.Song_functions.smooth_data",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.... | [((661, 703), 'numpy.sqrt', 'np.sqrt', (['(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)'], {}), '(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)\n', (668, 703), True, 'import numpy as np\n'), ((859, 901), 'numpy.sqrt', 'np.sqrt', (['(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)'], {}), '(v[0] ** 2 + v[1] ** 2 + v[2] ** 2)\n', (866, 901), True, 'impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 8 17:13:10 2018
@author: quinn
"""
import h5py
import json
import numpy as np
from model import model
## Section on reading weights
def read_weights(weights):
out = {}
if isinstance(weights, h5py.Dataset):
return np.asarray(wei... | [
"numpy.asarray",
"model.model",
"argparse.ArgumentParser",
"h5py.File"
] | [((1473, 1484), 'model.model', 'model', (['name'], {}), '(name)\n', (1478, 1484), False, 'from model import model\n'), ((1496, 1515), 'h5py.File', 'h5py.File', (['filename'], {}), '(filename)\n', (1505, 1515), False, 'import h5py\n'), ((2758, 2869), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descripti... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
# This file is part of S4D.
#
# SD4 is a python package for speaker diarization based on SIDEKIT.
# S4D home page: http://www-lium.univ-lemans.fr/s4d/
# SIDEKIT home page: http://www-lium.univ-lemans.fr/sidekit/
#
# S4D is free software: you can redistribute it and/or m... | [
"numpy.ones",
"os.path.splitext",
"sidekit.features_server.FeaturesServer",
"os.path.dirname",
"os.path.basename",
"re.sub",
"sidekit.features_extractor.FeaturesExtractor",
"logging.info",
"logging.error"
] | [((1528, 1551), 're.sub', 're.sub', (['"""_+"""', '"""_"""', 'name'], {}), "('_+', '_', name)\n", (1534, 1551), False, 'import re\n'), ((1764, 1790), 'os.path.splitext', 'os.path.splitext', (['fullpath'], {}), '(fullpath)\n', (1780, 1790), False, 'import os\n'), ((1981, 1999), 'os.path.dirname', 'os.path.dirname', (['p... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from a2c_ppo_acktr.distributions import Bernoulli, Categorical, DiagGaussian
from a2c_ppo_acktr.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Policy(nn.Module):
... | [
"torch.nn.ReLU",
"torch.nn.linear",
"numpy.sqrt",
"torch.nn.Tanh",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"a2c_ppo_acktr.distributions.Bernoulli",
"torch.nn.Conv2d",
"torch.nn.init.orthogonal_",
"a2c_ppo_acktr.distributions.Categorical",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"t... | [((8491, 8500), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (8498, 8500), True, 'import torch.nn as nn\n'), ((10155, 10175), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2, 2)'], {}), '((2, 2))\n', (10167, 10175), True, 'import torch.nn as nn\n'), ((10523, 10540), 'torch.nn.ModuleList', 'nn.ModuleList', (['[]'], {}), '(... |
from enum import Enum
import os
import pygame
import pygame.gfxdraw
import pygame.ftfont
import pygame.image
import pygame.transform
import numpy as np
import game_logic as game
from square_rect import SquareRect
from config import config
SQUARESIZE = 100
HALF_SQUARE = int(SQUARESIZE / 2)
RADIUS = int(HALF_SQUARE - ... | [
"numpy.flip",
"pygame.display.set_mode",
"square_rect.SquareRect",
"os.environ.get",
"pygame.image.load",
"pygame.draw.rect",
"pygame.ftfont.init",
"square_rect.SquareRect.from_rect"
] | [((641, 661), 'pygame.ftfont.init', 'pygame.ftfont.init', ([], {}), '()\n', (659, 661), False, 'import pygame\n'), ((666, 694), 'os.environ.get', 'os.environ.get', (['"""FULLSCREEN"""'], {}), "('FULLSCREEN')\n", (680, 694), False, 'import os\n'), ((709, 757), 'pygame.display.set_mode', 'pygame.display.set_mode', (['siz... |
# -*- coding: utf-8 -*-
""""
ニューラルネットワーク・サンプル
"""
import os
import sys
import numpy as np
def main():
sys.path.append(os.path.join(os.getcwd(), 'src', 'lib'))
from neuralnetwork import NeuralNetwork
import utils
seed_value = 8976
# 学習データの作成 (評価にも利用)
X_train = np.array([
... | [
"os.getcwd",
"utils.plot_error_log",
"numpy.array",
"neuralnetwork.NeuralNetwork",
"utils.print_accuracy_rate"
] | [((309, 369), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 0], [1, 1]]'], {'dtype': 'np.float32'}), '([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=np.float32)\n', (317, 369), True, 'import numpy as np\n'), ((428, 488), 'numpy.array', 'np.array', (['[[1, 0], [0, 1], [0, 1], [1, 0]]'], {'dtype': 'np.float32'}), '([[1, 0... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import numpy as np
from os import path as op
from .utils import _check_pytables
from .externals.six import string_types, text_type
##############################################################################
# WRITE
def write_hdf5(fn... | [
"os.path.isfile",
"numpy.array",
"numpy.atleast_1d"
] | [((780, 796), 'os.path.isfile', 'op.isfile', (['fname'], {}), '(fname)\n', (789, 796), True, 'from os import path as op\n'), ((4036, 4052), 'os.path.isfile', 'op.isfile', (['fname'], {}), '(fname)\n', (4045, 4052), True, 'from os import path as op\n'), ((5339, 5353), 'numpy.array', 'np.array', (['node'], {}), '(node)\n... |
#!/usr/bin/python3
import sys
import numpy as np
import numpysane as nps
import os
testdir = os.path.dirname(os.path.realpath(__file__))
# I import the LOCAL mrcal since that's what I'm testing
sys.path[:0] = f"{testdir}/..",
import mrcal
import testutils
import cv2
image = cv2.imread(f'{testdir}/data/figueroa-ove... | [
"testutils.finish",
"os.path.realpath",
"numpy.array",
"testutils.confirm",
"numpy.linalg.inv",
"numpysane.dummy",
"mrcal.match_feature",
"testutils.confirm_equal",
"cv2.imread",
"mrcal.apply_homography",
"numpy.arange"
] | [((280, 381), 'cv2.imread', 'cv2.imread', (['f"""{testdir}/data/figueroa-overpass-looking-S.0.downsampled.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "(f'{testdir}/data/figueroa-overpass-looking-S.0.downsampled.jpg',\n cv2.IMREAD_GRAYSCALE)\n", (290, 381), False, 'import cv2\n'), ((478, 568), 'numpy.array', 'np.array', (... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
"copy.deepcopy",
"mindspore.ops.operations.Mul",
"numpy.ones",
"mindspore.nn.LogSoftmax",
"mindspore.ops.operations.MatMul",
"mindspore.ops.operations.Shape",
"mindspore.ops.operations.OnesLike",
"mindspore.ops.operations.Reshape",
"mindspore.common.tensor.Tensor",
"numpy.tril",
"mindspore.ops.o... | [((1983, 1994), 'mindspore.ops.operations.Reshape', 'P.Reshape', ([], {}), '()\n', (1992, 1994), True, 'from mindspore.ops import operations as P\n'), ((2017, 2043), 'mindspore.ops.operations.MatMul', 'P.MatMul', ([], {'transpose_b': '(True)'}), '(transpose_b=True)\n', (2025, 2043), True, 'from mindspore.ops import ope... |
import os
import sys
sys.path.append('.')
import cv2
import numpy as np
import time
from Utilities import drawRegion, drawBox, col_rgb, CVConstants
try:
import pyMTF
mtf_available = 1
except ImportError as e:
print('MTF unavailable: {}'.format(e))
mtf_available = 0
from siamfc.SiamFC import SiamFC... | [
"cv2.TrackerGOTURN_create",
"siamfc.SiamFC.SiamFC",
"time.clock",
"cv2.TrackerKCF_create",
"cv2.imshow",
"numpy.array",
"siamfc.SiamFC.SiamFCParams",
"sys.path.append",
"cv2.TrackerMedianFlow_create",
"cv2.__version__.split",
"os.path.exists",
"pyMTF.getRegion",
"DaSiamRPN.DaSiamRPN.DaSiamRP... | [((22, 42), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (37, 42), False, 'import sys\n'), ((1618, 1632), 'siamfc.SiamFC.SiamFCParams', 'SiamFCParams', ([], {}), '()\n', (1630, 1632), False, 'from siamfc.SiamFC import SiamFC, SiamFCParams\n'), ((1658, 1674), 'SiamMask.SiamMask.SiamMaskParams', 'S... |
from abc import abstractmethod
from typing import Optional, Tuple
from pylidar_slam.common.modules import _with_cv2
if _with_cv2:
import cv2
import numpy as np
from omegaconf import DictConfig
from pylidar_slam.common.utils import check_sizes, assert_debug
class ImageBased2DRegistration:
... | [
"numpy.clip",
"cv2.BFMatcher",
"numpy.eye",
"numpy.ones",
"cv2.findHomography",
"numpy.round",
"pylidar_slam.common.utils.assert_debug",
"cv2.AKAZE_create",
"numpy.argsort",
"numpy.array",
"cv2.ORB_create",
"pylidar_slam.common.utils.check_sizes",
"numpy.linalg.svd",
"matplotlib.cm.get_cma... | [((619, 661), 'pylidar_slam.common.utils.assert_debug', 'assert_debug', (["(features in ['orb', 'akaze'])"], {}), "(features in ['orb', 'akaze'])\n", (631, 661), False, 'from pylidar_slam.common.utils import check_sizes, assert_debug\n'), ((863, 906), 'cv2.BFMatcher', 'cv2.BFMatcher', (['cv2.NORM_L2'], {'crossCheck': '... |
"""
tricks:
1.torch-optimizer:实现了最新的一些优化器.
2.numba:import numba as nb,纯python或numpy加速,加@nb.njit或@nb.jit(nopython=True)
3.swifter:df.apply()→·df.swifter.apply(),加速pandas
4.cupy:1000万以上数据更快
5.modin:import modin.pandas as mdpd,用mdpd代替pd即可,加速pandas,加载数据和查询数据更快,统计方法pandas更快
"""
import os
import sys
import argparse
import ti... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.utils.tensorboard.SummaryWriter",
"numpy.mean",
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"data.custom_dataset.MyDataset",
"torch.load",
"wandb.init",
"wandb.watch",
"torch.cuda.is_available",
"numpy.random.seed",
"torch... | [((729, 740), 'time.time', 'time.time', ([], {}), '()\n', (738, 740), False, 'import time\n'), ((745, 769), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (767, 769), False, 'import torch\n'), ((1817, 1879), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train a ne... |
from yo_fluq_ds__tests.common import *
import numpy as np
class MiscMethodsTests(TestCase):
def test_pairwise(self):
result = Query.args(1,2,3).feed(fluq.pairwise()).to_list()
self.assertListEqual([(1,2),(2,3)],result)
def test_strjoin(self):
result = Query.args(1,2,3).feed(fluq.strjoi... | [
"numpy.random.RandomState"
] | [((819, 843), 'numpy.random.RandomState', 'np.random.RandomState', (['(1)'], {}), '(1)\n', (840, 843), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.