code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: UTF-8 -*-
"""
@author: <NAME> (<EMAIL>)
@author: <NAME> (<EMAIL>)
@author: <NAME> (<EMAIL>)
Politecnico di Milano 2018
"""
import os
from glob import glob
from multiprocessing import cpu_count, Pool
import numpy as np
from PIL import Image
import time
import prnu
import sys
import matplotlib.pyplot as p... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.bar",
"glob.glob",
"matplotlib.pyplot.gca",
"numpy.unique",
"prnu.crosscorr_2d",
"prnu.extract_multiple_aligned",
"prnu.gt",
"prnu.extract_single",
"prnu.pce",
"matplotlib.pyplot.xticks",
"numpy.stack",
"matplotlib.pypl... | [((351, 512), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This program extracts camera fingerprint using VDNet and VDID and compares them with the original implementation"""'}), "(description=\n 'This program extracts camera fingerprint using VDNet and VDID and compares them with t... |
import logging
import numpy as np
LOGGER = logging.getLogger(__name__)
def top_n_accuracy(y_pred, y_true, n):
"""
y_pred: prediction, np.array with shape of n x c which n is instances and c is the number of class
y_true: groudtruth label, np.array with shape of n x c which n is instances and c is the num... | [
"numpy.argsort",
"logging.getLogger"
] | [((45, 72), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (62, 72), False, 'import logging\n'), ((405, 431), 'numpy.argsort', 'np.argsort', (['y_pred'], {'axis': '(1)'}), '(y_pred, axis=1)\n', (415, 431), True, 'import numpy as np\n')] |
import numpy as np
import scipy.signal as ss
def simulation(data, params=[1.0, 0.15, 250, 0.055,
0.055, 0.04, 0.7, 3.0,
1.5, 120, 1.0, 0.0,
5.0, 0.7, 0.05, 0.1]):
'''
Implementation of HBV model (Bergstrom, 1986)
Input... | [
"sys.path.append",
"wfdei_to_lumped_dataframe.dataframe_construction",
"scipy.signal.lfilter",
"pandas.read_csv",
"metrics.NS",
"numpy.where",
"pandas.concat",
"numpy.round",
"scipy.signal.butter"
] | [((9992, 10020), 'sys.path.append', 'sys.path.append', (['"""../tools/"""'], {}), "('../tools/')\n", (10007, 10020), False, 'import sys\n'), ((3699, 3730), 'numpy.where', 'np.where', (['(Temp > parTT)', 'Prec', '(0)'], {}), '(Temp > parTT, Prec, 0)\n', (3707, 3730), True, 'import numpy as np\n'), ((3742, 3774), 'numpy.... |
import numpy as np
import torch
class MyDataset(torch.utils.data.Dataset):
def __init__(self, X, Y):
'Initialization'
self.X = X
self.Y = Y
def __len__(self):
'Denotes the total number of samples'
return len(self.X)
def __getitem__(self, index):
'Generates one s... | [
"numpy.random.seed",
"numpy.max",
"numpy.mean",
"numpy.array",
"numpy.min",
"torch.tensor"
] | [((472, 492), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (486, 492), True, 'import numpy as np\n'), ((878, 898), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (892, 898), True, 'import numpy as np\n'), ((1482, 1497), 'numpy.mean', 'np.mean', (['losses'], {}), '(losses)\n', (... |
import numpy as np
from numba import jit
@jit
def diff_u(un,uvis,uvis_x,uvis_y,nx,ny,dx,dy,dt,ep,ep_x,cw):
for i in np.arange(1,nx+1):
for j in np.arange(1,ny+1):
uvis_x[i,j]=ep[i,j]*(un[i,j]-un[i-1,j])/dx
uvis_x[0]=uvis_x[1]; uvis_x[nx+1]=uvis_x[nx]
for i in np.arange(0,nx... | [
"numpy.arange"
] | [((124, 144), 'numpy.arange', 'np.arange', (['(1)', '(nx + 1)'], {}), '(1, nx + 1)\n', (133, 144), True, 'import numpy as np\n'), ((306, 326), 'numpy.arange', 'np.arange', (['(0)', '(nx + 1)'], {}), '(0, nx + 1)\n', (315, 326), True, 'import numpy as np\n'), ((530, 546), 'numpy.arange', 'np.arange', (['(1)', 'nx'], {})... |
"""
Log parser for simulator JSON logs.
Connects to the spectator socket and reads JSON objects in a child process.
Selected events are extracted for each car and sent to Redis using the car id as key.
"""
from collections import defaultdict
from multiprocessing import Process, Queue
import contextlib
import json
impor... | [
"redis.Redis",
"math.isnan",
"robotini_ddpg.simulator.connection.connect",
"robotini_ddpg.util.join_or_terminate",
"json.JSONDecoder",
"json.dumps",
"collections.defaultdict",
"numpy.array",
"multiprocessing.Queue",
"signal.signal",
"multiprocessing.Process"
] | [((1048, 1065), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1059, 1065), False, 'from collections import defaultdict\n'), ((2624, 2668), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal.SIG_IGN'], {}), '(signal.SIGINT, signal.SIG_IGN)\n', (2637, 2668), False, 'import signal\n'), (... |
import numpy as np
from simulation.test_estimator_templates import test_lg_cv_estimator, test_skf_cv_estimator, test_skf_rw_estimator
from simulation.generate_path_templates import create_path_constant_volocity_one_model, create_path_constant_volocity_multi_model, create_path_random_walk_multi_model
# Create a testing... | [
"simulation.test_estimator_templates.test_skf_cv_estimator",
"simulation.generate_path_templates.create_path_random_walk_multi_model",
"simulation.generate_path_templates.create_path_constant_volocity_multi_model",
"numpy.array",
"simulation.test_estimator_templates.test_skf_rw_estimator"
] | [((418, 597), 'simulation.generate_path_templates.create_path_constant_volocity_multi_model', 'create_path_constant_volocity_multi_model', ([], {'q': '[1.0, 6.0]', 'r': '[0.75, 0.5]', 't': '(200)', 'change_pnt': '[100]', 'state_dim': '(4)', 'obs_dim': '(2)', 'output_measurements': 'None', 'output_groundtruth': 'None'})... |
from .BaseModel import BaseModel
from .Function import Function
from .utils import *
import numpy as np
from numpy.polynomial.polynomial import polyfit
from sklearn.metrics import mean_squared_error
class PolynomialModel(BaseModel):
def __init__(self):
pass
def get_model_name(self):
return "... | [
"numpy.polyval",
"numpy.polynomial.polynomial.polyfit",
"sklearn.metrics.mean_squared_error"
] | [((831, 864), 'numpy.polynomial.polynomial.polyfit', 'polyfit', (['x0', 'y0', 'complexity_level'], {}), '(x0, y0, complexity_level)\n', (838, 864), False, 'from numpy.polynomial.polynomial import polyfit\n'), ((929, 955), 'sklearn.metrics.mean_squared_error', 'mean_squared_error', (['y0', 'y1'], {}), '(y0, y1)\n', (947... |
"""Predefined robot models."""
import numpy as np # type: ignore
def kuka_lbr_iiwa_7() -> np.ndarray: # pragma: no cover
"""Get KUKA LBR iiwa 7 MDH model."""
return np.array(
[
[0, 0, 0, 340],
[-np.pi / 2, 0, 0, 0],
[np.pi / 2, 0, 0, 400],
[np.pi / 2, ... | [
"numpy.array"
] | [((177, 354), 'numpy.array', 'np.array', (['[[0, 0, 0, 340], [-np.pi / 2, 0, 0, 0], [np.pi / 2, 0, 0, 400], [np.pi / 2,\n 0, 0, 0], [-np.pi / 2, 0, 0, 400], [-np.pi / 2, 0, 0, 0], [np.pi / 2, 0,\n 0, 126]]'], {}), '([[0, 0, 0, 340], [-np.pi / 2, 0, 0, 0], [np.pi / 2, 0, 0, 400], [\n np.pi / 2, 0, 0, 0], [-np.p... |
import plotly.graph_objs as go
from _plotly_utils.basevalidators import ColorscaleValidator
from ._core import apply_default_cascade
import numpy as np
_float_types = []
# Adapted from skimage.util.dtype
_integer_types = (
np.byte,
np.ubyte, # 8 bits
np.short,
np.ushort, # 16 bits
np.intc,
n... | [
"numpy.isscalar",
"numpy.asanyarray",
"numpy.iinfo",
"plotly.graph_objs.Image",
"numpy.isfinite",
"_plotly_utils.basevalidators.ColorscaleValidator",
"plotly.graph_objs.Heatmap",
"plotly.graph_objs.Figure"
] | [((4235, 4253), 'numpy.asanyarray', 'np.asanyarray', (['img'], {}), '(img)\n', (4248, 4253), True, 'import numpy as np\n'), ((6128, 6164), 'plotly.graph_objs.Figure', 'go.Figure', ([], {'data': 'trace', 'layout': 'layout'}), '(data=trace, layout=layout)\n', (6137, 6164), True, 'import plotly.graph_objs as go\n'), ((597... |
import numpy as np
import torch
def compute_nme(preds, target, normalize=False):
if isinstance(preds, torch.Tensor):
preds = preds.cpu().numpy()
is_visible = target[:, :, 2] == 2
preds = preds[:, :, :2]
target = target[:, :, :2]
N = preds.shape[0]
L = preds.shape[1]
rmse = np.zer... | [
"numpy.linalg.norm",
"numpy.zeros",
"numpy.sum"
] | [((314, 325), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (322, 325), True, 'import numpy as np\n'), ((451, 476), 'numpy.linalg.norm', 'np.linalg.norm', (['(pred - gt)'], {}), '(pred - gt)\n', (465, 476), True, 'import numpy as np\n'), ((572, 585), 'numpy.sum', 'np.sum', (['_rmse'], {}), '(_rmse)\n', (578, 585), T... |
import matplotlib.pyplot as plt
import obspy
import os
from obspy import read,UTCDateTime
from obspy.signal.trigger import recursive_sta_lta, trigger_onset, classic_sta_lta
import warnings
import numpy as np
from obspy import UTCDateTime
year = 2016
mon = 10
day = 14
date = str(year)+str(mon)+str(day)+'/'
def main(... | [
"obspy.signal.trigger.trigger_onset",
"os.makedirs",
"os.path.exists",
"numpy.array",
"obspy.UTCDateTime",
"obspy.read"
] | [((4315, 4332), 'numpy.array', 'np.array', (['charfct'], {}), '(charfct)\n', (4323, 4332), True, 'import numpy as np\n'), ((334, 354), 'os.path.exists', 'os.path.exists', (['date'], {}), '(date)\n', (348, 354), False, 'import os\n'), ((364, 381), 'os.makedirs', 'os.makedirs', (['date'], {}), '(date)\n', (375, 381), Fal... |
# coding: utf-8
import os
import torch
import random
import logging
import numpy as np
import pandas as pd
from models import algorithms
import matplotlib.pyplot as plt
import torch.nn.functional as F
logger = logging.getLogger('OoD' + __name__)
def split_data(
train_data, test_data=None, batch_size=1024, v... | [
"matplotlib.pyplot.title",
"os.mkdir",
"numpy.load",
"numpy.random.seed",
"numpy.floor",
"matplotlib.pyplot.figure",
"numpy.arange",
"glob.glob",
"torch.no_grad",
"os.path.join",
"pandas.DataFrame",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.imshow",
"os.path.exists",
"numpy.trans... | [((212, 247), 'logging.getLogger', 'logging.getLogger', (["('OoD' + __name__)"], {}), "('OoD' + __name__)\n", (229, 247), False, 'import logging\n'), ((485, 505), 'numpy.arange', 'np.arange', (['n_samples'], {}), '(n_samples)\n', (494, 505), True, 'import numpy as np\n'), ((510, 536), 'numpy.random.shuffle', 'np.random... |
import matplotlib.pyplot as plt
import numpy as np
import scipy
pos = range(-8, 9)
pos2 = range(-5, 6)
pos3 = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2]
fig,ax=plt.subplots()
sphere_raw = []
f = open('/Users/lm579/Projects/arctk/output/Raman_weight_highres_sphere_2mm.txt','r')
for line in f:
sphere_raw.append(float... | [
"numpy.sum",
"matplotlib.pyplot.show",
"numpy.std",
"numpy.mean",
"matplotlib.pyplot.subplots"
] | [((159, 173), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (171, 173), True, 'import matplotlib.pyplot as plt\n'), ((2479, 2489), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2487, 2489), True, 'import matplotlib.pyplot as plt\n'), ((2009, 2035), 'numpy.sum', 'np.sum', (['weightings_1_gro... |
import os
import argparse
import multiprocessing as mp
import torch
import torch.nn as nn
import pytorch_lightning as pl
import numpy as np
from tqdm import tqdm
from omegaconf import OmegaConf, DictConfig
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import DataLoader
import torch_pointnet.... | [
"pytorch_lightning.metrics.accuracy",
"torch_pointnet.models.PointNetClassifier",
"torch_pointnet.losses.PointNetLoss",
"numpy.random.seed",
"pytorch_lightning.Trainer",
"argparse.ArgumentParser",
"torch.manual_seed",
"omegaconf.OmegaConf.load",
"torch_pointnet.transforms.train_transforms",
"torch... | [((523, 540), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (537, 540), True, 'import numpy as np\n'), ((541, 561), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (558, 561), False, 'import torch\n'), ((2024, 2113), 'torch_pointnet.models.PointNetClassifier', 'PointNetClassifier', ([... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import sys
import typing
from functools import reduce
import numpy as np
from openvino.preprocess import PrePostProcessor
from openvino.runtime import (Core, Layout, Mo... | [
"numpy.argsort",
"numpy.ndarray",
"openvino.runtime.set_batch",
"openvino.runtime.Model",
"openvino.runtime.opset8.add",
"openvino.runtime.opset8.matmul",
"openvino.runtime.opset1.max_pool",
"openvino.runtime.opset8.reshape",
"openvino.preprocess.PrePostProcessor",
"openvino.runtime.opset8.relu",
... | [((713, 754), 'numpy.fromfile', 'np.fromfile', (['model_path'], {'dtype': 'np.float32'}), '(model_path, dtype=np.float32)\n', (724, 754), True, 'import numpy as np\n'), ((1200, 1293), 'openvino.runtime.opset8.convolution', 'opset8.convolution', (['param_node', 'conv_1_kernel', '[1, 1]', 'padding_begin', 'padding_end', ... |
import typing as tp
import cirq
import numpy as np
import sympy
class CircuitLayerBuilder:
"""Create a densely connected quantum neural network layer,
where each input qubit is connected to the output qubit with a gate."""
def __init__(self, data_qubits, readout):
self.data_qubits = data_qubits
... | [
"cirq.GridQubit.rect",
"cirq.GridQubit",
"cirq.H",
"cirq.Circuit",
"cirq.X",
"cirq.Z",
"numpy.ndarray.flatten"
] | [((893, 918), 'numpy.ndarray.flatten', 'np.ndarray.flatten', (['image'], {}), '(image)\n', (911, 918), True, 'import numpy as np\n'), ((932, 965), 'cirq.GridQubit.rect', 'cirq.GridQubit.rect', (['*image.shape'], {}), '(*image.shape)\n', (951, 965), False, 'import cirq\n'), ((980, 994), 'cirq.Circuit', 'cirq.Circuit', (... |
import numpy as np
import random
class BoxProposalModule(object):
def __init__(self, *args, **kwargs):
self.MinimapRatio = kwargs.get('MinimapRatio', 2) # we down-sample the normal boundary map to save computation cost
self.min_box_size = kwargs.get('min_box_size', 64) // self.MinimapRatio
... | [
"numpy.sum",
"random.randint",
"random.shuffle",
"random.random",
"numpy.array"
] | [((4706, 4724), 'random.shuffle', 'random.shuffle', (['hs'], {}), '(hs)\n', (4720, 4724), False, 'import random\n'), ((4869, 4887), 'random.shuffle', 'random.shuffle', (['ws'], {}), '(ws)\n', (4883, 4887), False, 'import random\n'), ((5832, 5857), 'random.shuffle', 'random.shuffle', (['Proposals'], {}), '(Proposals)\n'... |
import numpy as np
import math
import os
import time
from typing import List, Dict
class Dataset:
def __init__(self, config, E, B, N, distr_scheme, drop_last_iter, seed):
self.config = config
if self.config['synthetic']:
self.D = self.config['synthetic_params']['samples']
else... | [
"numpy.random.seed",
"math.ceil",
"numpy.empty",
"os.path.getsize",
"os.path.exists",
"math.floor",
"os.path.isfile",
"numpy.random.permutation",
"os.path.join",
"os.listdir"
] | [((1720, 1753), 'numpy.empty', 'np.empty', (['(num * epochs)'], {'dtype': 'int'}), '(num * epochs, dtype=int)\n', (1728, 1753), True, 'import numpy as np\n'), ((5034, 5050), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (5044, 5050), False, 'import os\n'), ((529, 549), 'numpy.random.seed', 'np.random.seed', (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Provide the Cartesian Position constraint.
The bilateral inequality cartesian position constraint is given by:
.. math:: x_{lb} \leq x + J(q) \dot{q} * dt \leq x_{ub}
where :math:`x_{lb}, x_{ub}` are the lower and upper bound on the cartesian positions of a given dis... | [
"numpy.asarray"
] | [((5128, 5145), 'numpy.asarray', 'np.asarray', (['bound'], {}), '(bound)\n', (5138, 5145), True, 'import numpy as np\n'), ((6030, 6047), 'numpy.asarray', 'np.asarray', (['bound'], {}), '(bound)\n', (6040, 6047), True, 'import numpy as np\n')] |
from typing import Optional
from anndata import AnnData
import numpy as np
from scipy.sparse.csr import csr_matrix
import pandas as pd
from ._weighting_matrix import (
calculate_weight_matrix,
impute_neighbour,
_WEIGHTING_MATRIX,
_PLATFORM,
)
def SME_normalize(
adata: AnnData,
use_data: str = ... | [
"numpy.array"
] | [((1999, 2036), 'numpy.array', 'np.array', (['[count_embed, imputed_data]'], {}), '([count_embed, imputed_data])\n', (2007, 2036), True, 'import numpy as np\n')] |
# Licensed under an MIT style license -- see LICENSE.md
from pesummary.core.plots.bounded_1d_kde import Bounded_1d_kde, bounded_1d_kde
from pesummary.core.plots.bounded_2d_kde import Bounded_2d_kde
from scipy.stats import gaussian_kde
import numpy as np
import pytest
__author__ = ["<NAME> <<EMAIL>>"]
class TestBoun... | [
"numpy.random.uniform",
"scipy.stats.gaussian_kde",
"pesummary.core.plots.bounded_2d_kde.Bounded_2d_kde",
"pytest.raises",
"pesummary.core.plots.bounded_1d_kde.Bounded_1d_kde",
"pesummary.core.plots.bounded_1d_kde.bounded_1d_kde"
] | [((537, 558), 'scipy.stats.gaussian_kde', 'gaussian_kde', (['samples'], {}), '(samples)\n', (549, 558), False, 'from scipy.stats import gaussian_kde\n'), ((577, 626), 'pesummary.core.plots.bounded_1d_kde.Bounded_1d_kde', 'Bounded_1d_kde', (['samples'], {'xlow': 'x_low', 'xhigh': 'x_high'}), '(samples, xlow=x_low, xhigh... |
# Copyright 2019 Inspur Corporation. 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 ... | [
"data.SSD.BaseTransform",
"data.SSD.VOCAnnotationTransform",
"torch.utils.data.DataLoader",
"numpy.float32",
"torchvision.transforms.ToTensor",
"torch.Tensor",
"numpy.array",
"numpy.swapaxes",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"os.path.join",
"cv2.resize"... | [((1130, 1145), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (1138, 1145), True, 'import numpy as np\n'), ((1362, 1390), 'cv2.resize', 'cv2.resize', (['imgFloat', '(w, h)'], {}), '(imgFloat, (w, h))\n', (1372, 1390), False, 'import cv2\n'), ((1597, 1623), 'numpy.swapaxes', 'np.swapaxes', (['imgProc', '(0)',... |
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
def np_load(fname):
return np.load(fname, allow_pickle=True)
get_entropy = lambda x: float(x[x.index('entropy_')+8:x.index('.npy')])
def get_files(model, dataset):
filepath = f"saved_models/{model}/{dataset}/"
nextlevel = os.listd... | [
"numpy.load",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.tight_layout",
"os.listdir",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.grid"
] | [((3119, 3137), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (3131, 3137), True, 'import matplotlib.pyplot as plt\n'), ((3735, 3753), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (3747, 3753), True, 'import matplotlib.pyplot as plt\n'), ((3988, 4006)... |
__author__ = '<NAME>'
import numpy as np
import math
def slow_dtw(base_list, test_list, extended=False):
""" Computes the DTW of two sequences.
:param base_list: np array [0..b]
:param test_list: np array [0..t]
:param extended: bool
"""
b = base_list.shape[0]
t = test_list... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"math.sqrt",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linalg.norm",
"matplotlib.pyplot.tigh... | [((2881, 2908), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (2891, 2908), True, 'import matplotlib.pyplot as plt\n'), ((3022, 3042), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(3)', '(1)'], {}), '(2, 3, 1)\n', (3033, 3042), True, 'import matplotlib.pyplot as... |
import numpy as np
from sklearn.model_selection import train_test_split
class KnnClassifier(object):
def __init__(self, X: np.ndarray, y: np.ndarray):
self.X = X
self.y = y
self.X_train: np.ndarray = None
self.X_test: np.ndarray = None
self.y_train: np.ndarray = None
... | [
"numpy.std",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.apply_along_axis",
"numpy.mean",
"numpy.array"
] | [((405, 420), 'numpy.mean', 'np.mean', (['vector'], {}), '(vector)\n', (412, 420), True, 'import numpy as np\n'), ((434, 448), 'numpy.std', 'np.std', (['vector'], {}), '(vector)\n', (440, 448), True, 'import numpy as np\n'), ((464, 509), 'numpy.array', 'np.array', (['[((x - mean) / sd) for x in vector]'], {}), '([((x -... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 7 21:01:56 2020
@author: <NAME>
"""
import os
import torch
import tqdm
import numpy as np
import scipy.sparse as sp
from scipy.sparse import linalg
##############################################################################
def get_adjacency_matrix(distance_... | [
"numpy.nan_to_num",
"numpy.isnan",
"numpy.mean",
"numpy.float_power",
"numpy.maximum.reduce",
"os.path.join",
"torch.isnan",
"scipy.sparse.eye",
"numpy.power",
"torch.FloatTensor",
"scipy.sparse.coo_matrix",
"scipy.sparse.identity",
"numpy.repeat",
"torch.mean",
"scipy.sparse.diags",
"... | [((860, 914), 'numpy.zeros', 'np.zeros', (['(num_sensors, num_sensors)'], {'dtype': 'np.float32'}), '((num_sensors, num_sensors), dtype=np.float32)\n', (868, 914), True, 'import numpy as np\n'), ((2068, 2086), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['adj'], {}), '(adj)\n', (2081, 2086), True, 'import scipy.sparse... |
from typing import Optional, Tuple
import cv2
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.path import Path
from matplotlib.widgets import LassoSelector
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
... | [
"pandas.DataFrame",
"cv2.equalizeHist",
"matplotlib.pyplot.show",
"cv2.bitwise_not",
"pandas.pivot_table",
"cv2.waitKey",
"cv2.imwrite",
"pandas.merge",
"cv2.imread",
"matplotlib.path.Path",
"matplotlib.use",
"numpy.tile",
"cv2.destroyWindow",
"cv2.createCLAHE",
"pandas.melt",
"cv2.res... | [((2260, 2274), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (2271, 2274), False, 'import cv2\n'), ((2279, 2305), 'cv2.destroyWindow', 'cv2.destroyWindow', (['"""Image"""'], {}), "('Image')\n", (2296, 2305), False, 'import cv2\n'), ((2310, 2324), 'cv2.waitKey', 'cv2.waitKey', (['(1)'], {}), '(1)\n', (2321, 232... |
#-*- coding: utf8
'''
IO code for prediction tasks. Here we have the methods to convert the
json code csv, which is faster to load / process using pandas.
'''
from __future__ import division, print_function
from config import DATAFRAME_FOLDER
from config import TRAIN_FOLDER
from config import TEST_FOLDER
from collect... | [
"sklearn.preprocessing.LabelBinarizer",
"json.load",
"numpy.log",
"pandas.DataFrame.from_dict",
"os.path.basename",
"pandas.DataFrame.from_csv",
"numpy.hstack",
"glob.glob",
"collections.OrderedDict",
"numpy.vstack",
"os.path.join",
"numpy.unique"
] | [((1461, 1484), 'numpy.log', 'np.log', (['(1 + vals_visits)'], {}), '(1 + vals_visits)\n', (1467, 1484), True, 'import numpy as np\n'), ((1504, 1528), 'numpy.log', 'np.log', (['(1 + vals_twitter)'], {}), '(1 + vals_twitter)\n', (1510, 1528), True, 'import numpy as np\n'), ((1549, 1574), 'numpy.log', 'np.log', (['(1 + v... |
"""
Copyright 2019 Samsung SDS
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 applic... | [
"brightics.common.utils.get_default_from_parameters_if_required",
"brightics.common.repr.BrtcReprBuilder",
"brightics.common.repr.pandasDF2MD",
"brightics.common.validation.from_to",
"numpy.array",
"pandas.DataFrame.from_records",
"brightics.common.utils.check_required_parameters",
"brightics.common.v... | [((1211, 1283), 'brightics.common.utils.get_default_from_parameters_if_required', 'get_default_from_parameters_if_required', (['params', '_ftest_for_stacked_data'], {}), '(params, _ftest_for_stacked_data)\n', (1250, 1283), False, 'from brightics.common.utils import get_default_from_parameters_if_required\n'), ((1367, 1... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.tri as mtri
# u, v are parameterisation variables
u = (np.linspace(0, 2.0 * np.pi, endpoint=True, num=50) * np.ones((10, 1))).flatten()
v = np.repeat(np.linspace(-0.5, 0.5, endpoint=True, num=10), repeats=50).f... | [
"matplotlib.pyplot.show",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.sin",
"numpy.linspace",
"matplotlib.tri.Triangulation",
"numpy.cos",
"numpy.repeat"
] | [((603, 627), 'matplotlib.tri.Triangulation', 'mtri.Triangulation', (['u', 'v'], {}), '(u, v)\n', (621, 627), True, 'import matplotlib.tri as mtri\n'), ((635, 647), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (645, 647), True, 'import matplotlib.pyplot as plt\n'), ((988, 1026), 'numpy.linspace', 'np.lin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
def learningCurve(X, y, Xval, yval, _lambda):
# LEARNINGCURVE Generates the train and cross validation set errors needed
# to plot a learning curve
# [error_train, error_val] = ...
# LEARNINGCURVE(X, y, Xval, yval, lambda ) returns the ... | [
"numpy.shape",
"ex5_regularized_linear_regressionand_bias_vs_variance.trainLinearReg.trainLinearReg",
"ex5_regularized_linear_regressionand_bias_vs_variance.linearRegCostFunction.linearRegCostFunction"
] | [((848, 859), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (856, 859), True, 'import numpy as np\n'), ((2623, 2671), 'ex5_regularized_linear_regressionand_bias_vs_variance.trainLinearReg.trainLinearReg', 'trainLinearReg', (['X[:i + 1, :]', 'y[:i + 1]', '_lambda'], {}), '(X[:i + 1, :], y[:i + 1], _lambda)\n', (2637,... |
import argparse
import time
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import pickle as pc
import data
import model
import copy
import random
import os
parser = argparse.ArgumentParser(description='PyTorch PCE Model Active Learning')
parser.add_argument('-... | [
"model.PCE_four_way",
"argparse.ArgumentParser",
"data.Active_Data",
"torch.LongTensor",
"torch.manual_seed",
"torch.autograd.Variable",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"numpy.zeros",
"torch.nn.functional.softmax",
"torch.optim.Adam",
"random.seed",
"torch.max"
] | [((223, 295), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch PCE Model Active Learning"""'}), "(description='PyTorch PCE Model Active Learning')\n", (246, 295), False, 'import argparse\n'), ((1199, 1222), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (1216... |
#!/usr/bin/env python3
from __future__ import division
import rospy
import sys
import message_filters
import cv2
import numpy as np
from sensor_msgs.msg import Image
from sensor_msgs.msg import CameraInfo
from sensor_msgs.point_cloud2 import PointCloud2
from nav_msgs.msg import Odometry
import sensor_msgs.point_cloud2... | [
"cv2.GaussianBlur",
"rospy.logerr",
"rospy.Subscriber",
"cv2.approxPolyDP",
"cv2.arcLength",
"tf2_geometry_msgs.do_transform_pose",
"rospy.Time",
"sensor_msgs.point_cloud2.read_points",
"imutils.resize",
"cv2.erode",
"cv2.minAreaRect",
"rospy.Duration",
"geometry_msgs.msg.PoseStamped",
"cv... | [((801, 811), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (809, 811), False, 'from cv_bridge import CvBridge\n'), ((845, 918), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/small_scout_1/points2"""', 'PointCloud2', 'self.pc_callback'], {}), "('/small_scout_1/points2', PointCloud2, self.pc_callback)\n", (861, 9... |
"""
Unit tests for SINDy class.
Note: all tests should be encapsulated in functions whose
names start with "test_"
To run all tests for this package, navigate to the top-level
directory and execute the following command:
pytest
To run tests for just one file, run
pytest file_to_test.py
"""
import numpy as np
import... | [
"numpy.count_nonzero",
"pysindy.feature_library.PolynomialLibrary",
"pytest.warns",
"sklearn.linear_model.ElasticNet",
"pytest.lazy_fixture",
"pysindy.optimizers.SR3",
"sklearn.utils.validation.check_is_fitted",
"pysindy.optimizers.STLSQ",
"pytest.raises",
"pysindy.SINDy",
"pysindy.feature_libra... | [((12035, 12157), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params, warning"""', "[({'threshold': 100}, UserWarning), ({'max_iter': 1}, ConvergenceWarning)]"], {}), "('params, warning', [({'threshold': 100},\n UserWarning), ({'max_iter': 1}, ConvergenceWarning)])\n", (12058, 12157), False, 'import ... |
import time
import numpy as np
import matplotlib.pyplot as plt
from skimage.restoration import estimate_sigma
class ExecutionTimer:
def __init__(self, f):
self._f = f
def __call__(self, *args, **kwargs):
self._start = time.time()
self._result = self._f(*args, **kwargs)
self._e... | [
"numpy.pad",
"numpy.zeros_like",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"numpy.multiply",
"numpy.abs",
"numpy.subtract",
"numpy.std",
"skimage.util.random_noise",
"numpy.zeros",
"time.time",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.subplots",
"skimage.restorat... | [((2693, 2710), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '(im)\n', (2706, 2710), True, 'import numpy as np\n'), ((2757, 2821), 'numpy.pad', 'np.pad', (['im', '((offset, offset), (offset, offset))'], {'mode': '"""reflect"""'}), "(im, ((offset, offset), (offset, offset)), mode='reflect')\n", (2763, 2821), True,... |
# -*- coding: utf-8 -*-
import platform
import numpy as np
import pytest
from qutip import (
Qobj, tensor, fock_dm, basis, destroy, qdiags, sigmax, sigmay, sigmaz,
qeye, rand_ket, rand_super_bcsz, rand_ket_haar, rand_dm_ginibre, rand_dm,
rand_unitary, rand_unitary_haar, to_super, to_choi, kraus_to_choi,
... | [
"qutip.hellinger_dist",
"qutip.rand_dm",
"qutip.qip.operations.hadamard_transform",
"qutip.unitarity",
"qutip.rand_unitary_haar",
"pytest.mark.skipif",
"qutip.rand_super_bcsz",
"numpy.exp",
"pytest.mark.parametrize",
"qutip.destroy",
"qutip.to_super",
"qutip.fock_dm",
"qutip.rand_ket_haar",
... | [((689, 753), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'params': '[2, 5, 10, 15, 25, 100]'}), "(scope='function', params=[2, 5, 10, 15, 25, 100])\n", (703, 753), False, 'import pytest\n'), ((10810, 10967), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(cvxpy is None or cvxopt is None)'], {'... |
"""
Random collection of utilities for the robots to use
"""
import numpy as np
def get_rotation_from_homogeneous_transform(transform):
"""Extract the rotation section of the homogeneous transformation
:param transform: The 4x4 homogeneous transform to extract the
rotation matrix from.... | [
"numpy.ones",
"numpy.zeros",
"numpy.identity",
"numpy.hstack"
] | [((935, 949), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (946, 949), True, 'import numpy as np\n'), ((1048, 1065), 'numpy.hstack', 'np.hstack', (['(T, p)'], {}), '((T, p))\n', (1057, 1065), True, 'import numpy as np\n'), ((972, 986), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (980, 986), True,... |
from typing import Optional, Tuple
from numpy import floor
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.compass import compass
from gdsfactory.components.via import via1, viac
from gdsfactory.tech import LAYER
from gdsfactory.types import ComponentOrFactory, Layer
@g... | [
"gdsfactory.partial",
"numpy.floor",
"gdsfactory.components.compass.compass",
"gdsfactory.component.Component"
] | [((2927, 2990), 'gdsfactory.partial', 'gf.partial', (['contact_slot'], {'layers': '(LAYER.M1, LAYER.M2)', 'via': 'via1'}), '(contact_slot, layers=(LAYER.M1, LAYER.M2), via=via1)\n', (2937, 2990), True, 'import gdsfactory as gf\n'), ((3015, 3069), 'gdsfactory.partial', 'gf.partial', (['contact_slot'], {'layers': '(LAYER... |
from __future__ import print_function, absolute_import
from importlib import import_module
from distutils import sysconfig
from distutils import version
from distutils.core import Extension
import distutils.command.build_ext
import glob
import multiprocessing
import os
import platform
import re
import subprocess
from... | [
"imp.reload",
"sys.platform.startswith",
"gi.repository.Gtk.get_micro_version",
"setup_external_compile.tar_extract",
"os.popen",
"subprocess.getstatusoutput",
"os.path.isfile",
"glob.glob",
"ConfigParser.ConfigParser",
"os.path.join",
"subprocess.check_call",
"shutil.copy",
"versioneer.get_... | [((2460, 2502), 'os.environ.get', 'os.environ.get', (['"""MPLSETUPCFG"""', '"""setup.cfg"""'], {}), "('MPLSETUPCFG', 'setup.cfg')\n", (2474, 2502), False, 'import os\n'), ((2506, 2531), 'os.path.exists', 'os.path.exists', (['setup_cfg'], {}), '(setup_cfg)\n', (2520, 2531), False, 'import os\n'), ((652, 684), 'os.enviro... |
import cv2
import numpy as np
def BoundCon(HazeImg, A, C0, C1, windowSze):
if(len(HazeImg.shape) == 3):
t_b = np.maximum((A[0] - HazeImg[:, :, 0].astype(np.float)) / (A[0] - C0),
(HazeImg[:, :, 0].astype(np.float) - A[0]) / (C1 - A[0]))
t_g = np.maximum((A[1] - HazeImg[:, :... | [
"cv2.morphologyEx",
"numpy.minimum",
"numpy.maximum",
"numpy.ones"
] | [((928, 969), 'numpy.ones', 'np.ones', (['(windowSze, windowSze)', 'np.float'], {}), '((windowSze, windowSze), np.float)\n', (935, 969), True, 'import numpy as np\n'), ((989, 1051), 'cv2.morphologyEx', 'cv2.morphologyEx', (['transmission', 'cv2.MORPH_CLOSE'], {'kernel': 'kernel'}), '(transmission, cv2.MORPH_CLOSE, kern... |
"""
ISBI 2012 Simple 2D Multicut Pipeline
======================================
Here we segment neuro data as in :cite:`beier_17_multicut`.
In fact, this is a simplified version of :cite:`beier_17_multicut`.
We start from an distance transform watershed
over-segmentation.
We compute a RAG and features for all edges.... | [
"numpy.abs",
"numpy.maximum",
"numpy.clip",
"os.path.isfile",
"pylab.figure",
"pylab.tight_layout",
"nifty.graph.rag.gridRag",
"nifty.segmentation.localMaximaSeeds",
"nifty.graph.rag.projectScalarNodeDataToPixels",
"pylab.title",
"nifty.segmentation.seededWatersheds",
"pylab.imshow",
"nifty.... | [((8398, 8448), 'numpy.concatenate', 'numpy.concatenate', (["trainingSet['features']"], {'axis': '(0)'}), "(trainingSet['features'], axis=0)\n", (8415, 8448), False, 'import numpy\n'), ((8458, 8506), 'numpy.concatenate', 'numpy.concatenate', (["trainingSet['labels']"], {'axis': '(0)'}), "(trainingSet['labels'], axis=0)... |
"""
Unit tests for the class NNModifier in nn_modifiers.py
-- <EMAIL>
"""
# pylint: disable=invalid-name
from copy import deepcopy
import numpy as np
import os
import six
from shutil import rmtree
# Local imports
from nn import nn_constraint_checkers
from nn import nn_modifiers
from nn.neural_network import Neura... | [
"copy.deepcopy",
"nn.nn_modifiers.NNModifier",
"nn.nn_constraint_checkers.MLPConstraintChecker",
"utils.base_test_class.execute_tests",
"os.path.exists",
"numpy.all",
"nn.nn_constraint_checkers.CNNConstraintChecker",
"unittest_neural_network.generate_mlp_architectures",
"shutil.rmtree",
"six.iteri... | [((1776, 1792), 'copy.deepcopy', 'deepcopy', (['old_nn'], {}), '(old_nn)\n', (1784, 1792), False, 'from copy import deepcopy\n'), ((8098, 8113), 'utils.base_test_class.execute_tests', 'execute_tests', ([], {}), '()\n', (8111, 8113), False, 'from utils.base_test_class import BaseTestClass, execute_tests\n'), ((1711, 175... |
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.pyplot as plt
from beyond.dates import Date, timedelta
from beyond.io.tle import Tle
from beyond.frames import create_station
from beyond.config import config
tle = Tle("""ISS (ZARYA)
1 25544U 98067A 16086.49419020 .00003976 00000-0 66962-4 ... | [
"numpy.radians",
"matplotlib.pyplot.subplot",
"beyond.dates.timedelta",
"matplotlib.pyplot.show",
"numpy.degrees",
"beyond.frames.create_station",
"beyond.dates.Date.now",
"matplotlib.pyplot.figure",
"beyond.io.tle.Tle"
] | [((442, 493), 'beyond.frames.create_station', 'create_station', (['"""TLS"""', '(43.428889, 1.497778, 178.0)'], {}), "('TLS', (43.428889, 1.497778, 178.0))\n", (456, 493), False, 'from beyond.frames import create_station\n'), ((1464, 1476), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1474, 1476), True,... |
"""Main module."""
import numpy as np
import numba as nb
import xarray as xr
import xsimlab as xs
import pandas as pd
import math
import fastscape
from fastscape.processes.erosion import TotalErosion
from fastscape.processes.channel import DifferentialStreamPowerChannelTD
from fastscape.processes.hillslope import Diffe... | [
"xsimlab.on_demand",
"numpy.zeros_like",
"numpy.median",
"numpy.power",
"numpy.zeros",
"numpy.ones",
"xsimlab.variable",
"fastscape_litho._helper.is_draiange_divide_SF",
"numpy.percentile",
"xsimlab.foreign",
"numpy.arange",
"xsimlab.runtime",
"xarray.DataArray",
"numpy.unique"
] | [((2423, 2465), 'xsimlab.foreign', 'xs.foreign', (['UniformRectilinearGrid2D', '"""dx"""'], {}), "(UniformRectilinearGrid2D, 'dx')\n", (2433, 2465), True, 'import xsimlab as xs\n'), ((2473, 2515), 'xsimlab.foreign', 'xs.foreign', (['UniformRectilinearGrid2D', '"""dy"""'], {}), "(UniformRectilinearGrid2D, 'dy')\n", (248... |
#! /usr/bin/env python2.7
import pickle
ksdict = pickle.load(open('ks.p','rb'))
prefixes = ('brazil', 'costarica', 'guatemala', 'taiwan', 'venezuela')
colors = {'brazil': 'b',
'costarica': 'c',
'guatemala': 'g',
'taiwan': 'm',
'venezuela': 'r'}
import matplotlib
matplotlib.us... | [
"matplotlib.pyplot.loglog",
"numpy.load",
"numpy.linalg.lstsq",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"numpy.isfinite",
"denudationRateAnalysis.plot_stock_and_montgomery",
"matplotlib.use",
"numpy.array",
"numpy.mean",
"numpy.log10",
"matplotlib.pyplot.grid",
"matplotlib.pyplo... | [((307, 328), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (321, 328), False, 'import matplotlib\n'), ((553, 580), 'numpy.load', 'np.load', (['"""costarica/dr.npy"""'], {}), "('costarica/dr.npy')\n", (560, 580), True, 'import numpy as np\n'), ((638, 665), 'numpy.load', 'np.load', (['"""guatemal... |
import nmi,maxent
import numpy as np
from sys import argv
from os import mkdir
inFN = argv[1]
gapthresh = 0.03 #Fraction of gaps to allow in a sequence
alpha = 1e-1 #Starting learning rate
gaps = False
maxiter = 200 #I'll be shocked if > 100 steps are necessary
h,s = nmi.importFasta(inFN)
ats,mtx = nmi.prunePrimaryGap... | [
"os.mkdir",
"numpy.save",
"nmi.binMatrix",
"numpy.ones",
"numpy.array",
"nmi.importFasta",
"maxent.maxll"
] | [((269, 290), 'nmi.importFasta', 'nmi.importFasta', (['inFN'], {}), '(inFN)\n', (284, 290), False, 'import nmi, maxent\n'), ((322, 338), 'nmi.binMatrix', 'nmi.binMatrix', (['s'], {}), '(s)\n', (335, 338), False, 'import nmi, maxent\n'), ((772, 785), 'os.mkdir', 'mkdir', (['outdir'], {}), '(outdir)\n', (777, 785), False... |
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.feature_selection import VarianceThreshold
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import Random... | [
"pandas.DataFrame",
"sklearn.preprocessing.StandardScaler",
"warnings.simplefilter",
"numpy.ravel",
"pandas.read_csv",
"numpy.ones",
"rdkit.ML.Descriptors.MoleculeDescriptors.MolecularDescriptorCalculator",
"scipy.spatial.distance_matrix",
"numpy.take",
"seaborn.color_palette",
"rdkit.Chem.MolFr... | [((17, 79), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (38, 79), False, 'import warnings\n'), ((1009, 1028), 'seaborn.color_palette', 'sns.color_palette', ([], {}), '()\n', (1026, 1028), True, 'import se... |
#! /usr/bin/env python
import numpy as np
from .movement_mechanics import update_position
from .ros_system_state import (
ROSSpinManagerMixin,
ROSStaticPoseUpdateMixin,
ROSCommunicationManagerMixin,
ROSCommunicationMixin,
ROSCommunicationStatePublisherMixin,
)
from .state import create_state_rando... | [
"numpy.zeros",
"numpy.random.random_sample"
] | [((830, 841), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (838, 841), True, 'import numpy as np\n'), ((2055, 2080), 'numpy.random.random_sample', 'np.random.random_sample', ([], {}), '()\n', (2078, 2080), True, 'import numpy as np\n')] |
import numpy as np
import scipy.stats as st
import csv
import sys
from smoothfdr.utils import calc_fdr
expdir = sys.argv[1]
with open(expdir + 'buffer_lis.csv', 'rb') as f:
reader = csv.reader(f, delimiter=' ')
lis = np.array([float(x) for x in reader.next() if x != ''])
# Try treating the LIS as a prior pro... | [
"numpy.argsort",
"csv.reader",
"numpy.savetxt",
"numpy.zeros"
] | [((1195, 1215), 'numpy.zeros', 'np.zeros', (['(128, 128)'], {}), '((128, 128))\n', (1203, 1215), True, 'import numpy as np\n'), ((1347, 1432), 'numpy.savetxt', 'np.savetxt', (["(expdir + 'hmrf_discoveries.csv')", 'discovered'], {'delimiter': '""","""', 'fmt': '"""%d"""'}), "(expdir + 'hmrf_discoveries.csv', discovered,... |
from tensorflow import keras
import numpy as np
from properties import MODEL, EXPECTED_LABEL, num_classes
class Predictor:
# Load the pre-trained model.
model = keras.models.load_model(MODEL)
print("Loaded model from disk")
@staticmethod
def predict(img):
explabel = (np.expand_dims(EXPE... | [
"numpy.argsort",
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.models.load_model",
"numpy.expand_dims"
] | [((173, 203), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['MODEL'], {}), '(MODEL)\n', (196, 203), False, 'from tensorflow import keras\n'), ((301, 334), 'numpy.expand_dims', 'np.expand_dims', (['EXPECTED_LABEL', '(0)'], {}), '(EXPECTED_LABEL, 0)\n', (315, 334), True, 'import numpy as np\n'), ((41... |
from mayavi import mlab
import matplotlib.pyplot as plt
mlab.clf()
import numpy as np
T = 750000
h = 0.001
a = 0.25
b = 0.25
epsilon = 0.05
c1 = 0.2
c2 = 0.05
d1 = 1.0
d2 = 1.0
eta = lambda rho, c: np.exp(-(rho)**2/(2*c**2))
w = 0.406
u = np.zeros(T)
v = np.zeros(T)
rho = np.zeros(T)
time = np.zeros(T)
# Maps
f = ... | [
"mayavi.mlab.ylabel",
"matplotlib.pyplot.show",
"mayavi.mlab.zlabel",
"mayavi.mlab.show",
"mayavi.mlab.axes",
"mayavi.mlab.clf",
"numpy.zeros",
"mayavi.mlab.xlabel",
"numpy.mean",
"numpy.exp",
"mayavi.mlab.plot3d",
"mayavi.mlab.contour3d",
"matplotlib.pyplot.subplots"
] | [((59, 69), 'mayavi.mlab.clf', 'mlab.clf', ([], {}), '()\n', (67, 69), False, 'from mayavi import mlab\n'), ((244, 255), 'numpy.zeros', 'np.zeros', (['T'], {}), '(T)\n', (252, 255), True, 'import numpy as np\n'), ((260, 271), 'numpy.zeros', 'np.zeros', (['T'], {}), '(T)\n', (268, 271), True, 'import numpy as np\n'), ((... |
# -*- coding: utf-8 -*-
# <NAME> @ https://github.com/sooftware/
# This source code is licensed under the Apache 2.0 License license found in the
# LICENSE file in the root directory of this source tree.
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from... | [
"torch.bmm",
"torch.nn.Conv1d",
"torch.nn.functional.softmax",
"models.modules.Linear",
"torch.sigmoid",
"torch.rand",
"numpy.sqrt"
] | [((1525, 1537), 'numpy.sqrt', 'np.sqrt', (['dim'], {}), '(dim)\n', (1532, 1537), True, 'import numpy as np\n'), ((1817, 1837), 'torch.nn.functional.softmax', 'F.softmax', (['score', '(-1)'], {}), '(score, -1)\n', (1826, 1837), True, 'import torch.nn.functional as F\n'), ((1856, 1878), 'torch.bmm', 'torch.bmm', (['attn'... |
"""This script runs a validation case of Ptera Software’s UVLM.
I first emulate the geometry and kinematics of a flapping robotic test stand from
"Experimental and Analytical Pressure Characterization of a Rigid Flapping Wing for
Ornithopter Development" by <NAME>, <NAME>, and <NAME>. Then,
I run the UVLM simulation o... | [
"numpy.abs",
"pterasoftware.geometry.Wing",
"pterasoftware.operating_point.OperatingPoint",
"numpy.mean",
"numpy.sin",
"numpy.interp",
"numpy.round",
"numpy.power",
"numpy.genfromtxt",
"numpy.linspace",
"pterasoftware.problems.UnsteadyProblem",
"matplotlib.pyplot.subplots",
"pterasoftware.mo... | [((1978, 2044), 'numpy.genfromtxt', 'np.genfromtxt', (['"""Extracted Planform Coordinates.csv"""'], {'delimiter': '""","""'}), "('Extracted Planform Coordinates.csv', delimiter=',')\n", (1991, 2044), True, 'import numpy as np\n'), ((2861, 2908), 'numpy.flip', 'np.flip', (['planform_coords[tip_index:, :]'], {'axis': '(0... |
from pyomo.environ import Constraint, Var, quicksum, sqrt, Objective, Block
from romodel.reformulate import BaseRobustTransformation
from pyomo.core import TransformationFactory
from pyomo.repn import generate_standard_repn
from romodel.uncset import UncSet, EllipsoidalSet
import numpy as np
@TransformationFactory.re... | [
"pyomo.repn.generate_standard_repn",
"pyomo.environ.Block",
"pyomo.environ.Constraint",
"pyomo.environ.sqrt",
"numpy.linalg.eig",
"pyomo.environ.Objective",
"numpy.array",
"numpy.linalg.inv",
"pyomo.core.TransformationFactory.register",
"numpy.all"
] | [((296, 385), 'pyomo.core.TransformationFactory.register', 'TransformationFactory.register', (['"""romodel.ellipsoidal"""'], {'doc': '"""Ellipsoidal Counterpart"""'}), "('romodel.ellipsoidal', doc=\n 'Ellipsoidal Counterpart')\n", (326, 385), False, 'from pyomo.core import TransformationFactory\n'), ((4307, 4314), '... |
# non-resonant leptogenesis with two decaying sterile neutrino using the Boltzmann equations. Note these kinetic equations do not include off diagonal flavour oscillations. Equations from 1112.4528
import ulysses
import numpy as np
from odeintw import odeintw
from ulysses.numba import jit
@jit
def fast_RHS(y0,eps1tt,... | [
"numpy.array",
"numpy.conjugate",
"ulysses.numba.List",
"numpy.real"
] | [((500, 517), 'numpy.conjugate', 'np.conjugate', (['c1t'], {}), '(c1t)\n', (512, 517), True, 'import numpy as np\n'), ((532, 549), 'numpy.conjugate', 'np.conjugate', (['c1m'], {}), '(c1m)\n', (544, 549), True, 'import numpy as np\n'), ((564, 581), 'numpy.conjugate', 'np.conjugate', (['c1e'], {}), '(c1e)\n', (576, 581),... |
# -*- coding: utf-8 -*-
"""
Input/output utilities.
"""
from __future__ import division, print_function, absolute_import
# standard library dependencies
from anhima.compat import string_types, zip
# third party dependencies
import numpy as np
def save_tped(path, genotypes, ref, alt, pos,
chromoso... | [
"anhima.compat.zip",
"numpy.asarray",
"numpy.zeros",
"numpy.amax",
"numpy.array"
] | [((1850, 1871), 'numpy.asarray', 'np.asarray', (['genotypes'], {}), '(genotypes)\n', (1860, 1871), True, 'import numpy as np\n'), ((2095, 2110), 'numpy.asarray', 'np.asarray', (['ref'], {}), '(ref)\n', (2105, 2110), True, 'import numpy as np\n'), ((2201, 2216), 'numpy.asarray', 'np.asarray', (['alt'], {}), '(alt)\n', (... |
#!/usr/bin/env python3
# Copyright 2019 Hitachi, Ltd. (author: <NAME>)
# Licensed under the MIT license.
#
# This script generates simulated multi-talker mixtures for diarization
#
# common/make_mixture.py \
# mixture.scp \
# data/mixture \
# wav/mixture
import argparse
import os
from eend import kaldi_d... | [
"os.path.abspath",
"numpy.sum",
"argparse.ArgumentParser",
"json.loads",
"math.pow",
"eend.kaldi_data.load_wav",
"eend.kaldi_data.process_wav",
"numpy.rint",
"soundfile.write",
"os.path.join",
"numpy.concatenate"
] | [((400, 425), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (423, 425), False, 'import argparse\n'), ((1227, 1246), 'json.loads', 'json.loads', (['jsonstr'], {}), '(jsonstr)\n', (1237, 1246), False, 'import json\n'), ((3537, 3560), 'numpy.sum', 'np.sum', (['mixture'], {'axis': '(0)'}), '(mixtu... |
import numpy as np
import scipy.stats
from .plotting_results import plotting_results
from .get_hotelling_tvalue_matrix_whole import get_hotelling_tvalue_matrix_whole
def get_pvalue_from_tvalue(args, tvalue_matrix_whole):
tvalue_matrix = tvalue_matrix_whole[:, :, :-4]
# print("tvalue_matrix.shape: ", tvalue_mat... | [
"numpy.zeros",
"numpy.argsort",
"numpy.append",
"G.graph_node2vec_ttest_nn.parameter_setting_expr_10.parameter_setting",
"numpy.where",
"numpy.min",
"numpy.array",
"numpy.unique"
] | [((474, 532), 'numpy.zeros', 'np.zeros', (['(tvalue_matrix.shape[1], tvalue_matrix.shape[0])'], {}), '((tvalue_matrix.shape[1], tvalue_matrix.shape[0]))\n', (482, 532), True, 'import numpy as np\n'), ((558, 616), 'numpy.zeros', 'np.zeros', (['(tvalue_matrix.shape[1], tvalue_matrix.shape[0])'], {}), '((tvalue_matrix.sha... |
import os
import numpy as np
import tensorflow as tf
from resnet_block import resnet_block
def conv_net_model(features, labels, mode):
# Input Layer
N, H, W, C = features['x'].shape
input_layer = tf.reshape(features['x'], [-1, H, W, C])
# are we training?
training = mode==tf.estimator.ModeKeys.TR... | [
"os.mkdir",
"numpy.load",
"tensorflow.get_collection",
"tensorflow.reshape",
"tensorflow.train.LoggingTensorHook",
"os.path.isfile",
"tensorflow.estimator.Estimator",
"os.path.join",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"tensorflow.stack",
"tensorflow.train.get_global_step",
"tenso... | [((210, 250), 'tensorflow.reshape', 'tf.reshape', (["features['x']", '[-1, H, W, C]'], {}), "(features['x'], [-1, H, W, C])\n", (220, 250), True, 'import tensorflow as tf\n'), ((559, 673), 'tensorflow.layers.conv2d', 'tf.layers.conv2d', ([], {'inputs': 'input_layer', 'filters': 'filters', 'kernel_size': 'kernel_size', ... |
from netCDF4 import Dataset
from numpy.random import seed, randint
from numpy.testing import assert_array_equal, assert_equal,\
assert_array_almost_equal
import tempfile, unittest, os, random
import numpy as np
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
xdim=9; ydim=10; zdim=11
#seed(9) #... | [
"unittest.main",
"tempfile.NamedTemporaryFile",
"netCDF4.Dataset",
"os.remove",
"numpy.random.uniform",
"numpy.testing.assert_array_equal",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.random.randint",
"numpy.array",
"numpy.arange",
"numpy.testing.assert_equal",
"numpy.broadcast_to",... | [((224, 279), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'suffix': '""".nc"""', 'delete': '(False)'}), "(suffix='.nc', delete=False)\n", (251, 279), False, 'import tempfile, unittest, os, random\n'), ((10162, 10177), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10175, 10177), False, 'im... |
# coding: utf-8
import os
import matplotlib.pyplot as plt
import math
import pickle
import os
import numpy as np
import torch
from torch.autograd import Variable
from torch import optim
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from .utils import *
from .dsp... | [
"numpy.stack",
"numpy.load",
"numpy.save",
"os.makedirs",
"torch.utils.data.DataLoader",
"logging.basicConfig",
"torch.LongTensor",
"torch.load",
"torch.FloatTensor",
"os.path.exists",
"torch.nn.NLLLoss",
"numpy.random.randint",
"torch.cuda.is_available",
"pickle.load",
"logging.getLogge... | [((395, 488), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(levelname)s %(message)s"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s %(levelname)s %(message)s')\n", (414, 488), False, 'import logging\n'), ((493, 520), 'logging.getLogger', 'logging.getLo... |
""" Definitions relating to the simulated DM distribution of FRBs.
To use this code, please download the asymmetric_kde package from
https://github.com/tillahoffmann/asymmetric_kde [<NAME>, 2015] """
from asymmetric_kde import ProperGammaEstimator
from frb.dm import igm
import numpy as np
import scipy as sp
import pan... | [
"numpy.load",
"numpy.sum",
"pandas.read_csv",
"scipy.interpolate.CubicSpline",
"numpy.arange",
"numpy.random.normal",
"pdf_fns.make_kde_funtion",
"frb.dm.igm.z_from_DM",
"asymmetric_kde.ProperGammaEstimator",
"scipy.signal.argrelextrema",
"numpy.append",
"numpy.minimum",
"numpy.save",
"num... | [((600, 709), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(message)s"""', 'datefmt': '"""%d-%b-%y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(message)s', datefmt=\n '%d-%b-%y %H:%M:%S', level=logging.INFO)\n", (619, 709), False, 'import logging\n'), ((1862,... |
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import det, inv
from IMLearn.metrics.loss_functions import misclassification_error as me
class GaussianNaiveBayes(BaseEstimator):
"""
Gaussian Naive-Bayes classifier
"""
def __init__(self):
"""
... | [
"numpy.stack",
"numpy.sum",
"numpy.count_nonzero",
"numpy.log",
"IMLearn.metrics.loss_functions.misclassification_error",
"numpy.argmax",
"numpy.square",
"numpy.array",
"numpy.unique"
] | [((4975, 4997), 'numpy.array', 'np.array', (['k_likelihood'], {}), '(k_likelihood)\n', (4983, 4997), True, 'import numpy as np\n'), ((1578, 1590), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1587, 1590), True, 'import numpy as np\n'), ((1812, 1837), 'numpy.stack', 'np.stack', (['sample_k_values'], {}), '(sample... |
#!/bin/python3
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colors, cm
from matplotlib.ticker import PercentFormatter
import pathlib, json, glob, os
from scipy import stats
import random
import sys
class Trace:
"""Decoded data from a trace file"""
def __init__(self, filename):
... | [
"json.load",
"matplotlib.pyplot.show",
"numpy.median",
"matplotlib.pyplot.subplots",
"sys.exit"
] | [((1201, 1280), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'sharey': '(True)', 'tight_layout': '(True)', 'figsize': '(16 * 0.8, 9 * 0.4)'}), '(1, 2, sharey=True, tight_layout=True, figsize=(16 * 0.8, 9 * 0.4))\n', (1213, 1280), True, 'import matplotlib.pyplot as plt\n'), ((2190, 2200), 'matplotlib.... |
# Libraries ###########################################################################################################
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from sklearn import preprocessing
import random
from sklearn.metrics import roc_curve, roc_auc_score
# Fun... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"random.shuffle",
"sklearn.preprocessing.MinMaxScaler",
"seaborn.despine",
"sklearn.metrics.roc_auc_score",
"matplotlib.pyplot.ylabel",... | [((3618, 3654), 'pandas.read_csv', 'pd.read_csv', (["(path + 'TMM_counts.csv')"], {}), "(path + 'TMM_counts.csv')\n", (3629, 3654), True, 'import pandas as pd\n'), ((3711, 3757), 'pandas.read_csv', 'pd.read_csv', (["(path + 'sample_info_filtered.csv')"], {}), "(path + 'sample_info_filtered.csv')\n", (3722, 3757), True,... |
# Copyright (c) 2020 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... | [
"he_utils.Paillier",
"logging.basicConfig",
"random.shuffle",
"numpy.isnan",
"pandas.qcut",
"logging.getLogger"
] | [((872, 943), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(format='%(asctime)s - %(levelname)s - %(message)s')\n", (891, 943), False, 'import logging\n'), ((953, 980), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (9... |
import itertools
import pickle
import nltk
import numpy as np
from .constants import METADATA_PATH
from .preprocessing import clean_text, read_txt, preprocess_cornell_data
OUT = 'out' # unknown
PAD = 'pad'
MOST_FREQ_WORDS = 10000
MAX_LEN = 25
MIN_LEN = 2
def get_metadata(path=METADATA_PATH):
with open(pat... | [
"numpy.load",
"numpy.save",
"pickle.dump",
"numpy.zeros",
"pickle.load",
"numpy.array",
"itertools.chain"
] | [((2480, 2525), 'numpy.zeros', 'np.zeros', (['[data_len, MAX_LEN]'], {'dtype': 'np.int32'}), '([data_len, MAX_LEN], dtype=np.int32)\n', (2488, 2525), True, 'import numpy as np\n'), ((2543, 2588), 'numpy.zeros', 'np.zeros', (['[data_len, MAX_LEN]'], {'dtype': 'np.int32'}), '([data_len, MAX_LEN], dtype=np.int32)\n', (255... |
import sys
import numpy as np
vcf = sys.argv[1]
bac = sys.argv[2]
counter = 0
with open(vcf, "r") as File:
for line in File:
if line.startswith("#CHROM"):
l = line.rstrip().split("\t")
pos = [i for i,x in enumerate(l) if x == bac][0]
... | [
"numpy.asarray",
"numpy.sum"
] | [((484, 501), 'numpy.asarray', 'np.asarray', (['l[9:]'], {}), '(l[9:])\n', (494, 501), True, 'import numpy as np\n'), ((568, 579), 'numpy.sum', 'np.sum', (['arr'], {}), '(arr)\n', (574, 579), True, 'import numpy as np\n')] |
# Copyright (c) 2021 zfit
# TODO(Mayou36): update docs above
import functools
import inspect
import itertools
import warnings
from abc import abstractmethod
from collections import defaultdict
from contextlib import suppress
from typing import Callable, Iterable, Mapping, Optional, Tuple, Union
import numpy as np
i... | [
"tensorflow.python.util.deprecation.deprecated",
"numpy.allclose",
"zfit.z.numpy.expand_dims",
"collections.defaultdict",
"numpy.shape",
"tensorflow.greater_equal",
"tensorflow.logical_and",
"tensorflow.less_equal",
"zfit.z.numpy.all",
"tensorflow.get_static_value",
"contextlib.suppress",
"ins... | [((5193, 5233), 'tensorflow.logical_and', 'tf.logical_and', (['above_lower', 'below_upper'], {}), '(above_lower, below_upper)\n', (5207, 5233), True, 'import tensorflow as tf\n'), ((56381, 56552), 'tensorflow.python.util.deprecation.deprecated', 'deprecated', ([], {'date': 'None', 'instructions': '"""Depreceated, use .... |
# Copyright (c) 2021 - present / Neuralmagic, Inc. 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 b... | [
"numpy.empty",
"numpy.mean",
"pickle.load",
"os.path.join",
"sparseml.tensorflow_v1.utils.tf_compat.random_uniform",
"sparsezoo.utils.download_file",
"sparseml.tensorflow_v1.utils.tf_compat_div",
"sparseml.tensorflow_v1.utils.tf_compat.name_scope",
"sparseml.tensorflow_v1.utils.tf_compat.equal",
"... | [((5876, 5949), 'sparseml.tensorflow_v1.datasets.registry.DatasetRegistry.register', 'DatasetRegistry.register', ([], {'key': "['cifar10']", 'attributes': "{'num_classes': 10}"}), "(key=['cifar10'], attributes={'num_classes': 10})\n", (5900, 5949), False, 'from sparseml.tensorflow_v1.datasets.registry import DatasetReg... |
import numpy as np
import tensorflow as tf
from neuralode.adjoint_tf import odeint
import matplotlib
import matplotlib.pyplot as plt
tf.enable_eager_execution()
tfe = tf.contrib.eager
data_size = 130
batch_time = 5
batch_size = 10
true_y0 = np.array([[0.5, 0.3]], dtype=np.float32)
true_A = np.array([[-0.1, -1.], [1.... | [
"tensorflow.keras.layers.Dense",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"numpy.arange",
"tensorflow.abs",
"numpy.random.randn",
"neuralode.adjoint_tf.odeint",
"numpy.linspace",
"matplotlib.pyplot.show",
"tensorflow.linspace",
"numpy.hstack",
"tensorflow.enable_eager_execution",
"nu... | [((133, 160), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (158, 160), True, 'import tensorflow as tf\n'), ((244, 284), 'numpy.array', 'np.array', (['[[0.5, 0.3]]'], {'dtype': 'np.float32'}), '([[0.5, 0.3]], dtype=np.float32)\n', (252, 284), True, 'import numpy as np\n'), ((294, 3... |
from matplotlib import gridspec
import matplotlib.pyplot as plt
import numpy as np
from pymc3.diagnostics import gelman_rubin
from pymc3.stats import quantiles, hpd
from .utils import identity_transform, get_default_varnames
def _var_str(name, shape):
"""Return a sequence of strings naming the element of the tall... | [
"matplotlib.pyplot.subplot",
"numpy.size",
"pymc3.stats.hpd",
"numpy.transpose",
"pymc3.diagnostics.gelman_rubin",
"numpy.shape",
"numpy.indices",
"numpy.min",
"numpy.max",
"pymc3.stats.quantiles",
"matplotlib.gridspec.GridSpec",
"numpy.prod"
] | [((453, 467), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (460, 467), True, 'import numpy as np\n'), ((1202, 1221), 'pymc3.diagnostics.gelman_rubin', 'gelman_rubin', (['trace'], {}), '(trace)\n', (1214, 1221), False, 'from pymc3.diagnostics import gelman_rubin\n'), ((5861, 5924), 'pymc3.stats.quantiles', 'qu... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from pathlib import Path
from collections import namedtuple
from typing import List, Dict
import pickle
SentenceTriplet = namedtuple('SentenceTriplet', 'sent, head, tail, relation')
def load_data(data_file: Path, tag_file: Path) -> List[SentenceTrip... | [
"pickle.dump",
"numpy.save",
"numpy.zeros",
"pathlib.Path",
"pickle.load",
"numpy.array",
"collections.namedtuple",
"numpy.random.normal"
] | [((191, 250), 'collections.namedtuple', 'namedtuple', (['"""SentenceTriplet"""', '"""sent, head, tail, relation"""'], {}), "('SentenceTriplet', 'sent, head, tail, relation')\n", (201, 250), False, 'from collections import namedtuple\n'), ((4847, 4880), 'pathlib.Path', 'Path', (['"""./chinese_data/open_data/"""'], {}), ... |
from itertools import izip
import theano
import theano.tensor as T
import numpy as np
import utils as U
from parameters import Parameters
def clip(magnitude):
def clipper(deltas):
grads_norms = [T.sqrt(T.sum(T.sqr(g))) for g in deltas]
return [
T.switch(
T.gt(n, magnitu... | [
"parameters.Parameters",
"numpy.float32",
"numpy.zeros",
"theano.tensor.gt",
"theano.tensor.sqr",
"itertools.izip",
"theano.tensor.sqrt",
"theano.tensor.max"
] | [((1622, 1638), 'numpy.float32', 'np.float32', (['(0.95)'], {}), '(0.95)\n', (1632, 1638), True, 'import numpy as np\n'), ((1654, 1672), 'numpy.float32', 'np.float32', (['(0.0001)'], {}), '(0.0001)\n', (1664, 1672), True, 'import numpy as np\n'), ((576, 594), 'theano.tensor.max', 'T.max', (['grads_norms'], {}), '(grads... |
import os
import json
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.image as mpimg
from PIL import Image
def compute_iou(box_1, box_2):
'''
This function takes a pair of bounding boxes and returns intersection-over-
union (IoU) of two bounding box... | [
"matplotlib.pyplot.title",
"json.load",
"matplotlib.pyplot.show",
"os.path.join",
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.legend",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((6685, 6733), 'numpy.linspace', 'np.linspace', (['min_confidence', 'max_confidence', '(400)'], {}), '(min_confidence, max_confidence, 400)\n', (6696, 6733), True, 'import numpy as np\n'), ((8224, 8239), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)'], {}), '(1)\n', (8236, 8239), True, 'import matplotlib.pyplot... |
import numpy as np
from ._array import find_changes, find_repeats
def test_find_repeats():
example = np.array([0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0])
np.testing.assert_array_equal(
find_repeats(example, wrap=False),
np.array(
[
False,
False,
... | [
"numpy.array"
] | [((107, 159), 'numpy.array', 'np.array', (['[0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0]'], {}), '([0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0])\n', (115, 159), True, 'import numpy as np\n'), ((2045, 2097), 'numpy.array', 'np.array', (['[0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0]'], {}), '([0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, ... |
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
data_dir = "/home/jdw/projects/kaggle/data/city_lines/"
def get_df(fn):
path = os.path.join(data_dir, fn+".csv")
return pd.read_csv(path)
def pointstr2coord(pointstr):
pointstr = pointstr[6:-1]
x, y = pointstr.split(" ... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.imshow",
"numpy.linalg.norm",
"os.path.join"
] | [((168, 203), 'os.path.join', 'os.path.join', (['data_dir', "(fn + '.csv')"], {}), "(data_dir, fn + '.csv')\n", (180, 203), False, 'import os\n'), ((213, 230), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (224, 230), True, 'import pandas as pd\n'), ((1043, 1067), 'matplotlib.pyplot.imshow', 'plt.imshow... |
# -*- coding: utf-8 -*-
"""
Domain adaptation with optimal transport
"""
import numpy as np
from .bregman import sinkhorn
from .lp import emd
from .utils import unif,dist,kernel
from .optim import cg
from .optim import gcg
def indices(a, func):
return [i for (i, val) in enumerate(a) if func(val)]
def sinkhorn_... | [
"numpy.sum",
"numpy.zeros",
"numpy.ones",
"numpy.argmin",
"numpy.min",
"numpy.max",
"numpy.linalg.norm",
"numpy.dot",
"numpy.eye",
"numpy.linalg.solve",
"numpy.unique"
] | [((3059, 3075), 'numpy.min', 'np.min', (['labels_a'], {}), '(labels_a)\n', (3065, 3075), True, 'import numpy as np\n'), ((3218, 3235), 'numpy.zeros', 'np.zeros', (['M.shape'], {}), '(M.shape)\n', (3226, 3235), True, 'import numpy as np\n'), ((6679, 6698), 'numpy.unique', 'np.unique', (['labels_a'], {}), '(labels_a)\n',... |
from argparse import ArgumentParser
from . import utils
#import utils
import airsimneurips as airsim
import cv2
import threading
import time
import numpy as np
import math
import sys
import traceback
import gym
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torc... | [
"torch.nn.Dropout",
"argparse.ArgumentParser",
"airsimneurips.MultirotorClient",
"numpy.random.normal",
"cv2.imshow",
"cv2.cvtColor",
"torch.load",
"os.path.exists",
"torch.FloatTensor",
"torch.squeeze",
"torch.exp",
"torch.nn.functional.relu",
"torch.cuda.set_device",
"numpy.fromstring",
... | [((681, 705), 'torch.cuda.set_device', 'torch.cuda.set_device', (['(0)'], {}), '(0)\n', (702, 705), False, 'import torch\n'), ((882, 908), 'os.path.exists', 'os.path.exists', (['sample_dir'], {}), '(sample_dir)\n', (896, 908), False, 'import os\n'), ((914, 937), 'os.makedirs', 'os.makedirs', (['sample_dir'], {}), '(sam... |
import numpy as np
from numpy import genfromtxt
import matplotlib.pyplot as plt
import time
marker_size = 1
convergence = genfromtxt('continuous_to_discrete_convergence.csv', delimiter=',')
empirical_errors = genfromtxt('empirical_errors.csv', delimiter=',')
empirical_error = np.mean(empirical_errors)
curves = np.s... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.genfromtxt",
"time.sleep",
"numpy.shape",
"matplotlib.pyplot.ion",
"numpy.mean",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((124, 191), 'numpy.genfromtxt', 'genfromtxt', (['"""continuous_to_discrete_convergence.csv"""'], {'delimiter': '""","""'}), "('continuous_to_discrete_convergence.csv', delimiter=',')\n", (134, 191), False, 'from numpy import genfromtxt\n'), ((211, 260), 'numpy.genfromtxt', 'genfromtxt', (['"""empirical_errors.csv"""'... |
import skimage.io
import numpy as np
import sys
import os
from os import listdir
img_folder = sys.argv[1]
test_img = sys.argv[2]
image_names = listdir(img_folder)
print(image_names[:10])
# load all faces array
image_X = []
for name in image_names:
single_img = skimage.io.imread(os.path.join(img_folder,name))
... | [
"numpy.min",
"numpy.linalg.svd",
"numpy.mean",
"numpy.reshape",
"numpy.max",
"numpy.dot",
"os.path.join",
"os.listdir"
] | [((144, 163), 'os.listdir', 'listdir', (['img_folder'], {}), '(img_folder)\n', (151, 163), False, 'from os import listdir\n'), ((360, 390), 'numpy.reshape', 'np.reshape', (['image_X', '(415, -1)'], {}), '(image_X, (415, -1))\n', (370, 390), True, 'import numpy as np\n'), ((401, 428), 'numpy.mean', 'np.mean', (['image_f... |
import copy
import numpy as np
np.random.seed(123456)
import pandas as pd
import os
import cPickle as pickle
from Lambda import Lambda
import itertools
import operator
from .NumbaFuncs import histogram1d_numba
class Histograms(object):
def __init__(self):
self.histograms = None
self.configs = []
... | [
"pandas.DataFrame",
"copy.deepcopy",
"numpy.meshgrid",
"numpy.random.seed",
"numpy.ones_like",
"os.makedirs",
"numpy.empty",
"os.path.exists",
"cPickle.load",
"numpy.hstack",
"cPickle.dump",
"numpy.array",
"Lambda.Lambda",
"operator.itemgetter",
"os.path.join",
"pandas.concat"
] | [((31, 53), 'numpy.random.seed', 'np.random.seed', (['(123456)'], {}), '(123456)\n', (45, 53), True, 'import numpy as np\n'), ((5250, 5268), 'numpy.meshgrid', 'np.meshgrid', (['*mins'], {}), '(*mins)\n', (5261, 5268), True, 'import numpy as np\n'), ((5284, 5302), 'numpy.meshgrid', 'np.meshgrid', (['*maxs'], {}), '(*max... |
try:
import torch
has_torch = True
except:
has_torch = False
import itertools
import phathom.segmentation.segmentation as cpu_impl
import numpy as np
import unittest
if has_torch:
import phathom.segmentation.torch_impl as gpu_impl
class TestTorchImpl(unittest.TestCase):
def test_gradient... | [
"unittest.main",
"numpy.testing.assert_almost_equal",
"numpy.random.RandomState",
"numpy.linalg.eigvalsh",
"phathom.segmentation.segmentation.gradient",
"phathom.segmentation.torch_impl.eigen3",
"numpy.array",
"numpy.linalg.inv",
"phathom.segmentation.torch_impl._inverse",
"phathom.segmentation.se... | [((3158, 3173), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3171, 3173), False, 'import unittest\n'), ((613, 661), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (['dz', 'g[..., 0]', '(4)'], {}), '(dz, g[..., 0], 4)\n', (643, 661), True, 'import numpy as np\n'), ((674, 722), 'numpy.test... |
import numpy as np
import copy
from helpers import (argmax, is_atari_game, copy_atari_state, restore_atari_state, stable_normalizer)
from igraph import Graph, EdgeSeq, Edge
import plotly.graph_objects as go
import plotly.io as pio
import json
##### MCTS functions #####
class Action():
''' Action object '''
d... | [
"helpers.copy_atari_state",
"helpers.argmax",
"copy.deepcopy",
"numpy.sum",
"helpers.stable_normalizer",
"helpers.is_atari_game",
"plotly.graph_objects.Figure",
"igraph.Graph",
"json.dumps",
"numpy.array",
"numpy.linalg.norm",
"helpers.restore_atari_state",
"numpy.sqrt"
] | [((1669, 1684), 'json.dumps', 'json.dumps', (['inf'], {}), '(inf)\n', (1679, 1684), False, 'import json\n'), ((1989, 2000), 'helpers.argmax', 'argmax', (['UCT'], {}), '(UCT)\n', (1995, 2000), False, 'from helpers import argmax, is_atari_game, copy_atari_state, restore_atari_state, stable_normalizer\n'), ((3114, 3132), ... |
# Copyright 2019 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 applicable law or agr... | [
"numpy.zeros",
"numpy.ones",
"collections.defaultdict",
"collections.namedtuple",
"numpy.prod"
] | [((817, 992), 'collections.namedtuple', 'collections.namedtuple', (['"""_CalculatorReturn"""', "['root_node_values', 'action_values', 'counterfactual_reach_probs',\n 'player_reach_probs', 'sum_cfr_reach_by_action_value']"], {}), "('_CalculatorReturn', ['root_node_values',\n 'action_values', 'counterfactual_reach_... |
import types
from typing import Union
from typing import Optional
import timeit
import numpy as np
class Sorting:
class Binpacking(object):
class Bin(object):
def __init__(self, size: Union[float, int], buffer: Union[float, int] = 0):
self.items = []
... | [
"matplotlib.pyplot.subplots",
"numpy.polyfit",
"matplotlib.pyplot.show"
] | [((3368, 3382), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3380, 3382), True, 'import matplotlib.pyplot as plt\n'), ((3752, 3762), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3760, 3762), True, 'import matplotlib.pyplot as plt\n'), ((8160, 8174), 'matplotlib.pyplot.subplots', 'plt.sub... |
import unittest
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal
import dymos as dm
from dymos.utils.lgl import lgl
from dymos.models.eom import FlightPathEOM2D
import numpy as np
class TestInputParameterConnections(unittest.TestCase):
def test_dynamic_input_parameter_connec... | [
"unittest.main",
"dymos.utils.lgl.lgl",
"dymos.models.eom.FlightPathEOM2D",
"openmdao.api.DirectSolver",
"numpy.zeros",
"dymos.Radau",
"numpy.array",
"openmdao.api.pyOptSparseDriver",
"openmdao.api.Group",
"dymos.GaussLobatto"
] | [((10392, 10407), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10405, 10407), False, 'import unittest\n'), ((1221, 1243), 'openmdao.api.pyOptSparseDriver', 'om.pyOptSparseDriver', ([], {}), '()\n', (1241, 1243), True, 'import openmdao.api as om\n'), ((1353, 1374), 'dymos.utils.lgl.lgl', 'lgl', (['(num_segments ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 16:58:52 2020
This source code is adapted from SentEval dataset https://github.com/facebookresearch/SentEval.
The code allows you to evaluate Sentence Transformers models in different tasks concatenating
the sentence embeddings from different multilingual models and ap... | [
"os.mkdir",
"logging.debug",
"numpy.concatenate",
"logging.basicConfig",
"optparse.OptionParser",
"os.path.exists",
"sys.path.insert",
"senteval.engine.SE",
"pandas.read_pickle",
"os.path.join",
"sentence_transformers.SentenceTransformer",
"sys.exit"
] | [((1240, 1275), 'optparse.OptionParser', 'OptionParser', ([], {'add_help_option': '(False)'}), '(add_help_option=False)\n', (1252, 1275), False, 'from optparse import OptionParser\n'), ((3627, 3663), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PATH_TO_SENTEVAL'], {}), '(0, PATH_TO_SENTEVAL)\n', (3642, 3663), False,... |
import os
import os.path
import io
import tempfile
import json as js
import re
from itertools import tee
from functools import wraps
import functools as ft
import threading
from urllib.parse import urlparse as parse_url
from urllib.parse import parse_qs
import numpy as np
import keyword
import uuid
from .bitmap impor... | [
"os.remove",
"numpy.random.seed",
"numpy.isnan",
"json.dumps",
"numpy.random.normal",
"os.path.join",
"urllib.parse.urlparse",
"json.loads",
"os.path.dirname",
"pandas.io.common.is_url",
"os.path.exists",
"urllib.parse.parse_qs",
"tempfile.mkdtemp",
"requests.get",
"IPython.get_ipython",... | [((4583, 4619), 're.compile', 're.compile', (['"""[_A-Za-z][_a-zA-Z0-9]*"""'], {}), "('[_A-Za-z][_a-zA-Z0-9]*')\n", (4593, 4619), False, 'import re\n'), ((1138, 1151), 'itertools.tee', 'tee', (['iterator'], {}), '(iterator)\n', (1141, 1151), False, 'from itertools import tee\n'), ((6363, 6380), 'numpy.array', 'np.array... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 17 15:02:27 2022
@author: turnerp
"""
import traceback
import numpy as np
from skimage import exposure
import cv2
import tifffile
import os
from glob2 import glob
import pandas as pd
import mat4py
import datetime
import json
import matplotlib.pyplot as plt
import hash... | [
"pandas.DataFrame",
"os.path.abspath",
"cv2.contourArea",
"json.loads",
"os.path.basename",
"glob2.glob",
"tifffile.TiffFile",
"os.path.isfile",
"os.path.splitext",
"tifffile.imread",
"cv2.boundingRect",
"datetime.datetime.now",
"numpy.unique"
] | [((813, 1045), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['path', 'folder', 'user_initial', 'file_name', 'channel', 'file_list',\n 'channel_list', 'segmentation_file', 'segmentation_channel',\n 'segmented', 'labelled', 'segmentation_curated', 'label_curated']"}), "(columns=['path', 'folder', 'user_ini... |
"""
Unit and regression test for the datasets module.
"""
import autograd
import numpy
from bayesiantesting import unit
from bayesiantesting.datasets.nist import NISTDataType
from bayesiantesting.surrogates import StollWerthSurrogate
def generate_parameters():
"""Returns a set of parameters (and their reduced va... | [
"numpy.allclose",
"autograd.grad",
"numpy.isclose",
"numpy.array",
"autograd.jacobian",
"bayesiantesting.surrogates.StollWerthSurrogate"
] | [((814, 865), 'bayesiantesting.surrogates.StollWerthSurrogate', 'StollWerthSurrogate', (['(30.069 * unit.gram / unit.mole)'], {}), '(30.069 * unit.gram / unit.mole)\n', (833, 865), False, 'from bayesiantesting.surrogates import StollWerthSurrogate\n'), ((1131, 1162), 'numpy.isclose', 'numpy.isclose', (['value', '(310.9... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | [
"graph.dim.Dim.combine",
"logging.getLogger",
"graph.dim.Dim.unknown",
"numpy.array",
"utils.real_transpose.real_transpose",
"functools.reduce",
"graph.dim.Dim.unnamed"
] | [((1308, 1347), 'logging.getLogger', 'logging.getLogger', (["('nntool.' + __name__)"], {}), "('nntool.' + __name__)\n", (1325, 1347), False, 'import logging\n'), ((3401, 3454), 'utils.real_transpose.real_transpose', 'real_transpose', (['self.in_dims[0].shape', 'self.transpose'], {}), '(self.in_dims[0].shape, self.trans... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
from plotting import setup, savefig, SQUARE_FIGSIZE
setup()
np.random.seed(42)
def log_prior(m, b, lns):
if not -10.0 < lns < 5.0:
return -np.inf
return -1.5 * np.log(1 + b**2)
def log_... | [
"numpy.vander",
"numpy.random.seed",
"numpy.log",
"numpy.argmax",
"emcee.EnsembleSampler",
"numpy.random.randn",
"matplotlib.pyplot.legend",
"numpy.append",
"plotting.savefig",
"numpy.mean",
"numpy.loadtxt",
"numpy.linspace",
"numpy.exp",
"matplotlib.pyplot.MaxNLocator",
"numpy.dot",
"... | [((169, 176), 'plotting.setup', 'setup', ([], {}), '()\n', (174, 176), False, 'from plotting import setup, savefig, SQUARE_FIGSIZE\n'), ((177, 195), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (191, 195), True, 'import numpy as np\n'), ((689, 727), 'numpy.loadtxt', 'np.loadtxt', (['"""../data.txt""... |
import numpy as np
import glfw
def step_env(env, max_path_length=100, iterations=1, render=True):
"""Step env helper."""
for _ in range(iterations):
obs = env.reset()
for _ in range(max_path_length):
next_obs, _, done, info = env.step(env.action_space.sample())
if env._p... | [
"numpy.zeros"
] | [((382, 393), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (390, 393), True, 'import numpy as np\n'), ((1068, 1079), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (1076, 1079), True, 'import numpy as np\n'), ((1130, 1141), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (1138, 1141), True, 'import numpy a... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.mindrecord.FileWriter",
"json.load",
"src.tokenization.preprocess_text",
"argparse.ArgumentParser",
"six.moves.range",
"six.ensure_binary",
"src.tokenization.FullTokenizer",
"mindspore.log.logging.info",
"numpy.zeros",
"six.moves.map",
"os.path.exists",
"numpy.array",
"collections... | [((981, 1108), 'collections.namedtuple', 'collections.namedtuple', (['"""PrelimPrediction"""', "['feature_index', 'start_index', 'end_index', 'start_log_prob', 'end_log_prob']"], {}), "('PrelimPrediction', ['feature_index', 'start_index',\n 'end_index', 'start_log_prob', 'end_log_prob'])\n", (1003, 1108), False, 'im... |
from sklearn.externals import joblib
from sklearn.model_selection import train_test_split
from sklearn.decomposition import PCA
from sklearn import preprocessing
from sklearn.neural_network import MLPRegressor
from sklearn.model_selection import validation_curve
import pandas as pd
from matplotlib import pyplot as plt
... | [
"sklearn.model_selection.validation_curve",
"matplotlib.pyplot.fill_between",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.std",
"matplotlib.pyplot.legend",
"sklearn.neural_network.MLPRegressor",
"numpy.mean",
"matplotlib.pyplot.ylab... | [((442, 480), 'pandas.read_csv', 'pd.read_csv', (['"""../dataset/data_036.csv"""'], {}), "('../dataset/data_036.csv')\n", (453, 480), True, 'import pandas as pd\n'), ((704, 734), 'sklearn.preprocessing.StandardScaler', 'preprocessing.StandardScaler', ([], {}), '()\n', (732, 734), False, 'from sklearn import preprocessi... |
from mmfutils.math import bessel
import numpy as np
class TestBessel(object):
"""
"""
nus = [0.5, 1.0, 1.5]
def test_j_root(self):
for nu in self.nus:
for Nroots in [5, 2000]:
# Ensure coverage
j_ = bessel.j_root(nu, Nroots)
J = bes... | [
"mmfutils.math.bessel.j_root",
"numpy.allclose",
"mmfutils.math.bessel.J",
"numpy.linspace",
"mmfutils.math.bessel.J_sqrt_pole"
] | [((478, 504), 'numpy.linspace', 'np.linspace', (['(0.01)', '(1.1)', '(10)'], {}), '(0.01, 1.1, 10)\n', (489, 504), True, 'import numpy as np\n'), ((548, 573), 'mmfutils.math.bessel.j_root', 'bessel.j_root', (['nu', 'Nroots'], {}), '(nu, Nroots)\n', (561, 573), False, 'from mmfutils.math import bessel\n'), ((271, 296), ... |
from abc import abstractmethod, ABC
import numpy as np
from numpy import meshgrid
from swutil.validation import Integer, Positive, validate_args
class AbstractProbabilityDistribution(ABC):
'''
Probability spaces over subsets of Euclidean space
'''
@abstractmethod
def lebesgue_density(self, X):... | [
"numpy.meshgrid",
"swutil.validation.validate_args",
"numpy.zeros",
"numpy.ones",
"numpy.exp",
"numpy.linspace",
"numpy.sqrt"
] | [((2413, 2442), 'swutil.validation.validate_args', 'validate_args', ([], {'warnings': '(False)'}), '(warnings=False)\n', (2426, 2442), False, 'from swutil.validation import Integer, Positive, validate_args\n'), ((3088, 3117), 'swutil.validation.validate_args', 'validate_args', ([], {'warnings': '(False)'}), '(warnings=... |
import random
import numpy as np
from collections import namedtuple, deque
# Pytorch imports
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
# Implementation imports
from model import Actor, Critic
#from model import Critic
#import shared_memory
BUFFER_SIZE = int(1e5)... | [
"torch.from_numpy",
"model.Critic",
"random.sample",
"torch.nn.functional.mse_loss",
"numpy.clip",
"random.seed",
"torch.cuda.is_available",
"collections.namedtuple",
"numpy.vstack",
"torch.no_grad",
"collections.deque",
"model.Actor"
] | [((616, 641), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (639, 641), False, 'import torch\n'), ((1075, 1100), 'collections.deque', 'deque', ([], {'maxlen': 'buffer_size'}), '(maxlen=buffer_size)\n', (1080, 1100), False, 'from collections import namedtuple, deque\n'), ((1152, 1245), 'collect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.