code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
# coding: utf-8
import os
import time
os.environ['TRKXINPUTDIR']="/global/cfs/cdirs/m3443/data/trackml-kaggle/train_10evts"
os.environ['TRKXOUTPUTDIR']= "/global/cfs/projectdirs/m3443/usr/caditi97/iml2020/outtest"
import numpy as np
import pandas as pd
# 3rd party
import torch
from torch_geomet... | [
"numpy.arctan2",
"argparse.ArgumentParser",
"torch.sqrt",
"exatrkx.src.processing.utils.detector_utils.load_detector",
"torch.cat",
"trackml.dataset.load_event",
"gc.collect",
"exatrkx.src.processing.utils.cell_utils.get_one_event",
"torch.arange",
"torch.no_grad",
"numpy.unique",
"exatrkx.Lay... | [((2139, 2186), 'torch.load', 'torch.load', (['embed_ckpt_dir'], {'map_location': 'device'}), '(embed_ckpt_dir, map_location=device)\n', (2149, 2186), False, 'import torch\n'), ((3484, 3533), 'torch.sqrt', 'torch.sqrt', (['(data.x[:, 0] ** 2 + data.x[:, 2] ** 2)'], {}), '(data.x[:, 0] ** 2 + data.x[:, 2] ** 2)\n', (349... |
"""
"""
import pyscal.traj_process as ptp
from pyscal.formats.ase import convert_snap
import pyscal.routines as routines
import os
import numpy as np
import warnings
import pyscal.csystem as pc
from pyscal.catom import Atom
import itertools
from ase.io import write
import uuid
import gzip
import io
import pyscal.vi... | [
"os.remove",
"numpy.abs",
"numpy.sum",
"pyscal.routines.get_energy_atom",
"pyscal.formats.ase.convert_snap",
"numpy.argsort",
"numpy.histogram",
"numpy.mean",
"numpy.linalg.norm",
"numpy.sqrt",
"numpy.unique",
"pyscal.visualization.plot_system",
"pyscal.csystem.System.__init__",
"numpy.cei... | [((896, 902), 'pyscal.catom.Atom', 'Atom', ([], {}), '()\n', (900, 902), False, 'from pyscal.catom import Atom\n'), ((2139, 2163), 'pyscal.csystem.System.__init__', 'pc.System.__init__', (['self'], {}), '(self)\n', (2157, 2163), True, 'import pyscal.csystem as pc\n'), ((6029, 6118), 'pyscal.traj_process.read_file', 'pt... |
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"apache_beam.testing.util.assert_that",
"absl.testing.absltest.main",
"apache_beam.Create",
"tensorflow_model_analysis.metrics.metric_types.MetricKey",
"apache_beam.metrics.metric.MetricsFilter",
"numpy.std",
"apache_beam.Pipeline",
"numpy.mean",
"numpy.array",
"tensorflow_model_analysis.evaluator... | [((11229, 11244), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (11242, 11244), False, 'from absl.testing import absltest\n'), ((3086, 3138), 'tensorflow_model_analysis.evaluators.confidence_intervals_util.mean_and_std', 'confidence_intervals_util.mean_and_std', (['values', 'ddof'], {}), '(values, dd... |
"""
Move to specified pose (with Robot class)
Author: <NAME> (daniel-s-ingram)
<NAME> (@Atsushi_twi)
<NAME> (@Muhammad-Yazdian)
P.<NAME>, "Robotics, Vision & Control", Springer 2017, ISBN 978-3-319-54413-7
"""
import matplotlib.pyplot as plt
import numpy as np
import copy
from move_to_pose import P... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"move_to_pose.PathFinderController",
"copy.copy",
"numpy.sin",
"numpy.array",
"matplotlib.pyplot.cla",
"numpy.cos",
"numpy.sign",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.pause"
] | [((6177, 6230), 'matplotlib.pyplot.plot', 'plt.plot', (['[p1[0], p2[0]]', '[p1[1], p2[1]]', "(color + '-')"], {}), "([p1[0], p2[0]], [p1[1], p2[1]], color + '-')\n", (6185, 6230), True, 'import matplotlib.pyplot as plt\n'), ((6233, 6286), 'matplotlib.pyplot.plot', 'plt.plot', (['[p2[0], p3[0]]', '[p2[1], p3[1]]', "(col... |
from typing import List, Tuple
import numpy as np
from nptyping import NDArray
from pandas import DataFrame
from scipy.stats import expon
from dlsys.model import DualSysyem
def expon_equally_spaced(mean_interval: float, _min: float,
n: int) -> NDArray[1, float]:
intervals = expon.ppf(
... | [
"pandas.DataFrame",
"dlsys.model.DualSysyem",
"numpy.linspace",
"pathlib.Path"
] | [((1579, 1625), 'pandas.DataFrame', 'DataFrame', (['row_of_result'], {'columns': "['gk', 'hk']"}), "(row_of_result, columns=['gk', 'hk'])\n", (1588, 1625), False, 'from pandas import DataFrame\n'), ((2474, 2520), 'pandas.DataFrame', 'DataFrame', (['row_of_result'], {'columns': "['gk', 'hk']"}), "(row_of_result, columns... |
import numpy as np
from qsim import Operation, Circuit
class OperationIdentity(Operation):
"""
Identity quantum operation
"""
def __init__(self, circuit: Circuit):
op_matrix = np.array([
[1, 0],
[0, 1]])
super().__init__(circuit, op_matrix)
| [
"numpy.array"
] | [((202, 228), 'numpy.array', 'np.array', (['[[1, 0], [0, 1]]'], {}), '([[1, 0], [0, 1]])\n', (210, 228), True, 'import numpy as np\n')] |
import numpy as np
import plotly.graph_objects as go
from plotly.colors import n_colors
np.random.seed(1)
# 12 sets of normal distributed random data, with increasing mean and standard deviation
data = (np.linspace(1, 2, 12)[:, np.newaxis] * np.random.randn(12, 200) +
(np.arange(12) + 2 * np.random.random(12))... | [
"numpy.random.seed",
"numpy.random.randn",
"plotly.graph_objects.Figure",
"plotly.colors.n_colors",
"numpy.random.random",
"numpy.arange",
"numpy.linspace",
"plotly.graph_objects.Violin"
] | [((89, 106), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (103, 106), True, 'import numpy as np\n'), ((347, 416), 'plotly.colors.n_colors', 'n_colors', (['"""rgb(5, 200, 200)"""', '"""rgb(200, 10, 10)"""', '(12)'], {'colortype': '"""rgb"""'}), "('rgb(5, 200, 200)', 'rgb(200, 10, 10)', 12, colortype='r... |
## Cite as: https://link.springer.com/chapter/10.1007/978-3-030-12450-2_29
from cv2 import imread, cvtColor, COLOR_BGR2RGB as RGB, COLOR_BGR2GRAY as GRAY
from matplotlib.pyplot import subplots, subplots_adjust, axes, show
from matplotlib.widgets import Slider, RadioButtons
## https://matplotlib.org/3.2.1/gallery/widge... | [
"matplotlib.pyplot.show",
"matplotlib.widgets.RadioButtons",
"warnings.filterwarnings",
"matplotlib.pyplot.axes",
"matplotlib.widgets.Slider",
"auxiliary.displayImages",
"random.choice",
"cv2.imread",
"numpy.random.poisson",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots"
] | [((528, 561), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (551, 561), False, 'import warnings\n'), ((1101, 1111), 'matplotlib.pyplot.subplots', 'subplots', ([], {}), '()\n', (1109, 1111), False, 'from matplotlib.pyplot import subplots, subplots_adjust, axes, show\n'), (... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/1/16 22:12
# @author : Mo
# @function: only model predict
import pathlib
import sys
import os
project_path = str(pathlib.Path(os.path.abspath(__file__)).parent.parent.parent.parent)
sys.path.append(project_path)
from macropodus.preprocess.tools_ml import ... | [
"sys.path.append",
"os.path.abspath",
"codecs.open",
"keras_bert.Tokenizer",
"numpy.argmax",
"macropodus.preprocess.tools_common.load_json",
"macropodus.preprocess.tools_ml.macropodus_cut",
"numpy.array",
"os.path.join"
] | [((246, 275), 'sys.path.append', 'sys.path.append', (['project_path'], {}), '(project_path)\n', (261, 275), False, 'import sys\n'), ((908, 949), 'os.path.join', 'os.path.join', (['self.path_dir', '"""graph.json"""'], {}), "(self.path_dir, 'graph.json')\n", (920, 949), False, 'import os\n'), ((971, 1010), 'os.path.join'... |
from numpy.core.arrayprint import printoptions
from utils import tab_printer
from sg_net import SGTrainer
from parser_sg import sgpr_args
import numpy as np
from tqdm import tqdm
import os
import sys
from matplotlib import pyplot as plt
from sklearn import metrics
from utils import *
def main():
args = sgpr_args(... | [
"utils.tab_printer",
"matplotlib.pyplot.title",
"numpy.sum",
"numpy.nan_to_num",
"matplotlib.pyplot.figure",
"os.path.join",
"os.path.abspath",
"os.path.exists",
"sg_net.SGTrainer",
"numpy.max",
"tqdm.tqdm",
"numpy.save",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"sklearn.met... | [((310, 321), 'parser_sg.sgpr_args', 'sgpr_args', ([], {}), '()\n', (319, 321), False, 'from parser_sg import sgpr_args\n'), ((486, 503), 'utils.tab_printer', 'tab_printer', (['args'], {}), '(args)\n', (497, 503), False, 'from utils import tab_printer\n'), ((518, 540), 'sg_net.SGTrainer', 'SGTrainer', (['args', '(False... |
from ....tools.conversion import r_function
from ....tools.decorators import method
from ....tools.utils import check_version
import numpy as np
import pandas as pd
_rctd = r_function("rctd.R")
@method(
method_name="RCTD",
paper_name="Robust decomposition of cell type mixtures in spatial transcriptomics",
... | [
"numpy.ones"
] | [((816, 847), 'numpy.ones', 'np.ones', (['(sc_adata.shape[0], 2)'], {}), '((sc_adata.shape[0], 2))\n', (823, 847), True, 'import numpy as np\n')] |
import numpy as np
from modpy.stats._core import auto_correlation_time
class MCMCResult:
def __init__(self, x, f, samples, burn, success=False, status=0, message='', nit=0):
# state-space
self.x = x # chain, array_like, shape (n, m)
self.f = f # likelihood, array_like, shape ... | [
"numpy.amin",
"numpy.std",
"numpy.percentile",
"numpy.amax",
"numpy.mean",
"numpy.array",
"modpy.stats._core.auto_correlation_time"
] | [((1596, 1619), 'numpy.mean', 'np.mean', (['self.x'], {'axis': '(0)'}), '(self.x, axis=0)\n', (1603, 1619), True, 'import numpy as np\n'), ((1640, 1662), 'numpy.std', 'np.std', (['self.x'], {'axis': '(0)'}), '(self.x, axis=0)\n', (1646, 1662), True, 'import numpy as np\n'), ((1718, 1741), 'numpy.amin', 'np.amin', (['se... |
"""
Reference: <NAME> et al., "Deep Matrix Factorization Models for Recommender Systems." In IJCAI2017.
@author: wubin
"""
import tensorflow as tf
import numpy as np
from time import time
from util import learner, tool
from model.AbstractRecommender import AbstractRecommender
from util import timer
class DMF(Abstra... | [
"tensorflow.reduce_sum",
"tensorflow.nn.relu",
"util.learner.optimizer",
"time.time",
"tensorflow.placeholder",
"tensorflow.matmul",
"numpy.random.randint",
"numpy.array",
"numpy.arange",
"tensorflow.square",
"util.learner.pointwise_loss",
"tensorflow.name_scope",
"util.tool.get_initializer"... | [((7886, 7922), 'numpy.array', 'np.array', (['user_input'], {'dtype': 'np.int32'}), '(user_input, dtype=np.int32)\n', (7894, 7922), True, 'import numpy as np\n'), ((7944, 7980), 'numpy.array', 'np.array', (['item_input'], {'dtype': 'np.int32'}), '(item_input, dtype=np.int32)\n', (7952, 7980), True, 'import numpy as np\... |
import numpy as np
try:
import faiss
except ImportError:
faiss = None
class QueryExpansion:
def __init__(
self,
alpha=1,
k=2,
similarity_threshold=None,
normalize_similarity=False,
strategy_to_deal_original="discard",
n_query_update_iter=1,
... | [
"faiss.index_cpu_to_all_gpus",
"numpy.ceil",
"numpy.concatenate",
"numpy.expand_dims",
"faiss.IndexFlatIP",
"numpy.apply_along_axis",
"numpy.linalg.norm",
"numpy.vstack"
] | [((1026, 1074), 'faiss.IndexFlatIP', 'faiss.IndexFlatIP', (['reference_embeddings.shape[1]'], {}), '(reference_embeddings.shape[1])\n', (1043, 1074), False, 'import faiss\n'), ((2898, 2941), 'numpy.expand_dims', 'np.expand_dims', (['(sims ** self.alpha)'], {'axis': '(-1)'}), '(sims ** self.alpha, axis=-1)\n', (2912, 29... |
from os import listdir
from sys import argv
import numpy as np
def load_data(filename):
return np.loadtxt(filename, delimiter='\t')
def compute_nrmse(gt, mask, imputations):
# Compute normalized root mean squared error for a column.
std = gt.std()
gt = gt[mask]
imputations = imputations[mask]
... | [
"numpy.round",
"numpy.loadtxt",
"numpy.isnan",
"numpy.argmax"
] | [((1508, 1528), 'numpy.isnan', 'np.isnan', (['input_data'], {}), '(input_data)\n', (1516, 1528), True, 'import numpy as np\n'), ((102, 138), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'delimiter': '"""\t"""'}), "(filename, delimiter='\\t')\n", (112, 138), True, 'import numpy as np\n'), ((886, 915), 'numpy.argmax', ... |
import pytest
import numpy as np
from jina.flow import Flow
from jina.drivers.helper import array2pb
from jina.proto import jina_pb2, uid
@pytest.mark.parametrize('random_workspace_name', ['JINA_TEST_WORKSPACE_BINARY_PB'])
def test_binarypb_in_flow(test_metas):
def random_docs(num_docs, chunks_per_doc=5, embed_di... | [
"jina.proto.jina_pb2.Document",
"numpy.random.randint",
"jina.flow.Flow",
"pytest.mark.parametrize",
"jina.proto.uid.new_doc_id"
] | [((141, 229), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""random_workspace_name"""', "['JINA_TEST_WORKSPACE_BINARY_PB']"], {}), "('random_workspace_name', [\n 'JINA_TEST_WORKSPACE_BINARY_PB'])\n", (164, 229), False, 'import pytest\n'), ((444, 463), 'jina.proto.jina_pb2.Document', 'jina_pb2.Document',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 31 11:14:21 2018
@author: nsde
"""
#%%
import numpy as np
from sklearn.neighbors import NearestNeighbors, KNeighborsClassifier
from sklearn.decomposition import PCA
from sklearn.metrics import pairwise_distances
from tqdm import tqdm
from .utility i... | [
"tqdm.tqdm",
"sklearn.metrics.pairwise_distances",
"numpy.zeros",
"numpy.ones",
"numpy.argsort",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.where",
"sklearn.decomposition.PCA",
"numpy.reshape",
"sklearn.neighbors.NearestNeighbors",
"numpy.array",
"numpy.array_equal",
"numpy.vstack",
... | [((910, 923), 'numpy.vstack', 'np.vstack', (['tN'], {}), '(tN)\n', (919, 923), True, 'import numpy as np\n'), ((1119, 1135), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1127, 1135), True, 'import numpy as np\n'), ((2096, 2118), 'numpy.reshape', 'np.reshape', (['X', '(N, -1)'], {}), '(X, (N, -1))\n', (21... |
import cv2
import numpy as np
import time
from threading import Thread
try:
import pygame
from pygame.locals import K_DOWN
from pygame.locals import K_LEFT
from pygame.locals import K_RIGHT
from pygame.locals import K_UP
from pygame.locals import K_a
from pygame.locals import K_d
from p... | [
"pygame.key.get_pressed",
"pygame.quit",
"threading.Thread",
"cv2.resize",
"pygame.display.set_mode",
"pygame.event.pump",
"pygame.init",
"time.sleep",
"numpy.hstack",
"pygame.display.flip",
"pygame.font.init",
"pygame.display.set_caption",
"pygame.time.Clock",
"carla.VehicleControl",
"n... | [((895, 908), 'pygame.init', 'pygame.init', ([], {}), '()\n', (906, 908), False, 'import pygame\n'), ((917, 935), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (933, 935), False, 'import pygame\n'), ((958, 977), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (975, 977), False, 'import pygame\n'... |
import cv2
import numpy as np
from extraction.Fp import getOriGrad, enhance_fingerprint
from compute_freq import compute_global_freq
def drawOrientation(ori, background, mask=None, block_size=16, color=(255, 0, 0), thickness=1, is_block_ori=False):
'''
:param im: the background image to draw orientation field... | [
"cv2.line",
"numpy.stack",
"cv2.waitKey",
"cv2.imwrite",
"numpy.ones",
"cv2.imread",
"extraction.Fp.enhance_fingerprint",
"numpy.sin",
"numpy.cos",
"compute_freq.compute_global_freq",
"cv2.imshow",
"extraction.Fp.getOriGrad"
] | [((2576, 2605), 'cv2.imshow', 'cv2.imshow', (['win_name', 'im_show'], {}), '(win_name, im_show)\n', (2586, 2605), False, 'import cv2\n'), ((2693, 2718), 'cv2.imread', 'cv2.imread', (['"""./14.bmp"""', '(0)'], {}), "('./14.bmp', 0)\n", (2703, 2718), False, 'import cv2\n'), ((2751, 2774), 'extraction.Fp.getOriGrad', 'get... |
# Copyright 2020 The TensorFlow 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 applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.keras.models.save_model",
"tensorflow.python.keras.models.load_model",
"tensorflow.python.keras.testing_utils.get_save_format",
"numpy.random.random",
"absl.testing.parameterized.named_parameters",
"os.path.join"
] | [((2094, 2157), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (['*model_architectures.ALL_MODELS'], {}), '(*model_architectures.ALL_MODELS)\n', (2124, 2157), False, 'from absl.testing import parameterized\n'), ((3266, 3277), 'tensorflow.python.platform.test.main', 'test.main', ([], {}... |
"""
Created on Mon Sep 23 23:00:08 2019
@author: vince
"""
import numpy as np
from PIL import Image
import cv2
img = Image.open("gray.jpg")
imgArray = 1./255 * np.asarray(img, dtype="float32")
def AddRandNoise(I, m):
noise = np.random.uniform(-m,m,(I.shape[0],I.shape[1])).astype("float32")
re... | [
"cv2.GaussianBlur",
"numpy.random.uniform",
"cv2.medianBlur",
"cv2.imwrite",
"numpy.asarray",
"PIL.Image.open",
"cv2.imread",
"cv2.split",
"numpy.random.choice",
"cv2.merge",
"numpy.sqrt"
] | [((130, 152), 'PIL.Image.open', 'Image.open', (['"""gray.jpg"""'], {}), "('gray.jpg')\n", (140, 152), False, 'from PIL import Image\n'), ((411, 449), 'cv2.imwrite', 'cv2.imwrite', (['"""A1_Q6_a.jpg"""', 'noiseImage'], {}), "('A1_Q6_a.jpg', noiseImage)\n", (422, 449), False, 'import cv2\n'), ((464, 503), 'cv2.GaussianBl... |
import joblib
import librosa
import numpy as np
import soundfile as sf
from extract_feats import extract_features
class VoiceGenderClassifier:
def __init__(self, model_path, fs):
self.model = joblib.load(model_path)
self.fs = fs
def _normalize_audio(self, audio, fs):
if len(audio.sha... | [
"soundfile.read",
"extract_feats.extract_features",
"librosa.resample",
"numpy.array",
"joblib.load"
] | [((1163, 1182), 'soundfile.read', 'sf.read', (['audio_path'], {}), '(audio_path)\n', (1170, 1182), True, 'import soundfile as sf\n'), ((207, 230), 'joblib.load', 'joblib.load', (['model_path'], {}), '(model_path)\n', (218, 230), False, 'import joblib\n'), ((616, 643), 'extract_feats.extract_features', 'extract_features... |
#
"""
Tools for working with JWST pipeline DQ bitmask arrays.
Author: <NAME> (<EMAIL>)
REVISION HISTORY:
02-Aug-2021 First written by <NAME> (<EMAIL>)
"""
import os as os
import sys
import math
import numpy as np
from astropy.io import fits
from numpy.testing import assert_allclose
import miricoord.mrs.mrs_tools as... | [
"stcal.dqflags.dqflags_to_mnemonics",
"stcal.dqflags.interpret_bit_flags",
"numpy.where"
] | [((846, 920), 'stcal.dqflags.dqflags_to_mnemonics', 'dqflags.dqflags_to_mnemonics', (['value'], {'mnemonic_map': 'datamodels.dqflags.pixel'}), '(value, mnemonic_map=datamodels.dqflags.pixel)\n', (874, 920), False, 'from stcal import dqflags\n'), ((1225, 1297), 'stcal.dqflags.interpret_bit_flags', 'dqflags.interpret_bit... |
# -*- coding: utf-8 -*-
"""
Created on Fr March 23 01:21:40 2018
@author: <NAME>
"""
import os
import cv2
import dlib
import numpy as np
import argparse
from wide_resnet import WideResNet
def get_args():
parser = argparse.ArgumentParser(description="This script detects faces from web cam input, ... | [
"cv2.putText",
"argparse.ArgumentParser",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.getTextSize",
"wide_resnet.WideResNet",
"cv2.VideoCapture",
"numpy.shape",
"numpy.arange",
"dlib.get_frontal_face_detector",
"cv2.rectangle",
"cv2.imshow",
"os.path.join",
"cv2.resize"
] | [((237, 440), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script detects faces from web cam input, and estimates age and gender for the detected faces."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'This script detects faces from web cam ... |
# see: https://gym.openai.com/envs/FrozenLake8x8-v0/
# see: https://towardsdatascience.com/reinforcement-learning-with-openai-d445c2c687d2
import gym
import numpy as np
import os
def clear_output():
os.system('clear') # clear for *nix, cls for windows?
def render(env):
clear_output()
env.render()
clear_ou... | [
"gym.make",
"numpy.random.randn",
"numpy.zeros",
"os.system",
"numpy.max"
] | [((378, 406), 'gym.make', 'gym.make', (['"""FrozenLake8x8-v0"""'], {}), "('FrozenLake8x8-v0')\n", (386, 406), False, 'import gym\n'), ((411, 466), 'numpy.zeros', 'np.zeros', (['[env.observation_space.n, env.action_space.n]'], {}), '([env.observation_space.n, env.action_space.n])\n', (419, 466), True, 'import numpy as n... |
# ----------------------------------------------------------------------------
# Title: Scientific Visualisation - Python & Matplotlib
# Author: <NAME>
# License: BSD
# ----------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ti... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.connect",
"matplotlib.pyplot.savefig"
] | [((2701, 2745), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(width, height)', 'dpi': '(100)'}), '(figsize=(width, height), dpi=100)\n', (2711, 2745), True, 'import matplotlib.pyplot as plt\n'), ((2751, 2764), 'matplotlib.pyplot.subplot', 'plt.subplot', ([], {}), '()\n', (2762, 2764), True, 'import matpl... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>).
# Modified by <NAME> (<EMAIL>).
# ------------------------------------------------------------------------------
from __future__ import absolute_im... | [
"torch.eq",
"copy.deepcopy",
"numpy.meshgrid",
"torch.topk",
"torch.stack",
"torch.argmax",
"numpy.zeros",
"torch.cat",
"numpy.exp",
"numpy.linspace",
"torch.nn.MaxPool2d",
"torch.argmin"
] | [((1247, 1301), 'numpy.linspace', 'np.linspace', (['(0)', '(heatmap_y_length - 1)', 'heatmap_y_length'], {}), '(0, heatmap_y_length - 1, heatmap_y_length)\n', (1258, 1301), True, 'import numpy as np\n'), ((1310, 1364), 'numpy.linspace', 'np.linspace', (['(0)', '(heatmap_x_length - 1)', 'heatmap_x_length'], {}), '(0, he... |
"""
Geometry generator from
Shapefiles (buiding footprint)
and .tiff (terrain)
into 3D geometry with windows and roof equivalent to LOD3
"""
import os
import pickle
from itertools import repeat
from osgeo import gdal, osr
import geopandas as gpd
import cea
cea.suppress_3rd_party_debug_loggers()
import math
import... | [
"py4design.py3dmodel.calculate.face_normal",
"py4design.py3dmodel.construct.delaunay3d",
"cea.utilities.devnull",
"py4design.py3dmodel.modify.uniform_scale",
"numpy.shape",
"py4design.py3dmodel.construct.boolean_difference",
"pickle.load",
"numpy.arange",
"py4design.py3dmodel.construct.simple_mesh",... | [((262, 300), 'cea.suppress_3rd_party_debug_loggers', 'cea.suppress_3rd_party_debug_loggers', ([], {}), '()\n', (298, 300), False, 'import cea\n'), ((3484, 3498), 'math.sqrt', 'math.sqrt', (['wwr'], {}), '(wwr)\n', (3493, 3498), False, 'import math\n'), ((3829, 3863), 'py4design.py3dmodel.construct.simple_mesh', 'const... |
import numpy as np
import pytest
from pros_noisefiltering.WT_NoiProc import WT_NoiseChannelProc
def test_one():
pass
@pytest.fixture
def example_wtncp()->WT_NoiseChannelProc:
return WT_NoiseChannelProc(desc='description sample', fs_Hz=100,
data = np.zeros((100,)),
channel_name= 'Torq... | [
"numpy.zeros",
"pros_noisefiltering.WT_NoiProc.WT_NoiseChannelProc.from_obj"
] | [((885, 947), 'pros_noisefiltering.WT_NoiProc.WT_NoiseChannelProc.from_obj', 'WT_NoiseChannelProc.from_obj', (['example_wtncp'], {'operation': '"""copy """'}), "(example_wtncp, operation='copy ')\n", (913, 947), False, 'from pros_noisefiltering.WT_NoiProc import WT_NoiseChannelProc\n'), ((705, 721), 'numpy.zeros', 'np.... |
import logging
import datetime
import numpy as np
from aquacrop_fd.templates import parser
logger = logging.getLogger(__name__)
FREQUENCY_CODES = {
'daily': 1,
'10-daily': 2,
'monthly': 3
}
START_DATE_BLANK = datetime.datetime(1901, 1, 1)
def _get_frequency(dates):
"""Get frequency in days from l... | [
"numpy.ceil",
"numpy.argmax",
"numpy.ndim",
"datetime.datetime",
"numpy.shape",
"numpy.diff",
"aquacrop_fd.templates.parser.change_lines",
"logging.getLogger"
] | [((103, 130), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (120, 130), False, 'import logging\n'), ((226, 255), 'datetime.datetime', 'datetime.datetime', (['(1901)', '(1)', '(1)'], {}), '(1901, 1, 1)\n', (243, 255), False, 'import datetime\n'), ((345, 359), 'numpy.diff', 'np.diff', (['d... |
#!/usr/bin/env python3
import sys
sys.path.append('../..')
import numpy as np
from neml.cp import crystallography, slipharden, sliprules, inelasticity, kinematics, singlecrystal
from neml.math import rotations, tensors, nemlmath
from neml import elasticity
import matplotlib.pyplot as plt
if __name__ == "__main__":... | [
"sys.path.append",
"neml.elasticity.IsotropicLinearElasticModel",
"neml.cp.crystallography.CubicLattice",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.copy",
"neml.math.nemlmath.sym",
"neml.cp.inelasticity.AsaroInelasticity",
"neml.cp.sliprules.PowerLawSlipRule",
"numpy.zeros",
"nu... | [((35, 59), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (50, 59), False, 'import sys\n'), ((327, 378), 'numpy.array', 'np.array', (['[[-0.5, 0, 0], [0, 1.0, 0], [0, 0, -0.5]]'], {}), '([[-0.5, 0, 0], [0, 1.0, 0], [0, 0, -0.5]])\n', (335, 378), True, 'import numpy as np\n'), ((560, 589), ... |
import numpy as np
import json
from keras.preprocessing.sequence import TimeseriesGenerator
from tensorflow import keras
import tensorflow as tf
from keras.models import Sequential
from keras.layers import LSTM, Dense
import plotly.graph_objects as go
data = {}
with open('owid-covid-data.json') as f:
data = json.... | [
"plotly.graph_objects.Scatter",
"json.load",
"tensorflow.keras.models.load_model",
"plotly.graph_objects.Figure",
"keras.layers.LSTM",
"keras.preprocessing.sequence.TimeseriesGenerator",
"numpy.append",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential"
] | [((797, 874), 'keras.preprocessing.sequence.TimeseriesGenerator', 'TimeseriesGenerator', (['cases_train', 'cases_train'], {'length': 'lookback', 'batch_size': '(14)'}), '(cases_train, cases_train, length=lookback, batch_size=14)\n', (816, 874), False, 'from keras.preprocessing.sequence import TimeseriesGenerator\n'), (... |
import string
import numpy as np
from pandas import DataFrame, MultiIndex, Series, concat, date_range, merge, merge_asof
from pandas import pipeline_merge
import pandas.util.testing as tm
try:
from pandas import merge_ordered
except ImportError:
from pandas import ordered_merge as merge_ordered
N = 1000000... | [
"pandas.util.testing.makeStringIndex",
"pandas.merge",
"numpy.tile",
"numpy.random.randn"
] | [((419, 448), 'numpy.tile', 'np.tile', (['indices[:1000000]', '(1)'], {}), '(indices[:1000000], 1)\n', (426, 448), True, 'import numpy as np\n'), ((456, 486), 'numpy.tile', 'np.tile', (['indices2[:1000000]', '(1)'], {}), '(indices2[:1000000], 1)\n', (463, 486), True, 'import numpy as np\n'), ((344, 365), 'pandas.util.t... |
"""
Detect Methane hotspots
------------------------------
Functions to load and detect methane hotspots
"""
import pandas as pd
import numpy as np
import geopandas as gpd
import shapely
import ee
# Load infra
from methane.infrastructure import plants_as_gdf, pipelines_as_gdf
df_plants = plants_as_gdf()
df_pipelines... | [
"geopandas.to_file",
"methane.infrastructure.pipelines_as_gdf",
"numpy.log",
"ee.ImageCollection",
"ee.Kernel.plus",
"ee.Reducer.median",
"methane.infrastructure.plants_as_gdf",
"ee.Image.pixelArea",
"ee.Kernel.square",
"geopandas.GeoDataFrame",
"ee.Reducer.mean",
"shapely.geometry.shape",
"... | [((292, 307), 'methane.infrastructure.plants_as_gdf', 'plants_as_gdf', ([], {}), '()\n', (305, 307), False, 'from methane.infrastructure import plants_as_gdf, pipelines_as_gdf\n'), ((323, 341), 'methane.infrastructure.pipelines_as_gdf', 'pipelines_as_gdf', ([], {}), '()\n', (339, 341), False, 'from methane.infrastructu... |
"""
Calculation of the various metrics for quantifying the behaviour of grid cells
and some graphical output etc
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from ephysiopy.common.binning import RateMap
from ephysiopy.common.ephys_generic import FieldCalcs
from ephysiopy.common.uti... | [
"ephysiopy.common.utils.rect",
"ephysiopy.common.ephys_generic.FieldCalcs",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.linspace",
"ephysiopy.common.binning.RateMap",
"numpy.atleast_2d"
] | [((1409, 1418), 'ephysiopy.common.binning.RateMap', 'RateMap', ([], {}), '()\n', (1416, 1418), False, 'from ephysiopy.common.binning import RateMap\n'), ((2410, 2419), 'ephysiopy.common.binning.RateMap', 'RateMap', ([], {}), '()\n', (2417, 2419), False, 'from ephysiopy.common.binning import RateMap\n'), ((3732, 3741), ... |
# MIT License
# Copyright (c) 2017 Tuxedo
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | [
"numpy.argmax",
"os.path.isdir",
"pyseeta.Aligner",
"PIL.Image.open",
"PIL.Image.fromarray",
"os.path.isfile",
"numpy.array",
"pyseeta.Identifier",
"PIL.ImageDraw.Draw",
"pyseeta.Detector"
] | [((1912, 1935), 'pyseeta.Detector', 'Detector', (['model_path_fd'], {}), '(model_path_fd)\n', (1920, 1935), False, 'from pyseeta import Detector\n'), ((2119, 2146), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image_color'], {}), '(image_color)\n', (2133, 2146), False, 'from PIL import Image, ImageDraw\n'), ((2980, 3003)... |
from multiprocess.pool import ThreadPool
from synthesizer import audio
from functools import partial
from itertools import chain
from encoder import config, inference as encoder
from pathlib import Path
from utils import logmmse
from tqdm import tqdm
from audioread.exceptions import NoBackendError
from shutil import co... | [
"atexit.register",
"numpy.load",
"encoder.inference.is_loaded",
"numpy.abs",
"synthesizer.audio.melspectrogram",
"encoder.inference.load_model",
"encoder.inference.preprocess_wav",
"utils.logmmse.profile_noise",
"shutil.copyfile",
"functools.partial",
"json.dump",
"numpy.save",
"encoder.infe... | [((2368, 2433), 'atexit.register', 'atexit.register', (['save_metadata_progress', 'metadata', 'metadata_fpath'], {}), '(save_metadata_progress, metadata, metadata_fpath)\n', (2383, 2433), False, 'import atexit\n'), ((2475, 2681), 'functools.partial', 'partial', (['preprocess_speaker'], {'out_dir': 'out_dir', 'skip_exis... |
#Move marker towards marker center with stepper motors
from videoUtils import CaptureVideo
from motor import MotorNema
from control import generateCommands, Kp
#import firstOrderSystem
#import zeroOrderSystem
import threading
import time
import numpy as np
import cv2
import cv2.aruco as aruco
import markerUtil
import t... | [
"threading.Thread",
"cv2.circle",
"cv2.putText",
"control.generateCommands",
"cv2.waitKey",
"videoUtils.CaptureVideo",
"cv2.imshow",
"motor.MotorNema",
"time.sleep",
"numpy.clip",
"markerUtil.findArucoMarker",
"cv2.destroyAllWindows"
] | [((345, 359), 'videoUtils.CaptureVideo', 'CaptureVideo', ([], {}), '()\n', (357, 359), False, 'from videoUtils import CaptureVideo\n'), ((369, 380), 'motor.MotorNema', 'MotorNema', ([], {}), '()\n', (378, 380), False, 'from motor import MotorNema\n'), ((1056, 1069), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (... |
"""
Modified from OpenAI Baselines code to work with multi-agent envs
"""
import numpy as np
from multiprocessing import Process, Pipe
from baselines.common.vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while Tru... | [
"numpy.stack",
"multiprocessing.Pipe",
"numpy.array",
"baselines.common.vec_env.VecEnv.__init__",
"baselines.common.vec_env.CloudpickleWrapper"
] | [((2739, 2806), 'baselines.common.vec_env.VecEnv.__init__', 'VecEnv.__init__', (['self', 'self.length', 'observation_space', 'action_space'], {}), '(self, self.length, observation_space, action_space)\n', (2754, 2806), False, 'from baselines.common.vec_env import VecEnv, CloudpickleWrapper\n'), ((4885, 4952), 'baseline... |
import os
import torch
import numpy as np
import torch.distributed as dist
from runx.logx import logx
from ignite.engine import Events
from ignite.handlers import Timer
from torch.nn.functional import normalize
from engine.engine import create_eval_engine
from engine.engine import create_train_engine
from engine.metri... | [
"torch.distributed.is_initialized",
"utils.eval_cmc.eval_rank_list",
"runx.logx.logx.msg",
"torch.distributed.get_rank",
"runx.logx.logx.metric",
"ignite.handlers.Timer",
"torch.distributed.barrier",
"torch.cat",
"torch.save",
"numpy.argsort",
"engine.engine.create_train_engine",
"torch.cuda.e... | [((595, 644), 'engine.engine.create_train_engine', 'create_train_engine', (['model', 'optimizer', 'enable_amp'], {}), '(model, optimizer, enable_amp)\n', (614, 644), False, 'from engine.engine import create_train_engine\n'), ((978, 997), 'ignite.handlers.Timer', 'Timer', ([], {'average': '(True)'}), '(average=True)\n',... |
import os
import matplotlib.pyplot as plt
import skimage
import numpy as np
from skimage.metrics import peak_signal_noise_ratio
from skimage import feature
from skimage.color import rgb2gray, rgb2hsv
from skimage.filters import threshold_otsu
from skimage.io import imshow
directory = os.path.dirname(os.path.abspath(__... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.figure",
"skimage.metrics.normalized_root_mse",
"os.path.join",
"os.path.abspath",
"skimage.color.rgb2gray",
"skimage.filters.threshold_otsu",
"numpy.std",
"matplotlib.pyplot.imshow",
"skimage.io.imshow",
"matplotlib.pyplot.subplots",
... | [((417, 432), 'skimage.color.rgb2gray', 'rgb2gray', (['image'], {}), '(image)\n', (425, 432), False, 'from skimage.color import rgb2gray, rgb2hsv\n'), ((442, 466), 'skimage.feature.canny', 'feature.canny', (['grayscale'], {}), '(grayscale)\n', (455, 466), False, 'from skimage import feature\n'), ((476, 503), 'skimage.f... |
"""Solvers for multitask regression models."""
import warnings
import numpy as np
import numba as nb
from numba import (jit, float64, int64, boolean)
from joblib import Parallel, delayed
from sklearn.linear_model import Lasso
from sklearn.exceptions import ConvergenceWarning
from . import utils
from .solver_mtw_cd i... | [
"numpy.stack",
"numpy.ones_like",
"numpy.maximum",
"numpy.abs",
"numpy.asarray",
"numpy.zeros",
"numpy.asfortranarray",
"numpy.ones",
"numpy.sign",
"numpy.linalg.norm",
"joblib.Parallel",
"warnings.warn",
"numba.types.Tuple",
"joblib.delayed",
"sklearn.linear_model.Lasso",
"numpy.sqrt"... | [((1377, 1449), 'numba.types.Tuple', 'nb.types.Tuple', (['(float64[::1, :], float64[::1, :], float64[:, :], int64)'], {}), '((float64[::1, :], float64[::1, :], float64[:, :], int64))\n', (1391, 1449), True, 'import numba as nb\n'), ((691, 711), 'numpy.asfortranarray', 'np.asfortranarray', (['X'], {}), '(X)\n', (708, 71... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2019 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | [
"pyannote.generators.fragment.random_segment",
"pyannote.generators.fragment.random_subsegment",
"numpy.sum",
"numpy.ceil",
"pyannote.database.get_annotated",
"numpy.random.random_sample",
"numpy.log",
"pyannote.core.Segment",
"pyannote.core.Timeline",
"numpy.mean",
"numpy.array",
"numpy.rando... | [((3594, 3646), 'pyannote.audio.features.RawAudio', 'RawAudio', ([], {'sample_rate': 'feature_extraction.sample_rate'}), '(sample_rate=feature_extraction.sample_rate)\n', (3602, 3646), False, 'from pyannote.audio.features import RawAudio\n'), ((4248, 4303), 'numpy.array', 'np.array', (["[self.data_[uri]['duration'] for... |
from numpy import pi, cos, sin, ceil, vstack, array, repeat
from numpy.random import shuffle, uniform, normal, choice
from pandas import DataFrame
from haversine import haversine
from geoUtils import convertMetersToLat, convertMetersToLong
from pandasUtils import castDateTime, castFloat64
from collections import Ordere... | [
"numpy.random.uniform",
"numpy.random.shuffle",
"pandasUtils.castFloat64",
"random.choices",
"pandasUtils.castDateTime",
"haversine.haversine",
"geoUtils.convertMetersToLong",
"numpy.sin",
"numpy.array",
"numpy.random.normal",
"numpy.random.choice",
"collections.OrderedDict",
"numpy.cos",
... | [((583, 633), 'numpy.random.uniform', 'uniform', ([], {'low': 'latRange[0]', 'high': 'latRange[1]', 'size': 'n'}), '(low=latRange[0], high=latRange[1], size=n)\n', (590, 633), False, 'from numpy.random import shuffle, uniform, normal, choice\n'), ((772, 822), 'numpy.random.uniform', 'uniform', ([], {'low': 'lngRange[0]... |
import numpy as np
from sklearn.linear_model import Ridge,LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
class SlopeApproximator():
"""Acoustic sensor model"""
def __init__(self):
degree = 4
self.pf = PolynomialFeatures(degree)
... | [
"numpy.sum",
"numpy.zeros",
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.PolynomialFeatures",
"sklearn.pipeline.Pipeline",
"numpy.fromfunction"
] | [((287, 313), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', (['degree'], {}), '(degree)\n', (305, 313), False, 'from sklearn.preprocessing import PolynomialFeatures\n'), ((335, 387), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {'fit_intercept': '(True)', 'normalize': '(True)'})... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 11 23:56:39 2022
@author: sarangbhagwat
"""
from biorefineries.TAL.system_TAL_adsorption_glucose import u, get_SA_MPSP
from matplotlib import pyplot as plt
import numpy as np
column = u.AC401
MPSPs, aics = [], []
ads_caps = np.linspace(0.0739, 0.2474, 30)
for ac in ad... | [
"biorefineries.TAL.system_TAL_adsorption_glucose.get_SA_MPSP",
"matplotlib.pyplot.plot",
"numpy.linspace"
] | [((275, 306), 'numpy.linspace', 'np.linspace', (['(0.0739)', '(0.2474)', '(30)'], {}), '(0.0739, 0.2474, 30)\n', (286, 306), True, 'import numpy as np\n'), ((435, 460), 'matplotlib.pyplot.plot', 'plt.plot', (['ads_caps', 'MPSPs'], {}), '(ads_caps, MPSPs)\n', (443, 460), True, 'from matplotlib import pyplot as plt\n'), ... |
# Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | [
"argparse.ArgumentParser",
"monai.transforms.RandScaleIntensityd",
"monai.transforms.RandSpatialCropd",
"monai.transforms.LoadImaged",
"torch.distributed.get_world_size",
"torch.device",
"torch.no_grad",
"os.path.join",
"monai.utils.set_determinism",
"monai.transforms.AsChannelFirstd",
"monai.tr... | [((6287, 6348), 'torch.distributed.init_process_group', 'dist.init_process_group', ([], {'backend': '"""nccl"""', 'init_method': '"""env://"""'}), "(backend='nccl', init_method='env://')\n", (6310, 6348), True, 'import torch.distributed as dist\n'), ((6368, 6379), 'time.time', 'time.time', ([], {}), '()\n', (6377, 6379... |
# import _init_paths
import argparse
import os
import copy
import random
import numpy as np
from PIL import Image
import scipy.io as scio
import scipy.misc
import numpy.ma as ma
import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
impor... | [
"torch.bmm",
"torchvision.transforms.Normalize",
"lib_d.network.PoseNet",
"torch.load",
"lib_d.network.PoseRefineNet",
"numpy.transpose",
"lib_d.transformations.quaternion_from_matrix",
"numpy.append",
"numpy.random.shuffle",
"copy.deepcopy",
"torch.autograd.Variable",
"torch.norm",
"torch.m... | [((1136, 1211), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (1156, 1211), True, 'import torchvision.transforms as transforms\n'), ((3157, 3204), 'lib_d.network.PoseNet', ... |
import scratchai
import torch
import torch.nn as nn
import unittest
import requests
import zipfile
import io
import numpy as np
from torchvision import models, transforms
from PIL import Image
from inspect import isfunction
import matplotlib.pyplot as plt
from scratchai import *
NOISE = 'noise'
SEMANTIC = 'semantic'
... | [
"io.BytesIO",
"torch.randint",
"torchvision.transforms.ToPILImage",
"PIL.Image.open",
"numpy.array",
"requests.get",
"inspect.isfunction",
"scratchai.attacks.FGM",
"torch.tensor"
] | [((873, 900), 'PIL.Image.open', 'Image.open', (['"""/tmp/test.png"""'], {}), "('/tmp/test.png')\n", (883, 900), False, 'from PIL import Image\n'), ((1605, 1632), 'PIL.Image.open', 'Image.open', (['"""/tmp/test.png"""'], {}), "('/tmp/test.png')\n", (1615, 1632), False, 'from PIL import Image\n'), ((2432, 2459), 'PIL.Ima... |
#!/usr/bin/python
import sys
sys.path.append('../pycThermopack/')
import matplotlib.pyplot as plt
import numpy as np
from pyctp import extended_csp, pcsaft, tcPR
tc_pr = tcPR.tcPR()
tc_pr.init("CO2,N2")
csp = extended_csp.ext_csp()
csp.init("CO2,N2", "SRK", "Classic", "vdW", "NIST_MEOS", "C3")
pcs = pcsaft.pcsaft(... | [
"sys.path.append",
"matplotlib.pyplot.title",
"pyctp.extended_csp.ext_csp",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"pyctp.pcsaft.pcsaft",
"pyctp.tcPR.tcPR",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((30, 66), 'sys.path.append', 'sys.path.append', (['"""../pycThermopack/"""'], {}), "('../pycThermopack/')\n", (45, 66), False, 'import sys\n'), ((175, 186), 'pyctp.tcPR.tcPR', 'tcPR.tcPR', ([], {}), '()\n', (184, 186), False, 'from pyctp import extended_csp, pcsaft, tcPR\n'), ((214, 236), 'pyctp.extended_csp.ext_csp'... |
import functools
import pathlib
import h5py
import numpy as np
from ..afm_data import column_dtypes, known_columns
from ..meta import IMAGING_MODALITIES
__all__ = ["H5DictReader", "load_hdf5"]
class H5DictReader(object):
def __init__(self, path_or_h5, enum_key):
"""Read-only HDF5-based dictionary for ... | [
"numpy.asarray",
"functools.lru_cache",
"h5py.File",
"pathlib.Path"
] | [((1856, 1886), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(2)'}), '(maxsize=2)\n', (1875, 1886), False, 'import functools\n'), ((2206, 2231), 'h5py.File', 'h5py.File', (['path'], {'mode': '"""r"""'}), "(path, mode='r')\n", (2215, 2231), False, 'import h5py\n'), ((4347, 4385), 'pathlib.Path', 'path... |
# solutions.py
"""Volume I: Monte Carlo Integration
Solutions file. Written by <NAME>
"""
import numpy as np
import scipy.stats as stats
def mc_int(f, mins, maxs, numPoints=500, numIters=100):
"""Use Monte-Carlo integration to approximate the integral of f
on the box defined by mins and maxs.
Inputs:... | [
"scipy.stats.mvn.mvnun",
"numpy.average",
"numpy.apply_along_axis",
"numpy.array",
"numpy.random.rand"
] | [((1823, 1842), 'numpy.average', 'np.average', (['results'], {}), '(results)\n', (1833, 1842), True, 'import numpy as np\n'), ((2499, 2539), 'scipy.stats.mvn.mvnun', 'stats.mvn.mvnun', (['mins', 'maxs', 'means', 'covs'], {}), '(mins, maxs, means, covs)\n', (2514, 2539), True, 'import scipy.stats as stats\n'), ((2736, 2... |
from os.path import join, exists, isdir
import torch
from torch.utils.data import Dataset
from torchvision.datasets.folder import default_loader
from torch.utils.data import TensorDataset, Dataset, DataLoader
from torchvision.transforms import CenterCrop, Compose, Normalize, ToTensor
from mask_generators import Image... | [
"sklearn.datasets.make_circles",
"numpy.concatenate",
"torchvision.datasets.FashionMNIST",
"mask_generators.DropoutMaskGenerator",
"sklearn.model_selection.train_test_split",
"os.path.isdir",
"os.path.exists",
"torch.cat",
"numpy.random.normal",
"torchvision.datasets.MNIST",
"torchvision.dataset... | [((10656, 10678), 'mask_generators.DropoutMaskGenerator', 'DropoutMaskGenerator', ([], {}), '()\n', (10676, 10678), False, 'from mask_generators import ImageMaskGenerator, DropoutMaskGenerator\n'), ((3274, 3325), 'os.path.join', 'join', (['self.root_dir', 'self.partition[self.mode][idx]'], {}), '(self.root_dir, self.pa... |
from datetime import datetime as dt
from sys import getsizeof
import numpy as np
import pandas as pd
import pickle
import os
import random
import math
import argparse
from nltk import word_tokenize
from sklearn.feature_extraction.text import CountVectorizer
import gzip
import nltk
# nltk.download('punkt')
parser = ar... | [
"sklearn.feature_extraction.text.CountVectorizer",
"os.remove",
"pickle.dump",
"argparse.ArgumentParser",
"math.ceil",
"random.shuffle",
"os.path.isfile",
"pickle.load",
"numpy.linalg.norm",
"pandas.read_table",
"datetime.datetime.now"
] | [((318, 357), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (341, 357), False, 'import argparse\n'), ((1707, 1815), 'pandas.read_table', 'pd.read_table', (['f"""/fs/projects/finn_haps/snp_stats/FINRISK_R1_chr{chr}.snp_stats"""'], {'delim_whitespace': '(True)'... |
#coding: utf-8
import nest
import time
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
# reset kernel for new example
class neuron():
def __init__(self, model_name, multimeter=True, spike_detector=True,
label=None, color=None):
self.neuron = nest.Creat... | [
"nest.SetStatus",
"matplotlib.pyplot.tight_layout",
"nest.GetStatus",
"matplotlib.pyplot.show",
"nest.SetDefaults",
"nest.SetKernelStatus",
"nest.CopyModel",
"time.time",
"nest.Create",
"matplotlib.pyplot.figure",
"numpy.histogram",
"nest.ResetKernel",
"matplotlib.pyplot.subplots",
"nest.C... | [((1462, 1507), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'sharex': '(True)', 'sharey': '(False)'}), '(2, 1, sharex=True, sharey=False)\n', (1474, 1507), True, 'import matplotlib.pyplot as plt\n'), ((310, 333), 'nest.Create', 'nest.Create', (['model_name'], {}), '(model_name)\n', (321, 333), False... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : gru_model.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 26.07.2019
# Last Modified Date: 21.11.2019
# Last Modified By : Chi Han
#
# This file is part of the VCML codebase
# Distributed under MI... | [
"torch.nn.Dropout",
"jactorch.nn.CrossEntropyLoss",
"jactorch.nn.Identity",
"torch.nn.init.kaiming_normal_",
"torch.stack",
"torch.nn.Embedding",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.cat",
"numpy.zeros",
"jactorch.nn.GRULayer",
"utility.load_ckpt.load_embedding",
"jactorch.mode... | [((2047, 2110), 'torch.nn.Embedding', 'nn.Embedding', (['self.num_vocab', 'self.dim'], {'padding_idx': 'padding_idx'}), '(self.num_vocab, self.dim, padding_idx=padding_idx)\n', (2059, 2110), True, 'import torch.nn as nn\n'), ((2144, 2231), 'jactorch.nn.GRULayer', 'jacnn.GRULayer', (['self.dim', '(128)', '(1)'], {'bidir... |
# Copyright (c) <NAME>, <NAME>, and ZOZO Technologies, Inc. All rights reserved.
# Licensed under the Apache 2.0 License.
"""Bandit Simulator."""
from tqdm import tqdm
import numpy as np
from ..utils import check_bandit_feedback_inputs, convert_to_action_dist
from ..types import BanditFeedback, BanditPolicy
def ru... | [
"numpy.array"
] | [((2806, 2837), 'numpy.array', 'np.array', (['selected_actions_list'], {}), '(selected_actions_list)\n', (2814, 2837), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
File name: simulation_interface.py
Description: a set of functions for recording and training/testing neural networks
Author: <NAME>
Python version: 3.6
"""
IS_REPRODUCIBLE = True
from warnings import warn
import numpy as np
# For reproducibility in Keras
# https://keras.... | [
"numpy.random.seed",
"numpy.ones",
"tensorflow.ConfigProto",
"utils.reshape_rows_to_blocks",
"keras.layers.Reshape",
"tensorflow.get_default_graph",
"keras.layers.Flatten",
"numpy.random.RandomState",
"tensorflow.set_random_seed",
"keras.utils.plot_model",
"random.seed",
"numpy.linspace",
"k... | [((437, 582), 'warnings.warn', 'warn', (['"""Tensorflow will be running on a single CPU to get a reproducible result. Set IS_REPRODUCIBLE to False to use more cores or GPUs"""'], {}), "(\n 'Tensorflow will be running on a single CPU to get a reproducible result. Set IS_REPRODUCIBLE to False to use more cores or GPUs... |
import random
import copy
import numpy.random
import numpy as np
import projectq
from projectq.ops import H,X,Y,Z,T,Tdagger,S,Sdagger,CNOT,CX,Rx,Ry,Rz,SqrtX
from projectq.ops import Measure,All,get_inverse,Swap,SwapGate
from math import pi
from qiskit import QuantumCircuit, transpile, QuantumRegister, ClassicalRegister... | [
"projectq.backends.CircuitDrawerMatplotlib",
"qiskit.QuantumCircuit",
"projectq.backends.Simulator",
"random.uniform",
"random.shuffle",
"numpy.zeros",
"random.choice",
"projectq.ops.get_inverse",
"projectq.ops.All",
"random.random",
"qiskit.ClassicalRegister",
"projectq.MainEngine",
"qiskit... | [((1501, 1523), 'numpy.zeros', 'np.zeros', (['(Nexp, Nexp)'], {}), '((Nexp, Nexp))\n', (1509, 1523), True, 'import numpy as np\n'), ((7484, 7513), 'projectq.backends.Simulator', 'projectq.backends.Simulator', ([], {}), '()\n', (7511, 7513), False, 'import projectq\n'), ((7692, 7740), 'projectq.MainEngine', 'projectq.Ma... |
from umap.umap_ import (
INT32_MAX,
INT32_MIN,
make_forest,
rptree_leaf_array,
nearest_neighbors,
smooth_knn_dist,
fuzzy_simplicial_set,
UMAP,
)
from umap.utils import deheap_sort
from umap.nndescent import (
make_initialisations,
make_initialized_nnd_search,
initialise_searc... | [
"sklearn.datasets.load_iris",
"numpy.random.seed",
"numpy.sum",
"umap.utils.deheap_sort",
"umap.distances.mahalanobis",
"umap.distances.haversine",
"sklearn.utils.testing.assert_equal",
"sklearn.manifold.t_sne.trustworthiness",
"umap.umap_.fuzzy_simplicial_set",
"numpy.ones",
"scipy.sparse.lil_m... | [((1404, 1459), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (1427, 1459), False, 'import warnings\n'), ((1462, 1480), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1476, 1480), True, 'import numpy as np\... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32, Float32MultiArray
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classification.tl_clas... | [
"yaml.load",
"cv_bridge.CvBridge",
"rospy.Subscriber",
"rospy.logerr",
"math.sqrt",
"light_classification.tl_classifier.TLClassifier",
"numpy.asanyarray",
"rospy.Publisher",
"numpy.argmin",
"rospy.get_param",
"rospy.loginfo",
"rospy.init_node",
"std_msgs.msg.Float32MultiArray",
"rospy.spin... | [((565, 595), 'rospy.init_node', 'rospy.init_node', (['"""tl_detector"""'], {}), "('tl_detector')\n", (580, 595), False, 'import rospy\n'), ((956, 996), 'rospy.get_param', 'rospy.get_param', (['"""/traffic_light_config"""'], {}), "('/traffic_light_config')\n", (971, 996), False, 'import rospy\n'), ((1019, 1043), 'yaml.... |
"""Benchmarks for the GridArchive."""
import numpy as np
from ribs.archives import GridArchive
def benchmark_add_10k(benchmark, benchmark_data_10k):
n, solutions, objective_values, behavior_values = benchmark_data_10k
def setup():
archive = GridArchive((64, 64), [(-1, 1), (-1, 1)])
archive.i... | [
"numpy.random.random",
"numpy.array",
"ribs.archives.GridArchive",
"numpy.linspace"
] | [((765, 808), 'ribs.archives.GridArchive', 'GridArchive', (['(dim, dim)', '[(-1, 1), (-1, 1)]'], {}), '((dim, dim), [(-1, 1), (-1, 1)])\n', (776, 808), False, 'from ribs.archives import GridArchive\n'), ((850, 873), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'dim'], {}), '(-1, 1, dim)\n', (861, 873), True, 'impo... |
import networkx as nx
import numpy as np
from lxml import etree
from collections import defaultdict
def export_to_nx(file):
troncons = defaultdict(dict)
junctions = dict(
caf=defaultdict(dict), rep=defaultdict(dict), gir=defaultdict(dict)
)
parser = etree.XMLParser(remove_comments=True)
c... | [
"collections.defaultdict",
"lxml.etree.XMLParser",
"numpy.linalg.norm",
"lxml.etree.parse",
"networkx.DiGraph",
"numpy.fromstring"
] | [((141, 158), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (152, 158), False, 'from collections import defaultdict\n'), ((277, 314), 'lxml.etree.XMLParser', 'etree.XMLParser', ([], {'remove_comments': '(True)'}), '(remove_comments=True)\n', (292, 314), False, 'from lxml import etree\n'), ((330,... |
#!/usr/bin/env python3
import os
import numpy as np
from util import modifiers, loaders
from implementations import ridge_regression
DEFAULT_DATA_PATH = os.path.join('..', 'data')
def _load_data(data_path, is_logistic=False):
train_y, train_tx, train_ids = loaders.load_csv_data(os.path.join(data_path, 'train.c... | [
"implementations.ridge_regression",
"numpy.sum",
"util.modifiers.predict_labels",
"util.modifiers.build_poly",
"util.modifiers.split_data_rand",
"numpy.reshape",
"numpy.squeeze",
"os.path.join",
"numpy.delete",
"numpy.concatenate"
] | [((156, 182), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""'], {}), "('..', 'data')\n", (168, 182), False, 'import os\n'), ((1032, 1118), 'numpy.delete', 'np.delete', (['jet0_tx', '[jet_num_idx, 4, 5, 6, 12, 23, 24, 25, 26, 27, 28, 29]'], {'axis': '(1)'}), '(jet0_tx, [jet_num_idx, 4, 5, 6, 12, 23, 24, 25, 2... |
import os
import numpy as np
from model import *
from load import load_mnist_with_valid_set
import time
import scipy
import sys
from sklearn.decomposition import PCA
from skimage.feature import hog
n_epochs = 1000
learning_rate = 0.0002
batch_size = 128
image_shape = [28,28,1]
dim_z = 100
dim_W1 = 1024
dim_W2 = 128
d... | [
"load.load_mnist_with_valid_set",
"numpy.random.shuffle",
"numpy.asarray",
"numpy.dtype",
"numpy.zeros",
"time.time",
"numpy.random.randint",
"numpy.arange",
"numpy.loadtxt",
"numpy.array",
"numpy.concatenate"
] | [((585, 609), 'numpy.random.randint', 'np.random.randint', (['(10000)'], {}), '(10000)\n', (602, 609), True, 'import numpy as np\n'), ((765, 793), 'numpy.loadtxt', 'np.loadtxt', (['"""percentage.csv"""'], {}), "('percentage.csv')\n", (775, 793), True, 'import numpy as np\n'), ((825, 904), 'load.load_mnist_with_valid_se... |
# Importing essential libraries and modules
from flask import Flask, render_template, request, Markup
import numpy as np
import pandas as pd
from utils.disease import disease_dic
from utils.fertilizer import fertilizer_dic
import requests
import config
import pickle
import io
# import torch
# from torchvision import t... | [
"flask.request.files.get",
"flask.request.form.get",
"pandas.read_csv",
"flask.Flask",
"numpy.array",
"flask.render_template",
"requests.get"
] | [((4527, 4542), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (4532, 4542), False, 'from flask import Flask, render_template, request, Markup\n'), ((3403, 3429), 'requests.get', 'requests.get', (['complete_url'], {}), '(complete_url)\n', (3415, 3429), False, 'import requests\n'), ((4643, 4685), 'flask.ren... |
#
# OneDimSampler Class
#
# This file is part of SEQGIBBS
# (https://github.com/I-Bouros/seqgibbs.git) which is released
# under the MIT license. See accompanying LICENSE for copyright
# notice and full license details.
#
import numpy as np
class OneDimSampler():
r"""OneDimSampler Class:
Class for the transit... | [
"numpy.asarray"
] | [((3317, 3342), 'numpy.asarray', 'np.asarray', (['current_state'], {}), '(current_state)\n', (3327, 3342), True, 'import numpy as np\n'), ((2326, 2351), 'numpy.asarray', 'np.asarray', (['current_state'], {}), '(current_state)\n', (2336, 2351), True, 'import numpy as np\n')] |
import numpy as np
import torch
from torch import optim
from torch.autograd import Variable
from pdb import set_trace as T
from collections import defaultdict
from forge.ethyr.torch import loss
class ManualAdam(optim.Adam):
'''Adam wrapper that accepts gradient lists'''
def step(self, grads):
'''Takes an ... | [
"torch.stack",
"forge.ethyr.torch.loss.PG",
"collections.defaultdict",
"numpy.array",
"torch.tensor"
] | [((2262, 2286), 'torch.stack', 'torch.stack', (["out['vals']"], {}), "(out['vals'])\n", (2273, 2286), False, 'import torch\n'), ((2416, 2447), 'forge.ethyr.torch.loss.PG', 'loss.PG', (['atns', 'idxs', 'vals', 'rets'], {}), '(atns, idxs, vals, rets)\n', (2423, 2447), False, 'from forge.ethyr.torch import loss\n'), ((113... |
import numpy as np
__author__ = 'Andres'
class StrechableNumpyArray(object):
"""When trying to add values to a numpy array, things can get slow if the array is too large.
This class tries to solve that by updating the size of the array incrementally"""
def __init__(self, dtype=np.float32):
self._... | [
"numpy.zeros"
] | [((354, 393), 'numpy.zeros', 'np.zeros', (['(1000000,)'], {'dtype': 'self._dtype'}), '((1000000,), dtype=self._dtype)\n', (362, 393), True, 'import numpy as np\n'), ((555, 595), 'numpy.zeros', 'np.zeros', (['(capacity,)'], {'dtype': 'self._dtype'}), '((capacity,), dtype=self._dtype)\n', (563, 595), True, 'import numpy ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@author: Ryhax
@contact: https://ryhax.github.io/
@file: DQN.py
@date: 2021/4/21 15:01
@desc:
"""
import random
from collections import deque
import numpy as np
import torch
from torch import nn, optim
from torch.nn import functional
import gym
import matplotlib.pyplot as ... | [
"torch.nn.MSELoss",
"gym.make",
"random.sample",
"matplotlib.pyplot.ion",
"numpy.random.random",
"torch.max",
"matplotlib.pyplot.pause",
"torch.nn.Linear",
"torch.tensor",
"matplotlib.pyplot.subplots",
"collections.deque"
] | [((4771, 4794), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (4779, 4794), False, 'import gym\n'), ((4935, 4944), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (4942, 4944), True, 'import matplotlib.pyplot as plt\n'), ((4959, 4973), 'matplotlib.pyplot.subplots', 'plt.subplots', ([],... |
from keras.layers import Dense, Convolution2D, Dropout
from keras.layers.noise import GaussianNoise
from keras.models import Sequential
from keras.activations import selu, relu, linear, sigmoid
from keras.regularizers import l1
import numpy as np
import os, sys
cur_dir = os.path.dirname(__file__)
project_root = os.pat... | [
"gensim.models.word2vec.Word2Vec.load_word2vec_format",
"os.path.dirname",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential",
"os.path.join"
] | [((273, 298), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (288, 298), False, 'import os, sys\n'), ((314, 347), 'os.path.join', 'os.path.join', (['cur_dir', '""".."""', '""".."""'], {}), "(cur_dir, '..', '..')\n", (326, 347), False, 'import os, sys\n'), ((361, 404), 'os.path.join', 'os.path... |
from typing import List
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from presentation.ham10kplots import plot_confusion_matrix, plot_label_counts, plot_performance_graphs
"""
Plots of tensorboard results with adjusted theming for presentation
"""
"""
Label barch... | [
"pandas.read_csv",
"numpy.array",
"presentation.ham10kplots.plot_performance_graphs",
"matplotlib.pyplot.show"
] | [((443, 728), 'numpy.array', 'np.array', (['[[0.81, 0, 0.03, 0.24, 0.02, 0, 0], [0, 0.84, 0.01, 0, 0, 0.01, 0.06], [\n 0.07, 0.05, 0.83, 0.05, 0.05, 0.04, 0.12], [0.02, 0, 0.01, 0.62, 0.01, \n 0, 0], [0.07, 0.02, 0.04, 0.05, 0.75, 0.07, 0], [0.02, 0.1, 0.08, 0.05,\n 0.17, 0.88, 0.21], [0, 0, 0, 0, 0.01, 0, 0.6... |
import Twitter_Depression_Detection # Reads the input and the training sets
import numpy as np
import numpy
from sklearn.model_selection import KFold
from sklearn.metrics import confusion_matrix
from sklearn.metrics import precision_recall_fscore_support, accuracy_score
from sklearn.metrics import roc_auc_score
... | [
"matplotlib.pyplot.title",
"sklearn.metrics.confusion_matrix",
"numpy.maximum",
"numpy.random.seed",
"sklearn.metrics.accuracy_score",
"numpy.mean",
"keras.constraints.maxnorm",
"matplotlib.pyplot.fill_between",
"sklearn.metrics.precision_recall_fscore_support",
"numpy.std",
"numpy.linspace",
... | [((839, 925), 'matplotlib.pyplot.plot', 'plt.plot', (['[0, 1]', '[0, 1]'], {'linestyle': '"""--"""', 'lw': '(2)', 'color': '"""r"""', 'label': '"""Luck"""', 'alpha': '(0.8)'}), "([0, 1], [0, 1], linestyle='--', lw=2, color='r', label='Luck',\n alpha=0.8)\n", (847, 925), True, 'import matplotlib.pyplot as plt\n'), ((... |
import numpy as np
from tempfile import mkstemp
from sklearn.datasets import load_iris
from sklearn.cross_validation import train_test_split
from pystruct.models import GraphCRF
from pystruct.learners import NSlackSSVM
from pystruct.utils import SaveLogger
from pystruct.inference import get_installed
from nose.tools... | [
"sklearn.datasets.load_iris",
"sklearn.cross_validation.train_test_split",
"nose.tools.assert_less",
"tempfile.mkstemp",
"numpy.empty",
"nose.tools.assert_almost_equal",
"pystruct.utils.SaveLogger",
"pystruct.learners.NSlackSSVM",
"pystruct.models.GraphCRF",
"pystruct.inference.get_installed",
"... | [((443, 479), 'pystruct.inference.get_installed', 'get_installed', (["['qpbo', 'ad3', 'lp']"], {}), "(['qpbo', 'ad3', 'lp'])\n", (456, 479), False, 'from pystruct.inference import get_installed\n'), ((515, 526), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (524, 526), False, 'from sklearn.datasets impor... |
# Licensed under an MIT open source license - see LICENSE
'''
Wrapper on spectral_cube for simulated datasets
'''
import numpy as np
from spectral_cube import SpectralCube, CompositeMask
try:
from signal_id import Noise
except ImportError:
pass
prefix = "/srv/astro/erickoch/" # Adjust if you're not me... | [
"cube_utils._check_beam",
"spectral_cube.CompositeMask",
"numpy.isfinite",
"cube_utils._check_mask",
"spectral_cube.SpectralCube.read",
"spectral_cube.SpectralCube",
"signal_id.Noise",
"cube_utils._get_int_intensity"
] | [((747, 770), 'spectral_cube.SpectralCube.read', 'SpectralCube.read', (['cube'], {}), '(cube)\n', (764, 770), False, 'from spectral_cube import SpectralCube, CompositeMask\n'), ((972, 1014), 'signal_id.Noise', 'Noise', (['self.cube'], {'beam': 'beam', 'method': 'method'}), '(self.cube, beam=beam, method=method)\n', (97... |
from typing import Optional, Sequence, Tuple
import pandas as pd
import numpy as np
__all__ = ['get']
# All credit for this goes to networkx https://github.com/networkx/networkx/blob/master/networkx/drawing/layout.py
def _process_parameters(
center: Optional[Sequence] = None,
dim: Optional[int] = ... | [
"numpy.asarray",
"numpy.zeros",
"numpy.random.RandomState",
"numpy.sin",
"numpy.linspace",
"numpy.cos"
] | [((2243, 2275), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (2264, 2275), True, 'import numpy as np\n'), ((431, 444), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (439, 444), True, 'import numpy as np\n'), ((472, 490), 'numpy.asarray', 'np.asarray', (['center'],... |
import numpy as np
import numpy.linalg as nlg
def stieltjes(nodes,weights,N):
"""
Parameters
----------
nodes : np.ndarray (nnodes)
The locations of the probability masses
weights : np.ndarray (nnodes)
The weights of the probability masses
N : integer
The desired numbe... | [
"numpy.atleast_2d",
"numpy.absolute",
"numpy.zeros_like",
"numpy.sum",
"numpy.empty",
"numpy.allclose",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.all",
"numpy.linalg.norm",
"numpy.dot",
"pyapprox.orthonormal_polynomials_1d.evaluate_monic_polynomial_1d",
"numpy.concatenate",
"n... | [((592, 608), 'numpy.empty', 'np.empty', (['(N, 2)'], {}), '((N, 2))\n', (600, 608), True, 'import numpy as np\n'), ((618, 633), 'numpy.sum', 'np.sum', (['weights'], {}), '(weights)\n', (624, 633), True, 'import numpy as np\n'), ((694, 710), 'numpy.zeros', 'np.zeros', (['nnodes'], {}), '(nnodes)\n', (702, 710), 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 app... | [
"tarfile.open",
"numpy.array",
"paddle.dataset.common._check_exists_and_download",
"gzip.GzipFile"
] | [((6538, 6566), 'tarfile.open', 'tarfile.open', (['self.data_file'], {}), '(self.data_file)\n', (6550, 6566), False, 'import tarfile\n'), ((4012, 4097), 'paddle.dataset.common._check_exists_and_download', '_check_exists_and_download', (['data_file', 'DATA_URL', 'DATA_MD5', '"""conll05st"""', 'download'], {}), "(data_fi... |
"""
Helper function for running Grizli redshift fits in AWS lambda
event = {'s3_object_path' : 'Pipeline/j001452+091221/Extractions/j001452+091221_00277.beams.fits'}
Optional event key (and anything to grizli.fitting.run_all):
'skip_started' : Look for a start.log file and abort if found
'check_wcs' : check... | [
"numpy.load",
"os.remove",
"boto3.client",
"grizli.utils.fetch_acs_wcs_files",
"time.ctime",
"grizli.utils.load_templates",
"gc.collect",
"boto3.resource",
"glob.glob",
"grizli.aws.db.add_redshift_fit_row",
"os.chdir",
"numpy.unique",
"json.loads",
"matplotlib.pyplot.close",
"os.path.dir... | [((1527, 1548), 'astropy.io.fits.open', 'pyfits.open', (['wcs_fits'], {}), '(wcs_fits)\n', (1538, 1548), True, 'import astropy.io.fits as pyfits\n'), ((1698, 1742), 'astropy.wcs.WCS', 'pywcs.WCS', (['im[0].header'], {'fobj': 'im', 'relax': '(True)'}), '(im[0].header, fobj=im, relax=True)\n', (1707, 1742), True, 'import... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"numpy.random.seed",
"tensorflow.contrib.eager.python.tfe.Variable",
"_pickle.dumps",
"absl.logging.info",
"absl.flags.DEFINE_boolean",
"os.path.join",
"tensorflow.contrib.eager.python.tfe.enable_eager_execution",
"tensorflow.compat.v1.train.get_checkpoint_state",
"platform.python_version_tuple",
... | [((1375, 1463), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""exploration_noise"""', '(0.1)', '"""Scale of noise used for exploration."""'], {}), "('exploration_noise', 0.1,\n 'Scale of noise used for exploration.')\n", (1393, 1463), False, 'from absl import flags\n'), ((1738, 1817), 'absl.flags.DEFINE_stri... |
# Copyright © 2016-2021 Medical Image Analysis Laboratory, University Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland
#
# This software is distributed under the open-source license Modified BSD.
"""PyMIALSRTK preprocessing functions.
It includes BTK Non-local-mean denoising, slice intensity corre... | [
"skimage.morphology.binary_opening",
"skimage.morphology.binary_closing",
"numpy.sum",
"nipype.interfaces.base.traits.Float",
"os.environ.copy",
"scipy.ndimage.measurements.label",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.mean",
"pathlib.Path",
"cv2.boxPoints",
"numpy.sqrt",
"os.pat... | [((1414, 1463), 'nipype.interfaces.base.File', 'File', ([], {'desc': '"""Input image filename"""', 'mandatory': '(True)'}), "(desc='Input image filename', mandatory=True)\n", (1418, 1463), False, 'from nipype.interfaces.base import traits, TraitedSpec, File, InputMultiPath, OutputMultiPath, BaseInterface, BaseInterface... |
import multiprocessing
import numpy as np
import pickle
import sys
import time
from FDApy.representation.functional_data import DenseFunctionalData, MultivariateFunctionalData
from FDApy.preprocessing.dim_reduction.fpca import MFPCA
from FDApy.clustering.fcubt import Node, FCUBT
from joblib import Parallel, delayed
f... | [
"pickle.dump",
"FDApy.preprocessing.dim_reduction.fpca.MFPCA",
"sklearn.mixture.GaussianMixture",
"time.time",
"pickle.load",
"numpy.arange",
"numpy.loadtxt",
"joblib.Parallel",
"sklearn.metrics.adjusted_rand_score",
"joblib.delayed",
"multiprocessing.cpu_count"
] | [((424, 451), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (449, 451), False, 'import multiprocessing\n'), ((585, 616), 'numpy.loadtxt', 'np.loadtxt', (['"""./data/labels.csv"""'], {}), "('./data/labels.csv')\n", (595, 616), True, 'import numpy as np\n'), ((633, 665), 'FDApy.preprocessing... |
from skimage.color import rgb2gray
from skimage.io import imread
from PIL import Image
from PIL.MpoImagePlugin import MpoImageFile
try:
from cairosvg import svg2png
except ImportError:
pass
from io import BytesIO
import numpy as np
import xml.etree
class CorruptImageError(RuntimeError):
pass
class Image... | [
"numpy.abs",
"numpy.ravel",
"numpy.mean",
"numpy.linalg.norm",
"numpy.arange",
"numpy.diag",
"numpy.pad",
"skimage.color.rgb2gray",
"numpy.linspace",
"skimage.io.imread",
"io.BytesIO",
"numpy.asarray",
"numpy.percentile",
"numpy.fliplr",
"numpy.concatenate",
"numpy.all",
"numpy.zeros... | [((20140, 20188), 'numpy.zeros', 'np.zeros', (['(x_coords.shape[0], y_coords.shape[0])'], {}), '((x_coords.shape[0], y_coords.shape[0]))\n', (20148, 20188), True, 'import numpy as np\n'), ((27498, 27510), 'numpy.all', 'np.all', (['mask'], {}), '(mask)\n', (27504, 27510), True, 'import numpy as np\n'), ((29436, 29457), ... |
import numpy as np
import matplotlib.pyplot as plt
def DataFrameToPieChart(df, ouputFileName, typeCode=0):
listColumn = list(df.columns.values)
listOccurent = []
listDuration = []
for col in listColumn:
listOccurent.append(df[col][0])
listDuration.append(df[col][1])
fig, ax = plt.... | [
"matplotlib.pyplot.setp",
"numpy.sum",
"matplotlib.pyplot.savefig"
] | [((918, 960), 'matplotlib.pyplot.setp', 'plt.setp', (['autotexts'], {'size': '(8)', 'weight': '"""bold"""'}), "(autotexts, size=8, weight='bold')\n", (926, 960), True, 'import matplotlib.pyplot as plt\n'), ((1017, 1064), 'matplotlib.pyplot.savefig', 'plt.savefig', (['ouputFileName'], {'bbox_inches': '"""tight"""'}), "(... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import copy
import logging
from typing import List, Optional
import numpy as np
import reagent.types as rlt
import torch
import torch.nn.functional as F
from reagent.core.configuration import resolve_defaults
from reagent.co... | [
"torch.mean",
"copy.deepcopy",
"torch.full_like",
"numpy.log",
"torch.var",
"torch.zeros_like",
"reagent.core.tracker.observable",
"reagent.tensorboardX.SummaryWriterContext.add_scalar",
"reagent.core.dataclasses.field",
"torch.nn.functional.mse_loss",
"reagent.tensorboardX.SummaryWriterContext.... | [((612, 639), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (629, 639), False, 'import logging\n'), ((643, 927), 'reagent.core.tracker.observable', 'observable', ([], {'td_loss': 'torch.Tensor', 'reward_loss': 'torch.Tensor', 'logged_actions': 'torch.Tensor', 'logged_propensities': 'torc... |
#%%
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import phd.viz
import phd.thermo
constants = phd.thermo.load_constants()
colors, palette = phd.viz.phd_style()
# %%
# Load the experimental data.
data = pd.read_csv('../../data/ch2_induction/RazoMejia_2018.csv', comment='#')
data = data[data[... | [
"pandas.read_csv",
"numpy.logspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((231, 302), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/ch2_induction/RazoMejia_2018.csv"""'], {'comment': '"""#"""'}), "('../../data/ch2_induction/RazoMejia_2018.csv', comment='#')\n", (242, 302), True, 'import pandas as pd\n'), ((500, 523), 'numpy.logspace', 'np.logspace', (['(-2)', '(4)', '(200)'], {}), '(-... |
import argparse
import sys
import time
import numpy as np
from numpy.random.mtrand import RandomState
import gym
from gym import wrappers, logger
import gym_adserver
class EpsilonGreedyAgent(object):
def __init__(self, seed, epsilon):
self.name = "epsilon-Greedy Agent"
self.np_random = RandomSta... | [
"numpy.random.uniform",
"gym.make",
"argparse.ArgumentParser",
"gym.logger.set_level",
"numpy.random.mtrand.RandomState"
] | [((798, 823), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (821, 823), False, 'import argparse\n'), ((1213, 1242), 'gym.logger.set_level', 'logger.set_level', (['logger.INFO'], {}), '(logger.INFO)\n', (1229, 1242), False, 'from gym import wrappers, logger\n'), ((1334, 1424), 'gym.make', 'gym.... |
import numpy as np
# image libraries
from PIL import Image, ImageDraw
from scipy import interpolate
from scipy.optimize import fsolve
from skimage.measure import find_contours
# local functions
from ..generic.mapping_tools import pol2cart, cart2pol, rot_mat
from .matching_tools_frequency_filters import \
make_fo... | [
"PIL.Image.new",
"numpy.arctan2",
"numpy.sum",
"numpy.resize",
"numpy.abs",
"numpy.sin",
"numpy.arange",
"skimage.measure.find_contours",
"numpy.meshgrid",
"numpy.power",
"numpy.fft.fft",
"scipy.optimize.fsolve",
"numpy.linalg.eig",
"numpy.reshape",
"numpy.linspace",
"PIL.ImageDraw.Dra... | [((898, 923), 'numpy.matmul', 'np.matmul', (['R', 'stack_grd.T'], {}), '(R, stack_grd.T)\n', (907, 923), True, 'import numpy as np\n'), ((937, 970), 'numpy.reshape', 'np.reshape', (['grd_new[0, :]', '(m, n)'], {}), '(grd_new[0, :], (m, n))\n', (947, 970), True, 'import numpy as np\n'), ((983, 1016), 'numpy.reshape', 'n... |
from utils import *
from rendering_ops import *
import tensorflow as tf
import numpy as np
VERTEX_NUM = 53215
def main(_):
batch_size = 16
output_size = 224
texture_size = [192, 224]
mDim = 8
vertexNum = VERTEX_NUM
channel_num = 3
data = np.load('sample_data.npz')
gpu_options = tf.... | [
"numpy.load",
"tensorflow.placeholder",
"tensorflow.ConfigProto",
"tensorflow.GPUOptions",
"tensorflow.app.run"
] | [((270, 296), 'numpy.load', 'np.load', (['"""sample_data.npz"""'], {}), "('sample_data.npz')\n", (277, 296), True, 'import numpy as np\n'), ((317, 374), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'visible_device_list': '"""0"""', 'allow_growth': '(True)'}), "(visible_device_list='0', allow_growth=True)\n", (330, 3... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from mo.front.common.partial_infer.utils import tf_window_op_pad_infer, int64_array, float_array, shape_array, \
dynamic_dimension_value, dynamic_dimension
from mo.front.onnx.extractors.utils import get_backend_pa... | [
"mo.ops.op.PermuteAttrs.create_permute_attrs",
"mo.utils.error.Error",
"mo.front.onnx.extractors.utils.get_backend_pad",
"numpy.add.reduce",
"mo.front.extractor.bool_to_str",
"numpy.any",
"numpy.array",
"mo.front.common.partial_infer.utils.tf_window_op_pad_infer"
] | [((6708, 6855), 'mo.ops.op.PermuteAttrs.create_permute_attrs', 'PermuteAttrs.create_permute_attrs', (['node'], {'attrs': "[('pad', 'input:0'), ('stride', 'input:0'), ('window', 'input:0'), (\n 'spatial_dims', 'input:0')]"}), "(node, attrs=[('pad', 'input:0'), (\n 'stride', 'input:0'), ('window', 'input:0'), ('spa... |
from __future__ import print_function
import pandas as pd
import pickle
import numpy as np
from itertools import chain
from collections import OrderedDict
import random
import sys
sys.path.append('../vectorsearch/')
import LDA
from random import shuffle
n_topics=120
n_features=5000
max_df=.35
min_df=2
max_iter=10
alp... | [
"sys.path.append",
"pandas.DataFrame",
"LDA.SaveLDAModel",
"pickle.dump",
"itertools.chain.from_iterable",
"random.shuffle",
"LDA.LDA",
"random.seed",
"pandas.read_pickle",
"numpy.dot",
"collections.OrderedDict"
] | [((180, 215), 'sys.path.append', 'sys.path.append', (['"""../vectorsearch/"""'], {}), "('../vectorsearch/')\n", (195, 215), False, 'import sys\n'), ((409, 480), 'pandas.read_pickle', 'pd.read_pickle', (['"""../output/bar_reviews_cleaned_and_tokenized_SF.pickle"""'], {}), "('../output/bar_reviews_cleaned_and_tokenized_S... |
from os import path as osp
import numpy as np
import torch
import torch.utils as utils
from numpy.linalg import inv
from src.utils.dataset import (
read_scannet_gray,
read_scannet_depth,
read_scannet_pose,
)
class ScanNetDataset(utils.data.Dataset):
def __init__(self,
root_dir,
... | [
"numpy.load",
"src.utils.dataset.read_scannet_pose",
"numpy.linalg.inv",
"src.utils.dataset.read_scannet_gray",
"os.path.join",
"torch.tensor"
] | [((1966, 2024), 'os.path.join', 'osp.join', (['self.pose_dir', 'scene_name', '"""pose"""', 'f"""{name}.txt"""'], {}), "(self.pose_dir, scene_name, 'pose', f'{name}.txt')\n", (1974, 2024), True, 'from os import path as osp\n'), ((2086, 2108), 'src.utils.dataset.read_scannet_pose', 'read_scannet_pose', (['pth'], {}), '(p... |
from ..core.aggregate import BaseChoropleth
from .bindings import PanelDeck
import pandas as pd
import numpy as np
from typing import Type
from bokeh.models import ColumnDataSource
import bokeh
from PIL import ImageColor
class Choropleth(BaseChoropleth):
# reset event handling not required, as the default behav... | [
"pandas.DataFrame",
"bokeh.models.ColumnDataSource",
"PIL.ImageColor.getrgb",
"numpy.isnan",
"pandas.cut",
"numpy.array"
] | [((1970, 2022), 'pandas.cut', 'pd.cut', (['x', 'BREAKS'], {'labels': '(False)', 'include_lowest': '(True)'}), '(x, BREAKS, labels=False, include_lowest=True)\n', (1976, 2022), True, 'import pandas as pd\n'), ((2264, 2284), 'pandas.DataFrame', 'pd.DataFrame', (['colors'], {}), '(colors)\n', (2276, 2284), True, 'import p... |
import numpy as np
import keras
import tensorflow as tf
from keras.models import Model
from keras import backend as K
import keras.layers as layers
from keras.layers import Input, merge, Conv2D, Concatenate, concatenate, Conv2DTranspose, DepthwiseConv2D, BatchNormalization, Dropout, Flatten, Lambda
from keras.layers.p... | [
"keras.backend.stack",
"keras.regularizers.l2",
"tensorflow.control_dependencies",
"tensorflow.identity",
"keras.backend.flatten",
"keras.losses.binary_crossentropy",
"keras.backend.get_session",
"keras.backend.sum",
"keras.layers.Conv2DTranspose",
"keras.models.Model",
"keras.layers.pooling.Max... | [((834, 859), 'numpy.arange', 'np.arange', (['(0.5)', '(1.0)', '(0.05)'], {}), '(0.5, 1.0, 0.05)\n', (843, 859), True, 'import numpy as np\n'), ((1270, 1287), 'keras.backend.flatten', 'K.flatten', (['y_true'], {}), '(y_true)\n', (1279, 1287), True, 'from keras import backend as K\n'), ((1303, 1320), 'keras.backend.flat... |
import numpy as np
import matplotlib.pyplot as plt
import scipy
from scipy.misc import toimage
from PIL import ImageFilter
def plot_(x, y, acc, save_path, value, pred_mean=None, pred_var=None, mean_entropy=None):
img_w = x.shape[1]
num_rows = int(np.sqrt(y.shape[0]))
if not y.shape[0] % num_rows:
... | [
"scipy.misc.toimage",
"PIL.ImageFilter.GaussianBlur",
"numpy.ceil",
"numpy.zeros",
"scipy.ndimage.interpolation.rotate",
"numpy.array",
"numpy.random.normal",
"matplotlib.pyplot.subplots_adjust",
"numpy.squeeze",
"matplotlib.pyplot.subplots",
"numpy.sqrt"
] | [((471, 515), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': 'num_rows', 'ncols': 'num_cols'}), '(nrows=num_rows, ncols=num_cols)\n', (483, 515), True, 'import matplotlib.pyplot as plt\n'), ((580, 670), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'left': '(0.1)', 'bottom': '(0.13)', ... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"numpy.trace",
"numpy.argmax",
"numpy.allclose",
"numpy.product",
"numpy.isclose",
"qiskit.quantum_info.states.statevector.Statevector.from_label",
"numpy.linalg.eig",
"numpy.kron",
"numpy.reshape",
"qiskit.quantum_info.operators.predicates.is_hermitian_matrix",
"numpy.conj",
"qiskit.exception... | [((5188, 5252), 'qiskit.quantum_info.operators.predicates.is_positive_semidefinite_matrix', 'is_positive_semidefinite_matrix', (['self.data'], {'rtol': 'rtol', 'atol': 'atol'}), '(self.data, rtol=rtol, atol=atol)\n', (5219, 5252), False, 'from qiskit.quantum_info.operators.predicates import is_positive_semidefinite_mat... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
image = mpimg.imread('bridge_shadow.jpg')
# Edit this function to create your own pipeline.
def pipeline(img, s_thresh=(170, 255), sx_thresh=(20, 100)):
img = np.copy(img)
# Convert to HLS color space and separate ... | [
"numpy.absolute",
"matplotlib.image.imread",
"numpy.zeros_like",
"matplotlib.pyplot.show",
"numpy.copy",
"cv2.cvtColor",
"numpy.max",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots",
"cv2.Sobel"
] | [((105, 138), 'matplotlib.image.imread', 'mpimg.imread', (['"""bridge_shadow.jpg"""'], {}), "('bridge_shadow.jpg')\n", (117, 138), True, 'import matplotlib.image as mpimg\n'), ((1327, 1362), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(24, 9)'}), '(1, 2, figsize=(24, 9))\n', (1339, 1362)... |
# Copyright 2020, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | [
"tensorflow.test.main",
"numpy.full",
"tensorflow.feature_column.numeric_column",
"tensorflow_privacy.privacy.estimators.test_utils.make_input_fn",
"tensorflow_privacy.privacy.estimators.test_utils.make_input_data",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow_privacy.privacy.estimator... | [((3022, 3036), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3034, 3036), True, 'import tensorflow as tf\n'), ((1233, 1270), 'tensorflow_privacy.privacy.estimators.binary_class_head.DPBinaryClassHead', 'binary_class_head.DPBinaryClassHead', ([], {}), '()\n', (1268, 1270), False, 'from tensorflow_privacy.p... |
# Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from functools import partial
import numpy as np
from ..function_selector import WEIGHTS_STATS_FN, PERTENSOR, PERCHANNEL
w_stats_fn_per_tensor = WEIGHTS_STATS_FN[PERTENSOR]
w_stats_fn_per_channel = WEIGHTS_STATS_FN[PERCHANNEL]
# help... | [
"functools.partial",
"numpy.quantile",
"numpy.abs",
"numpy.transpose",
"numpy.max",
"numpy.min",
"numpy.reshape"
] | [((967, 1010), 'numpy.reshape', 'np.reshape', (['weights', '(weights.shape[0], -1)'], {}), '(weights, (weights.shape[0], -1))\n', (977, 1010), True, 'import numpy as np\n'), ((1117, 1132), 'numpy.max', 'np.max', (['weights'], {}), '(weights)\n', (1123, 1132), True, 'import numpy as np\n'), ((1214, 1229), 'numpy.min', '... |
from npcl import to_device
from npcl.solvers.inpaint import inpaint_h1
import numpy as np
import cv2
from time import time
img = cv2.imread('lake.tif', 0)/255
img = to_device(img)
mask = np.zeros(img.shape[:2], dtype=np.float32)
mask[256:257, :] = 1
mask[:, 256:257] = 1
mask = to_device(mask)
contaminated = img*(1-... | [
"cv2.waitKey",
"numpy.float32",
"numpy.zeros",
"time.time",
"cv2.imread",
"npcl.solvers.inpaint.inpaint_h1",
"cv2.destroyAllWindows",
"npcl.to_device"
] | [((167, 181), 'npcl.to_device', 'to_device', (['img'], {}), '(img)\n', (176, 181), False, 'from npcl import to_device\n'), ((190, 231), 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'dtype': 'np.float32'}), '(img.shape[:2], dtype=np.float32)\n', (198, 231), True, 'import numpy as np\n'), ((281, 296), 'npcl.to_device'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.