code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
A collection of Algos used to create Strategy logic.
"""
from __future__ import division
import abc
import random
import re
import numpy as np
import pandas as pd
import sklearn.covariance
from future.utils import iteritems
import bt
from bt.core import Algo, AlgoStack, SecurityBase, is_zero
def run_always(f):... | [
"bt.ffn.limit_weights",
"bt.ffn.to_returns",
"numpy.isnan",
"numpy.linalg.pinv",
"pandas.DataFrame",
"pandas.DateOffset",
"future.utils.iteritems",
"bt.ffn.random_weights",
"pandas.to_datetime",
"pandas.Series",
"bt.core.is_zero",
"numpy.linalg.inv",
"bt.ffn.get_num_days_required",
"re.com... | [((2425, 2440), 'pdb.set_trace', 'pdb.set_trace', ([], {}), '()\n', (2438, 2440), False, 'import pdb\n'), ((9709, 9729), 'pandas.to_datetime', 'pd.to_datetime', (['date'], {}), '(date)\n', (9723, 9729), True, 'import pandas as pd\n'), ((16807, 16830), 'pandas.DateOffset', 'pd.DateOffset', ([], {'months': '(3)'}), '(mon... |
import tensorflow as tf
import numpy as np
from path_explain.utils import set_up_environment
from path_explain.path_explainer_tf import PathExplainerTF
from preprocess import higgs_dataset
from train import build_model
from absl import app
from absl import flags
FLAGS = flags.FLAGS
flags.DEFINE_integer('num_examples... | [
"numpy.save",
"path_explain.utils.set_up_environment",
"numpy.sum",
"preprocess.higgs_dataset",
"numpy.zeros",
"tensorflow.concat",
"train.build_model",
"absl.app.run",
"absl.flags.DEFINE_integer",
"numpy.concatenate",
"path_explain.path_explainer_tf.PathExplainerTF"
] | [((286, 376), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""num_examples"""', '(10000)', '"""Number of inputs to run attributions on"""'], {}), "('num_examples', 10000,\n 'Number of inputs to run attributions on')\n", (306, 376), False, 'from absl import flags\n'), ((373, 473), 'absl.flags.DEFINE_intege... |
import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
import torch
import torch.nn.functional as F
import torch.nn as nn
def encode(item):
index = [0, 3, 4, 5]
year = np.zeros((3))
y... | [
"torch.nn.MSELoss",
"torch.from_numpy",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"sklearn.linear_model.Lasso",
"numpy.append",
"numpy.array",
"numpy.tile",
"numpy.reshape",
"torch.nn.Linear",
"numpy.delete",
"numpy.concatenate",
"sklearn.metrics.mean_sq... | [((3545, 3620), 'sklearn.model_selection.train_test_split', 'train_test_split', (['male_train_x', 'male_train_y'], {'test_size': '(100)', 'random_state': '(0)'}), '(male_train_x, male_train_y, test_size=100, random_state=0)\n', (3561, 3620), False, 'from sklearn.model_selection import train_test_split\n'), ((3664, 3743... |
from matplotlib import pyplot as plt
import numpy as np
from fractions import Fraction
f13=Fraction('1/3')
f23=Fraction('2/3')
f43=Fraction('4/3')
f53=Fraction('5/3')
f12=Fraction('1/2')
f32=Fraction('3/2')
f56=Fraction('5/6')
fm1=Fraction('-1')
fm23=Fraction('-2/3')
fm32=Fraction('-3/2')
#Powers of t9 from original co... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"fractions.Fraction",
"matplotlib.pyplot.xlabel"
] | [((91, 106), 'fractions.Fraction', 'Fraction', (['"""1/3"""'], {}), "('1/3')\n", (99, 106), False, 'from fractions import Fraction\n'), ((111, 126), 'fractions.Fraction', 'Fraction', (['"""2/3"""'], {}), "('2/3')\n", (119, 126), False, 'from fractions import Fraction\n'), ((131, 146), 'fractions.Fraction', 'Fraction', ... |
# PyPore
#
# Idea: GUI for porE
#
# Author: <NAME>
# Dates:
# 06.01.2020 -- init, pore functions
# 09.01.2020 -- use new pore.f90 files
# build user input
# pore and get_psd are working
# 10.01.2020 -- include all Fortr... | [
"os.listdir",
"os.open",
"os.remove",
"os.dup2",
"ase.visualize.view",
"os.dup",
"os.path.exists",
"numpy.zeros",
"tkinter.filedialog.askopenfilename",
"tkinter.ttk.Frame",
"os.close",
"ase.io.read",
"os.chdir",
"numpy.sqrt"
] | [((12380, 12396), 'numpy.zeros', 'np.zeros', (['[3, 3]'], {}), '([3, 3])\n', (12388, 12396), True, 'import numpy as np\n'), ((13644, 13660), 'numpy.zeros', 'np.zeros', (['[3, 3]'], {}), '([3, 3])\n', (13652, 13660), True, 'import numpy as np\n'), ((23857, 23870), 'tkinter.ttk.Frame', 'Frame', (['newwin'], {}), '(newwin... |
import sys
from PIL import Image
import numpy as np
import argparse
import datetime
def create_namespace():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-i', '--image', default=None, metavar='',
help='set image to transform into a mosaic in grayscale')
... | [
"numpy.full",
"numpy.sum",
"argparse.ArgumentParser",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"datetime.datetime.now"
] | [((135, 160), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (158, 160), False, 'import argparse\n'), ((2991, 3013), 'PIL.Image.fromarray', 'Image.fromarray', (['array'], {}), '(array)\n', (3006, 3013), False, 'from PIL import Image\n'), ((611, 633), 'PIL.Image.open', 'Image.open', (['image_nam... |
# def test(a):
# return a
import numpy as np
import textblob
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
import nltk
def test(input_):
nltk.data.path.append("/data/data/cau.injiyong.slight/files/nltk_data")
B_INCR = 0.293
... | [
"sklearn.feature_extraction.text.CountVectorizer",
"nltk.tokenize.TreebankWordTokenizer",
"numpy.maximum",
"numpy.sum",
"numpy.log",
"sklearn.feature_extraction.text.TfidfVectorizer",
"textblob.Word",
"numpy.asfarray",
"nltk.data.path.append",
"nltk.tokenize.sent_tokenize",
"textblob.TextBlob"
] | [((224, 295), 'nltk.data.path.append', 'nltk.data.path.append', (['"""/data/data/cau.injiyong.slight/files/nltk_data"""'], {}), "('/data/data/cau.injiyong.slight/files/nltk_data')\n", (245, 295), False, 'import nltk\n'), ((10718, 10752), 'textblob.TextBlob', 'textblob.TextBlob', (["(input_ + ' (s)')"], {}), "(input_ + ... |
"""
@author sanjeethr, oligoglot
Thanks to <NAME> for this step by step guide: https://towardsdatascience.com/multi-class-text-classification-with-lstm-1590bee1bd17
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import sys, os
from keras.preprocessing.text import Tokenizer
from keras.prepro... | [
"sklearn.preprocessing.LabelBinarizer",
"numpy.argmax",
"pandas.read_csv",
"keras.preprocessing.sequence.pad_sequences",
"keras.Sequential",
"sklearn.metrics.classification_report",
"indicnlp.normalize.indic_normalize.BaseNormalizer",
"lib.feature_utils.get_doc_len_range",
"os.path.dirname",
"kera... | [((1125, 1186), 'indictrans.Transliterator', 'Transliterator', ([], {'source': '"""eng"""', 'target': '"""tam"""', 'build_lookup': '(True)'}), "(source='eng', target='tam', build_lookup=True)\n", (1139, 1186), False, 'from indictrans import Transliterator\n'), ((1198, 1259), 'indictrans.Transliterator', 'Transliterator... |
"""Filters module with a class to manage filters/algorithms for polydata datasets."""
import collections.abc
import logging
import numpy as np
import pyvista
from pyvista import (
abstract_class, _vtk, NORMALS, generate_plane, assert_empty_kwargs, vtk_id_list_to_array, get_array
)
from pyvista.core.errors import ... | [
"pyvista.core.filters._update_alg",
"numpy.sum",
"pyvista.core.filters._get_output",
"pyvista._vtk.vtkRotationalExtrusionFilter",
"numpy.empty",
"pyvista.assert_empty_kwargs",
"pyvista._vtk.vtkPlaneCollection",
"pyvista._vtk.vtkPolyDataNormals",
"numpy.arange",
"numpy.linalg.norm",
"pyvista._vtk... | [((1020, 1049), 'numpy.arange', 'np.arange', (['poly_data.n_points'], {}), '(poly_data.n_points)\n', (1029, 1049), True, 'import numpy as np\n'), ((1073, 1095), 'pyvista._vtk.vtkFeatureEdges', '_vtk.vtkFeatureEdges', ([], {}), '()\n', (1093, 1095), False, 'from pyvista import abstract_class, _vtk, NORMALS, generate_pla... |
# OS libraries
import os
import copy
import queue
import argparse
import scipy.misc
import numpy as np
from tqdm import tqdm
# Pytorch
import torch
import torch.nn as nn
# Customized libraries
from libs.test_utils import *
from libs.model import transform
from libs.utils import norm_mask
from libs.model import Model_... | [
"libs.model.Model_switchGTfixdot_swCC_Res",
"copy.deepcopy",
"os.makedirs",
"argparse.ArgumentParser",
"torch.load",
"torch.nn.DataParallel",
"torch.max",
"numpy.array",
"torch.cuda.set_device",
"torch.nn.functional.interpolate",
"torch.no_grad",
"os.path.join",
"queue.Queue"
] | [((476, 501), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (499, 501), False, 'import argparse\n'), ((1983, 2037), 'os.path.join', 'os.path.join', (['args.davis_dir', '"""ImageSets/2017/val.txt"""'], {}), "(args.davis_dir, 'ImageSets/2017/val.txt')\n", (1995, 2037), False, 'import os\n'), ((2... |
from holoviews.element import RGB, Tiles, Points, Bounds
from holoviews.element.tiles import StamenTerrain, _ATTRIBUTIONS
from .test_plot import TestPlotlyPlot, plotly_renderer
import numpy as np
class TestMapboxTilesPlot(TestPlotlyPlot):
def setUp(self):
super().setUp()
# Precompute coordinates
... | [
"holoviews.element.tiles.StamenTerrain",
"holoviews.element.RGB",
"holoviews.element.Points",
"numpy.array",
"holoviews.element.Tiles.easting_northing_to_lon_lat",
"numpy.random.rand",
"holoviews.element.Tiles",
"holoviews.element.Bounds"
] | [((638, 699), 'holoviews.element.Tiles.easting_northing_to_lon_lat', 'Tiles.easting_northing_to_lon_lat', (['self.x_range', 'self.y_range'], {}), '(self.x_range, self.y_range)\n', (671, 699), False, 'from holoviews.element import RGB, Tiles, Points, Bounds\n'), ((745, 812), 'holoviews.element.Tiles.easting_northing_to_... |
"""A collection of shared utilities for all encoders, not intended for external use."""
import pandas as pd
import numpy as np
from scipy.sparse.csr import csr_matrix
__author__ = 'willmcginnis'
def convert_cols_to_list(cols):
if isinstance(cols, pd.Series):
return cols.tolist()
elif isinstance(cols... | [
"pandas.DataFrame",
"numpy.size",
"numpy.isscalar",
"pandas.api.types.is_categorical_dtype",
"numpy.shape",
"pandas.Series"
] | [((954, 994), 'pandas.api.types.is_categorical_dtype', 'pd.api.types.is_categorical_dtype', (['dtype'], {}), '(dtype)\n', (987, 994), True, 'import pandas as pd\n'), ((373, 390), 'numpy.isscalar', 'np.isscalar', (['cols'], {}), '(cols)\n', (384, 390), True, 'import numpy as np\n'), ((2751, 2777), 'pandas.DataFrame', 'p... |
import mne
import numpy as np
import pandas as pd
from mne.beamformer import make_lcmv, apply_lcmv
from scipy.stats import pearsonr
import config
from config import fname, lcmv_settings
from time_series import simulate_raw, create_epochs
# Don't be verbose
mne.set_log_level(False)
fn_stc_signal = fname.stc_signal(ve... | [
"pandas.DataFrame",
"config.fname.stc_signal",
"mne.io.read_raw_fif",
"time_series.simulate_raw",
"numpy.abs",
"mne.pick_types",
"mne.beamformer.apply_lcmv",
"time_series.create_epochs",
"mne.set_log_level",
"mne.pick_types_forward",
"mne.beamformer.make_lcmv",
"mne.compute_covariance",
"mne... | [((259, 283), 'mne.set_log_level', 'mne.set_log_level', (['(False)'], {}), '(False)\n', (276, 283), False, 'import mne\n'), ((301, 339), 'config.fname.stc_signal', 'fname.stc_signal', ([], {'vertex': 'config.vertex'}), '(vertex=config.vertex)\n', (317, 339), False, 'from config import fname, lcmv_settings\n'), ((359, 4... |
"""Test training of sensor classification k-fold validation."""
import os
import torch
from iotai_sensor_classification.dataset import read_dataset, read_recordings
from iotai_sensor_classification.model_handler import ModelCall
from iotai_sensor_classification.evaluation import evaluate_prediction
from data.gesture... | [
"os.makedirs",
"iotai_sensor_classification.evaluation.evaluate_prediction",
"sklearn.model_selection.train_test_split",
"os.path.dirname",
"torch.load",
"iotai_sensor_classification.model_handler.ModelCall",
"sklearn.model_selection.KFold",
"iotai_sensor_classification.preprocess.check_windows",
"o... | [((657, 716), 'os.path.join', 'os.path.join', (['"""test_output"""', '"""gestures"""', '"""trainer"""', '"""kfold"""'], {}), "('test_output', 'gestures', 'trainer', 'kfold')\n", (669, 716), False, 'import os\n'), ((989, 1049), 'iotai_sensor_classification.preprocess.check_windows', 'check_windows', (['recordings'], {'w... |
# Scatter plot of a gaussian distribution
# with varying color and point sizes
from vedo import *
from vedo.pyplot import plot
import numpy as np
n = 1000
x = np.random.randn(n)
y = np.random.randn(n)
# define what size must have each marker:
marker_sizes = np.sin(2*x)/8
# define a (r,g,b) list of colors for each ma... | [
"numpy.random.randn",
"numpy.zeros",
"vedo.pyplot.plot",
"numpy.sin",
"numpy.cos"
] | [((160, 178), 'numpy.random.randn', 'np.random.randn', (['n'], {}), '(n)\n', (175, 178), True, 'import numpy as np\n'), ((183, 201), 'numpy.random.randn', 'np.random.randn', (['n'], {}), '(n)\n', (198, 201), True, 'import numpy as np\n'), ((457, 535), 'vedo.pyplot.plot', 'plot', (['x', 'y'], {'ma': '(0.3)', 'lw': '(0)'... |
import torch
import math
import random
from pycm import ConfusionMatrix
import time
import os
import cv2
import sys
from pytorch_metric_learning import losses, testers
from pytorch_metric_learning.utils.accuracy_calculator import AccuracyCalculator
from pytorch_grad_cam import (
GradCAM,
ScoreCAM,
GradCAMPl... | [
"numpy.random.seed",
"torch.argmax",
"pytorch_grad_cam.utils.image.show_cam_on_image",
"torch.cat",
"torch.no_grad",
"os.path.dirname",
"os.path.exists",
"torch.FloatTensor",
"pytorch_metric_learning.testers.BaseTester",
"random.seed",
"torch.utils.tensorboard.SummaryWriter",
"pycm.ConfusionMa... | [((2015, 2030), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2028, 2030), False, 'import torch\n'), ((2706, 2721), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2719, 2721), False, 'import torch\n'), ((577, 602), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (592, 602), False,... |
import os
import numpy as np
from dtcwt.compat import dtwavexfm2, dtwaveifm2
from dtcwt.coeffs import biort, qshift
import tests.datasets as datasets
TOLERANCE = 1e-12
def setup():
global mandrill, mandrill_crop
mandrill = datasets.mandrill().astype(np.float64)
mandrill_crop = mandrill[:233, :301]
def t... | [
"dtcwt.compat.dtwaveifm2",
"numpy.abs",
"dtcwt.compat.dtwavexfm2",
"numpy.issubsctype",
"dtcwt.coeffs.qshift",
"tests.datasets.mandrill",
"dtcwt.coeffs.biort"
] | [((560, 580), 'dtcwt.compat.dtwavexfm2', 'dtwavexfm2', (['mandrill'], {}), '(mandrill)\n', (570, 580), False, 'from dtcwt.compat import dtwavexfm2, dtwaveifm2\n'), ((602, 620), 'dtcwt.compat.dtwaveifm2', 'dtwaveifm2', (['Yl', 'Yh'], {}), '(Yl, Yh)\n', (612, 620), False, 'from dtcwt.compat import dtwavexfm2, dtwaveifm2\... |
"""
Please see
https://computationalmindset.com/en/neural-networks/ordinary-differential-equation-solvers.html#sys1
for details
"""
import numpy as np
import matplotlib.pyplot as plt
import torch
from neurodiffeq import diff
from neurodiffeq.ode import solve_system
from neurodiffeq.ode import IVP
from neurodiffeq.ode... | [
"matplotlib.pyplot.title",
"neurodiffeq.diff",
"neurodiffeq.ode.IVP",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.linspace",
"neurodiffeq.ode.Monitor",
"matplotlib.pyplot.xlabel",
"neurodiffeq.networks.FCNN"
] | [((622, 661), 'numpy.linspace', 'np.linspace', (['t_begin', 't_end', 't_nsamples'], {}), '(t_begin, t_end, t_nsamples)\n', (633, 661), True, 'import numpy as np\n'), ((671, 696), 'neurodiffeq.ode.IVP', 'IVP', ([], {'t_0': 't_begin', 'x_0': '(2.0)'}), '(t_0=t_begin, x_0=2.0)\n', (674, 696), False, 'from neurodiffeq.ode ... |
import pdb
import os
import argparse
import matplotlib
import numpy as np
import sys # NOQA
sys.path.insert(0, '..') # NOQA: E402
from envs.gridworld_drone import GridWorldDrone as GridWorld
import utils
from logger.logger import Logger
parser = argparse.ArgumentParser()
parser.add_argument('--policy-path', type=s... | [
"featureExtractor.gridworld_featureExtractor.LocalGlobal",
"irlmethods.deep_maxent.DeepMaxEnt",
"argparse.ArgumentParser",
"numpy.asarray",
"logger.logger.Logger",
"sys.path.insert",
"featureExtractor.gridworld_featureExtractor.FrontBackSideSimple",
"featureExtractor.gridworld_featureExtractor.OneHot"... | [((94, 118), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (109, 118), False, 'import sys\n'), ((251, 276), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (274, 276), False, 'import argparse\n'), ((3070, 3099), 'logger.logger.Logger', 'Logger', (['base_folder',... |
# global
from typing import List, Optional, Union
import ivy
_round = round
import mxnet as mx
import numpy as np
from numbers import Number
import multiprocessing as _multiprocessing
# local
from ivy.functional.ivy.device import default_device
from ivy.functional.backends.mxnet.device import dev
from ivy.functional.... | [
"ivy.inplace_update",
"multiprocessing.get_context",
"mxnet.nd.split",
"ivy.is_ivy_array",
"mxnet.nd.concat",
"mxnet.nd.scatter_nd",
"ivy.exists",
"ivy.functional.backends.mxnet.device.dev",
"mxnet.nd.transpose",
"mxnet.nd.shape_array",
"ivy.dtype",
"mxnet.nd.ones_like",
"mxnet.nd.reshape",
... | [((1516, 1531), 'ivy.exists', 'ivy.exists', (['out'], {}), '(out)\n', (1526, 1531), False, 'import ivy\n'), ((1746, 1806), 'mxnet.nd.split', 'mx.nd.split', (['x', 'num_outputs', 'axis'], {'squeeze_axis': '(not keepdims)'}), '(x, num_outputs, axis, squeeze_axis=not keepdims)\n', (1757, 1806), True, 'import mxnet as mx\n... |
# License: Apache-2.0
import glob
import os
import platform
import numpy as np
import pytest
from lightgbm import LGBMClassifier
from gators.model_building.lgbm_treelite_dumper import LGBMTreeliteDumper
def test():
X_train = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
y_train = np.array([0, 1, 1, 0])
mod... | [
"os.remove",
"lightgbm.LGBMClassifier",
"gators.model_building.lgbm_treelite_dumper.LGBMTreeliteDumper.dump",
"pytest.raises",
"numpy.array",
"glob.glob",
"platform.system"
] | [((233, 275), 'numpy.array', 'np.array', (['[[0, 0], [0, 1], [1, 0], [1, 1]]'], {}), '([[0, 0], [0, 1], [1, 0], [1, 1]])\n', (241, 275), True, 'import numpy as np\n'), ((290, 312), 'numpy.array', 'np.array', (['[0, 1, 1, 0]'], {}), '([0, 1, 1, 0])\n', (298, 312), True, 'import numpy as np\n'), ((1216, 1258), 'numpy.arr... |
"""
Convert ACE data to our json format.
"""
import xml.etree.ElementTree as ET
import json
from os import path
import os
import re
import argparse
from dataclasses import dataclass
from typing import List
import spacy
from spacy.symbols import ORTH
import numpy as np
class AceException(Exception):
pass
class ... | [
"xml.etree.ElementTree.parse",
"os.makedirs",
"argparse.ArgumentParser",
"ipdb.set_trace",
"numpy.roll",
"json.dumps",
"numpy.cumsum",
"spacy.load",
"os.path.join",
"re.compile"
] | [((31298, 31363), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Preprocess ACE event data."""'}), "(description='Preprocess ACE event data.')\n", (31321, 31363), False, 'import argparse\n'), ((32050, 32088), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exist_ok': '(True)'}), '(outpu... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" The io.files module provides basic functions for working with file-based
images in nipy.
* load : load an image from a file
* save : save an image to a file
Examples
--------
See documentation for loa... | [
"nibabel.Spm2AnalyzeImage.from_image",
"numpy.dtype",
"os.path.splitext",
"nibabel.load"
] | [((1141, 1159), 'nibabel.load', 'nib.load', (['filename'], {}), '(filename)\n', (1149, 1159), True, 'import nibabel as nib\n'), ((5219, 5245), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (5235, 5245), False, 'import os\n'), ((3745, 3765), 'numpy.dtype', 'np.dtype', (['dtype_from'], {}), ... |
import random
from .operators import prod
from numpy import array, float64, ndarray
import numba
MAX_DIMS = 32
class IndexingError(RuntimeError):
"Exception raised for indexing errors."
pass
def index_to_position(index, strides):
"""
Converts a multidimensional tensor `index` into a single-dimensio... | [
"random.randint",
"numpy.array",
"numba.cuda.to_device",
"numba.cuda.is_cuda_array"
] | [((3646, 3660), 'numpy.array', 'array', (['strides'], {}), '(strides)\n', (3651, 3660), False, 'from numpy import array, float64, ndarray\n'), ((3683, 3695), 'numpy.array', 'array', (['shape'], {}), '(shape)\n', (3688, 3695), False, 'from numpy import array, float64, ndarray\n'), ((5155, 5172), 'numpy.array', 'array', ... |
#!/usr/bin/env python
# coding: utf-8
# Author:
# <NAME>
# Emotional Sentiment on Twitter
# A coronavirus vaccine online firestorm
# In this python script you will find examples of some of the most common
# NLP (Natural Language Processing) techniques used to uncover patterns of
# sentiment and emotion on social m... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"pandas.read_csv",
"sklearn.feature_extraction.text.TfidfVectorizer",
"wordcloud.WordCloud",
"matplotlib.pyplot.box",
"collections.defaultdict",
"numpy.argsort",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.style.use",
"sklearn.decomposition.Laten... | [((861, 892), 'pandas.read_csv', 'pd.read_csv', (['"""input/tweets.csv"""'], {}), "('input/tweets.csv')\n", (872, 892), True, 'import pandas as pd\n'), ((970, 1004), 'pandas.to_datetime', 'pd.to_datetime', (["tweets['datetime']"], {}), "(tweets['datetime'])\n", (984, 1004), True, 'import pandas as pd\n'), ((1082, 1110)... |
import numpy as np
def hmc(U, grad_U, eps, L, current_q, p_sampler):
q = current_q
p = p_sampler()
current_p = p
p -= eps * grad_U(q)/2.0
for i in range(L):
q = q + eps *p
if i != L-1:
p -= eps * grad_U(q)
p -= eps * grad_U(q)/2.0
p = -p
current_... | [
"numpy.random.uniform",
"numpy.exp"
] | [((454, 509), 'numpy.exp', 'np.exp', (['(current_U - proposed_U + current_K - proposed_K)'], {}), '(current_U - proposed_U + current_K - proposed_K)\n', (460, 509), True, 'import numpy as np\n'), ((517, 542), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(1)'}), '(size=1)\n', (534, 542), True, 'import num... |
import vplanet
import vplot
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pathlib
import sys
import glob
import subprocess
from tqdm import tqdm
from scipy.interpolate import interp2d
import os
# Path hacks
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(... | [
"sys.stdout.write",
"matplotlib.pyplot.figure",
"pathlib.Path",
"sys.stdout.flush",
"matplotlib.pyplot.tick_params",
"os.path.join",
"get_args.get_args",
"vplanet.get_output",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.fill_betweenx",
"matplotlib.pyplot.ylabel",
"os.listdir",
"matplotlib.p... | [((795, 827), 'sys.stdout.write', 'sys.stdout.write', (['"""Making plot."""'], {}), "('Making plot.')\n", (811, 827), False, 'import sys\n'), ((828, 846), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (844, 846), False, 'import sys\n'), ((869, 888), 'os.listdir', 'os.listdir', (['"""data/"""'], {}), "('data... |
# Copyright 2018 The Simons Foundation, Inc. - All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by appli... | [
"numpy.set_printoptions",
"netket.operator.LocalOperator",
"netket.exact.steady_state",
"netket.graph.Hypercube",
"netket.hilbert.Spin",
"numpy.kron",
"netket.utils.RandomEngine",
"netket.operator.LocalLiouvillian"
] | [((651, 685), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(180)'}), '(linewidth=180)\n', (670, 685), True, 'import numpy as np\n'), ((691, 723), 'netket.utils.RandomEngine', 'nk.utils.RandomEngine', ([], {'seed': '(1234)'}), '(seed=1234)\n', (712, 723), True, 'import netket as nk\n'), ((748, 79... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 3 22:21:32 2017
@author: yxl
"""
import wx
from imagepy.core.engine import Tool
import numpy as np
import pandas as pd
from numpy.linalg import norm
from .setting import Setting
from imagepy import IPy
class Distance:
"""Define the distance class"""
dtype = 'di... | [
"pandas.DataFrame",
"numpy.array",
"wx.Pen",
"numpy.linalg.norm",
"wx.Font"
] | [((1209, 1298), 'wx.Font', 'wx.Font', (['(10)', 'wx.FONTFAMILY_DEFAULT', 'wx.FONTSTYLE_NORMAL', 'wx.FONTWEIGHT_NORMAL', '(False)'], {}), '(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.\n FONTWEIGHT_NORMAL, False)\n', (1216, 1298), False, 'import wx\n'), ((1095, 1144), 'wx.Pen', 'wx.Pen', (["Setting['color']"],... |
# -*- coding: utf-8 -*-
"""
@author: hkaneko
"""
import math
import sys
import numpy as np
import pandas as pd
import sample_functions
from sklearn import metrics, model_selection, svm
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split, GridSearchCV
... | [
"pandas.DataFrame",
"numpy.ceil",
"math.ceil",
"numpy.random.rand",
"sklearn.model_selection.train_test_split",
"pandas.to_pickle",
"sample_functions.gamma_optimization_with_variance",
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.cross_val_predict",
"sklearn.neighbors.KNeighborsClass... | [((2093, 2183), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': 'number_of_test_samples', 'shuffle': '(True)', 'random_state': '(0)'}), '(x, y, test_size=number_of_test_samples, shuffle=True,\n random_state=0)\n', (2109, 2183), False, 'from sklearn.model_selection import tr... |
#-*- coding:utf-8 -*-
import os
import os.path
import sys
import cv2
import random
import torch
import torch.utils.data as data
import numpy as np
from utils import matrix_iof
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
WIDER_CLASSES = ('__backgrou... | [
"numpy.minimum",
"numpy.maximum",
"random.randint",
"torch.stack",
"random.uniform",
"cv2.cvtColor",
"numpy.empty",
"numpy.logical_and",
"numpy.expand_dims",
"numpy.hstack",
"random.randrange",
"numpy.array",
"torch.is_tensor",
"numpy.vstack",
"utils.matrix_iof",
"os.path.join",
"cv2... | [((2564, 2583), 'random.randrange', 'random.randrange', (['(2)'], {}), '(2)\n', (2580, 2583), False, 'import random\n'), ((4005, 4024), 'random.randrange', 'random.randrange', (['(2)'], {}), '(2)\n', (4021, 4024), False, 'import random\n'), ((4107, 4127), 'random.uniform', 'random.uniform', (['(1)', 'p'], {}), '(1, p)\... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import logging
from absl import app
import os
import torch
import argparse
import nfsp_arm
import numpy as np
from open_spiel.python import policy
from open_spiel.python import rl_environment
from o... | [
"open_spiel.python.rl_environment.TimeStep",
"open_spiel.python.algorithms.exploitability.exploitability",
"numpy.random.seed",
"argparse.ArgumentParser",
"nfsp_arm.NFSP_ARM",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"torch.cuda.is_available",
"open_spiel.python.rl_environment.Environment"... | [((1565, 1627), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""NFSP LONR in kuhn args."""'}), "(description='NFSP LONR in kuhn args.')\n", (1588, 1627), False, 'import argparse\n'), ((1641, 1691), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""NFSP LONR in kuhn args."""'], {... |
#
# Script is based on this gist
# https://gist.github.com/StanislawAntol/656e3afe2d43864bb410d71e1c5789c1#file-freeze_mobilenet-py
# and ARM's conversion script
# https://github.com/ARM-software/ComputeLibrary/blob/master/scripts/tensorflow_data_extractor.py
#
# We can't directly use ARM's conversion script because of... | [
"os.mkdir",
"numpy.save",
"tensorflow.train.Saver",
"mobilenet_v1.mobilenet_v1_arg_scope",
"os.path.isdir",
"tensorflow.get_collection",
"numpy.ascontiguousarray",
"tensorflow.Session",
"tensorflow.placeholder",
"shutil.rmtree",
"os.path.join",
"os.getenv"
] | [((905, 929), 'os.path.join', 'os.path.join', (['"""."""', '"""npy"""'], {}), "('.', 'npy')\n", (917, 929), False, 'import os\n'), ((943, 976), 'os.getenv', 'os.getenv', (['"""MOBILENET_MULTIPLIER"""'], {}), "('MOBILENET_MULTIPLIER')\n", (952, 976), False, 'import os\n'), ((990, 1023), 'os.getenv', 'os.getenv', (['"""M... |
import numpy as np
import pickle
from astropy.io import fits
import sunpy.map as mp
import astropy.units as u
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
from reproject import reproject_interp
import matplotlib.colors as clr
from matplotlib import cm
plt.rcParams["font.family"] = "serif"
pl... | [
"numpy.load",
"numpy.zeros_like",
"matplotlib.pyplot.show",
"sunpy.map.Map",
"numpy.nan_to_num",
"numpy.log2",
"matplotlib.pyplot.subplots",
"numpy.max",
"reproject.reproject_interp",
"astropy.io.fits.open",
"seaborn.color_palette",
"matplotlib.ticker.MultipleLocator",
"seaborn.set_palette",... | [((381, 410), 'seaborn.set_palette', 'sns.set_palette', (['"""colorblind"""'], {}), "('colorblind')\n", (396, 410), True, 'import seaborn as sns\n'), ((418, 444), 'seaborn.color_palette', 'sns.color_palette', (['palette'], {}), '(palette)\n', (435, 444), True, 'import seaborn as sns\n'), ((700, 721), 'astropy.io.fits.o... |
import html
import random
import re
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from common.client import AnimeApiClient
random.seed(12345)
class DatasetGenerator:
def __init__(self, api_client: AnimeApiClient):
self.api_client = api_client
self.anime_lists = ... | [
"html.unescape",
"sklearn.feature_extraction.text.TfidfVectorizer",
"random.shuffle",
"random.seed",
"numpy.array",
"re.sub"
] | [((159, 177), 'random.seed', 'random.seed', (['(12345)'], {}), '(12345)\n', (170, 177), False, 'import random\n'), ((1317, 1347), 'random.shuffle', 'random.shuffle', (['imported_anime'], {}), '(imported_anime)\n', (1331, 1347), False, 'import random\n'), ((4513, 4555), 'html.unescape', 'html.unescape', (["anime['saniti... |
# -*- coding: utf-8 -*-
#
# network_params.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License,... | [
"numpy.array",
"numpy.zeros"
] | [((1393, 1413), 'numpy.zeros', 'np.zeros', (['(dim, dim)'], {}), '((dim, dim))\n', (1401, 1413), True, 'import numpy as np\n'), ((2054, 2074), 'numpy.zeros', 'np.zeros', (['(dim, dim)'], {}), '((dim, dim))\n', (2062, 2074), True, 'import numpy as np\n'), ((2862, 2882), 'numpy.zeros', 'np.zeros', (['(dim, dim)'], {}), '... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import figure
## Quick curve fitting of BSA paper from nist
x=[10.0 , 30.0 , 60.0] #Particle diams 10,30,60nm
y=[0.023, 0.017, 0.014] #BSA per square nm assuming spheres, converted x--> area
cov=[60.0, 44.0, 36.0] #Coverage percentage corresponding t... | [
"numpy.poly1d",
"numpy.polyfit"
] | [((601, 620), 'numpy.polyfit', 'np.polyfit', (['x', 'y', '(1)'], {}), '(x, y, 1)\n', (611, 620), True, 'import numpy as np\n'), ((633, 645), 'numpy.poly1d', 'np.poly1d', (['z'], {}), '(z)\n', (642, 645), True, 'import numpy as np\n'), ((811, 832), 'numpy.polyfit', 'np.polyfit', (['x1', 'y1', '(1)'], {}), '(x1, y1, 1)\n... |
import os
from abc import abstractmethod
import cv2
import numpy as np
from src.loaders.BaseLoader import BaseLoader
from src.loaders.depth_image.CameraConfig import CameraConfig
from src.model.SegmentedPointCloud import SegmentedPointCloud
from src.utils.point_cloud import depth_to_pcd_custom
class ImageLoader(Ba... | [
"src.utils.point_cloud.depth_to_pcd_custom",
"cv2.imread",
"os.path.join",
"numpy.arange"
] | [((1482, 1531), 'cv2.imread', 'cv2.imread', (['depth_frame_path', 'cv2.IMREAD_ANYDEPTH'], {}), '(depth_frame_path, cv2.IMREAD_ANYDEPTH)\n', (1492, 1531), False, 'import cv2\n'), ((1827, 1898), 'src.utils.point_cloud.depth_to_pcd_custom', 'depth_to_pcd_custom', (['depth_image', 'cam_intrinsics', 'initial_pcd_transform']... |
""" Simple plot
In this section, we want to draw the cosine and sine functions
on the same plot. Starting from the default settings, we'll
enrich the figure step by step to make it nicer.
First step is to get the data for the sine and cosine functions:
:lesson goal file: goal01.py
"""
import numpy as np
import matplo... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((344, 390), 'numpy.linspace', 'np.linspace', (['(-np.pi)', 'np.pi', '(256)'], {'endpoint': '(True)'}), '(-np.pi, np.pi, 256, endpoint=True)\n', (355, 390), True, 'import numpy as np\n'), ((983, 997), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'c'], {}), '(x, c)\n', (991, 997), True, 'import matplotlib.pyplot as plt... |
from sklearn.linear_model import LinearRegression
import pandas as pd
import numpy as np
import scipy
import matplotlib.pyplot as plt
import base64
from io import BytesIO
from sourceCode.func import create_t_figure
from sourceCode.func import create_p_figure
from sourceCode.func import create_b_figure
import platform
... | [
"numpy.log",
"pandas.read_csv",
"numpy.ones",
"scipy.stats.f.sf",
"numpy.insert",
"sklearn.linear_model.LinearRegression",
"sourceCode.func.create_p_figure",
"numpy.append",
"numpy.linalg.inv",
"scipy.stats.t.sf",
"platform.system",
"numpy.dot",
"numpy.round",
"sourceCode.func.create_b_fig... | [((446, 464), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (462, 464), False, 'from sklearn.linear_model import LinearRegression\n'), ((511, 532), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (522, 532), True, 'import pandas as pd\n'), ((842, 851), 'numpy.log',... |
"""
Compile Darknet Models
=====================
This article is a test script to test darknet models with NNVM.
All the required models and libraries will be downloaded from the internet
by the script.
"""
import os
import requests
import sys
import urllib
import numpy as np
import tvm
from tvm.contrib import graph_ru... | [
"requests.head",
"cffi.FFI",
"tvm.nd.empty",
"tvm.cpu",
"numpy.empty",
"numpy.testing.assert_allclose",
"numpy.zeros",
"os.path.getsize",
"urllib.request.urlretrieve",
"os.path.isfile",
"requests.get",
"urllib.urlretrieve",
"numpy.random.rand",
"nnvm.frontend.darknet.from_darknet",
"tvm.... | [((1661, 1702), 'nnvm.testing.darknet.__darknetffi__.dlopen', '__darknetffi__.dlopen', (["('./' + DARKNET_LIB)"], {}), "('./' + DARKNET_LIB)\n", (1682, 1702), False, 'from nnvm.testing.darknet import __darknetffi__\n'), ((1805, 1846), 'nnvm.frontend.darknet.from_darknet', 'frontend.darknet.from_darknet', (['net', 'dtyp... |
# losses.py
import numpy as np
def to_numpy(inputs):
if isinstance(inputs, np.ndarray): inputs = np.array(inputs)
return inputs
class Losses(object):
def __init__(self):
pass
def gradient(self):
return None
def __call__(self):
return None
@staticmethod
def get... | [
"numpy.sum",
"numpy.log",
"numpy.square",
"numpy.array",
"numpy.dot"
] | [((104, 120), 'numpy.array', 'np.array', (['inputs'], {}), '(inputs)\n', (112, 120), True, 'import numpy as np\n'), ((1459, 1484), 'numpy.square', 'np.square', (['(preds - labels)'], {}), '(preds - labels)\n', (1468, 1484), True, 'import numpy as np\n'), ((1032, 1059), 'numpy.dot', 'np.dot', (['inputs.T', 'gradients'],... |
__author__ = "<NAME>"
__MatricNo__ = "KIE160111"
__Title__ = "Assignment 2"
__GitHub__ = "https://github.com/khvmaths"
import sys
from PyQt5 import QtCore,QtGui,QtWidgets
from PyQt5.QtCore import QThread
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLay... | [
"cv2.bitwise_and",
"pygame.event.get",
"PyQt5.QtWidgets.QPushButton",
"pygame.Rect",
"numpy.ones",
"pygame.display.update",
"PyQt5.QtWidgets.QApplication",
"cv2.erode",
"os.path.join",
"cv2.inRange",
"collections.deque",
"pygame.mixer.get_init",
"cv2.line",
"PyQt5.QtWidgets.QLabel",
"PyQ... | [((6332, 6355), 'numpy.array', 'np.array', (['[110, 50, 50]'], {}), '([110, 50, 50])\n', (6340, 6355), True, 'import numpy as np\n'), ((6367, 6392), 'numpy.array', 'np.array', (['[130, 255, 255]'], {}), '([130, 255, 255])\n', (6375, 6392), True, 'import numpy as np\n'), ((6396, 6412), 'collections.deque', 'deque', ([],... |
"""
Copyright (C) 2021 Adobe. All rights reserved.
"""
import cv2
import os
import numpy as np
import pickle
import torch
import pydiffvg
import torch.nn.functional as F
def txt2list(the_txt_fn):
with open(the_txt_fn, 'r') as txt_obj:
lines = txt_obj.readlines()
lines = [haha.strip() for haha in ... | [
"pickle.dump",
"numpy.sum",
"numpy.amin",
"torch.cat",
"numpy.clip",
"numpy.ones",
"pickle.load",
"numpy.arange",
"torch.nn.functional.leaky_relu",
"numpy.interp",
"cv2.imshow",
"torch.ones",
"cv2.imwrite",
"os.path.exists",
"pydiffvg.Path",
"torch.zeros",
"cv2.destroyAllWindows",
... | [((959, 972), 'numpy.uint8', 'np.uint8', (['img'], {}), '(img)\n', (967, 972), True, 'import numpy as np\n'), ((2029, 2064), 'numpy.zeros', 'np.zeros', (['(nv, 2)'], {'dtype': 'np.float64'}), '((nv, 2), dtype=np.float64)\n', (2037, 2064), True, 'import numpy as np\n'), ((2454, 2489), 'numpy.zeros', 'np.zeros', (['(nv, ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import model_helper, workspace, core, rnn_cell
from caffe2.python.attention import AttentionType
import n... | [
"caffe2.python.workspace.GlobalInit",
"caffe2.python.rnn_cell.LSTMWithAttention",
"numpy.random.seed",
"caffe2.proto.caffe2_pb2.DeviceOption",
"numpy.allclose",
"caffe2.python.core.DeviceScope",
"unittest.main",
"caffe2.python.workspace.FeedBlob",
"caffe2.python.workspace.RunNetOnce",
"hypothesis.... | [((915, 941), 'caffe2.python.workspace.ResetWorkspace', 'workspace.ResetWorkspace', ([], {}), '()\n', (939, 941), False, 'from caffe2.python import model_helper, workspace, core, rnn_cell\n'), ((4574, 4611), 'caffe2.python.model_helper.ModelHelper', 'model_helper.ModelHelper', ([], {'name': '"""lstm"""'}), "(name='lstm... |
from __future__ import absolute_import, division, print_function, unicode_literals
from keras.utils import to_categorical
import numpy as np
import tensorflow as tf
import datetime
import scipy.io as sio
import multiprocessing
import math
from matplotlib.pyplot import pause
import os
import glob
# Parameters for learn... | [
"os.remove",
"numpy.random.seed",
"scipy.io.loadmat",
"numpy.ones",
"tensorflow.matmul",
"os.path.isfile",
"numpy.arange",
"glob.glob",
"tensorflow.set_random_seed",
"tensorflow.placeholder",
"tensorflow.gradients",
"matplotlib.pyplot.pause",
"datetime.datetime.now",
"keras.utils.to_catego... | [((3623, 3662), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 512]'], {}), '(tf.float32, [None, 512])\n', (3637, 3662), True, 'import tensorflow as tf\n'), ((3709, 3746), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 8]'], {}), '(tf.float32, [None, 8])\n', (3723, 3746), True,... |
#!/usr/bin/env python
#%% imports
import os
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
# use local cython installs
import sys
#sys.path.append(f"{BASE_PATH}/gtsam/install/cython")
import gtsam
import inspect
import numpy as np
import math
import ics
import matplotlib.pyplot as ... | [
"gtsam.Values",
"gtsam.Pose2",
"gtsam.symbol",
"os.path.dirname",
"gtsam.ISAM2Params",
"numpy.array",
"gtsam.NonlinearFactorGraph",
"gtsam.ISAM2"
] | [((773, 799), 'gtsam.Pose2', 'gtsam.Pose2', (['(0.0)', '(0.0)', '(0.0)'], {}), '(0.0, 0.0, 0.0)\n', (784, 799), False, 'import gtsam\n'), ((660, 685), 'numpy.array', 'np.array', (['[0.2, 0.2, 0.1]'], {}), '([0.2, 0.2, 0.1])\n', (668, 685), True, 'import numpy as np\n'), ((734, 759), 'numpy.array', 'np.array', (['[0.3, ... |
"""LTI Control for SBML models. Base handles initialization, get, set."""
"""
This module creates an LTI system for an SBML model.
States are chemical species. Inputs are unnormalized enzyme reaction elasticities.
Outputs are chemical species.
Notes:
1. Reaction enzymes are identified by the SBML reaction ID.
2. The ... | [
"pandas.DataFrame",
"control.ss2tf",
"controlSBML.util.makeRoadrunnerSer",
"controlSBML.util.setRoadrunnerValue",
"controlSBML.make_roadrunner.makeRoadrunner",
"numpy.isnan",
"numpy.shape",
"numpy.isclose",
"numpy.repeat",
"numpy.reshape",
"controlSBML.NonlinearIOSystem",
"controlSBML.util.mak... | [((1507, 1543), 'controlSBML.make_roadrunner.makeRoadrunner', 'makeRoadrunner', (['self.model_reference'], {}), '(self.model_reference)\n', (1521, 1543), False, 'from controlSBML.make_roadrunner import makeRoadrunner\n'), ((7586, 7626), 'pandas.DataFrame', 'pd.DataFrame', (['C_T_dct'], {'index': 'state_names'}), '(C_T_... |
"""This module contains functionality for generating scenarios.
Specifically, it generates network configurations and action space
configurations based on number of hosts and services in network using standard
formula.
"""
import numpy as np
import nasim.scenarios.utils as u
from nasim.scenarios import Scenario
from ... | [
"numpy.random.seed",
"numpy.random.random_sample",
"numpy.zeros",
"nasim.scenarios.Scenario",
"numpy.random.randint",
"numpy.random.poisson",
"numpy.random.choice",
"numpy.random.rand"
] | [((7546, 7585), 'nasim.scenarios.Scenario', 'Scenario', (['scenario_dict'], {'name': 'self.name'}), '(scenario_dict, name=self.name)\n', (7554, 7585), False, 'from nasim.scenarios import Scenario\n'), ((8225, 8261), 'numpy.zeros', 'np.zeros', (['(num_subnets, num_subnets)'], {}), '((num_subnets, num_subnets))\n', (8233... |
import numpy as np
def cosine8(rampparams, t, etc = []):
"""
This function creates a model that fits a superposition of up to 8 sinusoids.
Parameters
----------
a#: amplitude
p#: period
t#: phase/time offset
c: vertical offset
t: Array of time/phase points
Returns... | [
"numpy.cos"
] | [((1020, 1050), 'numpy.cos', 'np.cos', (['(2 * pi * (t - t8) / p8)'], {}), '(2 * pi * (t - t8) / p8)\n', (1026, 1050), True, 'import numpy as np\n'), ((992, 1022), 'numpy.cos', 'np.cos', (['(2 * pi * (t - t7) / p7)'], {}), '(2 * pi * (t - t7) / p7)\n', (998, 1022), True, 'import numpy as np\n'), ((964, 994), 'numpy.cos... |
"""Advanced 3D Polylidar Example
This example shows the limitations of Polylidar in extracting planes from 3D point clouds.
The main limitations are:
1. Only planes that have normals at roughly [0,0,1] are extracted.
Rotate point cloud prior to sending to Polylidar to resolve issue.
2. Planes can not be... | [
"polylidarutil.set_up_axes",
"polylidarutil.apply_rotation",
"numpy.random.seed",
"matplotlib.pyplot.show",
"polylidarutil.plot_polygons_3d",
"numpy.asarray",
"polylidarutil.rotation_matrix",
"polylidarutil.scale_points",
"polylidarutil.generate_3d_plane",
"polylidarutil.plot_planes_3d",
"polyli... | [((1301, 1318), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1315, 1318), True, 'import numpy as np\n'), ((1351, 1466), 'polylidarutil.generate_3d_plane', 'generate_3d_plane', ([], {'bounds_x': '[0, 10, 0.5]', 'bounds_y': '[0, 10, 0.5]', 'holes': '[]', 'height_noise': '(0.02)', 'planar_noise': '(0.02... |
# coding: utf-8
import logging
import numpy as np
from ppyt.indicators import IndicatorBase
from ppyt.indicators.closerecenthighlow_indicators import (
CloseGtRecentHighIndicator, CloseLtRecentLowIndicator
)
logger = logging.getLogger(__name__)
class UpperBreakoutIndicator(IndicatorBase):
"""上にブレイクアウトしたかを示す指... | [
"ppyt.indicators.closerecenthighlow_indicators.CloseLtRecentLowIndicator",
"ppyt.indicators.closerecenthighlow_indicators.CloseGtRecentHighIndicator",
"logging.getLogger",
"numpy.logical_not"
] | [((222, 249), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (239, 249), False, 'import logging\n'), ((557, 612), 'ppyt.indicators.closerecenthighlow_indicators.CloseGtRecentHighIndicator', 'CloseGtRecentHighIndicator', ([], {'stock': 'self.stock', 'span': 'span'}), '(stock=self.stock, sp... |
from mrr import mrr
import numpy as np
# in this case, we have two queries, each of one composed of 3 elements,
# as indicated by the array groups.
# in label, we have the labels for any of the 3 documents in the two queries
# in prediction, we have the scores assigned by the algorithm to the documents
label = np.arr... | [
"numpy.array"
] | [((314, 358), 'numpy.array', 'np.array', (['[0, 1, 0, 1, 0, 0]'], {'dtype': 'np.int32'}), '([0, 1, 0, 1, 0, 0], dtype=np.int32)\n', (322, 358), True, 'import numpy as np\n'), ((372, 426), 'numpy.array', 'np.array', (['[0.1, 0.2, 0.3, 1, 0.5, 0]'], {'dtype': 'np.float32'}), '([0.1, 0.2, 0.3, 1, 0.5, 0], dtype=np.float32... |
# -*- coding: utf-8 -*-
"""The Mosaic Python API
.. moduleauthor:: <NAME>
This module provides abstract base classes that define the Mosaic
Python API and implement validation code. They also provide a few
convenience functions implemented in terms of the raw API.
Concrete implementations subclass the abstract base ... | [
"numpy.sum",
"re.match",
"numpy.arange",
"numpy.array",
"numpy.linalg.det",
"numpy.add.accumulate",
"numpy.concatenate"
] | [((17229, 17249), 'numpy.add.accumulate', 'N.add.accumulate', (['ns'], {}), '(ns)\n', (17245, 17249), True, 'import numpy as N\n'), ((28332, 28346), 'numpy.array', 'N.array', (['bonds'], {}), '(bonds)\n', (28339, 28346), True, 'import numpy as N\n'), ((28891, 28911), 'numpy.concatenate', 'N.concatenate', (['total'], {}... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import workspace, model_helpers
from caffe2.python.model_helper import ModelHelperBase
import caffe2.python.hypothesis_test_util as hu
from hypothesis ... | [
"caffe2.python.model_helpers.FC_Decomp",
"caffe2.python.workspace.FetchBlob",
"caffe2.python.model_helpers.FC_Prune",
"numpy.random.rand",
"caffe2.python.workspace.FeedBlob",
"caffe2.python.model_helpers.PackedFC",
"caffe2.python.workspace.RunNetOnce",
"caffe2.python.model_helper.ModelHelperBase",
"... | [((608, 634), 'caffe2.python.workspace.FeedBlob', 'workspace.FeedBlob', (['"""x"""', 'X'], {}), "('x', X)\n", (626, 634), False, 'from caffe2.python import workspace, model_helpers\n'), ((651, 685), 'caffe2.python.model_helper.ModelHelperBase', 'ModelHelperBase', ([], {'name': '"""test_model"""'}), "(name='test_model')... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 <NAME> <<EMAIL>>
#
# Distributed under terms of the GNU-License license.
"""
"""
import uqra, warnings, random, math
import numpy as np, os, sys
import collections
import scipy.stats as stats
import scipy
import scipy.io
from tqdm im... | [
"numpy.load",
"numpy.random.seed",
"numpy.amin",
"uqra.metrics.mean_squared_error",
"numpy.isnan",
"numpy.around",
"numpy.linalg.svd",
"numpy.mean",
"uqra.Legendre",
"os.path.join",
"numpy.set_printoptions",
"scipy.stats.norm",
"numpy.std",
"scipy.stats.norm.cdf",
"numpy.printoptions",
... | [((330, 418), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'module': '"""scipy"""', 'message': '"""^internal gelsd"""'}), "(action='ignore', module='scipy', message=\n '^internal gelsd')\n", (353, 418), False, 'import uqra, warnings, random, math\n'), ((428, 459), 'uqra.utili... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 7 13:33:59 2016
@author: cs401
"""
import os
import numpy
import pandas
from collections import OrderedDict
import matplotlib.pyplot as plt
import seaborn as sns
import copy
from .._toolboxPath import toolboxPath
from ..objects import Dataset
from pyChemometrics.Chemomet... | [
"numpy.absolute",
"seaborn.heatmap",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"shutil.rmtree",
"os.path.join",
"pandas.DataFrame",
"numpy.full",
"seaborn.axes_style",
"matplotlib.pyplot.close",
"os.path.exists",
"IPython.display.display",
"re.sub",
"copy.deepcopy",
"ma... | [((6662, 6685), 'copy.deepcopy', 'copy.deepcopy', (['dataTrue'], {}), '(dataTrue)\n', (6675, 6685), False, 'import copy\n'), ((7307, 7320), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (7318, 7320), False, 'from collections import OrderedDict\n'), ((7340, 7353), 'collections.OrderedDict', 'OrderedDict', ... |
import os
import time
import torch
import glob
import numpy as np
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pad_sequence
from dataclasses import dataclass
from transformers.data.data_collator import DataCollatorMixin
from fengshen.data.MMapIndexDataset import MMapIndexDataset
def safe_check... | [
"numpy.sum",
"numpy.unique",
"os.path.exists",
"fengshen.data.MMapIndexDataset.MMapIndexDataset",
"glob.glob",
"torch.zeros",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor"
] | [((1370, 1416), 'torch.tensor', 'torch.tensor', (['decoder_inputs'], {'dtype': 'torch.long'}), '(decoder_inputs, dtype=torch.long)\n', (1382, 1416), False, 'import torch\n'), ((1728, 1794), 'torch.nn.utils.rnn.pad_sequence', 'pad_sequence', (['encoder_inputs'], {'batch_first': '(True)', 'padding_value': '(-100)'}), '(e... |
# coding: utf-8
__author__ = 'cleardusk'
import sys
sys.path.append('..')
import cv2
import numpy as np
import os.path as osp
import scipy.io as sio
from ..Sim3DR import rasterize
from .functions import plot_image
from .io import _load
from .tddfa_util import _to_ctype
make_abs_path = lambda fn: osp.join(osp.dirn... | [
"sys.path.append",
"numpy.maximum",
"scipy.io.loadmat",
"cv2.imwrite",
"os.path.realpath",
"numpy.floor",
"numpy.zeros",
"numpy.clip",
"numpy.round",
"numpy.concatenate"
] | [((55, 76), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (70, 76), False, 'import sys\n'), ((387, 402), 'scipy.io.loadmat', 'sio.loadmat', (['fp'], {}), '(fp)\n', (398, 402), True, 'import scipy.io as sio\n'), ((1615, 1647), 'numpy.clip', 'np.clip', (['x0', '(0)', '(img.shape[1] - 1)'], {}), '(... |
"""
Some helper functions for the matern prior covariance
Hmm... it would be nice to add this on to the ControlField
infrastructure...
Maybe once I understand things more
"""
import os
import numpy as np
import xarray as xr
from MITgcmutils import wrmds
from scipy.special import gamma, kv
from .io import read_mds
de... | [
"os.makedirs",
"os.path.isdir",
"xarray.Dataset",
"xarray.zeros_like",
"MITgcmutils.wrmds",
"numpy.arange",
"xarray.DataArray",
"scipy.special.kv",
"numpy.array",
"xarray.where",
"xarray.ones_like",
"scipy.special.gamma",
"numpy.sqrt"
] | [((1212, 1224), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1222, 1224), True, 'import xarray as xr\n'), ((1238, 1270), 'numpy.arange', 'np.arange', (['(-n_shift)', '(n_shift + 1)'], {}), '(-n_shift, n_shift + 1)\n', (1247, 1270), True, 'import numpy as np\n'), ((1281, 1346), 'xarray.DataArray', 'xr.DataArray', ... |
import itertools
import numpy as np
from collections import deque
from tensorboardX import SummaryWriter
import Config
from AgentControl import AgentControl
from Buffer import Buffer
from TestAgent import TestAgent
class Agent:
# Role of Agent class is to coordinate between AgentControll where we do ... | [
"AgentControl.AgentControl",
"numpy.max",
"numpy.mean",
"itertools.islice",
"TestAgent.TestAgent",
"Buffer.Buffer",
"numpy.round",
"collections.deque"
] | [((574, 613), 'AgentControl.AgentControl', 'AgentControl', (['state_shape', 'action_shape'], {}), '(state_shape, action_shape)\n', (586, 613), False, 'from AgentControl import AgentControl\n'), ((637, 698), 'Buffer.Buffer', 'Buffer', (['num_agents', 'state_shape', 'action_shape', 'episode_length'], {}), '(num_agents, s... |
import numpy as np
from nptyping import NDArray
from ..objective import Objective
def char_vector(f: Objective, e: int) -> NDArray[int]:
"""
Return the n-dimensional characteristic vector with 1 on coordinate e.
:param f: integer-lattice submodular function
:param e: coordinate of the characteristic v... | [
"numpy.in1d"
] | [((370, 387), 'numpy.in1d', 'np.in1d', (['f.V', '[e]'], {}), '(f.V, [e])\n', (377, 387), True, 'import numpy as np\n')] |
from typing import Dict
import pytest
from numpy.testing import assert_almost_equal
from allopy import ActivePortfolioOptimizer, OptData
from allopy.datasets import load_monte_carlo
from tests.active_portfolio.data import (
adj, cov_mat, get_expected_results, get_linear_constraints, get_risk_cstr, lb, ub
)
from t... | [
"tests.active_portfolio.data.get_expected_results",
"tests.active_portfolio.data.get_linear_constraints",
"allopy.ActivePortfolioOptimizer",
"numpy.testing.assert_almost_equal",
"pytest.fixture",
"tests.utils.fetch_opt_data_test_file",
"tests.active_portfolio.data.get_risk_cstr",
"allopy.datasets.load... | [((1429, 1459), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1443, 1459), False, 'import pytest\n'), ((1910, 1940), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1924, 1940), False, 'import pytest\n'), ((497, 512), 'tests.activ... |
"""Conversion tool from EDF+,BDF to FIF
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import os
import calendar
import datetime
import re
import warnings
from math import ceil, floor
import numpy as np
from ...transforms import als_ras_trans_mm, apply_trans
from ...utils import verbose, logger
from ..... | [
"numpy.ones",
"numpy.arange",
"numpy.unique",
"os.path.lexists",
"os.path.abspath",
"numpy.max",
"re.findall",
"numpy.fromstring",
"os.path.basename",
"datetime.datetime",
"numpy.hstack",
"numpy.min",
"numpy.vstack",
"numpy.fromfile",
"numpy.zeros",
"numpy.array",
"numpy.logical_or",... | [((18179, 18193), 'numpy.array', 'np.array', (['locs'], {}), '(locs)\n', (18187, 18193), True, 'import numpy as np\n'), ((20744, 20766), 're.findall', 're.findall', (['pat', 'annot'], {}), '(pat, annot)\n', (20754, 20766), False, 'import re\n'), ((20931, 20956), 're.findall', 're.findall', (['pat', 'annotmap'], {}), '(... |
'''
use tensorflow for event embedding
input n_size*[[actor],[action],[object]]
output event embedding & model
'''
import tensorflow as tf
import pickle
import numpy as np
import datetime
import pandas as pd
wordsDic = pickle.load(open("./traindata/wordsDic.pkl", "rb"))
eventWord_time = pickle.load(open("./traindata/... | [
"pandas.DataFrame",
"numpy.divide",
"tensorflow.train.Saver",
"tensorflow.clip_by_value",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"numpy.zeros",
"datetime.date",
"tensorflow.stack",
"tensorflow.placeholder",
"datetime.datetime.strptime",
"tensorflow.Print",
"numpy.ar... | [((1746, 1795), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, dimension * 3]'], {}), '(tf.float32, [None, dimension * 3])\n', (1760, 1795), True, 'import tensorflow as tf\n'), ((1814, 1863), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, dimension * 3]'], {}), '(tf.float32, [N... |
#
# Copyright © 2020 Intel Corporation.
#
# This software and the related documents are Intel copyrighted
# materials, and your use of them is governed by the express
# license under which they were provided to you (License). Unless
# the License provides otherwise, you may not use, modify, copy,
# publish, distribute,... | [
"os.path.expanduser",
"numpy.isscalar",
"numpy.ones",
"time.strftime",
"numpy.any",
"numpy.argsort",
"nxsdk_modules_ncl.dnn.src.utils.getS",
"nxsdk_modules_ncl.dnn.src.data_structures.Layer",
"collections.namedtuple",
"numpy.array",
"numpy.dot",
"nxsdk_modules_ncl.dnn.src.utils.getCoreOccupanc... | [((1059, 1163), 'collections.namedtuple', 'namedtuple', (['"""CostTerms"""', "['coreCost', 'inputAxonCost', 'outputAxonCost', 'synCost', 'postLayerCost']"], {}), "('CostTerms', ['coreCost', 'inputAxonCost', 'outputAxonCost',\n 'synCost', 'postLayerCost'])\n", (1069, 1163), False, 'from collections import namedtuple,... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | [
"unittest.main",
"unittest.skipIf",
"os.path.abspath",
"os.remove",
"test_utils.run_keras_and_ort",
"keras2onnx.convert_keras",
"numpy.random.rand"
] | [((10051, 10116), 'unittest.skipIf', 'unittest.skipIf', (['(test_level_0 or not is_tf2)', '"""Test level 0 only."""'], {}), "(test_level_0 or not is_tf2, 'Test level 0 only.')\n", (10066, 10116), False, 'import unittest\n'), ((10607, 10622), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10620, 10622), False, 'im... |
"""
This module contains all routines for training GDML and sGDML models.
"""
# MIT License
#
# Copyright (c) 2018-2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... | [
"sys.stdout.write",
"scipy.linalg.solve",
"numpy.diag_indices_from",
"numpy.abs",
"numpy.sum",
"numpy.empty",
"numpy.einsum",
"numpy.ones",
"sys.stdout.flush",
"numpy.arange",
"numpy.tile",
"numpy.linalg.norm",
"scipy.spatial.distance.pdist",
"numpy.exp",
"numpy.unique",
"warnings.simp... | [((3433, 3445), 'numpy.sqrt', 'np.sqrt', (['(5.0)'], {}), '(5.0)\n', (3440, 3445), True, 'import numpy as np\n'), ((3482, 3498), 'numpy.arange', 'np.arange', (['dim_i'], {}), '(dim_i)\n', (3491, 3498), True, 'import numpy as np\n'), ((4411, 4507), 'numpy.einsum', 'np.einsum', (['"""ijk,k->ji"""', 'rj_d_desc_perms', '((... |
"""Probablistic forecast error metrics."""
import numpy as np
def brier_score(obs, fx, fx_prob):
"""Brier Score (BS).
BS = 1/n sum_{i=1}^n (f_i - o_i)^2
where n is the number of forecasts, f_i is the forecasted probability of
event i, and o_i is the observed event indicator (o_i=0: event did no... | [
"numpy.sum",
"numpy.isscalar",
"numpy.ndim",
"numpy.shape",
"numpy.around",
"numpy.mean",
"numpy.where",
"numpy.diff",
"numpy.tile",
"numpy.unique"
] | [((1454, 1483), 'numpy.where', 'np.where', (['(obs <= fx)', '(1.0)', '(0.0)'], {}), '(obs <= fx, 1.0, 0.0)\n', (1462, 1483), True, 'import numpy as np\n'), ((1559, 1580), 'numpy.mean', 'np.mean', (['((f - o) ** 2)'], {}), '((f - o) ** 2)\n', (1566, 1580), True, 'import numpy as np\n'), ((7691, 7724), 'numpy.around', 'n... |
"""
==================================================
Automatic Fiber Bundle Extraction with RecoBundles
==================================================
This example explains how we can use RecoBundles [Garyfallidis17]_ to
extract bundles from tractograms.
First import the necessary modules.
"""
import numpy as ... | [
"dipy.io.streamline.load_trk",
"numpy.save",
"dipy.data.fetcher.fetch_target_tractogram_hcp",
"dipy.data.fetcher.get_two_hcp842_bundles",
"dipy.segment.bundles.RecoBundles",
"dipy.io.streamline.save_trk",
"dipy.viz.actor.line",
"dipy.viz.window.show",
"dipy.align.streamlinear.whole_brain_slr",
"di... | [((819, 848), 'dipy.data.fetcher.fetch_target_tractogram_hcp', 'fetch_target_tractogram_hcp', ([], {}), '()\n', (846, 848), False, 'from dipy.data.fetcher import fetch_target_tractogram_hcp, fetch_bundle_atlas_hcp842, get_bundle_atlas_hcp842, get_target_tractogram_hcp\n'), ((876, 903), 'dipy.data.fetcher.fetch_bundle_a... |
import click
import cv2
import numpy as np
from scipy.ndimage.filters import rank_filter
def process_image(image_array):
"""Given a numpy array, return an image cropped to the "useful" area of text"""
decoded_image = cv2.imdecode(image_array, 1) # Decode the image as color
# Load and scale down image.
... | [
"cv2.approxPolyDP",
"cv2.medianBlur",
"cv2.arcLength",
"cv2.imdecode",
"click.echo",
"numpy.ones",
"cv2.bilateralFilter",
"numpy.mean",
"numpy.sin",
"cv2.getRotationMatrix2D",
"cv2.line",
"scipy.ndimage.filters.rank_filter",
"cv2.filter2D",
"cv2.dilate",
"cv2.Canny",
"numpy.minimum",
... | [((227, 255), 'cv2.imdecode', 'cv2.imdecode', (['image_array', '(1)'], {}), '(image_array, 1)\n', (239, 255), False, 'import cv2\n'), ((891, 931), 'cv2.filter2D', 'cv2.filter2D', (['cropped', '(-1)'], {'kernel': 'kernel'}), '(cropped, -1, kernel=kernel)\n', (903, 931), False, 'import cv2\n'), ((936, 975), 'click.echo',... |
import numpy as np
# Hyperparameters
x = 0.1
noise = 0.1
print("x: %f" % x)
print("noise: %f" % noise)
# Simulated training loss
loss = np.sin(5 * x) * (1 - np.tanh(x ** 2)) + np.random.randn() * noise
print("loss: %f" % loss)
| [
"numpy.sin",
"numpy.tanh",
"numpy.random.randn"
] | [((139, 152), 'numpy.sin', 'np.sin', (['(5 * x)'], {}), '(5 * x)\n', (145, 152), True, 'import numpy as np\n'), ((179, 196), 'numpy.random.randn', 'np.random.randn', ([], {}), '()\n', (194, 196), True, 'import numpy as np\n'), ((160, 175), 'numpy.tanh', 'np.tanh', (['(x ** 2)'], {}), '(x ** 2)\n', (167, 175), True, 'im... |
from threading import Thread
import socket
import sys
from time import time, sleep
import numpy as np
TEST_MSG_COUNT = 1000
class Sender(Thread):
def run(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = ('127.0.0.1', 8125)
try:
num_send = 0
... | [
"socket.socket",
"time.time",
"numpy.percentile",
"time.sleep",
"numpy.array"
] | [((1782, 1790), 'time.sleep', 'sleep', (['(5)'], {}), '(5)\n', (1787, 1790), False, 'from time import time, sleep\n'), ((183, 231), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (196, 231), False, 'import socket\n'), ((864, 912), 'socket.socket... |
from keras.layers import ConvLSTM2D, Dense, Conv1D, TimeDistributed, BatchNormalization, MaxPooling2D, MaxPooling1D
from keras.layers import Bidirectional, CuDNNLSTM, Dropout, LSTM, Add, Conv2D, Multiply
from keras.layers import Reshape, Input, Flatten, BatchNormalization
from keras.models import Model
from keras.utils... | [
"numpy.argmax",
"keras.models.Model",
"numpy.shape",
"tensorflow.ConfigProto",
"keras.layers.Input",
"keras.layers.Reshape",
"keras.layers.Flatten",
"datetime.datetime.now",
"keras.layers.Multiply",
"keras.utils.to_categorical",
"keras.layers.Dropout",
"keras.backend.set_session",
"tensorflo... | [((678, 854), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'intra_op_parallelism_threads': 'num_cores', 'inter_op_parallelism_threads': 'num_cores', 'allow_soft_placement': '(True)', 'device_count': "{'CPU': num_CPU, 'GPU': num_GPU}"}), "(intra_op_parallelism_threads=num_cores,\n inter_op_parallelism_threads=nu... |
import numpy as np
import scipy.sparse
import used.unused.softmax as softmax
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def sigmoid_prime(x):
return sigmoid(x) * (1 - sigmoid(x))
def stack2params(stack):
"""
Converts a "stack" structure into a flattened parameter vector and also
stores the n... | [
"used.unused.softmax.softmax_predict",
"numpy.sum",
"numpy.log",
"numpy.ones",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.tile",
"numpy.concatenate"
] | [((1104, 1126), 'numpy.concatenate', 'np.concatenate', (['params'], {}), '(params)\n', (1118, 1126), True, 'import numpy as np\n'), ((6585, 6658), 'used.unused.softmax.softmax_predict', 'softmax.softmax_predict', (['(softmax_theta, hidden_size, num_classes)', 'a[-1]'], {}), '((softmax_theta, hidden_size, num_classes), ... |
import logging
from random import shuffle
import numpy as np
from rdkit import Chem
from rdkit import DataStructs
from rdkit.Chem import AllChem
from typing import Optional, List, Callable, Tuple
from frag_gt.src.afp import calculate_alignment_similarity_scores
logger = logging.getLogger(__name__)
class FragSample... | [
"numpy.sum",
"numpy.concatenate",
"rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect",
"random.shuffle",
"numpy.where",
"numpy.array",
"numpy.random.choice",
"rdkit.Chem.MolFromSmiles",
"logging.getLogger"
] | [((274, 301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (291, 301), False, 'import logging\n'), ((6444, 6506), 'rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect', 'AllChem.GetMorganFingerprintAsBitVect', (['query_mol', '(2)'], {'nBits': '(512)'}), '(query_mol, 2, nBits=512)\n', (6481... |
import numpy as np
import torch
def move_data_to_device(x, device):
if 'float' in str(x.dtype):
x = torch.Tensor(x)
elif 'int' in str(x.dtype):
x = torch.LongTensor(x)
else:
return x
return x.to(device)
def do_mixup(x, mixup_lambda):
"""Mixup x of even indexes (0, 2, 4, ... | [
"torch.LongTensor",
"torch.cat",
"torch.Tensor",
"torch.no_grad",
"numpy.concatenate"
] | [((3390, 3431), 'torch.cat', 'torch.cat', (['(framewise_output, pad)'], {'dim': '(1)'}), '((framewise_output, pad), dim=1)\n', (3399, 3431), False, 'import torch\n'), ((114, 129), 'torch.Tensor', 'torch.Tensor', (['x'], {}), '(x)\n', (126, 129), False, 'import torch\n'), ((2274, 2314), 'numpy.concatenate', 'np.concaten... |
# 走迷宫
# 注意,为了和屏幕坐标系一致,maze[x,y]和我们一般的矩阵的行列是反的
from typing import Tuple
from easygraphics import * # 使用easygraphics绘图
import numpy as np # 使用numpy的ndarray来保存迷宫信息
import scanf
BRICK_WIDTH = 25 # 迷宫每格宽度
BRICK_HEIGHT = 25 # 迷宫每格高度
WALL_COLOR = Color.DARK_RED
WAY_COLOR = Color.LIGHT_GRAY
WAY_VISITED_COLOR = Color.DARK_... | [
"scanf.scanf",
"numpy.zeros"
] | [((2098, 2124), 'scanf.scanf', 'scanf.scanf', (['"""%d,%d"""', 'line'], {}), "('%d,%d', line)\n", (2109, 2124), False, 'import scanf\n'), ((2224, 2253), 'numpy.zeros', 'np.zeros', (['(m, n)'], {'dtype': '"""int"""'}), "((m, n), dtype='int')\n", (2232, 2253), True, 'import numpy as np\n'), ((2602, 2628), 'scanf.scanf', ... |
# Copyright 2020 The DDSP Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"numpy.zeros",
"tensorflow.compat.v1.test.main",
"ddsp.training.nn.split_to_dict",
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.concatenate"
] | [((829, 853), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (851, 853), True, 'import tensorflow.compat.v1 as tf\n'), ((1590, 1604), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (1602, 1604), True, 'import tensorflow.compat.v1 as tf\n'), ((1219, 1253), 'd... |
from os.path import dirname, join
from scipy.io import wavfile
import numpy as np
import mel
from sklearn.preprocessing import MinMaxScaler
# the model was trained in tf1
import tensorflow.compat.v1 as tf
from tensorflow.compat.v1.keras.models import load_model
tf.disable_v2_behavior()
def load_sound(filename):
... | [
"os.path.dirname",
"sklearn.preprocessing.MinMaxScaler",
"numpy.expand_dims",
"scipy.io.wavfile.read",
"mel.invert_pretty_spectrogram",
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.squeeze",
"tensorflow.compat.v1.keras.models.load_model"
] | [((265, 289), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (287, 289), True, 'import tensorflow.compat.v1 as tf\n'), ((620, 642), 'scipy.io.wavfile.read', 'wavfile.read', (['filename'], {}), '(filename)\n', (632, 642), False, 'from scipy.io import wavfile\n'), ((1695, 1709), '... |
# This file is covered by the LICENSE file in the root of this project.
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import os
import numpy as np
from PIL import Image
import random
import torchvision.transforms.functional as TF
import cv2
'''
means(rgb): [0.47037394 ... | [
"torchvision.transforms.ColorJitter",
"os.path.expanduser",
"PIL.Image.new",
"torch.from_numpy",
"torch.utils.data.DataLoader",
"PIL.Image.open",
"torch.cuda.device_count",
"random.random",
"numpy.array",
"torch.cuda.is_available",
"torchvision.transforms.Normalize",
"torchvision.transforms.Re... | [((9396, 9412), 'PIL.Image.open', 'Image.open', (['file'], {}), '(file)\n', (9406, 9412), False, 'from PIL import Image\n'), ((9446, 9462), 'PIL.Image.open', 'Image.open', (['file'], {}), '(file)\n', (9456, 9462), False, 'from PIL import Image\n'), ((9818, 9853), 'PIL.Image.new', 'Image.new', (['img_type', '(new_w, new... |
#ref: https://github.com/mileyan/Pseudo_Lidar_V2/compare/master...swdev1202:master
import argparse
import os
import numpy as np
import tqdm
def pto_rec_map(velo_points, H=64, W=512, D=800):
# depth, width, height
valid_inds = (velo_points[:, 0] < 80) & \
(velo_points[:, 0] >= 0) & \
... | [
"numpy.radians",
"tqdm.tqdm",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.fromfile",
"numpy.ones",
"numpy.arcsin",
"os.path.join",
"os.listdir",
"numpy.vstack",
"numpy.sqrt"
] | [((1639, 1659), 'numpy.radians', 'np.radians', (['(90.0 / W)'], {}), '(90.0 / W)\n', (1649, 1659), True, 'import numpy as np\n'), ((1762, 1795), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2 + z ** 2)'], {}), '(x ** 2 + y ** 2 + z ** 2)\n', (1769, 1795), True, 'import numpy as np\n'), ((1804, 1828), 'numpy.sqrt', 'np.sq... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from isegm.utils import misc
class NormalizedFocalLossSigmoid(nn.Module):
def __init__(self, axis=-1, alpha=0.25, gamma=2, max_mult=-1, eps=1e-12,
from_sigmoid=False, detach_delimeter=True,
bat... | [
"torch.ones_like",
"torch.flatten",
"torch.ones",
"torch.relu",
"torch.where",
"torch.zeros_like",
"numpy.any",
"torch.abs",
"torch.sigmoid",
"torch.max",
"torch.clamp_max",
"torch.no_grad",
"torch.sum",
"torch.log"
] | [((1130, 1218), 'torch.where', 'torch.where', (['one_hot', '(self._alpha * sample_weight)', '((1 - self._alpha) * sample_weight)'], {}), '(one_hot, self._alpha * sample_weight, (1 - self._alpha) *\n sample_weight)\n', (1141, 1218), False, 'import torch\n'), ((1367, 1419), 'torch.sum', 'torch.sum', (['sample_weight']... |
import signal
import numpy as np
from keras import Input
from IPython.display import SVG
from keras.utils.vis_utils import model_to_dot
from keras.engine import Model
from keras.layers import Dense, Activation
from keras.losses import mean_squared_error
from keras.models import Sequential
from keras.utils import plot_... | [
"keras.Input",
"keras.engine.Model",
"numpy.ones",
"autokeras.layers.WeightedAdd",
"keras.utils.plot_model",
"keras.layers.Dense",
"keras.utils.vis_utils.model_to_dot",
"signal.alarm",
"keras.models.Sequential",
"signal.signal",
"sklearn.gaussian_process.GaussianProcessRegressor"
] | [((489, 507), 'keras.Input', 'Input', ([], {'shape': '(32,)'}), '(shape=(32,))\n', (494, 507), False, 'from keras import Input\n'), ((592, 618), 'keras.engine.Model', 'Model', ([], {'inputs': 'a', 'outputs': 'b'}), '(inputs=a, outputs=b)\n', (597, 618), False, 'from keras.engine import Model\n'), ((627, 645), 'keras.In... |
##########################################################################
#
# Copyright 2007-2019 by <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software witho... | [
"geomap.Polygon",
"fig.File",
"math.sqrt",
"math.ceil",
"vigra.meshIter",
"vigra.GrayImage",
"numpy.square",
"numpy.asarray",
"math.sin",
"fig.Polygon",
"fig.Arrow",
"math.cos",
"geomap.BoundingBox",
"numpy.dot"
] | [((1738, 1753), 'numpy.dot', 'numpy.dot', (['v', 'v'], {}), '(v, v)\n', (1747, 1753), False, 'import vigra, geomap, numpy, math\n'), ((1805, 1826), 'numpy.square', 'numpy.square', (['maxDist'], {}), '(maxDist)\n', (1817, 1826), False, 'import vigra, geomap, numpy, math\n'), ((11698, 11707), 'geomap.Polygon', 'Polygon',... |
import typing
from enum import unique
import os
import numpy as np
import torch
from tqdm import tqdm
import xarray as xr
from langbrainscore.dataset import Dataset
from langbrainscore.interface import EncoderRepresentations, _ModelEncoder
from langbrainscore.utils.encoder import (
aggregate_layers,
cos_sim_m... | [
"langbrainscore.utils.encoder.get_torch_device",
"numpy.abs",
"transformers.AutoModel.from_pretrained",
"langbrainscore.utils.logging.log",
"langbrainscore.utils.xarray.fix_xr_dtypes",
"numpy.unique",
"langbrainscore.utils.encoder.encode_stimuli_in_context",
"langbrainscore.utils.encoder.get_context_g... | [((986, 1004), 'langbrainscore.utils.encoder.get_torch_device', 'get_torch_device', ([], {}), '()\n', (1002, 1004), False, 'from langbrainscore.utils.encoder import aggregate_layers, cos_sim_matrix, count_zero_threshold_values, flatten_activations_per_sample, get_context_groups, get_torch_device, pick_matching_token_ix... |
# -*- coding: utf-8 -*-
# @Time : 2019/12/7 14:46
# @Author : zhoujun
import numpy as np
import cv2
import os
import random
from tqdm import tqdm
# calculate means and std
train_txt_path = './train_val_list.txt'
CNum = 10000 # 挑选多少图片进行计算
img_h, img_w = 640, 640
imgs = np.zeros([img_w, img_h, 3, 1])
means, stdev... | [
"cv2.resize",
"numpy.std",
"random.shuffle",
"numpy.zeros",
"cv2.imread",
"numpy.mean",
"numpy.concatenate"
] | [((277, 307), 'numpy.zeros', 'np.zeros', (['[img_w, img_h, 3, 1]'], {}), '([img_w, img_h, 3, 1])\n', (285, 307), True, 'import numpy as np\n'), ((399, 420), 'random.shuffle', 'random.shuffle', (['lines'], {}), '(lines)\n', (413, 420), False, 'import random\n'), ((532, 552), 'cv2.imread', 'cv2.imread', (['img_path'], {}... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# 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 agre... | [
"pytest.warns",
"numpy.allclose",
"pytest.mark.backends",
"numpy.array",
"numpy.all",
"numpy.sqrt"
] | [((703, 735), 'pytest.mark.backends', 'pytest.mark.backends', (['"""gaussian"""'], {}), "('gaussian')\n", (723, 735), False, 'import pytest\n'), ((1320, 1354), 'pytest.mark.backends', 'pytest.mark.backends', (['"""fock"""', '"""tf"""'], {}), "('fock', 'tf')\n", (1340, 1354), False, 'import pytest\n'), ((5396, 5442), 'p... |
import matplotlib.pyplot as plt
import numpy as np
import pdb
reso = False
y_D_pixel_416 = np.load('abs_test_pixel.npy');pdb.set_trace()
# check certain supervision result
# y_test = y_D_416[0,:]#for direct supervision
# y_test = y_S_416[:,0]
y_test = y_D_pixel_416[:,0]
# max_5_error_index = np.argpartition(y_test, ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.tight_layout",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"pdb.set_trace",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
... | [((93, 122), 'numpy.load', 'np.load', (['"""abs_test_pixel.npy"""'], {}), "('abs_test_pixel.npy')\n", (100, 122), True, 'import numpy as np\n'), ((123, 138), 'pdb.set_trace', 'pdb.set_trace', ([], {}), '()\n', (136, 138), False, 'import pdb\n'), ((3514, 3524), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (35... |
import os
import h5py
import numpy as np
from scipy.ndimage.filters import uniform_filter1d
import matplotlib.pyplot as plt
def plot_histogram(all_histograms, save_path, attr_id, attr_name, k=25, smoothing=True):
x = np.array(list(range(100)))
if smoothing:
benign = uniform_filter1d(all_histograms... | [
"matplotlib.pyplot.title",
"h5py.File",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.array",
"scipy.ndimage.filters.uniform_filter1d",
"os.path.join"
] | [((657, 692), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'benign'], {'label': '"""benign"""'}), "(x, benign, label='benign')\n", (665, 692), True, 'import matplotlib.pyplot as plt\n'), ((697, 736), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'atypical'], {'label': '"""atypical"""'}), "(x, atypical, label='atypical')... |
#!/usr/bin/env python
# coding:utf8
# -*- coding: utf-8 -*-
"""
Main Program: Run MODIS AGGREGATION IN PARALLEL BY MPI
Created on 2019
@author: <NAME>
"""
import os
import sys
import h5py
import glob
import time
import timeit
import random
import numpy as np
import xarray as xr
from mpi4py import MPI
from netCDF4 i... | [
"netCDF4.Dataset",
"matplotlib.pyplot.title",
"timeit.default_timer",
"numpy.zeros",
"matplotlib.pyplot.colorbar",
"numpy.split",
"matplotlib.pyplot.figure",
"numpy.where",
"random.seed",
"xarray.DataArray",
"numpy.linspace",
"numpy.array",
"glob.glob",
"matplotlib.pyplot.ylabel",
"matpl... | [((495, 518), 'netCDF4.Dataset', 'Dataset', (['M06_files', '"""r"""'], {}), "(M06_files, 'r')\n", (502, 518), False, 'from netCDF4 import Dataset\n'), ((729, 752), 'netCDF4.Dataset', 'Dataset', (['M03_files', '"""r"""'], {}), "(M03_files, 'r')\n", (736, 752), False, 'from netCDF4 import Dataset\n'), ((3034, 3050), 'xar... |
import copy
import numpy as np
def smoothen(test_data, pv_inds, filter_functions, keys=None):
"""Smoothens the test_data within each pv_inds with given filter_functions.
If filter_function is a dict with filter functions, test_data with those keys are smoothened.
If filter_function is just a single functi... | [
"copy.deepcopy",
"numpy.linalg.lstsq",
"numpy.polyfit",
"numpy.polyval",
"numpy.sort",
"numpy.linspace"
] | [((1651, 1675), 'copy.deepcopy', 'copy.deepcopy', (['test_data'], {}), '(test_data)\n', (1664, 1675), False, 'import copy\n'), ((2717, 2742), 'numpy.polyfit', 'np.polyfit', (['t', 'v'], {'deg': 'deg'}), '(t, v, deg=deg)\n', (2727, 2742), True, 'import numpy as np\n'), ((3826, 3862), 'numpy.linspace', 'np.linspace', (['... |
#!/usr/bin/env python
## Copyright 2020 IBM 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... | [
"sklearn.metrics.accuracy_score",
"sklearn.metrics.recall_score",
"logging.getLogger",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.brier_score_loss",
"sklearn.metrics.precision_score",
"sklearn.metrics.average_precision_score",
"six.iteritems",
"numpy.vstack"
] | [((893, 912), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (910, 912), False, 'import logging\n'), ((2547, 2620), 'sklearn.metrics.precision_score', 'precision_score', ([], {'y_true': 'y_true_top_k', 'y_pred': 'y_hat_top_k', 'average': 'average'}), '(y_true=y_true_top_k, y_pred=y_hat_top_k, average=avera... |
"""
This module contains the class "Engine", which contains the most important functions.
"""
import os
import io
#import matplotlib as mpl
#import matplotlib.pyplot as plt
import base64
import numpy as np
#import pyopencl as cl
from tqdm import tqdm
from .font_loader import load_font
from .filter_bank import Fil... | [
"io.BytesIO",
"os.path.abspath",
"tqdm.tqdm",
"numpy.sum",
"numpy.ceil",
"numpy.floor",
"numpy.zeros",
"base64.b64encode",
"numpy.arange",
"numpy.int32",
"numpy.array",
"os.path.join"
] | [((468, 506), 'os.path.join', 'os.path.join', (['script_dir', '"""kernels.cl"""'], {}), "(script_dir, 'kernels.cl')\n", (480, 506), False, 'import os\n'), ((421, 446), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (436, 446), False, 'import os\n'), ((2044, 2058), 'tqdm.tqdm', 'tqdm', (['glyp... |
# -*- coding: utf-8 -*-
"""
Multi Signals
=============
Defines the class implementing support for multi-continuous signals:
- :class:`colour.continuous.MultiSignals`
"""
from __future__ import division, unicode_literals
import numpy as np
import sys
# Python 3 compatibility.
try:
from operator import div, i... | [
"pandas.DataFrame",
"numpy.array_equal",
"numpy.hstack",
"colour.utilities.is_pandas_installed",
"colour.utilities.as_float_array",
"collections.OrderedDict",
"colour.utilities.tsplit"
] | [((26896, 26913), 'colour.utilities.as_float_array', 'as_float_array', (['y'], {}), '(y)\n', (26910, 26913), False, 'from colour.utilities import as_float_array, first_item, is_pandas_installed, tsplit, tstack\n'), ((42332, 42345), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (42343, 42345), False, 'from... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # ... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"evo.core.trajectory.align_trajectory",
"logging.Formatter",
"matplotlib.pyplot.figure",
"numpy.linalg.norm",
"evo.tools.plot.prepare_axis",
"evo.core.metrics.RPE",
"pandas.DataFrame",
"evo.core.metrics.APE",
"evo.tools.plot.trajectories",
"matplot... | [((575, 602), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (592, 602), False, 'import logging\n'), ((11155, 11216), 'pandas.read_csv', 'pd.read_csv', (['output_lcd_status_filename'], {'sep': '""","""', 'index_col': '(0)'}), "(output_lcd_status_filename, sep=',', index_col=0)\n", (11166,... |
import unittest
import numpy as np
import tensorflow as tf
from elasticdl.python.common.constants import DistributionStrategy
from elasticdl.python.common.model_handler import ModelHandler
from elasticdl.python.elasticdl.layers.embedding import Embedding
class CustomModel(tf.keras.models.Model):
def __init__(se... | [
"unittest.main",
"tensorflow.keras.layers.DenseFeatures",
"tensorflow.feature_column.numeric_column",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.backend.clear_session",
"numpy.ones",
"tensorflow.constant",
"tensorflow.keras.models.Model",
"tensorflow.feature_column.categorical_column_with_ha... | [((655, 698), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(4,)', 'name': '"""x"""'}), "(shape=(4,), name='x')\n", (676, 698), True, 'import tensorflow as tf\n'), ((816, 854), 'tensorflow.keras.models.Model', 'tf.keras.models.Model', (['inputs', 'outputs'], {}), '(inputs, outputs)\n', (837,... |
# -*- coding: utf-8 -*-
# @Time : 2020/10/28 2:18 下午
# @Author : zhengjiawei
# @FileName: nlu_slot_test.py
# @Software: PyCharm
import os
import json
import random
import numpy as np
from xbot.util.path import get_root_path
from xbot.nlu.slot.slot_with_bert import SlotWithBert
from data.crosswoz.data_process.nlu... | [
"data.crosswoz.data_process.nlu_slot_dataloader.Dataloader",
"data.crosswoz.data_process.nlu_slot_postprocess.recover_intent",
"numpy.random.seed",
"xbot.util.path.get_root_path",
"os.makedirs",
"data.crosswoz.data_process.nlu_slot_postprocess.calculate_f1",
"torch.manual_seed",
"os.path.exists",
"x... | [((513, 530), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (524, 530), False, 'import random\n'), ((535, 555), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (549, 555), True, 'import numpy as np\n'), ((560, 583), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (57... |
from PIL import Image
from matplotlib import pyplot as plt
import numpy as np
import face_recognition
import keras
from keras.models import load_model
import cv2
import time
emotion_dict= {'Angry': 0, 'Sad': 5, 'Neutral': 4, 'Disgust': 1, 'Surprise': 6, 'Fear': 2, 'Happy': 3}
emoji_array = {0: 'angerEmoji.png', 5: 'sa... | [
"keras.models.load_model",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.imread",
"numpy.reshape",
"cv2.flip",
"face_recognition.face_locations",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((452, 482), 'keras.models.load_model', 'load_model', (['"""model_v6_23.hdf5"""'], {}), "('model_v6_23.hdf5')\n", (462, 482), False, 'from keras.models import load_model\n'), ((525, 544), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (541, 544), False, 'import cv2\n'), ((2235, 2258), 'cv2.destroyAllW... |
#!/usr/bin/env python2
import unittest
import numpy as np
import libpandasafety_py
MAX_RATE_UP = 3
MAX_RATE_DOWN = 7
MAX_STEER = 255
MAX_RT_DELTA = 112
RT_INTERVAL = 250000
DRIVER_TORQUE_ALLOWANCE = 50;
DRIVER_TORQUE_FACTOR = 2;
def twos_comp(val, bits):
if val >= 0:
return val
else:
return (2**bits) + ... | [
"unittest.main",
"libpandasafety_py.ffi.new",
"numpy.arange"
] | [((7725, 7740), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7738, 7740), False, 'import unittest\n'), ((643, 697), 'libpandasafety_py.ffi.new', 'libpandasafety_py.ffi.new', (['"""CAN_FIFOMailBox_TypeDef *"""'], {}), "('CAN_FIFOMailBox_TypeDef *')\n", (668, 697), False, 'import libpandasafety_py\n'), ((858, 912... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.