code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
from contextlib import contextmanager
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.tensor.si... | [
"theano.tensor.zeros_like",
"theano.tensor.argmin",
"theano.tensor.nnet.abstract_conv.AbstractConv2d_gradInputs",
"theano.tensor.alloc",
"theano.map",
"theano.tensor.tile",
"theano.tensor.squeeze",
"theano.tensor.stack",
"theano.tensor.inv",
"theano.tensor.std",
"theano.tensor.nnet.abstract_conv... | [((1191, 1243), 'theano.tensor.scalar', 'T.scalar', ([], {'dtype': '"""uint8"""', 'name': '"""keras_learning_phase"""'}), "(dtype='uint8', name='keras_learning_phase')\n", (1199, 1243), True, 'from theano import tensor as T\n'), ((1260, 1276), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1271, 1... |
try:
import unittest
from copy import copy
from numpy.testing import assert_allclose
import numpy as np
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.library import Library, Dimension
from spitfire.chemistry.flamelet import FlameletSpec
from spi... | [
"spitfire.chemistry.library.Library",
"spitfire.chemistry.library.Dimension",
"numpy.testing.assert_allclose",
"cantera.__version__.replace",
"numpy.squeeze",
"numpy.swapaxes",
"numpy.linspace",
"numpy.isnan",
"spitfire.chemistry.tabulation.build_adiabatic_eq_library",
"spitfire.chemistry.mechanis... | [((490, 526), 'cantera.__version__.replace', 'cantera.__version__.replace', (['"""."""', '""""""'], {}), "('.', '')\n", (517, 526), False, 'import cantera\n'), ((9336, 9351), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9349, 9351), False, 'import unittest\n'), ((625, 674), 'cantera.Solution', 'ct.Solution', ([... |
from matplotlib import pyplot as plt
from typing import Callable, Union
from tkinter import Toplevel
import tkinter as tk
import tkinter.ttk as ttk
from functools import partial
import numpy as np
from src.utils.MatplotlibTkinterIntegration import createPlot
from src.utils.State import State
from src.utils.constants i... | [
"tkinter.ttk.Button",
"matplotlib.pyplot.ylabel",
"tkinter.ttk.Entry",
"tkinter.ttk.Frame",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"tkinter.ttk.Label",
"matplotlib.pyplot.close",
"src.utils.MatplotlibTkinterIntegration.createPlot",
"tkinter.Toplevel",
"matplotlib.pyplot.subplot",
... | [((5844, 5861), 'tkinter.ttk.Frame', 'ttk.Frame', (['window'], {}), '(window)\n', (5853, 5861), True, 'import tkinter.ttk as ttk\n'), ((6017, 6076), 'tkinter.ttk.Button', 'ttk.Button', (['btnFrame'], {'text': '"""Show Fit"""', 'command': 'self.showFit'}), "(btnFrame, text='Show Fit', command=self.showFit)\n", (6027, 60... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "Times"
P = np.array([[1, 0, 0, 0, 0, 0],
[0.5, 0, 0.5, 0, 0, 0],
[0, 0.5, 0, 0.5, 0, 0],
[0, 0, 0.5, 0, 0.5, 0],
[0, 0, 0, 0.5, 0, 0.5],
[0, 0, 0,... | [
"numpy.append",
"numpy.array",
"numpy.dot",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((115, 266), 'numpy.array', 'np.array', (['[[1, 0, 0, 0, 0, 0], [0.5, 0, 0.5, 0, 0, 0], [0, 0.5, 0, 0.5, 0, 0], [0, 0,\n 0.5, 0, 0.5, 0], [0, 0, 0, 0.5, 0, 0.5], [0, 0, 0, 0, 0, 1]]'], {}), '([[1, 0, 0, 0, 0, 0], [0.5, 0, 0.5, 0, 0, 0], [0, 0.5, 0, 0.5, 0, 0\n ], [0, 0, 0.5, 0, 0.5, 0], [0, 0, 0, 0.5, 0, 0.5], [... |
"""Input/output"""
import os
import wave
import numpy as np
def read_wave(file: os.PathLike) -> tuple[int, np.ndarray]:
"""Read WAV file into numpy array
NOTE: only mono audio is supported. Multi-channel audio is interlaced,
and would need to be de-interlaced into a 2D array.
Args:
file (o... | [
"numpy.frombuffer"
] | [((846, 881), 'numpy.frombuffer', 'np.frombuffer', (['buffer'], {'dtype': '_dtype'}), '(buffer, dtype=_dtype)\n', (859, 881), True, 'import numpy as np\n')] |
import numpy as np
import xarray as xr
from xbitinfo import get_keepbits
from . import _skip_slow, ensure_loaded, parameterized, randn, requires_dask
class GetKeepbits:
"""
Benchmark time and peak memory of `get_keepbits`.
"""
# https://asv.readthedocs.io/en/stable/benchmarks.html
timeout = 30.... | [
"numpy.array",
"xbitinfo.get_keepbits"
] | [((1752, 1793), 'xbitinfo.get_keepbits', 'get_keepbits', (['self.info_per_bit'], {}), '(self.info_per_bit, **kwargs)\n', (1764, 1793), False, 'from xbitinfo import get_keepbits\n'), ((1900, 1941), 'xbitinfo.get_keepbits', 'get_keepbits', (['self.info_per_bit'], {}), '(self.info_per_bit, **kwargs)\n', (1912, 1941), Fals... |
#!/usr/bin/env python
import numpy
from shogun import MSG_DEBUG
traindat = numpy.random.random_sample((10,10))
testdat = numpy.random.random_sample((10,10))
parameter_list=[[traindat,testdat,1.2],[traindat,testdat,1.4]]
def kernel_director_linear (fm_train_real=traindat,fm_test_real=testdat,scale=1.2):
try:
from sh... | [
"numpy.random.random_sample",
"shogun.LinearKernel",
"shogun.DirectorKernel.__init__",
"shogun.features",
"numpy.dot",
"shogun.Time",
"shogun.AvgDiagKernelNormalizer"
] | [((75, 111), 'numpy.random.random_sample', 'numpy.random.random_sample', (['(10, 10)'], {}), '((10, 10))\n', (101, 111), False, 'import numpy\n'), ((121, 157), 'numpy.random.random_sample', 'numpy.random.random_sample', (['(10, 10)'], {}), '((10, 10))\n', (147, 157), False, 'import numpy\n'), ((838, 864), 'shogun.featu... |
import networkx as nx
from entity.entity import Graph, Node
from node2vec import Node2Vec
import numpy as np
from gensim.models.word2vec import Word2Vec
from flask import current_app
from sklearn.decomposition import PCA
from sklearn import manifold
from algorithm.search_community import PyLouvain
from algorithm.simila... | [
"os.path.exists",
"gensim.models.word2vec.Word2Vec.load",
"algorithm.structure_correspond.find_structure_correspond",
"algorithm.search_community.PyLouvain.from_graph",
"pickle.dump",
"sklearn.decomposition.PCA",
"pickle.load",
"sklearn.manifold.TSNE",
"os.path.isfile",
"algorithm.similar_structur... | [((1520, 1527), 'entity.entity.Graph', 'Graph', ([], {}), '()\n', (1525, 1527), False, 'from entity.entity import Graph, Node\n'), ((2431, 2468), 'algorithm.similar_structure.get_similar_structure', 'get_similar_structure', (['name', 'nodes', 'k'], {}), '(name, nodes, k)\n', (2452, 2468), False, 'from algorithm.similar... |
# Copyright 2020 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
"utils.general.parse_gpu_ids",
"numpy.lib.pad",
"torch.cuda.is_available",
"torch.squeeze",
"os.path.exists",
"argparse.ArgumentParser",
"torch.unsqueeze",
"models.network_factory.get_network",
"torch.autograd.Variable",
"torchvision.transforms.Normalize",
"torch.nn.functional.relu",
"cv2.imre... | [((1053, 1124), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Reversing the cycle: single shot"""'}), "(description='Reversing the cycle: single shot')\n", (1076, 1124), False, 'import argparse\n'), ((2435, 2470), 'utils.general.parse_gpu_ids', 'general.parse_gpu_ids', (['args.gpu_ids']... |
"""
Title :RegularizationCallback.py
Description :Callback for custom weight regularization
Author :<NAME>
Date Created :23-03-2020
Date Modified :11-05-2020
version :1.1
python_version :3.6.6
"""
import keras
import numpy as np
from keras import backend as K
from laye... | [
"numpy.identity",
"numpy.ones",
"keras.backend.sum"
] | [((740, 755), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (747, 755), True, 'import numpy as np\n'), ((757, 771), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (768, 771), True, 'import numpy as np\n'), ((1133, 1179), 'keras.backend.sum', 'K.sum', (['current_weights[0][:, :, depth, neuron]'], {}... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <<EMAIL>>
"""USAGE: %(program)s MATRIX.mm [CLIP_DOCS] [CLIP_TERMS]
Check truncated SVD error for the algo in gensim, using a given corpus. This script
runs the decomposition with several internal parameters (number of requested factors,
iter... | [
"gensim.models.LsiModel",
"gensim.utils.FakeDict",
"sys.exit",
"numpy.linalg.norm",
"logging.info",
"numpy.save",
"numpy.multiply",
"bz2.BZ2File",
"gensim.corpora.MmCorpus",
"sys.stdout.flush",
"gensim.utils.grouper",
"time.time",
"logging.basicConfig",
"itertools.islice",
"numpy.diag",
... | [((2128, 2146), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (2144, 2146), False, 'import sys\n'), ((2508, 2603), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',... |
# coding=utf-8
# Copyright 2020 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.abs",
"numpy.isclose",
"cirq.rx",
"itertools.product",
"cirq.LineQubit",
"ast.literal_eval",
"cirq.Circuit",
"numpy.dot",
"numpy.sum",
"cirq.Simulator"
] | [((3897, 3930), 'ast.literal_eval', 'ast.literal_eval', (['protocol_string'], {}), '(protocol_string)\n', (3913, 3930), False, 'import ast\n'), ((5228, 5244), 'cirq.Simulator', 'cirq.Simulator', ([], {}), '()\n', (5242, 5244), False, 'import cirq\n'), ((6908, 6922), 'cirq.Circuit', 'cirq.Circuit', ([], {}), '()\n', (69... |
import json
import torch
import numpy as np
from typing import Optional
from datasets.arrow_dataset import Dataset
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
from seq2seq.utils.dataset import DataTrainingArguments, normalize, serialize_schema
from seq2seq.utils.trainer import Seq2SeqTraine... | [
"numpy.where",
"seq2seq.utils.dataset.serialize_schema",
"seq2seq.utils.trainer.EvalPrediction"
] | [((909, 1492), 'seq2seq.utils.dataset.serialize_schema', 'serialize_schema', ([], {'question': "ex['question']", 'db_path': "ex['db_path']", 'db_id': "ex['db_id']", 'db_column_names': "ex['db_column_names']", 'db_table_names': "ex['db_table_names']", 'schema_serialization_type': 'data_training_args.schema_serialization... |
# port "loss analysis v5.xlsx" by <NAME> to python3
import openpyxl
import numpy as np
import sys
import os
import re
from collections import OrderedDict
import matplotlib.pyplot as plt
import warnings
# modules for this package
import analysis
from scipy import constants
T = 300 # TODO: make optional input?
Vth = ... | [
"numpy.polyfit",
"analysis.Rs_calc_2",
"numpy.array",
"numpy.isfinite",
"numpy.genfromtxt",
"analysis.find_nearest",
"analysis.ideal_FF",
"analysis.ideal_FF_series_shunt",
"numpy.dot",
"numpy.polyval",
"analysis.FF_loss_series",
"warnings.simplefilter",
"analysis.ideality_factor",
"collect... | [((27015, 27054), 'os.path.join', 'os.path.join', (['os.pardir', '"""example_cell"""'], {}), "(os.pardir, 'example_cell')\n", (27027, 27054), False, 'import os\n'), ((571, 582), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (579, 582), True, 'import numpy as np\n'), ((1371, 1407), 'numpy.trapz', 'np.trapz', (['(self... |
import os
import numpy as np
import pkg_resources
from sklearn.pipeline import make_pipeline
import bob.io.base
import bob.io.image
from bob.pipelines.sample_loaders import AnnotationsLoader, CSVToSampleLoader
def test_sample_loader():
path = pkg_resources.resource_filename(
__name__, os.path.join("da... | [
"bob.pipelines.sample_loaders.CSVToSampleLoader",
"numpy.alltrue",
"os.path.join",
"sklearn.pipeline.make_pipeline",
"bob.pipelines.sample_loaders.AnnotationsLoader"
] | [((363, 466), 'bob.pipelines.sample_loaders.CSVToSampleLoader', 'CSVToSampleLoader', ([], {'data_loader': 'bob.io.base.load', 'dataset_original_directory': 'path', 'extension': '""".pgm"""'}), "(data_loader=bob.io.base.load, dataset_original_directory=\n path, extension='.pgm')\n", (380, 466), False, 'from bob.pipel... |
import contextlib
import math
from collections import defaultdict
from time import perf_counter
from warnings import filterwarnings
import numpy
import dask
from dask.base import tokenize
from dask.dataframe.core import new_dd_object
from dask.distributed import Client, performance_report, wait
from dask.utils import... | [
"time.sleep",
"dask.distributed.wait",
"dask.base.tokenize",
"numpy.arange",
"time.perf_counter",
"dask.utils.format_bytes",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.permutation",
"dask.config.set",
"dask_cuda.utils.all_to_all",
"dask.distributed.performance_report",
"dask.uti... | [((976, 1003), 'numpy.random.seed', 'xp.random.seed', (['(2 ** 32 - 1)'], {}), '(2 ** 32 - 1)\n', (990, 1003), True, 'import numpy as xp\n'), ((4135, 4178), 'dask.dataframe.core.new_dd_object', 'new_dd_object', (['graph', 'name', 'meta', 'divisions'], {}), '(graph, name, meta, divisions)\n', (4148, 4178), False, 'from ... |
#! /etc/bin/env python3
"""
transparent_images.py
Converts a RGB image to a RGBA image with transparency,
depending on colors in each of the four corners of the image.
"""
from collections import Counter
from glob import glob
from os import chdir, makedirs, path
import sys
from matplotlib.ima... | [
"os.path.exists",
"PIL.Image.open",
"PySimpleGUI.Popup",
"os.makedirs",
"PySimpleGUI.FolderBrowse",
"PySimpleGUI.In",
"os.path.splitext",
"matplotlib.image.imsave",
"PySimpleGUI.Text",
"os.chdir",
"numpy.array",
"PySimpleGUI.CloseButton",
"collections.Counter",
"PySimpleGUI.Window",
"glo... | [((722, 764), 'PySimpleGUI.Popup', 'sg.Popup', (['"""Cancel"""', '"""No filename supplied"""'], {}), "('Cancel', 'No filename supplied')\n", (730, 764), True, 'import PySimpleGUI as sg\n'), ((874, 886), 'os.chdir', 'chdir', (['fname'], {}), '(fname)\n', (879, 886), False, 'from os import chdir, makedirs, path\n'), ((90... |
# Copyright (c) 2021, Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import (AutoMinorLocator, FuncFormatter, MaxNLocator,
For... | [
"matplotlib.ticker.LogLocator",
"matplotlib.pyplot.ylabel",
"numpy.array",
"matplotlib.ticker.MaxNLocator",
"matplotlib.ticker.AutoMinorLocator",
"numpy.histogram",
"numpy.full_like",
"matplotlib.ticker.FuncFormatter",
"matplotlib.pyplot.close",
"numpy.issubdtype",
"matplotlib.pyplot.savefig",
... | [((108, 122), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (115, 122), True, 'import matplotlib as mpl\n'), ((595, 626), 'numpy.histogram', 'np.histogram', (['data'], {'bins': '"""sqrt"""'}), "(data, bins='sqrt')\n", (607, 626), True, 'import numpy as np\n'), ((1032, 1093), 'matplotlib.pyplot.subplots... |
import gc
from functools import reduce
from typing import Callable, Iterable, List, Optional, Tuple, TypeVar
import numpy as np
import pandas as pd
from .graph import AttrMap, Graph
from .trace import AddOp, TraceKey
from .utils import filter_not_null
from .utils.fs import IOAction
from .utils.ray import ray_iter
__... | [
"numpy.intersect1d",
"numpy.eye",
"numpy.prod",
"numpy.bitwise_or",
"numpy.union1d",
"numpy.unpackbits",
"numpy.bitwise_and",
"numpy.count_nonzero",
"numpy.zeros",
"gc.collect",
"typing.TypeVar"
] | [((854, 866), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (861, 866), False, 'from typing import Callable, Iterable, List, Optional, Tuple, TypeVar\n'), ((16024, 16049), 'numpy.eye', 'np.eye', (['size'], {'dtype': 'float'}), '(size, dtype=float)\n', (16030, 16049), True, 'import numpy as np\n'), ((17567,... |
import cv2
import numpy as np
def filterClusters(clusters):
# Remove things with angle far from median
for i in range(len(clusters)):
cluster = clusters[i]
if len(cluster) > 9:
median = np.median([facelet[2] for facelet in cluster])
clusters[i] = [facelet for facelet... | [
"cv2.convexHull",
"numpy.median",
"cv2.contourArea"
] | [((227, 273), 'numpy.median', 'np.median', (['[facelet[2] for facelet in cluster]'], {}), '([facelet[2] for facelet in cluster])\n', (236, 273), True, 'import numpy as np\n'), ((742, 760), 'cv2.contourArea', 'cv2.contourArea', (['c'], {}), '(c)\n', (757, 760), False, 'import cv2\n'), ((784, 801), 'cv2.convexHull', 'cv2... |
import numpy as np
from gym import spaces
from gym import Env
class ObservedPointEnv(Env):
"""
point mass on a 2-D plane
four tasks: move to (-10, -10), (-10, 10), (10, -10), (10, 10)
Problem 1: augment the observation with a one-hot vector encoding the task ID
- change the dimension of the obse... | [
"numpy.array",
"gym.spaces.Box"
] | [((886, 964), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-np.inf)', 'high': 'np.inf', 'shape': '(2 + num_tasks,)', 'dtype': 'np.float32'}), '(low=-np.inf, high=np.inf, shape=(2 + num_tasks,), dtype=np.float32)\n', (896, 964), False, 'from gym import spaces\n'), ((1125, 1185), 'gym.spaces.Box', 'spaces.Box', ([], {'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name:mnist_softmax
Description : softmax 实现 minst 预测
使用了 sklearn 的 one-hot 编码
参考: https://ask.hellobi.com/blog/DataMiner/4897
Email : <EMAIL>
Date:18-1-13
"""
import matplotlib.pyplot as plt
impo... | [
"tensorflow.equal",
"tensorflow.nn.softmax",
"tensorflow.log",
"numpy.mean",
"tensorflow.placeholder",
"tensorflow.Session",
"matplotlib.pyplot.style.use",
"tensorflow.matmul",
"tensorflow.zeros",
"sklearn.model_selection.train_test_split",
"tensorflow.train.GradientDescentOptimizer",
"matplot... | [((551, 564), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (559, 564), True, 'import numpy as np\n'), ((736, 787), 'tensorflow.placeholder', 'tf.placeholder', (['data_type'], {'shape': '[None, n_features]'}), '(data_type, shape=[None, n_features])\n', (750, 787), True, 'import tensorflow as tf\n'), ((796, 844),... |
#!/usr/bin/env python
import sys, os
import gdal
import numpy as np
from gdalconst import GDT_Float32
from osgeo import osr
from netCDF4 import Dataset
def createImgCAMS(inputPath):
driver = gdal.GetDriverByName('GTiff')
ncfile = Dataset(inputPath, 'r')
data = ncfile.variables['so2_conc'][:]
xSi... | [
"os.path.exists",
"numpy.amin",
"gdal.GetDriverByName",
"osgeo.osr.SpatialReference",
"netCDF4.Dataset",
"sys.exit",
"numpy.amax"
] | [((197, 226), 'gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""GTiff"""'], {}), "('GTiff')\n", (217, 226), False, 'import gdal\n'), ((245, 268), 'netCDF4.Dataset', 'Dataset', (['inputPath', '"""r"""'], {}), "(inputPath, 'r')\n", (252, 268), False, 'from netCDF4 import Dataset\n'), ((2320, 2375), 'sys.exit', 'sys.e... |
"""Methods for geodetic calculations."""
import os
import numpy
import srtm
import geopy
from geopy.distance import GeodesicDistance
from gewittergefahr.gg_utils import longitude_conversion as lng_conversion
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.gg_utils import error_checking
RADIA... | [
"gewittergefahr.gg_utils.error_checking.assert_is_valid_lat_numpy_array",
"numpy.sqrt",
"gewittergefahr.gg_utils.error_checking.assert_is_numpy_array_without_nan",
"gewittergefahr.gg_utils.error_checking.assert_is_real_numpy_array",
"numpy.invert",
"numpy.nanmean",
"numpy.array",
"numpy.arctan2",
"n... | [((4674, 4730), 'gewittergefahr.gg_utils.error_checking.assert_is_real_numpy_array', 'error_checking.assert_is_real_numpy_array', (['latitudes_deg'], {}), '(latitudes_deg)\n', (4715, 4730), False, 'from gewittergefahr.gg_utils import error_checking\n'), ((4735, 4804), 'gewittergefahr.gg_utils.error_checking.assert_is_n... |
""" This file defines the main object that runs experiments. """
import logging
import imp
import os
import os.path
import sys
import copy
import argparse
import threading
import time
import traceback
import matplotlib as mpl
sys.path.append('/'.join(str.split(__file__, '/')[:-2]))
# Add gps/python to path so that im... | [
"imp.load_source",
"time.sleep",
"sys.exc_info",
"sys.exit",
"os.path.exists",
"gps.utility.data_logger.DataLogger",
"os.listdir",
"argparse.ArgumentParser",
"gps.agent.ros.agent_ros.AgentROS",
"numpy.random.seed",
"gps.gui.gps_training_gui.GPSTrainingGUI",
"matplotlib.use",
"matplotlib.pypl... | [((481, 498), 'matplotlib.use', 'mpl.use', (['"""Qt4Agg"""'], {}), "('Qt4Agg')\n", (488, 498), True, 'import matplotlib as mpl\n'), ((13238, 13316), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run the Guided Policy Search algorithm."""'}), "(description='Run the Guided Policy Search a... |
# This file is part of the P3IV Simulator (https://github.com/fzi-forschungszentrum-informatik/P3IV),
# copyright by FZI Forschungszentrum Informatik, licensed under the BSD-3 license (see LICENSE file in main directory)
import unittest
import numpy as np
from p3iv_utils.coordinate_transformation import CoordinateTran... | [
"numpy.ones",
"p3iv_visualization.motion.plot_array2d.PlotArray2D",
"p3iv_visualization.motion.plot_motion_components.PlotMotionComponents",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.zeros",
"unittest.main",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.su... | [((4869, 4884), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4882, 4884), False, 'import unittest\n'), ((717, 735), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (729, 735), True, 'import matplotlib.pyplot as plt\n'), ((748, 776), 'p3iv_visualization.motion.plot_array2d.PlotArr... |
"""
Class :py:class:`FWViewImage` is a FWView for interactive image
===============================================================
FWView <- QGraphicsView <- ... <- QWidget
Usage ::
# Test
#-----
import sys
from psana.graphqt.FWViewImage import *
import psana.graphqt.ColorTable as ct
app = Q... | [
"psana.graphqt.ColorTable.color_table_rainbow",
"PyQt5.QtGui.QPixmap.fromImage",
"psana.graphqt.ColorTable.color_table_interpolated",
"psana.graphqt.ColorTable.color_table_monochr256",
"psana.pyalgos.generic.NDArrGenerators.add_ring",
"PyQt5.QtGui.QImage",
"sys._getframe",
"psana.graphqt.ColorTable.ar... | [((6261, 6282), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (6276, 6282), False, 'import sys\n'), ((8997, 9031), 'sys.exit', 'sys.exit', (["('End of Test %s' % tname)"], {}), "('End of Test %s' % tname)\n", (9005, 9031), False, 'import sys\n'), ((2021, 2079), 'psana.graphqt.ColorTable.color_ta... |
import math
import tensorflow as tf
from .model import Model
from .builder import MODELS
from .common import ConvNormActBlock
from core.layers import build_activation
def bottle2neckx(inputs,
filters,
cardinality,
strides=1,
scale=4,
... | [
"core.layers.build_activation",
"math.floor",
"tensorflow.split",
"tensorflow.keras.layers.GlobalAvgPool2D",
"tensorflow.keras.layers.Dense",
"tensorflow.nn.softmax",
"tensorflow.keras.layers.AvgPool2D",
"tensorflow.io.gfile.GFile",
"tensorflow.keras.layers.Lambda",
"tensorflow.keras.layers.Dropou... | [((807, 848), 'math.floor', 'math.floor', (['(filters * (base_width / 64.0))'], {}), '(filters * (base_width / 64.0))\n', (817, 848), False, 'import math\n'), ((4093, 4132), 'tensorflow.keras.layers.Add', 'tf.keras.layers.Add', ([], {'name': "(name + '/add')"}), "(name=name + '/add')\n", (4112, 4132), True, 'import ten... |
"""OctreeLevelInfo and OctreeLevel classes.
"""
import logging
import math
from typing import Dict, List, Optional
import numpy as np
from ....types import ArrayLike
from .octree_chunk import OctreeChunk, OctreeChunkGeom, OctreeLocation
from .octree_util import OctreeMetadata
LOGGER = logging.getLogger("napari.octre... | [
"logging.getLogger",
"numpy.array",
"math.ceil",
"numpy.minimum"
] | [((289, 323), 'logging.getLogger', 'logging.getLogger', (['"""napari.octree"""'], {}), "('napari.octree')\n", (306, 323), False, 'import logging\n'), ((1044, 1076), 'math.ceil', 'math.ceil', (['(base[0] / scaled_size)'], {}), '(base[0] / scaled_size)\n', (1053, 1076), False, 'import math\n'), ((1097, 1129), 'math.ceil'... |
# ---------------------------------------------------------
# Tensorflow MPC-GAN Implementation
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# ---------------------------------------------------------
import os
import time
import collections
import numpy as np
import matplotlib.pyplot ... | [
"model.MPCGAN",
"utils.threshold_by_otsu",
"utils.dice_coefficient_in_train",
"utils.remain_in_mask",
"numpy.mod",
"utils.AUC_ROC",
"utils.crop_to_original",
"tensorflow.Session",
"numpy.asarray",
"matplotlib.pyplot.close",
"numpy.stack",
"matplotlib.gridspec.GridSpec",
"os.path.isdir",
"t... | [((630, 654), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (652, 654), True, 'import tensorflow as tf\n'), ((676, 692), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (690, 692), True, 'import tensorflow as tf\n'), ((764, 793), 'tensorflow.Session', 'tf.Session', ([], {'c... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"logging.getLogger",
"kraken.lib.segmentation.extract_polygons",
"shapely.ops.split",
"albumentations.MedianBlur",
"torch.LongTensor",
"albumentations.Blur",
"torchvision.transforms.Lambda",
"albumentations.HueSaturationValue",
"numpy.array",
"torch.nn.functional.pad",
"torchvision.transforms.Pa... | [((1979, 2006), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1996, 2006), False, 'import logging\n'), ((5975, 6009), 'torchvision.transforms.Compose', 'transforms.Compose', (['out_transforms'], {}), '(out_transforms)\n', (5993, 6009), False, 'from torchvision import transforms\n'), ((8... |
import numpy as np
import scmodes
def test_simulate_pois_rank1():
x, eta = scmodes.dataset.simulate_pois(n=30, p=60, rank=1)
assert x.shape == (30, 60)
assert eta.shape == (30, 60)
assert (x >= 0).all()
assert (~np.isclose(np.linalg.svd(eta, compute_uv=False, full_matrices=False), 0)).sum() == 1
def test_si... | [
"numpy.linalg.svd",
"numpy.ma.is_masked",
"scmodes.dataset.simulate_pois",
"scmodes.dataset.simulate_pois_size"
] | [((78, 127), 'scmodes.dataset.simulate_pois', 'scmodes.dataset.simulate_pois', ([], {'n': '(30)', 'p': '(60)', 'rank': '(1)'}), '(n=30, p=60, rank=1)\n', (107, 127), False, 'import scmodes\n'), ((352, 401), 'scmodes.dataset.simulate_pois', 'scmodes.dataset.simulate_pois', ([], {'n': '(30)', 'p': '(60)', 'rank': '(2)'})... |
# coding=utf-8
# 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 ... | [
"numpy.random.normal",
"numpy.abs",
"tempfile.TemporaryDirectory",
"learned_optimization.population.mutators.winner_take_all_genetic.WinnerTakeAllGenetic",
"absl.testing.parameterized.parameters",
"absl.testing.absltest.main",
"numpy.random.seed"
] | [((955, 991), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(1,)', '(3,)'], {}), '((1,), (3,))\n', (979, 991), False, 'from absl.testing import parameterized\n'), ((4329, 4344), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (4342, 4344), False, 'from absl.testing import absl... |
import sys
import tempfile
import numpy as np
from dffml.record import Record
from dffml.high_level.ml import score
from dffml.source.source import Sources
from dffml.source.memory import MemorySource, MemorySourceConfig
from dffml.feature import Feature, Features
from dffml.util.asynctestcase import AsyncTestCase
im... | [
"tempfile.TemporaryDirectory",
"sklearn.datasets.make_blobs",
"dffml.high_level.ml.score",
"dffml.feature.Feature",
"dffml.feature.Features",
"numpy.concatenate",
"dffml.source.memory.MemorySourceConfig"
] | [((10059, 10127), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': '(80)', 'centers': '(8)', 'n_features': '(4)', 'random_state': '(2020)'}), '(n_samples=80, centers=8, n_features=4, random_state=2020)\n', (10069, 10127), False, 'from sklearn.datasets import make_blobs\n'), ((10160, 10207), 'numpy.concat... |
import numpy as np
import scipy as sp
from sklearn.gaussian_process import GaussianProcessRegressor
import matplotlib.pyplot as plt
class PostProcessing:
"""
This class contains the methods for visualizing the results of the DIC analysis.
**Input:**
* **analysis_obj** (`object`)
Object of the ... | [
"matplotlib.pyplot.imshow",
"sklearn.gaussian_process.GaussianProcessRegressor",
"scipy.ndimage.gaussian_filter",
"numpy.sqrt",
"matplotlib.pyplot.colorbar",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.min",
"numpy.meshgrid",
"numpy.shape",
"matp... | [((4302, 4328), 'numpy.array', 'np.array', (['strain_matrix_11'], {}), '(strain_matrix_11)\n', (4310, 4328), True, 'import numpy as np\n'), ((4353, 4379), 'numpy.array', 'np.array', (['strain_matrix_22'], {}), '(strain_matrix_22)\n', (4361, 4379), True, 'import numpy as np\n'), ((4404, 4430), 'numpy.array', 'np.array',... |
"""
Here the structure of the network is made in pytorch
"""
from typing import List, Union, Optional
import torch
import os
from logger import logger
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from scipy.stats import norm
class Encoder(nn.Module):
"""
Encodes the data using a CN... | [
"torch.distributions.normal.Normal",
"logger.logger.error",
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"os.path.exists",
"numpy.histogram",
"torch.nn.Flatten",
"numpy.linspace",
"numpy.empty",
"torch.zeros_like",
"torch.randn",
"logger.logger.info",
"torch.nn.LeakyReLU",
"numpy.digitize",... | [((3540, 3579), 'torch.distributions.normal.Normal', 'torch.distributions.normal.Normal', (['(0)', '(1)'], {}), '(0, 1)\n', (3573, 3579), False, 'import torch\n'), ((3852, 3884), 'numpy.zeros', 'np.zeros', (['(z_dim, self.num_bins)'], {}), '((z_dim, self.num_bins))\n', (3860, 3884), True, 'import numpy as np\n'), ((489... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 19 08:55:28 2021
Purpose of the script:
The purpose of the script is to load informations from files created by both the Quality Control of Nergica and the lidar installed on Nergica's site.
The informations is extracted for heights and the year selected a the top... | [
"matplotlib.pyplot.grid",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"numpy.arange",
"pickle.load",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.ylim"... | [((5515, 5564), 'glob.glob', 'glob.glob', (['(str_pathDirectory_CQ + str_filesFilter)'], {}), '(str_pathDirectory_CQ + str_filesFilter)\n', (5524, 5564), False, 'import glob\n'), ((5931, 5979), 'glob.glob', 'glob.glob', (["(str_pathDirectory_CQ + '*mmv1*Baroh*')"], {}), "(str_pathDirectory_CQ + '*mmv1*Baroh*')\n", (594... |
import matplotlib.pyplot as plt
import os
import pandas as pd
import geopandas as gpd
import numpy as np
import networkx as nx
def map_setup(n_communities, area, small_network=False):
# directory of data
areas = ['London', 'UK']
if area not in areas:
raise ValueError("Invalid area name. Expect... | [
"os.path.join",
"networkx.Graph",
"numpy.array",
"numpy.nanmax",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplots"
] | [((1124, 1134), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1132, 1134), True, 'import networkx as nx\n'), ((1299, 1332), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)'], {'figsize': '(15, 15)'}), '(1, figsize=(15, 15))\n', (1311, 1332), True, 'import matplotlib.pyplot as plt\n'), ((1363, 1378), 'matplotlib... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Example for computing the RIR between several sources and receivers in GPU.
@author: <EMAIL>
pyrirgen: https://github.com/phecda-xu/RIR-Generator
"""
import numpy as np
import soundfile as sf
import math
import pyrirgen
import argparse
import os
from mult... | [
"os.path.exists",
"numpy.abs",
"numpy.sqrt",
"os.makedirs",
"argparse.ArgumentParser",
"multiprocessing.Process",
"math.degrees",
"soundfile.write",
"pyrirgen.generateRir",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.arctan2",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin"
] | [((5909, 5934), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5932, 5934), False, 'import argparse\n'), ((383, 409), 'os.path.exists', 'os.path.exists', (['output_dir'], {}), '(output_dir)\n', (397, 409), False, 'import os\n'), ((420, 443), 'os.makedirs', 'os.makedirs', (['output_dir'], {}), ... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# <NAME> (<EMAIL>), Blue Yonder Gmbh, 2016
import os
import tempfile
import numpy as np
import pandas as pd
from mock import Mock
from tests.fixtures import DataTestCase
from tsfresh.feat... | [
"numpy.random.normal",
"numpy.testing.assert_array_almost_equal",
"numpy.repeat",
"tsfresh.feature_extraction.settings.ComprehensiveFCParameters",
"mock.Mock",
"os.path.join",
"tsfresh.feature_extraction.settings.PickeableSettings",
"os.path.isfile",
"numpy.array",
"tempfile.gettempdir",
"tsfres... | [((763, 784), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (782, 784), False, 'import tempfile\n'), ((957, 1077), 'tsfresh.feature_extraction.extraction.extract_features', 'extract_features', (['df'], {'column_id': '"""id"""', 'column_sort': '"""sort"""', 'column_kind': '"""kind"""', 'column_value': ... |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, Series, date_range, offsets
import pandas._testing as tm
class TestDataFrameShift:
def test_shift(self, datetime_frame, int_frame):
# naive shift
shiftedFrame = datetime_frame.shift(5)
tm.assert_inde... | [
"pandas.Series",
"pandas.offsets.BDay",
"pandas._testing.assert_series_equal",
"pytest.mark.filterwarnings",
"numpy.random.rand",
"numpy.asarray",
"pandas._testing.assert_index_equal",
"numpy.array",
"pandas._testing.makePeriodFrame",
"numpy.random.randint",
"pandas.concat",
"pytest.raises",
... | [((5919, 5990), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:tshift is deprecated:FutureWarning"""'], {}), "('ignore:tshift is deprecated:FutureWarning')\n", (5945, 5990), False, 'import pytest\n'), ((306, 369), 'pandas._testing.assert_index_equal', 'tm.assert_index_equal', (['shiftedFrame.i... |
import numpy as np
from gym.spaces.dict import Dict as GymDict
from rlpyt.utils.collections import NamedTupleSchema, NamedTuple
from rlpyt.spaces.composite import Composite
class GymSpaceWrapper:
"""Wraps a gym space to match the rlpyt interface; most of
the functionality is for automatically converting a G... | [
"rlpyt.spaces.composite.Composite",
"numpy.asarray"
] | [((4641, 4676), 'numpy.asarray', 'np.asarray', (['value'], {'dtype': 'np.float32'}), '(value, dtype=np.float32)\n', (4651, 4676), True, 'import numpy as np\n'), ((1762, 1783), 'rlpyt.spaces.composite.Composite', 'Composite', (['spaces', 'nt'], {}), '(spaces, nt)\n', (1771, 1783), False, 'from rlpyt.spaces.composite imp... |
"""PROGRAM FOR LEC COMPUTATION.
The module contains the following functions:
- lorenz: it is the main program, calling functions that compute the
reservoirs and conversion terms, storing them separately in
NetCDF files and providing a flux diagram and a table outputs,
the ... | [
"numpy.fft.irfft",
"math.sqrt",
"numpy.nanmean",
"sys.exit",
"numpy.imag",
"numpy.arange",
"os.remove",
"numpy.fft.fft",
"netCDF4.Dataset",
"numpy.fft.rfft",
"numpy.real",
"cdo.Cdo",
"numpy.conj",
"numpy.deg2rad",
"numpy.cos",
"numpy.shape",
"numpy.nansum",
"numpy.transpose",
"nu... | [((2768, 2827), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""ComplexWarning"""'}), "('ignore', message='ComplexWarning')\n", (2791, 2827), False, 'import warnings\n'), ((3801, 3825), 'numpy.nanmean', 'np.nanmean', (['ta_c'], {'axis': '(1)'}), '(ta_c, axis=1)\n', (3811, 3825),... |
import argparse
import collections
import random
import numpy
class ValueRange(collections.Container):
'''A class wrapping a list with some extra functional magic, like head,
tail, init, last, drop, and take.'''
def __init__(self, min=0., max=1., dtype=float):
self.dtype = dtype
if dtype... | [
"argparse.ArgumentParser",
"numpy.random.random",
"numpy.random.choice",
"numpy.exp",
"numpy.array",
"numpy.random.randint",
"random.getrandbits"
] | [((2323, 2356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '(**kwargs)\n', (2346, 2356), False, 'import argparse\n'), ((1243, 1310), 'numpy.random.randint', 'numpy.random.randint', (['self.min_value', '(self.max_value + 1)'], {'size': 'size'}), '(self.min_value, self.max_value + 1, size=size)\n', (... |
# predict probabilities for counts, given a set of future features
# execute: python predict.py
# This file can be scheduled to run at any time.
# It will generate hourly predictions for the remaining hours in today and N-additional days:
# - current hour - if the job is running at 8:45, the first prediction will be fo... | [
"logging.basicConfig",
"datetime.datetime",
"numpy.unique",
"pandas.read_csv",
"numpy.random.poisson",
"pickle.load",
"numpy.argmax",
"requests.get",
"os.path.isfile",
"datetime.datetime.now",
"numpy.quantile",
"pandas.date_range",
"pandas.DataFrame",
"datetime.timedelta",
"logging.info"... | [((2627, 2683), 'pandas.date_range', 'pd.date_range', ([], {'start': 'start_date', 'end': 'end_date', 'freq': '"""1H"""'}), "(start=start_date, end=end_date, freq='1H')\n", (2640, 2683), True, 'import pandas as pd\n'), ((2700, 2725), 'pandas.DataFrame', 'pd.DataFrame', (["{'dt': idx}"], {}), "({'dt': idx})\n", (2712, 2... |
import sys
import unittest
from random import randint
import numpy as np
import crocoddyl
import pinocchio
from crocoddyl.utils import DDPDerived
class SolverAbstractTestCase(unittest.TestCase):
MODEL = None
SOLVER = None
SOLVER_DER = None
def setUp(self):
# Set up the solvers
self.... | [
"unittest.TestSuite",
"random.randint",
"numpy.allclose",
"crocoddyl.ShootingProblem",
"crocoddyl.CostModelControl",
"crocoddyl.CostModelState",
"pinocchio.utils.rand",
"pinocchio.SE3.Random",
"crocoddyl.CostModelSum",
"pinocchio.buildSampleModelManipulator",
"crocoddyl.StateMultibody",
"croco... | [((4457, 4488), 'crocoddyl.ActionModelUnicycle', 'crocoddyl.ActionModelUnicycle', ([], {}), '()\n', (4486, 4488), False, 'import crocoddyl\n'), ((4620, 4659), 'pinocchio.buildSampleModelManipulator', 'pinocchio.buildSampleModelManipulator', ([], {}), '()\n', (4657, 4659), False, 'import pinocchio\n'), ((4672, 4709), 'c... |
#!/usr/bin/env python3
#title : poisson.py
#description : Poisson distribution.
#author : <NAME>
#date : 2015.06.19
#version : 0.1
#usage : python poisson.py
#=====================================================
import numpy as np
from scipy import special as sp
from scipy... | [
"core.core.delta.log_likelihood",
"numpy.random.poisson",
"numpy.power",
"numpy.where",
"core.core.delta.pmf",
"numpy.log",
"core.core.delta.samples",
"numpy.sum",
"mpmath.ln",
"numpy.arange"
] | [((932, 957), 'core.core.delta.pmf', 'co.delta.pmf', (['[0]', 'domain'], {}), '([0], domain)\n', (944, 957), True, 'from core import core as co\n'), ((1457, 1484), 'core.core.delta.samples', 'co.delta.samples', (['[0]', 'size'], {}), '([0], size)\n', (1473, 1484), True, 'from core import core as co\n'), ((1518, 1552), ... |
import numpy as np
from collections import Counter
from lidar_interpolate_toolbox import *
from path import Path
from PIL import Image
from imageio import imread
from visdom import Visdom
from color_utils import *
vis = Visdom()
def read_raw_calib_file(filepath):
# From https://github.com/utiasSTARS/pykitti/blob... | [
"numpy.uint8",
"numpy.eye",
"PIL.Image.fromarray",
"numpy.reshape",
"numpy.fromfile",
"numpy.where",
"collections.Counter",
"path.Path",
"numpy.dot",
"numpy.array",
"numpy.zeros",
"imageio.imread",
"numpy.transpose",
"numpy.round",
"visdom.Visdom"
] | [((221, 229), 'visdom.Visdom', 'Visdom', ([], {}), '()\n', (227, 229), False, 'from visdom import Visdom\n'), ((1133, 1142), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (1139, 1142), True, 'import numpy as np\n'), ((3074, 3084), 'path.Path', 'Path', (['root'], {}), '(root)\n', (3078, 3084), False, 'from path import ... |
"""
Train a new model on one or across multiple GPUs.
"""
from comet_ml import ExistingExperiment, Experiment
import collections
import math
import random
from getpass import getpass
import keyring
import numpy as np
import torch
from fairseq import (
checkpoint_utils,
distributed_utils,
options,
pr... | [
"comet_ml.Experiment",
"fairseq.options.parse_args_and_arch",
"torch.cuda.device_count",
"comet_ml.ExistingExperiment",
"torch.cuda.is_available",
"fairseq.options.get_training_parser",
"fairseq.distributed_utils.infer_init_method",
"fairseq.checkpoint_utils.load_checkpoint",
"keyring.set_password",... | [((550, 580), 'fairseq.utils.import_user_module', 'utils.import_user_module', (['args'], {}), '(args)\n', (574, 580), False, 'from fairseq import checkpoint_utils, distributed_utils, options, progress_bar, tasks, utils\n'), ((1119, 1144), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (113... |
from typing import List
import numpy as np
import segmentation_models_pytorch as smp
from segmentation_models_pytorch.base.modules import Activation
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets
from torchvision.transforms import transforms
from baal import Ac... | [
"segmentation_models_pytorch.base.modules.Activation",
"torch.nn.Dropout2d",
"torch.Tensor",
"torch.nn.Conv2d",
"torch.nn.UpsamplingBilinear2d",
"numpy.array",
"torchvision.transforms.transforms.ToTensor",
"torch.nn.functional.log_softmax",
"torch.nn.Identity",
"torchvision.datasets.VOCSegmentatio... | [((358, 682), 'numpy.array', 'np.array', (['[[0, 0, 0], [128, 0, 0], [0, 128, 0], [128, 128, 0], [0, 0, 128], [128, 0, \n 128], [0, 128, 128], [128, 128, 128], [64, 0, 0], [192, 0, 0], [64, 128,\n 0], [192, 128, 0], [64, 0, 128], [192, 0, 128], [64, 128, 128], [192, \n 128, 128], [0, 64, 0], [128, 64, 0], [0, ... |
import pandas as pd
import numpy as np
import json
import csv
import argparse
import re
from collections import OrderedDict
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Converts Covid-19 Data \
Tabels provided by the RKI to a simpler format \
... | [
"collections.OrderedDict",
"argparse.ArgumentParser",
"re.compile",
"pandas.read_csv",
"json.load",
"numpy.sum",
"pandas.DataFrame",
"pandas.date_range"
] | [((168, 355), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Converts Covid-19 Data Tabels provided by the RKI to a simpler format to fit the model"""'}), "(description=\n 'Converts Covid-19 Data Tabels prov... |
#!/usr/bin/env python
# encoding: utf-8
"""Usage:
convert.py serial_speakers <input_path> <serie_uri> <annotation_path> <annotated_path> [--map]
"""
from pyannote.core import Annotation, Segment, Timeline
import pyannote.database
from Plumcot import Plumcot
import json
from termcolor import colored
import numpy as n... | [
"Plumcot.Plumcot",
"json.loads",
"pyannote.core.Segment",
"re.split",
"numpy.unique",
"termcolor.colored",
"json.dump",
"pyannote.core.Timeline",
"json.load",
"pyannote.core.Annotation",
"docopt.docopt"
] | [((1716, 1725), 'Plumcot.Plumcot', 'Plumcot', ([], {}), '()\n', (1723, 1725), False, 'from Plumcot import Plumcot\n'), ((3381, 3432), 'numpy.unique', 'np.unique', (['serial_speaker_names'], {'return_counts': '(True)'}), '(serial_speaker_names, return_counts=True)\n', (3390, 3432), True, 'import numpy as np\n'), ((5899,... |
# -*- coding: utf-8 -*-
"""
Simple ANALYSIS driver for GrainHill model
"""
from landlab.io import load_params
import numpy as np
grain_hill_as_class = reload(grain_hill_as_class)
def two_node_diff(a):
"""Calculate and return diffs over two nodes instead of one."""
N = len(a)
return a[2:] - a[:(N-2)]
dx ... | [
"landlab.io.load_params",
"numpy.amax",
"numpy.round"
] | [((499, 522), 'landlab.io.load_params', 'load_params', (['input_file'], {}), '(input_file)\n', (510, 522), False, 'from landlab.io import load_params\n'), ((2131, 2152), 'numpy.amax', 'np.amax', (['elev_profile'], {}), '(elev_profile)\n', (2138, 2152), True, 'import numpy as np\n'), ((596, 638), 'numpy.round', 'np.roun... |
from sacred import Experiment
import os.path as osp
import os
import numpy as np
import yaml
import cv2
import torch
from torch.utils.data import DataLoader
from tracktor.config import get_output_dir, get_tb_dir
from tracktor.solver import Solver
from tracktor.datasets.factory import Datasets
from tracktor.resnet imp... | [
"torch.manual_seed",
"tracktor.datasets.factory.Datasets",
"os.path.exists",
"tracktor.resnet.resnet50",
"os.makedirs",
"yaml.dump",
"tracktor.config.get_tb_dir",
"os.path.join",
"sacred.Experiment",
"tracktor.solver.Solver",
"numpy.random.seed",
"tracktor.config.get_output_dir",
"torch.util... | [((339, 351), 'sacred.Experiment', 'Experiment', ([], {}), '()\n', (349, 351), False, 'from sacred import Experiment\n'), ((522, 556), 'torch.manual_seed', 'torch.manual_seed', (["siamese['seed']"], {}), "(siamese['seed'])\n", (539, 556), False, 'import torch\n'), ((561, 600), 'torch.cuda.manual_seed', 'torch.cuda.manu... |
######################################################################
# #
# Copyright 2009-2020 <NAME>. #
# This file is part of gdspy, distributed under the terms of the #
# Boost Software License - Version 1.0. See the accom... | [
"itertools.chain",
"gdspy.path.FlexPath",
"colorsys.hsv_to_rgb",
"numpy.array",
"builtins.range",
"copy.deepcopy",
"numpy.sin",
"datetime.datetime.today",
"copy.copy",
"gdspy.label.Label",
"gdspy.gdsiiformat._eight_byte_real",
"gdspy.gdsiiformat._raw_record_reader",
"numpy.concatenate",
"w... | [((1723, 1747), 'numpy.array', 'numpy.array', (['(-1.0, 1.0)'], {}), '((-1.0, 1.0))\n', (1734, 1747), False, 'import numpy\n'), ((970, 1004), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (1002, 1004), False, 'from future import standard_library\n'), ((103314, 103340),... |
# Reference: https://www.kaggle.com/CVxTz/audio-data-augmentation
import numpy as np
from nlpaug.model.audio import Audio
class Shift(Audio):
def __init__(self, sampling_rate, shift_max=2, shift_direction='both'):
"""
:param sampling_rate: SR of audio
:param shift_max: Max shifting in s... | [
"numpy.random.randint",
"numpy.roll"
] | [((855, 909), 'numpy.random.randint', 'np.random.randint', (['(self.sampling_rate * self.shift_max)'], {}), '(self.sampling_rate * self.shift_max)\n', (872, 909), True, 'import numpy as np\n'), ((1162, 1182), 'numpy.roll', 'np.roll', (['data', 'shift'], {}), '(data, shift)\n', (1169, 1182), True, 'import numpy as np\n'... |
from itertools import product
from random import choice
from sys import stdout
from typing import Tuple
from numpy import all, full, zeros, uint8
symbol_dict = {
'hunt': ('S', 'P'),
'harvest': ('p', 'P'),
'escalation': 'M'
}
A_AGENT = 0 # base
B_AGENT = 1
STAG = 2 # hunt
PLANT = 3
Y_PLANT = 2 # harv... | [
"numpy.all",
"random.choice",
"numpy.zeros",
"numpy.full",
"sys.stdout.flush",
"sys.stdout.write"
] | [((1549, 1597), 'sys.stdout.write', 'stdout.write', (['"""╔════════════════════════════╗\n"""'], {}), "('╔════════════════════════════╗\\n')\n", (1561, 1597), False, 'from sys import stdout\n'), ((2169, 2219), 'sys.stdout.write', 'stdout.write', (["'╚════════════════════════════╝\\n\\r'"], {}), "('╚════════════════════... |
__author__='lhq'
import os
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
def get_train_img():
"""
获取输入数据
:return:
"""
cwd=os.getcwd()
mi_dir=cwd+'/dataset/train/mi/'
shu_dir=cwd+'/dataset/train/shu/'
file1=os.listdir(mi_dir)
file0=os.listdir(shu_dir)... | [
"os.listdir",
"PIL.Image.open",
"numpy.delete",
"os.getcwd",
"numpy.array",
"numpy.empty",
"numpy.concatenate"
] | [((176, 187), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (185, 187), False, 'import os\n'), ((272, 290), 'os.listdir', 'os.listdir', (['mi_dir'], {}), '(mi_dir)\n', (282, 290), False, 'import os\n'), ((301, 320), 'os.listdir', 'os.listdir', (['shu_dir'], {}), '(shu_dir)\n', (311, 320), False, 'import os\n'), ((425, 44... |
"""Conjugate Gradient Optimizer.
Computes the decent direction using the conjugate gradient method, and then
computes the optimal step size that will satisfy the KL divergence constraint.
Finally, it performs a backtracking line search to optimize the objective.
"""
import warnings
from dowel import logger
import nu... | [
"torch.isnan",
"numpy.arange",
"metarl.misc.tensor_utils.unflatten_tensors",
"dowel.logger.log",
"torch.autograd.grad",
"numpy.isnan",
"torch.sum",
"warnings.warn",
"torch.zeros_like",
"torch.Size",
"torch.cat",
"torch.dot"
] | [((1129, 1178), 'torch.autograd.grad', 'torch.autograd.grad', (['f', 'params'], {'create_graph': '(True)'}), '(f, params, create_graph=True)\n', (1148, 1178), False, 'import torch\n'), ((2665, 2684), 'torch.zeros_like', 'torch.zeros_like', (['b'], {}), '(b)\n', (2681, 2684), False, 'import torch\n'), ((2697, 2712), 'to... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#import tensorflow as tf
import numpy as np
import math
try:
import cPickle as pickle
except:
import pickle
import os
class BlockScramble:
def __init__( self, blockSize_filename ):
if( isinstance( blockSize_filename, str ) ):
self.load( block... | [
"os.path.exists",
"PIL.Image.fromarray",
"PIL.Image.open",
"numpy.reshape",
"pickle.dump",
"numpy.tile",
"math.floor",
"numpy.int32",
"numpy.asarray",
"pickle.load",
"matplotlib.cm.gist_earth",
"numpy.argsort",
"numpy.concatenate",
"numpy.transpose",
"numpy.arange",
"numpy.random.shuff... | [((4260, 4282), 'PIL.Image.open', 'Image.open', (['"""lena.png"""'], {}), "('lena.png')\n", (4270, 4282), False, 'from PIL import Image\n'), ((4294, 4324), 'numpy.asarray', 'np.asarray', (['im'], {'dtype': 'np.uint8'}), '(im, dtype=np.uint8)\n', (4304, 4324), True, 'import numpy as np\n'), ((4336, 4371), 'numpy.reshape... |
"""Abstract baseclass for all distributions."""
import logging
import numpy
import chaospy
from .utils import check_dependencies
class Distribution(object):
"""Baseclass for all probability distributions."""
__array_priority__ = 9000
"""Numpy override variable."""
interpret_as_integer = False
... | [
"logging.getLogger",
"numpy.prod",
"numpy.clip",
"chaospy.StochasticallyDependentError",
"numpy.asfarray",
"numpy.array",
"chaospy.approximate_moment",
"chaospy.Negative",
"chaospy.Power",
"chaospy.UnsupportedFeature",
"chaospy.approximate_inverse",
"numpy.where",
"numpy.asarray",
"numpy.r... | [((5076, 5097), 'numpy.atleast_1d', 'numpy.atleast_1d', (['out'], {}), '(out)\n', (5092, 5097), False, 'import numpy\n'), ((5307, 5356), 'chaospy.UnsupportedFeature', 'chaospy.UnsupportedFeature', (['"""lower not supported"""'], {}), "('lower not supported')\n", (5333, 5356), False, 'import chaospy\n'), ((6105, 6126), ... |
"""Basic filtering of garbage and perplexity sampling for OSCAR v1."""
import gzip
import multiprocessing
import os
from random import sample
import fsspec
import kenlm # pip install https://github.com/kpu/kenlm/archive/master.zip
import langid
import numpy as np
from datasets import load_dataset
from nltk.corpus im... | [
"os.path.exists",
"kenlm.Model",
"random.sample",
"numpy.random.default_rng",
"gzip.open",
"multiprocessing.Process",
"os.path.split",
"numpy.exp",
"langid.classify",
"os.unlink",
"transformers.AutoTokenizer.from_pretrained",
"os.system",
"fsspec.open"
] | [((10563, 10578), 'os.unlink', 'os.unlink', (['file'], {}), '(file)\n', (10572, 10578), False, 'import os\n'), ((12981, 13002), 'os.path.exists', 'os.path.exists', (['file2'], {}), '(file2)\n', (12995, 13002), False, 'import os\n'), ((13096, 13235), 'os.system', 'os.system', (['f"""/content/lmplz --discount_fallback -... |
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import pytest
import test_util as tu
@tu.requires_ipu_model
def test_ipu_copy_bca1():
popart.getLogger().setLevel("TRACE")
builder = popart.Builder()
i1 = builder.addInputTensor(popart.TensorInfo("FLOAT", [1]))
... | [
"popart.Builder",
"test_util.create_test_device",
"popart.AnchorReturnType",
"numpy.random.rand",
"popart.SessionOptions",
"popart.TensorInfo",
"pytest.raises",
"popart.getLogger"
] | [((235, 251), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (249, 251), False, 'import popart\n'), ((744, 767), 'popart.SessionOptions', 'popart.SessionOptions', ([], {}), '()\n', (765, 767), False, 'import popart\n'), ((1228, 1244), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (1242, 1244), False, 'im... |
#!/usr/bin/env python
# coding: utf-8
# # Homework 1 Solution Question 2
# In[1]:
#importing libraries
import csv
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# In[2]:
#opening the data files for data 1
with open('data_1.csv') as csvfile:
x_1=[]
y_1=[]
readCSV = csv.reader(cs... | [
"matplotlib.pyplot.text",
"numpy.sqrt",
"numpy.linalg.eig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.zeros_like",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"csv.reader",
"matplotlib.pyplot.title",
"matplotlib.pyplo... | [((844, 871), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 4)'}), '(figsize=(15, 4))\n', (854, 871), True, 'import matplotlib.pyplot as plt\n'), ((871, 887), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(121)'], {}), '(121)\n', (882, 887), True, 'import matplotlib.pyplot as plt\n'), ((888, 908), '... |
import json
import logging
import math
import socket
import time
import numpy as np
import tables
import torch
import torch.nn.functional as F
import transformers
from torch import nn
from torch.nn import DataParallel
from torchtext import data
from torchtext.data import Iterator, Batch
from tqdm import tqdm
from tran... | [
"logging.debug",
"torch.LongTensor",
"transformers.get_constant_schedule_with_warmup",
"torch.cuda.device_count",
"transformers.AutoTokenizer.from_pretrained",
"logging.info",
"logging.error",
"json.dumps",
"numpy.concatenate",
"socket.gethostname",
"tables.Float32Atom",
"torchtext.data.Field"... | [((8610, 8625), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8623, 8625), False, 'import torch\n'), ((12921, 12936), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (12934, 12936), False, 'import torch\n'), ((827, 963), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (["config... |
import os
import sys
import numpy as np
from joblib import Parallel, delayed
import joblib
import argparse
import importlib
from itertools import product
import collections
from copy import deepcopy
from mcpy.utils import filesafe
from mcpy import plotting
def _get(opts, key, default):
return opts[key] if (key in... | [
"os.path.exists",
"mcpy.utils.filesafe",
"mcpy.plotting.sweep_plot",
"importlib.import_module",
"argparse.ArgumentParser",
"os.makedirs",
"joblib.load",
"itertools.product",
"mcpy.plotting.instance_plot",
"numpy.min",
"numpy.max",
"numpy.random.seed",
"copy.deepcopy",
"joblib.delayed",
"... | [((7760, 7821), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(description='Process some integers.')\n", (7783, 7821), False, 'import argparse\n'), ((7945, 7981), 'importlib.import_module', 'importlib.import_module', (['args.config'], {}), '(args.config)\n... |
import pytest
import pyvibdmc as pv
import os
import numpy as np
def test_imp_samp_derivs():
water_coord = np.array([[1.81005599, 0., 0.],
[-0.45344658, 1.75233806, 0.],
[0., 0., 0.]]) * 1.01
water_coord = np.tile(water_coord, (1000, 1, 1))
ohs = [[... | [
"numpy.tile",
"numpy.array",
"pyvibdmc.ChainRuleHelper"
] | [((272, 306), 'numpy.tile', 'np.tile', (['water_coord', '(1000, 1, 1)'], {}), '(water_coord, (1000, 1, 1))\n', (279, 306), True, 'import numpy as np\n'), ((360, 395), 'pyvibdmc.ChainRuleHelper', 'pv.ChainRuleHelper', (['water_coord', 'np'], {}), '(water_coord, np)\n', (378, 395), True, 'import pyvibdmc as pv\n'), ((113... |
import numpy as np
from scipy.signal import kaiserord, lfilter, firwin, freqz, lfilter_zi
class fir_filter(object):
def __init__(self, fs, cutoff, ripple_db):
self.fs = fs # sample_rate
# The Nyquist rate of the signal.
nyq_rate = self.fs / 2.0
# The desired width of the transitio... | [
"utils.Logger.IO",
"scipy.signal.firwin",
"scipy.signal.lfilter_zi",
"numpy.array",
"matplotlib.pylab.plt.plot",
"matplotlib.pylab.plt.show",
"numpy.arange",
"scipy.signal.kaiserord"
] | [((2478, 2501), 'numpy.array', 'np.array', (['filter_x_list'], {}), '(filter_x_list)\n', (2486, 2501), True, 'import numpy as np\n'), ((2516, 2538), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(0.01)'], {}), '(0, 10, 0.01)\n', (2525, 2538), True, 'import numpy as np\n'), ((2537, 2562), 'matplotlib.pylab.plt.plot', '... |
"""
Application class for the model 'im_3_kW' of an induction machine
https://gitlab.onelab.info/doc/models/-/wikis/Electric-machines
"""
from typing import Dict
import os
import subprocess
from subprocess import PIPE
import tempfile
import time
import numpy as np
from pymgrit.core.application import Application
fro... | [
"pymgrit.induction_machine.helper.is_numeric",
"tempfile.TemporaryDirectory",
"pymgrit.induction_machine.helper.set_resolution",
"pymgrit.induction_machine.helper.get_values_from",
"numpy.size",
"subprocess.run",
"os.path.splitext",
"os.path.join",
"os.path.split",
"os.path.isfile",
"numpy.sum",... | [((2013, 2044), 'pymgrit.induction_machine.helper.pre_file', 'pre_file', (['(path_im3kw + self.pre)'], {}), '(path_im3kw + self.pre)\n', (2021, 2044), False, 'from pymgrit.induction_machine.helper import is_numeric, pre_file, get_values_from, getdp_read_resolution, set_resolution, get_preresolution\n'), ((2621, 2706), ... |
"""
Reduced 3-body Problem testing script
====================================
Testing the reduced 3-body problem solvers with different numerical algorithms.
"""
import os
import time
from math import pi,cos,sin
import numpy as np
import matplotlib.pyplot as plt
from const import *
import reduced3body as r3b
try:
... | [
"matplotlib.pyplot.ylabel",
"math.cos",
"reduced3body.hohmann",
"reduced3body.low_energy_parts8",
"numpy.sin",
"reduced3body.trajectory",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"reduced3body.refine",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.yscale"... | [((414, 425), 'time.time', 'time.time', ([], {}), '()\n', (423, 425), False, 'import time\n'), ((8816, 8828), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (8826, 8828), True, 'import matplotlib.pyplot as plt\n'), ((8829, 8865), 'matplotlib.pyplot.plot', 'plt.plot', (['(tlist * unit_time)', 'errlist'], {}... |
import logging
import os
import warnings
from collections import defaultdict
from typing import Union, Tuple
from multiprocessing import Pool
import h5py
import numpy as np
import torch
from sklearn.metrics import f1_score, roc_auc_score, confusion_matrix, average_precision_score, auc
from deepethogram import utils
f... | [
"logging.getLogger",
"sklearn.metrics.auc",
"numpy.logical_not",
"sklearn.metrics.roc_auc_score",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.mean",
"numpy.asarray",
"deepethogram.postprocessing.remove_low_thresholds",
"numpy.stack",
"numpy.linspace",
"os.path.isdir",
"numpy.con... | [((388, 415), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'import logging\n'), ((1384, 1438), 'numpy.zeros', 'np.zeros', (['(index.shape[0], n_classes)'], {'dtype': 'np.uint16'}), '((index.shape[0], n_classes), dtype=np.uint16)\n', (1392, 1438), True, 'import numpy a... |
# -*- coding: utf-8 -*-
# author: <NAME>
"""pyplt.
绘图函数接口
# ## matplotlib
# matplotlib 提供了较为完整的matlab式绘图API,这种绘图代码简洁;
#
# 一般语法为plt.func
#
# 对于复杂绘图的支持,matplotlib 可以用面向对象的API接口实现
#
# 通过图层一步步搭建图形 figure->axes->axis,对于子图的设置为axes.set_prop
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import ticker... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.ticker.ScalarFormatter",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.ylim",
"numpy.meshgrid",
"... | [((369, 457), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 18, 'font.family': 'Serif', 'text.usetex': False}"], {}), "({'font.size': 18, 'font.family': 'Serif', 'text.usetex':\n False})\n", (388, 457), True, 'import matplotlib.pyplot as plt\n'), ((590, 630), 'matplotlib.ticker.ScalarF... |
#!/usr/bin/env python3
# encoding: utf-8
import time
import numpy as np
from keras.models import Sequential
from keras.layers.recurrent import LSTM
from keras.callbacks import EarlyStopping
from keras.layers.core import Dense, Activation, Dropout
from utils import read_dataset, split_dataset
from nn_common import plot... | [
"utils.split_dataset",
"hyperopt.fmin",
"nn_common.store_model",
"numpy.reshape",
"keras.layers.core.Activation",
"nn_common.plot_result",
"hyperopt.hp.randint",
"keras.models.Sequential",
"keras.layers.core.Dense",
"utils.read_dataset",
"keras.callbacks.EarlyStopping",
"keras.layers.core.Drop... | [((453, 465), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (463, 465), False, 'from keras.models import Sequential\n'), ((937, 948), 'time.time', 'time.time', ([], {}), '()\n', (946, 948), False, 'import time\n'), ((1006, 1068), 'utils.read_dataset', 'read_dataset', (['"""../datasets/internet-traffic-data... |
# import the necessary packages
import cv2
import joblib
import numpy as np
import tkinter as tk
import time
from core import extract_signature
from PIL import Image, ImageTk
from tkinter import filedialog
def resize(image, size):
w, h = image.size
if w == 0 or h == 0:
return Image.fromarray(np.ones(... | [
"cv2.rectangle",
"core.extract_signature",
"tkinter.Button",
"numpy.array",
"tkinter.Label",
"tkinter.Frame",
"tkinter.Grid.rowconfigure",
"numpy.where",
"joblib.load",
"PIL.ImageTk.PhotoImage",
"tkinter.filedialog.askopenfilename",
"numpy.ones",
"numpy.fliplr",
"cv2.cvtColor",
"time.tim... | [((604, 619), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (612, 619), True, 'import numpy as np\n'), ((834, 857), 'PIL.Image.fromarray', 'Image.fromarray', (['canvas'], {}), '(canvas)\n', (849, 857), False, 'from PIL import Image, ImageTk\n'), ((1872, 1900), 'tkinter.filedialog.askopenfilename', 'filedialo... |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import links
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'in_size': 10, 'out_size': 10},
{'in_size': 10, 'out_size': 40}... | [
"chainer.testing.parameterize",
"chainer.Variable",
"chainer.gradient_check.assert_allclose",
"chainer.links.LSTM",
"numpy.random.uniform",
"chainer.cuda.to_gpu"
] | [((226, 316), 'chainer.testing.parameterize', 'testing.parameterize', (["{'in_size': 10, 'out_size': 10}", "{'in_size': 10, 'out_size': 40}"], {}), "({'in_size': 10, 'out_size': 10}, {'in_size': 10,\n 'out_size': 40})\n", (246, 316), False, 'from chainer import testing\n'), ((401, 440), 'chainer.links.LSTM', 'links.... |
import cv2
import numpy as np
from generic_dataset.dataset_folder_manager import DatasetFolderManager
from generic_dataset.utilities.color import Color
from generic_dataset.dataset_manager import DatasetManager
from gibson_env_utilities.doors_dataset.door_sample import DoorSample
dataset_path ='/home/michele/myfiles... | [
"generic_dataset.dataset_folder_manager.DatasetFolderManager",
"generic_dataset.utilities.color.Color",
"generic_dataset.dataset_manager.DatasetManager",
"numpy.concatenate",
"cv2.waitKey"
] | [((413, 511), 'generic_dataset.dataset_folder_manager.DatasetFolderManager', 'DatasetFolderManager', ([], {'dataset_path': 'dataset_path', 'folder_name': '"""house1"""', 'sample_class': 'DoorSample'}), "(dataset_path=dataset_path, folder_name='house1',\n sample_class=DoorSample)\n", (433, 511), False, 'from generic_... |
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
# Read in the image
image = mpimg.imread('./images/waymo_car.jpg')
# Print out the image dimensions
print('Image dimensions:', image.shape)
# Change from color to grayscale
gray_image = cv2.cvtColor(image, cv2.COLOR_RGB2GRA... | [
"matplotlib.pyplot.imshow",
"numpy.amin",
"matplotlib.image.imread",
"numpy.array",
"cv2.cvtColor",
"matplotlib.pyplot.matshow",
"numpy.amax",
"matplotlib.pyplot.show"
] | [((124, 162), 'matplotlib.image.imread', 'mpimg.imread', (['"""./images/waymo_car.jpg"""'], {}), "('./images/waymo_car.jpg')\n", (136, 162), True, 'import matplotlib.image as mpimg\n'), ((283, 322), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_RGB2GRAY'], {}), '(image, cv2.COLOR_RGB2GRAY)\n', (295, 322), False... |
# pylint: disable=C,R,E1101
import torch
import numpy as np
class NormActivation(torch.nn.Module):
def __init__(self, dimensionalities, tensor_act=None, scalar_act=None, eps=1e-6, bias_min=.5, bias_max=2):
'''
:param dimensionalities: list of dimensionalities of the capsules
:param scalar_... | [
"torch.nn.Softplus",
"torch.Tensor",
"torch.cat",
"numpy.array",
"torch.norm",
"torch.sum",
"torch.FloatTensor",
"torch.rand"
] | [((2936, 2973), 'torch.cat', 'torch.cat', (['capsule_activations'], {'dim': '(1)'}), '(capsule_activations, dim=1)\n', (2945, 2973), False, 'import torch\n'), ((5750, 5787), 'torch.cat', 'torch.cat', (['capsule_activations'], {'dim': '(1)'}), '(capsule_activations, dim=1)\n', (5759, 5787), False, 'import torch\n'), ((6... |
# remove warning message
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# required library
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from local_utils import detect_lp
from os.path import splitext,basename
from keras.models import model_from_json... | [
"cv2.rectangle",
"sklearn.preprocessing.LabelEncoder",
"cv2.convertScaleAbs",
"cv2.imshow",
"argparse.ArgumentParser",
"cv2.threshold",
"numpy.stack",
"cv2.waitKey",
"os.path.splitext",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.resize",
"cv2.GaussianBlur",
"cv2.imread",
"keras.models.mode... | [((4434, 4459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4457, 4459), False, 'import argparse\n'), ((5640, 5676), 'cv2.imshow', 'cv2.imshow', (['"""Vehicle Image"""', 'vehicle'], {}), "('Vehicle Image', vehicle)\n", (5650, 5676), False, 'import cv2\n'), ((5678, 5717), 'cv2.imshow', 'cv2.... |
#!/usr/bin/python
# Copyright 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice... | [
"tritonclient.http.InferInput",
"tritonclient.http.InferenceServerClient",
"builtins.range",
"tritonclient.http.InferRequestedOutput",
"numpy.expand_dims",
"unittest.main",
"numpy.full",
"sys.path.append",
"numpy.arange"
] | [((1572, 1600), 'sys.path.append', 'sys.path.append', (['"""../common"""'], {}), "('../common')\n", (1587, 1600), False, 'import sys\n'), ((5132, 5147), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5145, 5147), False, 'import unittest\n'), ((2018, 2083), 'tritonclient.http.InferenceServerClient', 'httpclient.In... |
# coding: utf8
"""
Ensemble de fonctions pour manipuler une instance du problème "Le jardinier et
les taupes", dans le cas où l'objectif est :
- qu'aucune taupe ne puisse pénétrer dans le jardin ;
- que le nombre de pièges soit minimal.
"""
import os
import itertools
import numpy as np
import pulp
def _dimcheck(g... | [
"pulp.LpProblem",
"numpy.product",
"pulp.LpVariable.dicts",
"pulp.lpSum",
"numpy.where",
"os.path.join",
"numpy.any",
"numpy.zeros",
"numpy.arange",
"os.remove"
] | [((1222, 1248), 'numpy.any', 'np.any', (['(check >= threshold)'], {}), '(check >= threshold)\n', (1228, 1248), True, 'import numpy as np\n'), ((2005, 2025), 'numpy.where', 'np.where', (['grid', '(0)', '(1)'], {}), '(grid, 0, 1)\n', (2013, 2025), True, 'import numpy as np\n'), ((3289, 3306), 'numpy.product', 'np.product... |
#!/usr/bin/env python
# coding=utf-8
"""
Evaluation (t-tree comparison functions).
"""
from __future__ import unicode_literals
from __future__ import division
from builtins import zip
from builtins import range
from builtins import object
from past.utils import old_div
from collections import defaultdict
from enum im... | [
"tgen.logf.log_debug",
"numpy.mean",
"numpy.median",
"tgen.logf.log_warn",
"tgen.tree.TreeData.from_ttree",
"tgen.logf.log_info",
"past.utils.old_div",
"builtins.zip",
"collections.defaultdict",
"enum.Enum",
"numpy.percentile",
"tgen.tree.TreeNode"
] | [((640, 675), 'enum.Enum', 'Enum', (['"""EvalTypes"""', '"""TOKEN NODE DEP"""'], {}), "('EvalTypes', 'TOKEN NODE DEP')\n", (644, 675), False, 'from enum import Enum\n'), ((1305, 1321), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1316, 1321), False, 'from collections import defaultdict\n'), ((54... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Train normalising flow.
Created: June 2021
Author: <NAME>
"""
import numpy as np
import sys
sys.path.append("../../src")
from constants import kpc
from ml import train_flow
from utils import get_rescaled_tensor
if __name__ == '__main__':
# load data
data =... | [
"numpy.array",
"ml.train_flow",
"sys.path.append"
] | [((145, 173), 'sys.path.append', 'sys.path.append', (['"""../../src"""'], {}), "('../../src')\n", (160, 173), False, 'import sys\n'), ((677, 724), 'ml.train_flow', 'train_flow', (['data', 'seed'], {'n_layers': '(8)', 'n_hidden': '(64)'}), '(data, seed, n_layers=8, n_hidden=64)\n', (687, 724), False, 'from ml import tra... |
'''
Created on Oct 23, 2017
@author: ronaldmaceachern
modules for methods to clean dirty .csv using a set of rules
'''
import re
import os
import numpy as np
import pandas as pd
from difflib import SequenceMatcher
def makeRowDf( x, desc_name = '', cols = None):
'''a wrapper function to make it neater to mak... | [
"numpy.mean",
"pandas.isnull",
"os.listdir",
"difflib.SequenceMatcher",
"re.match",
"numpy.array",
"numpy.isnan",
"numpy.concatenate",
"re.sub",
"pandas.concat",
"numpy.arange",
"re.search"
] | [((596, 608), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (605, 608), True, 'import numpy as np\n'), ((945, 972), 'numpy.concatenate', 'np.concatenate', (['out'], {'axis': '(0)'}), '(out, axis=0)\n', (959, 972), True, 'import numpy as np\n'), ((1013, 1033), 'numpy.mean', 'np.mean', (['out'], {'axis': '(0)'}), '(... |
# 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... | [
"random.shuffle",
"absl.app.run",
"random.seed",
"numpy.array",
"absl.flags.DEFINE_string"
] | [((904, 1098), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input_dir"""', 'None', '"""Local input directory containing the mit-bih file that can be copied from /namespace/health-research/unencrypted/reference/user/milah/mit_bih/."""'], {}), "('input_dir', None,\n 'Local input directory containing the mi... |
#! /usr/bin/env python
"""
Module with pixel and frame subsampling functions.
"""
__author__ = '<NAME>, <NAME>'
__all__ = ['cube_collapse',
'cube_subsample',
'cube_subsample_trimmean']
import numpy as np
def cube_collapse(cube, mode='median', n=50, w=None):
""" Collapses a cube into a fra... | [
"numpy.nanmedian",
"numpy.sort",
"numpy.ndenumerate",
"numpy.nanmean",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"numpy.nanmax",
"numpy.empty_like",
"numpy.isnan",
"numpy.moveaxis",
"numpy.nansum"
] | [((5651, 5676), 'numpy.empty', 'np.empty', (['[num + 2, y, x]'], {}), '([num + 2, y, x])\n', (5659, 5676), True, 'import numpy as np\n'), ((1652, 1675), 'numpy.nanmean', 'np.nanmean', (['arr'], {'axis': '(0)'}), '(arr, axis=0)\n', (1662, 1675), True, 'import numpy as np\n'), ((3560, 3579), 'numpy.empty', 'np.empty', ([... |
import operator
import numpy as np
import bitpacking.packing as pk
from boolnet.utils import PackedMatrix
FUNCTIONS = {
'add': operator.add,
'sub': operator.sub,
'mul': operator.mul,
'div': operator.floordiv,
'mod': operator.mod,
}
def to_binary(value, num_bits):
# little-endian
ret... | [
"numpy.savez",
"numpy.binary_repr",
"numpy.split",
"bitpacking.packing.packmat",
"numpy.load",
"boolnet.utils.PackedMatrix"
] | [((826, 851), 'numpy.split', 'np.split', (['M', '[Ni]'], {'axis': '(1)'}), '(M, [Ni], axis=1)\n', (834, 851), True, 'import numpy as np\n'), ((1374, 1419), 'numpy.savez', 'np.savez', (['outfile'], {'matrix': 'Mp', 'Ni': 'Ni', 'Ne': 'Mp.Ne'}), '(outfile, matrix=Mp, Ni=Ni, Ne=Mp.Ne)\n', (1382, 1419), True, 'import numpy ... |
import torch
import load_data
import random
import numpy as np
from HSCNN_model import HSCNN_network
from HSCNN_train import train
from HSCNN_classifier import predict,get_compare
random.seed(1234)
np.random.seed(1234)
torch.cuda.manual_seed(1234)
torch.backends.cudnn.deterministic = True
print('load data.............. | [
"HSCNN_model.HSCNN_network",
"HSCNN_classifier.get_compare",
"torch.load",
"random.seed",
"HSCNN_classifier.predict",
"load_data.load_pairs",
"torch.cuda.is_available",
"numpy.random.seed",
"HSCNN_train.train",
"torch.cuda.manual_seed"
] | [((181, 198), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (192, 198), False, 'import random\n'), ((199, 219), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (213, 219), True, 'import numpy as np\n'), ((220, 248), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['(1234)'], {}),... |
import numpy as np
import scipy.sparse as sparse
from scipy.sparse import linalg
import pandas as pd
# global variables
#This will change the initial condition used. Currently it starts from the first# value
shift_k = 0
approx_res_size = 5000
model_params = {'tau': 0.25,
'nstep': 1000,
... | [
"numpy.abs",
"scipy.sparse.rand",
"numpy.random.rand",
"numpy.floor",
"numpy.asarray",
"numpy.linalg.eigvals",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.dot",
"numpy.random.seed",
"numpy.shape",
"scipy.sparse.identity",
"numpy.mod"
] | [((898, 918), 'numpy.linalg.eigvals', 'np.linalg.eigvals', (['A'], {}), '(A)\n', (915, 918), True, 'import numpy as np\n'), ((1046, 1101), 'numpy.zeros', 'np.zeros', (["(res_params['N'], res_params['train_length'])"], {}), "((res_params['N'], res_params['train_length']))\n", (1054, 1101), True, 'import numpy as np\n'),... |
import gym
import unittest
import numpy as np
from connect_four.envs.connect_four_env import ConnectFourEnv
from connect_four.evaluation.incremental_victor.graph.graph_manager import GraphManager
from connect_four.evaluation.incremental_victor.solution.victor_solution_manager import VictorSolutionManager
from connect... | [
"connect_four.evaluation.incremental_victor.graph.graph_manager.GraphManager",
"connect_four.evaluation.incremental_victor.solution.victor_solution_manager.VictorSolutionManager",
"numpy.array",
"connect_four.problem.ConnectFourGroupManager",
"unittest.main",
"unittest.skip",
"gym.make"
] | [((368, 395), 'unittest.skip', 'unittest.skip', (['"""deprecated"""'], {}), "('deprecated')\n", (381, 395), False, 'import unittest\n'), ((1393, 1408), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1406, 1408), False, 'import unittest\n'), ((490, 517), 'gym.make', 'gym.make', (['"""connect_four-v0"""'], {}), "('... |
from cv2 import cv2
import tello
import time
import numpy as np
drone = tello.Tello('', 8889)
time.sleep(10)
chase_count = 0
chase_image_list = []
chase_corner_list = []
objp = np.zeros((9*6, 3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, ... | [
"tello.Tello",
"cv2.cv2.findChessboardCorners",
"cv2.cv2.waitKey",
"time.sleep",
"cv2.cv2.calibrateCamera",
"numpy.zeros",
"cv2.cv2.FileStorage",
"cv2.cv2.cvtColor",
"cv2.cv2.cornerSubPix",
"cv2.cv2.imshow"
] | [((73, 94), 'tello.Tello', 'tello.Tello', (['""""""', '(8889)'], {}), "('', 8889)\n", (84, 94), False, 'import tello\n'), ((95, 109), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (105, 109), False, 'import time\n'), ((178, 210), 'numpy.zeros', 'np.zeros', (['(9 * 6, 3)', 'np.float32'], {}), '((9 * 6, 3), np.fl... |
import os, sys
import argparse
import numpy as np
import cv2
from skimage import filters
from linefiller.thinning import thinning
from linefiller.trappedball_fill import trapped_ball_fill_multi, flood_fill_multi, mark_fill, build_fill_map, merge_fill, \
show_fill_map, my_merge_fill
def dline_of(x, low_thr=1, h... | [
"numpy.clip",
"linefiller.trappedball_fill.trapped_ball_fill_multi",
"numpy.argsort",
"numpy.save",
"linefiller.trappedball_fill.flood_fill_multi",
"os.path.exists",
"cv2.Laplacian",
"os.listdir",
"linefiller.thinning.thinning",
"argparse.ArgumentParser",
"linefiller.trappedball_fill.mark_fill",... | [((362, 382), 'cv2.medianBlur', 'cv2.medianBlur', (['x', '(5)'], {}), '(x, 5)\n', (376, 382), False, 'import cv2\n'), ((450, 508), 'cv2.bilateralFilter', 'cv2.bilateralFilter', (['x', 'bf_args[0]', 'bf_args[1]', 'bf_args[2]'], {}), '(x, bf_args[0], bf_args[1], bf_args[2])\n', (469, 508), False, 'import cv2\n'), ((566, ... |
""" Defines the Plot class.
"""
# Major library imports
import itertools
import warnings
import six
import six.moves as sm
from numpy import arange, array, ndarray, linspace
from types import FunctionType
# Enthought library imports
from traits.api import Delegate, Dict, Instance, Int, List, Property, Str
# Local, r... | [
"itertools.chain",
"traits.api.Instance",
"traits.api.Property",
"traits.api.Delegate",
"six.itervalues",
"traits.api.Dict",
"numpy.array",
"numpy.linspace",
"chaco.ui.plot_window.PlotWindow",
"traits.api.Int",
"warnings.warn",
"six.moves.map",
"numpy.arange",
"traits.api.List"
] | [((3361, 3387), 'traits.api.Instance', 'Instance', (['AbstractPlotData'], {}), '(AbstractPlotData)\n', (3369, 3387), False, 'from traits.api import Delegate, Dict, Instance, Int, List, Property, Str\n'), ((3783, 3798), 'traits.api.Dict', 'Dict', (['Str', 'List'], {}), '(Str, List)\n', (3787, 3798), False, 'from traits.... |
# Created by <NAME> (<EMAIL>)
import numpy as np
from collections import namedtuple
def zeros(system, size):
"""
Create an all zeros trajectory.
Parameters
----------
system : System
System for trajectory
size : int
Size of trajectory
"""
obs = np.zeros((size, system.... | [
"collections.namedtuple",
"numpy.zeros",
"numpy.array_equal",
"numpy.empty",
"numpy.concatenate"
] | [((1450, 1484), 'collections.namedtuple', 'namedtuple', (['"""TimeStep"""', '"""obs ctrl"""'], {}), "('TimeStep', 'obs ctrl')\n", (1460, 1484), False, 'from collections import namedtuple\n'), ((297, 329), 'numpy.zeros', 'np.zeros', (['(size, system.obs_dim)'], {}), '((size, system.obs_dim))\n', (305, 329), True, 'impor... |
import os
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras import backend as K
from keras.models import load_model
import numpy as np
"""
Here we test our fooling images with more... | [
"numpy.copy",
"keras.layers.Conv2D",
"keras.backend.image_data_format",
"keras.models.load_model",
"keras.datasets.mnist.load_data",
"keras.layers.MaxPooling2D",
"keras.layers.Flatten",
"os.path.join",
"keras.utils.to_categorical",
"os.getcwd",
"numpy.array",
"keras.models.Sequential",
"os.p... | [((545, 585), 'os.path.join', 'os.path.join', (['model_folder', 'model_1_path'], {}), '(model_folder, model_1_path)\n', (557, 585), False, 'import os\n'), ((636, 676), 'os.path.join', 'os.path.join', (['model_folder', 'model_2_path'], {}), '(model_folder, model_2_path)\n', (648, 676), False, 'import os\n'), ((713, 749)... |
#!/usr/bin/env python2
import logging
import argparse
import numpy as np
import pandas as pd
import cv2
def read_motion_vector(filename):
""" read the motion vector file under csv format
:param filename: input path to input csv file
:return: data under DataFrame format (see pandas lib)
"""
logging... | [
"logging.getLogger",
"argparse.ArgumentParser",
"pandas.read_csv",
"cv2.findHomography",
"numpy.logical_not",
"numpy.float32"
] | [((381, 402), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (392, 402), True, 'import pandas as pd\n'), ((2100, 2174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""create a video of the vector field."""'}), "(description='create a video of the vector field.')\n"... |
import numpy as np
import pandas.compat as compat
import pandas as pd
class TablePlotter(object):
"""
Layout some DataFrames in vertical/horizontal layout for explanation.
Used in merging.rst
"""
def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
self.cell_width = cel... | [
"pandas.compat.iteritems",
"numpy.max",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"pandas.plotting.table",
"pandas.DataFrame",
"pandas.MultiIndex.from_tuples",
"pandas.concat",
"matplotlib.pyplot.show"
] | [((6185, 6256), 'pandas.DataFrame', 'pd.DataFrame', (["{'A': [10, 11, 12], 'B': [20, 21, 22], 'C': [30, 31, 32]}"], {}), "({'A': [10, 11, 12], 'B': [20, 21, 22], 'C': [30, 31, 32]})\n", (6197, 6256), True, 'import pandas as pd\n'), ((6315, 6359), 'pandas.DataFrame', 'pd.DataFrame', (["{'A': [10, 12], 'C': [30, 32]}"], ... |
import numpy as np
def score(input):
if (input[2]) <= (2.6):
var0 = np.asarray([1.0, 0.0, 0.0])
else:
if (input[2]) <= (4.8500004):
if (input[3]) <= (1.6500001):
var0 = np.asarray([0.0, 1.0, 0.0])
else:
var0 = np.asarray([0.0, 0.33333333333... | [
"numpy.asarray"
] | [((80, 107), 'numpy.asarray', 'np.asarray', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (90, 107), True, 'import numpy as np\n'), ((221, 248), 'numpy.asarray', 'np.asarray', (['[0.0, 1.0, 0.0]'], {}), '([0.0, 1.0, 0.0])\n', (231, 248), True, 'import numpy as np\n'), ((290, 347), 'numpy.asarray', 'np.asarray', (['... |
import numpy as np
import matplotlib as mpl
if os.environ.get('DISPLAY','') == '':
print('no display found. Using non-interactive Agg backend')
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import paths
import counterfactuals.infrastructurefunctions as infr
import counter... | [
"matplotlib.pyplot.savefig",
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.tight_layout",
"numpy.load",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((386, 414), 'numpy.array', 'np.array', (['[-4.0, -2.5, -1.8]'], {}), '([-4.0, -2.5, -1.8])\n', (394, 414), True, 'import numpy as np\n'), ((423, 463), 'numpy.array', 'np.array', (['[0.0, 0.2, 0.4, 0.6, 0.8, 0.9]'], {}), '([0.0, 0.2, 0.4, 0.6, 0.8, 0.9])\n', (431, 463), True, 'import numpy as np\n'), ((2776, 2868), 'm... |
import random
import numpy as np
import torch
from openprompt.utils.logging import logger
from typing import *
def set_seed(seed:Optional[int] = None):
"""set seed for reproducibility
Args:
seed (:obj:`int`): the seed to seed everything for reproducibility. if None, do nothing.
"""
if seed:
... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"random.seed",
"openprompt.utils.logging.logger.info",
"numpy.random.seed"
] | [((328, 345), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (339, 345), False, 'import random\n'), ((354, 374), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (368, 374), True, 'import numpy as np\n'), ((383, 406), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (40... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.