code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- encoding: utf-8 """ Copyright (c) 2014, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright noti...
[ "numpy.mean", "numpy.sum", "numpy.zeros", "numpy.isnan", "numpy.vstack" ]
[((1876, 1908), 'numpy.zeros', 'np.zeros', (['(0, 4)'], {'dtype': 'np.int32'}), '((0, 4), dtype=np.int32)\n', (1884, 1908), True, 'import numpy as np\n'), ((1829, 1841), 'numpy.vstack', 'np.vstack', (['b'], {}), '(b)\n', (1838, 1841), True, 'import numpy as np\n'), ((2666, 2683), 'numpy.mean', 'np.mean', (['bo[:, 0]'],...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import make_blobs from sklearn.mixture import GaussianMixture from sklearn.cluster import KMeans from matplotlib.patches import Ellipse # For reproducibility np.random.seed(1000) nb_samples = 300 nb_centers = 2 if __na...
[ "sklearn.cluster.KMeans", "seaborn.set", "sklearn.mixture.GaussianMixture", "sklearn.datasets.make_blobs", "numpy.dot", "numpy.random.seed", "numpy.linalg.norm", "numpy.linalg.eigh", "matplotlib.patches.Ellipse", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((256, 276), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (270, 276), True, 'import numpy as np\n'), ((376, 510), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'nb_samples', 'n_features': '(2)', 'center_box': '[-1, 1]', 'centers': 'nb_centers', 'cluster_std': '[1.0, 0.6]', 'ra...
""" fit1d package is designed to provide an organized toolbox for different types of 1D fits that can be performed. It is easy to add new fits and other functionalities """ from abc import ABC, abstractmethod import numpy as np from typing import List,Tuple from fit1d.common.model import Model, ModelMock from fit1d.co...
[ "numpy.delete", "numpy.array", "fit1d.common.fit_data.FitData", "fit1d.common.model.ModelMock" ]
[((2867, 2899), 'numpy.delete', 'np.delete', (['self._fit_data.x', 'ind'], {}), '(self._fit_data.x, ind)\n', (2876, 2899), True, 'import numpy as np\n'), ((2927, 2959), 'numpy.delete', 'np.delete', (['self._fit_data.y', 'ind'], {}), '(self._fit_data.y, ind)\n', (2936, 2959), True, 'import numpy as np\n'), ((3223, 3232)...
# min (1/2) x'Q'x - q'x from __future__ import print_function import numpy as np import aa dim = 1000 mems = [5, 10, 20, 50, 100] N = int(1e4) np.random.seed(1234) Q = np.random.randn(dim,dim) Q = Q.T.dot(Q) q = np.random.randn(dim) x_0 = np.random.randn(dim) x_star = np.linalg.solve(Q, q) step = 0.0005 def f(x):...
[ "numpy.copy", "numpy.linalg.solve", "aa.AndersonAccelerator", "numpy.random.seed", "numpy.random.randn" ]
[((146, 166), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (160, 166), True, 'import numpy as np\n'), ((172, 197), 'numpy.random.randn', 'np.random.randn', (['dim', 'dim'], {}), '(dim, dim)\n', (187, 197), True, 'import numpy as np\n'), ((216, 236), 'numpy.random.randn', 'np.random.randn', (['di...
from paper_1.data.data_loader import load_val_data, load_train_data, sequential_data_loader, random_data_loader from paper_1.utils import read_parameter_file, create_experiment_directory from paper_1.evaluation.eval_utils import init_metrics_object from paper_1.baseline.main import train as baseline_train from paper_1....
[ "paper_1.data.data_loader.sequential_data_loader", "torch.cuda.is_available", "paper_1.data.data_loader.load_val_data", "torch.utils.tensorboard.SummaryWriter", "os.path.exists", "os.listdir", "paper_1.baseline.main.train", "paper_1.utils.read_parameter_file", "os.path.isdir", "pandas.concat", "...
[((787, 811), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (809, 811), False, 'import torch\n'), ((1407, 1465), 'paper_1.data.data_loader.load_train_data', 'load_train_data', (['data_params', 'source_domain', 'target_domain'], {}), '(data_params, source_domain, target_domain)\n', (1422, 1465), ...
import tensorflow as tf import pandas as pd import numpy as np import sys import time from cflow import ConditionalFlow from MoINN.modules.subnetworks import DenseSubNet from utils import train_density_estimation, plot_loss, plot_tau_ratio # import data tau1_gen = np.reshape(np.load("../data/tau1s_Pythia_gen.npy"), ...
[ "cflow.ConditionalFlow", "tensorflow.keras.optimizers.schedules.InverseTimeDecay", "tensorflow.data.Dataset.from_tensor_slices", "utils.train_density_estimation", "tensorflow.keras.optimizers.Adam", "numpy.split", "utils.plot_tau_ratio", "tensorflow.constant", "numpy.concatenate", "tensorflow.redu...
[((758, 779), 'numpy.split', 'np.split', (['data_gen', '(2)'], {}), '(data_gen, 2)\n', (766, 779), True, 'import numpy as np\n'), ((802, 823), 'numpy.split', 'np.split', (['data_sim', '(2)'], {}), '(data_sim, 2)\n', (810, 823), True, 'import numpy as np\n'), ((986, 1095), 'cflow.ConditionalFlow', 'ConditionalFlow', ([]...
from abc import ABC, abstractmethod import numpy as np class SwarmAlgorithm(ABC): ''' A base abstract class for different swarm algorithms. Parameters ---------- D : int Search space dimension. N : int Population size. fit_func : callable Fitness (objective) functi...
[ "numpy.copy", "numpy.ndarray.argmin", "numpy.tile", "numpy.random.seed", "numpy.random.uniform", "numpy.argmin" ]
[((3954, 3977), 'numpy.copy', 'np.copy', (['new_population'], {}), '(new_population)\n', (3961, 3977), True, 'import numpy as np\n'), ((4113, 4143), 'numpy.ndarray.argmin', 'np.ndarray.argmin', (['self.scores'], {}), '(self.scores)\n', (4130, 4143), True, 'import numpy as np\n'), ((4165, 4201), 'numpy.copy', 'np.copy',...
""" Generate coulomb matrices for molecules. See Montavon et al., _New Journal of Physics_ __15__ (2013) 095003. """ import numpy as np from typing import Any, List, Optional from deepchem.utils.typing import RDKitMol from deepchem.utils.data_utils import pad_array from deepchem.feat.base_classes import MolecularFeat...
[ "numpy.abs", "numpy.linalg.eig", "rdkit.Chem.AddHs", "numpy.asarray", "numpy.triu_indices_from", "numpy.squeeze", "numpy.argsort", "numpy.array", "numpy.zeros", "numpy.outer", "rdkit.Chem.AllChem.ETKDG", "numpy.linalg.norm", "rdkit.Chem.RemoveHs", "numpy.random.RandomState", "deepchem.ut...
[((3568, 3588), 'numpy.asarray', 'np.asarray', (['features'], {}), '(features)\n', (3578, 3588), True, 'import numpy as np\n'), ((5033, 5049), 'numpy.asarray', 'np.asarray', (['rval'], {}), '(rval)\n', (5043, 5049), True, 'import numpy as np\n'), ((5793, 5825), 'numpy.random.RandomState', 'np.random.RandomState', (['se...
#!/usr/bin/env python # coding: utf-8 # This script generates a zone plate pattern (based on partial filling) given the material, energy, grid size and number of zones as input # In[1]: import numpy as np import matplotlib.pyplot as plt from numba import njit from joblib import Parallel, delayed from tqdm import tq...
[ "numpy.sqrt", "numpy.where", "urllib.request.Request", "numpy.arcsin", "os.getcwd", "numpy.array", "numpy.zeros", "numpy.linspace", "urllib.parse.urlencode", "numpy.meshgrid", "numpy.shape", "urllib.request.urlopen" ]
[((4720, 4735), 'numpy.zeros', 'np.zeros', (['zones'], {}), '(zones)\n', (4728, 4735), True, 'import numpy as np\n'), ((6546, 6569), 'numpy.array', 'np.array', (['zones_to_fill'], {}), '(zones_to_fill)\n', (6554, 6569), True, 'import numpy as np\n'), ((7066, 7097), 'numpy.linspace', 'np.linspace', (['(-x1)', 'x1', 'gri...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "numpy.mean", "numpy.ones", "argparse.ArgumentParser", "numpy.argmax", "numpy.min", "numpy.max", "os.path.dirname", "numpy.array", "cv2.cvtColor", "numpy.std", "platform.machine", "cv2.resize", "cv2.imread" ]
[((873, 898), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (896, 898), False, 'import argparse\n'), ((2870, 2888), 'platform.machine', 'platform.machine', ([], {}), '()\n', (2886, 2888), False, 'import platform\n'), ((7710, 7737), 'cv2.imread', 'cv2.imread', (['args.image_path'], {}), '(args....
""" Waymo dataset with votes. Author: <NAME> Date: 2020 """ import os import sys import numpy as np import pickle from torch.utils.data import Dataset import scipy.io as sio # to load .mat files for depth points BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.appe...
[ "numpy.array", "sys.path.append", "os.path.exists", "box_util.get_corners_from_labels_array", "numpy.random.random", "numpy.delete", "numpy.max", "pc_util.random_sampling", "numpy.min", "numpy.tile", "pc_util.write_oriented_bbox", "pickle.load", "model_util_waymo.WaymoDatasetConfig", "nump...
[((307, 332), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (322, 332), False, 'import sys\n'), ((527, 547), 'model_util_waymo.WaymoDatasetConfig', 'WaymoDatasetConfig', ([], {}), '()\n', (545, 547), False, 'from model_util_waymo import WaymoDatasetConfig\n'), ((241, 266), 'os.path.abspath',...
import numpy as np class Agent: def __init__(self): self.q_table = np.zeros(shape=(3, )) self.rewards = [] self.averaged_rewards = [] self.total_rewards = 0 self.action_cursor = 1 class HystereticAgentMatrix: def __init__(self, environment, increasing_learning_rate=0.9...
[ "numpy.zeros", "numpy.argmax", "numpy.random.randint", "numpy.max" ]
[((80, 100), 'numpy.zeros', 'np.zeros', ([], {'shape': '(3,)'}), '(shape=(3,))\n', (88, 100), True, 'import numpy as np\n'), ((2484, 2524), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.num_of_action'], {}), '(0, self.num_of_action)\n', (2501, 2524), True, 'import numpy as np\n'), ((2560, 2584), 'numpy.ar...
# -*- coding: utf-8 -*- # Copyright 2020 The PsiZ Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
[ "tensorflow.shape", "psiz.keras.initializers.RandomAttention", "tensorflow.keras.utils.serialize_keras_object", "tensorflow.keras.initializers.Ones", "tensorflow.ones_like", "tensorflow.keras.initializers.serialize", "tensorflow.rank", "tensorflow.concat", "tensorflow.keras.regularizers.get", "ten...
[((1520, 1618), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_serializable', ([], {'package': '"""psiz.keras.layers"""', 'name': '"""GroupAttention"""'}), "(package='psiz.keras.layers',\n name='GroupAttention')\n", (1562, 1618), True, 'import tensorflow as tf\n'), ((5502, 5592)...
import os.path as osp import numpy as np import math from tqdm import tqdm import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data from torchvision import transforms, datasets from ofa.utils import AverageMeter, accuracy from ofa.model_zoo import ofa_specialized from ofa.imagenet_classifica...
[ "torch.nn.CrossEntropyLoss", "ofa.model_zoo.ofa_specialized", "numpy.array", "torchvision.transforms.ColorJitter", "copy.deepcopy", "numpy.mean", "ofa.utils.accuracy", "torchvision.transforms.ToTensor", "torchvision.transforms.RandomResizedCrop", "random.randint", "torchvision.transforms.RandomH...
[((4567, 4607), 'ofa.imagenet_classification.elastic_nn.utils.set_running_statistics', 'set_running_statistics', (['net', 'data_loader'], {}), '(net, data_loader)\n', (4589, 4607), False, 'from ofa.imagenet_classification.elastic_nn.utils import set_running_statistics\n'), ((5384, 5398), 'ofa.utils.AverageMeter', 'Aver...
from netCDF4 import Dataset import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection import matplotlib.cm as cm import numpy as np #------------------------------------------------------------- def plot_subfigure(axis, array, nCells, n...
[ "matplotlib.pyplot.savefig", "netCDF4.Dataset", "matplotlib.collections.PatchCollection", "matplotlib.pyplot.close", "numpy.array", "numpy.sum", "matplotlib.pyplot.cla", "matplotlib.pyplot.subplots", "matplotlib.patches.Polygon", "matplotlib.pyplot.get_cmap" ]
[((505, 523), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['cmap'], {}), '(cmap)\n', (517, 523), True, 'import matplotlib.pyplot as plt\n'), ((1132, 1167), 'matplotlib.collections.PatchCollection', 'PatchCollection', (['patches'], {'cmap': 'cmap'}), '(patches, cmap=cmap)\n', (1147, 1167), False, 'from matplotlib.col...
import glob import json import os import subprocess import time import xml.etree.ElementTree as ET from xml.etree.ElementTree import ParseError import geopandas as gpd import rasterio import numpy as np from shapely.geometry import Polygon class PipelineError(RuntimeError): def __init__(self, message): s...
[ "geopandas.sjoin", "xml.etree.ElementTree.parse", "geopandas.read_file", "os.makedirs", "subprocess.run", "os.path.join", "numpy.array", "shapely.geometry.Polygon", "numpy.stack", "os.path.basename", "time.time", "numpy.meshgrid", "geopandas.GeoDataFrame", "numpy.arange", "os.remove" ]
[((3566, 3592), 'os.path.basename', 'os.path.basename', (['poly_shp'], {}), '(poly_shp)\n', (3582, 3592), False, 'import os\n'), ((3607, 3632), 'os.path.join', 'os.path.join', (['odir', 'fname'], {}), '(odir, fname)\n', (3619, 3632), False, 'import os\n'), ((3637, 3669), 'os.makedirs', 'os.makedirs', (['odir'], {'exist...
import numpy as np import matplotlib.pyplot as plt #################### def merge_dicts(list_of_dicts): results = {} for d in list_of_dicts: for key in d.keys(): if key in results.keys(): results[key].append(d[key]) else: results[key] = [d[key]]...
[ "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gca", "matplotlib.pyplot.gcf", "matplotlib.pyplot.clf", "numpy.max", "matplotlib.pyplot.close", "matplotlib.pyplot.rcParams.update", "numpy.zeros", "matplotlib.pyplot.bar", "numpy.sum", "numpy.array", "matplotlib.pyplot.tight_layou...
[((502, 542), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2, 2, 2, 2, num_layers)'}), '(shape=(2, 2, 2, 2, num_layers))\n', (510, 542), True, 'import numpy as np\n'), ((551, 591), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2, 2, 2, 2, num_layers)'}), '(shape=(2, 2, 2, 2, num_layers))\n', (559, 591), True, 'import nump...
#!/usr/bin/python # # Copyright 2020 DeepMind Technologies 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 a...
[ "dm_construction.get_unity_environment", "numpy.random.choice", "absl.testing.parameterized.named_parameters", "absl.testing.absltest.main", "dm_construction.get_environment", "numpy.random.randint", "numpy.random.seed", "numpy.random.uniform", "absl.flags.DEFINE_string" ]
[((850, 894), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""backend"""', '"""docker"""', '""""""'], {}), "('backend', 'docker', '')\n", (869, 894), False, 'from absl import flags\n'), ((1580, 1600), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1594, 1600), True, 'import numpy as np\n')...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 11 13:30:53 2017 @author: laoj """ import numpy as np import pymc3 as pm import theano.tensor as tt from pymc3.distributions.distribution import Discrete, draw_values, generate_samples, infer_shape from pymc3.distributions.dist_math import bound, lo...
[ "pymc3.distributions.dist_math.factln", "theano.tensor.ones", "theano.tensor.all", "theano.tensor.abs_", "numpy.array", "pymc3.sample", "pymc3.distributions.distribution.generate_samples", "theano.tensor.dot", "theano.tensor.shape_padleft", "theano.tensor.log", "numpy.asarray", "numpy.random.m...
[((406, 458), 'numpy.array', 'np.array', (['[[106], [143], [102], [116], [183], [150]]'], {}), '([[106], [143], [102], [116], [183], [150]])\n', (414, 458), True, 'import numpy as np\n'), ((468, 719), 'numpy.array', 'np.array', (['[[0.21245365, 0.41223126, 0.37531509], [0.13221011, 0.50537169, 0.3624182],\n [0.08813...
from typing import Callable, Optional, Sequence, Tuple, Union import numpy from dexp.processing.utils.nd_slice import nd_split_slices, remove_margin_slice from dexp.processing.utils.normalise import Normalise from dexp.utils import xpArray from dexp.utils.backends import Backend def scatter_gather_i2i( function...
[ "dexp.processing.utils.nd_slice.nd_split_slices", "dexp.utils.backends.Backend.get_xp_module", "dexp.utils.backends.Backend.to_backend", "dexp.processing.utils.nd_slice.remove_margin_slice", "dexp.utils.backends.Backend.to_numpy", "numpy.empty" ]
[((2346, 2398), 'numpy.empty', 'numpy.empty', ([], {'shape': 'image.shape', 'dtype': 'internal_dtype'}), '(shape=image.shape, dtype=internal_dtype)\n', (2357, 2398), False, 'import numpy\n'), ((2534, 2559), 'dexp.utils.backends.Backend.to_backend', 'Backend.to_backend', (['image'], {}), '(image)\n', (2552, 2559), False...
import unittest import csv import numpy as np from viroconcom.fitting import Fit def read_benchmark_dataset(path='tests/testfiles/1year_dataset_A.txt'): """ Reads a datasets provided for the environmental contour benchmark. Parameters ---------- path : string Path to dataset including the...
[ "numpy.abs", "numpy.asarray", "numpy.exp", "viroconcom.fitting.Fit", "csv.reader", "numpy.random.RandomState" ]
[((1299, 1312), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1309, 1312), True, 'import numpy as np\n'), ((1321, 1334), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (1331, 1334), True, 'import numpy as np\n'), ((825, 860), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""";"""'}), "(csv_file...
import numpy as np """ Contains preprocessing code for creating additional information based on MRI volumes and true segmentation maps (asegs). Eg. weight masks for median frequency class weighing, edge weighing etc. """ def create_weight_mask(aseg): """ Main function for calculating weight mask of segmentati...
[ "numpy.median", "numpy.unique", "numpy.array", "numpy.zeros", "numpy.zeros_like" ]
[((756, 788), 'numpy.zeros', 'np.zeros', (['(h, w, d)'], {'dtype': 'float'}), '((h, w, d), dtype=float)\n', (764, 788), True, 'import numpy as np\n'), ((1441, 1476), 'numpy.unique', 'np.unique', (['aseg'], {'return_counts': '(True)'}), '(aseg, return_counts=True)\n', (1450, 1476), True, 'import numpy as np\n'), ((2410,...
import os import scipy import numpy as np import pandas as pd import torch from torch.autograd import Variable def predict_batch(net, inputs): v = Variable(inputs.cuda(), volatile=True) return net(v).data.cpu().numpy() def get_probabilities(model, loader): model.eval() return np.vstack(predict_batch...
[ "numpy.copy", "numpy.mean", "scipy.stats.mode", "torch.max", "numpy.empty", "numpy.vstack", "scipy.stats.mstats.gmean" ]
[((411, 425), 'numpy.copy', 'np.copy', (['probs'], {}), '(probs)\n', (418, 425), True, 'import numpy as np\n'), ((568, 592), 'torch.max', 'torch.max', (['output'], {'dim': '(1)'}), '(output, dim=1)\n', (577, 592), False, 'import torch\n'), ((988, 1016), 'numpy.vstack', 'np.vstack', (['[targets, target]'], {}), '([targe...
#!/usr/bin/env python3 # # Author: <NAME> # License: BSD 2-clause # Last Change: Sun May 09, 2021 at 02:52 AM +0200 import numpy as np ARRAY_TYPE = 'np' def read_branch(ntp, tree, branch, idx=None): data = ntp[tree][branch].array(library=ARRAY_TYPE) return data if not idx else data[idx] def read_branches...
[ "numpy.column_stack" ]
[((623, 644), 'numpy.column_stack', 'np.column_stack', (['data'], {}), '(data)\n', (638, 644), True, 'import numpy as np\n')]
#!/usr/bin/env python """ Test code for the BBox Object """ import numpy as np import pytest from geometry_utils.bound_box import (BBox, asBBox, NullBBox, InfBBox, f...
[ "geometry_utils.bound_box.fromBBArray", "geometry_utils.bound_box.InfBBox", "geometry_utils.bound_box.BBox", "numpy.array", "geometry_utils.bound_box.from_points", "pytest.raises", "numpy.isnan", "numpy.isinf", "geometry_utils.bound_box.NullBBox", "geometry_utils.bound_box.asBBox" ]
[((10354, 10387), 'geometry_utils.bound_box.BBox', 'BBox', (['((-23.5, 456), (56, 532.0))'], {}), '(((-23.5, 456), (56, 532.0)))\n', (10358, 10387), False, 'from geometry_utils.bound_box import BBox, asBBox, NullBBox, InfBBox, fromBBArray, from_points\n'), ((10396, 10427), 'geometry_utils.bound_box.BBox', 'BBox', (['((...
import cv2 cv2.setNumThreads(0) cv2.ocl.setUseOpenCL(False) import numpy as np import math from functools import wraps def clip(img, dtype, maxval): return np.clip(img, 0, maxval).astype(dtype) def clipped(func): """ wrapper to clip results of transform to image dtype value range """ ...
[ "numpy.clip", "numpy.ascontiguousarray", "math.cos", "numpy.array", "cv2.warpPerspective", "numpy.rot90", "numpy.moveaxis", "cv2.ocl.setUseOpenCL", "numpy.where", "functools.wraps", "numpy.max", "numpy.dot", "cv2.blur", "cv2.add", "cv2.merge", "cv2.warpAffine", "cv2.getPerspectiveTra...
[((12, 32), 'cv2.setNumThreads', 'cv2.setNumThreads', (['(0)'], {}), '(0)\n', (29, 32), False, 'import cv2\n'), ((34, 61), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(False)'], {}), '(False)\n', (54, 61), False, 'import cv2\n'), ((326, 337), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (331, 337), Fa...
import numpy as np def get_conf_thresholded(conf, thresh_log_conf, dtype_np): """Normalizes a confidence score to (0..1). Args: conf (float): Unnormalized confidence. dtype_np (type): Desired return type. Returns: confidence (np.float32): Norma...
[ "numpy.zeros" ]
[((1052, 1107), 'numpy.zeros', 'np.zeros', (['query_2d_full.poses.shape[-1]'], {'dtype': 'dtype_np'}), '(query_2d_full.poses.shape[-1], dtype=dtype_np)\n', (1060, 1107), True, 'import numpy as np\n')]
# encoding: utf-8 import datetime import numpy as np import pandas as pd def get_next_period_day(current, period, n=1, extra_offset=0): """ Get the n'th day in next period from current day. Parameters ---------- current : int Current date in format "%Y%m%d". period : str Inter...
[ "pandas.Series", "numpy.int64", "pandas.Timedelta", "pandas.tseries.offsets.BMonthBegin", "pandas.tseries.offsets.Week", "pandas.tseries.offsets.BDay", "pandas.Timestamp", "pandas.to_datetime" ]
[((1491, 1526), 'pandas.to_datetime', 'pd.to_datetime', (['dt'], {'format': '"""%Y%m%d"""'}), "(dt, format='%Y%m%d')\n", (1505, 1526), True, 'import pandas as pd\n'), ((2277, 2304), 'pandas.Timedelta', 'pd.Timedelta', ([], {'weeks': 'n_weeks'}), '(weeks=n_weeks)\n', (2289, 2304), True, 'import pandas as pd\n'), ((618, ...
import deepchem as dc import numpy as np import tensorflow as tf import deepchem.models.tensorgraph.layers as layers from tensorflow.python.eager import context from tensorflow.python.framework import test_util class TestLayersEager(test_util.TensorFlowTestCase): """ Test that layers function in eager mode. """...
[ "numpy.log", "deepchem.models.tensorgraph.layers.MaxPool1D", "deepchem.models.tensorgraph.layers.BatchNorm", "deepchem.models.tensorgraph.layers.Conv3D", "deepchem.models.tensorgraph.layers.ReduceMax", "deepchem.models.tensorgraph.layers.SoftMax", "deepchem.models.tensorgraph.layers.Gather", "deepchem...
[((403, 423), 'tensorflow.python.eager.context.eager_mode', 'context.eager_mode', ([], {}), '()\n', (421, 423), False, 'from tensorflow.python.eager import context\n'), ((619, 654), 'deepchem.models.tensorgraph.layers.Conv1D', 'layers.Conv1D', (['filters', 'kernel_size'], {}), '(filters, kernel_size)\n', (632, 654), Tr...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- from pathlib import Path import pandas as pd from numpy import around if __name__ == "__main__": # Harden's PPG is from 2018-19 season # Bryant's PPG is from 2005-06 season # Jordan's PPG is from 1986-87 season per_game_df = pd.read_csv(Path('../data/com...
[ "numpy.around", "pathlib.Path" ]
[((303, 347), 'pathlib.Path', 'Path', (['"""../data/compare_players_per_game.csv"""'], {}), "('../data/compare_players_per_game.csv')\n", (307, 347), False, 'from pathlib import Path\n'), ((377, 419), 'pathlib.Path', 'Path', (['"""../data/compare_players_per_48.csv"""'], {}), "('../data/compare_players_per_48.csv')\n",...
# A Rapid Proof of Concept for the eDensiometer # Copyright 2018, <NAME>. All Rights Reserved. Created with contributions from <NAME>. # Imports from PIL import Image from pprint import pprint import numpy as np import time as time_ def millis(): # from https://stackoverflow.com/questions/5998245/get-current-time-in-...
[ "numpy.zeros", "PIL.Image.open", "time.time" ]
[((653, 708), 'numpy.zeros', 'np.zeros', (['(temp.shape[0], temp.shape[1], temp.shape[2])'], {}), '((temp.shape[0], temp.shape[1], temp.shape[2]))\n', (661, 708), True, 'import numpy as np\n'), ((723, 763), 'numpy.zeros', 'np.zeros', (['(temp.shape[0], temp.shape[1])'], {}), '((temp.shape[0], temp.shape[1]))\n', (731, ...
import numpy as nm from sfepy.linalg import dot_sequences from sfepy.terms.terms import Term, terms class DivGradTerm(Term): r""" Diffusion term. :Definition: .. math:: \int_{\Omega} \nu\ \nabla \ul{v} : \nabla \ul{u} \mbox{ , } \int_{\Omega} \nu\ \nabla \ul{u} : \nabla \ul{w} \\ ...
[ "numpy.array", "sfepy.linalg.dot_sequences", "numpy.ones", "numpy.ascontiguousarray" ]
[((11757, 11785), 'numpy.ascontiguousarray', 'nm.ascontiguousarray', (['div_bf'], {}), '(div_bf)\n', (11777, 11785), True, 'import numpy as nm\n'), ((1821, 1863), 'numpy.ones', 'nm.ones', (['(1, n_qp, 1, 1)'], {'dtype': 'nm.float64'}), '((1, n_qp, 1, 1), dtype=nm.float64)\n', (1828, 1863), True, 'import numpy as nm\n')...
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def plot_loss(model, n_iter): plt.figure() plt.plot(model.trainloss, 'b-', model.validloss, 'r-') plt.xlim(0, n_iter) plt.xlabel('iteration') plt.ylabel('loss') plt.title('learning curve') plt.legend(['training loss...
[ "matplotlib.pyplot.ylabel", "numpy.hstack", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((111, 123), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (121, 123), True, 'import matplotlib.pyplot as plt\n'), ((128, 182), 'matplotlib.pyplot.plot', 'plt.plot', (['model.trainloss', '"""b-"""', 'model.validloss', '"""r-"""'], {}), "(model.trainloss, 'b-', model.validloss, 'r-')\n", (136, 182), True,...
import pytheia as pt import os import numpy as np def test_track_set_descriptor_read_write(): recon = pt.sfm.Reconstruction() view_id1 = recon.AddView("0",0.0) m_view1 = recon.MutableView(view_id1) m_view1.IsEstimated = True view_id2 = recon.AddView("1",1.0) m_view2 = recon.MutableView(view_id2...
[ "pytheia.io.ReadReconstruction", "numpy.asarray", "pytheia.sfm.Reconstruction", "pytheia.io.WriteReconstruction", "os.remove" ]
[((107, 130), 'pytheia.sfm.Reconstruction', 'pt.sfm.Reconstruction', ([], {}), '()\n', (128, 130), True, 'import pytheia as pt\n'), ((523, 555), 'numpy.asarray', 'np.asarray', (['[100, 200, 300, 400]'], {}), '([100, 200, 300, 400])\n', (533, 555), True, 'import numpy as np\n'), ((678, 718), 'pytheia.io.WriteReconstruct...
# -*- coding: utf-8 -*- """ @author: <NAME>. Department of Aerodynamics Faculty of Aerospace Engineering TU Delft, Delft, Netherlands """ from numpy import sin, cos, pi from objects.CSCG._3d.exact_solutions.status.incompressible_Navier_Stokes.base import incompressible_NavierStokes_Base fro...
[ "numpy.sin", "objects.CSCG._3d.fields.vector.main._3dCSCG_VectorField", "numpy.cos" ]
[((918, 933), 'numpy.cos', 'cos', (['(2 * pi * z)'], {}), '(2 * pi * z)\n', (921, 933), False, 'from numpy import sin, cos, pi\n'), ((1126, 1141), 'numpy.sin', 'sin', (['(2 * pi * z)'], {}), '(2 * pi * z)\n', (1129, 1141), False, 'from numpy import sin, cos, pi\n'), ((1333, 1348), 'numpy.sin', 'sin', (['(2 * pi * x)'],...
import read_data as RD import numpy as np import matplotlib.pyplot as plt from PIL import Image X = RD.read_data() print('X = ',X.shape) X_mean = np.reshape(np.sum(X,1)/X.shape[1],[ X.shape[0],1]) X = X-X_mean print('X_centerred = ',X.shape) [U,S,V] = np.linalg.svd(X, full_matrices=False) print('U = ',U.shape) print('...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.savefig", "numpy.reshape", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "numpy.arange", "numpy.sqrt", "matplotlib.pyplot.xlabel", "numpy.sum", "matplotlib.pyplot.figure", "read_data.read_data", "matplotlib.pyplot.yticks", "numpy.matmu...
[((101, 115), 'read_data.read_data', 'RD.read_data', ([], {}), '()\n', (113, 115), True, 'import read_data as RD\n'), ((253, 290), 'numpy.linalg.svd', 'np.linalg.svd', (['X'], {'full_matrices': '(False)'}), '(X, full_matrices=False)\n', (266, 290), True, 'import numpy as np\n'), ((406, 434), 'matplotlib.pyplot.figure',...
import math from numpy import linalg from scipy import stats from scipy.spatial import distance import numpy def euclidean(p, Q): return numpy.apply_along_axis(lambda q: linalg.norm(p - q), 0, Q) def hellinger(p, Q): factor = 1 / math.sqrt(2) sqrt_p = numpy.sqrt(p) return factor * numpy.apply_along...
[ "scipy.stats.entropy", "numpy.sqrt", "math.sqrt", "numpy.square", "numpy.linalg.norm", "scipy.spatial.distance.jensenshannon" ]
[((269, 282), 'numpy.sqrt', 'numpy.sqrt', (['p'], {}), '(p)\n', (279, 282), False, 'import numpy\n'), ((243, 255), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (252, 255), False, 'import math\n'), ((177, 195), 'numpy.linalg.norm', 'linalg.norm', (['(p - q)'], {}), '(p - q)\n', (188, 195), False, 'from numpy import...
import json import math from dataclasses import dataclass from datetime import timedelta from enum import Enum from pathlib import Path from typing import List, Optional import numpy as np from vad.util.time_utils import ( format_timedelta_to_milliseconds, format_timedelta_to_timecode, parse_timecode_to_t...
[ "vad.util.time_utils.parse_timecode_to_timedelta", "vad.util.time_utils.format_timedelta_to_milliseconds", "numpy.zeros", "json.load", "datetime.timedelta", "json.dump", "vad.util.time_utils.format_timedelta_to_timecode" ]
[((10019, 10057), 'numpy.zeros', 'np.zeros', (['total_samples'], {'dtype': 'np.long'}), '(total_samples, dtype=np.long)\n', (10027, 10057), True, 'import numpy as np\n'), ((863, 878), 'json.load', 'json.load', (['file'], {}), '(file)\n', (872, 878), False, 'import json\n'), ((4223, 4289), 'json.dump', 'json.dump', (['v...
# -*- coding: utf-8 -*- """ Created on 2017-4-25 @author: cheng.li """ import datetime as dt import numpy as np from sklearn.linear_model import LinearRegression from alphamind.data.neutralize import neutralize def benchmark_neutralize(n_samples: int, n_features: int, n_loops: int) -> None: pr...
[ "numpy.testing.assert_array_almost_equal", "alphamind.data.neutralize.neutralize", "datetime.datetime.now", "numpy.random.randint", "numpy.random.randn", "sklearn.linear_model.LinearRegression" ]
[((591, 620), 'numpy.random.randn', 'np.random.randn', (['n_samples', '(5)'], {}), '(n_samples, 5)\n', (606, 620), True, 'import numpy as np\n'), ((630, 668), 'numpy.random.randn', 'np.random.randn', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (645, 668), True, 'import numpy as np\n'), ((684, 701), ...
# coding=utf-8 # Copyright 2020 The Tensor2Robot 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 ...
[ "tensorflow.compat.v1.train.Features", "tensorflow.compat.v1.train.FloatList", "numpy.random.choice", "numpy.sort", "numpy.array", "tensorflow.compat.v1.train.BytesList", "collections.defaultdict", "tensorflow.compat.v1.train.FeatureList", "numpy.concatenate", "tensorflow.compat.v1.train.Int64List...
[((2614, 2630), 'numpy.sort', 'np.sort', (['indices'], {}), '(indices)\n', (2621, 2630), True, 'import numpy as np\n'), ((3634, 3663), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (3657, 3663), False, 'import collections\n'), ((2168, 2202), 'numpy.array', 'np.array', (['[0, original...
import base64 import datetime import io import json import os import requests from collections import namedtuple from urllib.parse import urlparse import faust import numpy as np import keras_preprocessing.image as keras_img from avro import schema from confluent_kafka import avro from confluent_kafka.avro import Avr...
[ "requests.post", "numpy.log10", "confluent_kafka.avro.loads", "faust.App", "keras_preprocessing.image.load_img", "io.BytesIO", "confluent_kafka.avro.cached_schema_registry_client.CachedSchemaRegistryClient", "blob.BlobConfig", "blob.Blob", "numpy.nanmax", "collections.namedtuple", "biovolume.c...
[((637, 692), 'os.environ.get', 'os.environ.get', (['"""IFCB_STREAM_APP_CONFIG"""', '"""config.json"""'], {}), "('IFCB_STREAM_APP_CONFIG', 'config.json')\n", (651, 692), False, 'import os\n'), ((777, 911), 'collections.namedtuple', 'namedtuple', (['"""Stats"""', "['time', 'ifcb_id', 'roi', 'name', 'classifier', 'prob',...
#ecoding:utf-8 import DatasetLoader import RICNNModel import tensorflow as tf import sys import numpy as np import regularization as re import os import trainLoader os.environ["CUDA_VISIBLE_DEVICES"] = "1" TRAIN_FILENAME = '/media/liuqi/Files/dataset/test_mnist_ricnn_raw_100.h5' TEST_FILENAME = '/media/liuqi/Files/da...
[ "tensorflow.cast", "sys.stdout.flush", "tensorflow.initialize_all_variables", "trainLoader.DataLoader", "tensorflow.placeholder", "tensorflow.Session", "RICNNModel.define_model", "tensorflow.argmax", "tensorflow.name_scope", "numpy.random.seed", "regularization.regu_constraint", "tensorflow.nn...
[((801, 820), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (815, 820), True, 'import numpy as np\n'), ((821, 844), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(100)'], {}), '(100)\n', (839, 844), True, 'import tensorflow as tf\n'), ((849, 951), 'tensorflow.placeholder', 'tf.placeholder'...
""" The file defines the evaluate process on target dataset. @Author: <NAME> @Github: https://github.com/luyanger1799 @Project: https://github.com/luyanger1799/amazing-semantic-segmentation """ from sklearn.metrics import multilabel_confusion_matrix from amazingutils.helpers import * from amazingutils.utils import lo...
[ "os.path.exists", "numpy.mean", "os.listdir", "argparse.ArgumentParser", "os.path.join", "argparse.ArgumentTypeError", "os.getcwd", "sys.stdout.flush", "amazingutils.utils.load_image" ]
[((651, 676), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (674, 676), False, 'import argparse\n'), ((1311, 1355), 'os.path.join', 'os.path.join', (['args.dataset', '"""class_dict.csv"""'], {}), "(args.dataset, 'class_dict.csv')\n", (1323, 1355), False, 'import os\n'), ((1142, 1153), 'os.getc...
from pso.GPSO import GPSO import numpy as np import time import pandas as pd np.random.seed(42) # f1 完成 def Sphere(p): # Sphere函数 out_put = 0 for i in p: out_put += i ** 2 return out_put # f2 完成 def Sch222(x): out_put = 0 out_put01 = 1 for i in x: out_put += abs(i) ...
[ "numpy.abs", "numpy.prod", "numpy.sqrt", "numpy.random.rand", "numpy.ones", "numpy.floor", "numpy.min", "numpy.square", "numpy.exp", "numpy.sum", "numpy.zeros", "numpy.random.seed", "numpy.cos", "numpy.std", "pandas.DataFrame", "time.time" ]
[((78, 96), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (92, 96), True, 'import numpy as np\n'), ((2299, 2316), 'numpy.zeros', 'np.zeros', (['(2, 10)'], {}), '((2, 10))\n', (2307, 2316), True, 'import numpy as np\n'), ((2325, 2343), 'numpy.zeros', 'np.zeros', (['(10, 30)'], {}), '((10, 30))\n', (23...
import sys import pygame as pg import numpy as np import random import time pic = np.zeros(shape=(128,64)) width = 128 height = 64 refresh_rate = 60 interval = 1 / refresh_rate bootrom_file = "bootrom0" rom_file = "rom" # rom_file = "hello_world" debug = False pg.display.init() display = pg.display.set_mode((width*4...
[ "pygame.display.init", "pygame.Surface", "pygame.event.get", "pygame.display.set_mode", "pygame.display.flip", "pygame.Rect", "numpy.zeros", "sys.stdin.buffer.read", "sys.stdout.flush", "time.time", "random.randint", "pygame.transform.scale" ]
[((83, 108), 'numpy.zeros', 'np.zeros', ([], {'shape': '(128, 64)'}), '(shape=(128, 64))\n', (91, 108), True, 'import numpy as np\n'), ((264, 281), 'pygame.display.init', 'pg.display.init', ([], {}), '()\n', (279, 281), True, 'import pygame as pg\n'), ((292, 354), 'pygame.display.set_mode', 'pg.display.set_mode', (['(w...
#Import modules import os import pandas as pd import numpy as np from pandas import DatetimeIndex import dask import scipy import time import glob import torch import torch.nn as nn from live_plotter import live_plotter import matplotlib.pyplot as plt from mpl_toolkits import mplot3d from functools impo...
[ "pytorchModel.Functional_encoder", "numpy.reshape", "numpy.ones", "torch.tensor", "pytorchModel.Code", "numpy.expand_dims", "torch.isnan", "torch.cat" ]
[((1146, 1197), 'pytorchModel.Functional_encoder', 'pytorchModel.Functional_encoder', (['(self.nbFactors + 1)'], {}), '(self.nbFactors + 1)\n', (1177, 1197), False, 'import pytorchModel\n'), ((2399, 2428), 'torch.tensor', 'torch.tensor', (['batch[0].values'], {}), '(batch[0].values)\n', (2411, 2428), False, 'import tor...
import pytest import numpy as np import itertools from numpy.testing import assert_allclose from keras_contrib.utils.test_utils import layer_test, keras_test from keras.utils.conv_utils import conv_input_length from keras import backend as K from keras_contrib import backend as KC from keras_contrib.layers import conv...
[ "keras.backend.image_data_format", "numpy.random.random", "numpy.asarray", "keras_contrib.utils.test_utils.layer_test", "keras.backend.floatx", "pytest.main", "keras.models.Sequential", "keras_contrib.layers.convolutional.CosineConvolution2D", "keras_contrib.backend.depth_to_space", "keras.backend...
[((427, 438), 'keras.backend.backend', 'K.backend', ([], {}), '()\n', (436, 438), True, 'from keras import backend as K\n'), ((2581, 2593), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2591, 2593), False, 'from keras.models import Sequential\n'), ((2917, 2934), 'numpy.asarray', 'np.asarray', (['[1.0]'], ...
import numpy as np import matplotlib.pyplot as plt import cv2 import time def getTransformMatrix(origin, destination): x = np.zeros(origin.shape[0] + 1) # insert [0]-element for better indexing -> x[1] = first element x[1:] = origin[:,0] y = np.copy(x) y[1:] = origin[:,1] x_ = np.copy(x) x_[1...
[ "numpy.copy", "matplotlib.pyplot.imread", "numpy.array", "numpy.zeros", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((129, 158), 'numpy.zeros', 'np.zeros', (['(origin.shape[0] + 1)'], {}), '(origin.shape[0] + 1)\n', (137, 158), True, 'import numpy as np\n'), ((256, 266), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (263, 266), True, 'import numpy as np\n'), ((301, 311), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (308, 311), T...
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
[ "tempfile.TemporaryDirectory", "collections.OrderedDict", "numpy.allclose", "onnxruntime.SessionOptions", "oneflow.FunctionConfig", "numpy.abs", "os.path.join", "onnxruntime.InferenceSession", "oneflow.random_uniform_initializer", "oneflow.train.CheckPoint", "numpy.random.uniform", "oneflow.on...
[((927, 950), 'oneflow.train.CheckPoint', 'flow.train.CheckPoint', ([], {}), '()\n', (948, 950), True, 'import oneflow as flow\n'), ((1396, 1425), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1423, 1425), False, 'import tempfile\n'), ((1629, 1658), 'tempfile.TemporaryDirectory', 'tem...
# -*- coding: utf-8 -*- # Copyright © 2018 PyHelp Project Contributors # https://github.com/jnsebgosselin/pyhelp # # This file is part of PyHelp. # Licensed under the terms of the GNU General Public License. # ---- Standard Library Imports import os import os.path as osp # ---- Third Party imports import numpy as ...
[ "pyhelp.weather_reader.save_airtemp_to_HELP", "pandas.read_csv", "numpy.hstack", "numpy.array", "pyhelp.processing.run_help_allcells", "numpy.save", "numpy.arange", "os.path.exists", "os.listdir", "numpy.where", "netCDF4.Dataset", "pyhelp.weather_reader.read_cweeds_file", "numpy.max", "num...
[((18515, 18539), 'pandas.read_csv', 'pd.read_csv', (['path_togrid'], {}), '(path_togrid)\n', (18526, 18539), True, 'import pandas as pd\n'), ((18571, 18596), 'os.path.basename', 'osp.basename', (['path_togrid'], {}), '(path_togrid)\n', (18583, 18596), True, 'import os.path as osp\n'), ((1587, 1629), 'os.path.join', 'o...
import ctypes as ct import time import copy import numpy as np import sharpy.aero.utils.mapping as mapping import sharpy.utils.cout_utils as cout import sharpy.utils.solver_interface as solver_interface import sharpy.utils.controller_interface as controller_interface from sharpy.utils.solver_interface import solver, ...
[ "sharpy.utils.algebra.unit_vector", "sharpy.utils.cout_utils.TablePrinter", "sharpy.utils.cout_utils.cout_wrap", "numpy.log10", "sharpy.utils.exceptions.NotConvergedSolver", "sharpy.utils.controller_interface.initialise_controller", "sharpy.utils.settings.SettingsTable", "time.perf_counter", "numpy....
[((6294, 6318), 'sharpy.utils.settings.SettingsTable', 'settings.SettingsTable', ([], {}), '()\n', (6316, 6318), True, 'import sharpy.utils.settings as settings\n'), ((26759, 26795), 'sharpy.utils.algebra.unit_vector', 'algebra.unit_vector', (['tstep.dqdt[-4:]'], {}), '(tstep.dqdt[-4:])\n', (26778, 26795), True, 'impor...
# coding: utf-8 """ Test Pyleecan optimization module using Zitzler–Deb–Thiele's function N. 3 """ import pytest from ....definitions import PACKAGE_NAME from ....Tests.Validation.Machine.SCIM_001 import SCIM_001 from ....Classes.InputCurrent import InputCurrent from ....Classes.MagFEMM import MagFEMM from ....Classes...
[ "numpy.sqrt", "numpy.unique", "numpy.ones", "numpy.where", "matplotlib.image.imread", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.random.uniform", "numpy.sin", "matplotlib.pyplot.subplots" ]
[((3954, 3977), 'numpy.array', 'np.array', (['self.is_valid'], {}), '(self.is_valid)\n', (3962, 3977), True, 'import numpy as np\n'), ((3996, 4018), 'numpy.array', 'np.array', (['self.fitness'], {}), '(self.fitness)\n', (4004, 4018), True, 'import numpy as np\n'), ((4034, 4053), 'numpy.array', 'np.array', (['self.ngen'...
from builder.laikago_task_bullet import LaikagoTaskBullet from builder.laikago_task import InitPose import math import numpy as np ABDUCTION_P_GAIN = 220.0 ABDUCTION_D_GAIN = 0.3 HIP_P_GAIN = 220.0 HIP_D_GAIN = 2.0 KNEE_P_GAIN = 220.0 KNEE_D_GAIN = 2.0 class LaikagoStandImitationBulletBase(LaikagoTaskBullet): de...
[ "numpy.array", "numpy.zeros", "numpy.abs", "numpy.ones" ]
[((2373, 2385), 'numpy.zeros', 'np.zeros', (['(12)'], {}), '(12)\n', (2381, 2385), True, 'import numpy as np\n'), ((1383, 1394), 'numpy.ones', 'np.ones', (['(12)'], {}), '(12)\n', (1390, 1394), True, 'import numpy as np\n'), ((707, 771), 'numpy.array', 'np.array', (['[-10, 30, -75, 10, 30, -75, -10, 50, -75, 10, 50, -7...
import unittest from datetime import date from irLib.marketConvention.dayCount import ACT_ACT from irLib.marketConvention.compounding import annually_k_Spot from irLib.helpers.yieldCurve import yieldCurve, discountCurve, forwardCurve import numpy as np alias_disC = 'disC' alias_forC = 'forC' referenceDate = date(2020...
[ "numpy.ones", "numpy.arange", "numpy.round", "irLib.helpers.yieldCurve.yieldCurve.dF2Forward", "irLib.marketConvention.dayCount.ACT_ACT", "irLib.helpers.yieldCurve.discountCurve", "irLib.helpers.yieldCurve.forwardCurve", "datetime.date", "irLib.helpers.yieldCurve.yieldCurve.spot2Df", "irLib.helper...
[((311, 328), 'datetime.date', 'date', (['(2020)', '(6)', '(26)'], {}), '(2020, 6, 26)\n', (315, 328), False, 'from datetime import date\n'), ((340, 349), 'irLib.marketConvention.dayCount.ACT_ACT', 'ACT_ACT', ([], {}), '()\n', (347, 349), False, 'from irLib.marketConvention.dayCount import ACT_ACT\n'), ((364, 381), 'ir...
__all__ = [ "Dataset", "forgiving_true", "load_config", "log", "make_tdtax_taxonomy", "plot_gaia_density", "plot_gaia_hr", "plot_light_curve_data", "plot_periods", ] from astropy.io import fits import datetime import json import healpy as hp import matplotlib.pyplot as plt import nu...
[ "numpy.log10", "pandas.read_csv", "healpy.mollview", "yaml.load", "numpy.argsort", "numpy.array", "astropy.io.fits.open", "numpy.linalg.norm", "numpy.arange", "numpy.mean", "numpy.histogram", "healpy.projplot", "tensorflow.data.Dataset.from_tensor_slices", "numpy.max", "matplotlib.pyplot...
[((2182, 2198), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (2191, 2198), True, 'import matplotlib.pyplot as plt\n'), ((4337, 4364), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (4343, 4364), True, 'import matplotlib.pyplot as plt\n')...
#!/usr/bin/env python from anti_instagram.AntiInstagram import AntiInstagram from cv_bridge import CvBridge, CvBridgeError from duckietown_msgs.msg import (AntiInstagramTransform, BoolStamped, Segment, SegmentList, Vector2D, FSMState) from duckietown_utils.instantiate_utils import instantiate from duckietown_utils....
[ "duckietown_utils.jpg.image_cv_from_jpg", "cv2.convertScaleAbs", "line_detector.line_detector_plot.drawLines", "numpy.hstack", "rospy.init_node", "duckietown_msgs.msg.Segment", "numpy.array", "line_detector.timekeeper.TimeKeeper", "duckietown_msgs.msg.SegmentList", "anti_instagram.AntiInstagram.An...
[((10551, 10600), 'rospy.init_node', 'rospy.init_node', (['"""line_detector"""'], {'anonymous': '(False)'}), "('line_detector', anonymous=False)\n", (10566, 10600), False, 'import rospy\n'), ((10648, 10696), 'rospy.on_shutdown', 'rospy.on_shutdown', (['line_detector_node.onShutdown'], {}), '(line_detector_node.onShutdo...
"""Copy number detection with CNVkit with specific support for targeted sequencing. http://cnvkit.readthedocs.org """ import copy import math import operator import os import sys import tempfile import subprocess import pybedtools import numpy as np import toolz as tz from bcbio import utils from bcbio.bam import re...
[ "toolz.groupby", "bcbio.structural.annotate.add_genes", "bcbio.variation.bedutils.sort_merge", "numpy.array", "pybedtools.BedTool", "bcbio.pipeline.datadict.get_cores", "copy.deepcopy", "bcbio.variation.vcfutils.get_paired_bams", "bcbio.pipeline.datadict.get_align_bam", "bcbio.pipeline.datadict.ge...
[((2981, 3045), 'bcbio.variation.vcfutils.get_paired_bams', 'vcfutils.get_paired_bams', (["[x['align_bam'] for x in items]", 'items'], {}), "([x['align_bam'] for x in items], items)\n", (3005, 3045), False, 'from bcbio.variation import bedutils, effects, ploidy, population, vcfutils\n'), ((5903, 5935), 'os.path.join', ...
import tensorflow as tf from keras.preprocessing import image from keras.applications.inception_v3 import InceptionV3, preprocess_input, decode_predictions import numpy as np import h5py model = InceptionV3(include_top=True, weights='imagenet', input_tensor=None, input_shape=None) graph = tf.get_default_graph() def ...
[ "keras.applications.inception_v3.preprocess_input", "keras.applications.inception_v3.decode_predictions", "numpy.expand_dims", "keras.applications.inception_v3.InceptionV3", "tensorflow.get_default_graph" ]
[((197, 287), 'keras.applications.inception_v3.InceptionV3', 'InceptionV3', ([], {'include_top': '(True)', 'weights': '"""imagenet"""', 'input_tensor': 'None', 'input_shape': 'None'}), "(include_top=True, weights='imagenet', input_tensor=None,\n input_shape=None)\n", (208, 287), False, 'from keras.applications.incep...
import numpy as np from typing import Any, Iterable, Tuple from .ext import EnvSpec from .parallel import ParallelEnv from ..prelude import Action, Array, State from ..utils.rms import RunningMeanStd class ParallelEnvWrapper(ParallelEnv[Action, State]): def __init__(self, penv: ParallelEnv) -> None: self....
[ "numpy.zeros", "numpy.roll" ]
[((1453, 1504), 'numpy.zeros', 'np.zeros', (['(self.num_envs, *self.shape)'], {'dtype': 'dtype'}), '((self.num_envs, *self.shape), dtype=dtype)\n', (1461, 1504), True, 'import numpy as np\n'), ((1717, 1752), 'numpy.roll', 'np.roll', (['self.obs'], {'shift': '(-1)', 'axis': '(1)'}), '(self.obs, shift=-1, axis=1)\n', (17...
import imutils import cv2 import numpy as np import math from math import sqrt def find_robot_orientation(image): robot = {} robot['angle'] = [] robot['direction'] = [] robotLower = (139, 227, 196) robotUpper = (255, 255, 255) distances = [] # img = cv2.imread('all_color_terrain_with_robot....
[ "cv2.drawContours", "cv2.inRange", "cv2.erode", "cv2.line", "math.degrees", "numpy.argmax", "imutils.is_cv2", "cv2.imshow", "math.sqrt", "cv2.circle", "math.atan2", "cv2.cvtColor", "cv2.moments", "cv2.dilate", "cv2.waitKey", "numpy.float32" ]
[((336, 374), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2HSV'], {}), '(image, cv2.COLOR_BGR2HSV)\n', (348, 374), False, 'import cv2\n'), ((386, 426), 'cv2.inRange', 'cv2.inRange', (['hsv', 'robotLower', 'robotUpper'], {}), '(hsv, robotLower, robotUpper)\n', (397, 426), False, 'import cv2\n'), ((438, 473)...
import numpy as np def load_mnist(): # the data, shuffled and split between train and test sets from keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() x = np.concatenate((x_train, x_test)) y = np.concatenate((y_train, y_test)) x = x.reshape(-1, 28, 28, 1).as...
[ "os.path.exists", "keras.datasets.mnist.load_data", "numpy.array", "numpy.concatenate", "os.system" ]
[((182, 199), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (197, 199), False, 'from keras.datasets import mnist\n'), ((209, 242), 'numpy.concatenate', 'np.concatenate', (['(x_train, x_test)'], {}), '((x_train, x_test))\n', (223, 242), True, 'import numpy as np\n'), ((251, 284), 'numpy.concaten...
""" This module defines a class called "balto_gui" that can be used to create a graphical user interface (GUI) for downloading data from OpenDAP servers from and into a Jupyter notebook. If used with Binder, this GUI runs in a browser window and does not require the user to install anything on their computer. However...
[ "IPython.display.display", "ipywidgets.VBox", "ipywidgets.Dropdown", "ipyleaflet.FullScreenControl", "ipywidgets.BoundedIntText", "datetime.timedelta", "copy.copy", "numpy.arange", "ipywidgets.HBox", "datetime.datetime", "ipywidgets.Button", "balto_plot.show_grid_as_image", "ipywidgets.Outpu...
[((7936, 7952), 'ipywidgets.Output', 'widgets.Output', ([], {}), '()\n', (7950, 7952), True, 'import ipywidgets as widgets\n'), ((7961, 7990), 'IPython.display.display', 'display', (['self.gui', 'gui_output'], {}), '(self.gui, gui_output)\n', (7968, 7990), False, 'from IPython.display import display, HTML\n'), ((9529, ...
__author__ = 'stephen' import numpy as np import scipy.io import scipy.sparse import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.pylab as pylab from .utils import get_subindices import matplotlib.ticker as mtick from collections import Counter from s...
[ "numpy.log10", "matplotlib.pyplot.ylabel", "numpy.log", "numpy.argsort", "numpy.array", "numpy.arange", "matplotlib.pyplot.imshow", "scipy.stats.gaussian_kde", "numpy.where", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.max", "matplotlib.pyplot.close", "matplotlib.pyplot.co...
[((96, 117), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (110, 117), False, 'import matplotlib\n'), ((818, 835), 'numpy.unique', 'np.unique', (['labels'], {}), '(labels)\n', (827, 835), True, 'import numpy as np\n'), ((840, 863), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': '(10...
import cv2 import numpy as np def drawPoint(canvas,x,y): canvas[y,x] = 0 def drawLine(canvas,x1,y1,x2,y2): dx, dy = abs(x2 - x1), abs(y2 - y1) xi, yi = x1, y1 sx, sy = 1 if (x2 - x1) > 0 else -1, 1 if (y2 - y1) > 0 else -1 pi = 2*dy - dx while xi != x2 + 1: if pi < 0: pi +...
[ "cv2.imwrite", "numpy.ones" ]
[((2335, 2366), 'cv2.imwrite', 'cv2.imwrite', (['"""line.png"""', 'canvas'], {}), "('line.png', canvas)\n", (2346, 2366), False, 'import cv2\n'), ((2460, 2493), 'cv2.imwrite', 'cv2.imwrite', (['"""circle.png"""', 'canvas'], {}), "('circle.png', canvas)\n", (2471, 2493), False, 'import cv2\n'), ((2592, 2626), 'cv2.imwri...
import numpy as np import numpy.matlib # soma das matrizes A = np.array([[1,0],[0,2]]) B = np.array([[0,1],[1,0]]) C = A + B print(C) # soma das linhas A = np.array([[1,0],[0,2]]) B = np.array([[0,1],[1,0]]) s_linha = sum(A) print(s_linha) # soma dos elementos A = np.array([[1,0],[0,2]]) B = np.array([[0,1],[1,0]]...
[ "numpy.array", "numpy.linalg.matrix_power", "numpy.matmul", "numpy.linalg.det" ]
[((66, 92), 'numpy.array', 'np.array', (['[[1, 0], [0, 2]]'], {}), '([[1, 0], [0, 2]])\n', (74, 92), True, 'import numpy as np\n'), ((94, 120), 'numpy.array', 'np.array', (['[[0, 1], [1, 0]]'], {}), '([[0, 1], [1, 0]])\n', (102, 120), True, 'import numpy as np\n'), ((161, 187), 'numpy.array', 'np.array', (['[[1, 0], [0...
import numpy as np import scipy import matplotlib.pyplot as plt import sys def compute_r_squared(data, predictions): ''' In exercise 5, we calculated the R^2 value for you. But why don't you try and and calculate the R^2 value yourself. Given a list of original data points, and also a li...
[ "numpy.sum" ]
[((804, 837), 'numpy.sum', 'np.sum', (['((data - predictions) ** 2)'], {}), '((data - predictions) ** 2)\n', (810, 837), True, 'import numpy as np\n'), ((849, 875), 'numpy.sum', 'np.sum', (['((data - mean) ** 2)'], {}), '((data - mean) ** 2)\n', (855, 875), True, 'import numpy as np\n')]
from sklearn import preprocessing, svm from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn import cross_validation import pandas as pd import numpy as np import quandl import math df = quandl.get('WIKI/GOOGL') df = df[['Adj. Open', 'Adj. High', 'Adj. Lo...
[ "numpy.array", "quandl.get", "sklearn.cross_validation.train_test_split", "sklearn.linear_model.LinearRegression", "sklearn.preprocessing.scale" ]
[((250, 274), 'quandl.get', 'quandl.get', (['"""WIKI/GOOGL"""'], {}), "('WIKI/GOOGL')\n", (260, 274), False, 'import quandl\n'), ((826, 847), 'numpy.array', 'np.array', (["df['label']"], {}), "(df['label'])\n", (834, 847), True, 'import numpy as np\n'), ((852, 874), 'sklearn.preprocessing.scale', 'preprocessing.scale',...
import datetime import os import yaml import numpy as np import pandas as pd import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from scipy.integrate import solve_ivp from scipy.optimize import minimize import plotly.graph_objs as go ENV_F...
[ "pandas.read_csv", "numpy.arange", "dash_core_components.RadioItems", "dash_core_components.Input", "dash.dependencies.Output", "os.path.join", "yaml.load", "dash.dependencies.Input", "dash_core_components.Dropdown", "dash_html_components.Label", "datetime.date", "dash_core_components.Markdown...
[((530, 622), 'os.path.join', 'os.path.join', (['ROOT_DIR', "params['directories']['processed']", "params['files']['all_data']"], {}), "(ROOT_DIR, params['directories']['processed'], params['files'][\n 'all_data'])\n", (542, 622), False, 'import os\n'), ((1497, 1527), 'dash.Dash', 'dash.Dash', (['"""C0VID-19 Explore...
import pytest from astropy.io import fits import numpy as np from lightkurve.io.kepseismic import read_kepseismic_lightcurve from lightkurve.io.detect import detect_filetype @pytest.mark.remote_data def test_detect_kepseismic(): """Can we detect the correct format for KEPSEISMIC files?""" url = "https://arch...
[ "lightkurve.io.kepseismic.read_kepseismic_lightcurve", "lightkurve.io.detect.detect_filetype", "numpy.sum", "astropy.io.fits.open" ]
[((461, 475), 'astropy.io.fits.open', 'fits.open', (['url'], {}), '(url)\n', (470, 475), False, 'from astropy.io import fits\n'), ((878, 909), 'lightkurve.io.kepseismic.read_kepseismic_lightcurve', 'read_kepseismic_lightcurve', (['url'], {}), '(url)\n', (904, 909), False, 'from lightkurve.io.kepseismic import read_keps...
#!/usr/bin/env python # coding: utf-8 # In[1]: from __future__ import absolute_import, division, print_function import argparse import logging import os import random import sys from io import open import numpy as np import torch import json from torch.utils.data import (DataLoader, SequentialSampler, RandomSampl...
[ "logging.getLogger", "models.modeling_bert.Config.from_json_file", "ray.tune.track.log", "apex.amp.scale_loss", "utils.korquad_utils.RawResult", "torch.cuda.device_count", "io.open", "ray.tune.grid_search", "apex.amp.initialize", "torch.cuda.is_available", "ray.init", "os.path.exists", "json...
[((887, 1030), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=...
import torch from lib.utils import is_parallel import numpy as np np.set_printoptions(threshold=np.inf) import cv2 from sklearn.cluster import DBSCAN def build_targets(cfg, predictions, targets, model, bdd=True): ''' predictions [16, 3, 32, 32, 85] [16, 3, 16, 16, 85] [16, 3, 8, 8, 85] torch.t...
[ "lib.utils.is_parallel", "numpy.polyfit", "torch.max", "numpy.array", "torch.arange", "numpy.mean", "numpy.asarray", "numpy.linspace", "numpy.polyval", "torch.zeros_like", "torch.ones_like", "cv2.polylines", "cv2.morphologyEx", "cv2.cvtColor", "torch.cat", "numpy.set_printoptions", "...
[((66, 103), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (85, 103), True, 'import numpy as np\n'), ((1059, 1095), 'torch.ones', 'torch.ones', (['(7)'], {'device': 'targets.device'}), '(7, device=targets.device)\n', (1069, 1095), False, 'import torch\n'), ((361...
""" ckwg +31 Copyright 2016 by Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the ...
[ "vital.types.eigen.EigenArray.from_iterable", "numpy.allclose", "vital.types.eigen.EigenArray.c_ptr_type", "vital.types.eigen.EigenArray", "vital.util.VitalErrorHandle" ]
[((3614, 3676), 'vital.types.eigen.EigenArray.from_iterable', 'EigenArray.from_iterable', (['principle_point'], {'target_shape': '(2, 1)'}), '(principle_point, target_shape=(2, 1))\n', (3638, 3676), False, 'from vital.types.eigen import EigenArray\n'), ((4645, 4689), 'vital.types.eigen.EigenArray.c_ptr_type', 'EigenArr...
import numpy as np import util.data def ndcg(X_test, y_test, y_pred, ): Xy_pred = X_test.copy([['srch_id', 'prop_id', 'score']]) Xy_pred['score_pred'] = y_pred Xy_pred['score'] = y_test Xy_pred.sort_values(['srch_id', 'score_pred'], ascending=[True, False]) dcg_test = DCG_dict(Xy_pred) ndcg = ...
[ "numpy.asfarray", "numpy.arange" ]
[((683, 697), 'numpy.asfarray', 'np.asfarray', (['r'], {}), '(r)\n', (694, 697), True, 'import numpy as np\n'), ((790, 814), 'numpy.arange', 'np.arange', (['(2)', '(r.size + 1)'], {}), '(2, r.size + 1)\n', (799, 814), True, 'import numpy as np\n'), ((881, 905), 'numpy.arange', 'np.arange', (['(2)', '(r.size + 2)'], {})...
from __future__ import division import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import matplotlib.ticker as mticker import gsd import gsd.fl import numpy as np import os import sys import datetime import time import pickle from shutil import copyfile import inspect import md_tools...
[ "numpy.sqrt", "numpy.log", "matplotlib.ticker.ScalarFormatter", "matplotlib.rc", "os.walk", "numpy.mean", "md_tools27.correct_jumps", "numpy.where", "matplotlib.pyplot.close", "numpy.dot", "os.path.isdir", "numpy.linalg.lstsq", "numpy.ones", "matplotlib.use", "pickle.load", "inspect.cu...
[((59, 73), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (66, 73), True, 'import matplotlib as mpl\n'), ((880, 949), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'serif', 'serif': ['Computer Modern Roman']})\n", (882, 949), False, 'from matplotlib import rc\n'), ((947, 970), 'ma...
#!/usr/bin/env python3 import matplotlib matplotlib.use('pgf') import matplotlib.pyplot as plt import numpy as np from multi_isotope_calculator import Multi_isotope import plotsettings as ps plt.style.use('seaborn-darkgrid') plt.rcParams.update(ps.tex_fonts()) def main(): plot() #figure5() def figure1(): ...
[ "plotsettings.set_size", "matplotlib.pyplot.savefig", "matplotlib.use", "multi_isotope_calculator.Multi_isotope", "plotsettings.tex_fonts", "matplotlib.pyplot.style.use", "matplotlib.pyplot.close", "matplotlib.pyplot.rcParams.update", "numpy.argsort", "numpy.empty", "matplotlib.pyplot.tight_layo...
[((42, 63), 'matplotlib.use', 'matplotlib.use', (['"""pgf"""'], {}), "('pgf')\n", (56, 63), False, 'import matplotlib\n'), ((194, 227), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-darkgrid"""'], {}), "('seaborn-darkgrid')\n", (207, 227), True, 'import matplotlib.pyplot as plt\n'), ((248, 262), 'plotse...
#!/usr/bin/env python3 import datetime import time import os import matplotlib.pyplot as plt import matplotlib.dates as md import numpy as np class handle_data: data_file = "./data/data.log" data_list = [] def __init__(self): pass def insert_data(self, timestamp, temp, state_onoff, state_light, state_cool...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.close", "datetime.datetime.now", "numpy.genfromtxt", "matplotlib.pyplot.subplots" ]
[((1935, 2190), 'numpy.genfromtxt', 'np.genfromtxt', (['self.data_file'], {'delimiter': '""";"""', 'skip_header': '(1)', 'names': "['Time', 'Temp', 'Onoff', 'Light', 'Cooling', 'Heating']", 'dtype': "[('Time', '<U30'), ('Temp', '<f8'), ('Onoff', '<f8'), ('Light', '<f8'), (\n 'Cooling', '<f8'), ('Heating', '<f8')]"})...
""" This is a simple application for sentence embeddings: clustering Sentences are mapped to sentence embeddings and then agglomerative clustering with a threshold is applied. """ from sentence_transformers import SentenceTransformer from sklearn.cluster import AgglomerativeClustering import numpy as np embedder = Se...
[ "sklearn.cluster.AgglomerativeClustering", "sentence_transformers.SentenceTransformer", "numpy.linalg.norm" ]
[((318, 364), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['"""paraphrase-MiniLM-L6-v2"""'], {}), "('paraphrase-MiniLM-L6-v2')\n", (337, 364), False, 'from sentence_transformers import SentenceTransformer\n'), ((1165, 1229), 'sklearn.cluster.AgglomerativeClustering', 'AgglomerativeClustering', ...
import pandas as pd wine = pd.read_csv('https://bit.ly/wine-date') # wine = pd.read_csv('../data/wine.csv') print(wine.head()) data = wine[['alcohol', 'sugar', 'pH']].to_numpy() target = wine['class'].to_numpy() from sklearn.model_selection import train_test_split train_input, test_input, train_target, test_target ...
[ "scipy.stats.randint", "numpy.mean", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.model_selection.cross_validate", "sklearn.tree.DecisionTreeClassifier", "scipy.stats.uniform", "numpy.argmax", "numpy.max", "sklearn.model_selection.StratifiedKFold", "numpy.arange" ]
[((28, 67), 'pandas.read_csv', 'pd.read_csv', (['"""https://bit.ly/wine-date"""'], {}), "('https://bit.ly/wine-date')\n", (39, 67), True, 'import pandas as pd\n'), ((322, 384), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'target'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(data, t...
# Module to build a potential landscape import numpy as np def gauss(x,mean=0.0,stddev=0.02,peak=1.0): ''' Input: x : x-coordintes Output: f(x) where f is a Gaussian with the given mean, stddev and peak value ''' stddev = 5*(x[1] - x[0]) return peak*np.exp(-(x-mean)**2/(2*stddev**2)) d...
[ "numpy.exp", "numpy.zeros", "numpy.random.rand" ]
[((659, 684), 'numpy.random.rand', 'np.random.rand', (['(n_dot + 1)'], {}), '(n_dot + 1)\n', (673, 684), True, 'import numpy as np\n'), ((747, 758), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (755, 758), True, 'import numpy as np\n'), ((283, 327), 'numpy.exp', 'np.exp', (['(-(x - mean) ** 2 / (2 * stddev ** 2))']...
import sys, os, seaborn as sns, rasterio, pandas as pd import numpy as np import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from config.definitions import ROOT_DIR, ancillary_path, city,year attr_value ="totalpop" gtP = ROOT_DIR + "/Evaluation/{0}_groundT...
[ "seaborn.lmplot", "matplotlib.pyplot.ylabel", "numpy.where", "rasterio.open", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "matplotlib.pyplot.axis", "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "os.path.abspath", "matplo...
[((378, 396), 'rasterio.open', 'rasterio.open', (['gtP'], {}), '(gtP)\n', (391, 396), False, 'import sys, os, seaborn as sns, rasterio, pandas as pd\n'), ((789, 806), 'rasterio.open', 'rasterio.open', (['cp'], {}), '(cp)\n', (802, 806), False, 'import sys, os, seaborn as sns, rasterio, pandas as pd\n'), ((1003, 1021), ...
import numpy as np import pytest import nengo from nengo.builder import Builder from nengo.builder.operator import Reset, Copy from nengo.builder.signal import Signal from nengo.dists import UniformHypersphere from nengo.exceptions import ValidationError from nengo.learning_rules import LearningRuleTypeParam, PES, BCM...
[ "nengo.learning_rules.BCM", "nengo.dists.Uniform", "nengo.processes.WhiteSignal", "nengo.Node", "numpy.array", "numpy.var", "numpy.linalg.norm", "numpy.arange", "nengo.builder.operator.Copy", "nengo.builder.operator.Reset", "nengo.Ensemble", "numpy.where", "numpy.asarray", "nengo.learning_...
[((7196, 7245), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""weights"""', '[False, True]'], {}), "('weights', [False, True])\n", (7219, 7245), False, 'import pytest\n'), ((11392, 11467), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""learning_rule"""', '[nengo.PES, nengo.BCM, nengo.Oja]'], {...
import numpy as np from django.core.management.base import BaseCommand from oscar.core.loading import get_classes StatsSpe, StatsItem, Test, Speciality, Item, Conference = get_classes( 'confs.models', ( "StatsSpe", "StatsItem", "Test", "Speciality", "Item", "Conference" ) ) class Command(BaseCo...
[ "numpy.mean", "numpy.median", "oscar.core.loading.get_classes", "numpy.std" ]
[((175, 277), 'oscar.core.loading.get_classes', 'get_classes', (['"""confs.models"""', "('StatsSpe', 'StatsItem', 'Test', 'Speciality', 'Item', 'Conference')"], {}), "('confs.models', ('StatsSpe', 'StatsItem', 'Test', 'Speciality',\n 'Item', 'Conference'))\n", (186, 277), False, 'from oscar.core.loading import get_c...
import matplotlib.pyplot as plt import numpy as np from ipywidgets import interactive, interactive_output, fixed, HBox, VBox import ipywidgets as widgets def true_function_old(x): x_copy = -1 * x f = 2 * x_copy * np.sin(0.8*x_copy) + 0.5 * x_copy**2 - 5 return f def sigmoid(x, L=10, k=2, x_0=20): re...
[ "numpy.exp", "numpy.sin", "numpy.random.RandomState" ]
[((717, 752), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (738, 752), True, 'import numpy as np\n'), ((334, 356), 'numpy.exp', 'np.exp', (['(-k * (x - x_0))'], {}), '(-k * (x - x_0))\n', (340, 356), True, 'import numpy as np\n'), ((223, 243), 'numpy.sin', 'np.sin', (...
#!/usr/bin/env python import os import sys import jieba import numpy as np jieba.setLogLevel(60) # quiet fname = sys.argv[1] with open(fname) as f: text = f.read() tokenizer = jieba.Tokenizer() tokens = list(tokenizer.cut(text)) occurences = np.array([tokenizer.FREQ[w] for w in tokens if w in tokenizer.FREQ])...
[ "numpy.mean", "matplotlib.pyplot.hist", "matplotlib.pyplot.gca", "numpy.array", "os.path.basename", "numpy.percentile", "jieba.setLogLevel", "jieba.Tokenizer", "matplotlib.pyplot.show" ]
[((77, 98), 'jieba.setLogLevel', 'jieba.setLogLevel', (['(60)'], {}), '(60)\n', (94, 98), False, 'import jieba\n'), ((186, 203), 'jieba.Tokenizer', 'jieba.Tokenizer', ([], {}), '()\n', (201, 203), False, 'import jieba\n'), ((252, 320), 'numpy.array', 'np.array', (['[tokenizer.FREQ[w] for w in tokens if w in tokenizer.F...
#!/usr/bin/env python # coding: utf-8 # # Self-Driving Car Engineer Nanodegree # # # ## Project: **Finding Lane Lines on the Road** # *** # In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and...
[ "matplotlib.image.imread", "numpy.array", "matplotlib.pyplot.imshow", "os.path.exists", "os.listdir", "cv2.line", "cv2.addWeighted", "moviepy.editor.VideoFileClip", "cv2.fillPoly", "matplotlib.pyplot.subplot", "cv2.cvtColor", "matplotlib.pyplot.title", "cv2.GaussianBlur", "cv2.Canny", "m...
[((3572, 3619), 'matplotlib.image.imread', 'mpimg.imread', (['"""test_images/solidWhiteRight.jpg"""'], {}), "('test_images/solidWhiteRight.jpg')\n", (3584, 3619), True, 'import matplotlib.image as mpimg\n'), ((3729, 3746), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image'], {}), '(image)\n', (3739, 3746), True, 'impo...
import numpy from scipy.spatial import distance import matplotlib.pyplot as plt import math import matplotlib.ticker as mtick freqs = [20, 25, 31.5, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500] def cosine_distance(a, b, we...
[ "scipy.spatial.distance.cosine", "numpy.sqrt", "matplotlib.pyplot.show", "numpy.average", "matplotlib.ticker.PercentFormatter", "math.sqrt", "numpy.asarray", "numpy.any", "numpy.square", "numpy.rot90", "matplotlib.pyplot.subplots", "numpy.arange", "numpy.atleast_1d" ]
[((3222, 3247), 'numpy.rot90', 'numpy.rot90', (['ref_spectrum'], {}), '(ref_spectrum)\n', (3233, 3247), False, 'import numpy\n'), ((3266, 3293), 'numpy.rot90', 'numpy.rot90', (['test1_spectrum'], {}), '(test1_spectrum)\n', (3277, 3293), False, 'import numpy\n'), ((3312, 3339), 'numpy.rot90', 'numpy.rot90', (['test2_spe...
# -*- coding: utf-8 -*- """ Created on Sat May 21 17:05:48 2022 @author: <NAME> """ import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, balanced_accuracy_score, confusion_matrix from ibllib.atlas import BrainRegions from joblib import l...
[ "matplotlib.pyplot.hist", "sklearn.metrics.balanced_accuracy_score", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.imshow", "seaborn.despine", "model_functions.load_channel_data", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "sklearn.metrics.confusion_matrix"...
[((450, 464), 'ibllib.atlas.BrainRegions', 'BrainRegions', ([], {}), '()\n', (462, 464), False, 'from ibllib.atlas import BrainRegions\n'), ((658, 677), 'model_functions.load_channel_data', 'load_channel_data', ([], {}), '()\n', (675, 677), False, 'from model_functions import load_channel_data, load_trained_model\n'), ...
import struct import numpy as np import pandas as pd df_train = pd.read_csv('../data/train_data.csv') df_valid = pd.read_csv('../data/valid_data.csv') df_test = pd.read_csv('../data/test_data.csv') with open('result.dat', 'rb') as f: N, = struct.unpack('i', f.read(4)) no_dims, = struct.unpack('i', f.read(4)) ...
[ "numpy.array", "numpy.savez", "pandas.read_csv" ]
[((65, 102), 'pandas.read_csv', 'pd.read_csv', (['"""../data/train_data.csv"""'], {}), "('../data/train_data.csv')\n", (76, 102), True, 'import pandas as pd\n'), ((114, 151), 'pandas.read_csv', 'pd.read_csv', (['"""../data/valid_data.csv"""'], {}), "('../data/valid_data.csv')\n", (125, 151), True, 'import pandas as pd\...
import pygame; import numpy as np; from math import sin, cos; pygame.init(); width, height, depth = 640, 480, 800; camera = [width // 2, height // 2, depth]; units_x, units_y, units_z = 8, 8, 8; scale_x, scale_y, scale_z = width / units_x, height / units_y, depth / units_z; screen = pygame.display.set_mode((width, he...
[ "pygame.key.set_repeat", "pygame.display.set_caption", "pygame.draw.polygon", "pygame.init", "pygame.quit", "pygame.event.get", "pygame.display.set_mode", "pygame.display.flip", "math.cos", "numpy.array", "pygame.draw.rect", "pygame.time.Clock", "math.sin" ]
[((62, 75), 'pygame.init', 'pygame.init', ([], {}), '()\n', (73, 75), False, 'import pygame\n'), ((286, 326), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width, height)'], {}), '((width, height))\n', (309, 326), False, 'import pygame\n'), ((328, 388), 'pygame.display.set_caption', 'pygame.display.set_capt...
import pytest from easydict import EasyDict import numpy as np import gym from copy import deepcopy from ding.envs.env import check_array_space, check_different_memory, check_all, demonstrate_correct_procedure from ding.envs.env.tests import DemoEnv @pytest.mark.unittest def test_an_implemented_env(): demo_env =...
[ "ding.envs.env.tests.DemoEnv", "ding.envs.env.demonstrate_correct_procedure", "gym.spaces.Box", "numpy.array", "pytest.raises", "ding.envs.env.check_array_space", "ding.envs.env.check_different_memory", "copy.deepcopy", "ding.envs.env.check_all" ]
[((321, 332), 'ding.envs.env.tests.DemoEnv', 'DemoEnv', (['{}'], {}), '({})\n', (328, 332), False, 'from ding.envs.env.tests import DemoEnv\n'), ((337, 356), 'ding.envs.env.check_all', 'check_all', (['demo_env'], {}), '(demo_env)\n', (346, 356), False, 'from ding.envs.env import check_array_space, check_different_memor...
import sys sys.path.insert(0, '/home/hena/caffe-ocr/buildcmake/install/python') sys.path.insert(0, '/home/hena/tool/protobuf-3.1.0/python') import caffe import math import numpy as np def SoftMax(net_ans): tmp_net = [math.exp(i) for i in net_ans] sum_exp = sum(tmp_net) return [i/sum_exp for i in tmp_net] ...
[ "numpy.sum", "math.exp", "sys.path.insert", "numpy.zeros_like" ]
[((11, 79), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/hena/caffe-ocr/buildcmake/install/python"""'], {}), "(0, '/home/hena/caffe-ocr/buildcmake/install/python')\n", (26, 79), False, 'import sys\n'), ((80, 139), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/hena/tool/protobuf-3.1.0/python"""'],...
""" Tools for creating and working with Line (Station) Grids """ from typing import Union import pyproj import numpy as np _atype = Union[type(None), np.ndarray] _ptype = Union[type(None), pyproj.Proj] class StaHGrid: """ Stations Grid EXAMPLES: -------- >>> x = arange(8) >>> y = arange(8...
[ "numpy.isnan", "numpy.any", "numpy.ma.masked_where" ]
[((690, 702), 'numpy.any', 'np.any', (['mask'], {}), '(mask)\n', (696, 702), True, 'import numpy as np\n'), ((653, 664), 'numpy.isnan', 'np.isnan', (['x'], {}), '(x)\n', (661, 664), True, 'import numpy as np\n'), ((667, 678), 'numpy.isnan', 'np.isnan', (['y'], {}), '(y)\n', (675, 678), True, 'import numpy as np\n'), ((...
import numpy as np from ..reco.disp import disp_vector import astropy.units as u import matplotlib.pyplot as plt from ctapipe.visualization import CameraDisplay __all__ = [ 'overlay_disp_vector', 'overlay_hillas_major_axis', 'overlay_source', 'display_dl1_event', ] def display_dl1_event(event, camera_...
[ "matplotlib.pyplot.subplots", "numpy.isfinite", "ctapipe.visualization.CameraDisplay", "numpy.arange" ]
[((1019, 1078), 'ctapipe.visualization.CameraDisplay', 'CameraDisplay', (['camera_geometry', 'image'], {'ax': 'axes[0]'}), '(camera_geometry, image, ax=axes[0], **kwargs)\n', (1032, 1078), False, 'from ctapipe.visualization import CameraDisplay\n'), ((1120, 1183), 'ctapipe.visualization.CameraDisplay', 'CameraDisplay',...
import numpy as np import random from scipy.stats import skew as scipy_skew from skimage.transform import resize as skimage_resize from QFlow import config ## set of functions for loading and preparing a dataset for training. def get_num_min_class(labels): ''' Get the number of the minimum represented class i...
[ "numpy.copy", "numpy.mean", "numpy.random.default_rng", "random.Random", "numpy.argmax", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.einsum", "numpy.concatenate", "numpy.std", "numpy.expand_dims", "numpy.gradient", "numpy.ravel", "skimage.transform.resize", "numpy.load" ]
[((558, 584), 'numpy.argmax', 'np.argmax', (['labels'], {'axis': '(-1)'}), '(labels, axis=-1)\n', (567, 584), True, 'import numpy as np\n'), ((1729, 1756), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (1750, 1756), True, 'import numpy as np\n'), ((2684, 2723), 'numpy.concatenate', 'n...
''' This file implements various optimization methods, including -- SGD with gradient norm clipping -- AdaGrad -- AdaDelta -- Adam Transparent to switch between CPU / GPU. @author: <NAME> (<EMAIL>) ''' import random from collections import OrderedDict import numpy as np i...
[ "theano.tensor.Lop", "collections.OrderedDict", "theano.tensor.sqrt", "theano.tensor.minimum", "numpy.float64", "theano.tensor.sqr", "theano.tensor.set_subtensor", "theano.tensor.inc_subtensor", "theano.tensor.grad" ]
[((1566, 1580), 'theano.tensor.sqrt', 'T.sqrt', (['g_norm'], {}), '(g_norm)\n', (1572, 1580), True, 'import theano.tensor as T\n'), ((8330, 8361), 'theano.tensor.Lop', 'T.Lop', (['gparams', 'params', 'samples'], {}), '(gparams, params, samples)\n', (8335, 8361), True, 'import theano.tensor as T\n'), ((1419, 1439), 'the...
import sys from pathlib import Path import numpy as np import pandas as pd from bokeh.models import ColumnDataSource from bokeh.io import export_png from bokeh.plotting import figure def plot_lifetime(df, type, path): df = df.copy() palette = ["#c9d9d3", "#718dbf", "#e84d60", "#648450"] ylist = [] ...
[ "numpy.abs", "numpy.mean", "bokeh.plotting.figure", "pandas.merge", "bokeh.models.ColumnDataSource", "pandas.DataFrame", "pandas.concat", "numpy.arange" ]
[((1241, 1365), 'bokeh.plotting.figure', 'figure', ([], {'x_range': 'ylist', 'plot_height': '(250)', 'plot_width': '(1500)', 'title': "('Employment Status by age: West Germany / type: ' + type)"}), "(x_range=ylist, plot_height=250, plot_width=1500, title=\n 'Employment Status by age: West Germany / type: ' + type)\n...
import unittest import numpy as np import openjij as oj import cxxjij as cj def calculate_ising_energy(h, J, spins): energy = 0.0 for (i, j), Jij in J.items(): energy += Jij*spins[i]*spins[j] for i, hi in h.items(): energy += hi * spins[i] return energy def calculate_qubo_energy(Q, ...
[ "openjij.cast_var_type", "openjij.ChimeraModel", "openjij.BinaryQuadraticModel", "openjij.BinaryQuadraticModel.from_qubo", "openjij.KingGraph", "numpy.array", "openjij.KingGraph.from_qubo", "openjij.ChimeraModel.from_qubo", "unittest.main", "numpy.testing.assert_array_equal" ]
[((8441, 8456), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8454, 8456), False, 'import unittest\n'), ((534, 558), 'openjij.cast_var_type', 'oj.cast_var_type', (['"""SPIN"""'], {}), "('SPIN')\n", (550, 558), True, 'import openjij as oj\n'), ((617, 643), 'openjij.cast_var_type', 'oj.cast_var_type', (['"""BINARY...
from __future__ import print_function import os, sys import pickle import time import glob import numpy as np import torch from model import PVSE from loss import cosine_sim, order_sim from vocab import Vocabulary from data import get_test_loader from logger import AverageMeter from option import parser, verify_input...
[ "model.PVSE", "numpy.median", "numpy.where", "torch.load", "numpy.tensordot", "pickle.load", "torch.cuda.device_count", "torch.nn.DataParallel", "torch.Tensor", "os.path.isfile", "numpy.argsort", "data.get_test_loader", "torch.cuda.is_available", "numpy.zeros", "numpy.dot", "numpy.arra...
[((7270, 7298), 'data.get_test_loader', 'get_test_loader', (['args', 'vocab'], {}), '(args, vocab)\n', (7285, 7298), False, 'from data import get_test_loader\n'), ((10374, 10399), 'os.path.isfile', 'os.path.isfile', (['args.ckpt'], {}), '(args.ckpt)\n', (10388, 10399), False, 'import os, sys\n'), ((10410, 10436), 'mode...
""" Model select class1 single allele models. """ import argparse import os import signal import sys import time import traceback import random from functools import partial from pprint import pprint import numpy import pandas from scipy.stats import kendalltau, percentileofscore, pearsonr from sklearn.metrics import ...
[ "os.path.exists", "scipy.stats.percentileofscore", "random.shuffle", "pandas.DataFrame", "argparse.ArgumentParser", "pandas.read_csv", "traceback.print_stack", "numpy.log", "sklearn.metrics.roc_auc_score", "pandas.concat", "os.mkdir", "os.getpid", "functools.partial", "os.path.abspath", ...
[((1157, 1195), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '__doc__'}), '(usage=__doc__)\n', (1180, 1195), False, 'import argparse\n'), ((5568, 5604), 'os.path.abspath', 'os.path.abspath', (['args.out_models_dir'], {}), '(args.out_models_dir)\n', (5583, 5604), False, 'import os\n'), ((12260, 1...
############################################################ # Copyright 2019 <NAME> # Licensed under the new BSD (3-clause) license: # # https://opensource.org/licenses/BSD-3-Clause ############################################################ ############################################################ # # Initial se...
[ "matplotlib.pyplot.gca", "matplotlib.pyplot.plot", "math.sqrt", "scipy.stats.norm.rvs", "math.log", "numpy.random.seed", "math.exp", "scipy.stats.uniform.rvs", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((2453, 2484), 'numpy.random.seed', 'numpy.random.seed', ([], {'seed': '(8675309)'}), '(seed=8675309)\n', (2470, 2484), False, 'import numpy\n'), ((3493, 3513), 'scipy.stats.norm.rvs', 'stats.norm.rvs', (['(0)', '(3)'], {}), '(0, 3)\n', (3507, 3513), True, 'import scipy.stats as stats\n'), ((3535, 3555), 'scipy.stats....