code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from sklearn.linear_model import LogisticRegression import numpy as np from . import AbstractZnormClassifier class LogisticRegressionClassifier(AbstractZnormClassifier): """Classifier which uses regularized logistic regression""" def __init__(self, C=1, phi=None, degree=3, **kwargs): # keyword argum...
[ "numpy.swapaxes", "numpy.arange", "sklearn.linear_model.LogisticRegression" ]
[((908, 941), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {'C': 'C'}), '(C=C, **kwargs)\n', (926, 941), False, 'from sklearn.linear_model import LogisticRegression\n'), ((1564, 1592), 'numpy.swapaxes', 'np.swapaxes', (['ft_powers', '(0)', '(1)'], {}), '(ft_powers, 0, 1)\n', (1575, 1592), True,...
import numpy as np v0 = 4.5 # Initial velocity g = 9.81 # Acceleration of gravity t = np.linspace(0, 1, 1000) # 1000 points in time interval y = v0*t - 0.5*g*t**2 # Generate all heights # Find index where ball approximately has reached y=0 i = 0 while y[i] >= 0...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.show" ]
[((131, 154), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(1000)'], {}), '(0, 1, 1000)\n', (142, 154), True, 'import numpy as np\n'), ((580, 594), 'matplotlib.pyplot.plot', 'plt.plot', (['t', 'y'], {}), '(t, y)\n', (588, 594), True, 'import matplotlib.pyplot as plt\n'), ((596, 621), 'matplotlib.pyplot.plot', 'plt...
# -*- coding: utf-8 -*- """ 回测 """ from futu import * from talib.abstract import * import numpy as np import pandas as pd import datetime import time import os import json import copy import math import sqlite3 from re import sub import itertools class Tools(object): def cuo_die_0(self, inputs, item, hands): ...
[ "sqlite3.connect", "numpy.average", "numpy.std", "itertools.product", "math.sqrt", "time.sleep", "datetime.datetime.now", "copy.deepcopy", "pandas.DataFrame", "re.sub", "datetime.date.today", "pandas.concat" ]
[((4728, 4749), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (4747, 4749), False, 'import datetime\n'), ((4837, 4858), 'copy.deepcopy', 'copy.deepcopy', (['m_list'], {}), '(m_list)\n', (4850, 4858), False, 'import copy\n'), ((5940, 5994), 'itertools.product', 'itertools.product', (['item_cd_day', 'it...
from math import erf from numpy import array as vec from numpy.linalg import norm as vec_size from pandas import DataFrame def approx(a, m, x): return ((a+x)**m-(a-x)**m)/((a+x)**m+(a-x)**m) def quadratic_error(a, m, x): err = approx(a, m, x)-erf(x) return err**2 def average_quadratic_error(a, m): s...
[ "pandas.DataFrame", "numpy.array", "numpy.linalg.norm", "math.erf" ]
[((808, 829), 'numpy.array', 'vec', (['(dx / h, dy / h)'], {}), '((dx / h, dy / h))\n', (811, 829), True, 'from numpy import array as vec\n'), ((1634, 1649), 'pandas.DataFrame', 'DataFrame', (['path'], {}), '(path)\n', (1643, 1649), False, 'from pandas import DataFrame\n'), ((254, 260), 'math.erf', 'erf', (['x'], {}), ...
import datetime from pathlib import Path from typing import Any, Callable, Iterable, List, NamedTuple, Optional import numpy as np from tqdm import tqdm from vcap import BaseCapsule, NodeDescription from vcap.testing.input_output_validation import make_detection_node from capsules import CapsuleDir from workers impor...
[ "capsules.CapsuleDir", "tqdm.tqdm", "workers.CapsuleThreadPool", "datetime.datetime.now", "vcap.testing.input_output_validation.make_detection_node", "numpy.random.RandomState" ]
[((994, 1017), 'capsules.CapsuleDir', 'CapsuleDir', (['capsule_dir'], {}), '(capsule_dir)\n', (1004, 1017), False, 'from capsules import CapsuleDir\n'), ((1248, 1275), 'numpy.random.RandomState', 'np.random.RandomState', (['(1337)'], {}), '(1337)\n', (1269, 1275), True, 'import numpy as np\n'), ((4023, 4046), 'datetime...
import pandas as pd import numpy as np from .Team import Team from .FootballModel import FootballModel from ..utils import array_sum_to_one, exists, to_percent from .ResultType import ResultType class Game: ''' ''' def __init__(self, model: FootballModel, team_1: str, team_2: str, max_goals=20): ...
[ "numpy.ndenumerate", "numpy.diag", "numpy.outer", "numpy.tril", "pandas.DataFrame", "numpy.amax", "numpy.triu" ]
[((549, 625), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'team': team_1.name, 'opponent': team_2.name}", 'index': '[1]'}), "(data={'team': team_1.name, 'opponent': team_2.name}, index=[1])\n", (561, 625), True, 'import pandas as pd\n'), ((3420, 3478), 'numpy.outer', 'np.outer', (['self.team_1.proba_goals', 'se...
""" permutation-flowshop repository This module has two examples on how to setup and run the algorithm for Permutation Flowshop scheduling problems. The first one uses random generated data, while the second uses one of the instances from the Taillard benchmark set. """ import numpy as np import benchmark from iterat...
[ "benchmark.import_taillard", "iterated_greedy.IteratedGreedy", "numpy.random.randint" ]
[((512, 559), 'numpy.random.randint', 'np.random.randint', ([], {'size': '(20, 5)', 'low': '(5)', 'high': '(80)'}), '(size=(20, 5), low=5, high=80)\n', (529, 559), True, 'import numpy as np\n'), ((589, 613), 'iterated_greedy.IteratedGreedy', 'IteratedGreedy', (['rnd_data'], {}), '(rnd_data)\n', (603, 613), False, 'from...
# -*- coding: utf-8 -*- from .common import * from ccxt.base.errors import AuthenticationError, ExchangeError, ExchangeNotAvailable, RequestTimeout from requests.exceptions import ConnectionError, HTTPError, ReadTimeout from socket import gaierror, timeout from urllib3.exceptions import MaxRetryError, NewConnectionErr...
[ "numpy.array" ]
[((2572, 2601), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""float64"""'}), "([], dtype='float64')\n", (2580, 2601), True, 'import numpy as np\n'), ((3633, 3645), 'numpy.array', 'np.array', (['hh'], {}), '(hh)\n', (3641, 3645), True, 'import numpy as np\n'), ((3994, 4023), 'numpy.array', 'np.array', (['[]'], {'dty...
"""Simulating time series, with aperiodic activity.""" import numpy as np from scipy.stats import zscore from scipy.linalg import toeplitz, cholesky from neurodsp.filt import filter_signal, infer_passtype from neurodsp.filt.fir import compute_filter_length from neurodsp.filt.checks import check_filter_definition from...
[ "numpy.convolve", "numpy.sqrt", "numpy.random.rand", "neurodsp.utils.data.create_times", "neurodsp.filt.infer_passtype", "scipy.linalg.cholesky", "numpy.arange", "neurodsp.filt.checks.check_filter_definition", "neurodsp.sim.transients.sim_synaptic_kernel", "numpy.where", "numpy.fft.fft", "nump...
[((4213, 4257), 'neurodsp.sim.transients.sim_synaptic_kernel', 'sim_synaptic_kernel', (['t_ker', 'fs', 'tau_r', 'tau_d'], {}), '(t_ker, fs, tau_r, tau_d)\n', (4232, 4257), False, 'from neurodsp.sim.transients import sim_synaptic_kernel\n'), ((5517, 5544), 'neurodsp.utils.data.create_times', 'create_times', (['n_seconds...
# ============================================================================== # 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 re...
[ "torch.manual_seed", "torch.nn.ReLU", "torch.nn.Sigmoid", "torch.nn.Tanh", "numpy.asarray", "random.seed", "torch.cuda.is_available", "numpy.random.seed", "torch.cuda.manual_seed", "torch.device" ]
[((833, 850), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (844, 850), False, 'import random\n'), ((900, 920), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (914, 920), True, 'import numpy as np\n'), ((925, 948), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (94...
# -*- coding: utf-8 -*- # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # You can only use this computer program if you have closed # a license agreement with MPG or you get the right to use the computer # program from someon...
[ "numpy.eye", "cv2.decomposeProjectionMatrix", "numpy.sqrt", "numpy.array", "numpy.zeros", "numpy.dot", "numpy.matmul", "numpy.linalg.norm" ]
[((5737, 5776), 'cv2.decomposeProjectionMatrix', 'cv2.decomposeProjectionMatrix', (['proj_mat'], {}), '(proj_mat)\n', (5766, 5776), False, 'import cv2\n'), ((6439, 6478), 'cv2.decomposeProjectionMatrix', 'cv2.decomposeProjectionMatrix', (['proj_mat'], {}), '(proj_mat)\n', (6468, 6478), False, 'import cv2\n'), ((6685, 6...
"""An attempt to implement a fishers exact test in numba. Gave up after a day because some ofthe distributions required are written in fortran in scipy.special. Seems like soon numba-scipy may make this effort much easier. For now will require use of cython""" from numba import njit import numpy as np from scipy.speci...
[ "numpy.abs", "numpy.log", "numpy.asarray", "numpy.iinfo", "numpy.any", "numpy.exp", "numpy.isnan", "scipy.special.comb", "numpy.maximum" ]
[((1721, 1754), 'numpy.asarray', 'np.asarray', (['table'], {'dtype': 'np.int64'}), '(table, dtype=np.int64)\n', (1731, 1754), True, 'import numpy as np\n'), ((1905, 1918), 'numpy.any', 'np.any', (['(c < 0)'], {}), '(c < 0)\n', (1911, 1918), True, 'import numpy as np\n'), ((4534, 4551), 'numpy.iinfo', 'np.iinfo', (['np....
import numpy as np from scipy.optimize import minimize from os import path import matplotlib.pyplot as plt import sys from MCPM import utils from MCPM.cpmfitsource import CpmFitSource def fun_3(inputs, cpm_source, t_E): """3-parameter function for optimisation; t_E - fixed""" t_0 = inputs[0] u_0 = in...
[ "numpy.abs", "scipy.optimize.minimize", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.array", "numpy.sum", "MCPM.cpmfitsource.CpmFitSource", "matplotlib.pyplot.show" ]
[((1262, 1299), 'numpy.array', 'np.array', (['[7556.0, 0.14, 21.0, 300.0]'], {}), '([7556.0, 0.14, 21.0, 300.0])\n', (1270, 1299), True, 'import numpy as np\n'), ((1311, 1341), 'numpy.array', 'np.array', (['[7556.0, 0.1, 150.0]'], {}), '([7556.0, 0.1, 150.0])\n', (1319, 1341), True, 'import numpy as np\n'), ((1485, 154...
# This script generates the scoring and schema files # necessary to operationalize your model from azureml.api.schema.dataTypes import DataTypes from azureml.api.schema.sampleDefinition import SampleDefinition from azureml.api.realtime.services import generate_schema import json import numpy as np import os imp...
[ "PIL.Image.open", "keras.models.load_model", "os.makedirs", "azureml.api.realtime.services.generate_schema", "io.BytesIO", "base64.b64decode", "numpy.argmax", "numpy.max", "numpy.array", "numpy.expand_dims", "azureml.api.schema.sampleDefinition.SampleDefinition" ]
[((907, 929), 'keras.models.load_model', 'load_model', (['model_name'], {}), '(model_name)\n', (917, 929), False, 'from keras.models import load_model\n'), ((1173, 1205), 'numpy.expand_dims', 'np.expand_dims', (['image_np'], {'axis': '(0)'}), '(image_np, axis=0)\n', (1187, 1205), True, 'import numpy as np\n'), ((1233, ...
from io import FileIO import numpy as np import pandas as pd from pathlib import Path from typing import Union, List, Iterable from .common import open_file, coerce_matrix def read_mdf(file: Union[str, FileIO, Path], raw: bool = False, tall: bool = False ) -> Union[np.ndarray, pd.DataFrame, pd.Series]: ...
[ "pandas.Series", "numpy.fromfile", "pandas.Index", "numpy.array", "numpy.zeros", "pandas.DataFrame" ]
[((1176, 1221), 'numpy.fromfile', 'np.fromfile', (['file_handler', 'np.uint32'], {'count': '(4)'}), '(file_handler, np.uint32, count=4)\n', (1187, 1221), True, 'import numpy as np\n'), ((1520, 1568), 'numpy.fromfile', 'np.fromfile', (['file_handler', 'np.uint32'], {'count': 'ndim'}), '(file_handler, np.uint32, count=nd...
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' os.environ["CUDA_VISIBLE_DEVICES"] = "-1" import tensorflow as tf from tensorflow.keras.preprocessing.sequence import pad_sequences from data_lit import Data_Augmentation import numpy as np #physical_devices = tf.config.list_physical_devices('GPU') #tf.config...
[ "tensorflow.keras.preprocessing.sequence.pad_sequences", "data_lit.Data_Augmentation", "numpy.argmax", "tensorflow.convert_to_tensor", "tensorflow.expand_dims", "tensorflow.zeros" ]
[((524, 543), 'data_lit.Data_Augmentation', 'Data_Augmentation', ([], {}), '()\n', (541, 543), False, 'from data_lit import Data_Augmentation\n'), ((1576, 1635), 'tensorflow.keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['[whole]'], {'maxlen': 'self.max_len', 'padding': '"""post"""'}), "([whole], maxle...
__author__ = "<NAME>" __copyright__ = "Copyright 2020" __version__ = "1.0.1" __maintainer__ = "Rabaa" __email__ = "<EMAIL>" import numpy as np import sys ## Class: TestParticle # Functions: Default Constructor, DataDissection, IdentifyResonance, PrintData class TestParticle: def __init__(self): # Attributes def...
[ "numpy.genfromtxt", "numpy.arange", "numpy.average" ]
[((11684, 11757), 'numpy.genfromtxt', 'np.genfromtxt', (["('tp' + TestParticleSample + '.out')"], {'usecols': '(1)', 'unpack': '(True)'}), "('tp' + TestParticleSample + '.out', usecols=1, unpack=True)\n", (11697, 11757), True, 'import numpy as np\n'), ((1668, 1730), 'numpy.genfromtxt', 'np.genfromtxt', (["('tp' + TestP...
import numpy as np import cv2 def draw_bbox(image, x1, y1, x2, y2, caption, color=(203, 232, 0)): b = np.array([x1, y1, x2, y2]).astype(int) cv2.rectangle(image, (x1, y1), (x2, y2), color=color, thickness=5) if caption: cv2.putText(image, caption, (b[0], b[1] - 10), cv2.FONT_HERSHEY_PLAIN, 1.5, (0...
[ "cv2.rectangle", "numpy.array", "cv2.putText" ]
[((150, 216), 'cv2.rectangle', 'cv2.rectangle', (['image', '(x1, y1)', '(x2, y2)'], {'color': 'color', 'thickness': '(5)'}), '(image, (x1, y1), (x2, y2), color=color, thickness=5)\n', (163, 216), False, 'import cv2\n'), ((242, 335), 'cv2.putText', 'cv2.putText', (['image', 'caption', '(b[0], b[1] - 10)', 'cv2.FONT_HERS...
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from queue import Queue, Full, Empty import threading import numpy as np import torch from datetime import datetime fr...
[ "torch.LongTensor", "torch.from_numpy", "collections.Counter", "datetime.datetime.now", "torch.cuda.is_available", "collections.defaultdict", "threading.Thread", "queue.Queue", "numpy.isinf", "torch.FloatTensor" ]
[((5438, 5445), 'queue.Queue', 'Queue', ([], {}), '()\n', (5443, 5445), False, 'from queue import Queue, Full, Empty\n'), ((5838, 5847), 'collections.Counter', 'Counter', ([], {}), '()\n', (5845, 5847), False, 'from collections import deque, Counter, defaultdict, OrderedDict\n'), ((7729, 7743), 'datetime.datetime.now',...
from __future__ import print_function import itertools import numpy as np import numba.unittest_support as unittest from numba import types, jit, typeof from .support import MemoryLeakMixin, TestCase, tag def getitem_usecase(a, b): return a[b] def setitem_usecase(a, idx, b): a[idx] = b class TestFancyIn...
[ "numba.unittest_support.main", "numpy.testing.assert_equal", "numpy.int16", "itertools.product", "numba.jit", "numpy.bool_", "numpy.uint16", "numpy.zeros_like", "numpy.arange" ]
[((6184, 6199), 'numba.unittest_support.main', 'unittest.main', ([], {}), '()\n', (6197, 6199), True, 'import numba.unittest_support as unittest\n'), ((430, 454), 'numpy.int16', 'np.int16', (['[0, N - 1, -2]'], {}), '([0, N - 1, -2])\n', (438, 454), True, 'import numpy as np\n'), ((1465, 1504), 'itertools.product', 'it...
# Copyright 2020 The Magenta Authors. # # 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 ...
[ "magenta.models.onsets_frames_transcription.infer_util.labels_to_features_wrapper", "tensorflow.compat.v1.gfile.GFile", "magenta.models.onsets_frames_transcription.data.hparams_frames_per_second", "tensorflow.compat.v1.Session", "numpy.mean", "note_seq.protobuf.music_pb2.NoteSequence.FromString", "six.e...
[((1389, 1475), 'tensorflow.compat.v1.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""master"""', '""""""', '"""Name of the TensorFlow runtime to use."""'], {}), "('master', '',\n 'Name of the TensorFlow runtime to use.')\n", (1415, 1475), True, 'import tensorflow.compat.v1 as tf\n'), ((1499, 1586), 't...
# utils.py import pandas as pd from sklearn.preprocessing import OneHotEncoder import numpy as np import os def extract_tls_info(s): tls_key_list = ['C', 'ST', 'L', 'O', 'OU', 'CN', 'emailAddress', 'unknown', 'serialNumber'] s = s.split(',') s = [x.split('/') for x in s] s = sum(s, []) res = {} ...
[ "pandas.DataFrame", "sklearn.preprocessing.OneHotEncoder", "numpy.array" ]
[((3711, 3801), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'categories': '"""auto"""', 'sparse': '(False)', 'dtype': 'np.int8', 'handle_unknown': '"""ignore"""'}), "(categories='auto', sparse=False, dtype=np.int8,\n handle_unknown='ignore')\n", (3724, 3801), False, 'from sklearn.preprocessing impo...
import argparse import os import sys from sys import stdout import mdtraj as md import numpy as np import parmed import simtk.openmm as mm import simtk.openmm.app as app import simtk.unit as unit from openforcefield.topology import Molecule, Topology from openmmforcefields.generators import SystemGenerator from perses...
[ "openforcefield.topology.Molecule.from_file", "os.makedirs", "argparse.ArgumentParser", "openmmforcefields.generators.SystemGenerator", "simtk.openmm.app.Simulation", "os.path.join", "openforcefield.topology.Topology.from_molecules", "numpy.zeros", "simtk.openmm.LangevinIntegrator", "simtk.openmm....
[((665, 690), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (688, 690), False, 'import argparse\n'), ((1420, 1472), 'simtk.openmm.app.ForceField', 'ForceField', (['protein_forcefield', 'solvation_forcefield'], {}), '(protein_forcefield, solvation_forcefield)\n', (1430, 1472), False, 'from simt...
import h5py as h5 import feather import pandas as pd import numpy as np import os correlation_files = os.listdir("correlation_folder") for i in range(0, len(correlation_files)): print(i) correlation = pd.read_feather("correlation_folder/"+correlation_files[i]) f = h5.File("h5/"+correlation_files[i].replac...
[ "pandas.read_feather", "os.listdir", "matplotlib.pyplot.savefig", "numpy.corrcoef", "s3fs.S3FileSystem", "matplotlib.pyplot.legend", "matplotlib.pyplot.plot", "h5py.File", "multiprocessing.pool.ThreadPool", "matplotlib.pyplot.close", "numpy.array", "numpy.sin", "matplotlib.pyplot.title", "...
[((103, 135), 'os.listdir', 'os.listdir', (['"""correlation_folder"""'], {}), "('correlation_folder')\n", (113, 135), False, 'import os\n'), ((901, 912), 'time.time', 'time.time', ([], {}), '()\n', (910, 912), False, 'import time\n'), ((1728, 1739), 'time.time', 'time.time', ([], {}), '()\n', (1737, 1739), False, 'impo...
from __future__ import absolute_import # Visualization of particles with gravity # Source: http://enja.org/2010/08/27/adventures-in-opencl-part-2-particles-with-opengl/ import pyopencl as cl # OpenCL - GPU computing interface mf = cl.mem_flags from pyopencl.tools import get_gl_sharing_context_properties from OpenGL.GL...
[ "pyopencl.Buffer", "pyopencl.Program", "pyopencl.enqueue_release_gl_objects", "numpy.random.random_sample", "pyopencl.get_platforms", "numpy.float32", "pyopencl.CommandQueue", "pyopencl.tools.get_gl_sharing_context_properties", "numpy.ndarray", "pyopencl.enqueue_acquire_gl_objects", "sys.exit", ...
[((4872, 4896), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['context'], {}), '(context)\n', (4887, 4896), True, 'import pyopencl as cl\n'), ((4912, 4969), 'pyopencl.Buffer', 'cl.Buffer', (['context', 'mf.COPY_HOST_PTR'], {'hostbuf': 'np_velocity'}), '(context, mf.COPY_HOST_PTR, hostbuf=np_velocity)\n', (4921, 4969), ...
"""Module containing models representing patients and their data. The Model layer is responsible for the 'business logic' part of the software. Patients' data is held in an inflammation table (2D array) where each row contains inflammation data for a single patient taken over a number of days and each column repres...
[ "numpy.mean", "numpy.any", "numpy.max", "numpy.errstate", "numpy.isnan", "numpy.min", "numpy.loadtxt" ]
[((511, 552), 'numpy.loadtxt', 'np.loadtxt', ([], {'fname': 'filename', 'delimiter': '""","""'}), "(fname=filename, delimiter=',')\n", (521, 552), True, 'import numpy as np\n'), ((735, 756), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (742, 756), True, 'import numpy as np\n'), ((928, 948),...
import numpy as np # We create a rank 1 ndarray x = np.array([1,2,3,4]) # We print x print() print('x = ', x) # We apply different mathematical functions to all elements of x print() print('EXP(x) =', np.exp(x)) print() print('SQRT(x) =',np.sqrt(x)) print() print('POW(x,2) =',np.power(x,2)) # We raise all elements t...
[ "numpy.exp", "numpy.array", "numpy.sqrt", "numpy.power" ]
[((53, 75), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (61, 75), True, 'import numpy as np\n'), ((204, 213), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (210, 213), True, 'import numpy as np\n'), ((241, 251), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (248, 251), True, 'import numpy as ...
from numpy.testing.utils import assert_equal, assert_raises from nose import with_setup from nose.plugins.attrib import attr from brian2 import * from brian2.devices.device import restore_device @attr('standalone-compatible') @with_setup(teardown=restore_device) def test_poissoninput(): # Test extreme cases and d...
[ "nose.with_setup", "numpy.testing.utils.assert_equal", "nose.plugins.attrib.attr" ]
[((198, 227), 'nose.plugins.attrib.attr', 'attr', (['"""standalone-compatible"""'], {}), "('standalone-compatible')\n", (202, 227), False, 'from nose.plugins.attrib import attr\n'), ((229, 264), 'nose.with_setup', 'with_setup', ([], {'teardown': 'restore_device'}), '(teardown=restore_device)\n', (239, 264), False, 'fro...
from tespy.connections import connection from tespy.components import source, sink, pipe from tespy.networks import network import numpy as np from matplotlib import pyplot as plt nw = network(['water'], p_unit='bar', T_unit='C', h_unit='kJ / kg') # %% components pi = pipe('pipe') si = sink('sink') so = source('sour...
[ "tespy.components.source", "tespy.components.sink", "numpy.linspace", "tespy.components.pipe", "tespy.networks.network", "tespy.connections.connection" ]
[((187, 249), 'tespy.networks.network', 'network', (["['water']"], {'p_unit': '"""bar"""', 'T_unit': '"""C"""', 'h_unit': '"""kJ / kg"""'}), "(['water'], p_unit='bar', T_unit='C', h_unit='kJ / kg')\n", (194, 249), False, 'from tespy.networks import network\n'), ((272, 284), 'tespy.components.pipe', 'pipe', (['"""pipe""...
import random import torch import numpy as np from torch_geometric.utils import degree, to_undirected def negative_sampling(edge_index, num_nodes=None, num_neg_samples=None, force_undirected=False): num_neg_samples = num_neg_samples or edge_index.size(1) # Handle '|V|^2 - |E| < |E|' ...
[ "random.sample", "torch.stack", "numpy.isin" ]
[((597, 632), 'random.sample', 'random.sample', (['rng', 'num_neg_samples'], {}), '(rng, num_neg_samples)\n', (610, 632), False, 'import random\n'), ((1079, 1109), 'torch.stack', 'torch.stack', (['[row, col]'], {'dim': '(0)'}), '([row, col], dim=0)\n', (1090, 1109), False, 'import torch\n'), ((686, 704), 'numpy.isin', ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os,time,datetime,sys import numpy as np import dgcnn import tensorflow as tf def round_decimals(val,digits): factor = float(np.power(10,digits)) return int(val * factor+0.5) / factor def iteration_f...
[ "tensorflow.local_variables_initializer", "dgcnn.trainval", "sys.exit", "numpy.mean", "os.path.exists", "tensorflow.Session", "os.path.isdir", "os.mkdir", "tensorflow.ConfigProto", "sys.stdout.flush", "dgcnn.io_factory", "sys.stderr.write", "tensorflow.summary.FileWriter", "time.time", "...
[((434, 457), 'dgcnn.io_factory', 'dgcnn.io_factory', (['flags'], {}), '(flags)\n', (450, 457), False, 'import dgcnn\n'), ((1547, 1570), 'dgcnn.io_factory', 'dgcnn.io_factory', (['flags'], {}), '(flags)\n', (1563, 1570), False, 'import dgcnn\n'), ((1750, 1771), 'dgcnn.trainval', 'dgcnn.trainval', (['flags'], {}), '(fla...
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # ''' Some hacky functions ''' import os, sys import imp import tempfile import shutil import functools import itertools import math import ctypes import numpy import h5py from pyscf.lib import param c_double_p = ctypes.POINTER(ctypes.c_double) c_int_p = ctypes.POIN...
[ "sys.platform.startswith", "multiprocessing.cpu_count", "os.fsync", "numpy.array", "imp.lock_held", "itertools.izip", "numpy.ctypeslib.load_library", "threading.Thread.join", "numpy.arange", "os.remove", "threading.Thread.__init__", "os.dup", "itertools.chain.from_iterable", "numpy.ctypesl...
[((267, 298), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (281, 298), False, 'import ctypes\n'), ((309, 337), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_int'], {}), '(ctypes.c_int)\n', (323, 337), False, 'import ctypes\n'), ((351, 382), 'ctypes.POINTER', 'ctypes.POINTER', ...
# encoding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import datetime import math import time import tensorflow.python.platform from tensorflow.python.platform import gfile import numpy as np import tensorflow as tf import cnn_tin...
[ "cnn_tiny_model.inference", "time.sleep", "tensorflow.app.run", "tensorflow.Graph", "tensorflow.train.Coordinator", "tensorflow.Session", "tensorflow.nn.in_top_k", "tensorflow.trainable_variables", "tensorflow.get_default_graph", "tensorflow.train.SummaryWriter", "tensorflow.train.get_checkpoint...
[((3269, 3281), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (3279, 3281), True, 'import tensorflow as tf\n'), ((522, 534), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (532, 534), True, 'import tensorflow as tf\n'), ((559, 610), 'tensorflow.train.get_checkpoint_state', 'tf.train.get_checkpoint_state'...
"""surfinBH ======== Surrogate final black hole properties for mergers of binary black holes. See https://pypi.org/project/surfinBH/ for more details. """ __copyright__ = "Copyright (C) 2018 <NAME>" __email__ = "<EMAIL>" __status__ = "testing" __author__ = "<NAME>" __version__ = "1.1.7" __license__ = """ Permission is...
[ "numpy.copy", "numpy.random.choice", "numpy.sin", "numpy.array", "numpy.sum", "numpy.cos", "numpy.random.uniform", "warnings.warn", "numpy.atleast_1d" ]
[((7008, 7027), 'numpy.atleast_1d', 'np.atleast_1d', (['chiA'], {}), '(chiA)\n', (7021, 7027), True, 'import numpy as np\n'), ((7043, 7062), 'numpy.atleast_1d', 'np.atleast_1d', (['chiB'], {}), '(chiB)\n', (7056, 7062), True, 'import numpy as np\n'), ((8613, 8660), 'numpy.random.uniform', 'np.random.uniform', (['(1)', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import math import itertools from scipy.linalg import svd, norm # general messages for LM/etc optimization TERMINATION_MESSAGES = { None: "Status returned `None`. Error.", -1: "Improper input parameters status returned from `leastsq`", 0: ...
[ "numpy.sqrt", "numpy.linalg.multi_dot", "math.log", "numpy.mean", "numpy.max", "numpy.dot", "numpy.matmul", "numpy.empty", "numpy.min", "numpy.abs", "itertools.cycle", "numpy.isnan", "scipy.linalg.svd", "itertools.islice", "math.isclose", "numpy.errstate", "numpy.sum", "numpy.empty...
[((3224, 3241), 'numpy.load', 'np.load', (['npz_file'], {}), '(npz_file)\n', (3231, 3241), True, 'import numpy as np\n'), ((5271, 5289), 'numpy.empty_like', 'np.empty_like', (['cov'], {}), '(cov)\n', (5284, 5289), True, 'import numpy as np\n'), ((5964, 5991), 'scipy.linalg.svd', 'svd', (['A'], {'full_matrices': '(False...
# ----------------------------------- # # 01_02 线性回归 # # ----------------------------------- import numpy as np import tensorflow as tf tf.enable_eager_execution() # ----------------------------------- # 1. 数据 # ----------------------------------- X_raw = np.array([2013, 2014, 2015, 2016, 2017], dtype=np.float32) ...
[ "tensorflow.get_variable", "tensorflow.enable_eager_execution", "tensorflow.train.GradientDescentOptimizer", "numpy.array", "tensorflow.GradientTape", "tensorflow.constant", "tensorflow.square" ]
[((139, 166), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (164, 166), True, 'import tensorflow as tf\n'), ((261, 319), 'numpy.array', 'np.array', (['[2013, 2014, 2015, 2016, 2017]'], {'dtype': 'np.float32'}), '([2013, 2014, 2015, 2016, 2017], dtype=np.float32)\n', (269, 319), Tru...
import cv2 import numpy as np drawing = False # true if mouse is pressed mode = True # if True, draw rectangle. Press 'm' to toggle to curve ix,iy = -1,-1 # mouse callback function def draw_circle(event,x,y,flags,param): global ix,iy,drawing,mode if event == cv2.EVENT_LBUTTONDOWN: drawing = True ...
[ "cv2.setMouseCallback", "cv2.rectangle", "cv2.imshow", "numpy.zeros", "cv2.circle", "cv2.destroyAllWindows", "cv2.waitKey", "cv2.namedWindow" ]
[((783, 816), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (791, 816), True, 'import numpy as np\n'), ((817, 841), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (832, 841), False, 'import cv2\n'), ((842, 884), 'cv2.setMouseCallback', 'cv2.s...
import sys from PIL import Image import argparse import os import numpy as np import torch import cv2 torch.set_printoptions(sci_mode=False, precision=4) np.set_printoptions(suppress=True, precision=4) def save_matrix(filename, mat, print_stats=False): import matplotlib.pyplot as plt # corr = F.avg_pool2d(co...
[ "cv2.rectangle", "numpy.count_nonzero", "matplotlib.pyplot.imshow", "os.path.exists", "torch.set_printoptions", "argparse.ArgumentParser", "cv2.addWeighted", "numpy.abs", "matplotlib.pyplot.savefig", "os.path.splitext", "cv2.resize", "cv2.imread", "numpy.set_printoptions", "cv2.applyColorM...
[((104, 155), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'sci_mode': '(False)', 'precision': '(4)'}), '(sci_mode=False, precision=4)\n', (126, 155), False, 'import torch\n'), ((156, 203), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'precision': '(4)'}), '(suppress=True, p...
# @Time : 2022/1/1 # @Author : <NAME> # @email : <EMAIL> import ipdb import math import torch import numpy as np import torch.nn.functional as F from loguru import logger from torch import nn import os from crslab.model.base import BaseModel from crslab.model.utils.modules.info_nce_loss import info_nce_lo...
[ "torch.nn.Dropout", "numpy.sqrt", "torch.nn.CrossEntropyLoss", "math.sqrt", "torch.nn.init.xavier_normal_", "crslab.model.utils.modules.transformer.TransformerFFN", "crslab.model.utils.modules.transformer.create_position_codes", "torch.nn.functional.softmax", "torch.arange", "torch.nn.functional.l...
[((2147, 2187), 'crslab.model.utils.functions.edge_to_pyg_format', 'edge_to_pyg_format', (['entity_edges', '"""RGCN"""'], {}), "(entity_edges, 'RGCN')\n", (2165, 2187), False, 'from crslab.model.utils.functions import edge_to_pyg_format\n'), ((3280, 3321), 'torch.nn.Linear', 'nn.Linear', (['self.kg_emb_dim', 'self.ffn_...
""" Implementation of a standard financial plot visualization using Chaco renderers and scales. This differs from the financial_plot.py example in that it uses a date-oriented axis. """ # Major library imports from numpy import abs, cumprod, linspace, random import time # Enthought library imports from enable.api im...
[ "chaco.api.FilledLinePlot", "traits.api.Instance", "numpy.random.normal", "chaco.tools.api.PanTool", "chaco.tools.api.ZoomTool", "numpy.cumprod", "chaco.scales.api.CalendarScaleSystem", "chaco.api.add_default_grids", "chaco.api.BarPlot", "chaco.api.DataRange1D", "chaco.api.ArrayDataSource", "n...
[((1169, 1180), 'time.time', 'time.time', ([], {}), '()\n', (1178, 1180), False, 'import time\n'), ((1219, 1265), 'numpy.linspace', 'linspace', (['now', '(now + numpoints * dt)', 'numpoints'], {}), '(now, now + numpoints * dt, numpoints)\n', (1227, 1265), False, 'from numpy import abs, cumprod, linspace, random\n'), ((...
# Copyright 2019 IBM Corporation # # 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, ...
[ "numpy.dtype", "lale.lib.lale.Hyperopt", "lale.lib.sklearn.LogisticRegression", "lale.lib.autoai_libs.float32_transform", "lale.lib.lale.NoOp", "lale.lib.lale.ConcatFeatures" ]
[((1824, 1875), 'lale.lib.lale.Hyperopt', 'Hyperopt', ([], {'estimator': 'trainable_pipeline', 'max_evals': '(1)'}), '(estimator=trainable_pipeline, max_evals=1)\n', (1832, 1875), False, 'from lale.lib.lale import Hyperopt, ConcatFeatures, NoOp\n'), ((2391, 2442), 'lale.lib.lale.Hyperopt', 'Hyperopt', ([], {'estimator'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Python version: 3.6 import models.func as fc # from models.func import node_deleting import models.test as ts # from models.test import test_part import copy import torch import operator import test from torch import nn from numpy import linalg as LA import logging import...
[ "logging.getLogger", "numpy.random.get_state", "numpy.random.set_state", "numpy.linalg.norm", "test", "numpy.random.seed", "copy.deepcopy", "operator.itemgetter", "copy.copy", "models.test.test_part", "models.func.node_deleting", "torch.FloatTensor", "numpy.random.shuffle" ]
[((374, 403), 'logging.getLogger', 'logging.getLogger', (['"""main_fed"""'], {}), "('main_fed')\n", (391, 403), False, 'import logging\n'), ((812, 840), 'copy.deepcopy', 'copy.deepcopy', (['value_list[0]'], {}), '(value_list[0])\n', (825, 840), False, 'import copy\n'), ((1104, 1125), 'copy.copy', 'copy.copy', (['idxs_u...
# Copyright (c) 2018 PaddlePaddle 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 app...
[ "paddle.fluid.layers.resize_nearest", "numpy.allclose", "paddle.fluid.data", "numpy.ones", "numpy.random.random", "paddle.fluid.default_startup_program", "paddle.fluid.core.CUDAPlace", "paddle.enable_static", "paddle.fluid.default_main_program", "numpy.zeros", "paddle.fluid.Executor", "numpy.a...
[((1809, 1839), 'numpy.zeros', 'np.zeros', (['(n, c, out_h, out_w)'], {}), '((n, c, out_h, out_w))\n', (1817, 1839), True, 'import numpy as np\n'), ((17166, 17188), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (17186, 17188), False, 'import paddle\n'), ((17193, 17208), 'unittest.main', 'unittest.ma...
import numpy as np import pytest def test_camera_display_create(): from ctapipe.visualization.bokeh import CameraDisplay CameraDisplay() def test_camera_geom(example_event, example_subarray): from ctapipe.visualization.bokeh import CameraDisplay t = list(example_event.r0.tel.keys())[0] geom = ...
[ "numpy.sqrt", "numpy.ones", "ctapipe.visualization.bokeh.CameraDisplay", "ctapipe.visualization.bokeh.FastCameraDisplay", "pytest.raises", "ctapipe.visualization.bokeh.intensity_to_hex", "ctapipe.visualization.bokeh.WaveformDisplay", "numpy.arange" ]
[((132, 147), 'ctapipe.visualization.bokeh.CameraDisplay', 'CameraDisplay', ([], {}), '()\n', (145, 147), False, 'from ctapipe.visualization.bokeh import CameraDisplay\n'), ((376, 395), 'ctapipe.visualization.bokeh.CameraDisplay', 'CameraDisplay', (['geom'], {}), '(geom)\n', (389, 395), False, 'from ctapipe.visualizati...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 30 16:23:35 2020 @author: elizabeth_mckenzie """ import numpy as np from scipy.ndimage.interpolation import rotate as ndrotate import tensorflow as tf from skimage.transform import resize import matplotlib.pyplot as plt order = 0 # input_shape = (...
[ "tensorflow.py_function", "numpy.random.uniform", "tensorflow.constant", "numpy.expand_dims", "tensorflow.ones_like", "tensorflow.cast", "skimage.transform.resize", "numpy.load" ]
[((4569, 4586), 'numpy.load', 'np.load', (['npy_name'], {}), '(npy_name)\n', (4576, 4586), True, 'import numpy as np\n'), ((4621, 4648), 'skimage.transform.resize', 'resize', (['img', '(32, 256, 256)'], {}), '(img, (32, 256, 256))\n', (4627, 4648), False, 'from skimage.transform import resize\n'), ((1210, 1238), 'tenso...
import collections import itertools import logging import operator from typing import Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, Union import networkx as nx import numpy as np from cytoolz import itertoolz from spacy.tokens import Span, Token from . import utils as ke_utils LOGGER = logging.g...
[ "logging.getLogger", "numpy.tile", "numpy.abs", "networkx.pagerank_scipy", "numpy.flatnonzero", "networkx.Graph", "cytoolz.itertoolz.sliding_window", "numpy.diag", "itertools.combinations", "numpy.sum", "numpy.dot", "cytoolz.itertoolz.peek", "collections.defaultdict", "operator.itemgetter"...
[((311, 338), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (328, 338), False, 'import logging\n'), ((2597, 2618), 'cytoolz.itertoolz.peek', 'itertoolz.peek', (['terms'], {}), '(terms)\n', (2611, 2618), False, 'from cytoolz import itertoolz\n'), ((3063, 3073), 'networkx.Graph', 'nx.Graph...
""" Python implementation of the LiNGAM algorithms. The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam """ import itertools import numbers import warnings import numpy as np from sklearn.utils import check_array, resample from .bootstrap import BootstrapResult from .direct_lingam import DirectLiNGAM ...
[ "numpy.copy", "numpy.abs", "numpy.mean", "numpy.reshape", "numpy.argmax", "numpy.array", "sklearn.utils.resample", "numpy.dot", "sklearn.utils.check_array", "numpy.std", "warnings.warn", "numpy.arange" ]
[((2618, 2645), 'numpy.arange', 'np.arange', (['self._n_features'], {}), '(self._n_features)\n', (2627, 2645), True, 'import numpy as np\n'), ((9286, 9303), 'numpy.array', 'np.array', (['X_list_'], {}), '(X_list_)\n', (9294, 9303), True, 'import numpy as np\n'), ((2680, 2690), 'numpy.copy', 'np.copy', (['X'], {}), '(X)...
""" This file contains the solution to the problem 2.8.4 of the book `Nonlinear Dynamics and Chaos` by <NAME>. """ import numpy as np import matplotlib.pyplot as plt def exact_solution(t, x0=1.0): """ The implementation of the exact solution to the differential equation x' = -x with the initial condit...
[ "numpy.abs", "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.log", "matplotlib.pyplot.minorticks_on", "numpy.exp", "numpy.array", "numpy.linspace", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "matplotlib.pypl...
[((3112, 3134), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(100)'], {}), '(0, 1, 100)\n', (3123, 3134), True, 'import numpy as np\n'), ((3178, 3220), 'matplotlib.pyplot.plot', 'plt.plot', (['exact_time', 'exact'], {'label': '"""exact"""'}), "(exact_time, exact, label='exact')\n", (3186, 3220), True, 'import matp...
import os import time import IPython import numpy as np import scipy.stats as st from sklearn.metrics import confusion_matrix import gym import torch import torch.nn.functional as F from torch.autograd import Variable def get_action(actions, env): if type(env.action_space) is gym.spaces.Discrete: # Get ...
[ "numpy.mean", "torch.manual_seed", "numpy.prod", "torch.nn.functional.nll_loss", "os.path.join", "scipy.stats.norm.interval", "torch.from_numpy", "numpy.random.randint", "scipy.stats.sem", "torch.autograd.Variable", "torch.zeros", "sklearn.metrics.confusion_matrix" ]
[((4493, 4509), 'numpy.mean', 'np.mean', (['returns'], {}), '(returns)\n', (4500, 4509), True, 'import numpy as np\n'), ((4535, 4550), 'scipy.stats.sem', 'st.sem', (['returns'], {}), '(returns)\n', (4541, 4550), True, 'import scipy.stats as st\n'), ((8138, 8176), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', ...
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
[ "unittest.main", "numpy.array", "numpy.fromstring" ]
[((8409, 8424), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8422, 8424), False, 'import unittest\n'), ((1325, 1354), 'numpy.fromstring', 'np.fromstring', (['s'], {'dtype': '"""|S1"""'}), "(s, dtype='|S1')\n", (1338, 1354), True, 'import numpy as np\n'), ((1378, 1410), 'numpy.fromstring', 'np.fromstring', (['s'...
import copy import logging import dask import numpy as np import xarray as xr from numcodecs.compat import ensure_ndarray from xarray.backends.zarr import ( DIMENSION_KEY, encode_zarr_attr_value, encode_zarr_variable, extract_zarr_variable_encoding, ) from zarr.meta import encode_fill_value from zarr.s...
[ "logging.getLogger", "zarr.meta.encode_fill_value", "xarray.backends.zarr.encode_zarr_attr_value", "numpy.asarray", "numcodecs.compat.ensure_ndarray", "numpy.empty_like", "zarr.util.normalize_shape", "xarray.backends.zarr.encode_zarr_variable", "copy.deepcopy", "xarray.backends.zarr.extract_zarr_v...
[((599, 623), 'logging.getLogger', 'logging.getLogger', (['"""api"""'], {}), "('api')\n", (616, 623), False, 'import logging\n'), ((1529, 1565), 'zarr.meta.encode_fill_value', 'encode_fill_value', (['fill_value', 'dtype'], {}), '(fill_value, dtype)\n', (1546, 1565), False, 'from zarr.meta import encode_fill_value\n'), ...
import numpy as np import dynet as dy from xnmt import logger import xnmt.batcher from xnmt.events import register_xnmt_handler, handle_xnmt_event from xnmt.expression_sequence import ExpressionSequence, LazyNumpyExpressionSequence from xnmt.linear import Linear from xnmt.param_collection import ParamManager from xnmt...
[ "dynet.parameter", "xnmt.param_collection.ParamManager.my_params", "numpy.sqrt", "dynet.affine_transform", "xnmt.logger.info", "xnmt.persistence.bare", "dynet.zeros", "numpy.zeros", "numpy.random.uniform", "numpy.empty", "dynet.pick_batch", "dynet.pick", "xnmt.persistence.Ref", "dynet.l2_n...
[((6731, 6766), 'xnmt.persistence.Ref', 'Ref', (['"""exp_global.default_layer_dim"""'], {}), "('exp_global.default_layer_dim')\n", (6734, 6766), False, 'from xnmt.persistence import serializable_init, Serializable, Ref, Path, bare\n'), ((6796, 6839), 'xnmt.persistence.Ref', 'Ref', (['"""exp_global.weight_noise"""'], {'...
import ctypes as ct import numpy as np import scipy.io as scio import matplotlib.pyplot as plt # Init ctypes types DOUBLE = ct.c_double PtrDOUBLE = ct.POINTER(DOUBLE) PtrPtrDOUBLE = ct.POINTER(PtrDOUBLE) PtrPtrPtrDOUBLE = ct.POINTER(PtrPtrDOUBLE) class TestStruct(ct.Structure): _fields_ = [ ("Sca...
[ "matplotlib.pyplot.imshow", "ctypes.byref", "ctypes.POINTER", "scipy.io.savemat", "scipy.io.loadmat", "numpy.zeros", "matplotlib.pyplot.figure", "ctypes.CDLL", "matplotlib.pyplot.show" ]
[((149, 167), 'ctypes.POINTER', 'ct.POINTER', (['DOUBLE'], {}), '(DOUBLE)\n', (159, 167), True, 'import ctypes as ct\n'), ((183, 204), 'ctypes.POINTER', 'ct.POINTER', (['PtrDOUBLE'], {}), '(PtrDOUBLE)\n', (193, 204), True, 'import ctypes as ct\n'), ((223, 247), 'ctypes.POINTER', 'ct.POINTER', (['PtrPtrDOUBLE'], {}), '(...
import argparse import cv2 import numpy as np import torch.nn.functional as F from torchvision.transforms.functional import normalize from facexlib.matting import init_matting_model from facexlib.utils import img2tensor def main(args): modnet = init_matting_model() # read image img = cv2.imread(args.img...
[ "numpy.repeat", "argparse.ArgumentParser", "facexlib.utils.img2tensor", "torch.nn.functional.interpolate", "numpy.full", "torchvision.transforms.functional.normalize", "facexlib.matting.init_matting_model", "cv2.imread" ]
[((252, 272), 'facexlib.matting.init_matting_model', 'init_matting_model', ([], {}), '()\n', (270, 272), False, 'from facexlib.matting import init_matting_model\n'), ((560, 603), 'facexlib.utils.img2tensor', 'img2tensor', (['img'], {'bgr2rgb': '(True)', 'float32': '(True)'}), '(img, bgr2rgb=True, float32=True)\n', (570...
# Image-based testing borrowed from vispy """ Procedure for unit-testing with images: 1. Run unit tests at least once; this initializes a git clone of pyqtgraph/test-data in ~/.pyqtgraph. 2. Run individual test scripts with the PYQTGRAPH_AUDIT environment variable set: $ PYQTGRAPH_AUDIT=1 python pyqtgraph...
[ "numpy.clip", "base64.b64encode", "time.sleep", "numpy.array", "sys.exc_info", "httplib.HTTPConnection", "subprocess.Popen", "subprocess.CalledProcessError", "os.path.split", "os.path.isdir", "numpy.empty", "os.path.expanduser", "numpy.round", "numpy.abs", "subprocess.check_call", "os....
[((3948, 3993), 'os.path.join', 'os.path.join', (['dataPath', "(standardFile + '.png')"], {}), "(dataPath, standardFile + '.png')\n", (3960, 3993), False, 'import os\n'), ((8885, 8916), 'numpy.empty', 'np.empty', (['shape'], {'dtype': 'np.ubyte'}), '(shape, dtype=np.ubyte)\n', (8893, 8916), True, 'import numpy as np\n'...
import pandas as pd import numpy as np import csv csv_file_loc = './/data//for-full-text-annotation.csv' """ Read in the CSV file and get the required data from it. Format the data. """ def get_file_description(): data = {} all_rows = pd.read_csv(csv_file_loc) all_rows = np.asarray(all_rows) lab...
[ "numpy.asarray", "pandas.read_csv", "csv.reader" ]
[((246, 271), 'pandas.read_csv', 'pd.read_csv', (['csv_file_loc'], {}), '(csv_file_loc)\n', (257, 271), True, 'import pandas as pd\n'), ((287, 307), 'numpy.asarray', 'np.asarray', (['all_rows'], {}), '(all_rows)\n', (297, 307), True, 'import numpy as np\n'), ((815, 864), 'csv.reader', 'csv.reader', (['csvfile'], {'deli...
# Minimal example showing how to reuse the exported c-code with # different time-steps. # # There are two use-cases demonstrated here. One use-case is to change # the length of the time-stamp vector (this results in a different # N). Another use-case is to change the final time but keep the number # of shooting nodes i...
[ "numpy.tile", "numpy.eye", "sys.path.insert", "acados_template.AcadosOcpSolver", "acados_template.AcadosOcp", "utils.plot_pendulum", "numpy.diag", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.ndarray", "pendulum_model.export_pendulum_ode_model", "numpy.cumsum" ]
[((2088, 2119), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../common"""'], {}), "(0, '../common')\n", (2103, 2119), False, 'import sys\n'), ((2426, 2437), 'acados_template.AcadosOcp', 'AcadosOcp', ([], {}), '()\n', (2435, 2437), False, 'from acados_template import AcadosOcp, AcadosOcpSolver\n'), ((2459, 2486), ...
# ------------------------------------------------------------------------------------------------------------------------------------------------------------- # Main, three machines (image - KMC, text - Logistic Regression, features - RF) and all white pdfs files # @Authors: <NAME> and <NAME> # @Version: 1.0 # @Date ...
[ "csv.DictWriter", "sklearn.feature_extraction.text.TfidfTransformer", "sklearn.metrics.classification_report", "sklearn.ensemble.AdaBoostClassifier", "sklearn.ensemble.AdaBoostRegressor", "numpy.array", "sys.exit", "xgboost.sklearn.XGBRegressor", "os.path.exists", "sklearn.ensemble.RandomForestReg...
[((1825, 1850), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1848, 1850), False, 'import argparse\n'), ((2805, 2816), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2814, 2816), False, 'import os\n'), ((2836, 2878), 'os.path.join', 'os.path.join', (['folder_path', "args['dataset']"], {}), "(fo...
from __future__ import absolute_import import numpy as np import chainer import tqdm import glob import warnings from abc import ABCMeta, abstractmethod from collections import OrderedDict from ..data import load_image # NOQA class BaseDataset(chainer.dataset.DatasetMixin, metaclass=ABCMeta): """ Base class of ...
[ "collections.OrderedDict", "numpy.delete", "tqdm.tqdm", "numpy.asarray", "pandas.read_excel", "warnings.warn", "distutils.version.LooseVersion", "numpy.arange" ]
[((2079, 2092), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2090, 2092), False, 'from collections import OrderedDict\n'), ((5263, 5291), 'distutils.version.LooseVersion', 'LooseVersion', (['pd.__version__'], {}), '(pd.__version__)\n', (5275, 5291), False, 'from distutils.version import LooseVersion\n')...
# -*- coding: utf-8 -*- """ Created on Thu Aug 24 14:46:59 2017 Some personal numpy array filtering and finding intersections with indices @author: <NAME> """ import numpy as np import glob import os import shutil def idx_filter(idx, *array_list): new_array_list = [] for array in array_list: new_arra...
[ "numpy.in1d", "os.path.join", "os.path.isfile", "shutil.copyfile", "os.path.basename" ]
[((760, 783), 'os.path.join', 'os.path.join', (['dir1', '"""*"""'], {}), "(dir1, '*')\n", (772, 783), False, 'import os\n'), ((836, 865), 'os.path.basename', 'os.path.basename', (['curFullFile'], {}), '(curFullFile)\n', (852, 865), False, 'import os\n'), ((890, 917), 'os.path.join', 'os.path.join', (['dir2', 'curFile']...
# Written by <NAME>, 2018 import numpy as np import bisect class SDR_Classifier: """Maximum Likelyhood classifier for SDRs.""" def __init__(self, alpha, input_sdr, num_labels): """ Argument alpha is the small constant used by the exponential moving average which tracks input-output co...
[ "numpy.product", "numpy.random.random", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.nonzero", "numpy.random.uniform", "numpy.cumsum" ]
[((544, 647), 'numpy.random.uniform', 'np.random.uniform', (['(0.1 * self.alpha)', '(0.2 * self.alpha)'], {'size': '(self.input_sdr.size, self.num_labels)'}), '(0.1 * self.alpha, 0.2 * self.alpha, size=(self.input_sdr.\n size, self.num_labels))\n', (561, 647), True, 'import numpy as np\n'), ((2357, 2377), 'numpy.zer...
import os, sys os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="" import pandas as pd import numpy as np eps = 0.004 desired = { 0: 0.36239782, 1: 0.043841336, 2: 0.075268817, 3: 0.059322034, 4: 0.075268817, 5: 0.075268817, 6: 0.043841336, 7: 0.07526881...
[ "numpy.mean", "keras.models.load_model", "pandas.read_csv", "Christof.utils.f1_sub", "numpy.stack", "numpy.zeros", "numpy.linspace", "numpy.transpose", "numpy.arange", "numpy.load" ]
[((752, 790), 'numpy.load', 'np.load', (["(MODEL_PATH + 'pred_ul_40.npy')"], {}), "(MODEL_PATH + 'pred_ul_40.npy')\n", (759, 790), True, 'import numpy as np\n'), ((801, 839), 'numpy.load', 'np.load', (["(MODEL_PATH + 'pred_ur_40.npy')"], {}), "(MODEL_PATH + 'pred_ur_40.npy')\n", (808, 839), True, 'import numpy as np\n'...
import pyPROPOSAL as pp import numpy as np photo_real = [ pp.parametrization.photonuclear.Zeus, pp.parametrization.photonuclear.BezrukovBugaev, pp.parametrization.photonuclear.Rhode, pp.parametrization.photonuclear.Kokoulin ] particle_defs = [ pp.particle.MuMinusDef.get(), pp.particle.TauMinus...
[ "pyPROPOSAL.particle.TauMinusDef.get", "pyPROPOSAL.parametrization.photonuclear.ShadowButkevichMikhailov", "os.makedirs", "pyPROPOSAL.InterpolationDef", "pyPROPOSAL.EnergyCutSettings", "pyPROPOSAL.crosssection.PhotoIntegral", "pyPROPOSAL.parametrization.photonuclear.ShadowDuttaRenoSarcevicSeckel", "os...
[((1369, 1395), 'numpy.logspace', 'np.logspace', (['(4)', '(13)'], {'num': '(10)'}), '(4, 13, num=10)\n', (1380, 1395), True, 'import numpy as np\n'), ((1411, 1432), 'pyPROPOSAL.InterpolationDef', 'pp.InterpolationDef', ([], {}), '()\n', (1430, 1432), True, 'import pyPROPOSAL as pp\n'), ((266, 294), 'pyPROPOSAL.particl...
print("################################################################################") print("# Implementation of a multivariate pattern analysis based on the scikitlearn ") print("# toolbox (http://scikit-learn.org/stable/). It reads a matlab file containing ") print("# Xm: a matrix of trials x chans x...
[ "sklearn.cross_validation.KFold", "scipy.io.savemat", "scipy.io.loadmat", "sys.stdout.write", "numpy.reshape", "scipy.stats.scoreatpercentile", "numpy.empty", "sklearn.cross_validation.LeaveOneOut", "sklearn.feature_selection.SelectPercentile", "sys.stdout.flush", "numpy.ones", "sklearn.prepro...
[((1364, 1386), 'scipy.io.loadmat', 'sio.loadmat', (['filenameX'], {}), '(filenameX)\n', (1375, 1386), True, 'import scipy.io as sio\n'), ((1456, 1478), 'scipy.io.loadmat', 'sio.loadmat', (['filenamey'], {}), '(filenamey)\n', (1467, 1478), True, 'import scipy.io as sio\n'), ((1645, 1680), 'numpy.reshape', 'np.reshape',...
""" Helmoltz coils ============== A script that computes the magnetic field generated by a pair of Helmoltz coils. """ import numpy as np from scipy import special, linalg ############################################################################## # Function to caculate the field of a loop def base_vectors(n): ...
[ "numpy.sqrt", "numpy.cross", "scipy.special.ellipe", "numpy.sin", "numpy.zeros_like", "numpy.square", "scipy.special.ellipk", "numpy.array", "numpy.dot", "numpy.vstack", "numpy.cos", "numpy.ravel", "scipy.linalg.inv", "numpy.round", "numpy.arctan" ]
[((3661, 3681), 'numpy.vstack', 'np.vstack', (['(r0, -r0)'], {}), '((r0, -r0))\n', (3670, 3681), True, 'import numpy as np\n'), ((3703, 3720), 'numpy.vstack', 'np.vstack', (['(n, n)'], {}), '((n, n))\n', (3712, 3720), True, 'import numpy as np\n'), ((3918, 3934), 'numpy.zeros_like', 'np.zeros_like', (['r'], {}), '(r)\n...
import itertools import numpy as np import torch from ..math import complex_mult, conj_complex_mult def get_interpob(model): """Retrieves the interpolation dictionary from model. Different nufft objects use different interpolation objects. This function only extracts the minimum amount necessary for sp...
[ "torch.floor", "itertools.product", "torch.prod", "numpy.array", "torch.remainder", "torch.zeros", "torch.arange", "torch.ones" ]
[((2134, 2183), 'torch.zeros', 'torch.zeros', (['tm.shape'], {'dtype': 'dtype', 'device': 'device'}), '(tm.shape, dtype=dtype, device=device)\n', (2145, 2183), False, 'import torch\n'), ((2201, 2253), 'torch.zeros', 'torch.zeros', (['tm.shape'], {'dtype': 'int_type', 'device': 'device'}), '(tm.shape, dtype=int_type, de...
import torch from torch import optim from torchvision import datasets, transforms from vision import LeNet, CNN, weights_init from PIL import Image from utils import label_to_onehot, cross_entropy_for_onehot import torch.nn.functional as F import numpy as np from skimage.metrics import structural_similarity as ssim imp...
[ "torch.manual_seed", "PIL.Image.open", "utils.label_to_onehot", "torchvision.transforms.ToPILImage", "skimage.metrics.structural_similarity", "vision.LeNet", "torch.load", "torch.Tensor", "numpy.asarray", "matplotlib.pyplot.figure", "torch.cuda.is_available", "federated_utils.PQclass", "torc...
[((593, 619), 'sys.path.append', 'sys.path.append', (['elad_path'], {}), '(elad_path)\n', (608, 619), False, 'import sys\n'), ((620, 647), 'sys.path.append', 'sys.path.append', (['tomer_path'], {}), '(tomer_path)\n', (635, 647), False, 'import sys\n'), ((970, 983), 'federated_utils.PQclass', 'PQclass', (['args'], {}), ...
import tensorflow as tf import numpy as np from model_fn.model_fn_nlp.util_nlp.attention import MultiHeadAttention def get_angles(pos, i, d_model): angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(d_model)) return pos * angle_rates def positional_encoding(position, d_model): angle_rads = ge...
[ "tensorflow.shape", "numpy.arange", "model_fn.model_fn_nlp.util_nlp.attention.MultiHeadAttention", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Embedding", "tensorflow.keras.layers.Dense", "numpy.cos", "numpy.sin", "tensorflow.cast", "numpy.float32", "tensorflow.keras.layers.Layer...
[((541, 568), 'numpy.sin', 'np.sin', (['angle_rads[:, 0::2]'], {}), '(angle_rads[:, 0::2])\n', (547, 568), True, 'import numpy as np\n'), ((646, 673), 'numpy.cos', 'np.cos', (['angle_rads[:, 1::2]'], {}), '(angle_rads[:, 1::2])\n', (652, 673), True, 'import numpy as np\n'), ((734, 773), 'tensorflow.cast', 'tf.cast', ([...
#!/usr/bin/env python """ Example of training DCGAN on MNIST using PBT with Tune's function API. """ import ray from ray import tune from ray.tune.schedulers import PopulationBasedTraining import argparse import os from filelock import FileLock import torch import torch.nn as nn import torch.nn.parallel import torch.o...
[ "ray.tune.report", "torch.cuda.is_available", "common.train", "common.Discriminator", "ray.init", "os.path.exists", "argparse.ArgumentParser", "ray.tune.checkpoint_dir", "os.path.expanduser", "ray.tune.choice", "os.path.dirname", "common.demo_gan", "common.get_data_loader", "torch.device",...
[((702, 745), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (714, 745), False, 'import torch\n'), ((892, 904), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (902, 904), True, 'import torch.nn as nn\n'), ((2657, 2682), 'argparse.ArgumentParser', 'ar...
# 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. import os import copy import numpy as np import torch from lottery.branch import base import models.registry from pruning.mask import Mask from...
[ "lottery.branch.morphism.change_depth", "pruning.mask.Mask.ones_like", "pruning.mask.Mask.load", "os.path.join", "numpy.linspace", "pruning.pruned_model.PrunedModel", "copy.deepcopy", "training.train.standard_train", "torch.all" ]
[((516, 545), 'copy.deepcopy', 'copy.deepcopy', (['pruned_model_a'], {}), '(pruned_model_a)\n', (529, 545), False, 'import copy\n'), ((2821, 2847), 'pruning.mask.Mask.load', 'Mask.load', (['self.level_root'], {}), '(self.level_root)\n', (2830, 2847), False, 'from pruning.mask import Mask\n'), ((3227, 3273), 'copy.deepc...
# =============================================================================== # Copyright 2015 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
[ "numpy.ones", "numpy.hstack", "numpy.random.random", "numpy.zeros", "numpy.vstack" ]
[((2740, 2761), 'numpy.random.random', 'random', ([], {'size': 'nsamples'}), '(size=nsamples)\n', (2746, 2761), False, 'from numpy.random import random\n'), ((2869, 2883), 'numpy.ones', 'ones', (['nsamples'], {}), '(nsamples)\n', (2873, 2883), False, 'from numpy import ones, vstack, zeros, hstack\n'), ((3026, 3041), 'n...
import numpy as np import zmq class Subscriber: def __init__(self, address='tcp://127.0.0.1', port=9999): self.context = zmq.Context() self.socket = self.context.socket(zmq.SUB) self.socket.setsockopt(zmq.SUBSCRIBE, b'') self.socket.connect(f'{address}:{port}') def recv(self):...
[ "numpy.frombuffer", "zmq.Context" ]
[((135, 148), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (146, 148), False, 'import zmq\n'), ((415, 462), 'numpy.frombuffer', 'np.frombuffer', (['message'], {'dtype': "metadata['dtype']"}), "(message, dtype=metadata['dtype'])\n", (428, 462), True, 'import numpy as np\n')]
import os, sys os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tensorflow as tf import cv2 import numpy as np sys.path.insert(1, os.path.join(sys.path[0], '/mywork/tensorflow-tuts/sd19reader')) from batches2patches_tensorflow import GetFuncToPatches, GetFuncOverlapAdd from myutils import describe from vizutils import ...
[ "numpy.prod", "tensorflow.InteractiveSession", "tensorflow.initialize_all_variables", "cv2.imread", "tensorflow.placeholder", "batches2patches_tensorflow.GetFuncOverlapAdd", "os.path.join", "cv2.imshow", "os.path.realpath", "cv2.waitKey", "cv2.getTrackbarPos", "numpy.expand_dims", "batches2p...
[((469, 512), 'os.path.join', 'os.path.join', (['path2file', '"""Lenna_noise1.png"""'], {}), "(path2file, 'Lenna_noise1.png')\n", (481, 512), False, 'import os, sys\n'), ((631, 679), 'numpy.pad', 'np.pad', (['testim', '[(1, 1), (1, 1), (0, 0)]', '"""edge"""'], {}), "(testim, [(1, 1), (1, 1), (0, 0)], 'edge')\n", (637, ...
# Copyright 2017 The TensorFlow Authors modified by <NAME>. 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 ...
[ "tensorflow.shape", "numpy.random.rand", "numpy.ones", "numpy.arange", "kerod.utils.ops.item_assignment", "numpy.testing.assert_allclose", "kerod.utils.ops.indices_to_dense_vector", "numpy.random.randint", "tensorflow.constant", "numpy.zeros", "numpy.testing.assert_array_equal", "numpy.random....
[((854, 877), 'numpy.random.randint', 'np.random.randint', (['size'], {}), '(size)\n', (871, 877), True, 'import numpy as np\n'), ((974, 1006), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'np.float32'}), '(size, dtype=np.float32)\n', (982, 1006), True, 'import numpy as np\n'), ((1069, 1094), 'tensorflow.constant', ...
""" Copyright (c) Microsoft Corporation. Licensed under the MIT license. convert image npz to LMDB """ import argparse import glob import io import json import multiprocessing as mp import os from os.path import basename, exists from cytoolz import curry import numpy as np from tqdm import tqdm import lmdb import ms...
[ "os.path.exists", "numpy.savez", "msgpack_numpy.patch", "argparse.ArgumentParser", "os.makedirs", "json.dump", "io.BytesIO", "glob.glob", "lmdb.open", "os.path.basename", "multiprocessing.Pool", "numpy.savez_compressed", "numpy.load", "msgpack.dumps" ]
[((347, 368), 'msgpack_numpy.patch', 'msgpack_numpy.patch', ([], {}), '()\n', (366, 368), False, 'import msgpack_numpy\n'), ((1315, 1330), 'os.path.basename', 'basename', (['fname'], {}), '(fname)\n', (1323, 1330), False, 'from os.path import basename, exists\n'), ((1659, 1697), 'msgpack.dumps', 'msgpack.dumps', (['dum...
import numpy as np import theano.tensor as tt from . import Hypers, ones from ...libs.tensors import tt_to_num class Metric(Hypers): def __call__(self, x1, x2): return tt.abs_(x1 - x2) def gram(self, x1, x2): #try: return (self(x1[:, self.dims].dimshuffle([0, 'x', 1]), x2[:, self.dims...
[ "numpy.abs", "theano.tensor.diag", "numpy.ones", "theano.tensor.sum", "theano.tensor.minimum", "theano.tensor.abs_", "numpy.zeros", "theano.tensor.eq", "numpy.float32", "theano.tensor.dot" ]
[((182, 198), 'theano.tensor.abs_', 'tt.abs_', (['(x1 - x2)'], {}), '(x1 - x2)\n', (189, 198), True, 'import theano.tensor as tt\n'), ((539, 558), 'numpy.ones', 'np.ones', (['self.shape'], {}), '(self.shape)\n', (546, 558), True, 'import numpy as np\n'), ((1976, 2004), 'theano.tensor.sum', 'tt.sum', (['(0.5 * (x1 - x2)...
# -*- coding: utf-8 -*- """ Created on Tue Oct 30 10:12:34 2018 @author: kite """ """ 完成策略的回测,绘制以沪深300为基准的收益曲线,计算年化收益、最大回撤、夏普比率 主要的方法包括: ma10_factor: is_k_up_break_ma10:当日K线是否上穿10日均线 is_k_down_break_ma10:当日K线是否下穿10日均线 compare_close_2_ma_10:工具方法,某日收盘价和当日对应的10日均线的关系 backtest:回测主...
[ "pandas.Series", "pickle.dump", "matplotlib.pyplot.show", "stock_pool_strategy.find_out_stocks", "pandas.DatetimeIndex", "matplotlib.pyplot.style.use", "stock_util.get_trading_dates", "factor.ma10_factor.is_k_down_break_ma10", "stock_util.dynamic_max_drawdown", "factor.ma10_factor.is_k_up_break_ma...
[((886, 909), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (899, 909), True, 'import matplotlib.pyplot as plt\n'), ((2365, 2376), 'pandas.Series', 'pd.Series', ([], {}), '()\n', (2374, 2376), True, 'import pandas as pd\n'), ((3283, 3337), 'pandas.DataFrame', 'pd.DataFrame', ([...
import torch import torch.nn as nn import numpy as np import random from torch import optim from rl_network import * class Agent: """ 학습 에이전트 네트워크 모델을 받고, 학습을 수행함 """ def __init__(self, num_states, num_actions, network_type, learning_rate, use_rnn=False, gamma=0.99, capa...
[ "random.sample", "torch.max", "numpy.zeros", "torch.sum", "torch.no_grad", "torch.zeros" ]
[((5858, 5901), 'random.sample', 'random.sample', (['self.memory', 'self.batch_size'], {}), '(self.memory, self.batch_size)\n', (5871, 5901), False, 'import random\n'), ((6310, 6360), 'numpy.zeros', 'np.zeros', ([], {'shape': '(*reward_shape, 1)', 'dtype': 'np.float'}), '(shape=(*reward_shape, 1), dtype=np.float)\n', (...
import sys import argparse import numpy as np from dataclasses import dataclass from mchap.application import baseclass from mchap.application.baseclass import SampleAssemblyError, SAMPLE_ASSEMBLY_ERROR from mchap.application.arguments import ( CALL_MCMC_PARSER_ARGUMENTS, collect_call_mcmc_program_arguments, )...
[ "mchap.io.qual_of_prob", "mchap.application.baseclass.SAMPLE_ASSEMBLY_ERROR.format", "numpy.unique", "argparse.ArgumentParser", "mchap.jitutils.natural_log_to_log10", "sys.exit", "mchap.application.baseclass.SampleAssemblyError", "mchap.calling.exact.genotype_likelihoods", "mchap.calling.classes.Cal...
[((836, 885), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""MCMC haplotype calling"""'], {}), "('MCMC haplotype calling')\n", (859, 885), False, 'import argparse\n'), ((1149, 1190), 'mchap.application.arguments.collect_call_mcmc_program_arguments', 'collect_call_mcmc_program_arguments', (['args'], {}), '(...
import pandas as pd import os import click import numpy as np opj = os.path.join @click.command() @click.option('--datadir', type=str, default='./data/lorenz/bias_experiment') def main(datadir): df = pd.read_pickle(opj(datadir, 'results.pkl')) print(df) print('\\toprule') print('$\\sigma_w$ & $\\si...
[ "click.option", "numpy.abs", "click.command" ]
[((85, 100), 'click.command', 'click.command', ([], {}), '()\n', (98, 100), False, 'import click\n'), ((102, 178), 'click.option', 'click.option', (['"""--datadir"""'], {'type': 'str', 'default': '"""./data/lorenz/bias_experiment"""'}), "('--datadir', type=str, default='./data/lorenz/bias_experiment')\n", (114, 178), F...
#!/usr/bin/env python # projectS and projectC were written by <NAME>. import time start = time.time() import argparse import cv2 import os import dlib import numpy as np np.set_printoptions(precision=2) import openface from matplotlib import cm fileDir = os.path.dirname(os.path.realpath(__file__)) modelDir = os.p...
[ "openface.TorchNeuralNet", "cv2.rectangle", "numpy.sqrt", "matplotlib.cm.Set1", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "numpy.sin", "numpy.multiply", "argparse.ArgumentParser", "cv2.line", "cv2.addWeighted", "numpy.linspace", "cv2.waitKey", "dlib.correlation_tracker", "c...
[((92, 103), 'time.time', 'time.time', ([], {}), '()\n', (101, 103), False, 'import time\n'), ((174, 206), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (193, 206), True, 'import numpy as np\n'), ((316, 353), 'os.path.join', 'os.path.join', (['fileDir', '""".."""', '"""...
# The dataset code has been adapted from: # https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html # from https://github.com/pytorch/tutorials # which has been distributed under the following license: ################################################################################ # BSD 3-Clause License #...
[ "torch.squeeze", "torch.as_tensor", "PIL.Image.open", "numpy.unique", "matplotlib.pyplot.show", "avalanche.benchmarks.datasets.default_dataset_location", "numpy.where", "torchvision.transforms.ToPILImage", "pathlib.Path", "torch.utils.data.dataloader.DataLoader", "numpy.max", "numpy.array", ...
[((3270, 3291), 'PIL.Image.open', 'Image.open', (['mask_path'], {}), '(mask_path)\n', (3280, 3291), False, 'from PIL import Image\n'), ((7804, 7840), 'torch.utils.data.dataloader.DataLoader', 'DataLoader', (['train_data'], {'batch_size': '(1)'}), '(train_data, batch_size=1)\n', (7814, 7840), False, 'from torch.utils.da...
import sys import functools import signal import select import socket import numpy as np import pickle import matplotlib.pyplot as plt import time import datetime from multiprocessing import Process, Queue sys.path.append('../dhmsw/') import interface import telemetry_iface_ag import struct PLOT = True headerStruct = ...
[ "struct.calcsize", "telemetry_iface_ag.Framesource_Telemetry", "multiprocessing.Process", "telemetry_iface_ag.Session_Telemetry", "sys.path.append", "telemetry_iface_ag.Hologram_Telemetry", "telemetry_iface_ag.Heartbeat_Telemetry", "telemetry_iface_ag.Datalogger_Telemetry", "numpy.frombuffer", "te...
[((206, 234), 'sys.path.append', 'sys.path.append', (['"""../dhmsw/"""'], {}), "('../dhmsw/')\n", (221, 234), False, 'import sys\n'), ((320, 340), 'struct.Struct', 'struct.Struct', (['"""III"""'], {}), "('III')\n", (333, 340), False, 'import struct\n'), ((7944, 7977), 'socket.gethostbyname', 'socket.gethostbyname', (['...
# coding: utf-8 import numpy as np from typing import List, Union from collections import OrderedDict from datetime import datetime from .objects import Direction, BI, FakeBI, Signal from .enum import Freq from .utils.ta import MACD, SMA, KDJ from .cobra.utils import kdj_gold_cross from . import analyze def check_th...
[ "numpy.array", "collections.OrderedDict" ]
[((23899, 23912), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (23910, 23912), False, 'from collections import OrderedDict\n'), ((24475, 24488), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (24486, 24488), False, 'from collections import OrderedDict\n'), ((25203, 25216), 'collections.Order...
# This module contains the code to create maps import numpy as np from itertools import combinations import matplotlib.pyplot as plt import itertools # For plotting import seaborn as sns import logging import statistics import time def manhattan(coords_ind1, coords_ind2): return abs(coords_ind1[0] - coords_ind...
[ "logging.getLogger", "seaborn.cubehelix_palette", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "numpy.digitize", "matplotlib.pyplot.xlabel", "seaborn.heatmap", "numpy.linspace", "numpy.zeros", "matplotlib.pyplot.yticks", "numpy.concatenate", "numpy.transpose", "matplotlib.pyplot.s...
[((792, 856), 'logging.getLogger', 'logging.getLogger', (['"""illumination_map.IlluminationAxisDefinition"""'], {}), "('illumination_map.IlluminationAxisDefinition')\n", (809, 856), False, 'import logging\n'), ((1227, 1271), 'numpy.linspace', 'np.linspace', (['min_value', 'max_value', 'num_cells'], {}), '(min_value, ma...
import os import warnings from typing import Optional, Tuple, Union, List import joblib import numpy as np from ConfigSpace import Configuration from sklearn import clone from sklearn.base import is_classifier from sklearn.model_selection import check_cv from sklearn.model_selection._validation import _fit_and_predict...
[ "dswizard.util.util.model_file", "dswizard.util.util.score", "numpy.reshape", "sklearn.base.is_classifier", "os.path.join", "sklearn.model_selection._validation._fit_and_predict", "sklearn.utils.indexable", "sklearn.utils.validation._num_samples", "numpy.concatenate", "sklearn.clone", "joblib.du...
[((819, 874), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (842, 874), False, 'import warnings\n'), ((1661, 1676), 'sklearn.clone', 'clone', (['pipeline'], {}), '(pipeline)\n', (1666, 1676), False, 'from sklearn import clone...
""" Module realize VLImage - structure for storing image in special format. """ from enum import Enum from pathlib import Path from typing import Optional, Union import requests from FaceEngine import FormatType, Image as CoreImage # pylint: disable=E0611,E0401 import numpy as np from PIL.Image import Image as PilImag...
[ "PIL.Image.fromarray", "pathlib.Path", "FaceEngine.Image", "requests.get", "numpy.array" ]
[((6990, 7001), 'FaceEngine.Image', 'CoreImage', ([], {}), '()\n', (6999, 7001), True, 'from FaceEngine import FormatType, Image as CoreImage\n'), ((11343, 11373), 'PIL.Image.fromarray', 'pilImage.fromarray', (['imageArray'], {}), '(imageArray)\n', (11361, 11373), True, 'from PIL import Image as pilImage\n'), ((6039, 6...
# modify from PointGroup # Written by <NAME> import os import os.path as osp import logging from typing import Optional from operator import itemgetter from copy import deepcopy import gorilla import torch import numpy as np import open3d as o3d COLORSEMANTIC = np.array([ [171, 198, 230], # rgb(171, 198, 230) ...
[ "gorilla.derive_logger", "numpy.where", "torch.load", "os.path.join", "os.path.isfile", "open3d.io.read_triangle_mesh", "numpy.array", "open3d.io.write_point_cloud", "numpy.zeros", "open3d.geometry.PointCloud", "copy.deepcopy", "operator.itemgetter", "numpy.loadtxt", "numpy.load", "numpy...
[((264, 617), 'numpy.array', 'np.array', (['[[171, 198, 230], [143, 223, 142], [0, 120, 177], [255, 188, 126], [189, \n 189, 57], [144, 86, 76], [255, 152, 153], [222, 40, 47], [197, 176, 212\n ], [150, 103, 185], [200, 156, 149], [0, 190, 206], [252, 183, 210], [\n 219, 219, 146], [255, 127, 43], [234, 119, 1...
#!/usr/bin/env python3 import os import numpy as np import matplotlib.pyplot as plt from scipy import signal fs = 1000 # sampling frequency fc = 6 # cut-off frequency t = np.arange(1000)/fs sga = np.sin(2*np.pi*2*t) # signal with f = 2 sgb = np.sin(2*np.pi*10*t) # signal with f = 10 sgo = sga + sgb #+ (np.rando...
[ "numpy.arange", "scipy.signal.filtfilt", "matplotlib.pyplot.plot", "scipy.signal.butter", "scipy.signal.lfilter", "numpy.sin", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((201, 226), 'numpy.sin', 'np.sin', (['(2 * np.pi * 2 * t)'], {}), '(2 * np.pi * 2 * t)\n', (207, 226), True, 'import numpy as np\n'), ((249, 275), 'numpy.sin', 'np.sin', (['(2 * np.pi * 10 * t)'], {}), '(2 * np.pi * 10 * t)\n', (255, 275), True, 'import numpy as np\n'), ((360, 386), 'scipy.signal.butter', 'signal.but...
# -*- coding: utf-8 -*- # Tests for module mosaic.immutable_model #----------------------------------------------------------------------------- # Copyright (C) 2013 The Mosaic Development Team # # Distributed under the terms of the BSD License. The full license is in # the file LICENSE.txt, distributed as p...
[ "mosaic.immutable_model.SiteLabel", "numpy.array", "unittest.main", "numpy.arange", "unittest.TestSuite", "mosaic.immutable_model.FragmentRef", "numpy.float64", "mosaic.immutable_model.fragment", "mosaic.immutable_model.TemplateSiteLabel", "mosaic.immutable_model.polymer", "mosaic.immutable_mode...
[((23536, 23557), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (23555, 23557), False, 'import unittest\n'), ((23566, 23586), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (23584, 23586), False, 'import unittest\n'), ((23982, 23997), 'unittest.main', 'unittest.main', ([], {}), '()\n', ...
# Code from Chapter 3 of Machine Learning: An Algorithmic Perspective (2nd Edition) # by <NAME> (http://stephenmonika.net) # You are free to use, change, or redistribute the code in any way you wish for # non-commercial purposes, but please maintain the name of the original author. # This code comes with no warranty ...
[ "numpy.zeros", "pcn.pcn", "cPickle.load", "gzip.open" ]
[((470, 501), 'gzip.open', 'gzip.open', (['"""mnist.pkl.gz"""', '"""rb"""'], {}), "('mnist.pkl.gz', 'rb')\n", (479, 501), False, 'import cPickle, gzip\n'), ((521, 536), 'cPickle.load', 'cPickle.load', (['f'], {}), '(f)\n', (533, 536), False, 'import cPickle, gzip\n'), ((726, 747), 'numpy.zeros', 'np.zeros', (['(nread, ...
import sys import numpy as np from cv2 import BRISK_create from cv2.xfeatures2d import FREAK_create from numpy import histogramdd from skimage.color import rgb2lab, rgb2hsv from skimage.feature import local_binary_pattern, greycoprops, greycomatrix from sklearn.base import TransformerMixin from sklearn.cluster import ...
[ "skimage.feature.local_binary_pattern", "sys.path.append", "numpy.divide", "numpy.mean", "numpy.histogram", "numpy.reshape", "helpers.img_utils.tif_to_grayscale", "skimage.color.rgb2lab", "numpy.concatenate", "sklearn.preprocessing.MinMaxScaler", "cv2.xfeatures2d.FREAK_create", "helpers.img_ut...
[((392, 414), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (407, 414), False, 'import sys\n'), ((1451, 1487), 'numpy.mean', 'np.mean', (['imgs'], {'axis': 'self.pixels_axis'}), '(imgs, axis=self.pixels_axis)\n', (1458, 1487), True, 'import numpy as np\n'), ((1502, 1537), 'numpy.std', 'np.std'...
# -*- coding: utf-8 -*- #from __future__ import print_function #import pixy #from ctypes import * #from pixy import * import math as ma import numpy as np test_data = 120,100 #test input #hight = 495-114 #mm #ball parameter r_ball = 114.8 #mm 'PIXY Parameter' #pixy-cam image size in pixy-coordination delta_X_pixy =...
[ "numpy.eye", "numpy.median", "math.tan", "math.radians", "math.cos", "numpy.array", "numpy.zeros", "numpy.dot", "numpy.linalg.inv", "math.sin", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((368, 382), 'math.radians', 'ma.radians', (['(33)'], {}), '(33)\n', (378, 382), True, 'import math as ma\n'), ((449, 463), 'math.radians', 'ma.radians', (['(47)'], {}), '(47)\n', (459, 463), True, 'import math as ma\n'), ((507, 521), 'math.radians', 'ma.radians', (['(75)'], {}), '(75)\n', (517, 521), True, 'import ma...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Image conversion functionality for trivector""" from enum import Enum import numpy as np import svgwrite import cv2 import progressbar def upper_tri_sum(d3array: np.ndarray) -> np.ndarray: """Get a 3D image array's upper diagonal's pixel color average :par...
[ "numpy.sum", "cv2.imread", "svgwrite.rgb", "numpy.rot90" ]
[((3986, 4008), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (3996, 4008), False, 'import cv2\n'), ((797, 816), 'numpy.sum', 'np.sum', (['tri'], {'axis': '(0)'}), '(tri, axis=0)\n', (803, 816), True, 'import numpy as np\n'), ((1712, 1731), 'numpy.sum', 'np.sum', (['tri'], {'axis': '(0)'}), '(tri,...
from __future__ import absolute_import, division, print_function import math import os import sys import h5py import numpy as np from cctbx import factor_ev_angstrom from cctbx.eltbx import attenuation_coefficient from scitbx import matrix from scitbx.array_family import flex from dxtbx.format.FormatHDF5 import For...
[ "cctbx.eltbx.attenuation_coefficient.get_table", "scitbx.array_family.flex.bool", "numpy.logical_not", "scitbx.array_family.flex.int", "dxtbx.model.ParallaxCorrectedPxMmStrategy", "h5py.File", "numpy.ascontiguousarray", "math.cos", "scitbx.matrix.col", "numpy.empty", "dxtbx.model.detector.Detect...
[((4656, 4691), 'h5py.File', 'h5py.File', (['self.image_filename', '"""r"""'], {}), "(self.image_filename, 'r')\n", (4665, 4691), False, 'import h5py\n'), ((4897, 4932), 'h5py.File', 'h5py.File', (['self.image_filename', '"""r"""'], {}), "(self.image_filename, 'r')\n", (4906, 4932), False, 'import h5py\n'), ((6279, 631...
import numpy as np import numba as nb import matplotlib.pyplot as plt from scipy import interpolate class Similarity(object): """ Class to compute the similarity between two diffraction patterns """ def __init__(self, f, g, N = None, x_range = None, l = 2.0, weight = 'cosine'): """ ...
[ "numpy.abs", "numpy.sqrt", "numba.f8", "matplotlib.pyplot.plot", "scipy.interpolate.interp1d", "numpy.max", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.cos", "numpy.min", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((1095, 1131), 'numpy.linspace', 'np.linspace', (['(-self.l)', 'self.l', 'self.N'], {}), '(-self.l, self.l, self.N)\n', (1106, 1131), True, 'import numpy as np\n'), ((1606, 1665), 'numba.f8', 'nb.f8', (['nb.f8[:]', 'nb.f8[:]', 'nb.f8', 'nb.i8', 'nb.f8[:]', 'nb.f8[:]'], {}), '(nb.f8[:], nb.f8[:], nb.f8, nb.i8, nb.f8[:]...
import numpy as np import pandas as pd import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.optimizers import Adam from tensorflow.keras.metrics import categorical_crossentropy from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.callbacks import ModelCheck...
[ "numpy.unique", "pandas.read_csv", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.optimizers.Adam", "numpy.array", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.applications.MobileNetV2" ]
[((530, 581), 'pandas.read_csv', 'pd.read_csv', (['"""Manually_CSV/training.csv"""'], {'dtype': 'str'}), "('Manually_CSV/training.csv', dtype=str)\n", (541, 581), True, 'import pandas as pd\n'), ((598, 651), 'pandas.read_csv', 'pd.read_csv', (['"""Manually_CSV/validation.csv"""'], {'dtype': 'str'}), "('Manually_CSV/val...
import datetime import inspect from io import BytesIO import os import pickle import shutil import tempfile import unittest from unittest.mock import patch import asdf import numpy from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from modelforge import configuration, storage_backend fr...
[ "modelforge.meta.generate_new_meta", "pickle.dumps", "io.BytesIO", "numpy.array", "asdf.open", "unittest.main", "pickle.loads", "unittest.mock.patch", "numpy.arange", "datetime.datetime", "os.path.exists", "modelforge.model.disassemble_sparse_matrix", "modelforge.models.GenericModel", "num...
[((2991, 3050), 'modelforge.meta.generate_new_meta', 'generate_new_meta', (['name', '"""test"""', '"""source{d}"""', '"""Proprietary"""'], {}), "(name, 'test', 'source{d}', 'Proprietary')\n", (3008, 3050), False, 'from modelforge.meta import generate_new_meta\n'), ((20727, 20742), 'unittest.main', 'unittest.main', ([],...
import typing import cv2 import numpy as np from numpy.lib.polynomial import poly import streamlit as st import plotly.express as px import plotly.graph_objects as go from utils.configs import IMAGES, DetectionConfig, RunningModes from utils.configs import default_config from utils.configs import birds_config from ut...
[ "streamlit.image", "numpy.array", "cv2.imdecode", "utils.configs.DetectionConfig", "cv2.threshold", "streamlit.warning", "streamlit.sidebar.header", "streamlit.sidebar.checkbox", "streamlit.sidebar.markdown", "streamlit.sidebar.slider", "streamlit.set_page_config", "streamlit.markdown", "cv2...
[((551, 567), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (561, 567), False, 'import cv2\n'), ((663, 699), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (675, 699), False, 'import cv2\n'), ((819, 856), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RG...
""" Copyright (c) 2021, WSO2 Inc. (http://www.wso2.com). All Rights Reserved. This software is the property of WSO2 Inc. and its suppliers, if any. Dissemination of any information or reproduction of any material contained herein is strictly forbidden, unless permitted by WSO2 in accordance with the WSO2 Comme...
[ "numpy.abs", "sklearn.preprocessing.LabelEncoder", "numpy.copy", "pymc3.find_MAP", "pandas.read_csv", "pymc3.gp.Marginal", "pymc3.sample_posterior_predictive", "sklearn.utils.shuffle", "pymc3.gp.cov.Polynomial", "csv.writer", "sklearn.metrics.mean_squared_error", "numpy.square", "numpy.array...
[((3210, 3244), 'pandas.read_csv', 'pd.read_csv', (['"""dataset/dataset.csv"""'], {}), "('dataset/dataset.csv')\n", (3221, 3244), True, 'import pandas as pd\n'), ((3477, 3491), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (3489, 3491), False, 'from sklearn.preprocessing import LabelEncoder\n'...