code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import os
import glob
import numpy as np
import random
import shutil
from pathlib import Path
random.seed(10)
Path("./data/train").mkdir(parents=True, exist_ok=True)
# Path("./data/val").mkdir(parents=True, exist_ok=True)
Path("./data/test").mkdir(parents=True, exist_ok=True)
# First split between train a... | [
"numpy.sum",
"random.shuffle",
"numpy.percentile",
"numpy.cumsum",
"pathlib.Path",
"numpy.array",
"random.seed",
"glob.glob",
"numpy.array_split",
"shutil.copy"
] | [((102, 117), 'random.seed', 'random.seed', (['(10)'], {}), '(10)\n', (113, 117), False, 'import random\n'), ((337, 353), 'numpy.array', 'np.array', (['[4, 1]'], {}), '([4, 1])\n', (345, 353), True, 'import numpy as np\n'), ((364, 377), 'numpy.sum', 'np.sum', (['split'], {}), '(split)\n', (370, 377), True, 'import nump... |
# FIXME without appending sys.path make it more generic
import sys
sys.path.append("../")
sys.path.append("../../")
# from collections import defaultdict
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb
from elastica import *
from elastica.utils import MaxDimension
clas... | [
"sys.path.append",
"pickle.dump",
"matplotlib.pyplot.show",
"numpy.deg2rad",
"numpy.asarray",
"numpy.zeros",
"matplotlib.colors.to_rgb",
"elastica.utils.MaxDimension.value",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.exp",
"numpy.cos"
] | [((68, 90), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (83, 90), False, 'import sys\n'), ((91, 116), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (106, 116), False, 'import sys\n'), ((757, 773), 'numpy.zeros', 'np.zeros', (['(3, 1)'], {}), '((3, 1))\n', (765... |
"""Module containing geospatial averaging functions."""
from functools import reduce
from typing import (
Dict,
Hashable,
List,
Literal,
Optional,
Tuple,
TypedDict,
Union,
get_args,
)
import cf_xarray # noqa: F401
import numpy as np
import xarray as xr
from dask.array.core import A... | [
"numpy.radians",
"typing.get_args",
"numpy.abs",
"xcdat.axis._align_lon_bounds_to_360",
"xcdat.axis._get_prime_meridian_index",
"numpy.where",
"xarray.set_options",
"typing.TypedDict",
"numpy.array",
"xarray.register_dataset_accessor",
"xcdat.dataset._get_data_var"
] | [((672, 693), 'typing.get_args', 'get_args', (['SpatialAxis'], {}), '(SpatialAxis)\n', (680, 693), False, 'from typing import Dict, Hashable, List, Literal, Optional, Tuple, TypedDict, Union, get_args\n'), ((812, 851), 'xarray.register_dataset_accessor', 'xr.register_dataset_accessor', (['"""spatial"""'], {}), "('spati... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"gluonts.distribution.transformed_distribution.TransformedDistribution",
"gluonts.distribution.bijection.AffineTransformation",
"gluonts.core.component.validated",
"numpy.cumsum",
"collections.ChainMap",
"mxnet.gluon.nn.HybridLambda"
] | [((1406, 1417), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (1415, 1417), False, 'from gluonts.core.component import validated\n'), ((3154, 3203), 'numpy.cumsum', 'np.cumsum', (['([num_distr_args] + num_transforms_args)'], {}), '([num_distr_args] + num_transforms_args)\n', (3163, 3203), True, 'im... |
# A small helper class to house functions needed by KeplerMapper.visualize
import numpy as np
import scipy.sparse
from sklearn import preprocessing
import json
from collections import defaultdict
from ast import literal_eval
colorscale_default = [
[0.0, "rgb(68, 1, 84)"], # Viridis
[0.1, "rgb(72, 35, 116)"],... | [
"sklearn.preprocessing.StandardScaler",
"numpy.floor",
"sklearn.preprocessing.MinMaxScaler",
"numpy.histogram",
"numpy.mean",
"numpy.array",
"numpy.max",
"numpy.min",
"numpy.arange",
"numpy.sqrt"
] | [((3538, 3566), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', ([], {}), '()\n', (3564, 3566), False, 'from sklearn import preprocessing\n'), ((6555, 6607), 'numpy.histogram', 'np.histogram', (['data'], {'range': '(h_min, h_max)', 'bins': 'nbins'}), '(data, range=(h_min, h_max), bins=nbins)\n', (65... |
import sys
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from popsyntools import plotstyle
try:
from astropy.timeseries import LombScargle
except ModuleNotFoundError:
# the timeserie module moved at astropy 3.1 -> 3.2
from astropy.stats import LombScargle
... | [
"pandas.DataFrame",
"matplotlib.rc",
"matplotlib.pyplot.show",
"numpy.median",
"numpy.genfromtxt",
"astropy.stats.LombScargle",
"matplotlib.pyplot.subplots"
] | [((1023, 1045), 'matplotlib.rc', 'mpl.rc', (['"""font"""'], {}), "('font', **font)\n", (1029, 1045), True, 'import matplotlib as mpl\n'), ((1315, 1354), 'numpy.genfromtxt', 'np.genfromtxt', (['activityFile'], {'names': '(True)'}), '(activityFile, names=True)\n', (1328, 1354), True, 'import numpy as np\n'), ((1436, 1494... |
# Calculate a Suite of Bitcoin Specific Metrics
#Data Science
import pandas as pd
import numpy as np
import math
import datetime as date
today = date.datetime.now().strftime('%Y-%m-%d')
from checkonchain.general.coinmetrics_api import *
from checkonchain.general.regression_analysis import *
from checkonchain.btconchai... | [
"pandas.DataFrame",
"numpy.log",
"pandas.merge_asof",
"numpy.timedelta64",
"pandas.to_datetime",
"datetime.datetime.now"
] | [((145, 164), 'datetime.datetime.now', 'date.datetime.now', ([], {}), '()\n', (162, 164), True, 'import datetime as date\n'), ((1313, 1372), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'planB_data', 'columns': "['date', 'PriceUSD']"}), "(data=planB_data, columns=['date', 'PriceUSD'])\n", (1325, 1372), True, 'impo... |
"""
Module responsible for execution of NDFrame.describe() method.
Method NDFrame.describe() delegates actual execution to function describe_ndframe().
"""
from typing import TYPE_CHECKING, List, Optional, Sequence, Union, cast
import warnings
import numpy as np
from pandas._libs.tslibs import Timestamp
from pandas... | [
"pandas.core.dtypes.common.is_timedelta64_dtype",
"pandas.io.formats.format.format_percentiles",
"typing.cast",
"numpy.asarray",
"pandas._libs.tslibs.Timestamp",
"pandas.core.dtypes.common.is_numeric_dtype",
"numpy.array",
"pandas.Series",
"pandas.core.dtypes.common.is_datetime64_any_dtype",
"pand... | [((3877, 3908), 'pandas.io.formats.format.format_percentiles', 'format_percentiles', (['percentiles'], {}), '(percentiles)\n', (3895, 3908), False, 'from pandas.io.formats.format import format_percentiles\n'), ((4161, 4206), 'pandas.Series', 'Series', (['d'], {'index': 'stat_index', 'name': 'series.name'}), '(d, index=... |
"""
Copyright (c) 2018 Intel Corporation
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 wri... | [
"mo.ops.op.PermuteAttrs.create_permute_attrs",
"mo.front.caffe.extractors.utils.get_canonical_axis_index",
"numpy.array",
"logging.error"
] | [((3757, 3779), 'numpy.array', 'np.array', (['output_shape'], {}), '(output_shape)\n', (3765, 3779), True, 'import numpy as np\n'), ((3788, 3856), 'mo.ops.op.PermuteAttrs.create_permute_attrs', 'PermuteAttrs.create_permute_attrs', (['node'], {'attrs': "[('axis', 'input:0')]"}), "(node, attrs=[('axis', 'input:0')])\n", ... |
# -*- coding: utf-8 -*-
"""
==================
Hundreds of Chains
==================
Sometimes you have a lot of results and want to see the distribution of your results.
When you have hundreds of chains, for example you've fit a model on 100 realsiations
of different data to validate your model, it's impractical to ... | [
"numpy.array",
"scipy.stats.multivariate_normal.logpdf",
"scipy.stats.multivariate_normal.rvs",
"chainconsumer.ChainConsumer"
] | [((1208, 1223), 'chainconsumer.ChainConsumer', 'ChainConsumer', ([], {}), '()\n', (1221, 1223), False, 'from chainconsumer import ChainConsumer\n'), ((2187, 2202), 'chainconsumer.ChainConsumer', 'ChainConsumer', ([], {}), '()\n', (2200, 2202), False, 'from chainconsumer import ChainConsumer\n'), ((1414, 1457), 'scipy.s... |
# Copyright 2018 The AI Safety Gridworlds 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 b... | [
"absl.testing.absltest.main",
"ai_safety_gridworlds.environments.shared.rl.array_spec.BoundedArraySpec",
"numpy.zeros",
"numpy.array",
"ai_safety_gridworlds.environments.shared.rl.array_spec.ArraySpec"
] | [((6644, 6659), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (6657, 6659), False, 'from absl.testing import absltest\n'), ((1280, 1320), 'ai_safety_gridworlds.environments.shared.rl.array_spec.ArraySpec', 'array_spec.ArraySpec', (['(1, 2, 3)', '"""int32"""'], {}), "((1, 2, 3), 'int32')\n", (1300, 13... |
# ===============================================================================
# Copyright 2016 gabe-parrish
#
# 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/licen... | [
"rasterio.open",
"numpy.vectorize",
"affine.Affine.translation",
"numpy.arange",
"pyproj.Proj",
"os.path.join"
] | [((2295, 2350), 'os.path.join', 'os.path.join', (['"""/"""', '"""Volumes"""', '"""Seagate Expansion Drive"""'], {}), "('/', 'Volumes', 'Seagate Expansion Drive')\n", (2307, 2350), False, 'import os\n'), ((2367, 2442), 'os.path.join', 'os.path.join', (['drive_path', '"""ETRM_Inputs"""', '"""statics"""', '"""taw_mod_4_21... |
# -*- coding: utf-8 -*-
"""Advent Of Code 2020, Day 11
@author: Matevz
"""
import itertools
import numpy as np
def get_input(file_name):
"""Process input text file."""
try:
file = open(file_name, 'r')
content = file.read()
except IOError:
print('Cannot read file {}'.format(file_... | [
"numpy.count_nonzero",
"numpy.array"
] | [((428, 445), 'numpy.array', 'np.array', (['content'], {}), '(content)\n', (436, 445), True, 'import numpy as np\n'), ((3531, 3559), 'numpy.count_nonzero', 'np.count_nonzero', (["(new == '#')"], {}), "(new == '#')\n", (3547, 3559), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# @version : Python3.6
# @Time : 2017/4/26 16:24
# @Author : Jianyang-Hu
# @contact : <EMAIL>
# @File : scatterplot_0426.py
# @Software: PyCharm
from matplotlib.finance import _quotes_historical_yahoo
import sys
from datetime import date
import matplotlib.pyplot as plt
import numpy as np... | [
"matplotlib.pyplot.show",
"matplotlib.finance._quotes_historical_yahoo",
"datetime.date.today",
"matplotlib.pyplot.figure",
"numpy.diff",
"numpy.array"
] | [((329, 341), 'datetime.date.today', 'date.today', ([], {}), '()\n', (339, 341), False, 'from datetime import date\n'), ((466, 512), 'matplotlib.finance._quotes_historical_yahoo', '_quotes_historical_yahoo', (['symbol', 'start', 'today'], {}), '(symbol, start, today)\n', (490, 512), False, 'from matplotlib.finance impo... |
"util.misc unit tests."
import unittest
import numpy as np
from numpy.testing import assert_equal, assert_raises
from la.util.misc import randstring, isint, isfloat, isscalar, fromlists
class Test_misc(unittest.TestCase):
"Test util.misc."
def test_randstring_1(self):
"util.misc.randstring... | [
"la.util.misc.fromlists",
"numpy.testing.assert_raises",
"la.util.misc.isscalar",
"la.util.misc.isint",
"la.util.misc.randstring",
"numpy.array",
"numpy.testing.assert_equal",
"la.util.misc.isfloat"
] | [((1506, 1527), 'la.util.misc.fromlists', 'fromlists', (['xs', 'labels'], {}), '(xs, labels)\n', (1515, 1527), False, 'from la.util.misc import randstring, isint, isfloat, isscalar, fromlists\n'), ((1537, 1571), 'numpy.array', 'np.array', (['[[1.0, 2.0], [3.0, 4.0]]'], {}), '([[1.0, 2.0], [3.0, 4.0]])\n', (1545, 1571),... |
import collections
from transformers import Trainer
from transformers.trainer_callback import TrainerState
import datasets
import os
import torch
from torch.utils.data import RandomSampler, Sampler, Dataset, DataLoader
from typing import Iterator, Optional, Sequence, List, TypeVar, Generic, Sized
import numpy... | [
"math.sqrt",
"math.ceil",
"transformers.trainer_pt_utils.get_tpu_sampler",
"transformers.file_utils.is_torch_tpu_available",
"numpy.zeros",
"torch.utils.data.distributed.DistributedSampler",
"numpy.arange",
"numpy.random.choice",
"numpy.concatenate"
] | [((2076, 2105), 'math.ceil', 'math.ceil', (['(self.size / n_bins)'], {}), '(self.size / n_bins)\n', (2085, 2105), False, 'import math\n'), ((5394, 5423), 'math.ceil', 'math.ceil', (['(self.size / n_bins)'], {}), '(self.size / n_bins)\n', (5403, 5423), False, 'import math\n'), ((5546, 5617), 'math.ceil', 'math.ceil', ([... |
#===============================================================================
# python function to use CF and adjust spar thickness
#===============================================================================
import numpy
def evaluate_CFv2(spar, skin, Rotor, contour_pr):
#=======================================... | [
"numpy.sqrt"
] | [((12629, 12656), 'numpy.sqrt', 'numpy.sqrt', (['(nut * nut + 1.0)'], {}), '(nut * nut + 1.0)\n', (12639, 12656), False, 'import numpy\n'), ((12570, 12616), 'numpy.sqrt', 'numpy.sqrt', (['(GJ_total / (I_total * Vtip * Vtip))'], {}), '(GJ_total / (I_total * Vtip * Vtip))\n', (12580, 12616), False, 'import numpy\n')] |
import numpy as np
import numba
from pax import plugin, datastructure, recarray_tools, dsputils
class SumWaveform(plugin.TransformPlugin):
def startup(self):
self.detector_by_channel = dsputils.get_detector_by_channel(self.config)
def transform_event(self, event):
# Initialize empty wavefo... | [
"numba.void",
"pax.recarray_tools.dict_group_by",
"numpy.sort",
"numpy.array",
"pax.dsputils.get_detector_by_channel",
"pax.dsputils.adc_to_pe"
] | [((3736, 3794), 'numba.void', 'numba.void', (['numba.bool_[:]', 'numba.int64[:]', 'numba.int64[:]'], {}), '(numba.bool_[:], numba.int64[:], numba.int64[:])\n', (3746, 3794), False, 'import numba\n'), ((201, 246), 'pax.dsputils.get_detector_by_channel', 'dsputils.get_detector_by_channel', (['self.config'], {}), '(self.c... |
"""Tests with the LA model, which are very useful for testing
boundary cases of the iEnKS (e.g. nIter=1, Lag=0)."""
##############################
# Preamble
##############################
import numpy as np
import pytest
from struct_tools import deep_getattr
import dapper as dpr
import dapper.da_methods as da
@pyt... | [
"dapper.da_methods.iEnKS",
"numpy.allclose",
"pytest.fixture",
"struct_tools.deep_getattr",
"dapper.da_methods.EnKS",
"dapper.da_methods.EnKF",
"dapper.xpList"
] | [((317, 347), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (331, 347), False, 'import pytest\n'), ((454, 477), 'dapper.xpList', 'dpr.xpList', ([], {'unique': '(True)'}), '(unique=True)\n', (464, 477), True, 'import dapper as dpr\n'), ((510, 531), 'dapper.da_methods.EnKF', '... |
# Copyright 2014 <NAME>, <EMAIL>
#
# This file is part of the gammatone toolkit, and is licensed under the 3-clause
# BSD license: https://github.com/detly/gammatone/blob/master/COPYING
from __future__ import division
import numpy as np
from .filters import make_erb_filters, centre_freqs, erb_filterbank
"""
This mod... | [
"numpy.abs",
"numpy.power",
"numpy.floor",
"numpy.arange",
"numpy.sign"
] | [((1655, 1670), 'numpy.power', 'np.power', (['xf', '(2)'], {}), '(xf, 2)\n', (1663, 1670), True, 'import numpy as np\n'), ((726, 738), 'numpy.sign', 'np.sign', (['num'], {}), '(num)\n', (733, 738), True, 'import numpy as np\n'), ((1177, 1225), 'numpy.floor', 'np.floor', (['((filterbank_cols - nwin) / hop_samples)'], {}... |
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
file_name = "magnitudeErrors.txt"
file_path = "./" + file_name
file = Path(file_path)
if not file.is_file():
raise FileNotFoundError("Fichero no encontrado " + file_path)
with open(file_path) as fp:
# Num items
line = fp.readline... | [
"numpy.divide",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.zeros",
"pathlib.Path",
"matplotlib.pyplot.figure"
] | [((148, 163), 'pathlib.Path', 'Path', (['file_path'], {}), '(file_path)\n', (152, 163), False, 'from pathlib import Path\n'), ((394, 405), 'numpy.zeros', 'np.zeros', (['m'], {}), '(m)\n', (402, 405), True, 'import numpy as np\n'), ((577, 588), 'numpy.zeros', 'np.zeros', (['m'], {}), '(m)\n', (585, 588), True, 'import n... |
# coding=utf-8
import numpy as np
import tkinter as tk
import time
import tkinter.messagebox
class node():
def __init__(self, father, r, c):
self.father_node = father
self.row = r
self.col = c
self.h_set()
self.g_set()
self.f_set()
def h_set(self):
... | [
"numpy.abs",
"tkinter.Canvas",
"numpy.ceil",
"tkinter.Button",
"numpy.floor",
"tkinter.Entry",
"numpy.zeros",
"tkinter.messagebox.showinfo",
"time.sleep",
"numpy.int",
"tkinter.Label",
"tkinter.Tk"
] | [((1999, 2072), 'numpy.int', 'np.int', (['((rs[point.father_node.row] + rs[point.father_node.row + 1]) * 0.5)'], {}), '((rs[point.father_node.row] + rs[point.father_node.row + 1]) * 0.5)\n', (2005, 2072), True, 'import numpy as np\n'), ((2087, 2160), 'numpy.int', 'np.int', (['((rs[point.father_node.col] + rs[point.fath... |
import os
import gzip
import numpy as np
from ztlearn.utils import maybe_download
from ztlearn.datasets.data_set import DataSet
URL = 'https://storage.googleapis.com/cvdf-datasets/mnist/'
train_files = {
'train_labels' : 'train-labels-idx1-ubyte.gz',
'train_data' : 'train-images-idx3-ubyte.gz'
}
test_file... | [
"os.getcwd",
"ztlearn.utils.maybe_download",
"numpy.concatenate"
] | [((476, 487), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (485, 487), False, 'import os\n'), ((1597, 1644), 'numpy.concatenate', 'np.concatenate', (['(train_data, test_data)'], {'axis': '(0)'}), '((train_data, test_data), axis=0)\n', (1611, 1644), True, 'import numpy as np\n'), ((1673, 1722), 'numpy.concatenate', 'np.c... |
import datetime
import os
import time
import torch
import torch.utils.data
from torch import nn
import torchvision
import torchvision.models.detection
import torchvision.models.detection.mask_rcnn
from torchvision import transforms
from coco_utils import get_coco, get_coco_kp
from group_by_aspect_ratio import Group... | [
"torch.utils.data.DataLoader",
"transforms.RandomHorizontalFlip",
"transforms.Compose",
"numpy.where",
"torch.utils.data.SequentialSampler",
"torch.device",
"torch.no_grad",
"transforms.ToTensor"
] | [((1007, 1028), 'transforms.Compose', 'T.Compose', (['transforms'], {}), '(transforms)\n', (1016, 1028), True, 'import transforms as T\n'), ((1056, 1078), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (1068, 1078), False, 'import torch\n'), ((1428, 1476), 'torch.utils.data.SequentialSampler', ... |
import numpy as np
import seaborn as sns
from multiagent.core import World, Agent, Landmark
from multiagent.scenario import BaseScenario
class Scenario(BaseScenario):
def make_world(self):
world = World()
# set any world properties first
world.dim_c = 5
num_listeners = 4
num... | [
"numpy.random.choice",
"numpy.random.uniform",
"numpy.concatenate",
"numpy.square",
"numpy.zeros",
"multiagent.core.Landmark",
"numpy.array",
"seaborn.color_palette",
"multiagent.core.World",
"numpy.random.shuffle",
"multiagent.core.Agent"
] | [((210, 217), 'multiagent.core.World', 'World', ([], {}), '()\n', (215, 217), False, 'from multiagent.core import World, Agent, Landmark\n'), ((2187, 2217), 'numpy.random.shuffle', 'np.random.shuffle', (['listen_inds'], {}), '(listen_inds)\n', (2204, 2217), True, 'import numpy as np\n'), ((414, 455), 'seaborn.color_pal... |
"""
References:
https://github.com/alykhantejani/nninit
"""
import numpy as np
import torch
from torch.autograd import Variable
def uniform(tensor, a=0, b=1):
"""Fills the input Tensor or Variable with values drawn from a uniform U(a,b)
Args:
tensor: a n-dimension torch.Tensor
a: the lowe... | [
"torch.from_numpy",
"numpy.ceil",
"torch.randn",
"torch.sign",
"torch.Tensor",
"numpy.arange",
"torch.abs",
"numpy.random.shuffle",
"numpy.sqrt"
] | [((3019, 3052), 'numpy.sqrt', 'np.sqrt', (['(2.0 / (fan_in + fan_out))'], {}), '(2.0 / (fan_in + fan_out))\n', (3026, 3052), True, 'import numpy as np\n'), ((3065, 3077), 'numpy.sqrt', 'np.sqrt', (['(3.0)'], {}), '(3.0)\n', (3072, 3077), True, 'import numpy as np\n'), ((3949, 3982), 'numpy.sqrt', 'np.sqrt', (['(2.0 / (... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.context.set_context",
"numpy.random.randn",
"mindspore.ops.operations.StridedSlice",
"mindspore.common.tensor.Tensor",
"mindspore.ops.composite.GradOperation"
] | [((895, 963), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.GRAPH_MODE, device_target='Ascend')\n", (914, 963), False, 'from mindspore import context\n'), ((1709, 1722), 'mindspore.common.tensor.Tensor', 'Tensor', (['input']... |
from run_classifier_application import bert_cls
import numpy as np
import os
import sys
def _is_chinese_char(char):
"""Checks whether CP is the codepoint of a CJK character."""
# This defines a "chinese character" as anything in the CJK Unicode block:
# https://en.wikipedia.org/wiki/CJK_Unified_Ideographs... | [
"json.loads",
"numpy.argmax",
"xlrd.open_workbook",
"json.dumps",
"run_classifier_application.bert_cls",
"os.path.join",
"os.listdir"
] | [((1579, 1611), 'xlrd.open_workbook', 'xlrd.open_workbook', (['path_source1'], {}), '(path_source1)\n', (1597, 1611), False, 'import xlrd\n'), ((2394, 2442), 'run_classifier_application.bert_cls', 'bert_cls', (['path_model', 'num_labels', 'max_seq_length'], {}), '(path_model, num_labels, max_seq_length)\n', (2402, 2442... |
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
import math
import pytest
import warnings
import grpc
import numpy as np
import pandas as pd
import mlos.global_values as global_values
from mlos.Grpc.OptimizerServicesServer import OptimizerServicesServer
from mlos.Grpc.Opti... | [
"mlos.Logger.create_logger",
"mlos.Optimizers.BayesianOptimizerFactory.BayesianOptimizerFactory",
"warnings.simplefilter",
"math.sqrt",
"numpy.abs",
"grpc.insecure_channel",
"mlos.Grpc.OptimizerServicesServer.OptimizerServicesServer",
"pandas.read_json",
"mlos.Grpc.OptimizerService_pb2.Empty",
"ml... | [((1044, 1074), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""'], {}), "('error')\n", (1065, 1074), False, 'import warnings\n'), ((1084, 1118), 'mlos.global_values.declare_singletons', 'global_values.declare_singletons', ([], {}), '()\n', (1116, 1118), True, 'import mlos.global_values as global_values... |
#!/usr/bin/python3
#
# See LICENSE file for copyright and license details.
# pointlight.py
#
# A point light source
#
import numpy
class PointLight:
""" Point light source. """
def __init__(self, pos, **kwargs):
self.pos = numpy.array(pos)
col = None
if 'colour' in kwargs:
... | [
"numpy.array"
] | [((246, 262), 'numpy.array', 'numpy.array', (['pos'], {}), '(pos)\n', (257, 262), False, 'import numpy\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Hindmarsh-Rose model on a 2D lattice
# FvW 03/2018
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy.interpolate import interp1d
import cv2
def hr2d(N, T, t0, dt, sd, D, a, b, c, d, s, r, x_1, I0, stim, blocks... | [
"cv2.VideoWriter_fourcc",
"numpy.ones",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.gca",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.tight_layout",
"numpy.random.randn",
"matplotlib.pyplot.imshow",
"numpy.reshape",
"numpy.linspace"... | [((370, 386), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (378, 386), True, 'import numpy as np\n'), ((394, 410), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (402, 410), True, 'import numpy as np\n'), ((418, 434), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (426, 434), True,... |
from unittest import TestCase
import numpy as np
from keras_transformer_xl.backend import keras
from keras_transformer_xl.backend import backend as K
from keras_transformer_xl import PositionalEmbedding
class TestPositionalEmbedding(TestCase):
def test_sample(self):
input_layer = keras.layers.Input(shape... | [
"keras_transformer_xl.PositionalEmbedding",
"numpy.allclose",
"keras_transformer_xl.backend.keras.layers.Input",
"keras_transformer_xl.backend.backend.function",
"numpy.random.standard_normal",
"numpy.array"
] | [((296, 329), 'keras_transformer_xl.backend.keras.layers.Input', 'keras.layers.Input', ([], {'shape': '(2, 10)'}), '(shape=(2, 10))\n', (314, 329), False, 'from keras_transformer_xl.backend import keras\n'), ((420, 460), 'keras_transformer_xl.backend.backend.function', 'K.function', (['[input_layer]', '[embed_layer]'],... |
import itertools
import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch.nn import functional as F
from src.net import get_dataloader
from src.preprocessing import split_into_cells
def get_predictions(model, device, dataloader):
model.eval()
test_loss = 0
correct = 0
wi... | [
"matplotlib.pyplot.subplot",
"numpy.random.choice",
"matplotlib.pyplot.show",
"src.net.get_dataloader",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"numpy.asarray",
"matplotlib.pyplot.figure",
"torch.nn.functional.nll_loss",
"src.preprocessing.split_into_cells",
"cv2.rectangle",
"torch.no_grad... | [((1364, 1393), 'src.net.get_dataloader', 'get_dataloader', (['grid_cells', 'y'], {}), '(grid_cells, y)\n', (1378, 1393), False, 'from src.net import get_dataloader\n'), ((2540, 2565), 'numpy.asarray', 'np.asarray', (['error_chances'], {}), '(error_chances)\n', (2550, 2565), True, 'import numpy as np\n'), ((3553, 3574)... |
import numpy as np
from util import now
import multiprocessing as mp
import threading
class SICommunicator():
def __init__(self, *args, **kwargs):
pass
def basename(self, *args, **kwargs):
pass
def next_file(self, *args, **kwargs):
pass
class DAQIn(object):
ANALOG_IN,ANALOG_OUT... | [
"util.now",
"threading.Thread",
"numpy.random.choice",
"multiprocessing.Value",
"numpy.random.random",
"numpy.arange",
"multiprocessing.Queue",
"numpy.random.normal"
] | [((1770, 1786), 'multiprocessing.Value', 'mp.Value', (['"""i"""', '(0)'], {}), "('i', 0)\n", (1778, 1786), True, 'import multiprocessing as mp\n'), ((431, 436), 'util.now', 'now', ([], {}), '()\n', (434, 436), False, 'from util import now\n'), ((489, 499), 'multiprocessing.Queue', 'mp.Queue', ([], {}), '()\n', (497, 49... |
"""Algorithms for time series analysis.
Algorithms for analysis of time-series derived from neuroimaging data
1. Coherency: calculate the pairwise correlation between time-series in the
frequency domain and related quantities
2. Spectral estimation: calculate the spectra of time-series and cross-spectra
between time... | [
"scipy.linalg.solve",
"numpy.sum",
"numpy.abs",
"utils.get_bounds",
"numpy.angle",
"numpy.empty",
"matplotlib.mlab.csd",
"numpy.ones",
"numpy.floor",
"numpy.imag",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.sin",
"utils.autocorr",
"numpy.conjugate",
"numpy.convolve",
"numpy.... | [((2876, 2962), 'numpy.zeros', 'np.zeros', (['(time_series.shape[0], time_series.shape[0], f.shape[0])'], {'dtype': 'complex'}), '((time_series.shape[0], time_series.shape[0], f.shape[0]), dtype=\n complex)\n', (2884, 2962), True, 'import numpy as np\n'), ((3200, 3241), 'utils.tril_indices', 'ut.tril_indices', (['ti... |
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Free University
# Berlin, 14195 Berlin, Germany.
# 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 ... | [
"unittest.main",
"numpy.sum",
"pyemma.msm.its",
"six.moves.range",
"pyemma.msm.api.timescales_msm",
"numpy.testing.assert_array_equal",
"numpy.allclose",
"pyemma.msm.timescales_hmsm",
"numpy.alltrue",
"msmtools.analysis.timescales",
"numpy.shape",
"numpy.random.randint",
"numpy.array",
"py... | [((9273, 9288), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9286, 9288), False, 'import unittest\n'), ((2411, 2420), 'six.moves.range', 'range', (['(10)'], {}), '(10)\n', (2416, 2420), False, 'from six.moves import range\n'), ((2600, 2634), 'numpy.array', 'np.array', (['[[0.9, 0.1], [0.1, 0.9]]'], {}), '([[0.9... |
import numpy as np
import mbuild as mb
class Silane(mb.Compound):
"""An Si(OH)2 group with two ports. """
def __init__(self, ):
super(Silane, self).__init__()
mb.load('silane.pdb', compound=self,
relative_to_module=self.__module__,
infer_hierarchy=False,
... | [
"numpy.array",
"mbuild.Port",
"mbuild.load",
"mbuild.x_axis_transform"
] | [((186, 320), 'mbuild.load', 'mb.load', (['"""silane.pdb"""'], {'compound': 'self', 'relative_to_module': 'self.__module__', 'infer_hierarchy': '(False)', 'backend': '"""parmed"""', 'skip_bonds': '(True)'}), "('silane.pdb', compound=self, relative_to_module=self.__module__,\n infer_hierarchy=False, backend='parmed',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
x, y = np.mgrid[-2.03:4.2:.04, -1.6:3.2:.04]
x = x.T
y = y.T
plt.figure(1, figsize=(3, 2.5))
plt.clf()
plt.axes([0, 0, 1, 1])
contours = plt.contour(np.sqrt((x - 3)**2 + (y - 2)**2),
... | [
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.clabel",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.fill... | [((188, 219), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(3, 2.5)'}), '(1, figsize=(3, 2.5))\n', (198, 219), True, 'import matplotlib.pyplot as plt\n'), ((220, 229), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (227, 229), True, 'import matplotlib.pyplot as plt\n'), ((230, 252), 'matplotl... |
# 3d plot of the test function
from numpy import arange
from numpy import meshgrid
from matplotlib import pyplot
# objective function
def objective(x, y):
return x**2.0 + y**2.0
# define range for input
r_min, r_max = -1.0, 1.0
# sample input range uniformly at 0.1 increments
xaxis = arange(r_min, r_max, 0.1)
yaxis ... | [
"numpy.meshgrid",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((288, 313), 'numpy.arange', 'arange', (['r_min', 'r_max', '(0.1)'], {}), '(r_min, r_max, 0.1)\n', (294, 313), False, 'from numpy import arange\n'), ((322, 347), 'numpy.arange', 'arange', (['r_min', 'r_max', '(0.1)'], {}), '(r_min, r_max, 0.1)\n', (328, 347), False, 'from numpy import arange\n'), ((385, 407), 'numpy.m... |
import unittest
import numpy as np
from numpy.testing import assert_almost_equal
from pycomlink.processing.wet_antenna import wet_antenna
class TestWaaLeijnse2008(unittest.TestCase):
def test_with_R_array(self):
R = np.logspace(-3, 2, 6)
expected_dict = {
'10': np.array([0.14634379, 0... | [
"numpy.logspace",
"numpy.testing.assert_almost_equal",
"numpy.array",
"numpy.arange",
"pycomlink.processing.wet_antenna.wet_antenna.waa_leijnse_2008",
"pycomlink.processing.wet_antenna.wet_antenna.eps_water"
] | [((230, 251), 'numpy.logspace', 'np.logspace', (['(-3)', '(2)', '(6)'], {}), '(-3, 2, 6)\n', (241, 251), True, 'import numpy as np\n'), ((1262, 1388), 'numpy.array', 'np.array', (['[0.0, 0.85081045, 1.2087577, 1.39943582, 1.53099038, 1.63112499, 1.7142827,\n 1.78122755, 1.84301522, 1.89539232]'], {}), '([0.0, 0.8508... |
# Copyright 2018 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",
"distutils.version.StrictVersion",
"numpy.roll",
"numpy.zeros",
"tensorflow.python.ops.manip_ops.roll",
"tensorflow.python.ops.gradient_checker.compute_gradient",
"numpy.random.randint",
"tensorflow.python.ops.array_ops.placeholder",
"numpy.random.rand"
] | [((7893, 7908), 'tensorflow.python.platform.test.main', 'test_lib.main', ([], {}), '()\n', (7906, 7908), True, 'from tensorflow.python.platform import test as test_lib\n'), ((1444, 1471), 'distutils.version.StrictVersion', 'Version', (['np.version.version'], {}), '(np.version.version)\n', (1451, 1471), True, 'from dist... |
"""Utils for creating datasets.
"""
"""
Copyright 2017 <NAME>. See also NOTICE.md.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required b... | [
"tensorflow.image.resize_images",
"tensorflow.train.shuffle_batch",
"numpy.std",
"os.walk",
"numpy.transpose",
"os.path.exists",
"scipy.io.wavfile.read",
"numpy.mean",
"numpy.array",
"tensorflow.WholeFileReader",
"numpy.random.permutation",
"tensorflow.image.resize_image_with_crop_or_pad",
"... | [((2465, 2485), 'tensorflow.WholeFileReader', 'tf.WholeFileReader', ([], {}), '()\n', (2483, 2485), True, 'import tensorflow as tf\n'), ((3660, 3699), 'tensorflow.image.resize_images', 'tf.image.resize_images', (['imgs', 'rsz_shape'], {}), '(imgs, rsz_shape)\n', (3682, 3699), True, 'import tensorflow as tf\n'), ((4481,... |
# coding=utf-8
# Copyright 2021 The I-BERT Authors (<NAME>, <NAME>, <NAME>,
# <NAME>, <NAME> - UC Berkeley) and The HuggingFace Inc. team.
# Copyright (c) 20121, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | [
"torch.sqrt",
"torch.no_grad",
"torch.sign",
"torch.kthvalue",
"torch.zeros",
"torch.mean",
"torch.zeros_like",
"torch.nn.GELU",
"torch.clamp",
"torch.floor",
"torch.max",
"torch.sum",
"torch.min",
"torch.from_numpy",
"decimal.Decimal",
"torch.nn.functional.linear",
"torch.nn.functio... | [((22805, 22850), 'torch.round', 'torch.round', (['(1.0 / scale * input + zero_point)'], {}), '(1.0 / scale * input + zero_point)\n', (22816, 22850), False, 'import torch\n'), ((26788, 26803), 'numpy.array', 'np.array', (['tmp_m'], {}), '(tmp_m)\n', (26796, 26803), True, 'import numpy as np\n'), ((3372, 3511), 'torch.n... |
def PolarCap(simu,vari,level,latpolar,period):
"""
Script calculates average over the polar cap (set latitude)
"""
### Import modules
import numpy as np
import calc_Utilities as UT
import read_CTLNQ as CONT
import read_ExpMonthly as NUDG
import read_ShortCoupled as COUP
import re... | [
"read_SIC_E3SM.readE3SM_SIC",
"read_SIC.readSIC",
"numpy.meshgrid",
"read_SIT.readSIT",
"numpy.empty",
"read_OldIceExperi.readOldIceExperi",
"read_LongCoupled.readLong",
"read_SIT_E3SM.readE3SM_SIT",
"read_CTLNQ.readControl",
"numpy.where",
"read_ExpMonthly.readExperi",
"calc_Utilities.calcDec... | [((8014, 8035), 'numpy.meshgrid', 'np.meshgrid', (['lon', 'lat'], {}), '(lon, lat)\n', (8025, 8035), True, 'import numpy as np\n'), ((1014, 1065), 'read_ExpMonthly.readExperi', 'NUDG.readExperi', (['varia', '"""AA"""', '"""2030"""', 'level', '"""none"""'], {}), "(varia, 'AA', '2030', level, 'none')\n", (1029, 1065), Tr... |
try:
from datetime import datetime
import playsound
import time
import os
import subprocess
import hashlib
import turtle as t
from turtle import *
import pyautogui
import cv2
from threading import Thread
import jdatetime
import numpy as np
from PIL i... | [
"playsound.playsound",
"os.remove",
"turtle.speed",
"turtle.pd",
"pyautogui.alert",
"turtle.mainloop",
"cv2.rectangle",
"turtle.clear",
"os.path.join",
"turtle.end_fill",
"turtle.ht",
"cv2.cvtColor",
"turtle.setup",
"turtle.fillcolor",
"cv2.destroyAllWindows",
"datetime.datetime.now",
... | [((360, 370), 'turtle.Turtle', 't.Turtle', ([], {}), '()\n', (368, 370), True, 'import turtle as t\n'), ((392, 402), 'turtle.Turtle', 't.Turtle', ([], {}), '()\n', (400, 402), True, 'import turtle as t\n'), ((567, 573), 'turtle.ht', 't.ht', ([], {}), '()\n', (571, 573), True, 'import turtle as t\n'), ((583, 593), 'turt... |
import numpy as np
from scipy.optimize import bisect
from scipy import interpolate
import seaborn as sns
def grid_HPD_contours(data, levels):
"""
Get the contours for a 2D grid of data at the
specified levels as a fraction the integral over the whole grid.
"""
N = 1e3
thresholds = np.linspace... | [
"seaborn.kdeplot",
"numpy.histogram2d",
"numpy.where",
"numpy.array",
"scipy.interpolate.interp1d"
] | [((505, 547), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['integral', 'thresholds'], {}), '(integral, thresholds)\n', (525, 547), False, 'from scipy import interpolate\n'), ((868, 920), 'numpy.histogram2d', 'np.histogram2d', (['xdata', 'ydata'], {'bins': 'bins', 'normed': '(True)'}), '(xdata, ydata, bins=bi... |
import numpy as np
import argparse
import os
os.environ["KERAS_BACKEND"]="tensorflow"
import importlib.machinery
import re
from mimic3models.readmission_no_icd9 import utils
from mimic3benchmark.readers import ReadmissionReader
from mimic3models.preprocessing import Discretizer, Normalizer
from mimic3models import... | [
"argparse.ArgumentParser",
"mimic3models.keras_utils.ReadmissionMetrics",
"os.path.join",
"mimic3models.common_utils.read_chunk",
"mimic3models.common_utils.add_common_arguments",
"os.path.dirname",
"os.path.exists",
"mimic3models.readmission_no_icd9.utils.save_results",
"os.path.basename",
"keras... | [((506, 531), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (529, 531), False, 'import argparse\n'), ((532, 573), 'mimic3models.common_utils.add_common_arguments', 'common_utils.add_common_arguments', (['parser'], {}), '(parser)\n', (565, 573), False, 'from mimic3models import common_utils\n')... |
"""
Test individual tool functionality
"""
# pylint: disable=C0103,C0116,C0415
import subprocess
import sys
import matplotlib as mpl
import numpy as np
import tables
from ctapipe.core import run_tool
from ctapipe.utils import get_dataset_path
GAMMA_TEST_LARGE = get_dataset_path("gamma_test_large.simtel.gz")
LST_MUONS... | [
"yaml.load",
"ctapipe.tools.bokeh.file_viewer.BokehFileViewer",
"ctapipe.tools.display_dl1.DisplayDL1Calib",
"ctapipe.tools.display_events_single_tel.SingleTelEventDisplay",
"ctapipe.tools.display_summed_images.ImageSumDisplayerTool",
"ctapipe.tools.display_integrator.DisplayIntegrator",
"ctapipe.tools.... | [((264, 310), 'ctapipe.utils.get_dataset_path', 'get_dataset_path', (['"""gamma_test_large.simtel.gz"""'], {}), "('gamma_test_large.simtel.gz')\n", (280, 310), False, 'from ctapipe.utils import get_dataset_path\n'), ((323, 363), 'ctapipe.utils.get_dataset_path', 'get_dataset_path', (['"""lst_muons.simtel.zst"""'], {}),... |
# Copyright 2018 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 applicab... | [
"tensorflow.test.main",
"numpy.outer",
"numpy.concatenate",
"numpy.square",
"numpy.zeros",
"numpy.transpose",
"tensorflow.constant",
"numpy.prod",
"numpy.hstack",
"fivo.models.ghmm.GaussianHMM",
"numpy.vstack",
"numpy.array",
"numpy.linalg.inv",
"numpy.tile",
"numpy.dot",
"numpy.diag",... | [((13386, 13400), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (13398, 13400), True, 'import tensorflow as tf\n'), ((9572, 9588), 'numpy.zeros', 'np.zeros', (['[4, 4]'], {}), '([4, 4])\n', (9580, 9588), True, 'import numpy as np\n'), ((10081, 10109), 'numpy.outer', 'np.outer', (['x_weight', 'x_weight'], {}... |
import numpy as np
import click
import re
@click.command()
@click.option('--input', default='./crawl-300d-2M.vec', help='The extracted word vectors')
@click.option('--vecs', default='./word_vec.npy', help='The output word vector mmap file')
@click.option('--words', default='./words.txt', help='The word list')
def con... | [
"numpy.memmap",
"click.option",
"re.match",
"click.command"
] | [((45, 60), 'click.command', 'click.command', ([], {}), '()\n', (58, 60), False, 'import click\n'), ((62, 156), 'click.option', 'click.option', (['"""--input"""'], {'default': '"""./crawl-300d-2M.vec"""', 'help': '"""The extracted word vectors"""'}), "('--input', default='./crawl-300d-2M.vec', help=\n 'The extracted... |
# -*- coding: utf-8 -*-
"""
.. module:: scinlp
:synopsis: The Natual Langauge Processing for SciSci
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import os
import sys
import re
from collections import defaultdict, Counter
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer... | [
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.empty",
"tqdm.tqdm.pandas",
"Levenshtein.ratio",
"sparse_dot_topn.awesome_cossim_topn"
] | [((4073, 4152), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'min_df': '(1)', 'ngram_range': '(3, 3)', 'analyzer': '"""char"""', 'lowercase': '(False)'}), "(min_df=1, ngram_range=(3, 3), analyzer='char', lowercase=False)\n", (4088, 4152), False, 'from sklearn.feature_extraction.text impor... |
import numpy as np
array = np.array([1, 2, 3])
print(array)
print(array.dtype)
print(type(array))
print(array.shape)
print(array.nbytes)
print()
print(np.zeros(5))
print(np.ones(5))
print(np.zeros_like(5))
print()
print(np.arange(1, 16, 4))
print(np.arange(1, 10))
print(np.arange(5))
print()
print(np.linspace(1, 1... | [
"numpy.zeros_like",
"numpy.log",
"numpy.zeros",
"numpy.ones",
"numpy.hsplit",
"numpy.hstack",
"numpy.any",
"numpy.sort",
"numpy.append",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.insert",
"numpy.eye",
"numpy.all"
] | [((28, 47), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (36, 47), True, 'import numpy as np\n'), ((340, 362), 'numpy.linspace', 'np.linspace', (['(3)', '(33)', '(11)'], {}), '(3, 33, 11)\n', (351, 362), True, 'import numpy as np\n'), ((367, 391), 'numpy.linspace', 'np.linspace', (['(-2)', '(-22)', ... |
import numpy as np
scores = np.array([0,1])
nScores = len(scores)
nClasses = 2
inputFile = "./data/crowdlabels_table.csv"
tableFormat = True
outputFile = "./data/test.out"
confMatFile = "./data/test_ibcc.mat"
goldFile = "./data/gold_short.csv"
nu0 = np.array([50,50])
alpha0 = np.array([[2, 1], [1, 2]])
| [
"numpy.array"
] | [((28, 44), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (36, 44), True, 'import numpy as np\n'), ((250, 268), 'numpy.array', 'np.array', (['[50, 50]'], {}), '([50, 50])\n', (258, 268), True, 'import numpy as np\n'), ((277, 303), 'numpy.array', 'np.array', (['[[2, 1], [1, 2]]'], {}), '([[2, 1], [1, 2]])\n... |
"""Probabilistic model class"""
import numpy as np
from nudging.model.base import BaseModel
import nudging.model.propensity_score as ps
from sklearn.base import is_classifier, is_regressor
class ProbModel(BaseModel):
"""class for Probalistic model"""
def _get_success(self, data_frame):
"""Convert ou... | [
"nudging.model.propensity_score.get_pscore",
"numpy.greater",
"nudging.model.propensity_score.get_psw_ate",
"nudging.model.propensity_score.match_ps",
"nudging.model.propensity_score.get_ate",
"sklearn.base.is_classifier",
"sklearn.base.is_regressor"
] | [((401, 426), 'sklearn.base.is_classifier', 'is_classifier', (['self.model'], {}), '(self.model)\n', (414, 426), False, 'from sklearn.base import is_classifier, is_regressor\n'), ((1446, 1471), 'nudging.model.propensity_score.get_pscore', 'ps.get_pscore', (['data_frame'], {}), '(data_frame)\n', (1459, 1471), True, 'imp... |
# To run the simulator: python3 ls372_simulator.py -p 7777
# (Since it automatically tries nearby ports, sometimes it will connect to 7778 when restarted,
# so you may need to temporarily change the port in Lakeshore372.py or just try running it again)
#
# To interact with the simulator:
# Connect 372 agent: python3 -i... | [
"argparse.ArgumentParser",
"logging.FileHandler",
"socket.socket",
"logging.StreamHandler",
"time.time",
"logging.Formatter",
"numpy.random.random",
"numpy.random.normal",
"logging.getLogger"
] | [((27653, 27685), 'logging.Formatter', 'logging.Formatter', (['format_string'], {}), '(format_string)\n', (27670, 27685), False, 'import logging\n'), ((27696, 27715), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (27713, 27715), False, 'import logging\n'), ((28270, 28281), 'time.time', 'time.time', ([], {... |
import socket
import time
import io
import sys
import seaborn as sns
import numpy as np
import pandas as pd
import sklearn
import matplotlib.pyplot as plt
sns.set_style('whitegrid')
print(np.__version__)
print(pd.__version__)
print(sys.version)
print(sklearn.__version__)
from sklearn.svm import SVC
from sklearn.model_... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.boxplot",
"numpy.clip",
"sklearn.metrics.mean_absolute_error",
"numpy.argsort",
"matplotlib.pyplot.figure",
"matplotlib.colors.LogNorm",
"pathlib.P... | [((156, 182), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (169, 182), True, 'import seaborn as sns\n'), ((979, 1017), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (998, 1017), True, 'import matplotlib.pyplot as ... |
import numpy as np
import timeit
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
def pointless_sort(x):
"""
This function always returns the same values to show how testing
works, check out the `test/test_alg.py` file to see.
"""
... | [
"pandas.DataFrame",
"seaborn.lmplot",
"numpy.log2",
"numpy.random.randint",
"numpy.array",
"timeit.timeit"
] | [((3161, 3180), 'pandas.DataFrame', 'pd.DataFrame', (['timed'], {}), '(timed)\n', (3173, 3180), True, 'import pandas as pd\n'), ((3267, 3353), 'seaborn.lmplot', 'sns.lmplot', ([], {'x': '"""n"""', 'y': '"""time"""', 'col': '"""algorithm"""', 'fit_reg': '(False)', 'data': 'timed', 'ci': '(False)'}), "(x='n', y='time', c... |
"""
All face finding stuff goes here.
Would be pretty great to expand the config part a bit more
"""
import numpy
import cv2
from cv2.cv2 import CASCADE_SCALE_IMAGE
from face_replace import FACE_TYPES, Face
import os
DIR = os.path.dirname(__file__)
FRONT_PATH = DIR + '/paths/haarcascade_frontalface_alt.xml'
PROFILE_PA... | [
"os.path.dirname",
"face_replace.Face",
"numpy.shape",
"cv2.warpAffine",
"numpy.fromstring",
"cv2.CascadeClassifier",
"cv2.flip",
"cv2.getRotationMatrix2D"
] | [((224, 249), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (239, 249), False, 'import os\n'), ((617, 645), 'numpy.shape', 'numpy.shape', (['self.__gray_img'], {}), '(self.__gray_img)\n', (628, 645), False, 'import numpy\n'), ((884, 917), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['... |
#!/usr/bin/env python
# coding: utf-8
# #### Clustering Operation exposed as a Service
#
# This file does the following:
# * Creates a model with k-means clustering
# * Predicts the label and returns it
# imports
from bottle import route, run, request
import numpy as np
#import matplotlib.pyplot as plt
#from matplo... | [
"pickle.dump",
"pandas.read_csv",
"sklearn.cluster.KMeans",
"bottle.run",
"bottle.route",
"spacy.load",
"numpy.array"
] | [((2414, 2429), 'bottle.route', 'route', (['"""/hello"""'], {}), "('/hello')\n", (2419, 2429), False, 'from bottle import route, run, request\n'), ((2471, 2484), 'bottle.route', 'route', (['"""/ner"""'], {}), "('/ner')\n", (2476, 2484), False, 'from bottle import route, run, request\n'), ((2781, 2797), 'bottle.route', ... |
"""Minibatching utilities."""
import torch
import math
import nltk
import pickle
import codecs
import logging
import gpustat
import operator
import numpy as np
import torch.nn as nn
from sklearn.utils import shuffle
from torch.autograd import Variable
from collections import Counter
def bleu_stats(hypothesis, refere... | [
"argparse.ArgumentParser",
"numpy.empty",
"torch.cuda.device_count",
"numpy.argsort",
"torch.no_grad",
"sys.path.append",
"codecs.open",
"numpy.append",
"gpustat.GPUStatCollection.new_query",
"torch.autograd.Variable",
"torch.nn.Conv2d",
"gensen.GenSenSingle",
"torch.Size",
"torch.rand",
... | [((1383, 1443), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])\n', (1391, 1443), True, 'import numpy as np\n'), ((1877, 1893), 'torch.Size', 'torch.Size', (['size'], {}), '(size)\n', (1887, 1893), False, 'import torch\n'), (... |
import numpy as np
import os
import random
import time
import torch
from os import path as osp
from .dist_util import master_only
def set_random_seed(seed):
"""Set random seeds."""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_se... | [
"numpy.random.seed",
"os.makedirs",
"torch.manual_seed",
"os.rename",
"torch.cuda.manual_seed",
"os.path.exists",
"torch.cuda.manual_seed_all",
"random.seed",
"os.path.relpath",
"os.path.join",
"os.scandir",
"time.localtime"
] | [((192, 209), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (203, 209), False, 'import random\n'), ((214, 234), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (228, 234), True, 'import numpy as np\n'), ((239, 262), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (25... |
from __future__ import division
import numpy as np
import glob
import os
from scipy.misc import imread
import cv2
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.datasets.dense_design_matrix import DefaultViewConverter
import logging
log = logging.getLogger()
def read_label(label_f... | [
"os.path.basename",
"numpy.asarray",
"logging.getLogger",
"scipy.misc.imread",
"pylearn2.datasets.dense_design_matrix.DefaultViewConverter",
"os.path.join",
"cv2.resize"
] | [((277, 296), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (294, 296), False, 'import logging\n'), ((472, 516), 'os.path.join', 'os.path.join', (['datadir', '"""faces_aligned/*.png"""'], {}), "(datadir, 'faces_aligned/*.png')\n", (484, 516), False, 'import os\n'), ((966, 1013), 'os.path.join', 'os.path.j... |
from collections import deque
from itertools import count
import torch
import torch.nn.functional as F
import random
import math
import numpy as np
def learn(memory, BATCH_SIZE, policy_net, target_net, optimizer):
if len(memory) < BATCH_SIZE:
return
transitions = memory.sample(BATCH_SIZE)
... | [
"math.exp",
"torch.cat",
"itertools.count",
"random.random",
"numpy.mean",
"random.randrange",
"torch.zeros",
"torch.tensor",
"torch.no_grad",
"collections.deque"
] | [((772, 829), 'torch.cat', 'torch.cat', (['[s for s in batch.next_state if s is not None]'], {}), '([s for s in batch.next_state if s is not None])\n', (781, 829), False, 'import torch\n'), ((901, 923), 'torch.cat', 'torch.cat', (['batch.state'], {}), '(batch.state)\n', (910, 923), False, 'import torch\n'), ((943, 966)... |
import numpy as np
import time
from typing import Dict
def load_file():
with open(
"/home/knniff/python-projects/python-vorkurs/Uebung08/word_list.txt", "r"
) as file:
all_words = file.readlines()
for word in range(len(all_words)):
all_words[word] = all_words[word].replace("\n", "... | [
"time.time",
"numpy.max",
"numpy.min",
"numpy.mean",
"numpy.array"
] | [((982, 996), 'numpy.array', 'np.array', (['zeit'], {}), '(zeit)\n', (990, 996), True, 'import numpy as np\n'), ((892, 903), 'time.time', 'time.time', ([], {}), '()\n', (901, 903), False, 'import time\n'), ((953, 964), 'time.time', 'time.time', ([], {}), '()\n', (962, 964), False, 'import time\n'), ((1028, 1041), 'nump... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import numpy as np
from utils import Timer
from evaluation import bcubed, pairwise
def _read_meta(fn):
labels = list()
lb_set = set()
with open(fn) as f:
for lb in f.readlines():
lb = int(lb.strip())
... | [
"numpy.array",
"argparse.ArgumentParser"
] | [((443, 498), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate Cluster"""'}), "(description='Evaluate Cluster')\n", (466, 498), False, 'import argparse\n'), ((376, 392), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (384, 392), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
import timeit
from sklearn import datasets
import random
import clustering
import dionysus as dion
def gen_data(n_samples, seed=0, noise=0.05):
# print("\nGenerating data...\n")
np.random.seed(seed)
random.seed(seed)
data = []
data.append(np.r... | [
"sklearn.datasets.make_circles",
"numpy.random.seed",
"clustering.pd_fuzzy",
"dionysus.homology_persistence",
"random.seed",
"numpy.arange",
"numpy.random.normal",
"timeit.timeit",
"dionysus.fill_rips",
"dionysus.init_diagrams",
"clustering.reformat_diagrams"
] | [((242, 262), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (256, 262), True, 'import numpy as np\n'), ((267, 284), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (278, 284), False, 'import random\n'), ((2643, 2665), 'numpy.arange', 'np.arange', (['(25)', '(275)', '(25)'], {}), '(25, 275... |
#!/usr/bin/env python
# coding: utf-8
import torch.nn as nn
import torch.nn.init as init
from torch.utils.data import Dataset, DataLoader
from torch import optim
import torch.nn.functional as F
from gensim.models import Word2Vec
import random
import pdb
import numpy as np
import torch
import jieba as jb
import math
im... | [
"torch.nn.Dropout",
"torch.bmm",
"torch.nn.Embedding",
"numpy.ones",
"torch.cat",
"numpy.sin",
"numpy.arange",
"torch.arange",
"torch.device",
"torch.ones",
"numpy.power",
"torch.load",
"torch.nn.Embedding.from_pretrained",
"torch.gt",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LogS... | [((748, 778), 'numpy.sin', 'np.sin', (['position_enc[1:, 0::2]'], {}), '(position_enc[1:, 0::2])\n', (754, 778), True, 'import numpy as np\n'), ((817, 847), 'numpy.cos', 'np.cos', (['position_enc[1:, 1::2]'], {}), '(position_enc[1:, 1::2])\n', (823, 847), True, 'import numpy as np\n'), ((1579, 1612), 'torch.from_numpy'... |
import numpy as np
import matplotlib as mpl
import pylab
from collections import Counter
mpl.use("Agg")
plt = mpl.pyplot
game_cls = 2
game_dic = {1: "DiscretizedNLLeduc", 2: "StandardLeduc"}
methods = ['CFR', 'CFRplus', 'LinCFR', 'MCCFR', 'MCCFR_OS','VR_CFR']
path = "/home/jialian/cfr/PokerRL/data/"
for m in method... | [
"numpy.log10",
"numpy.load",
"matplotlib.use",
"numpy.array"
] | [((90, 104), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (97, 104), True, 'import matplotlib as mpl\n'), ((335, 396), 'numpy.load', 'np.load', (["(path + m + '_EXAMPLE_' + game_dic[game_cls] + '.npy')"], {}), "(path + m + '_EXAMPLE_' + game_dic[game_cls] + '.npy')\n", (342, 396), True, 'import numpy ... |
""" This VR hand dexterity benchmark allows the user to interact with many types of objects
and interactive objects, and provides a good way to qualitatively measure the dexterity of a VR hand.
You can use the left and right controllers to start/stop/reset the timer,
as well as show/hide its display. The "overlay togg... | [
"igibson.render.mesh_renderer.mesh_renderer_cpu.MeshRendererSettings",
"pybullet.changeDynamics",
"igibson.simulator.Simulator",
"igibson.objects.articulated_object.ArticulatedObject",
"numpy.random.randint",
"igibson.robots.behavior_robot.BehaviorRobot",
"pybullet_data.getDataPath",
"numpy.random.cho... | [((1483, 1560), 'os.path.join', 'os.path.join', (['igibson.ig_dataset_path', '"""scenes"""', '"""background"""', '"""probe_02.hdr"""'], {}), "(igibson.ig_dataset_path, 'scenes', 'background', 'probe_02.hdr')\n", (1495, 1560), False, 'import os\n'), ((1576, 1653), 'os.path.join', 'os.path.join', (['igibson.ig_dataset_pa... |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... | [
"ctypes.c_double",
"ctypes.c_int",
"numpy.empty",
"numpy.linalg.cond",
"numpy.linalg.svd",
"numpy.arange",
"numpy.linalg.norm",
"numpy.ndarray",
"numpy.prod",
"numpy.zeros_like",
"pyscf.tblis_einsum.contract",
"numpy.append",
"pyscf.lib.misc.load_library",
"numpy.tril_indices",
"pyscf.li... | [((1124, 1157), 'pyscf.lib.misc.load_library', 'misc.load_library', (['"""libnp_helper"""'], {}), "('libnp_helper')\n", (1141, 1157), False, 'from pyscf.lib import misc\n'), ((1241, 1263), 'numpy.zeros', 'numpy.zeros', (['(3, 3, 3)'], {}), '((3, 3, 3))\n', (1252, 1263), False, 'import numpy\n'), ((1404, 1504), 'numpy.a... |
import os
import os.path as osp
from typing import Any, Tuple, List
import numpy
from setuptools import setup, find_packages, Extension
try:
import torch
except ImportError:
raise ImportError("PyTorch must be pre-installed before installing Falkon.")
from torch.utils.cpp_extension import BuildExtension, CUDAE... | [
"Cython.Build.cythonize",
"torch.__config__.parallel_info",
"torch.cuda.is_available",
"numpy.get_include",
"os.path.join",
"os.getenv",
"setuptools.find_packages",
"torch.utils.cpp_extension.BuildExtension.with_options"
] | [((366, 391), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (389, 391), False, 'import torch\n'), ((947, 962), 'torch.__config__.parallel_info', 'parallel_info', ([], {}), '()\n', (960, 962), False, 'from torch.__config__ import parallel_info\n'), ((2402, 2441), 'os.path.join', 'osp.join', (['... |
import numpy as np
import os
import torch
torch.set_default_tensor_type('torch.cuda.FloatTensor')
def pose_distance_measure(poses):
"""
Page 4 in the paper: https://arxiv.org/pdf/1904.06397.pdf
Get all the poses for a sequence and calculate them at the same time?
"""
distances = np.zeros((poses.... | [
"torch.eye",
"torch.norm",
"numpy.zeros",
"torch.set_default_tensor_type",
"numpy.transpose",
"numpy.linalg.norm",
"torch.zeros",
"numpy.eye",
"os.path.join",
"torch.tensor",
"numpy.sqrt"
] | [((42, 97), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['"""torch.cuda.FloatTensor"""'], {}), "('torch.cuda.FloatTensor')\n", (71, 97), False, 'import torch\n'), ((304, 346), 'numpy.zeros', 'np.zeros', (['(poses.shape[0], poses.shape[0])'], {}), '((poses.shape[0], poses.shape[0]))\n', (312, 346)... |
import numpy as np
import pandas as pd
import os
import seaborn as sns
import matplotlib.pyplot as plt
# import plotly.express as px
from matplotlib.gridspec import GridSpec
# import cv2
from datetime import date
from action_prediction import constants as const
import warnings
warnings.filterwarnings("ignore")
def... | [
"matplotlib.pyplot.title",
"seaborn.kdeplot",
"seaborn.factorplot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.style.use",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.rc... | [((280, 313), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (303, 313), False, 'import warnings\n'), ((343, 385), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': '(2)', 'figsize': '[2, 2]', 'dpi': '(300)'}), '(num=2, figsize=[2, 2], dpi=300)\n', (353, 385), True, '... |
"""Inference script for submissions.
See the expected code submission format at:
https://www.drivendata.org/competitions/81/detect-flood-water/page/389/
This script will average predictions from multiple models, but we have to pay
attention to providing the right inputs (i.e. the correct bands with the
expected rewri... | [
"numpy.stack",
"tqdm.tqdm",
"numpy.zeros_like",
"rasterio.open",
"tensorflow.keras.models.load_model",
"tensorflow.python.ops.numpy_ops.np_config.enable_numpy_behavior",
"tifffile.imwrite",
"numpy.expand_dims",
"numpy.argwhere",
"absl.logging.info",
"pathlib.Path",
"numpy.mean",
"numpy.rint"... | [((759, 781), 'pathlib.Path', 'Path', (['"""/codeexecution"""'], {}), "('/codeexecution')\n", (763, 781), False, 'from pathlib import Path\n'), ((1367, 1387), 'numpy.zeros_like', 'np.zeros_like', (['water'], {}), '(water)\n', (1380, 1387), True, 'import numpy as np\n'), ((3432, 3457), 'numpy.stack', 'np.stack', (['inpu... |
"""
defines:
- nids, nid_cd, icd_transform, xyz_cid0 = get_nid_cd_xyz_cid0(model)
- nids, nid_cd, xyz_cid0, icd_transform, eids, element_centroids_cid0 = smt_setup(model)
- xyz1, xyz2, xyz3, i, k, origin, xzplane, dim_max, stations = setup_coord_from_plane(
model, xyz_cid0,
p1, p2, p3, zaxis,
... | [
"numpy.abs",
"pyNastran.bdf.mesh_utils.cut_model_by_plane.get_stations",
"matplotlib.pyplot.show",
"matplotlib.pyplot.close",
"pyNastran.bdf.mesh_utils.cut_model_by_plane.get_element_centroids",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.linspace",
"pyNastran.bdf.mesh_utils.cut_model_by_plane... | [((947, 973), 'pyNastran.bdf.mesh_utils.cut_model_by_plane.get_nid_cd_xyz_cid0', 'get_nid_cd_xyz_cid0', (['model'], {}), '(model)\n', (966, 973), False, 'from pyNastran.bdf.mesh_utils.cut_model_by_plane import get_nid_cd_xyz_cid0, get_element_centroids, get_stations\n'), ((1009, 1037), 'pyNastran.bdf.mesh_utils.cut_mod... |
# Copyright 2019, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"tensorflow.test.main",
"functools.partial",
"numpy.random.seed",
"tensorflow.keras.layers.Dense",
"numpy.random.rand",
"optimization.shared.schedule_utils.build_scheduled_client_datasets_fn",
"collections.OrderedDict",
"tensorflow_federated.simulation.client_data.ConcreteClientData"
] | [((1274, 1299), 'numpy.random.seed', 'np.random.seed', (['client_id'], {}), '(client_id)\n', (1288, 1299), True, 'import numpy as np\n'), ((2705, 2719), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2717, 2719), True, 'import tensorflow as tf\n'), ((1416, 1461), 'collections.OrderedDict', 'collections.Orde... |
from ludopy.player import Player
from enum import Enum
import numpy as np
from QLearning.actionTable import ActionTable
class State(Enum):
Home=0 #state in which the token is home, which also is the starting position.
Safe=1 #state in which the token has reached goal.
Unsafe=2 # state where the token is sa... | [
"numpy.add",
"numpy.where",
"numpy.isnan",
"ludopy.player.Player"
] | [((2503, 2511), 'ludopy.player.Player', 'Player', ([], {}), '()\n', (2509, 2511), False, 'from ludopy.player import Player\n'), ((2513, 2521), 'ludopy.player.Player', 'Player', ([], {}), '()\n', (2519, 2521), False, 'from ludopy.player import Player\n'), ((2523, 2531), 'ludopy.player.Player', 'Player', ([], {}), '()\n'... |
"""
Copyright 2013 <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 agreed to in writing, software
distrib... | [
"cmpb.MPBModel",
"cmpb.MPBCones",
"numpy.arange"
] | [((3195, 3213), 'numpy.arange', 'np.arange', (['var_len'], {}), '(var_len)\n', (3204, 3213), True, 'import numpy as np\n'), ((3234, 3272), 'cmpb.MPBCones', 'cmpb.MPBCones', (['types', 'lengths', 'indices'], {}), '(types, lengths, indices)\n', (3247, 3272), False, 'import cmpb\n'), ((3910, 3931), 'numpy.arange', 'np.ara... |
# -*- coding: utf-8 -*-
"""
A class and operations for uncertain values using intervals and fuzzy numbers
Previously called FuzzyNumber.py, but now renamed to current name to represent
concentration not only with fuzzy numbers, making intervals default.
All equations refer to the following work:
Wehrle (2015) Design ... | [
"numpy.resize",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.patches.Rectangle",
"matplotlib.rcParams.update",
"numpy.max",
"numpy.linspace",
"matplotlib.pyplot.AutoLocator",
"numpy.trapz",
"numpy.size",
"matplotlib.pyplot.ylim",
"numpy.flipud",
"numpy.min",
"ma... | [((720, 764), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (729, 764), True, 'import numpy as np\n'), ((11393, 11405), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (11403, 11405), True, 'import matplotlib.pyplot as plt\... |
# Copyright 2021-2022 The DADApy 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 applic... | [
"numpy.allclose",
"os.path.split",
"dadapy.DensityEstimation",
"numpy.load"
] | [((1482, 1514), 'dadapy.DensityEstimation', 'DensityEstimation', ([], {'coordinates': 'X'}), '(coordinates=X)\n', (1499, 1514), False, 'from dadapy import DensityEstimation\n'), ((1561, 1602), 'numpy.allclose', 'np.allclose', (['de.log_den', 'expected_log_den'], {}), '(de.log_den, expected_log_den)\n', (1572, 1602), Tr... |
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
import os, csv
import numpy as np
from pyxrd.generic.io.utils import get_case_insensitive_glob
from pyxrd.generic.utils import u
from ..csv_base_parser import CSVBaseParser
f... | [
"numpy.array",
"pyxrd.generic.io.utils.get_case_insensitive_glob",
"csv.reader",
"os.path.basename"
] | [((5018, 5078), 'pyxrd.generic.io.utils.get_case_insensitive_glob', 'get_case_insensitive_glob', (['"""*.DAT"""', '"""*.CSV"""', '"""*.TAB"""', '"""*.XY"""'], {}), "('*.DAT', '*.CSV', '*.TAB', '*.XY')\n", (5043, 5078), False, 'from pyxrd.generic.io.utils import get_case_insensitive_glob\n'), ((3318, 3345), 'csv.reader'... |
from collections import defaultdict
from e2cnn.gspaces import *
from e2cnn.nn import FieldType
from e2cnn.nn import GeometricTensor
from ..equivariant_module import EquivariantModule
import torch
from torch.nn import Parameter
from typing import List, Tuple, Any, Union
import numpy as np
__all__ = ["GNormBatchNor... | [
"torch.LongTensor",
"collections.defaultdict",
"torch.einsum",
"torch.empty_like",
"numpy.eye",
"e2cnn.nn.GeometricTensor",
"torch.tensor"
] | [((1805, 1821), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1816, 1821), False, 'from collections import defaultdict\n'), ((1932, 1956), 'collections.defaultdict', 'defaultdict', (['(lambda : [])'], {}), '(lambda : [])\n', (1943, 1956), False, 'from collections import defaultdict\n'), ((7490, 7... |
import numpy as np
def kernel(A, b):
x = np.zeros_like(b)
y = np.zeros_like(b)
for i in range(A.shape[0]):
for j in range(i):
A[i, j] -= A[i, :j] @ A[:j, j]
A[i, j] /= A[j, j]
for j in range(i, A.shape[0]):
A[i, j] -= A[i, :i] @ A[:i, j]
for i in r... | [
"numpy.zeros_like"
] | [((48, 64), 'numpy.zeros_like', 'np.zeros_like', (['b'], {}), '(b)\n', (61, 64), True, 'import numpy as np\n'), ((73, 89), 'numpy.zeros_like', 'np.zeros_like', (['b'], {}), '(b)\n', (86, 89), True, 'import numpy as np\n')] |
"""
Speedml Feature component with methods that work on dataset features or the feature engineering workflow. Contact author https://twitter.com/manavsehgal. Code, docs and demos https://speedml.com.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from b... | [
"numpy.percentile",
"re.search",
"sklearn.preprocessing.LabelEncoder"
] | [((7557, 7579), 're.search', 're.search', (['regex', 'text'], {}), '(regex, text)\n', (7566, 7579), False, 'import re\n'), ((8443, 8457), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (8455, 8457), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((3403, 3445), 'numpy.percentile', '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import argparse
import os
import json
import glob
import random
import collections
import math
import time
from utils import *
from dataset import *
... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"tensorflow.trainable_variables",
"tensorflow.train.latest_checkpoint",
"tensorflow.RunOptions",
"os.path.join",
"random.randint",
"os.path.exists",
"tensorflow.set_random_seed",
"tensorflow.summary.histogram",
"random.seed",
"tensorflow.map_fn",... | [((373, 398), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (396, 398), False, 'import argparse\n'), ((3451, 3480), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['args.seed'], {}), '(args.seed)\n', (3469, 3480), True, 'import tensorflow as tf\n'), ((3486, 3511), 'numpy.random.seed', 'n... |
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import RandomizedSearchCV,train_test_split
import numpy as np
import pandas as pd
import warnings
warnings.simplefilter('ignore')
def logisticregression(x,y):
xtrain,xtest,ytrain,ytest=train_test_split(x,y,test_size=0.3,random... | [
"warnings.simplefilter",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.RandomizedSearchCV",
"numpy.append",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"numpy.arange"
] | [((184, 215), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (205, 215), False, 'import warnings\n'), ((279, 346), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.3)', 'random_state': '(4)', 'shuffle': '(True)'}), '(x, y, test_siz... |
# 5 Layer DNN for digits 0 to 4 of MNIST
# 100 neurons in each layer
# ADAM optimization and early stopping
# Import modules and data
import tensorflow as tf
import numpy as np
from tensorflow.contrib.layers import fully_connected, batch_norm, dropout
from tensorflow.examples.tutorials.mnist import input_data
# Set r... | [
"numpy.random.seed",
"tensorflow.contrib.learn.MetricSpec",
"tensorflow.nn.in_top_k",
"tensorflow.contrib.layers.fully_connected",
"tensorflow.global_variables_initializer",
"tensorflow.reduce_mean",
"tensorflow.contrib.framework.arg_scope",
"tensorflow.Session",
"tensorflow.set_random_seed",
"ten... | [((331, 354), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(123)'], {}), '(123)\n', (349, 354), True, 'import tensorflow as tf\n'), ((355, 374), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (369, 374), True, 'import numpy as np\n'), ((591, 630), 'tensorflow.examples.tutorials.mnist.input... |
"""
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 <NAME>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
ht... | [
"numpy.random.uniform",
"numpy.sum",
"numpy.concatenate",
"ext.lab2im.utils.get_volume_info",
"numpy.empty",
"ext.lab2im.utils.add_axis",
"numpy.any",
"numpy.where",
"numpy.arange",
"numpy.random.normal",
"numpy.eye",
"ext.lab2im.utils.draw_value_from_distribution",
"numpy.unique"
] | [((4858, 4899), 'ext.lab2im.utils.get_volume_info', 'utils.get_volume_info', (['path_label_maps[0]'], {}), '(path_label_maps[0])\n', (4879, 4899), False, 'from ext.lab2im import utils\n'), ((5042, 5061), 'numpy.arange', 'np.arange', (['n_labels'], {}), '(n_labels)\n', (5051, 5061), True, 'import numpy as np\n'), ((5082... |
# Copyright 2015 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.ops.random_ops.random_crop",
"numpy.zeros",
"tensorflow.python.framework.test_util.use_gpu",
"numpy.random.randint",
"numpy.arange",
"tensorflow.python.ops.random_ops.stateless_random_crop",
"numpy.sqrt",
"numpy.prod",
"numpy.repeat"
] | [((5947, 5958), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (5956, 5958), False, 'from tensorflow.python.platform import test\n'), ((2160, 2174), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (2167, 2174), True, 'import numpy as np\n'), ((2579, 2614), 'numpy.repeat', 'np.repeat', (['... |
import sys
sys.path.append("..")
import numpy as np
import cv2
from matplotlib import pyplot as plt
# mpl.rcParams['figure.figsize'] = 50, 25
import math
import sys
import dcraw_utils
from other.image_utils import findAllSuffix, findRawImage
def image_hist(image):
# 3-channel RGB image
color = {"red", "green",... | [
"sys.path.append",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"other.image_utils.findRawImage",
"cv2.imread",
"matplotlib.pyplot.figure",
"numpy.mean",
"math.log10",
"dcraw_utils.importRawImage",
"cv2.absdiff",
"other.image_utils.findAllSuffix"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((544, 554), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (552, 554), True, 'from matplotlib import pyplot as plt\n'), ((600, 639), 'cv2.imread', 'cv2.imread', (['path1', 'cv2.IMREAD_UNCHANGED'... |
# -*- coding: utf-8 -*-
"""
Tests of neo.io.exampleio
"""
# needed for python 3 compatibility
from __future__ import absolute_import, division
import warnings
import unittest
import quantities as pq
import numpy as np
from neo.io.nestio import ColumnIO
from neo.io.nestio import NestIO
from neo.test.iotest.common_io... | [
"unittest.main",
"neo.test.iotest.common_io_test.BaseTestIO.setUp",
"warnings.simplefilter",
"neo.io.nestio.ColumnIO",
"numpy.testing.assert_array_equal",
"neo.test.iotest.tools.get_test_file_full_path",
"numpy.max",
"numpy.where",
"numpy.arange",
"numpy.loadtxt",
"neo.io.nestio.NestIO",
"warn... | [((33993, 34008), 'unittest.main', 'unittest.main', ([], {}), '()\n', (34006, 34008), False, 'import unittest\n'), ((1509, 1645), 'neo.test.iotest.tools.get_test_file_full_path', 'get_test_file_full_path', ([], {'ioclass': 'NestIO', 'filename': '"""0gid-1time-2gex-3Vm-1261-0.dat"""', 'directory': 'self.local_test_dir',... |
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
def get_global_score(npz_path: str):
x = np.load(npz_path)
global_score = np.mean(x['lddt'])
return global_score
def get_df(dir_path: Path) -> pd.DataFrame:
model_name_list = []
global_score_list = []
for npz_... | [
"pandas.DataFrame",
"numpy.load",
"argparse.ArgumentParser",
"pandas.merge",
"pathlib.Path",
"numpy.mean"
] | [((128, 145), 'numpy.load', 'np.load', (['npz_path'], {}), '(npz_path)\n', (135, 145), True, 'import numpy as np\n'), ((165, 183), 'numpy.mean', 'np.mean', (["x['lddt']"], {}), "(x['lddt'])\n", (172, 183), True, 'import numpy as np\n'), ((541, 610), 'pandas.DataFrame', 'pd.DataFrame', (['{method_name: global_score_list... |
import os
import matplotlib.pyplot as plt
import numpy as np
def get_actor_data():
actor_csv = [ f for f in os.listdir() if '.csv' in f]
actor_data = {}
for csv in actor_csv:
###use exploration rate as the key, truncate because its a float
explore_rate = csv.split('.csv')[0][:4]
ac... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.amin",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.legend",
"numpy.genfromtxt",
"numpy.amax",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.listdir",
"numpy.concatenate"
] | [((567, 604), 'numpy.amin', 'np.amin', (['[data[d].size for d in data]'], {}), '([data[d].size for d in data])\n', (574, 604), True, 'import numpy as np\n'), ((621, 660), 'numpy.concatenate', 'np.concatenate', (['[data[d] for d in data]'], {}), '([data[d] for d in data])\n', (635, 660), True, 'import numpy as np\n'), (... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
try:
# try with fopenmp
ext = Extension("pysapc.sparseAP_cy", ['pysapc/sparseAP_cy.pyx'],
extra_compile_args=['-fopenmp'],
extra_link_a... | [
"numpy.get_include",
"distutils.core.setup"
] | [((419, 888), 'distutils.core.setup', 'setup', ([], {'name': '"""pysapc"""', 'version': '"""1.2.0"""', 'description': '"""Sparse Affinity Propagation Clustering"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/bioinfocao/pysapc"""', 'license': '"""BSD 3 clause"""', 'packages... |
import unittest
import numpy as np
import pandas as pd
from pydatview.tools.signal import *
# --------------------------------------------------------------------------------}
# ---
# --------------------------------------------------------------------------------{
class TestSignal(unittest.TestCase):
def test_... | [
"unittest.main",
"pandas.DataFrame",
"numpy.array",
"numpy.all"
] | [((2151, 2166), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2164, 2166), False, 'import unittest\n'), ((909, 930), 'numpy.array', 'np.array', (['[-1, 1, -1]'], {}), '([-1, 1, -1])\n', (917, 930), True, 'import numpy as np\n'), ((954, 978), 'numpy.all', 'np.all', (['(xz == [0.5, 1.5])'], {}), '(xz == [0.5, 1.5]... |
from __future__ import print_function
import Queue
import sys
import random
import numpy as np
def make(filename):
""" build a graph """
fin = open(filename, "r")
linenum = 0
graph = None
no_weight = False
for line in fin:
# print ("line " + line)
values = line.split("\t")
... | [
"numpy.matrix",
"numpy.sum",
"Queue.Queue",
"numpy.linalg.matrix_power",
"numpy.matrix.trace"
] | [((4475, 4495), 'numpy.sum', 'np.sum', (['self.data[u]'], {}), '(self.data[u])\n', (4481, 4495), True, 'import numpy as np\n'), ((9497, 9510), 'Queue.Queue', 'Queue.Queue', ([], {}), '()\n', (9508, 9510), False, 'import Queue\n'), ((10662, 10675), 'Queue.Queue', 'Queue.Queue', ([], {}), '()\n', (10673, 10675), False, '... |
import random
import numpy as np
from maskrcnn_benchmark.augmentations.image_level_augs.zoom_in import Zoom_in
from maskrcnn_benchmark.augmentations.image_level_augs.zoom_out import Zoom_out
from maskrcnn_benchmark.augmentations.image_level_augs.scale_jitter import scale_jitter
class Img_augs(object):
def __init_... | [
"maskrcnn_benchmark.augmentations.image_level_augs.zoom_out.Zoom_out",
"random.random",
"maskrcnn_benchmark.augmentations.image_level_augs.scale_jitter.scale_jitter",
"numpy.linspace",
"maskrcnn_benchmark.augmentations.image_level_augs.zoom_in.Zoom_in"
] | [((614, 683), 'maskrcnn_benchmark.augmentations.image_level_augs.zoom_in.Zoom_in', 'Zoom_in', ([], {'ratio': "zoom_in_ratio_range[img_augs_dict['zoom_in']['level']]"}), "(ratio=zoom_in_ratio_range[img_augs_dict['zoom_in']['level']])\n", (621, 683), False, 'from maskrcnn_benchmark.augmentations.image_level_augs.zoom_in ... |
import h5py
import numpy as np
import glob
import torch
from torch.utils.data import Dataset
import os
import subprocess
import shlex
from utils import strided_app
class Loader(Dataset):
def __init__(self, hdf5_name, transformation):
super(Loader, self).__init__()
self.hdf5_name = hdf5_name
self.transformation... | [
"h5py.File",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torch.LongTensor",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.ToPILImage",
"torchvision.transforms.ToTensor",
"numpy.random.permutation",
"torchvision.transforms.Normalize",
"torchvision.transforms.... | [((2246, 2301), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test data loader"""'}), "(description='Test data loader')\n", (2269, 2301), False, 'import argparse\n'), ((2732, 2817), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': '(10)', 'shuff... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 5 18:51:37 2019
Filtro FIR (Prueba2)
Tecnológico Nacional de México
Tecnológico de Estudios Superiores de Ixtapaluca
División de Ingeniería Electrónica
@author: <NAME>
"""
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
f1=0.1 #Frec... | [
"numpy.absolute",
"matplotlib.pyplot.legend",
"scipy.signal.firwin",
"numpy.sin",
"numpy.random.normal",
"numpy.linspace",
"scipy.signal.freqz",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.grid"
] | [((589, 616), 'numpy.linspace', 'np.linspace', (['(0)', '(1200 * T)', 'n'], {}), '(0, 1200 * T, n)\n', (600, 616), True, 'import numpy as np\n'), ((696, 721), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'n'], {}), '(0, 1, n)\n', (712, 721), True, 'import numpy as np\n'), ((962, 1029), 'scipy.signal.firwi... |
#!/usr/bin/env python
"""
Test the effect of different linear taper angles/lengths on S11 and S21.
"""
import numpy as np
from pyems.pcb import common_pcbs
from pyems.simulation import Simulation
from pyems.utilities import print_table
from pyems.structure import PCB, Microstrip
from pyems.coordinate import Box2, Coor... | [
"pyems.mesh.Mesh",
"pyems.coordinate.Coordinate3",
"pyems.coordinate.Coordinate2",
"numpy.arange",
"pyems.simulation.Simulation",
"pyems.coordinate.Axis"
] | [((482, 530), 'numpy.arange', 'np.arange', (['(0)', '(18000000000.0 + freq_res)', 'freq_res'], {}), '(0, 18000000000.0 + freq_res, freq_res)\n', (491, 530), True, 'import numpy as np\n'), ((696, 762), 'pyems.simulation.Simulation', 'Simulation', ([], {'freq': 'freq', 'unit': 'unit', 'reference_frequency': '(5600000000.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.