code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import cv2 import keras.backend as K import numpy as np import tensorflow as tf from keras.layers import Conv2D from keras.models import Model from app.main.Actions import Actions from app.models.model_factory import get_model class Visualizer(Actions): y = None y_hat = None FONT = cv2.FONT_HERSHEY_SIMPL...
[ "cv2.resize", "cv2.imwrite", "numpy.zeros", "numpy.min", "numpy.max", "keras.backend.eval", "app.models.model_factory.get_model" ]
[((931, 1139), 'app.models.model_factory.get_model', 'get_model', (['self.DSConfig.class_names'], {'weights_path': 'self.MDConfig.trained_model_weights', 'image_dimension': 'self.IMConfig.img_dim', 'color_mode': 'self.IMConfig.color_mode', 'class_mode': 'self.DSConfig.class_mode'}), '(self.DSConfig.class_names, weights...
# from pyvirtualdisplay import Display # display = Display(visible=1, size=(480, 320)) # display.start() import numpy as np import torch from toy.value_iteration import * from toy.network import AttentionNet from toy.env.fourrooms import Fourrooms from toy.env.fourrooms_withcoin import FourroomsCoin from torch import o...
[ "toy.network.AttentionNet", "torch.utils.data.DataLoader", "torch.rand", "numpy.min", "toy.env.fourrooms_withcoin.FourroomsCoin", "numpy.array", "numpy.mean", "numpy.max", "torch.device", "os.path.join", "cv2.resize", "numpy.repeat" ]
[((627, 647), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (639, 647), False, 'import torch\n'), ((675, 690), 'toy.env.fourrooms_withcoin.FourroomsCoin', 'FourroomsCoin', ([], {}), '()\n', (688, 690), False, 'from toy.env.fourrooms_withcoin import FourroomsCoin\n'), ((998, 1071), 'torch.utils.dat...
import unittest import numpy as np import torch from torch import nn from torchvision.ops import box_convert from rastervision.pytorch_learner.object_detection_utils import ( BoxList, collate_fn, TorchVisionODAdapter) class MockModel(nn.Module): def __init__(self, num_classes: int) -> None: super()....
[ "unittest.main", "torch.randint", "torch.empty", "torch.equal", "numpy.random.randint", "numpy.array", "torch.rand", "torch.is_tensor", "torchvision.ops.box_convert", "rastervision.pytorch_learner.object_detection_utils.BoxList" ]
[((5710, 5725), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5723, 5725), False, 'import unittest\n'), ((1163, 1190), 'torch.empty', 'torch.empty', (['N', '(3)', '(100)', '(100)'], {}), '(N, 3, 100, 100)\n', (1174, 1190), False, 'import torch\n'), ((1796, 1823), 'torch.empty', 'torch.empty', (['N', '(3)', '(100...
import timeit import tensorflow as tf import tensorflow_datasets as tfds import numpy as np import matplotlib.pyplot as plt from object_detection.metrics.coco_evaluation import CocoDetectionEvaluator from object_detection.core.standard_fields import InputDataFields, DetectionResultFields from yolov3_tf2.models import...
[ "tensorflow_datasets.load", "matplotlib.pyplot.imshow", "matplotlib.pyplot.figure", "yolov3_tf2.models.YoloV3", "yolov3_tf2.utils.draw_outputs", "numpy.array", "tensorflow.image.resize", "matplotlib.pyplot.savefig" ]
[((385, 437), 'tensorflow_datasets.load', 'tfds.load', (['"""coco"""'], {'with_info': '(True)', 'data_dir': '"""./data"""'}), "('coco', with_info=True, data_dir='./data')\n", (394, 437), True, 'import tensorflow_datasets as tfds\n'), ((610, 695), 'yolov3_tf2.models.YoloV3', 'YoloV3', ([], {'size': 'img_size', 'classes'...
import pySALESetup as pss import numpy as np import random """ This is a simple script that creates a particle bed of elliptical grains with ice shrouds covering them. It creates two meshes and then merges them to make one mirror-impact setup. """ # create two identical meshes mesh1 = pss.Mesh(X=400,Y=200) mesh2 = pss...
[ "pySALESetup.Mesh", "pySALESetup.combine_meshes", "pySALESetup.Grain", "random.random", "numpy.array", "pySALESetup.grainfromEllipse", "pySALESetup.Ensemble" ]
[((287, 309), 'pySALESetup.Mesh', 'pss.Mesh', ([], {'X': '(400)', 'Y': '(200)'}), '(X=400, Y=200)\n', (295, 309), True, 'import pySALESetup as pss\n'), ((317, 339), 'pySALESetup.Mesh', 'pss.Mesh', ([], {'X': '(400)', 'Y': '(200)'}), '(X=400, Y=200)\n', (325, 339), True, 'import pySALESetup as pss\n'), ((419, 438), 'pyS...
from ..CodonSpecification import CodonSpecification from python_codon_tables import get_codons_table import numpy as np from ...Location import Location from ...biotools import group_nearby_indices class BaseCodonOptimizationClass(CodonSpecification): best_possible_score = 0 # Don't forget to change in subclass...
[ "numpy.array", "python_codon_tables.get_codons_table" ]
[((1820, 1837), 'numpy.array', 'np.array', (['indices'], {}), '(indices)\n', (1828, 1837), True, 'import numpy as np\n'), ((1434, 1459), 'python_codon_tables.get_codons_table', 'get_codons_table', (['species'], {}), '(species)\n', (1450, 1459), False, 'from python_codon_tables import get_codons_table\n')]
from __future__ import division import numpy as np import pandas as pd from sklearn.base import BaseEstimator from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV class RandomShapeletForest(BaseEstimator): def __init__(self, number_shapelets = 20,...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.corrcoef", "numpy.max", "numpy.array", "pandas.Series" ]
[((3637, 3654), 'numpy.max', 'np.max', (['corr_list'], {}), '(corr_list)\n', (3643, 3654), True, 'import numpy as np\n'), ((4544, 4596), 'numpy.array', 'np.array', (['timeseries[ii:ii + random_shapelet_length]'], {}), '(timeseries[ii:ii + random_shapelet_length])\n', (4552, 4596), True, 'import numpy as np\n'), ((1994,...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from imfits import Imfits # intensity map def intensitymap(self, ax=None, outname=None, imscale=[], outformat='pdf', color=True, cmap='Blues', colorbar=True, cbaroptions=np.array(['right','4%','0%','Jy/beam']...
[ "mpl_toolkits.axes_grid1.ImageGrid", "numpy.abs", "numpy.empty", "matplotlib.pyplot.figure", "matplotlib.colors.LogNorm", "numpy.rot90", "numpy.sin", "matplotlib.pyplot.hlines", "matplotlib.colors.Normalize", "matplotlib.pyplot.colorbar", "numpy.cos", "matplotlib.patches.Ellipse", "matplotli...
[((282, 324), 'numpy.array', 'np.array', (["['right', '4%', '0%', 'Jy/beam']"], {}), "(['right', '4%', '0%', 'Jy/beam'])\n", (290, 324), True, 'import numpy as np\n'), ((4519, 4558), 'numpy.array', 'np.array', (["['eps', 'pdf', 'png', 'jpeg']"], {}), "(['eps', 'pdf', 'png', 'jpeg'])\n", (4527, 4558), True, 'import nump...
""" Lun. 12 Sep 2018 Author: <NAME> """ #IMPORTING LIBS import numpy as np import scipy.stats as si import matplotlib.pyplot as plt #Helper functions: def d_m(x, v): d_ = np.log(x) / np.sqrt(v) - .5 * np.sqrt(v) return d_ #Q1-a def C0(r, T, S0, K, sigma): X0 = S0 / (K * np.exp(-r*T)) C = si....
[ "numpy.log", "numpy.cumsum", "numpy.array", "numpy.exp", "numpy.random.normal", "numpy.sqrt" ]
[((847, 859), 'numpy.cumsum', 'np.cumsum', (['z'], {}), '(z)\n', (856, 859), True, 'import numpy as np\n'), ((1287, 1301), 'numpy.array', 'np.array', (['Ind_'], {}), '(Ind_)\n', (1295, 1301), True, 'import numpy as np\n'), ((1809, 1823), 'numpy.array', 'np.array', (['Ind_'], {}), '(Ind_)\n', (1817, 1823), True, 'import...
import numpy as np from sklearn.preprocessing import scale from sklearn.preprocessing import StandardScaler import matplotlib import matplotlib.pyplot as plt def find_error(X, y, w): """ Returns || Xw - y ||_2^2 (squared error) """ return np.linalg.norm(X@w - y, ord=2)**2 def get_lambda_lims(X, y, eps...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "sklearn.preprocessing.StandardScaler", "numpy.log", "matplotlib.pyplot.scatter", "numpy.ones", "numpy.hstack", "numpy.argsort", "numpy.any", "matplotlib.pyplot.figure", "numpy.array", "numpy.linalg.norm", "numpy.arange", "matplotlib....
[((830, 846), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (844, 846), False, 'from sklearn.preprocessing import StandardScaler\n'), ((861, 891), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {'with_std': '(False)'}), '(with_std=False)\n', (875, 891), False, 'from sklearn...
import unittest import numpy as np from PCAfold import preprocess from PCAfold import reduction from PCAfold import analysis class Preprocess(unittest.TestCase): def test_preprocess__get_centroids__allowed_calls(self): pass # ------------------------------------------------------------------------------...
[ "numpy.random.rand", "PCAfold.preprocess.get_centroids", "numpy.zeros", "numpy.array" ]
[((401, 424), 'numpy.random.rand', 'np.random.rand', (['(100)', '(10)'], {}), '(100, 10)\n', (415, 424), True, 'import numpy as np\n'), ((438, 453), 'numpy.zeros', 'np.zeros', (['(90,)'], {}), '((90,))\n', (446, 453), True, 'import numpy as np\n'), ((569, 592), 'numpy.random.rand', 'np.random.rand', (['(100)', '(10)'],...
# coding=utf-8 import math import numpy as np TIMES = 1000 choose = 0 if choose: dTypeEdge = np.dtype([('last_mid', np.str_, 16), ('mid', np.str_, 16)]) nDEdges = np.loadtxt('Weibo/res/edges.csv', dtype=dTypeEdge, delimiter=',') dTypeNode = np.dtype([('mid', np.str_, 16)]) nDNodes = np.loadtxt('Wei...
[ "math.sqrt", "numpy.savetxt", "numpy.dtype", "numpy.zeros", "numpy.array", "numpy.loadtxt", "numpy.random.rand" ]
[((897, 935), 'numpy.zeros', 'np.zeros', (['(nodesLength, 1)', 'np.float16'], {}), '((nodesLength, 1), np.float16)\n', (905, 935), True, 'import numpy as np\n'), ((101, 160), 'numpy.dtype', 'np.dtype', (["[('last_mid', np.str_, 16), ('mid', np.str_, 16)]"], {}), "([('last_mid', np.str_, 16), ('mid', np.str_, 16)])\n", ...
# -*- coding: utf-8 -*- # # Copyright © 2012 CEA # <NAME> # Licensed under the terms of the CECILL License # (see guiqwt/__init__.py for details) """Rotate/crop test: using the scaler C++ engine to rotate/crop images""" from __future__ import print_function SHOW = True # Show test in GUI-based test launcher import ...
[ "os.path.dirname", "guiqwt.builder.make.image", "guiqwt.widgets.rotatecrop.RotateCropWidget", "guiqwt.widgets.rotatecrop.RotateCropDialog", "guiqwt.widgets.rotatecrop.MultipleRotateCropWidget", "numpy.rot90", "guiqwt.plot.ImageDialog", "guiqwt.builder.make.trimage", "guidata.qapplication" ]
[((639, 666), 'guiqwt.plot.ImageDialog', 'ImageDialog', ([], {'wintitle': 'title'}), '(wintitle=title)\n', (650, 666), False, 'from guiqwt.plot import ImageDialog\n'), ((988, 1024), 'guiqwt.builder.make.trimage', 'make.trimage', (['array0'], {'dx': '(0.1)', 'dy': '(0.1)'}), '(array0, dx=0.1, dy=0.1)\n', (1000, 1024), F...
from __future__ import division import os import sys import random import argparse import time from shutil import copyfile import numpy as np import scipy.io as sio import matplotlib.pyplot as plt from scipy.signal import medfilt from scipy import stats import torch import torch.nn as nn import torch.nn.functional as F...
[ "utils.EarlyStopping", "numpy.random.seed", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "os.path.join", "torch.autograd.Variable", "os.path.realpath", "numpy.clip", "time.time", "numpy.append", "numpy.array", "net.MyNet", "sklearn.metrics.confusion_matrix", "utils.WeightedMSE...
[((1187, 1257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Engagement estimation with LSTM"""'}), "(description='Engagement estimation with LSTM')\n", (1210, 1257), False, 'import argparse\n'), ((2623, 2643), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2637, 2...
from mpl_toolkits.basemap import Basemap, shiftgrid, cm import numpy as np import matplotlib.pyplot as plt import h5py # create the figure and axes instances. fig = plt.figure() ax = fig.add_axes([0.1,0.1,0.8,0.8]) # setup of basemap ('lcc' = lambert conformal conic). # use major and minor sphere radii from WGS84 e...
[ "path.path", "h5py.File", "matplotlib.pyplot.show", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "datetime.datetime.strptime", "numpy.arange", "mpl_toolkits.basemap.Basemap" ]
[((169, 181), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (179, 181), True, 'import matplotlib.pyplot as plt\n'), ((334, 540), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'llcrnrlon': '(-145.5)', 'llcrnrlat': '(1.0)', 'urcrnrlon': '(-2.566)', 'urcrnrlat': '(46.352)', 'rsphere': '(6378137.0, 6356752...
""" File to generate comparisons between the models for data recorded as part of the HCHS publicly available data set. https://sleepdata.org/datasets/hchs """ from __future__ import print_function #Set the path to the downloaded HCHS data files on YOUR system!! hchs_data_location='../../HumanData/HCHS/hchs-sol-sue...
[ "seaborn.lineplot", "pandas.read_csv", "pandas.DatetimeIndex", "seaborn.regplot", "pylab.figure", "pylab.tight_layout", "builtins.range", "pandas.DataFrame", "scipy.interpolate.InterpolatedUnivariateSpline", "numpy.power", "pandas.merge", "numpy.linspace", "pylab.subplot", "pylab.savefig",...
[((2560, 2677), 'pandas.read_csv', 'pd.read_csv', (['"""../../HumanData/HCHS/datasets/hchs-sol-sueno-ancillary-dataset-0.3.0.csv"""'], {'usecols': 'column_list'}), "(\n '../../HumanData/HCHS/datasets/hchs-sol-sueno-ancillary-dataset-0.3.0.csv',\n usecols=column_list)\n", (2571, 2677), True, 'import pandas as pd\n...
import tensorflow as tf import logging from pdp.utils.vocab import aa_idx_vocab import numpy as np # new span # import random # todo : data split 에 대해 생각. 어떻게 데이터 버전 관리할지 class PretrainDataLoader: def __init__(self, files, seed: int = 12345): self.files = files self.seed = seed ...
[ "tensorflow.io.RaggedFeature", "tensorflow.ones", "tensorflow.range", "tensorflow.data.TFRecordDataset", "tensorflow.random.uniform", "tensorflow.identity", "random.shuffle", "tensorflow.gather", "tensorflow.device", "tensorflow.io.parse_single_example", "tensorflow.concat", "tensorflow.consta...
[((323, 340), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (334, 340), False, 'import random\n'), ((350, 376), 'random.shuffle', 'random.shuffle', (['self.files'], {}), '(self.files)\n', (364, 376), False, 'import random\n'), ((6007, 6037), 'tensorflow.constant', 'tf.constant', (['(0)'], {'dtype': 'tf.int3...
import numpy as np from nnfs.initializers import zeros, he_normal class Parameter: def __init__(self, initial_value): self.shape = initial_value.shape self.value = initial_value self.grad = np.zeros(initial_value.shape) class Layer: def get_parameters(self): return [] de...
[ "numpy.sum", "numpy.maximum", "numpy.empty", "numpy.zeros", "numpy.max", "numpy.where", "numpy.exp", "numpy.dot" ]
[((220, 249), 'numpy.zeros', 'np.zeros', (['initial_value.shape'], {}), '(initial_value.shape)\n', (228, 249), True, 'import numpy as np\n'), ((1034, 1072), 'numpy.dot', 'np.dot', (['grad_out', 'self.weights.value.T'], {}), '(grad_out, self.weights.value.T)\n', (1040, 1072), True, 'import numpy as np\n'), ((1101, 1140)...
import os from os import path as osp import numpy as np from tqdm import tqdm import pickle import cv2 import torch from experiments.service.benchmark_base import Benchmark from experiments.service.ldd_factory import LocalDetectorDescriptor from experiments.service.matchers_factory import MatchersFactory from experimen...
[ "numpy.sum", "experiments.service.ldd_factory.LocalDetectorDescriptor", "os.walk", "numpy.ones", "pickle.load", "numpy.linalg.norm", "numpy.mean", "os.path.join", "experiments.service.utils.compute_homography_error", "cv2.BFMatcher", "numpy.transpose", "numpy.append", "numpy.max", "experim...
[((1028, 1064), 'numpy.divide', 'np.divide', (['new_scale', 'original_scale'], {}), '(new_scale, original_scale)\n', (1037, 1064), True, 'import numpy as np\n'), ((875, 890), 'numpy.transpose', 'np.transpose', (['H'], {}), '(H)\n', (887, 890), True, 'import numpy as np\n'), ((1142, 1166), 'numpy.matmul', 'np.matmul', (...
# Create your tasks here from __future__ import absolute_import, unicode_literals import hashlib import json from urllib.parse import unquote import librosa import numpy as np from celery.task import task from django.core.exceptions import ObjectDoesNotExist from django.db import OperationalError from django.utils im...
[ "urllib.parse.unquote", "numpy.sum", "numpy.abs", "json.dumps", "numpy.mean", "numpy.round", "celery.task.task", "django.utils.timezone.now", "numpy.std", "numpy.cumsum", "numpy.cov", "librosa.stft", "numpy.asarray", "librosa.load", "numpy.dot", "librosa.onset.onset_strength", "numpy...
[((705, 775), 'celery.task.task', 'task', ([], {'name': '"""core.tasks.process_bpm"""', 'autoretry_for': '(OperationalError,)'}), "(name='core.tasks.process_bpm', autoretry_for=(OperationalError,))\n", (709, 775), False, 'from celery.task import task\n'), ((3072, 3149), 'celery.task.task', 'task', ([], {'name': '"""cor...
import geopandas as gpd import pandas as pd import numpy as np from .preprocess import * def busgps_arriveinfo(data,line,stop,col = ['VehicleId','GPSDateTime','lon','lat','stopname'], stopbuffer = 200,mintime = 300,project_epsg = 2416,timegap = 1800,method = 'project',projectoutput = False): ...
[ "pandas.DataFrame", "shapely.geometry.LineString", "geopandas.GeoDataFrame", "pandas.to_datetime", "geopandas.points_from_xy", "numpy.sign", "pandas.concat" ]
[((2769, 2809), 'geopandas.points_from_xy', 'gpd.points_from_xy', (['data[lon]', 'data[lat]'], {}), '(data[lon], data[lat])\n', (2787, 2809), True, 'import geopandas as gpd\n'), ((2820, 2842), 'geopandas.GeoDataFrame', 'gpd.GeoDataFrame', (['data'], {}), '(data)\n', (2836, 2842), True, 'import geopandas as gpd\n'), ((7...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd from numpy import linalg from sklearn import linear_model as lm from sklearn import svm as sv from cvxopt import matrix from cvxopt import solvers import time import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf impo...
[ "matplotlib.backends.backend_pdf.PdfPages", "pickle.dump", "matplotlib.pyplot.clf", "numpy.ones", "sklearn.svm.SVC", "numpy.identity", "time.clock", "cvxopt.solvers.qp", "matplotlib.pyplot.xticks", "cvxopt.matrix", "matplotlib.pyplot.legend", "numpy.hstack", "sklearn.linear_model.Perceptron"...
[((478, 489), 'numpy.zeros', 'np.zeros', (['D'], {}), '(D)\n', (486, 489), True, 'import numpy as np\n'), ((510, 521), 'numpy.zeros', 'np.zeros', (['D'], {}), '(D)\n', (518, 521), True, 'import numpy as np\n'), ((536, 552), 'numpy.zeros', 'np.zeros', (['(D, D)'], {}), '((D, D))\n', (544, 552), True, 'import numpy as np...
import numpy as np import cv2 def get_triangles(image, face_landmark_points): #The function creates an empty Delaunay subdivision where 2D points can be added #Subdiv2D( Rect(top_left_x, top_left_y, width, height) ) rect = (0, 0, image.shape[1], image.shape[0]) subdiv = cv2.Subdiv2D( rect ) ...
[ "cv2.Subdiv2D", "numpy.reshape", "cv2.line" ]
[((299, 317), 'cv2.Subdiv2D', 'cv2.Subdiv2D', (['rect'], {}), '(rect)\n', (311, 317), False, 'import cv2\n'), ((1109, 1127), 'cv2.Subdiv2D', 'cv2.Subdiv2D', (['rect'], {}), '(rect)\n', (1121, 1127), False, 'import cv2\n'), ((4477, 4518), 'numpy.reshape', 'np.reshape', (['img2_triangles_list', '(142, 6)'], {}), '(img2_t...
import numpy as np from typing import Tuple, List def _get_meanface( meanface_string: str, num_nb: int = 10 ) -> Tuple[List[int], List[int], List[int], int, int]: """ :param meanface_string: a long string contains normalized or un-normalized meanface coords, the format is "x0,y0,x1,y1,x2,...
[ "numpy.argsort", "numpy.power", "numpy.array" ]
[((909, 926), 'numpy.argsort', 'np.argsort', (['dists'], {}), '(dists)\n', (919, 926), True, 'import numpy as np\n'), ((622, 640), 'numpy.array', 'np.array', (['meanface'], {}), '(meanface)\n', (630, 640), True, 'import numpy as np\n'), ((855, 881), 'numpy.power', 'np.power', (['(pt - meanface)', '(2)'], {}), '(pt - me...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 1 15:52:48 2018 @author: esteban """ import numpy as np import solver as sol import matplotlib.pyplot as plt import matplotlib as mpl label_size = 16 mpl.rcParams['xtick.labelsize'] = label_size mpl.rcParams['font.size'] = label_size def predefin...
[ "matplotlib.pyplot.xlim", "numpy.abs", "matplotlib.pyplot.ylim", "matplotlib.pyplot.semilogx", "numpy.logspace", "solver.odd_pow", "scipy.special.gamma", "numpy.zeros", "solver.ode1", "numpy.ones", "matplotlib.pyplot.figure", "numpy.sin", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlab...
[((967, 988), 'numpy.logspace', 'np.logspace', (['(-1)', '(3)', '(5)'], {}), '(-1, 3, 5)\n', (978, 988), True, 'import numpy as np\n'), ((996, 1014), 'numpy.zeros', 'np.zeros', (['xx0.size'], {}), '(xx0.size)\n', (1004, 1014), True, 'import numpy as np\n'), ((1015, 1048), 'matplotlib.pyplot.figure', 'plt.figure', ([], ...
"""Custom pandas accessors. Methods can be accessed as follows: * `ReturnsSRAccessor` -> `pd.Series.vbt.returns.*` * `ReturnsDFAccessor` -> `pd.DataFrame.vbt.returns.*` ```python-repl >>> import numpy as np >>> import pandas as pd >>> import vectorbt as vbt >>> # vectorbt.returns.accessors.ReturnsAccessor.total >>>...
[ "vectorbt.utils.checks.is_pandas", "vectorbt.base.reshape_fns.broadcast_to", "numpy.isnan", "vectorbt.generic.accessors.GenericSRAccessor.__init__", "vectorbt.generic.accessors.GenericAccessor.__init__", "vectorbt.utils.checks.assert_type", "pandas.Timedelta", "vectorbt.utils.config.merge_dicts", "v...
[((2087, 2142), 'vectorbt._typing.TypeVar', 'tp.TypeVar', (['"""ReturnsAccessorT"""'], {'bound': '"""ReturnsAccessor"""'}), "('ReturnsAccessorT', bound='ReturnsAccessor')\n", (2097, 2142), True, 'from vectorbt import _typing as tp\n'), ((36936, 36971), 'vectorbt.root_accessors.register_series_accessor', 'register_serie...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 3 09:45:29 2019 @author: bala """ import random import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam from keras import optimizers import copy from sklearn.metrics import me...
[ "numpy.absolute", "copy.deepcopy", "random.randint", "random.sample", "numpy.asarray", "numpy.asanyarray", "numpy.zeros", "keras.optimizers.Adam", "random.random", "numpy.max", "numpy.where", "keras.layers.Dense", "numpy.linspace", "keras.models.Sequential", "sklearn.metrics.mean_squared...
[((910, 951), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)'], {'num': '(10)', 'endpoint': '(True)'}), '(-1, 1, num=10, endpoint=True)\n', (921, 951), True, 'import numpy as np\n'), ((2906, 2918), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2916, 2918), False, 'from keras.models import Sequential\n'),...
# -*- coding: utf-8 -*- # # unsupervised training of typology evaluator (categorical) # import sys import codecs import json import numpy as np import random from argparse import ArgumentParser from json_utils import load_json_file, load_json_stream from evaluator import CategoricalFeatureList, CategoricalFeatureListE...
[ "numpy.absolute", "numpy.random.seed", "argparse.ArgumentParser", "random.shuffle", "evaluator.CategoricalFeatureListEvaluator", "codecs.getwriter", "evaluator.NestedCategoricalFeatureListEvaluator", "random.seed", "evaluator.CategoricalFeatureList", "sys.stderr.write", "json_utils.load_json_fil...
[((2279, 2295), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (2293, 2295), False, 'from argparse import ArgumentParser\n'), ((4326, 4357), 'json_utils.load_json_file', 'load_json_file', (['args.fid2struct'], {}), '(args.fid2struct)\n', (4340, 4357), False, 'from json_utils import load_json_file, load_...
# -*- coding: utf-8 -*- # import vectorize_data as vd import settings import pickle as pickle from preProcessData import FeatureExtraction import numpy as np # X_train, y_train, X_test, y_test = vd.tf_Idf('./dataS/train/pre_train.txt', './dataS/test/pre_test.txt') # X_train, y_train, X_test, y_test = vd.Bow('./data/tr...
[ "sklearn.model_selection.GridSearchCV", "numpy.save", "numpy.array", "sklearn.svm.LinearSVC", "preProcessData.FeatureExtraction" ]
[((890, 901), 'sklearn.svm.LinearSVC', 'LinearSVC', ([], {}), '()\n', (899, 901), False, 'from sklearn.svm import LinearSVC\n'), ((1052, 1093), 'sklearn.model_selection.GridSearchCV', 'GridSearchCV', (['svc', 'param_grid'], {'refit': '(True)'}), '(svc, param_grid, refit=True)\n', (1064, 1093), False, 'from sklearn.mode...
import os, time, sys, zipfile import tensorflow as tf import torch from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F from io import open, BytesIO import numpy as np from PIL import Image import lib def pil_bilinear_interpolation(x, size=(299, 299)): """ x: [-1, 1] torch tensor ...
[ "numpy.load", "tensorflow.clip_by_value", "os.walk", "os.path.join", "tensorflow.image.crop_to_bounding_box", "tensorflow.py_function", "lib.utils.save_4dtensor_image", "tensorflow.image.random_contrast", "numpy.random.RandomState", "tensorflow.cast", "torch.Tensor", "io.open", "numpy.asarra...
[((334, 392), 'numpy.zeros', 'np.zeros', (['(x.shape[0], size[0], size[1], 3)'], {'dtype': '"""uint8"""'}), "((x.shape[0], size[0], size[1], 3), dtype='uint8')\n", (342, 392), True, 'import numpy as np\n'), ((1505, 1539), 'torch.Tensor', 'torch.Tensor', (['self.batch_size', '(128)'], {}), '(self.batch_size, 128)\n', (1...
from numpy import linspace, sum, absolute from math import log from population import Population, PopulationProperties from program_trees import IfWrapper, MultiplicationWrapper, AdditionWrapper, IsGreaterWrapper from environment import Environment, EnvironmentProperties from program_evolution import Evolution, Evoluti...
[ "population.PopulationProperties", "numpy.sum", "population.Population", "environment.Environment", "numpy.linspace" ]
[((837, 859), 'population.PopulationProperties', 'PopulationProperties', ([], {}), '()\n', (857, 859), False, 'from population import Population, PopulationProperties\n'), ((885, 970), 'population.Population', 'Population', (['function_wrappers', 'population_size', 'polynomial_population_properties'], {}), '(function_w...
import numpy as np from pandas.core.tools.numeric import to_numeric np.random.seed(42) import argparse import napari from napari_particles.particles import Particles from napari_particles.filters import ShaderFilter import pandas as pd def norm_clip(x, pmin=0.1, pmax=99.9): bounds = np.max(np.abs(np.percentile(x,...
[ "numpy.stack", "numpy.random.seed", "argparse.ArgumentParser", "numpy.median", "pandas.read_csv", "napari_particles.filters.ShaderFilter", "numpy.clip", "numpy.percentile", "numpy.max", "napari.Viewer", "napari.run" ]
[((68, 86), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (82, 86), True, 'import numpy as np\n'), ((361, 388), 'numpy.stack', 'np.stack', (['[-bounds, bounds]'], {}), '([-bounds, bounds])\n', (369, 388), True, 'import numpy as np\n'), ((397, 416), 'numpy.clip', 'np.clip', (['x', '*bounds'], {}), '(x...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 2020, <NAME> import numpy as np import pandas as pd from unittest import TestCase, main from .utils import MockKerasModel from ..core.constants import IMAGE_ID_COL, RLE_MASK_COL from ..core.optimization import RandomSearch class RandomSearchTest(TestCase): """ ...
[ "unittest.main", "numpy.arange" ]
[((2168, 2174), 'unittest.main', 'main', ([], {}), '()\n', (2172, 2174), False, 'from unittest import TestCase, main\n'), ((1343, 1363), 'numpy.arange', 'np.arange', (['(0)', '(128)', '(2)'], {}), '(0, 128, 2)\n', (1352, 1363), True, 'import numpy as np\n')]
#!/usr/bin/env python # Copyright 2018-2020 <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/LICENSE-2.0 # # Unless required by applicable law or ...
[ "unittest.main", "nbconvert.PythonExporter", "yaml.load", "numpy.load", "project3.Project3" ]
[((711, 737), 'nbconvert.PythonExporter', 'nbconvert.PythonExporter', ([], {}), '()\n', (735, 737), False, 'import nbconvert\n'), ((915, 943), 'numpy.load', 'np.load', (['"""pressure_gold.npy"""'], {}), "('pressure_gold.npy')\n", (922, 943), True, 'import numpy as np\n'), ((985, 1015), 'numpy.load', 'np.load', (['"""sa...
"""Tests cleaning module """ import numpy as np import pandas as pd from dsutils.cleaning import remove_duplicate_cols from dsutils.cleaning import remove_noninformative_cols from dsutils.cleaning import categorical_to_int def test_remove_duplicate_cols(): """Tests cleaning.remove_duplicate_cols""" # Sh...
[ "pandas.DataFrame", "numpy.array", "dsutils.cleaning.categorical_to_int", "dsutils.cleaning.remove_noninformative_cols" ]
[((356, 370), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (368, 370), True, 'import pandas as pd\n'), ((385, 413), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5]'], {}), '([0, 1, 2, 3, 4, 5])\n', (393, 413), True, 'import numpy as np\n'), ((428, 468), 'numpy.array', 'np.array', (["['a', 'a', 'a', 'b', 'b', ...
import unittest import numpy as np import pandas from GeoVectorizer import GeoVectorizer, GEO_VECTOR_LEN from shapely import wkt as wktreader TOPOLOGY_CSV = 'test_files/polygon_multipolygon.csv' SOURCE_DATA = pandas.read_csv(TOPOLOGY_CSV) brt_wkt = SOURCE_DATA['brt_wkt'] osm_wkt = SOURCE_DATA['osm_wkt'] target_wkt = ...
[ "pandas.read_csv", "GeoVectorizer.GeoVectorizer.max_points", "numpy.array", "GeoVectorizer.GeoVectorizer.vectorize_wkt", "shapely.wkt.loads" ]
[((211, 240), 'pandas.read_csv', 'pandas.read_csv', (['TOPOLOGY_CSV'], {}), '(TOPOLOGY_CSV)\n', (226, 240), False, 'import pandas\n'), ((366, 695), 'numpy.array', 'np.array', (['[[0.0, 0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0, 0.0], [1.0, 1.0, 1.0, 0.0,\n 0.0], [1.0, 0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0, 0.0], [...
#!/usr/bin/env python3 import colour from PIL import Image import numpy as np from matplotlib import pyplot as plt from colour.plotting import * from colour_demosaicing import ( EXAMPLES_RESOURCES_DIRECTORY, demosaicing_CFA_Bayer_bilinear, demosaicing_CFA_Bayer_Malvar2004, demosaicing_CFA_Bayer_Menon2...
[ "numpy.average", "numpy.fromfile", "PIL.Image.open", "colour_demosaicing.demosaicing_CFA_Bayer_Menon2007", "numpy.reshape" ]
[((572, 603), 'numpy.reshape', 'np.reshape', (['image', '(lines, 320)'], {}), '(image, (lines, 320))\n', (582, 603), True, 'import numpy as np\n'), ((629, 653), 'PIL.Image.open', 'Image.open', (['"""image.jpeg"""'], {}), "('image.jpeg')\n", (639, 653), False, 'from PIL import Image\n'), ((468, 485), 'numpy.average', 'n...
import _init_paths import argparse import os import random import time import numpy as np from object_pose_utils.datasets.pose_dataset import OutputTypes as otypes from object_pose_utils.datasets.ycb_dataset import YcbDataset as YCBDataset from object_pose_utils.datasets.image_processing import ColorJitter, ImageNormal...
[ "argparse.ArgumentParser", "object_pose_utils.datasets.point_processing.PointShifter", "scipy.io.loadmat", "featurization.PoseCNNFeaturizer", "object_pose_utils.utils.to_np", "os.path.join", "sys.path.append", "random.randint", "torch.utils.data.DataLoader", "os.path.dirname", "os.path.exists", ...
[((1797, 1822), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1820, 1822), False, 'import argparse\n'), ((783, 804), 'os.path.join', 'os.path.join', (['"""tools"""'], {}), "('tools')\n", (795, 804), False, 'import os\n'), ((846, 874), 'sys.path.append', 'sys.path.append', (['module_path'], {}...
import numpy as np from typing import Optional from fypy.volatility.implied.ImpliedVolCalculator import ImpliedVolCalculator class MarketSlice(object): def __init__(self, T: float, F: float, disc: float, strikes: np.ndarray, is_c...
[ "fypy.termstructures.EquityForward.DiscountCurve_ConstRate", "fypy.volatility.implied.ImpliedVolCalculator.ImpliedVolCalculator_Black76", "numpy.arange", "fypy.termstructures.EquityForward.EquityForward" ]
[((4016, 4037), 'numpy.arange', 'np.arange', (['(50)', '(150)', '(1)'], {}), '(50, 150, 1)\n', (4025, 4037), True, 'import numpy as np\n'), ((4118, 4152), 'fypy.termstructures.EquityForward.DiscountCurve_ConstRate', 'DiscountCurve_ConstRate', ([], {'rate': '(0.02)'}), '(rate=0.02)\n', (4141, 4152), False, 'from fypy.te...
""" @brief test log(time=2s) """ import unittest import numpy from pyquickhelper.pycode import ExtTestCase from mlinsights.sklapi.sklearn_base import SkBase from mlinsights.sklapi.sklearn_base_learner import SkBaseLearner from mlinsights.sklapi.sklearn_base_regressor import SkBaseRegressor from mlinsights.sklapi.s...
[ "unittest.main", "mlinsights.sklapi.sklearn_base.SkBase.compare_params", "mlinsights.sklapi.sklearn_base_classifier.SkBaseClassifier", "mlinsights.sklapi.sklearn_base_regressor.SkBaseRegressor", "mlinsights.sklapi.sklearn_base_learner.SkBaseLearner", "numpy.array", "mlinsights.sklapi.sklearn_base.SkBase...
[((5205, 5220), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5218, 5220), False, 'import unittest\n'), ((532, 554), 'mlinsights.sklapi.sklearn_base.SkBase', 'SkBase', ([], {'pa1': '"""r"""', 'pa2': '(2)'}), "(pa1='r', pa2=2)\n", (538, 554), False, 'from mlinsights.sklapi.sklearn_base import SkBase\n'), ((833, 8...
# Python code by <NAME> March 2021 (with input from <NAME> and <NAME>) from astropy.coordinates import EarthLocation from astropy.coordinates import get_body_barycentric_posvel, get_body_barycentric from astropy.time import Time import astropy.constants as ac import os import numpy as np import pandas as pd ...
[ "astropy.coordinates.EarthLocation.from_geodetic", "barycorrpy.utils.CalculatePositionVector", "astropy.constants.R_sun.to", "numpy.sum", "pandas.read_csv", "astropy.time.Time", "astropy.coordinates.get_body_barycentric_posvel", "numpy.cross", "barycorrpy.PINT_erfautils.gcrs_posvel_from_itrf", "nu...
[((931, 977), 'pandas.read_csv', 'pd.read_csv', (['"""../data/Sun_harpsn_qualflag.csv"""'], {}), "('../data/Sun_harpsn_qualflag.csv')\n", (942, 977), True, 'import pandas as pd\n'), ((1031, 1061), 'numpy.array', 'np.array', (["HARPSN_df['FWHMobs']"], {}), "(HARPSN_df['FWHMobs'])\n", (1039, 1061), True, 'import numpy as...
import torch import numpy as np import matplotlib.pyplot as plt from enbed.utils.scorer import RESCAL_score, DistMult_score class RESCAL: def __init__(self, num_entities, num_relations, dim, seed = 1231245): ''' Implementation of the RESCAL graph embedding model (Nickel et al., 2011). dim:...
[ "numpy.random.seed", "torch.manual_seed", "torch.nn.Embedding", "matplotlib.pyplot.close", "matplotlib.pyplot.vlines", "torch.exp", "enbed.utils.scorer.DistMult_score", "numpy.random.randint", "numpy.array", "numpy.random.random", "torch.rand", "torch.tensor" ]
[((605, 628), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (622, 628), False, 'import torch\n'), ((653, 690), 'torch.nn.Embedding', 'torch.nn.Embedding', (['num_entities', 'dim'], {}), '(num_entities, dim)\n', (671, 690), False, 'import torch\n'), ((716, 760), 'torch.nn.Embedding', 'torch.nn.Em...
""" Geosoft databases for line-oriented spatial data. :Classes: :`Geosoft_gdb`: Geosoft line database :`Line`: line handling :`Channel`: channel handling :Constants: :LINE_TYPE_NORMAL: `geosoft.gxapi.DB_LINE_TYPE_NORMAL` :LINE_TYPE_BASE: `geosoft.gxapi.DB_LINE_TYPE_BASE` :LINE_T...
[ "geosoft.gxapi.str_ref", "numpy.empty", "numpy.isnan", "os.path.isfile", "geosoft.gxapi.GXIPJ.create", "numpy.unique", "pandas.DataFrame", "os.path.abspath", "geosoft.gxapi.GXEDB.lock", "numpy.append", "numpy.apply_along_axis", "geosoft.gxpy.system.translate", "os.path.normpath", "geosoft....
[((2741, 2773), 'geosoft.gxpy.system.translate', 'geosoft.gxpy.system.translate', (['s'], {}), '(s)\n', (2770, 2773), False, 'import geosoft\n'), ((4357, 4379), 'os.path.splitext', 'os.path.splitext', (['name'], {}), '(name)\n', (4373, 4379), False, 'import os\n'), ((6038, 6053), 'geosoft.gxapi.str_ref', 'gxapi.str_ref...
import os, json import logging import numpy as np import collections import serifxml3 from serif.model.base_model import BaseModel from serif.theory.sentence import Sentence from nlplingo.decoding.decoder import Decoder, DocumentPrediction, SentencePrediction, EventPrediction, \ TriggerPrediction, ArgumentPredictio...
[ "numpy.load", "json.load", "nlplingo.decoding.decoder.Decoder", "os.path.basename", "nlplingo.annotation.ingestion.populate_doc_sentences_with_embeddings_and_annotations", "numpy.asarray", "time.time", "logging.info", "os.path.isfile", "nlplingo.text.text_theory.Document", "nlplingo.embeddings.w...
[((781, 808), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (798, 808), False, 'import logging\n'), ((3358, 3386), 'os.path.isfile', 'os.path.isfile', (['npz_filelist'], {}), '(npz_filelist)\n', (3372, 3386), False, 'import os, json\n'), ((3679, 3699), 'nlplingo.decoding.decoder.Decoder'...
def count_missingness(X): """ Count the number of missing values per column. Parameters ---------- X : array_like Matrix. Returns ------- count : ndarray Number of missing values per column. """ import dask.array as da from numpy import isnan if isinsta...
[ "dask.array.isnan", "numpy.isnan" ]
[((399, 407), 'numpy.isnan', 'isnan', (['X'], {}), '(X)\n', (404, 407), False, 'from numpy import isnan\n'), ((353, 364), 'dask.array.isnan', 'da.isnan', (['X'], {}), '(X)\n', (361, 364), True, 'import dask.array as da\n')]
import numpy as np import matplotlib.pyplot as plt def step(x): y=x>0 return y.astype(np.float) def sigmoid(x): return 1/(1+np.exp(-x)) def ReLU(x): return np.maximum(0, x) def identity(x): return x a=np.array([-0.1, 0, 0.5, 0.2]) #print(step(a)) x=np.arange(-5,5, dtype=np.float) #y=step(x) y=...
[ "numpy.maximum", "numpy.array", "numpy.exp", "numpy.arange", "numpy.dot" ]
[((226, 255), 'numpy.array', 'np.array', (['[-0.1, 0, 0.5, 0.2]'], {}), '([-0.1, 0, 0.5, 0.2])\n', (234, 255), True, 'import numpy as np\n'), ((275, 307), 'numpy.arange', 'np.arange', (['(-5)', '(5)'], {'dtype': 'np.float'}), '(-5, 5, dtype=np.float)\n', (284, 307), True, 'import numpy as np\n'), ((175, 191), 'numpy.ma...
# -*- coding: utf-8 -*- # @Time : 2022/1/12 10:10 上午 # @Author : 李炳翰 # @File : OLH.py # @Software: PyCharm import numpy as np import xxhash import random import sys class OLH_USER(object): def __init__(self, epsilon, domain, data): super(OLH_USER, self).__init__() # 隐私预算 self.epsilon = e...
[ "numpy.random.uniform", "random.randint", "numpy.exp" ]
[((510, 530), 'numpy.exp', 'np.exp', (['self.epsilon'], {}), '(self.epsilon)\n', (516, 530), True, 'import numpy as np\n'), ((905, 935), 'random.randint', 'random.randint', (['(0)', 'sys.maxsize'], {}), '(0, sys.maxsize)\n', (919, 935), False, 'import random\n'), ((1906, 1926), 'numpy.exp', 'np.exp', (['self.epsilon'],...
import os import multiprocessing import psutil import argparse from time import time, sleep import numpy as np import pandas as pd import rcsv readers_map = { 'numpy': lambda path: np.loadtxt(path, delimiter=',', dtype=np.float32), 'rcsv': lambda path: rcsv.read(path), 'panda': lambda path: pd.read_csv(...
[ "psutil.Process", "argparse.ArgumentParser", "rcsv.read", "pandas.read_csv", "time.time", "time.sleep", "numpy.loadtxt", "multiprocessing.Process" ]
[((339, 462), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simple Benchmarking tool"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Simple Benchmarking tool',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (362, 462), False, 'import ...
import datetime import json import logging import os from pprint import pprint import sys import time from indicatorcalc_redux import IndicatorCalc import numpy as np from pymarketcap import Pymarketcap import requests logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) config_p...
[ "json.dump", "pymarketcap.Pymarketcap", "json.load", "logging.basicConfig", "indicatorcalc_redux.IndicatorCalc", "time.sleep", "numpy.array", "requests.get", "sys.exit", "datetime.datetime.now", "logging.getLogger" ]
[((221, 242), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (240, 242), False, 'import logging\n'), ((252, 279), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'import logging\n'), ((501, 514), 'pymarketcap.Pymarketcap', 'Pymarketcap', ([], {}), '()\n'...
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 def open_image(fname, convert_to_rgb=False): im = cv2.imread(fname) if len(im.shape) == 2: return im if not convert_to_rgb: return im return cv2.cvtColor(im, cv2.COLOR_BGR2RGB) def open_...
[ "cv2.GaussianBlur", "numpy.abs", "numpy.sum", "cv2.bitwise_and", "numpy.polyfit", "numpy.argmax", "cv2.fillPoly", "matplotlib.pyplot.figure", "numpy.arange", "cv2.undistort", "cv2.line", "cv2.warpPerspective", "numpy.zeros_like", "cv2.cvtColor", "matplotlib.pyplot.imshow", "numpy.max",...
[((151, 168), 'cv2.imread', 'cv2.imread', (['fname'], {}), '(fname)\n', (161, 168), False, 'import cv2\n'), ((273, 308), 'cv2.cvtColor', 'cv2.cvtColor', (['im', 'cv2.COLOR_BGR2RGB'], {}), '(im, cv2.COLOR_BGR2RGB)\n', (285, 308), False, 'import cv2\n'), ((433, 458), 'cv2.undistort', 'cv2.undistort', (['im', 'cm', 'dc'],...
from hrm import readCSV, getBeats, getMeanHR, getDuration, hrd import pytest import numpy @pytest.mark.parametrize("testinput,expected", [ ('test_data31.csv', {"voltage_extremes": (1.0, 1.0), "duration": 1.0, "beats": numpy.array([]), "num_beats": 1.0, "mean_hr_bp...
[ "hrm.getDuration", "numpy.array", "hrm.readCSV" ]
[((755, 773), 'hrm.readCSV', 'readCSV', (['testinput'], {}), '(testinput)\n', (762, 773), False, 'from hrm import readCSV, getBeats, getMeanHR, getDuration, hrd\n'), ((803, 817), 'hrm.getDuration', 'getDuration', (['t'], {}), '(t)\n', (814, 817), False, 'from hrm import readCSV, getBeats, getMeanHR, getDuration, hrd\n'...
import numpy as np from lbdapy import ProblemData from lbdapy.lib.lbdapy.cutfamilies import LooseBenders as _LooseBenders from .CutFamily import CutFamily class LooseBenders(CutFamily): def __init__(self, problem: ProblemData, alpha: np.array, time_limit: float...
[ "numpy.asarray" ]
[((375, 392), 'numpy.asarray', 'np.asarray', (['alpha'], {}), '(alpha)\n', (385, 392), True, 'import numpy as np\n')]
# Copyright 2018 BLEMUNDSBURY AI LIMITED # # 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 ...
[ "json.dump", "tqdm.tqdm", "pickle.dump", "argparse.ArgumentParser", "os.makedirs", "docqa.squad.build_squad_dataset.parse_squad_data", "docqa.data_processing.text_utils.NltkAndPunctTokenizer", "os.path.exists", "docqa.triviaqa.read_data.TagMeEntityDoc", "docqa.triviaqa.read_data.TriviaQaQuestion",...
[((1124, 1162), 'os.path.join', 'join', (['PREPRO_DATASET_DIR', 'dataset_name'], {}), '(PREPRO_DATASET_DIR, dataset_name)\n', (1128, 1162), False, 'from os.path import join, exists\n'), ((1620, 1667), 'numpy.unique', 'np.unique', (['question.answer.answer_spans'], {'axis': '(0)'}), '(question.answer.answer_spans, axis=...
import copy import os import enum import random import traceback from abc import ABC from typing import Any, Tuple, Optional, Dict, Sequence, List, Union, cast, Set import compress_pickle import gym.spaces import numpy as np import stringcase from allenact.base_abstractions.misc import RLStepResult from allenact.base...
[ "copy.deepcopy", "env.utils.include_object_data", "allenact.utils.system.get_logger", "env.environment.HomeServiceSimpleTaskOrderTaskSpec", "compress_pickle.load", "random.randint", "allenact_plugins.ithor_plugin.ithor_util.round_to_factor", "env.environment.HomeServiceTHOREnvironment", "random.Rand...
[((36121, 36145), 'random.Random', 'random.Random', (['self.seed'], {}), '(self.seed)\n', (36134, 36145), False, 'import random\n'), ((40286, 40329), 'copy.deepcopy', 'copy.deepcopy', (['task_keys_to_task_spec_dicts'], {}), '(task_keys_to_task_spec_dicts)\n', (40299, 40329), False, 'import copy\n'), ((41111, 41164), 'e...
# -*- coding: utf-8 -*- import os import tempfile from argparse import ArgumentParser import numpy as np from cytomine import Cytomine from cytomine_utilities import CytomineJob from sldc import StandardOutputLogger, Logger from cell_counting.cytomine_utils import get_dataset from cell_counting.utils import make_dirs...
[ "cell_counting.utils.params_remove_list", "argparse.ArgumentParser", "cell_counting.utils.make_dirs", "numpy.asarray", "cytomine.Cytomine", "tempfile.gettempdir", "cell_counting.utils.check_default", "cell_counting.cytomine_utils.get_dataset", "cell_counting.utils.check_max_features", "sldc.Standa...
[((551, 614), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'prog': '"""Extra-Trees Object Counter Model Builder"""'}), "(prog='Extra-Trees Object Counter Model Builder')\n", (565, 614), False, 'from argparse import ArgumentParser\n'), ((6881, 6920), 'cell_counting.utils.make_dirs', 'make_dirs', (['params.cytomine...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2019 by <NAME> # Generates surrogate data for non-lynear analysis # # Uses algorithm from <NAME>., & <NAME>. (1996). # Improved surrogate data for nonlinearity tests. Physical Review Letters, 77(4), 635. import numpy as np import scipy.special import cm...
[ "numpy.sort", "mfdfa.mfdfa", "fgnoise.fgnoise", "mfdfa.create_logscale" ]
[((505, 515), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (512, 515), True, 'import numpy as np\n'), ((528, 559), 'mfdfa.create_logscale', 'create_logscale', (['(10)', '(n / 4)', '(100)'], {}), '(10, n / 4, 100)\n', (543, 559), False, 'from mfdfa import mfdfa, get_hurst, create_logscale\n'), ((625, 639), 'fgnoise.fg...
import os import logging logger = logging.getLogger(__name__) import numpy as np import astropy.io.fits as fits from ...echelle.imageproc import combine_images from ..common import load_obslog, load_config from .common import parse_image def reduce_rawdata(): """Reduce the Subaru/HDS spectra. """ # read ...
[ "astropy.io.fits.ImageHDU", "os.mkdir", "astropy.io.fits.getdata", "astropy.io.fits.PrimaryHDU", "os.path.exists", "os.cpu_count", "astropy.io.fits.Header", "numpy.array", "astropy.io.fits.HDUList", "os.path.join", "logging.getLogger" ]
[((34, 61), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (51, 61), False, 'import logging\n'), ((916, 939), 'os.path.exists', 'os.path.exists', (['figpath'], {}), '(figpath)\n', (930, 939), False, 'import os\n'), ((941, 958), 'os.mkdir', 'os.mkdir', (['figpath'], {}), '(figpath)\n', (94...
import numpy as np __all__ = ['default_version', 'known_versions', 'e_2_convention', 'default_column_keys', 'tomographic_redshift_bin', 'multiplicative_shear_bias'] default_version = 'DR4' known_versions = ['DR3', 'KV450', 'DR4'] e_2_convention = 'standard' def default_column_keys(version=defa...
[ "numpy.digitize", "numpy.where", "numpy.array" ]
[((1940, 1987), 'numpy.where', 'np.where', (['((z_s < 0.1) | (z_s >= 1.2))', '(-1)', 'z_bin'], {}), '((z_s < 0.1) | (z_s >= 1.2), -1, z_bin)\n', (1948, 1987), True, 'import numpy as np\n'), ((1875, 1923), 'numpy.digitize', 'np.digitize', (['z_s', '[0.1, 0.3, 0.5, 0.7, 0.9, 1.2]'], {}), '(z_s, [0.1, 0.3, 0.5, 0.7, 0.9, ...
from io import StringIO import math import statistics import geoglows import numpy as np import pandas as pd import plotly.graph_objects as go import requests from scipy import interpolate from scipy import stats import hydrostats as hs import hydrostats.data as hd def collect_data(start_id, start_ideam_id, downstre...
[ "numpy.nanpercentile", "pandas.read_csv", "geoglows.streamflow.historic_simulation", "numpy.mean", "scipy.stats.percentileofscore", "scipy.interpolate.interp1d", "pandas.DataFrame", "pandas.merge", "numpy.transpose", "hydrostats.data.merge_data", "numpy.max", "requests.get", "math.log", "s...
[((12342, 12384), 'pandas.read_csv', 'pd.read_csv', (['"""start_flow.csv"""'], {'index_col': '(0)'}), "('start_flow.csv', index_col=0)\n", (12353, 12384), True, 'import pandas as pd\n'), ((12404, 12452), 'pandas.read_csv', 'pd.read_csv', (['"""start_ideam_flow.csv"""'], {'index_col': '(0)'}), "('start_ideam_flow.csv', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ General utility and helper functions. """ # ============================================================================= # IMPORTS AND DEPENDENCIES # ============================================================================= import os import pickle import rand...
[ "sklearn.datasets.load_iris", "os.mkdir", "pickle.dump", "random.sample", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.MinMaxScaler", "torchvision.datasets.CIFAR10", "numpy.shape", "pickle.load", "torchvision.transforms.Normalize", "matplotlib.colors.ListedColormap", "dat...
[((1547, 1561), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1559, 1561), False, 'from datetime import datetime\n'), ((7257, 7268), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (7266, 7268), False, 'from sklearn.datasets import load_iris\n'), ((7369, 7384), 'sklearn.preprocessing.OneHotEn...
import torch.nn as nn import torch import numpy as np import pytest from test.utils import convert_and_test class FNormTest(nn.Module): """ Test for nn.functional types """ def __init__(self, dim, keepdim): super(FNormTest, self).__init__() self.dim = dim self.keepdim = keepd...
[ "numpy.random.uniform", "pytest.mark.repeat", "torch.norm", "test.utils.convert_and_test", "pytest.mark.parametrize" ]
[((528, 550), 'pytest.mark.repeat', 'pytest.mark.repeat', (['(10)'], {}), '(10)\n', (546, 550), False, 'import pytest\n'), ((552, 609), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""change_ordering"""', '[True, False]'], {}), "('change_ordering', [True, False])\n", (575, 609), False, 'import pytest\n'), (...
## """ Augmented Reality Drumset Main Script """ ## Imports import cv2 import numpy as np import time import pyaudio import wave from array import array from struct import pack import os import threading ## DRUMSOUNDSFOLDER = "drumFiles" ## Playing Drum Sounds #threads the play function def drumThreadCreator(fil...
[ "cv2.GaussianBlur", "cv2.bitwise_and", "numpy.ones", "cv2.adaptiveThreshold", "cv2.erode", "cv2.imshow", "cv2.inRange", "cv2.dilate", "cv2.cvtColor", "cv2.destroyAllWindows", "cv2.resize", "threading.Thread", "cv2.circle", "cv2.minEnclosingCircle", "cv2.waitKey", "time.sleep", "cv2.f...
[((341, 384), 'threading.Thread', 'threading.Thread', ([], {'target': 'play', 'args': '(file,)'}), '(target=play, args=(file,))\n', (357, 384), False, 'import threading\n'), ((511, 532), 'wave.open', 'wave.open', (['file', '"""rb"""'], {}), "(file, 'rb')\n", (520, 532), False, 'import wave\n'), ((542, 559), 'pyaudio.Py...
import pandas as pd import numpy as np import sklearn.metrics as metrics import matplotlib.pyplot as plt import seaborn as sns from mlflow import log_artifact sns.set() # Confusion matrix def plot_cm(target_all, predictions_all , path= "data/08_reporting/confusion_matrix.png", show= False): data_cm = m...
[ "matplotlib.pyplot.tight_layout", "seaborn.heatmap", "matplotlib.pyplot.show", "numpy.unique", "mlflow.log_artifact", "matplotlib.pyplot.figure", "sklearn.metrics.confusion_matrix", "seaborn.set", "matplotlib.pyplot.savefig" ]
[((159, 168), 'seaborn.set', 'sns.set', ([], {}), '()\n', (166, 168), True, 'import seaborn as sns\n'), ((319, 372), 'sklearn.metrics.confusion_matrix', 'metrics.confusion_matrix', (['target_all', 'predictions_all'], {}), '(target_all, predictions_all)\n', (343, 372), True, 'import sklearn.metrics as metrics\n'), ((708...
import numpy from astropy.constants import c, G, M_sun, R_sun, au, L_sun, pc from astropy import units as u from math import pi, sqrt, exp, log, log2 from scipy.special import j0, j1 # Bessel function from scipy.optimize import minimize r_g_sun = ((2 * G * M_sun) / (c**2)) / u.meter # [m] Schwarzschild radi...
[ "scipy.optimize.minimize", "numpy.arctanh", "numpy.abs", "math.exp", "math.sqrt", "numpy.deg2rad", "numpy.sin", "numpy.exp", "numpy.cos", "numpy.arctan", "math.log2", "numpy.sqrt" ]
[((7774, 7792), 'numpy.deg2rad', 'numpy.deg2rad', (['phi'], {}), '(phi)\n', (7787, 7792), False, 'import numpy\n'), ((10288, 10305), 'numpy.abs', 'numpy.abs', (['par[0]'], {}), '(par[0])\n', (10297, 10305), False, 'import numpy\n'), ((10756, 10775), 'numpy.deg2rad', 'numpy.deg2rad', (['phiq'], {}), '(phiq)\n', (10769, ...
from typing import List, NoReturn, Union, Dict import numpy as np from more_itertools import chunked from config import DATA_DIR class Bingo: """Bingo Solver""" def __init__(self, numbers: List[int], boards: List[np.ndarray]): """ Parameters ---------- numbers: List[int] ...
[ "numpy.asarray", "config.DATA_DIR.joinpath", "more_itertools.chunked" ]
[((4889, 4918), 'config.DATA_DIR.joinpath', 'DATA_DIR.joinpath', (['"""day4.txt"""'], {}), "('day4.txt')\n", (4906, 4918), False, 'from config import DATA_DIR\n'), ((5076, 5099), 'more_itertools.chunked', 'chunked', (['lines[1:]'], {'n': '(6)'}), '(lines[1:], n=6)\n', (5083, 5099), False, 'from more_itertools import ch...
# Created by Pro-Machina # This is an implementation of Particle Swarm Optimisation algorithm for the function: # Maximize: f(x) = 1 - (x^2) + 2x # Matrices are classified into position and fitness matrices, majorly only position matrices are used import numpy as np import random # Paramenters are taken as w = 0.7 # ...
[ "numpy.shape", "numpy.zeros", "numpy.ndim", "random.uniform" ]
[((4779, 4799), 'numpy.zeros', 'np.zeros', (['(n_var, 2)'], {}), '((n_var, 2))\n', (4787, 4799), True, 'import numpy as np\n'), ((5043, 5072), 'numpy.zeros', 'np.zeros', (['(swarm_size, n_var)'], {}), '((swarm_size, n_var))\n', (5051, 5072), True, 'import numpy as np\n'), ((5283, 5312), 'numpy.zeros', 'np.zeros', (['(s...
from styx_msgs.msg import TrafficLight import rospy import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf import zipfile from collections import defaultdict from io import StringIO from PIL import Image class TLClassifier(object): def __init__(self): ...
[ "tensorflow.GraphDef", "tensorflow.Session", "numpy.expand_dims", "tensorflow.gfile.GFile", "tensorflow.Graph", "tensorflow.import_graph_def" ]
[((477, 487), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (485, 487), True, 'import tensorflow as tf\n'), ((561, 574), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (572, 574), True, 'import tensorflow as tf\n'), ((590, 624), 'tensorflow.gfile.GFile', 'tf.gfile.GFile', (['PATH_TO_CKPT', '"""rb"""'], {})...
# Copyright (c) Fairlearn contributors. # Licensed under the MIT License. """ ================================================= MetricFrame: más allá de la clasificación binaria ================================================= """ # %% # Este notebook contiene ejemplos de uso :class:`~ fairlearn.metrics.MetricFrame`...
[ "functools.partial", "numpy.unique", "fairlearn.metrics.MetricFrame", "numpy.random.default_rng", "numpy.mean", "numpy.array", "numpy.concatenate" ]
[((1019, 1052), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': '(96132)'}), '(seed=96132)\n', (1040, 1052), True, 'import numpy as np\n'), ((1742, 1843), 'fairlearn.metrics.MetricFrame', 'MetricFrame', ([], {'metrics': "{'conf_mat': conf_mat}", 'y_true': 'y_true', 'y_pred': 'y_pred', 'sensitive_feat...
import torch import torch.nn as nn import numpy as np from typing import Iterable, Dict import rlkit.torch.pytorch_util as ptu from rlkit.torch.networks import FlattenMlp from self_supervised.env_wrapper.rlkit_wrapper import NormalizedBoxEnvWrapper from self_supervised.policy.skill_policy import SkillTanhGaussianPoli...
[ "rlkit.torch.pytorch_util.soft_update_from_to", "rlkit.torch.pytorch_util.zeros", "torch.nn.MSELoss", "torch.cat", "self_supervised.utils.conversion.from_numpy", "self_supervised.loss.loss_intrin_selfsup.reconstruction_based_rewards", "self_supervised.utils.typed_dicts.ForwardReturnMapping", "numpy.pr...
[((2404, 2416), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2414, 2416), True, 'import torch.nn as nn\n'), ((3375, 3512), 'self_supervised.loss.loss_intrin_selfsup.reconstruction_based_rewards', 'reconstruction_based_rewards', ([], {'mode_latent_model': 'self.mode_latent_model', 'obs_seq': 'data.obs', 'action_...
from __future__ import print_function import os import cv2 from skimage.transform import resize from skimage.io import imsave import numpy as np from keras.models import Model from keras.layers import Input, concatenate, Conv2D, MaxPooling2D, UpSampling2D from keras.optimizers import Adam from keras.callbacks import M...
[ "os.mkdir", "numpy.load", "data.load_test_data", "os.path.exists" ]
[((463, 479), 'data.load_test_data', 'load_test_data', ([], {}), '()\n', (477, 479), False, 'from data import load_train_data, load_test_data\n'), ((498, 527), 'numpy.load', 'np.load', (['"""imgs_mask_test.npy"""'], {}), "('imgs_mask_test.npy')\n", (505, 527), True, 'import numpy as np\n'), ((636, 660), 'os.path.exists...
# coding: utf-8 """ Abinit Task classes for Fireworks. """ import inspect import subprocess import logging import time import shutil import json import threading import glob import os import errno import numpy as np import abipy.abio.input_tags as atags from collections import namedtuple, defaultdict from monty.json i...
[ "abipy.electrons.gsr.GsrFile", "os.remove", "abipy.dfpt.anaddbnc.AnaddbNcFile", "abipy.flowtk.netcdf.NetcdfReader", "numpy.allclose", "abipy.flowtk.utils.Directory", "collections.defaultdict", "logging.Formatter", "os.path.isfile", "os.path.islink", "glob.glob", "shutil.rmtree", "abipy.abio....
[((1887, 1914), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1904, 1914), False, 'import logging\n'), ((13976, 14017), 'collections.namedtuple', 'namedtuple', (['"""Prefix"""', '"""idata odata tdata"""'], {}), "('Prefix', 'idata odata tdata')\n", (13986, 14017), False, 'from collection...
import numpy as np from scipy.optimize import fmin def coexistence(lnpi, N): """Locate the coexistence acticity near the critical point by maximizing compressibility. Args: lnpi: The original log of probability distribution. N: particle number distribution. ...
[ "numpy.abs", "numpy.sum", "numpy.exp", "numpy.loadtxt", "numpy.linspace", "numpy.dot" ]
[((1378, 1440), 'numpy.loadtxt', 'np.loadtxt', (["(path + '/lnpi_op.dat')"], {'usecols': '(0, 1)', 'unpack': '(True)'}), "(path + '/lnpi_op.dat', usecols=(0, 1), unpack=True)\n", (1388, 1440), True, 'import numpy as np\n'), ((1510, 1540), 'numpy.loadtxt', 'np.loadtxt', (["(path + '/elim.dat')"], {}), "(path + '/elim.da...
from __future__ import absolute_import import numpy as np import unittest from matplotlib import pyplot pyplot.switch_backend('template') from ... import Graph from .. import mountain_car as mcar class TestMountainCar(unittest.TestCase): def test_traj_sampling(self): traj, traces = mcar.mountain_car_trajector...
[ "matplotlib.pyplot.switch_backend", "unittest.main", "numpy.random.random" ]
[((104, 137), 'matplotlib.pyplot.switch_backend', 'pyplot.switch_backend', (['"""template"""'], {}), "('template')\n", (125, 137), False, 'from matplotlib import pyplot\n'), ((713, 728), 'unittest.main', 'unittest.main', ([], {}), '()\n', (726, 728), False, 'import unittest\n'), ((569, 593), 'numpy.random.random', 'np....
import numpy as np from skimage.transform import downscale_local_mean, rescale from fibercnn.modeling.spline import calculate_length, interpolation, to_mask def _calculate_point_distances(As, Bs): return np.sqrt(np.sum((As - Bs) ** 2, axis=1)) def _calculate_segment_lengths(keypoints): lengths = _calculate...
[ "fibercnn.modeling.spline.to_mask", "numpy.sum", "numpy.logical_and", "numpy.argmax", "fibercnn.modeling.spline.calculate_length", "numpy.any", "skimage.transform.downscale_local_mean", "numpy.argsort", "numpy.where", "numpy.array", "numpy.logical_or", "fibercnn.modeling.spline.interpolation",...
[((1623, 1643), 'numpy.any', 'np.any', (['mask'], {'axis': '(1)'}), '(mask, axis=1)\n', (1629, 1643), True, 'import numpy as np\n'), ((1655, 1675), 'numpy.any', 'np.any', (['mask'], {'axis': '(0)'}), '(mask, axis=0)\n', (1661, 1675), True, 'import numpy as np\n'), ((4487, 4515), 'numpy.array', 'np.array', (['potential_...
import numpy as np import datetime from dateutil.relativedelta import relativedelta def add_scenarios(df): assert "co2_kt_total" in df.columns assert "trend_const_kt" in df.columns assert "trend_lin_kt" in df.columns df["scenario_trendlin_kt"] = df["co2_kt_total"].fillna(df["trend_lin_kt"]) df["...
[ "datetime.datetime.strptime", "datetime.datetime.now", "numpy.isnan" ]
[((970, 1002), 'numpy.isnan', 'np.isnan', (['first_y_when_data_is_0'], {}), '(first_y_when_data_is_0)\n', (978, 1002), True, 'import numpy as np\n'), ((1631, 1654), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1652, 1654), False, 'import datetime\n'), ((1785, 1863), 'datetime.datetime.strptime',...
import pandas as pd import os import numpy as np import csv import re from kmeans import kmeans, avg_iou csv_path = r'G:\Deep_Learning\kaggle\global-wheat-detection\dataset\train.csv' CLUSTERS = 9 df = pd.read_csv(csv_path) def process_bbox(df): ids = [] values = [] imd = np.unique(df['image...
[ "kmeans.kmeans", "pandas.read_csv", "kmeans.avg_iou", "numpy.around", "numpy.array", "numpy.unique" ]
[((214, 235), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (225, 235), True, 'import pandas as pd\n'), ((1251, 1264), 'numpy.array', 'np.array', (['w_h'], {}), '(w_h)\n', (1259, 1264), True, 'import numpy as np\n'), ((1272, 1296), 'kmeans.kmeans', 'kmeans', (['data'], {'k': 'CLUSTERS'}), '(data...
import numpy as np import torch from network.vggish import Postprocessor, VGGish def tensor_mapper(pre_trained: np.array) -> torch.Tensor: """ Transpose the tensor depending on whether it is and FC or CN layer to match dimensions with Pytorch implementation. """ if len(pre_trained.shape) == 4: ...
[ "torch.nn.Parameter", "numpy.matmul", "torch.from_numpy" ]
[((422, 453), 'torch.from_numpy', 'torch.from_numpy', (['pre_trained.T'], {}), '(pre_trained.T)\n', (438, 453), False, 'import torch\n'), ((1209, 1256), 'torch.nn.Parameter', 'torch.nn.Parameter', (['tensor'], {'requires_grad': '(False)'}), '(tensor, requires_grad=False)\n', (1227, 1256), False, 'import torch\n'), ((12...
from collections import namedtuple from io import BytesIO import math import pkgutil from typing import Tuple from PIL import Image, ImageOps, ImageEnhance from cv2.data import haarcascades import cv2 import os import numpy __all__ = ('Colour', 'ColourTuple', 'DefaultColours', 'deepfry') Colour = Tuple[int, int, int...
[ "pkgutil.get_data", "PIL.ImageEnhance.Brightness", "os.getcwd", "PIL.ImageEnhance.Contrast", "math.floor", "PIL.ImageEnhance.Sharpness", "PIL.ImageOps.colorize", "collections.namedtuple", "numpy.array", "PIL.Image.blend", "PIL.ImageOps.posterize" ]
[((831, 878), 'collections.namedtuple', 'namedtuple', (['"""FlarePosition"""', "['x', 'y', 'size']"], {}), "('FlarePosition', ['x', 'y', 'size'])\n", (841, 878), False, 'from collections import namedtuple\n'), ((2668, 2694), 'PIL.ImageOps.posterize', 'ImageOps.posterize', (['img', '(4)'], {}), '(img, 4)\n', (2686, 2694...
import logging import numpy as np import torch from torch import nn from algorithm.nets import PolicyNet from algorithm.policies import Policy logger = logging.getLogger(__name__) class ClfPolicy(Policy): def rollout(self, placeholder, data, config): assert self.policy_net is not None, 'Set model fir...
[ "torch.nn.CrossEntropyLoss", "numpy.mean", "torch.cuda.is_available", "torch.empty_like", "torch.set_grad_enabled", "logging.getLogger" ]
[((156, 183), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (173, 183), False, 'import logging\n'), ((424, 453), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (446, 453), False, 'import torch\n'), ((1007, 1028), 'torch.nn.CrossEntropyLoss', 'nn.Cross...
from datetime import datetime, timedelta from scipy import stats import pandas as pd import math import numpy as np def create_sharpe_ratio(returns, periods=252, rf=0): ''' Create Sharpe ratio for the strategy, based on a benchmark of zero (i.e. no risk-free rate information). :param returns: A pandas S...
[ "math.exp", "math.sqrt", "numpy.std", "scipy.stats.norm.cdf", "numpy.mean", "pandas.Series", "numpy.sqrt" ]
[((987, 1007), 'pandas.Series', 'pd.Series', ([], {'index': 'idx'}), '(index=idx)\n', (996, 1007), True, 'import pandas as pd\n'), ((1023, 1043), 'pandas.Series', 'pd.Series', ([], {'index': 'idx'}), '(index=idx)\n', (1032, 1043), True, 'import pandas as pd\n'), ((523, 553), 'numpy.std', 'np.std', (['(returns - rf / pe...
# -*- coding: utf-8 -*- import scipy.stats as ss import numpy.random as npr from functools import partial from . import core def npr_op(distribution, size, input): prng = npr.RandomState(0) prng.set_state(input['random_state']) distribution = getattr(prng, distribution) size = (input['n'],)+tuple(siz...
[ "functools.partial", "numpy.random.RandomState" ]
[((178, 196), 'numpy.random.RandomState', 'npr.RandomState', (['(0)'], {}), '(0)\n', (193, 196), True, 'import numpy.random as npr\n'), ((737, 772), 'functools.partial', 'partial', (['npr_op', 'distribution', 'size'], {}), '(npr_op, distribution, size)\n', (744, 772), False, 'from functools import partial\n')]
import os import time import numpy as np """ From http://wiki.scipy.org/Cookbook/SegmentAxis """ def segment_axis(a, length, overlap=0, axis=None, end='cut', endvalue=0): """Generate a new array that chops the given array along the given axis into overlapping frames. example: >>> segment_axis(np.arange...
[ "os.makedirs", "numpy.ravel", "numpy.empty", "numpy.ndarray.__new__", "time.time" ]
[((1195, 1206), 'numpy.ravel', 'np.ravel', (['a'], {}), '(a)\n', (1203, 1206), True, 'import numpy as np\n'), ((3244, 3339), 'numpy.ndarray.__new__', 'np.ndarray.__new__', (['np.ndarray'], {'strides': 'newstrides', 'shape': 'newshape', 'buffer': 'a', 'dtype': 'a.dtype'}), '(np.ndarray, strides=newstrides, shape=newshap...
#!/usr/bin/env python # -*- coding: utf-8 -*- import networkx as nx import numpy as np import os import re import subprocess from scipy.spatial.distance import pdist from networkx.drawing.nx_pydot import write_dot from scipy.sparse.csgraph import shortest_path from sklearn.neighbors import BallTree def shortest_path...
[ "numpy.divide", "subprocess.Popen", "os.remove", "re.split", "networkx.set_node_attributes", "os.path.exists", "networkx.single_source_shortest_path_length", "numpy.hstack", "os.path.isfile", "sklearn.neighbors.BallTree", "scipy.spatial.distance.pdist", "networkx.drawing.nx_pydot.write_dot", ...
[((823, 853), 'scipy.spatial.distance.pdist', 'pdist', (['emb'], {'metric': '"""euclidean"""'}), "(emb, metric='euclidean')\n", (828, 853), False, 'from scipy.spatial.distance import pdist\n'), ((3228, 3255), 'sklearn.neighbors.BallTree', 'BallTree', (['emb'], {'leaf_size': '(40)'}), '(emb, leaf_size=40)\n', (3236, 325...
import matplotlib.pyplot as plt import pandas as pd import numpy as np def lithotrack(df:pd.DataFrame, codecols:list, percols:list, dtick:bool=False, lims:list=None, codedict: dict=None, fontsize=8, ax=None, ...
[ "pandas.DataFrame", "pandas.get_dummies", "numpy.cumsum", "numpy.arange", "numpy.linspace", "matplotlib.pyplot.gca", "pandas.concat" ]
[((1691, 1705), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1703, 1705), True, 'import pandas as pd\n'), ((1939, 1953), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1951, 1953), True, 'import pandas as pd\n'), ((2188, 2209), 'numpy.cumsum', 'np.cumsum', (['lm'], {'axis': '(1)'}), '(lm, axis=1)\n', ...
import matplotlib import matplotlib.pyplot as plt from matplotlib import patches, lines from matplotlib.patches import Polygon from skimage import io, color import numpy as np import sqlite3 import datetime import json import cv2 from mrcnn import visualize, utils image_path = "./images/" #image = io.imread(image_pa...
[ "cv2.circle", "matplotlib.pyplot.show", "json.loads", "numpy.zeros_like", "matplotlib.patches.Rectangle", "numpy.asarray", "numpy.ones", "numpy.any", "numpy.where", "sqlite3.connect", "mrcnn.visualize.random_colors", "matplotlib.pyplot.subplots", "skimage.io.imread" ]
[((539, 579), 'sqlite3.connect', 'sqlite3.connect', (['"""./results/filament.db"""'], {}), "('./results/filament.db')\n", (554, 579), False, 'import sqlite3\n'), ((720, 750), 'skimage.io.imread', 'io.imread', (['(image_path + row[0])'], {}), '(image_path + row[0])\n', (729, 750), False, 'from skimage import io, color\n...
# -*- coding: utf-8 -*- """ Created on Wed Sep 23 11:14:55 2020 @author: ST16 """ import matplotlib.pyplot as plt import numpy as np normal_samples = np.random.normal(size = 100000) # 生成 100000 組標準常態分配(平均值為 0,標準差為 1 的常態分配)隨機變數 uniform_samples = np.random.uniform(size = 100000) # 生成 100000 組介於 0 與 1 之間均勻分配隨機變數 plt.h...
[ "numpy.random.uniform", "matplotlib.pyplot.hist", "matplotlib.pyplot.show", "numpy.random.normal" ]
[((153, 182), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(100000)'}), '(size=100000)\n', (169, 182), True, 'import numpy as np\n'), ((248, 278), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(100000)'}), '(size=100000)\n', (265, 278), True, 'import numpy as np\n'), ((315, 339), 'matplotlib....
import torch from torch.utils.data import Dataset from torch.utils.data import DataLoader import os import numpy as np def unpickle(file): import pickle with open(file, 'rb') as fo: dict = pickle.load(fo, encoding='bytes') return dict[b'data'].reshape((-1, 3, 32, 32)).astype(np.float64), dict[b'la...
[ "pickle.load", "os.path.join", "numpy.concatenate", "torch.utils.data.DataLoader" ]
[((1849, 1912), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(2)', 'shuffle': '(False)', 'num_workers': '(1)'}), '(dataset, batch_size=2, shuffle=False, num_workers=1)\n', (1859, 1912), False, 'from torch.utils.data import DataLoader\n'), ((207, 240), 'pickle.load', 'pickle.load', (['fo'],...
import numpy as np from predicu.data import CUM_COLUMNS from predicu.preprocessing import preprocess_bedcounts from predicu.tests.utils import load_test_data def test_bedcounts_data_preprocessing(): test_data = load_test_data() preprocessed = preprocess_bedcounts(test_data["bedcounts"]) assert len(prepro...
[ "predicu.tests.utils.load_test_data", "numpy.all", "predicu.preprocessing.preprocess_bedcounts" ]
[((218, 234), 'predicu.tests.utils.load_test_data', 'load_test_data', ([], {}), '()\n', (232, 234), False, 'from predicu.tests.utils import load_test_data\n'), ((254, 298), 'predicu.preprocessing.preprocess_bedcounts', 'preprocess_bedcounts', (["test_data['bedcounts']"], {}), "(test_data['bedcounts'])\n", (274, 298), F...
# # Author: <NAME> # Copyright 2016 # import os import isceobj import logging import numpy as np from imageMath import IML def runCropOffsetGeo(self): ''' Crops and resamples lat/lon/los/z images created by topsApp to the same grid as the offset field image. ''' print('\n==========================...
[ "numpy.array", "isceobj.createImage", "os.path.join", "imageMath.IML.mmapFromISCE" ]
[((913, 962), 'os.path.join', 'os.path.join', (['self._insar.mergedDirname', 'filename'], {}), '(self._insar.mergedDirname, filename)\n', (925, 962), False, 'import os\n'), ((998, 1026), 'imageMath.IML.mmapFromISCE', 'IML.mmapFromISCE', (['f', 'logging'], {}), '(f, logging)\n', (1014, 1026), False, 'from imageMath impo...
import argparse import os import numpy as np import torch from torch import nn from hparams import HParam from lpcnet_bunched import MDense, LPCNetModelBunch max_rnn_neurons = 1 max_conv_inputs = 1 max_mdense_tmp = 1 def pk_convert_input_kernel(kernel): kernel_r, kernel_z, kernel_h = np.vsplit(kernel, 3) k...
[ "numpy.diag", "numpy.vsplit", "numpy.abs", "numpy.concatenate", "argparse.ArgumentParser", "torch.load", "numpy.zeros", "os.path.exists", "numpy.hsplit", "numpy.hstack", "numpy.transpose", "numpy.append", "os.path.isfile", "numpy.reshape", "hparams.HParam", "numpy.dot", "lpcnet_bunch...
[((294, 314), 'numpy.vsplit', 'np.vsplit', (['kernel', '(3)'], {}), '(kernel, 3)\n', (303, 314), True, 'import numpy as np\n'), ((377, 395), 'numpy.hstack', 'np.hstack', (['kernels'], {}), '(kernels)\n', (386, 395), True, 'import numpy as np\n'), ((473, 493), 'numpy.vsplit', 'np.vsplit', (['kernel', '(3)'], {}), '(kern...
from numba import cuda import cu_utils.transform as cutr import numpy as np SIZE = 128 np.random.seed(0) def test_cu_mean_transform(): arr = np.random.rand(SIZE) res = np.zeros(SIZE) cuda.jit(cutr.cu_mean_transform)(arr, res) np.testing.assert_almost_equal(res, np.mean(arr)) np.testing.assert_e...
[ "cu_utils.transform.get_cu_shift_transform", "numpy.random.seed", "numpy.roll", "cu_utils.transform.get_cu_rolling_mean_transform", "numpy.zeros", "numpy.min", "numpy.mean", "numpy.max", "cu_utils.transform.get_cu_rolling_min_transform", "numba.cuda.jit", "numpy.testing.assert_equal", "numpy.r...
[((88, 105), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (102, 105), True, 'import numpy as np\n'), ((148, 168), 'numpy.random.rand', 'np.random.rand', (['SIZE'], {}), '(SIZE)\n', (162, 168), True, 'import numpy as np\n'), ((179, 193), 'numpy.zeros', 'np.zeros', (['SIZE'], {}), '(SIZE)\n', (187, 193)...
""" Script to call different plots and illustrative methods - specifically tailored for the paper Author: <NAME> Version: 0.1 Date 21.12.2021 """ import numpy as np import pandas as pd from utils import load_density_function, scatter_plot_2d_N2, scatter_plot_3d, scatter_plot_2d def paper_illustrations(): # ---- ...
[ "numpy.load", "numpy.zeros" ]
[((359, 386), 'numpy.load', 'np.load', (['"""data/sod1D/X.npy"""'], {}), "('data/sod1D/X.npy')\n", (366, 386), True, 'import numpy as np\n'), ((399, 426), 'numpy.load', 'np.load', (['"""data/sod1D/Y.npy"""'], {}), "('data/sod1D/Y.npy')\n", (406, 426), True, 'import numpy as np\n'), ((439, 466), 'numpy.load', 'np.load',...
import numpy as np #np.set_printoptions(precision=2) import pandas as pd from typing import Any, Dict, List, Tuple, NoReturn import argparse import os import pickle import json from sklearn.mixture import BayesianGaussianMixture def parse_arguments() -> Any: """Parse command line arguments.""" parser = argparse...
[ "pandas.DataFrame", "json.dump", "pickle.dump", "argparse.ArgumentParser", "numpy.unique", "os.path.exists", "numpy.expand_dims", "pickle.load", "sklearn.mixture.BayesianGaussianMixture", "os.path.join", "numpy.concatenate" ]
[((312, 337), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (335, 337), False, 'import argparse\n'), ((1457, 1657), 'sklearn.mixture.BayesianGaussianMixture', 'BayesianGaussianMixture', ([], {'n_components': '(3)', 'covariance_type': '"""full"""', 'max_iter': '(1000)', 'tol': '(1e-05)', 'n_ini...
""" CollectionIndex.py Author: <NAME> (<EMAIL>) Manages the collection index. """ import h5py from math import floor, sqrt import os import numpy as np import random import scipy.sparse as sparse import scipy.spatial from sklearn.cluster import KMeans, MiniBatchKMeans from time import time from aimodel.commons impo...
[ "sklearn.cluster.MiniBatchKMeans", "numpy.load", "numpy.save", "h5py.File", "os.makedirs", "math.sqrt", "aimodel.commons.t", "numpy.zeros", "os.path.exists", "time.time", "numpy.argsort", "numpy.where", "numpy.array", "os.path.join" ]
[((1219, 1274), 'os.path.join', 'os.path.join', (['index_dir', 'CollectionIndex.INDEX_FILENAME'], {}), '(index_dir, CollectionIndex.INDEX_FILENAME)\n', (1231, 1274), False, 'import os\n'), ((1318, 1382), 'os.path.join', 'os.path.join', (['index_dir', 'CollectionIndex.INVERTED_INDEX_FILENAME'], {}), '(index_dir, Collect...
""" converts text to a matrix where every row is an observation and every feature is a unique word. The value of each element in the matrix is either a binary indicator marking the presence of that word or an intergert of the number of times that workd appears. """ # Load library import numpy as np from sklearn.featur...
[ "sklearn.feature_extraction.text.CountVectorizer", "numpy.array" ]
[((408, 484), 'numpy.array', 'np.array', (["['I love Brazil. Brazil!', 'Sweden is best', 'Germany beats both']"], {}), "(['I love Brazil. Brazil!', 'Sweden is best', 'Germany beats both'])\n", (416, 484), True, 'import numpy as np\n'), ((579, 596), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', (...
import matplotlib.pyplot as plt import numpy as np from keras.models import load_model import cv2 model = load_model("../model/semantic_model(92.4).h5") cap = cv2.VideoCapture(0) while cap.isOpened(): _, frame = cap.read() frame = cv2.resize(frame, (256, 256)) pred = model.predict(frame.reshape(1, frame....
[ "keras.models.load_model", "cv2.waitKey", "matplotlib.pyplot.imshow", "numpy.zeros", "cv2.imshow", "cv2.VideoCapture", "cv2.destroyAllWindows", "cv2.resize" ]
[((107, 153), 'keras.models.load_model', 'load_model', (['"""../model/semantic_model(92.4).h5"""'], {}), "('../model/semantic_model(92.4).h5')\n", (117, 153), False, 'from keras.models import load_model\n'), ((160, 179), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (176, 179), False, 'import cv2\n'),...
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> # -------------------------------------------------------- from __future__ import absolute_import from __future__ import division from __future__ import pri...
[ "numpy.uint8", "numpy.ceil", "six.moves.range", "PIL.ImageFont.truetype", "numpy.array", "PIL.ImageDraw.Draw" ]
[((3587, 3627), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""data/arial.ttf"""', '(15)'], {}), "('data/arial.ttf', 15)\n", (3605, 3627), True, 'import PIL.ImageFont as ImageFont\n'), ((3738, 3759), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (3752, 3759), True, 'import PIL.ImageDraw a...
import os import random from typing import Union import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.dates as mdates try: import plotly except ModuleNotFoundError: plotly = None from .plotting_tools import save_or_show from ai4water.utils.utils im...
[ "matplotlib.pyplot.title", "numpy.nanpercentile", "matplotlib.pyplot.clf", "pandas.infer_freq", "numpy.isnan", "matplotlib.pyplot.figure", "matplotlib.pyplot.style.use", "numpy.linalg.pinv", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "matplotlib.pyplot.yticks", "matplotlib.dates....
[((10408, 10436), 'random.choice', 'random.choice', (['regplot_combs'], {}), '(regplot_combs)\n', (10421, 10436), False, 'import random\n'), ((10477, 10493), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (10486, 10493), True, 'import matplotlib.pyplot as plt\n'), ((10509, 10548), 'matplotlib...
import os import tifffile from skimage.metrics import mean_squared_error, normalized_root_mse import numpy as np import matplotlib.pyplot as plt fake_root_path = 'mse_data/fake_64' real_root_path = 'mse_data/real_64' compared_root_path = 'compared/copperfoam_0.tiff' fake_image_names = os.listdir(fake_root_path) real_i...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.std", "matplotlib.pyplot.boxplot", "matplotlib.pyplot.figure", "numpy.mean", "tifffile.imread", "os.path.join", "os.listdir" ]
[((287, 313), 'os.listdir', 'os.listdir', (['fake_root_path'], {}), '(fake_root_path)\n', (297, 313), False, 'import os\n'), ((333, 359), 'os.listdir', 'os.listdir', (['real_root_path'], {}), '(real_root_path)\n', (343, 359), False, 'import os\n'), ((375, 410), 'tifffile.imread', 'tifffile.imread', (['compared_root_pat...
'optimizer.py' 'Main Datei' 'Das Programm wird über dieses Steuerungsskript gesteuert' 'Einige Dateien werden hier direkt aufgerufen, andere indirekt' from d_optimal_design import Doptimaldesign import parallelcomp import numpy as np from leastsquares import buildmodel,regkoeff var = [579,40,18,19...
[ "scipy.optimize.minimize", "leastsquares.buildmodel", "numpy.delete", "numpy.asarray", "numpy.transpose", "boundaries.ub", "boundaries.lb", "matplotlib.pyplot.figure", "numpy.array", "numpy.dot", "d_optimal_design.Doptimaldesign", "operator.itemgetter", "leastsquares.regkoeff", "parallelco...
[((795, 831), 'parallelcomp.run', 'parallelcomp.run', (['info', 'nodedist', 'op'], {}), '(info, nodedist, op)\n', (811, 831), False, 'import parallelcomp\n'), ((869, 923), 'leastsquares.buildmodel', 'buildmodel', (['D', 'lenvar', 'info', 'datetime', 'alllogs', 'ent_sp'], {}), '(D, lenvar, info, datetime, alllogs, ent_s...