code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Provides unit tests for preprocessing helper routines. """ # License: MIT from __future__ import absolute_import, division import numpy as np import pandas as pd from sklearn.utils import check_random_state import reanalysis_dbns.utils as rdu def test_construction_of_lagged_dataframe(): """Test construct...
[ "pandas.DataFrame", "sklearn.utils.check_random_state", "pandas.date_range", "pandas.Timestamp", "numpy.std", "numpy.zeros", "numpy.mean", "numpy.arange", "reanalysis_dbns.utils.standardize_time_series", "pandas.Categorical", "reanalysis_dbns.utils.remove_polynomial_trend", "reanalysis_dbns.ut...
[((389, 402), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (398, 402), True, 'import numpy as np\n'), ((547, 585), 'reanalysis_dbns.utils.construct_lagged_data', 'rdu.construct_lagged_data', (['offsets', 'df'], {}), '(offsets, df)\n', (572, 585), True, 'import reanalysis_dbns.utils as rdu\n'), ((608, 624), 'n...
# -*- coding: utf-8 -*- ########################################################################## # pySAP - Copyright (C) CEA, 2017 - 2018 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-e...
[ "numpy.abs", "numpy.transpose", "numpy.iscomplex", "pyqtgraph.mkQApp", "pyqtgraph.image", "pyqtgraph.plot" ]
[((1040, 1058), 'pyqtgraph.mkQApp', 'pyqtgraph.mkQApp', ([], {}), '()\n', (1056, 1058), False, 'import pyqtgraph\n'), ((988, 1003), 'numpy.abs', 'numpy.abs', (['data'], {}), '(data)\n', (997, 1003), False, 'import numpy\n'), ((944, 965), 'numpy.iscomplex', 'numpy.iscomplex', (['data'], {}), '(data)\n', (959, 965), Fals...
import tensorflow import matplotlib.pyplot as plt import pandas_datareader as pdr import pandas as pd import math import statistics import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.layers import LSTM from sklearn.metrics import mean_square...
[ "pandas.read_csv", "numpy.quantile", "statistics.mean" ]
[((334, 368), 'pandas.read_csv', 'pd.read_csv', (['"""IMDB-Movie-Data.csv"""'], {}), "('IMDB-Movie-Data.csv')\n", (345, 368), True, 'import pandas as pd\n'), ((442, 463), 'statistics.mean', 'statistics.mean', (['rate'], {}), '(rate)\n', (457, 463), False, 'import statistics\n'), ((479, 501), 'numpy.quantile', 'np.quant...
"""Ledoit & Wolf constant correlation unequal variance shrinkage estimator.""" import numpy as np import pandas as pd from poptimizer.data.views import quotes def shrinkage(returns: np.array) -> tuple[np.array, float, float]: # noqa: WPS210 """Shrinks sample covariance matrix towards constant correlation unequa...
[ "numpy.fill_diagonal", "poptimizer.data.views.quotes.div_and_prices", "numpy.mean", "numpy.linalg.norm", "numpy.diag" ]
[((1033, 1072), 'numpy.mean', 'np.mean', (['returns'], {'axis': '(0)', 'keepdims': '(True)'}), '(returns, axis=0, keepdims=True)\n', (1040, 1072), True, 'import numpy as np\n'), ((1449, 1482), 'numpy.fill_diagonal', 'np.fill_diagonal', (['prior', 'variance'], {}), '(prior, variance)\n', (1465, 1482), True, 'import nump...
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
[ "tensorflow.compat.v1.zeros", "tensorflow.compat.v1.variable_scope", "tensorflow.compat.v1.name_scope", "numpy.hstack", "tensorflow.compat.v1.nn.xw_plus_b", "tensorflow.compat.v1.truncated_normal", "numpy.array", "numpy.prod" ]
[((1594, 1622), 'numpy.hstack', 'np.hstack', (['flattened_weights'], {}), '(flattened_weights)\n', (1603, 1622), True, 'import numpy as np\n'), ((2262, 2299), 'numpy.prod', 'np.prod', (['weights_variable[name].shape'], {}), '(weights_variable[name].shape)\n', (2269, 2299), True, 'import numpy as np\n'), ((2323, 2380), ...
# Third-party import numpy as np from scipy.integrate import quad from scipy.interpolate import interp1d from astropy import units as u from typing import Iterable # Project from ..util import check_random_state, check_units __all__ = ['IMFIntegrator', 'salpeter_params', 'kroupa_params', 'scalo_params', ...
[ "numpy.asarray", "numpy.cumsum", "numpy.diff", "numpy.where", "scipy.interpolate.interp1d", "numpy.log10", "numpy.concatenate" ]
[((5239, 5257), 'numpy.diff', 'np.diff', (['bin_edges'], {}), '(bin_edges)\n', (5246, 5257), True, 'import numpy as np\n'), ((5268, 5291), 'numpy.cumsum', 'np.cumsum', (['(weights * dm)'], {}), '(weights * dm)\n', (5277, 5291), True, 'import numpy as np\n'), ((5323, 5385), 'scipy.interpolate.interp1d', 'interp1d', (['c...
""" A pytest module to test numpy methods, both supported and unsupported. Numpy methods are selected from this API reference: https://numpy.org/doc/stable/reference/routines.array-manipulation.html """ import random import numpy as np import pytest import galois from ..helper import randint, array_equal #########...
[ "numpy.moveaxis", "numpy.resize", "numpy.ravel", "numpy.shape", "numpy.tile", "numpy.unique", "numpy.atleast_2d", "random.randint", "numpy.copy", "numpy.transpose", "numpy.insert", "numpy.append", "pytest.raises", "numpy.reshape", "numpy.repeat", "numpy.roll", "numpy.flipud", "nump...
[((525, 552), 'random.choice', 'random.choice', (['field.dtypes'], {}), '(field.dtypes)\n', (538, 552), False, 'import random\n'), ((620, 630), 'numpy.copy', 'np.copy', (['a'], {}), '(a)\n', (627, 630), True, 'import numpy as np\n'), ((791, 818), 'random.choice', 'random.choice', (['field.dtypes'], {}), '(field.dtypes)...
import logging import cv2 import PIL from PIL import Image import scipy import scipy.ndimage import numpy as np from face_utils.Face import Face from skimage.transform._geometric import _umeyama def get_face_mask(face: Face, mask_type, erosion_size=None, dilation_kernel=None, ...
[ "numpy.floor", "numpy.clip", "cv2.warpAffine", "numpy.mean", "cv2.erode", "cv2.dilate", "scipy.ndimage.gaussian_filter", "skimage.transform._geometric._umeyama", "numpy.int32", "numpy.stack", "numpy.uint8", "numpy.median", "numpy.flipud", "numpy.hypot", "cv2.getStructuringElement", "nu...
[((1987, 2540), 'numpy.array', 'np.array', (['[0.000213256, 0.0752622, 0.18113, 0.29077, 0.393397, 0.586856, 0.689483, \n 0.799124, 0.904991, 0.98004, 0.490127, 0.490127, 0.490127, 0.490127, \n 0.36688, 0.426036, 0.490127, 0.554217, 0.613373, 0.121737, 0.187122, \n 0.265825, 0.334606, 0.260918, 0.182743, 0.645...
import h5py import matplotlib.pyplot as plt import numpy as np from glob import glob from astropy.io import fits f = h5py.File('archive.hdf5', 'a') dset = f['images'] composite = np.sum(f['images'][:], axis=2) # composite = composite.copy() - np.min(composite) + 1 # plt.hist(composite.ravel(), log=True) plt.imshow...
[ "h5py.File", "numpy.sum", "numpy.log", "matplotlib.pyplot.show" ]
[((119, 149), 'h5py.File', 'h5py.File', (['"""archive.hdf5"""', '"""a"""'], {}), "('archive.hdf5', 'a')\n", (128, 149), False, 'import h5py\n'), ((182, 212), 'numpy.sum', 'np.sum', (["f['images'][:]"], {'axis': '(2)'}), "(f['images'][:], axis=2)\n", (188, 212), True, 'import numpy as np\n'), ((374, 384), 'matplotlib.py...
import os import shutil import gym import numpy as np import pytest from stable_baselines3 import A2C, DDPG, DQN, PPO, SAC, TD3, HerReplayBuffer from stable_baselines3.common.callbacks import ( CallbackList, CheckpointCallback, EvalCallback, EveryNTimesteps, StopTrainingOnMaxEpisodes, StopTrai...
[ "stable_baselines3.common.callbacks.CheckpointCallback", "stable_baselines3.common.env_util.make_vec_env", "gym.make", "shutil.rmtree", "stable_baselines3.common.callbacks.CallbackList", "os.path.exists", "stable_baselines3.common.envs.BitFlippingEnv", "stable_baselines3.common.callbacks.EvalCallback"...
[((521, 592), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model_class"""', '[A2C, PPO, SAC, TD3, DQN, DDPG]'], {}), "('model_class', [A2C, PPO, SAC, TD3, DQN, DDPG])\n", (544, 592), False, 'import pytest\n'), ((927, 983), 'stable_baselines3.common.callbacks.CheckpointCallback', 'CheckpointCallback', ([]...
import os from typing import Optional import matplotlib.pyplot as plt import numpy as np import torch from tqdm import tqdm, trange from nerf import cumprod_exclusive, get_minibatches, get_ray_bundle, positional_encoding def compute_query_points_from_rays( ray_origins: torch.Tensor, ray_directions: torch.Te...
[ "numpy.load", "numpy.random.seed", "torch.cat", "nerf.get_ray_bundle", "numpy.random.randint", "os.path.join", "os.path.abspath", "matplotlib.pyplot.close", "nerf.cumprod_exclusive", "torch.exp", "torch.nn.Linear", "torch.nn.functional.relu", "tqdm.trange", "torch.manual_seed", "torch.nn...
[((4051, 4099), 'torch.nn.functional.relu', 'torch.nn.functional.relu', (['radiance_field[..., 3]'], {}), '(radiance_field[..., 3])\n', (4075, 4099), False, 'import torch\n'), ((4110, 4148), 'torch.sigmoid', 'torch.sigmoid', (['radiance_field[..., :3]'], {}), '(radiance_field[..., :3])\n', (4123, 4148), False, 'import ...
__all__ = ['planet_orbit', 'planet_star_projected_distance', 'planet_phase', 'transit', 'transit_integrated', 'transit_depth', 'transit_duration', 'eclipse', 'eclipse_integrated', 'eclipse_depth', 'eclipse_duration', 'eclipse_mid_time'] import numpy as np from pylightcurve.analysis.numerical_i...
[ "numpy.int_", "numpy.minimum", "numpy.maximum", "numpy.abs", "numpy.ones_like", "numpy.clip", "pylightcurve.analysis.numerical_integration.gauss_numerical_integration", "numpy.sin", "numpy.where", "numpy.arange", "numpy.cos", "pylightcurve.analysis.curve_fit.curve_fit", "numpy.array", "num...
[((1965, 1988), 'numpy.cos', 'np.cos', (['(vv + periastron)'], {}), '(vv + periastron)\n', (1971, 1988), True, 'import numpy as np\n'), ((1998, 2021), 'numpy.sin', 'np.sin', (['(vv + periastron)'], {}), '(vv + periastron)\n', (2004, 2021), True, 'import numpy as np\n'), ((2476, 2570), 'numpy.sqrt', 'np.sqrt', (['(posit...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 23 11:19:28 2020 @author: andreaapariciomartinez """ import scipy.stats as sts import numpy as np import csv import math as mt from matplotlib import pyplot as plt from Network_ID import fn #%% chsteps = 70 # parameter goes from 1 to 0 in these many...
[ "csv.reader", "math.ceil", "numpy.polyfit", "numpy.zeros", "numpy.ones", "numpy.array" ]
[((646, 659), 'numpy.array', 'np.array', (['v1l'], {}), '(v1l)\n', (654, 659), True, 'import numpy as np\n'), ((990, 1010), 'math.ceil', 'mt.ceil', (['(chsteps / 3)'], {}), '(chsteps / 3)\n', (997, 1010), True, 'import math as mt\n'), ((1065, 1094), 'numpy.zeros', 'np.zeros', (['(chsteps - win, sp)'], {}), '((chsteps -...
#coding=utf-8 import numpy as np def loadFromPts(filename): landmarks = np.genfromtxt(filename, skip_header=3, skip_footer=1) landmarks = landmarks - 1 return landmarks def saveToPts(filename, landmarks): pts = landmarks + 1 header = 'version: 1\nn_points: {}\n{{'.format(pts.shape[0]) np.sa...
[ "numpy.savetxt", "numpy.genfromtxt", "numpy.mean", "numpy.array", "numpy.linalg.norm", "numpy.dot" ]
[((78, 131), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'skip_header': '(3)', 'skip_footer': '(1)'}), '(filename, skip_header=3, skip_footer=1)\n', (91, 131), True, 'import numpy as np\n'), ((315, 412), 'numpy.savetxt', 'np.savetxt', (['filename', 'pts'], {'delimiter': '""" """', 'header': 'header', 'footer':...
import pickle from unittest import mock import numpy as np import pytest import tensorflow as tf from garage.tf.envs import TfEnv from garage.tf.policies import ContinuousMLPPolicy from tests.fixtures import TfGraphTestCase from tests.fixtures.envs.dummy import DummyBoxEnv from tests.fixtures.models import SimpleMLPM...
[ "numpy.full", "tensorflow.compat.v1.get_variable", "pickle.loads", "tensorflow.compat.v1.variable_scope", "tensorflow.compat.v1.placeholder", "garage.tf.policies.ContinuousMLPPolicy", "tensorflow.ones_like", "unittest.mock.patch", "tensorflow.Graph", "numpy.array_equal", "pytest.mark.parametrize...
[((381, 529), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""obs_dim, action_dim"""', '[((1,), (1,)), ((1,), (2,)), ((2,), (2,)), ((1, 1), (1, 1)), ((1, 1), (2, 2\n )), ((2, 2), (2, 2))]'], {}), "('obs_dim, action_dim', [((1,), (1,)), ((1,), (2,)),\n ((2,), (2,)), ((1, 1), (1, 1)), ((1, 1), (2, 2)), ...
import torch from torch.autograd import grad from tqdm import tqdm import os import torch.nn as nn import torch.nn.functional as F import pandas as pd from util.ClassifierDataSet import ClassifierDataSet from torch.utils.data import ConcatDataset import numpy as np import math class InF(): def __init__(self, arg...
[ "os.mkdir", "torch.logsumexp", "torch.utils.data.ConcatDataset", "tqdm.tqdm", "math.exp", "torch.utils.data.DataLoader", "torch.dot", "torch.autograd.grad", "os.path.isdir", "torch.nn.KLDivLoss", "torch.nn.CrossEntropyLoss", "torch.cat", "numpy.max", "numpy.min", "torch.nn.functional.rel...
[((434, 455), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (453, 455), True, 'import torch.nn as nn\n'), ((537, 578), 'torch.nn.KLDivLoss', 'torch.nn.KLDivLoss', ([], {'reduction': '"""batchmean"""'}), "(reduction='batchmean')\n", (555, 578), False, 'import torch\n'), ((2242, 2317), 'torch.util...
from floodsystem.stationdata import build_station_list from floodsystem.station import * from floodsystem.geo import * from floodsystem.plot import * from floodsystem.flood import * from floodsystem.datafetcher import fetch_measure_levels from datetime import * from floodsystem.analysis import * import numpy as np de...
[ "floodsystem.stationdata.build_station_list", "numpy.polyder" ]
[((408, 428), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (426, 428), False, 'from floodsystem.stationdata import build_station_list\n'), ((2876, 2892), 'numpy.polyder', 'np.polyder', (['poly'], {}), '(poly)\n', (2886, 2892), True, 'import numpy as np\n'), ((3524, 3540), 'numpy...
import numpy as np from panda_gym.envs.core import BimanualTaskEnv from panda_gym.envs.robots.panda import Panda from panda_gym.envs.tasks.assemble_bimanual import AssembleBimanual from panda_gym.pybullet import PyBullet class PandaAssembleBimanualEnv(BimanualTaskEnv): """Stack task wih Panda robot. Args: ...
[ "panda_gym.envs.tasks.assemble_bimanual.AssembleBimanual", "numpy.array", "panda_gym.pybullet.PyBullet" ]
[((740, 763), 'panda_gym.pybullet.PyBullet', 'PyBullet', ([], {'render': 'render'}), '(render=render)\n', (748, 763), False, 'from panda_gym.pybullet import PyBullet\n'), ((1312, 1478), 'panda_gym.envs.tasks.assemble_bimanual.AssembleBimanual', 'AssembleBimanual', (['sim', 'robot0.get_ee_position', 'robot1.get_ee_posit...
import numpy as np import gym import copy from collections import deque import random import pickle bsize = 32 q_in_size = 4 q_hl1_size = 40 q_hl2_size = 40 q_out_size = 1 miu_in_size = 3 miu_hl1_size = 40 miu_hl2_size = 40 miu_out_size = 1 replay_size = 100*1000 episodes_num = 500 iters_num = 1000 gamma = 0.99 up...
[ "numpy.random.uniform", "copy.deepcopy", "numpy.zeros_like", "numpy.random.seed", "gym.make", "numpy.maximum", "numpy.concatenate", "numpy.ones", "numpy.random.randint", "random.seed", "numpy.array", "numpy.exp", "numpy.matmul", "numpy.mean", "collections.deque", "numpy.sqrt" ]
[((376, 396), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (390, 396), True, 'import numpy as np\n'), ((397, 414), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (408, 414), False, 'import random\n'), ((1294, 1310), 'copy.deepcopy', 'copy.deepcopy', (['Q'], {}), '(Q)\n', (1307, 1310), F...
import matplotlib.pyplot as plt import numpy as np import random def draw_tree(xold,yold,theta,length): ratio= 0.6 xnew=xold+length*np.cos(theta) ynew=yold+length*np.sin(theta) if length>0.009: plt.plot([xold,xnew],[yold,ynew], '-r') draw_tree(xnew,ynew,theta+np.pi/5,length...
[ "numpy.sin", "matplotlib.pyplot.show", "numpy.cos", "matplotlib.pyplot.plot" ]
[((441, 451), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (449, 451), True, 'import matplotlib.pyplot as plt\n'), ((231, 273), 'matplotlib.pyplot.plot', 'plt.plot', (['[xold, xnew]', '[yold, ynew]', '"""-r"""'], {}), "([xold, xnew], [yold, ynew], '-r')\n", (239, 273), True, 'import matplotlib.pyplot as plt\...
import numpy as np from sqlalchemy.orm import * # session from sqlalchemy import create_engine from obspy.core import UTCDateTime from obspy.geodetics import locations2degrees, degrees2kilometers from .table_tt_curve import * from .table_nsta24 import * from .tables3D import * from .search_hypo import * #from .pbr imp...
[ "numpy.std", "numpy.median", "time.time", "obspy.core.UTCDateTime", "numpy.mean", "obspy.geodetics.locations2degrees", "operator.itemgetter" ]
[((17106, 17121), 'numpy.std', 'np.std', (['offsets'], {}), '(offsets)\n', (17112, 17121), True, 'import numpy as np\n'), ((2214, 2331), 'obspy.core.UTCDateTime', 'UTCDateTime', ([], {'year': 'fileHeader[1]', 'month': 'fileHeader[4]', 'day': 'fileHeader[5]', 'hour': 'fileHeader[6]', 'minute': 'fileHeader[7]'}), '(year=...
import warnings warnings.filterwarnings("ignore") # import faulthandler # faulthandler.enable() import logging import time from collections import Counter import numpy as np from ta import add_all_ta_features import matplotlib.pyplot as plt import xgboost as xgb from sklearn.model_selection import GridSearchCV, TimeS...
[ "matplotlib.pyplot.title", "sklearn.metrics.RocCurveDisplay", "numpy.isin", "sklearn.preprocessing.StandardScaler", "xgboost.XGBRFClassifier", "sklearn.metrics.classification_report", "matplotlib.pyplot.figure", "ta.add_all_ta_features", "matplotlib.pyplot.close", "sklearn.linear_model.LassoLarsIC...
[((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((895, 922), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (912, 922), False, 'import logging\n'), ((2268, 2279), 'time.time', 'time.time', ([]...
# *************************************************************** # Copyright (c) 2022 Jittor. All Rights Reserved. # Maintainers: # <NAME> <<EMAIL>> # <NAME> <<EMAIL>>. # # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. # *******...
[ "unittest.main", "jittor.float32", "jittor.dump_all_graphs", "jittor.nn.Conv", "jittor.nn.BatchNorm", "jittor.random", "jittor.sync", "jittor.grad", "numpy.random.rand", "jittor.nn.Pool", "jittor.nn.ReLU" ]
[((509, 532), 'jittor.random', 'jt.random', (['shape', 'dtype'], {}), '(shape, dtype)\n', (518, 532), True, 'import jittor as jt\n'), ((1958, 1973), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1971, 1973), False, 'import unittest\n'), ((1041, 1054), 'jittor.float32', 'jt.float32', (['(0)'], {}), '(0)\n', (1051...
""" A module implementing binned and unbinned likelihood for weighted and unweighted sets of photon phases. The model is encapsulated in LCTemplate, a mixture model. LCPrimitives are combined to form a light curve (LCTemplate). LCFitter then performs a maximum likielihood fit to determine the light curve parameter...
[ "scipy.optimize.fmin_tnc", "numpy.empty", "numpy.isnan", "numpy.argmin", "numpy.argsort", "scipy.optimize.leastsq", "numpy.histogram", "numpy.arange", "pylab.figure", "numpy.exp", "numpy.diag", "numpy.std", "numpy.fft.fft", "numpy.random.rand", "pylab.ylabel", "numpy.empty_like", "sc...
[((822, 844), 'numpy.fft.fft', 'np.fft.fft', (['m'], {'axis': '(-1)'}), '(m, axis=-1)\n', (832, 844), True, 'import numpy as np\n'), ((1152, 1208), 'numpy.linspace', 'np.linspace', (['(0 + phase_shift)', '(1 + phase_shift)', '(nbins + 1)'], {}), '(0 + phase_shift, 1 + phase_shift, nbins + 1)\n', (1163, 1208), True, 'im...
#!/usr/bin/env python # coding: utf-8 # In[ ]: # In[1]: import pandas as pd import numpy as np import pickle import sys from sklearn.feature_extraction.text import TfidfVectorizer import nltk from nltk.stem.porter import * import string import re from vaderSentiment.vaderSentiment import SentimentIntensityAnaly...
[ "seaborn.heatmap", "pandas.read_csv", "sklearn.feature_extraction.text.TfidfVectorizer", "nltk.tokenize.casual.casual_tokenize", "matplotlib.pyplot.figure", "matplotlib.pyplot.tick_params", "pandas.DataFrame", "matplotlib.pyplot.rc", "re.sub", "matplotlib.pyplot.show", "pandas.Series", "nltk.c...
[((2721, 2725), 'vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer', 'VS', ([], {}), '()\n', (2723, 2725), True, 'from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer as VS\n'), ((1375, 1414), 're.sub', 're.sub', (['space_pattern', '""" """', 'text_string'], {}), "(space_pattern, ' ', text_string...
""" Histograms example. """ import numpy as np import matplotlib.pyplot as plt mu, sigma = 2, 0.5 v = np.random.normal(mu,sigma,1000) plt.hist(v,bins=50,density=1) plt.show()
[ "matplotlib.pyplot.hist", "matplotlib.pyplot.show", "numpy.random.normal" ]
[((103, 136), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma', '(1000)'], {}), '(mu, sigma, 1000)\n', (119, 136), True, 'import numpy as np\n'), ((135, 166), 'matplotlib.pyplot.hist', 'plt.hist', (['v'], {'bins': '(50)', 'density': '(1)'}), '(v, bins=50, density=1)\n', (143, 166), True, 'import matplotlib.py...
from collections import namedtuple import numpy as np import pytest tf = pytest.importorskip("tensorflow") from eight_mile.tf.layers import ( SeqDotProductAttentionT5, SeqScaledDotProductAttentionT5, ) NH = 4 NQ = 7 NK = 6 NB = 32 @pytest.fixture def generate_buckets_values(): REL_BUCKETS = np.array([[...
[ "pytest.importorskip", "numpy.allclose", "eight_mile.tf.layers.SeqDotProductAttentionT5", "numpy.array", "numpy.arange", "eight_mile.tf.layers.SeqScaledDotProductAttentionT5" ]
[((74, 107), 'pytest.importorskip', 'pytest.importorskip', (['"""tensorflow"""'], {}), "('tensorflow')\n", (93, 107), False, 'import pytest\n'), ((309, 500), 'numpy.array', 'np.array', (['[[0, 17, 18, 19, 20, 21], [1, 0, 17, 18, 19, 20], [2, 1, 0, 17, 18, 19], [3,\n 2, 1, 0, 17, 18], [4, 3, 2, 1, 0, 17], [5, 4, 3, 2...
import numpy as np from tqdm import tqdm as tqdm import sys import torch import matplotlib.pyplot as plt class Meter(object): '''Meters provide a way to keep track of important statistics in an online manner. This class is abstract, but provides a standard interface for all meters to follow. ''' def ...
[ "tqdm.tqdm", "matplotlib.pyplot.show", "torch.save", "matplotlib.pyplot.figure", "torch.no_grad", "numpy.sqrt" ]
[((2253, 2265), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2263, 2265), True, 'import matplotlib.pyplot as plt\n'), ((6633, 6645), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (6643, 6645), True, 'import matplotlib.pyplot as plt\n'), ((3763, 3849), 'tqdm.tqdm', 'tqdm', (['dataloader'], ...
import sys, os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.insert(0, path) from haven import haven_chk as hc from haven import haven_results as hr from haven import haven_utils as hu import torch import torchvision import tqdm import pandas as pd import pprint import itertools import ...
[ "pandas.DataFrame", "tqdm.tqdm", "src.models.metrics.SegMeter", "src.datasets.get_dataset", "torch.utils.data.DataLoader", "os.path.realpath", "haven.haven_utils.load_pkl", "os.path.exists", "sys.path.insert", "haven.haven_utils.torch_load", "numpy.array", "pprint.pprint", "haven.haven_utils...
[((84, 108), 'sys.path.insert', 'sys.path.insert', (['(0)', 'path'], {}), '(0, path)\n', (99, 108), False, 'import sys, os\n'), ((55, 81), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (71, 81), False, 'import os\n'), ((1585, 1649), 'os.path.join', 'os.path.join', (["('/mnt/public/predicti...
#!/usr/bin/env python3 # Author: <NAME> <wecros|xfilip46> # Date: 2020/01/02 import sys import wave import matplotlib.pyplot as plt import numpy as np from sklearn.preprocessing import minmax_scale from lib import clip_centre, SAMPLE_RATE, OUTPUT_PATH, auto_correlate, \ save_figure, compute_log_spec...
[ "matplotlib.pyplot.show", "lib.save_figure", "numpy.fft.fft", "ex3.output", "matplotlib.pyplot.subplots", "lib.compute_log_spectogram" ]
[((454, 494), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {'constrained_layout': '(True)'}), '(2, constrained_layout=True)\n', (466, 494), True, 'import matplotlib.pyplot as plt\n'), ((1176, 1188), 'ex3.output', 'ex3.output', ([], {}), '()\n', (1186, 1188), False, 'import ex3\n'), ((1208, 1238), 'numpy.fft....
""" Defines CompilationLibrary class and supporting functions """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S...
[ "pygsti.tools.internalgates.standard_gatename_unitaries", "collections.defaultdict", "numpy.shape", "pygsti.circuits.circuit.Circuit", "pygsti.baseobjs.qubitgraph.QubitGraph", "itertools.permutations", "numpy.cumsum", "pygsti.tools.symplectic.unitary_to_symplectic", "itertools.product", "copy.deep...
[((3208, 3234), 'collections.OrderedDict', '_collections.OrderedDict', ([], {}), '()\n', (3232, 3234), True, 'import collections as _collections\n'), ((3306, 3332), 'collections.OrderedDict', '_collections.OrderedDict', ([], {}), '()\n', (3330, 3332), True, 'import collections as _collections\n'), ((3409, 3435), 'colle...
# -*- coding: utf-8 -*- """ Created on Sat Dec 5 13:32:12 2020 @author: <NAME> """ import pandas as pd import matplotlib.pyplot as plt import os import numpy as np import seaborn as sns def plot_nicer(ax, with_legend=True): """Takes an axis objects and makes it look nicer""" alpha=0.7 for spine in ax.spines....
[ "pandas.DataFrame", "seaborn.heatmap", "pandas.read_csv", "numpy.arange", "matplotlib.pyplot.gcf", "pandas.concat", "matplotlib.pyplot.savefig" ]
[((1273, 1287), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1285, 1287), True, 'import pandas as pd\n'), ((1303, 1327), 'numpy.arange', 'np.arange', (['(400)', '(1001)', '(50)'], {}), '(400, 1001, 50)\n', (1312, 1327), True, 'import numpy as np\n'), ((1811, 1888), 'pandas.read_csv', 'pd.read_csv', (["('Resul...
""" scratch.py - a place to try small experiments, figure out how things work """ import numpy as np import chainer from chainer import cuda, Function, gradient_check, report, training, utils, Variable from chainer import datasets, iterators, optimizers, serializers from chainer import Link, Chain, ChainList import ch...
[ "numpy.random.uniform", "kernels.make_array", "numpy.sum", "numpy.copy", "chainer.functions.convolution_2d", "numpy.zeros", "kernels.make_kernels", "numpy.reshape", "kernels.rotation_check", "chainer.datasets.get_mnist", "kernels.update_csm", "kernels.make_similiarity_matrix" ]
[((1873, 1901), 'chainer.datasets.get_mnist', 'chainer.datasets.get_mnist', ([], {}), '()\n', (1899, 1901), False, 'import chainer\n'), ((2354, 2376), 'kernels.make_kernels', 'kernels.make_kernels', ([], {}), '()\n', (2374, 2376), False, 'import kernels\n'), ((2399, 2443), 'kernels.make_similiarity_matrix', 'kernels.ma...
import numpy as np def softmax(x): xt = np.exp(x - np.max(x)) return xt / np.sum(xt) def save_model(outfile, model): U, V, W = model.U, model.V, model.W np.savez(outfile, U=U, V=V, W=W) print("Saved model parameters to %s." % outfile) def save_data(outfile, x_train, y_train, itw): np.savez(ou...
[ "numpy.savez", "numpy.max", "numpy.sum", "numpy.load" ]
[((171, 203), 'numpy.savez', 'np.savez', (['outfile'], {'U': 'U', 'V': 'V', 'W': 'W'}), '(outfile, U=U, V=V, W=W)\n', (179, 203), True, 'import numpy as np\n'), ((309, 357), 'numpy.savez', 'np.savez', (['outfile'], {'X': 'x_train', 'Y': 'y_train', 'ITW': 'itw'}), '(outfile, X=x_train, Y=y_train, ITW=itw)\n', (317, 357)...
import bz2 import os from urllib.request import urlopen import numpy as np import cv2 from align import align_image import pickle from sklearn.preprocessing import LabelEncoder from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import LinearSVC from sklearn.metrics import accuracy_score from sklearn.mo...
[ "pickle.dump", "numpy.argmax", "pickle.load", "numpy.arange", "cv2.rectangle", "cv2.imshow", "os.path.join", "os.path.sep.join", "os.path.abspath", "cv2.cvtColor", "face_recognition.face_encodings", "os.path.exists", "urllib.request.urlopen", "sklearn.preprocessing.LabelEncoder", "align....
[((1180, 1223), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolation': 'inter'}), '(image, dim, interpolation=inter)\n', (1190, 1223), False, 'import cv2\n'), ((1477, 1498), 'bz2.BZ2Decompressor', 'bz2.BZ2Decompressor', ([], {}), '()\n', (1496, 1498), False, 'import bz2\n'), ((1764, 1802), 'os.path.join', 'os...
from mir import DataEntry from mir import io from extractors.midi_utilities import get_valid_channel_count,is_percussive_channel,MidiBeatExtractor from extractors.rule_based_channel_reweight import midi_to_thickness_and_bass_weights from midi_chord import ChordRecognition from chord_class import ChordClass import...
[ "mir.DataEntry", "chord_class.ChordClass", "extractors.rule_based_channel_reweight.midi_to_thickness_and_bass_weights", "numpy.linspace" ]
[((1560, 1606), 'extractors.rule_based_channel_reweight.midi_to_thickness_and_bass_weights', 'midi_to_thickness_and_bass_weights', (['entry.midi'], {}), '(entry.midi)\n', (1594, 1606), False, 'from extractors.rule_based_channel_reweight import midi_to_thickness_and_bass_weights\n'), ((1909, 1920), 'mir.DataEntry', 'Dat...
from numpy.testing import TestCase, assert_equal, run_module_suite from weave import ast_tools class TestHarvestVariables(TestCase): """ Not much testing going on here, but at least it is a flame test.""" def generic_check(self,expr,desired): import parser ast_list = parser.suite(expr).toli...
[ "weave.ast_tools.harvest_variables", "parser.suite", "numpy.testing.assert_equal", "numpy.testing.run_module_suite" ]
[((638, 656), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (654, 656), False, 'from numpy.testing import TestCase, assert_equal, run_module_suite\n'), ((342, 379), 'weave.ast_tools.harvest_variables', 'ast_tools.harvest_variables', (['ast_list'], {}), '(ast_list)\n', (369, 379), False, 'from ...
# coding: utf-8 import interpreter import brica1 import numpy as np import logging import logging.config from config.log import APP_KEY app_logger = logging.getLogger(APP_KEY) class AgentService: def __init__(self, config_file, feature_extractor): self.feature_extractor = feature_extractor self...
[ "brica1.VirtualTimeScheduler", "interpreter.NetworkBuilder", "numpy.array", "interpreter.AgentBuilder", "logging.getLogger" ]
[((152, 178), 'logging.getLogger', 'logging.getLogger', (['APP_KEY'], {}), '(APP_KEY)\n', (169, 178), False, 'import logging\n'), ((326, 354), 'interpreter.NetworkBuilder', 'interpreter.NetworkBuilder', ([], {}), '()\n', (352, 354), False, 'import interpreter\n'), ((905, 931), 'interpreter.AgentBuilder', 'interpreter.A...
import random import time from unittest import TestCase import gym import numpy as np import torch from torch.distributions import Categorical from algorithms.utils.action_distributions import get_action_distribution, calc_num_logits, \ CategoricalActionDistribution, sample_actions_log_probs from utils.timing imp...
[ "torch.cuda.synchronize", "torch.distributions.Categorical", "gym.spaces.Discrete", "torch.cat", "algorithms.utils.action_distributions.sample_actions_log_probs", "torch.device", "torch.no_grad", "algorithms.utils.action_distributions.get_action_distribution", "torch.ones", "random.randint", "to...
[((506, 528), 'gym.spaces.Discrete', 'gym.spaces.Discrete', (['(3)'], {}), '(3)\n', (525, 528), False, 'import gym\n'), ((557, 593), 'algorithms.utils.action_distributions.calc_num_logits', 'calc_num_logits', (['simple_action_space'], {}), '(simple_action_space)\n', (572, 593), False, 'from algorithms.utils.action_dist...
#!/usr/bin/env python # coding: utf-8 # ## Import Packages # In[19]: import torch, pytz import torch.nn as nn from torch.utils.data import Dataset, DataLoader import numpy as np import os, csv # For plotting import matplotlib.pyplot as plt from matplotlib.pyplot import figure, xlabel import streamlit as st from PIL...
[ "torch.nn.Dropout", "matplotlib.pyplot.title", "csv.reader", "torch.no_grad", "torch.nn.MSELoss", "torch.utils.data.DataLoader", "matplotlib.pyplot.close", "torch.load", "torch.squeeze", "numpy.linspace", "torch.nn.Linear", "csv.writer", "matplotlib.pyplot.legend", "torch.cuda.is_available...
[((5323, 5437), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset', 'batch_size'], {'shuffle': "(mode == 'Train')", 'drop_last': '(False)', 'num_workers': 'n_jobs', 'pin_memory': '(True)'}), "(dataset, batch_size, shuffle=mode == 'Train', drop_last=False,\n num_workers=n_jobs, pin_memory=True)\n", (5333, 5437)...
import xarray as xr import sys from math import nan import numpy as np import pandas as pd # thermal conductivities (W/m) lamice=2.29 ; lamair=0.023 #expname=['SCAM_CLM5_CLM5F_01','SCAM_CLM5_CLM5F_02','SCAM_SNOWD_CLM5F_01','SCAM_SNOWD_CLM5F_02'] expname=['SCAM_SNOWD_CLM5F_02'] datpath="/project/cas/islas/python_savs...
[ "numpy.moveaxis", "xarray.open_dataset", "numpy.zeros", "numpy.where", "numpy.array", "numpy.reshape", "xarray.DataArray", "numpy.arange" ]
[((522, 574), 'xarray.open_dataset', 'xr.open_dataset', (["(datpath + 'SNOWICE_' + iexp + '.nc')"], {}), "(datpath + 'SNOWICE_' + iexp + '.nc')\n", (537, 574), True, 'import xarray as xr\n'), ((613, 665), 'xarray.open_dataset', 'xr.open_dataset', (["(datpath + 'SNOWLIQ_' + iexp + '.nc')"], {}), "(datpath + 'SNOWLIQ_' +...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 12 10:57:18 2019 @author: peter """ import numpy as np import h5py def curl(arr, xax, yax, zax, xaxis, yaxis, zaxis, verbose=False): nx = xaxis.shape[0] ny = yaxis.shape[0] nz = zaxis.shape[0] #create output array, initially fill...
[ "numpy.empty", "h5py.File", "numpy.gradient" ]
[((338, 357), 'numpy.empty', 'np.empty', (['arr.shape'], {}), '(arr.shape)\n', (346, 357), True, 'import numpy as np\n'), ((1383, 1400), 'h5py.File', 'h5py.File', (['f', '"""r"""'], {}), "(f, 'r')\n", (1392, 1400), False, 'import h5py\n'), ((499, 517), 'numpy.gradient', 'np.gradient', (['yaxis'], {}), '(yaxis)\n', (510...
# -*- coding: utf-8 -*- """ Created on Mon Nov 26 12:54:35 2018 @author: Eric The purpose of this program is to split train and test files. """ import numpy as np import pandas as pd def load_test_docs(type_doc): """ Load the document ids for the test files (returns a set). """ loc = "..//.//annotations//spl...
[ "pandas.read_csv", "numpy.asarray", "numpy.loadtxt", "pandas.DataFrame" ]
[((369, 410), 'numpy.loadtxt', 'np.loadtxt', (['loc'], {'delimiter': '""" """', 'dtype': 'int'}), "(loc, delimiter=' ', dtype=int)\n", (379, 410), True, 'import numpy as np\n'), ((494, 545), 'pandas.read_csv', 'pd.read_csv', (['loc'], {'engine': '"""python"""', 'encoding': '"""utf-8"""'}), "(loc, engine='python', encod...
import time import numpy as np ## Target maker target_maker_args = {} #target_maker_args['future_steps'] = [1,2,4,8,16,32] #target_maker_args['meas_to_predict'] = [0,1,2] target_maker_args['min_num_targs'] = 3 target_maker_args['rwrd_schedule_type'] = 'exp' target_maker_args['gammas'] = [] target_maker_args['invalid...
[ "numpy.array" ]
[((2372, 2412), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 0.5, 0.5, 1.0]'], {}), '([0.0, 0.0, 0.0, 0.5, 0.5, 1.0])\n', (2380, 2412), True, 'import numpy as np\n'), ((3498, 3613), 'numpy.array', 'np.array', (['[(32, 8, 4), (64, 4, 2), (64, 3, 1)]'], {'dtype': "[('out_channels', int), ('kernel', int), ('stride', int)...
# Copyright 2020 The dm_control 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 i...
[ "dm_control.mjcf.get_attachment_frame", "dm_control.utils.transformations.quat_to_euler", "dm_control.utils.transformations.euler_to_quat", "numpy.hstack", "numpy.array" ]
[((1696, 1773), 'numpy.hstack', 'np.hstack', (["[features['position'], features['quaternion'], features['joints']]"], {}), "([features['position'], features['quaternion'], features['joints']])\n", (1705, 1773), True, 'import numpy as np\n'), ((1811, 1908), 'numpy.hstack', 'np.hstack', (["[features['velocity'], features...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import config import time from disentangle_modules import AdaINGen, Decoder, MLP, LinearBlock, Target_transform, SELayer from scipy import signal from scipy.fftpack import fft module = 'separable_adapter' # specific module type for un...
[ "numpy.sum", "numpy.abs", "disentangle_modules.SELayer", "torch.cat", "numpy.mean", "torch.nn.MaxPool3d", "torch.flatten", "torch.nn.Conv3d", "torch.squeeze", "torch.Tensor", "disentangle_modules.Decoder", "torch.nn.functional.log_softmax", "torch.log", "scipy.signal.butter", "torch.mean...
[((2118, 2307), 'disentangle_modules.Decoder', 'Decoder', ([], {'inChans': '_channels', 'outChans_list': '_outChans_list', 'concatChan_list': '_outChans_list', 'num_class_list': 'num_class_list', 'norm': 'None', 'use_distill': '(True)', 'use_kd': 'args.use_kd', 'args': 'args'}), '(inChans=_channels, outChans_list=_outC...
import numpy from silx.math.fit import leastsq x = numpy.arange(10).astype(numpy.float64) y = 0.001 * x**3 + 25.1 * x**2 + 1.2 * x - 25 def poly2(x, a, b, c): return a * x**2 + b*x + c p0 = [1., 1., 1.] p, cov_matrix = leastsq(poly2, x, y, p0) print("Parameters [a, b, c]: " + str(p)) # 4. p, cov_matrix, info...
[ "silx.math.fit.leastsq", "numpy.arange" ]
[((228, 252), 'silx.math.fit.leastsq', 'leastsq', (['poly2', 'x', 'y', 'p0'], {}), '(poly2, x, y, p0)\n', (235, 252), False, 'from silx.math.fit import leastsq\n'), ((323, 365), 'silx.math.fit.leastsq', 'leastsq', (['poly2', 'x', 'y', 'p0'], {'full_output': '(True)'}), '(poly2, x, y, p0, full_output=True)\n', (330, 365...
import psutil from numpy import mean, round from .logger import Logger __all__ = ("MemoryLogger",) class MemoryLogger(Logger): def __init__(self, unit="gb"): if unit == "b": self.factor = 1 elif unit == "kb": self.factor = 1024 elif unit == "mb": self....
[ "psutil.virtual_memory", "numpy.mean" ]
[((728, 742), 'numpy.mean', 'mean', (['self.all'], {}), '(self.all)\n', (732, 742), False, 'from numpy import mean, round\n'), ((818, 841), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n', (839, 841), False, 'import psutil\n')]
# -*- coding: utf-8 -*- """ ese3 """ import numpy as np import matplotlib.pyplot as plt from funzioni_Approssimazione_MQ import metodoQR x = np.arange(10.0,10.6,0.1) y = np.array([11.0320, 11.1263, 11.1339, 11.1339, 11.1993, 11.1844]) a1 = metodoQR(x,y,4) valori = np.linspace(np.min(x), np.max(x), 100) p1 ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.polyval", "funzioni_Approssimazione_MQ.metodoQR", "numpy.min", "numpy.max", "numpy.array", "numpy.arange" ]
[((150, 176), 'numpy.arange', 'np.arange', (['(10.0)', '(10.6)', '(0.1)'], {}), '(10.0, 10.6, 0.1)\n', (159, 176), True, 'import numpy as np\n'), ((180, 243), 'numpy.array', 'np.array', (['[11.032, 11.1263, 11.1339, 11.1339, 11.1993, 11.1844]'], {}), '([11.032, 11.1263, 11.1339, 11.1339, 11.1993, 11.1844])\n', (188, 24...
#!/usr/bin/env python # coding: utf-8 #imports import cv2 import numpy as np import matplotlib.pyplot as plt from datetime import date import os #Intializing instance of class CascadeClassifier face_detect = cv2.CascadeClassifier(os.getcwd() + "\\haarcascade_frontalface_alt.xml") path = input("Enter the path of the ...
[ "os.listdir", "os.mkdir", "os.getcwd", "cv2.cvtColor", "os.path.isdir", "cv2.imwrite", "datetime.date.today", "cv2.imread", "os.path.isfile", "numpy.array", "os.chdir" ]
[((618, 632), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (626, 632), False, 'import os\n'), ((792, 803), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (801, 803), False, 'import os\n'), ((811, 827), 'cv2.imread', 'cv2.imread', (['name'], {}), '(name)\n', (821, 827), False, 'import cv2\n'), ((865, 901), 'cv2.cvtC...
from typing import Dict import os import numpy as np from ..core_chart import BaseChart from ....assets.numba_kernels import calc_groupby from ....assets import geo_json_mapper from ....layouts import chart_view from ....assets.cudf_utils import get_min_max from ...constants import CUXF_NAN_COLOR np.seterr(divide="ig...
[ "numpy.put", "numpy.seterr", "numpy.zeros", "numpy.where", "numpy.array", "numpy.round", "os.getenv" ]
[((300, 344), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (309, 344), True, 'import numpy as np\n'), ((1443, 1470), 'os.getenv', 'os.getenv', (['"""MAPBOX_API_KEY"""'], {}), "('MAPBOX_API_KEY')\n", (1452, 1470), False, 'import os\n')...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 23 20:08:46 2020 @author: ryanday """ # -*- coding: utf-8 -*- #Created on Thu Feb 01 08:56:54 2018 #@author: ryanday #MIT License #Copyright (c) 2018 <NAME> #Permission is hereby granted, free of charge, to any person obtaining a copy #of this ...
[ "numpy.floor", "numpy.einsum", "numpy.shape", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.linalg.norm", "chinook.klib.kpath", "matplotlib.colors.LinearSegmentedColormap.from_list", "matplotlib.pyplot.register_cmap", "numpy.meshgrid", "matplotlib.rcParams.upd...
[((1488, 1522), 'matplotlib.rcParams.update', 'rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (1503, 1522), False, 'from matplotlib import rcParams\n'), ((2279, 2347), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', ([], {'name': '"""RdBu_alpha"""', '...
import numpy as np import torch from scipy.sparse import diags from scipy.sparse.linalg import cg, LinearOperator from scipy.special import softmax def SSL_clustering(alpha, L, Yobs, w, eta, TOL=1e-9,MAXITER=10000): """ Minimizes the objective function: U = arg min_Y 1/2 ||Y - Yobs||_W^2 + alpha/2 * Y'*L*Y ...
[ "scipy.sparse.diags", "numpy.abs", "scipy.sparse.linalg.cg", "numpy.empty_like", "numpy.min", "scipy.sparse.linalg.LinearOperator", "scipy.special.softmax" ]
[((799, 807), 'scipy.sparse.diags', 'diags', (['w'], {}), '(w)\n', (804, 807), False, 'from scipy.sparse import diags\n'), ((1211, 1243), 'scipy.sparse.linalg.LinearOperator', 'LinearOperator', (['(n, n)', 'H_lambda'], {}), '((n, n), H_lambda)\n', (1225, 1243), False, 'from scipy.sparse.linalg import cg, LinearOperator...
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # Modifications copyright (C) 2020 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
[ "numpy.random.seed", "argparse.ArgumentParser", "os.path.isfile", "transformers.AutoModelForMaskedLM.from_pretrained", "torch.nn.Softmax", "torch.no_grad", "torch.utils.data.DataLoader", "torch.utils.data.SequentialSampler", "random.seed", "torch.zeros", "itertools.chain", "torch.mean", "tor...
[((13000, 13026), 'torch.utils.data.SequentialSampler', 'SequentialSampler', (['dataset'], {}), '(dataset)\n', (13017, 13026), False, 'from torch.utils.data import DataLoader, Dataset, SequentialSampler\n'), ((13044, 13133), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'sampler': 'sampler', 'batch_size':...
# -*- coding: utf-8 -*- """Noisy Skyline Implementation Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1WF8UXH8EeQFBPR5nhNmrQ0IBtdNSAmhZ """ import random import math def oracle(v1, v2, dim, deltaMain): # return v1[dim] >= v2[dim] with error prob...
[ "numpy.log", "random.shuffle", "numpy.zeros", "numpy.any", "random.random", "numpy.max", "numpy.mean", "numpy.array", "math.log", "numpy.all" ]
[((397, 412), 'random.random', 'random.random', ([], {}), '()\n', (410, 412), False, 'import random\n'), ((7897, 7908), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (7905, 7908), True, 'import numpy as np\n'), ((10088, 10105), 'random.shuffle', 'random.shuffle', (['s'], {}), '(s)\n', (10102, 10105), False, 'import ...
"""Example by <NAME>.""" import numpy as np import phonopy phonon = phonopy.load( unitcell_filename="POSCAR-unitcell", supercell_matrix=[2, 2, 1], log_level=1 ) print("Space group: %s" % phonon.symmetry.get_international_table()) # Example to obtain dynamical matrix dmat = phonon.get_dynamical_matrix_at_q([0, 0,...
[ "phonopy.load", "numpy.array" ]
[((70, 165), 'phonopy.load', 'phonopy.load', ([], {'unitcell_filename': '"""POSCAR-unitcell"""', 'supercell_matrix': '[2, 2, 1]', 'log_level': '(1)'}), "(unitcell_filename='POSCAR-unitcell', supercell_matrix=[2, 2, 1\n ], log_level=1)\n", (82, 165), False, 'import phonopy\n'), ((399, 430), 'numpy.array', 'np.array',...
import scipy from scipy.signal.signaltools import wiener import matplotlib.pyplot as plt import torch from util.reservoir_w_cur_replay_buffer import Reservoir_with_Cur_Replay_Memory import numpy as np s_c = torch.load("forward_curiosity") a_c = torch.load("inverse_curiosity") mul = 1000 change_var_at = [0, 100, 150, 3...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.std", "matplotlib.pyplot.close", "torch.load", "matplotlib.pyplot.legend", "torch.save", "numpy.mean", "matplotlib.pyplot.savefig" ]
[((207, 238), 'torch.load', 'torch.load', (['"""forward_curiosity"""'], {}), "('forward_curiosity')\n", (217, 238), False, 'import torch\n'), ((245, 276), 'torch.load', 'torch.load', (['"""inverse_curiosity"""'], {}), "('inverse_curiosity')\n", (255, 276), False, 'import torch\n'), ((764, 777), 'matplotlib.pyplot.plot'...
import numpy as np # call ft_uneven for a single time series and ft_uneven_bulk for multiple time series # This Block of methods is used to parse the arguments for bulk calculations def indexed(array2d): def dummy(index): return array2d[index] return dummy def not_indexed(array): def dummy(...
[ "numpy.arctan2", "numpy.sum", "numpy.zeros", "numpy.sin", "numpy.exp", "numpy.cos", "multiprocessing.Pool", "numpy.sqrt" ]
[((1143, 1160), 'numpy.zeros', 'np.zeros', (['num_omg'], {}), '(num_omg)\n', (1151, 1160), True, 'import numpy as np\n'), ((1171, 1206), 'numpy.zeros', 'np.zeros', (['num_omg'], {'dtype': 'np.cdouble'}), '(num_omg, dtype=np.cdouble)\n', (1179, 1206), True, 'import numpy as np\n'), ((4704, 4710), 'multiprocessing.Pool',...
import numpy as np #Numerical Python : lib used for matrix operations from math import cos,sin #Math lib of python for various mathematical functions import matplotlib.pyplot as plt #plotting lib of python x_list = np.linspace(-10,10,10000) #linearly spaced vector y_list = x_list**(2) #Parabolic Equ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.legend", "math.sin", "math.cos", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((234, 261), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(10000)'], {}), '(-10, 10, 10000)\n', (245, 261), True, 'import numpy as np\n'), ((1393, 1402), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1400, 1402), True, 'import matplotlib.pyplot as plt\n'), ((1406, 1426), 'matplotlib.pyplot.subplot', '...
import numpy as np import os ''' Purpose of this script is to take a list of file name with extension .npz serving as input of the sketchrnn and put together the categories. Input: ----- - l_category : list of file name to merge - name_mixture : name attributed to this mixture ''' l_category = ['cat.npz', 'broc...
[ "numpy.savez", "numpy.array", "os.listdir", "numpy.load" ]
[((523, 544), 'os.listdir', 'os.listdir', (['os.curdir'], {}), '(os.curdir)\n', (533, 544), False, 'import os\n'), ((1248, 1265), 'numpy.array', 'np.array', (['l_train'], {}), '(l_train)\n', (1256, 1265), True, 'import numpy as np\n'), ((1277, 1293), 'numpy.array', 'np.array', (['l_test'], {}), '(l_test)\n', (1285, 129...
""" A collection of utility functions and classes. Originally, many (but not all) were from the Python Cookbook -- hence the name cbook. This module is safe to import from anywhere within matplotlib; it imports matplotlib only at runtime. """ from __future__ import absolute_import, division, print_function import s...
[ "sys.platform.startswith", "os.remove", "numpy.isreal", "matplotlib.compat.subprocess.Popen", "os.removedirs", "os.walk", "numpy.ma.getmaskarray", "bz2.BZ2File", "six.moves.zip", "os.path.isfile", "gc.get_referents", "numpy.random.randint", "numpy.mean", "weakref.WeakKeyDictionary", "glo...
[((29138, 29176), 're.compile', 're.compile', (['"""(?:(?:\\\\n\\\\r?)|^)( *)\\\\S"""'], {}), "('(?:(?:\\\\n\\\\r?)|^)( *)\\\\S')\n", (29148, 29176), False, 'import re\n'), ((7470, 7491), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (7489, 7491), False, 'import traceback\n'), ((20932, 20957), 'os.pat...
import matplotlib.pyplot as plt import shutil import itertools import os import pickle import json # from sklearn.model_selection import train_test_split # from sklearn.metrics import confusion_matrix # from sympy import factorial from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau, ModelCheckpoint...
[ "matplotlib.pyplot.title", "os.mkdir", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "pickle.dump", "numpy.random.seed", "tensorflow.python.util.compat.as_bytes", "tensorflow.logging.info", "numpy.argmax", "matplotlib.pyplot.clf", "tensorflow.logging.error", "tensorflow.keras.layers...
[((3454, 3479), 'collections.defaultdict', 'collections.defaultdict', ([], {}), '()\n', (3477, 3479), False, 'import collections\n'), ((6768, 6815), 'tensorflow.keras.metrics.top_k_categorical_accuracy', 'top_k_categorical_accuracy', (['y_true', 'y_pred'], {'k': '(2)'}), '(y_true, y_pred, k=2)\n', (6794, 6815), False, ...
import numpy as np import paddle import paddle.nn as nn from custom_setup_ops import custom_relu BATCH_SIZE = 16 BATCH_NUM = 4 EPOCH_NUM = 4 IMAGE_SIZE = 784 CLASS_NUM = 10 # define a random dataset class RandomDataset(paddle.io.Dataset): def __init__(self, num_samples): self.num_samples = num_samples ...
[ "paddle.nn.Linear", "paddle.nn.CrossEntropyLoss", "custom_setup_ops.custom_relu", "numpy.random.random", "numpy.random.randint", "paddle.io.DataLoader", "paddle.static.InputSpec" ]
[((1083, 1104), 'paddle.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1102, 1104), True, 'import paddle.nn as nn\n'), ((1259, 1360), 'paddle.io.DataLoader', 'paddle.io.DataLoader', (['dataset'], {'batch_size': 'BATCH_SIZE', 'shuffle': '(True)', 'drop_last': '(True)', 'num_workers': '(2)'}), '(dataset,...
import logging as log import glob import os import matplotlib.pyplot as plt import numpy as np import json from report_generator import metrics from report_generator.road_profiler import RoadProfiler from shapely.geometry import LineString, Point from shapely.geometry.polygon import Polygon from shapely.ops import ...
[ "report_generator.metrics.is_oob", "json.dump", "shapely.geometry.Point", "descartes.PolygonPatch", "json.load", "report_generator.metrics.sd_steering", "matplotlib.pyplot.plot", "math.pow", "matplotlib.pyplot.gca", "report_generator.metrics.get_geometry", "os.path.dirname", "report_generator....
[((723, 773), 'numpy.array', 'np.array', (['[e[left_side][0] for e in road_geometry]'], {}), '([e[left_side][0] for e in road_geometry])\n', (731, 773), True, 'import numpy as np\n'), ((792, 842), 'numpy.array', 'np.array', (['[e[left_side][1] for e in road_geometry]'], {}), '([e[left_side][1] for e in road_geometry])\...
import matplotlib.pyplot as plt import os import numpy as np import matplotlib from matplotlib import ticker from scipy import optimize as op from scipy import stats as st class Timer: def __init__(self, var): font = {'size' :40} matplotlib.rc('font', **font) self.lw=3 self.var=va...
[ "matplotlib.rc", "matplotlib.pyplot.yscale", "numpy.load", "os.walk", "numpy.exp", "matplotlib.pyplot.gca", "matplotlib.pyplot.tick_params", "os.path.join", "numpy.round", "numpy.zeros_like", "matplotlib.pyplot.close", "matplotlib.ticker.FixedLocator", "numpy.cumsum", "numpy.format_float_s...
[((10464, 10483), 'os.walk', 'os.walk', (['"""results/"""'], {}), "('results/')\n", (10471, 10483), False, 'import os\n'), ((253, 282), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (266, 282), False, 'import matplotlib\n'), ((4612, 4652), 'numpy.concatenate', 'np.concatenate', (["[self....
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "numpy.fromfile", "struct.Struct" ]
[((1392, 1412), 'struct.Struct', 'struct.Struct', (['"""III"""'], {}), "('III')\n", (1405, 1412), False, 'import struct\n'), ((1783, 1825), 'numpy.fromfile', 'np.fromfile', (['fobj'], {'dtype': 'DTYPE_LIST[dtype]'}), '(fobj, dtype=DTYPE_LIST[dtype])\n', (1794, 1825), True, 'import numpy as np\n')]
from typing import List, Any, Sequence import logging import numpy as np import matplotlib.pyplot as plt from matplotlib.figure import Figure import qcodes as qc from .data_export import get_data_by_id, flatten_1D_data_for_plot from .data_export import datatype_from_setpoints_2d, reshape_2D_data log = logging.getLo...
[ "numpy.ma.masked_invalid", "numpy.diff", "numpy.array", "matplotlib.pyplot.subplots", "logging.getLogger" ]
[((307, 334), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (324, 334), False, 'import logging\n'), ((4833, 4847), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (4845, 4847), True, 'import matplotlib.pyplot as plt\n'), ((4436, 4449), 'numpy.diff', 'np.diff', (['xrow'], ...
def neo_preprocess(payload, content_type): import logging import numpy as np import io import PIL.Image def _read_input_shape(signature): shape = signature[-1]['shape'] shape[0] = 1 return shape def _transform_image(image, shape_info): # Fetch image size ...
[ "io.BytesIO", "numpy.asarray", "numpy.column_stack", "numpy.expand_dims", "json.dumps", "logging.info", "numpy.array", "numpy.rollaxis", "numpy.squeeze" ]
[((1270, 1331), 'logging.info', 'logging.info', (['"""Invoking user-defined pre-processing function"""'], {}), "('Invoking user-defined pre-processing function')\n", (1282, 1331), False, 'import logging\n'), ((1503, 1522), 'io.BytesIO', 'io.BytesIO', (['payload'], {}), '(payload)\n', (1513, 1522), False, 'import io\n')...
from ell import * import numpy as np _filter = Filter.from_name('db4') def check(a, mi, ma, shape): return np.all(a.min_index == mi) and np.all(a.max_index == ma) and np.all(np.equal(a.shape, shape)) def test_reduce_1d(): signal = Ell1d(np.sin(np.linspace(0,3,100))) reduced = signal.reduce(_filter) ...
[ "numpy.abs", "numpy.subtract", "numpy.ones", "numpy.equal", "numpy.linspace", "numpy.all" ]
[((864, 912), 'numpy.subtract', 'np.subtract', (['signal.min_index', '_filter.max_index'], {}), '(signal.min_index, _filter.max_index)\n', (875, 912), True, 'import numpy as np\n'), ((929, 977), 'numpy.subtract', 'np.subtract', (['signal.max_index', '_filter.min_index'], {}), '(signal.max_index, _filter.min_index)\n', ...
#%% imports import numpy as np from sklearn import datasets from sklearn.linear_model import SGDClassifier from sklearn.multiclass import OneVsRestClassifier from sklearn.model_selection import cross_val_score from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.svm import...
[ "sklearn.datasets.load_iris", "sklearn.preprocessing.StandardScaler", "sklearn.linear_model.SGDClassifier", "sklearn.model_selection.cross_val_score", "sklearn.multiclass.OneVsRestClassifier", "sklearn.svm.SVC", "numpy.random.permutation", "sklearn.svm.LinearSVC", "sklearn.datasets.fetch_mldata" ]
[((526, 546), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (544, 546), False, 'from sklearn import datasets\n'), ((1672, 1711), 'sklearn.datasets.fetch_mldata', 'datasets.fetch_mldata', (['"""MNIST original"""'], {}), "('MNIST original')\n", (1693, 1711), False, 'from sklearn import datasets\n'...
import numpy as np from xarray import Dataset, DataArray #from xray.core.ops import allclose_or_equiv import pytest # skip everythong pytestmark = pytest.mark.xfail(True, reason='deprecated') try: from xgcm import GCMDataset except ImportError: # this import syntax is old pass @pytest.fixture def test_da...
[ "numpy.full", "numpy.meshgrid", "numpy.roll", "xarray.Dataset", "numpy.hstack", "xgcm.GCMDataset", "numpy.sin", "numpy.diff", "xarray.DataArray", "numpy.cos", "numpy.arange", "pytest.raises", "pytest.mark.xfail" ]
[((148, 192), 'pytest.mark.xfail', 'pytest.mark.xfail', (['(True)'], {'reason': '"""deprecated"""'}), "(True, reason='deprecated')\n", (165, 192), False, 'import pytest\n'), ((592, 601), 'xarray.Dataset', 'Dataset', ([], {}), '()\n', (599, 601), False, 'from xarray import Dataset, DataArray\n'), ((1349, 1372), 'numpy.m...
#!/usr/bin/env python3 # Copyright (c) 2021 <NAME> <<EMAIL>> # # All rights reserved. Use of this source code is governed by a modified BSD # license that can be found in the LICENSE file. from .ABSdata import LVCData, O3InjectionsData import numpy as np import h5py import os import sys #from pesummary.io i...
[ "os.path.expanduser", "h5py.File", "os.getcwd", "numpy.ones", "numpy.squeeze", "os.path.join" ]
[((508, 548), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', 'PACKAGE_PARENT'], {}), '(SCRIPT_DIR, PACKAGE_PARENT)\n', (520, 548), False, 'import os\n'), ((3382, 3505), 'os.path.join', 'os.path.join', (['fname', "('IGWN-GWTC3p0-v1-' + event + '_PEDataRelease_mixed_' + self.suffix_name +\n self.post_file_extension)"...
# -*- coding: utf-8 -*- # /usr/bin/python2 from __future__ import print_function import argparse from models import Net2 import numpy as np from audio import spec2wav, inv_preemphasis, db2amp, denormalize_db import datetime import tensorflow as tf from hparam import hparam as hp from data_load import Net2DataFlow f...
[ "argparse.ArgumentParser", "tensorflow.summary.audio", "tensorflow.train.latest_checkpoint", "audio.spec2wav", "audio.inv_preemphasis", "audio.denormalize_db", "numpy.power", "data_load.Net2DataFlow", "tensorflow.summary.FileWriter", "datetime.datetime.now", "tensorflow.summary.merge_all", "te...
[((1581, 1644), 'audio.denormalize_db', 'denormalize_db', (['pred_spec', 'hp.default.max_db', 'hp.default.min_db'], {}), '(pred_spec, hp.default.max_db, hp.default.min_db)\n', (1595, 1644), False, 'from audio import spec2wav, inv_preemphasis, db2amp, denormalize_db\n'), ((1658, 1718), 'audio.denormalize_db', 'denormali...
# Copyright (C) 2021-present CompatibL # # 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 ...
[ "tensorflow.random.set_seed", "matplotlib.pyplot.title", "tensorflow.keras.layers.Dense", "attr.s", "pandas.read_csv", "numpy.set_printoptions", "numpy.random.RandomState", "tensorflow.keras.optimizers.Adam", "util.file_util.FileUtil.get_caller_name", "matplotlib.pyplot.show", "matplotlib.pyplot...
[((946, 983), 'attr.s', 'attr.s', ([], {'slots': '(True)', 'auto_attribs': '(True)'}), '(slots=True, auto_attribs=True)\n', (952, 983), False, 'import attr\n'), ((1131, 1166), 'attr.ib', 'attr.ib', ([], {'default': 'None', 'kw_only': '(True)'}), '(default=None, kw_only=True)\n', (1138, 1166), False, 'import attr\n'), (...
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.runner import force_fp32, auto_fp16 from mmcv.cnn import ConvModule, build_upsample_layer from mmdet.core import bbox_rescale from mmdet.models.builder import HEADS, build_loss from mmdet.models.roi_heads.mask_...
[ "pcan.core.cal_similarity", "mmdet.core.bbox_rescale", "torch.cat", "mmcv.cnn.build_upsample_layer", "torch.nn.init.constant_", "torch.arange", "mmdet.models.roi_heads.mask_heads.fcn_mask_head._do_paste_mask", "torch.no_grad", "numpy.round", "mmcv.cnn.ConvModule", "torch.nn.init.kaiming_normal_"...
[((1161, 1226), 'torch.arange', 'torch.arange', (['num_pos_feats'], {'dtype': 'torch.float32', 'device': 'x.device'}), '(num_pos_feats, dtype=torch.float32, device=x.device)\n', (1173, 1226), False, 'import torch\n'), ((8406, 8417), 'mmcv.runner.auto_fp16', 'auto_fp16', ([], {}), '()\n', (8415, 8417), False, 'from mmcv...
#!/usr/bin.env python # coding: utf-8 import numpy as np import scipy.io as sio from pyhsiclasso import HSICLasso def main(): # Numpy array input example hsic_lasso = HSICLasso() data = sio.loadmat("../tests/test_data/matlab_data.mat") X = data["X"].transpose() Y = data["Y"][0] featname =...
[ "pyhsiclasso.HSICLasso", "numpy.array", "scipy.io.loadmat" ]
[((182, 193), 'pyhsiclasso.HSICLasso', 'HSICLasso', ([], {}), '()\n', (191, 193), False, 'from pyhsiclasso import HSICLasso\n'), ((205, 254), 'scipy.io.loadmat', 'sio.loadmat', (['"""../tests/test_data/matlab_data.mat"""'], {}), "('../tests/test_data/matlab_data.mat')\n", (216, 254), True, 'import scipy.io as sio\n'), ...
#!/usr/bin/env python3 import ambit import sys, traceback import numpy as np from pathlib import Path import results_check def main(): basepath = str(Path(__file__).parent.absolute()) IO_PARAMS = {'problem_type' : 'flow0d', # solid, fluid, flow0d, solid_flow0d, fluid_flow0d ...
[ "results_check.results_check_vec", "numpy.zeros", "results_check.success_check", "pathlib.Path", "traceback.format_exc", "numpy.cos", "sys.exit" ]
[((2426, 2464), 'numpy.zeros', 'np.zeros', (['problem.mp.cardvasc0D.numdof'], {}), '(problem.mp.cardvasc0D.numdof)\n', (2434, 2464), True, 'import numpy as np\n'), ((3944, 4023), 'results_check.results_check_vec', 'results_check.results_check_vec', (['problem.mp.s', 's_corr', 'problem.mp.comm'], {'tol': 'tol'}), '(prob...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Apr 30 10:52:41 2018 @author: cuijiaxu """ import numpy as np import pylab as pl def simpleBasis(x): if len(x)==1: return np.array([1.0,x[0],x[0]*x[0]]) else: xx=[] for i in range(len(x)): xx.append(np.ar...
[ "pylab.title", "pylab.savefig", "pylab.colorbar", "pylab.figure", "numpy.loadtxt", "numpy.array" ]
[((2351, 2408), 'numpy.loadtxt', 'np.loadtxt', (["('results/basis-RGBODGCN-r%s.txt' % info.rseed)"], {}), "('results/basis-RGBODGCN-r%s.txt' % info.rseed)\n", (2361, 2408), True, 'import numpy as np\n'), ((2411, 2423), 'pylab.figure', 'pl.figure', (['(4)'], {}), '(4)\n', (2420, 2423), True, 'import pylab as pl\n'), ((2...
import cv2 import numpy as np def solidBackground(shape = (480, 640, 3), color = (0, 255, 0)): bg_image = np.ones(shape, dtype = np.uint8) bg_image[:] = color return bg_image def imageBackground(source): return cv2.imread(source)
[ "cv2.imread", "numpy.ones" ]
[((111, 141), 'numpy.ones', 'np.ones', (['shape'], {'dtype': 'np.uint8'}), '(shape, dtype=np.uint8)\n', (118, 141), True, 'import numpy as np\n'), ((229, 247), 'cv2.imread', 'cv2.imread', (['source'], {}), '(source)\n', (239, 247), False, 'import cv2\n')]
# Copyright (c) <NAME>. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory. # This example uses the "noisy Travelers Salesman Problem" and applies a machine learning # approach to avoid unnecessary function calls. Works only with the Python variant of # differentia...
[ "noisy_tsp.load_tsplib", "numpy.random.random", "numpy.array", "xgboost.XGBRegressor", "collections.deque" ]
[((2392, 2424), 'noisy_tsp.load_tsplib', 'load_tsplib', (['"""data/tsp/br17.tsp"""'], {}), "('data/tsp/br17.tsp')\n", (2403, 2424), False, 'from noisy_tsp import TSP, load_tsplib\n'), ((888, 906), 'collections.deque', 'deque', ([], {'maxlen': 'size'}), '(maxlen=size)\n', (893, 906), False, 'from collections import dequ...
# Copyright 1999-2020 Alibaba Group Holding 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 a...
[ "numpy.result_type", "numpy.asanyarray", "numpy.dtype", "pandas.Index", "pandas.Series", "collections.OrderedDict", "numpy.asscalar" ]
[((3402, 3433), 'pandas.Index', 'pd.Index', (['[]'], {'dtype': 'q_val.dtype'}), '([], dtype=q_val.dtype)\n', (3410, 3433), True, 'import pandas as pd\n'), ((3530, 3552), 'numpy.asanyarray', 'np.asanyarray', (['self._q'], {}), '(self._q)\n', (3543, 3552), True, 'import numpy as np\n'), ((3576, 3591), 'pandas.Index', 'pd...
# -*- coding: utf-8 -*- # # Author: <NAME> <<EMAIL>> from __future__ import print_function, division, absolute_import import os # DEFINE CONFIG def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration libs = [] if os.name == 'posix': libs.append('...
[ "numpy.distutils.misc_util.Configuration" ]
[((338, 385), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""bear"""', 'parent_package', 'top_path'], {}), "('bear', parent_package, top_path)\n", (351, 385), False, 'from numpy.distutils.misc_util import Configuration\n')]
""" EXPERIMENT """ from tools.model import * from tools.data import DataNPZ import argparse import logging.config from traceback import format_exc import torch import torch.nn as nn from torch.optim import optimizer from torch.utils.data import DataLoader from torchmetrics import MeanAbsolutePercentageError from ...
[ "numpy.load", "numpy.random.seed", "argparse.ArgumentParser", "matplotlib.pyplot.style.use", "pathlib.Path", "torch.nn.MSELoss", "tools.data.DataNPZ", "torchmetrics.WeightedMeanAbsolutePercentageError", "random.seed", "traceback.format_exc", "torchmetrics.SymmetricMeanAbsolutePercentageError", ...
[((645, 669), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (658, 669), True, 'import matplotlib.pyplot as plt\n'), ((1568, 1726), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""NeuralODE soil experiment"""', 'description': '"""Скрипт запускает экспер...
import numpy as np def load_data(): data = np.loadtxt('input.csv', dtype='int32', delimiter=',') return data def find_noun_verb(data): for noun in range(0, 100): for verb in range(0, 100): d = np.array(data, copy=True) d[1] = noun d[2] = verb index = 0 while(True): cmd ...
[ "numpy.array", "numpy.loadtxt" ]
[((46, 99), 'numpy.loadtxt', 'np.loadtxt', (['"""input.csv"""'], {'dtype': '"""int32"""', 'delimiter': '""","""'}), "('input.csv', dtype='int32', delimiter=',')\n", (56, 99), True, 'import numpy as np\n'), ((211, 236), 'numpy.array', 'np.array', (['data'], {'copy': '(True)'}), '(data, copy=True)\n', (219, 236), True, '...
import os import time import numpy as np import torch import torch.nn.functional as F from utils import AverageMeter, save from .face_evaluate import evaluate from ..base_training_agent import MetaTrainingAgent class FRTrainingAgent(MetaTrainingAgent): """The training agent to train the supernet and the search...
[ "utils.AverageMeter", "time.time", "torch.nn.functional.normalize", "torch.no_grad", "numpy.concatenate" ]
[((900, 911), 'time.time', 'time.time', ([], {}), '()\n', (909, 911), False, 'import time\n'), ((1819, 1830), 'time.time', 'time.time', ([], {}), '()\n', (1828, 1830), False, 'import time\n'), ((2887, 2913), 'numpy.concatenate', 'np.concatenate', (['all_labels'], {}), '(all_labels)\n', (2901, 2913), True, 'import numpy...
#!/usr/bin/env python """ Created on May 15, 2012 """ from __future__ import division __author__ = "<NAME>" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __date__ = "May 15, 2012" import unittest import numpy as np from pyhull.simplex im...
[ "unittest.main", "pyhull.simplex.Simplex", "numpy.random.random_sample" ]
[((1626, 1641), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1639, 1641), False, 'import unittest\n'), ((570, 585), 'pyhull.simplex.Simplex', 'Simplex', (['coords'], {}), '(coords)\n', (577, 585), False, 'from pyhull.simplex import Simplex\n'), ((939, 972), 'pyhull.simplex.Simplex', 'Simplex', (['[[0, 1], [1, 1...
import sys import os import numpy as np import time from torch.utils import data import shutil import cv2 import nrrd import torch from torch.autograd import Variable sys.path.insert(0, "../image_fusion/") sys.path.insert(0, "../cross_validation/scripts/models/") # import predictForSubject import dicomToVolume i...
[ "numpy.sum", "numpy.abs", "numpy.amin", "model_resUnet.UNet", "numpy.rot90", "numpy.unique", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "predictForSubject.predictForSubject", "sys.exit", "os.makedirs", "numpy.zeros", "sys.path.insert", "measure.measureKidneys", "tim...
[((173, 211), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../image_fusion/"""'], {}), "(0, '../image_fusion/')\n", (188, 211), False, 'import sys\n'), ((212, 269), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../cross_validation/scripts/models/"""'], {}), "(0, '../cross_validation/scripts/models/')\n", (22...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Program for Created on %(date) @author : trismonock @mail : <EMAIL> """ import numpy as np def uvspec_input(lib_data_dir,cloud_file,input_file,sza,phi0,phi,zout,doy,\ albedo_file,lambda0,lambda1,tau550,aerosol_season,aerosol_haze): # +++...
[ "numpy.array" ]
[((605, 639), 'numpy.array', 'np.array', (['[-1.0, 1.0]'], {'dtype': 'float'}), '([-1.0, 1.0], dtype=float)\n', (613, 639), True, 'import numpy as np\n')]
import numpy as np from numpy.core.fromnumeric import std from scipy.stats.stats import ttest_ind np.random.seed(42) # create array of controllgroup controll_group_f = np.random.randint(0, 100, (1, 50), dtype=np.int32) controll_group_m = np.random.randint(0, 100, (1, 50), dtype=np.int32) # create array of errorgroup ...
[ "numpy.random.uniform", "numpy.random.seed", "scipy.stats.stats.ttest_ind", "numpy.std", "numpy.mean", "seaborn.boxplot", "numpy.random.randint" ]
[((99, 117), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (113, 117), True, 'import numpy as np\n'), ((169, 219), 'numpy.random.randint', 'np.random.randint', (['(0)', '(100)', '(1, 50)'], {'dtype': 'np.int32'}), '(0, 100, (1, 50), dtype=np.int32)\n', (186, 219), True, 'import numpy as np\n'), ((239...
# for Logging handling import logging.config import pickle from functools import lru_cache import numpy as np import sympy logger = logging.getLogger(__name__) def c(ixs): """The sum of a range of integers Parameters ---------- ixs : list data list Returns ---------- sum : int ...
[ "pickle.dump", "numpy.count_nonzero", "model.BezierSimplex", "numpy.sum", "numpy.savetxt", "numpy.zeros", "sympy.diff", "numpy.nonzero", "itertools.combinations", "pickle.load", "numpy.loadtxt", "numpy.linspace", "functools.lru_cache", "numpy.concatenate" ]
[((1113, 1132), 'numpy.count_nonzero', 'np.count_nonzero', (['a'], {}), '(a)\n', (1129, 1132), True, 'import numpy as np\n'), ((1731, 1752), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'ng'], {}), '(0, 1, ng)\n', (1742, 1752), True, 'import numpy as np\n'), ((5982, 6005), 'functools.lru_cache', 'lru_cache', ([], {...
import numpy as np import algos import utils import viz import threading def cornerDetectionAndSuppression(I, Imask, anms, cmax, out): if not anms: _, Ixy = algos.harris(I, maxPeaks=cmax) out.append(Ixy) Id = algos.makeDescriptors(I, Ixy) out.append(Id) else: Ih, Ixy = ...
[ "viz.plotDescriptors", "numpy.random.seed", "numpy.amin", "numpy.abs", "numpy.ones", "viz.plotMatches", "algos.makeDescriptors", "algos.ransac", "numpy.arange", "algos.matchDescriptors", "algos.harris", "algos.anms", "utils.Image.load", "viz.plotImages", "threading.Thread", "numpy.ceil...
[((2179, 2221), 'algos.matchDescriptors', 'algos.matchDescriptors', (['Sd', 'Td'], {'nnMax': '(0.55)'}), '(Sd, Td, nnMax=0.55)\n', (2201, 2221), False, 'import algos\n'), ((2674, 2714), 'algos.ransac', 'algos.ransac', (['Sxy', 'Txy', 'idx'], {'e': '(6)', 'n': '(1000)'}), '(Sxy, Txy, idx, e=6, n=1000)\n', (2686, 2714), ...
from scipy.ndimage import zoom import numpy as np import config as c import data class Visualizer: def __init__(self, loss_labels): self.n_losses = len(loss_labels) self.loss_labels = loss_labels self.counter = 0 header = 'Epoch' for l in loss_labels: ...
[ "numpy.zeros", "visdom.Visdom", "scipy.ndimage.zoom", "numpy.ones", "numpy.clip", "matplotlib.use", "numpy.array", "numpy.random.random", "numpy.log10", "matplotlib.pyplot.subplots" ]
[((790, 811), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (804, 811), False, 'import matplotlib\n'), ((1075, 1090), 'visdom.Visdom', 'visdom.Visdom', ([], {}), '()\n', (1088, 1090), False, 'import visdom\n'), ((1587, 1634), 'matplotlib.pyplot.subplots', 'plt.subplots', (['n_plots', 'n_plots'],...
import haiku as hk import jax.numpy as jnp import numpy as np import pytest import optax as optix from rljax.util.optim import clip_gradient, clip_gradient_norm, optimize, soft_update, weight_decay @pytest.mark.parametrize("lr, w, x", [(0.1, 1.0, 1.0), (0.1, 20.0, 10.0), (1e-3, 0.0, -10.0)]) def test_optimize(lr, w,...
[ "rljax.util.optim.soft_update", "haiku.initializers.Constant", "rljax.util.optim.clip_gradient_norm", "jax.numpy.zeros", "haiku.PRNGSequence", "numpy.isclose", "numpy.array", "rljax.util.optim.clip_gradient", "optax.sgd", "jax.numpy.ones", "pytest.mark.parametrize" ]
[((202, 301), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lr, w, x"""', '[(0.1, 1.0, 1.0), (0.1, 20.0, 10.0), (0.001, 0.0, -10.0)]'], {}), "('lr, w, x', [(0.1, 1.0, 1.0), (0.1, 20.0, 10.0), (\n 0.001, 0.0, -10.0)])\n", (225, 301), False, 'import pytest\n'), ((537, 550), 'optax.sgd', 'optix.sgd', (['l...
import numpy as np import pickle import time class off_policy_mc: def __init__(self,q,c,state_name,action_name,exploration_space,epsilon=None,discount=None,theta=None,episode_step=None,save_episode=True): self.q=q self.c=c self.episode=[] self.state_name=state_name ...
[ "pickle.dump", "numpy.abs", "numpy.argmax", "numpy.power", "time.time", "pickle.load", "numpy.random.choice" ]
[((837, 848), 'time.time', 'time.time', ([], {}), '()\n', (846, 848), False, 'import time\n'), ((2130, 2141), 'time.time', 'time.time', ([], {}), '()\n', (2139, 2141), False, 'import time\n'), ((3017, 3032), 'numpy.argmax', 'np.argmax', (['q[s]'], {}), '(q[s])\n', (3026, 3032), True, 'import numpy as np\n'), ((6206, 62...
# FORCsensei module # compile using: python3 setup.py sdist bdist_wheel import os import numpy as np import codecs as cd import scipy as sp from scipy import linalg from IPython.display import YouTubeVideo import ipywidgets as widgets from ipywidgets import interact, interactive, fixed, Layout, VBox, HBox import matp...
[ "numpy.isin", "numpy.random.seed", "matplotlib.colors.LinearSegmentedColormap", "numpy.abs", "numpy.polyfit", "numpy.argmax", "IPython.display.YouTubeVideo", "numpy.sum", "ipywidgets.Text", "numpy.allclose", "numpy.ones", "numpy.isnan", "numpy.argsort", "matplotlib.pyplot.figure", "numpy...
[((1054, 1277), 'ipywidgets.Dropdown', 'widgets.Dropdown', ([], {'options': "[['Select topic', -1], ['1: Introduction - working with FORCsensei', 0], [\n '2: Plotting options', 1], ['3: download options', 2]]", 'value': '(-1)', 'description': '"""Video tutorials:"""', 'style': 'style'}), "(options=[['Select topic', ...
from unittest.mock import patch import numpy as np import pandas as pd import pytest from evalml.exceptions import EnsembleMissingPipelinesError from evalml.model_family import ModelFamily from evalml.pipelines import ( BinaryClassificationPipeline, MulticlassClassificationPipeline, ) from evalml.pipelines.co...
[ "numpy.random.rand", "evalml.pipelines.components.RandomForestClassifier", "numpy.isnan", "unittest.mock.patch", "pytest.raises", "pandas.Series", "evalml.pipelines.components.ensemble.StackedEnsembleClassifier", "pytest.mark.parametrize", "evalml.pipelines.MulticlassClassificationPipeline", "eval...
[((3391, 3498), 'unittest.mock.patch', 'patch', (['"""evalml.pipelines.components.ensemble.StackedEnsembleClassifier._stacking_estimator_class"""'], {}), "(\n 'evalml.pipelines.components.ensemble.StackedEnsembleClassifier._stacking_estimator_class'\n )\n", (3396, 3498), False, 'from unittest.mock import patch\n'...
import matplotlib.pyplot as plt import numpy as np import argparse parser = argparse.ArgumentParser() parser.add_argument('-m', '--mode', type=str, required=True, help='either "train" or "test"') args = parser.parse_args() a = np.load(f'APP4_RL_StockTrader_rewards/{args.mode}.npy') print(f"averag...
[ "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "matplotlib.pyplot.hist" ]
[((77, 102), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (100, 102), False, 'import argparse\n'), ((249, 304), 'numpy.load', 'np.load', (['f"""APP4_RL_StockTrader_rewards/{args.mode}.npy"""'], {}), "(f'APP4_RL_StockTrader_rewards/{args.mode}.npy')\n", (256, 304), True, 'import numpy as np\n'...
import numpy as np #from intervalt import * import sys def __MAX__(x, y): if x>y: return x else: return y class NNett: def __init__(self, _weights, _biases): self.weights=_weights self.biases=_biases self.weights.append([]) # output layer has empty weight vector self.biases=[[]]+self.biases # i...
[ "numpy.argmax" ]
[((1129, 1150), 'numpy.argmax', 'np.argmax', (['act[N - 1]'], {}), '(act[N - 1])\n', (1138, 1150), True, 'import numpy as np\n')]
# encoding=utf8 # 基于Doc2vec训练句子向量 https://zhuanlan.zhihu.com/p/36886191 import jieba import numpy as np from bert4keras.backend import keras from bert4keras.models import build_transformer_model def ___(): build_transformer_model() from bert4keras.tokenizers import Tokenizer from numpy.linalg import linalg __a...
[ "bert4keras.models.build_transformer_model", "bert4keras.tokenizers.Tokenizer", "numpy.linalg.linalg.norm", "numpy.array", "jieba.strdecode", "bert4keras.backend.keras.models.load_model" ]
[((212, 237), 'bert4keras.models.build_transformer_model', 'build_transformer_model', ([], {}), '()\n', (235, 237), False, 'from bert4keras.models import build_transformer_model\n'), ((474, 509), 'bert4keras.backend.keras.models.load_model', 'keras.models.load_model', (['model_file'], {}), '(model_file)\n', (497, 509),...
import sys import numpy as np ''' (1) 对于字符串z 和 y,index i, j分别从0开始指示z和y的字符,lcs(i, j)表示 z(i, ... len(z)和y(j, ..., len(y))的最长公共子串, 存在如下递归计算式: 如果 z(i) == y(j),那么lcs(i, j) = z(i) + lcs(i+1, j+1); 否则,即z(i) != y(j), 那么lcs(i, j) = max(lcs(i, j+1), lcs(i+1, j)) (2) 注意到,lcs(i, j+1) 和lcs(i+1, j)的子调用中存在大量重复的计算,因此,符合动态规划的子问题分解和...
[ "sys.stderr.write", "numpy.zeros" ]
[((757, 779), 'numpy.zeros', 'np.zeros', (['(1000, 1000)'], {}), '((1000, 1000))\n', (765, 779), True, 'import numpy as np\n'), ((933, 1020), 'sys.stderr.write', 'sys.stderr.write', (["('Input String Size is Over MAX_STR_SIZE, %s' % self.MAX_STR_SIZE)"], {}), "('Input String Size is Over MAX_STR_SIZE, %s' % self.\n ...