code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
## Copyright 2019 <NAME>, <NAME>, <NAME>, <NAME>, and <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...
[ "tensorflow.nn.relu", "numpy.zeros", "tensorflow.nn.dropout", "tensorflow.concat", "numpy.ones", "tensorflow.matmul", "tensorflow.cast", "tensorflow.Variable", "tensorflow.exp", "tensorflow.truncated_normal" ]
[((1757, 1796), 'numpy.zeros', 'np.zeros', (['self.nb_gp_blocks', 'np.float32'], {}), '(self.nb_gp_blocks, np.float32)\n', (1765, 1796), True, 'import numpy as np\n'), ((1962, 2001), 'numpy.zeros', 'np.zeros', (['self.nb_gp_blocks', 'np.float32'], {}), '(self.nb_gp_blocks, np.float32)\n', (1970, 2001), True, 'import nu...
import configargparse import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import pandas as pd # hard-coded parameters(should be changed into parameters) feature_num = 10 feature_norm = [640, 6, 2048, 6, 640, 6, 2048, 6, 6, 2, 64, 64, 512, 8192, 1] output_norm = 10000000 header = 'enco...
[ "torch.nn.ModuleList", "pandas.read_csv", "torch.load", "numpy.hstack", "torch.Tensor", "torch.nn.Linear", "configargparse.ArgumentParser" ]
[((1382, 1413), 'configargparse.ArgumentParser', 'configargparse.ArgumentParser', ([], {}), '()\n', (1411, 1413), False, 'import configargparse\n'), ((1701, 1731), 'pandas.read_csv', 'pd.read_csv', (['args.dataset_path'], {}), '(args.dataset_path)\n', (1712, 1731), True, 'import pandas as pd\n'), ((2006, 2033), 'torch....
from __future__ import division from __future__ import print_function from builtins import zip from builtins import range from builtins import object # 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 com...
[ "util.create_directory", "tensorflow.get_collection", "tensorflow.constant_initializer", "tensorflow.assign", "builtins.range", "numpy.prod", "traceback.print_exc", "threading.Condition", "tensorflow.variable_scope", "util.get_largest_epoch_in_dir", "tensorflow.placeholder", "tensorflow.FIFOQu...
[((1664, 1685), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (1683, 1685), False, 'import traceback, threading, time, warnings\n'), ((1776, 1934), 'util.create_directory', 'util.create_directory', (["('%s/%s/%s/%s' % (self.config['output_root'], self.config['env']['name'],\n self.config['name'], s...
""" .. _tut_artifacts_reject: Rejecting bad data (channels and segments) ========================================== """ import numpy as np import mne from mne.datasets import sample data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif' raw = mne.io.read_raw_fif(raw_fna...
[ "mne.io.read_raw_fif", "mne.pick_types", "mne.read_evokeds", "mne.Annotations", "mne.preprocessing.find_eog_events", "mne.find_events", "mne.Epochs", "mne.datasets.sample.data_path", "numpy.repeat" ]
[((198, 216), 'mne.datasets.sample.data_path', 'sample.data_path', ([], {}), '()\n', (214, 216), False, 'from mne.datasets import sample\n'), ((293, 323), 'mne.io.read_raw_fif', 'mne.io.read_raw_fif', (['raw_fname'], {}), '(raw_fname)\n', (312, 323), False, 'import mne\n'), ((3303, 3373), 'mne.read_evokeds', 'mne.read_...
import numpy as np def lombscargle_scipy(t, y, frequency, normalization='standard', center_data=True): """Lomb-Scargle Periodogram This is a wrapper of ``scipy.signal.lombscargle`` for computation of the Lomb-Scargle periodogram. This is a relatively fast version of the naive O...
[ "numpy.mean", "numpy.asarray", "numpy.broadcast_arrays", "scipy.signal.lombscargle" ]
[((1503, 1528), 'numpy.broadcast_arrays', 'np.broadcast_arrays', (['t', 'y'], {}), '(t, y)\n', (1522, 1528), True, 'import numpy as np\n'), ((1580, 1606), 'numpy.asarray', 'np.asarray', (['t'], {'dtype': 'float'}), '(t, dtype=float)\n', (1590, 1606), True, 'import numpy as np\n'), ((1615, 1641), 'numpy.asarray', 'np.as...
#!/usr/bin/env python3 ''' Deterministic numerical solver for ODE systems <NAME>. used for Cardenas & Santos-Vega, 2021 Coded by github.com/pablocarderam Creates heatmaps of contact rate and mutant fitness cost used in Figure 3b-c ''' ### Imports ### import numpy as np # handle arrays import pandas as pd from scipy...
[ "seaborn.set_style", "matplotlib.pyplot.subplot", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "numpy.power", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((473, 495), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (486, 495), True, 'import seaborn as sns\n'), ((3710, 3745), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4)', 'dpi': '(200)'}), '(figsize=(6, 4), dpi=200)\n', (3720, 3745), True, 'import matplotlib.pyplot as pl...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "six.moves.range", "warnings.warn", "numpy.array", "six.moves.zip" ]
[((5377, 5506), 'warnings.warn', 'warnings.warn', (['("The data type of \'%s\' in %s only support float16 in GPU now. %s" % (\n input_name, op_name, extra_message))'], {}), '(\n "The data type of \'%s\' in %s only support float16 in GPU now. %s" % (\n input_name, op_name, extra_message))\n', (5390, 5506), Fals...
import tensorflow import numpy as np import cv2 import os from os.path import isfile, join from mtcnn_pytorch_master.src.detector import detect_faces from mtcnn_pytorch_master.src.visualization_utils import show_bboxes from PIL import Image def convert_to_square(bboxes): """Convert bounding boxes to a square form...
[ "numpy.zeros_like", "numpy.maximum", "cv2.VideoWriter_fourcc", "mtcnn_pytorch_master.src.detector.detect_faces", "cv2.imwrite", "PIL.Image.open", "cv2.VideoCapture", "cv2.imread", "mtcnn_pytorch_master.src.visualization_utils.show_bboxes" ]
[((515, 536), 'numpy.zeros_like', 'np.zeros_like', (['bboxes'], {}), '(bboxes)\n', (528, 536), True, 'import numpy as np\n'), ((1152, 1169), 'PIL.Image.open', 'Image.open', (['image'], {}), '(image)\n', (1162, 1169), False, 'from PIL import Image\n'), ((1213, 1250), 'mtcnn_pytorch_master.src.detector.detect_faces', 'de...
import pandas as pd import matplotlib.pyplot as plt import cv2 import numpy as np from Model.BoundaryDescriptor import get_contours_binary, calc_contour_feature, draw_bbox def get_canny(img, isShow=True): gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(gray, (5, 5), 0) ca...
[ "cv2.GaussianBlur", "cv2.Canny", "cv2.cvtColor", "cv2.threshold", "numpy.hstack", "numpy.where", "numpy.mean", "cv2.findContours" ]
[((226, 263), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (238, 263), False, 'import cv2\n'), ((279, 312), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['gray', '(5, 5)', '(0)'], {}), '(gray, (5, 5), 0)\n', (295, 312), False, 'import cv2\n'), ((326, 353), 'cv2.Canny',...
import numpy as np import cv2 import torch from segmentoly.utils.visualizer import Visualizer from text_spotting.data.alphabet import AlphabetDecoder class TextVisualizer(Visualizer): def __init__(self, text_confidence_threshold, *args, **kwargs): super().__init__(*args, **kwargs) self.alphabet_...
[ "cv2.bitwise_and", "numpy.argmax", "numpy.asarray", "cv2.getTextSize", "numpy.zeros", "cv2.addWeighted", "numpy.max", "cv2.bitwise_or", "numpy.mean", "text_spotting.data.alphabet.AlphabetDecoder" ]
[((330, 347), 'text_spotting.data.alphabet.AlphabetDecoder', 'AlphabetDecoder', ([], {}), '()\n', (345, 347), False, 'from text_spotting.data.alphabet import AlphabetDecoder\n'), ((2309, 2350), 'numpy.zeros', 'np.zeros', (['image.shape[:2]'], {'dtype': 'np.uint8'}), '(image.shape[:2], dtype=np.uint8)\n', (2317, 2350), ...
from datetime import datetime from fastai import callbacks from fastai.basic_train import Learner, load_learner from fastai.metrics import exp_rmspe from fastai.tabular import DatasetType, FloatList, tabular_learner, TabularList from fastai.train import fit_one_cycle from functools import partial import math import num...
[ "preprocess.preprocess", "functools.partial", "preprocess.gather_args", "fastai.tabular.TabularList.from_df", "pandas.read_csv", "pathlib.Path", "numpy.exp", "datetime.datetime.now", "os.listdir" ]
[((468, 494), 'pathlib.Path', 'Path', (['"""../../data/interim"""'], {}), "('../../data/interim')\n", (472, 494), False, 'from pathlib import Path\n'), ((509, 530), 'pathlib.Path', 'Path', (['"""../../models/"""'], {}), "('../../models/')\n", (513, 530), False, 'from pathlib import Path\n'), ((1607, 1638), 'preprocess....
""" code inspired by https://github.com/gan3sh500/mixmatch-pytorch and https://github.com/google-research/mixmatch """ import torch import numpy as np from torch.nn import functional as F from .utils import label_guessing, sharpen # for type hint from typing import Optional, Dict, Union, List, Sequence from torch imp...
[ "numpy.random.beta", "torch.nn.functional.one_hot", "torch.cat", "torch.no_grad", "numpy.random.shuffle" ]
[((1389, 1404), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1402, 1404), False, 'import torch\n'), ((2460, 2475), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2473, 2475), False, 'import torch\n'), ((4520, 4549), 'torch.cat', 'torch.cat', (['u_augmented'], {'dim': '(0)'}), '(u_augmented, dim=0)\n', (45...
import numpy as np import pandas as pd from .bounce import bounce BALL_RADIUS = 91.25 SIDE_WALL_DISTANCE = 4096 BACK_WALL_DISTANCE = 5140 CEILING_DISTANCE = 2044 CORNER_WALL_DISTANCE = 8000 GOAL_X = 892.75 GOAL_X = 950 GOAL_Z = 640 GOAL_Z = 750 GOAL_Z = 900 x = 590 # CURVE_RADIUS_1, CURVE_RADIUS_2, CURVE_RADIUS_3 = 5...
[ "numpy.sqrt", "numpy.array", "numpy.concatenate", "numpy.column_stack" ]
[((2036, 2106), 'numpy.concatenate', 'np.concatenate', (["(self.sim_vars['position'], self.sim_vars['velocity'])"], {}), "((self.sim_vars['position'], self.sim_vars['velocity']))\n", (2050, 2106), True, 'import numpy as np\n'), ((3344, 3357), 'numpy.array', 'np.array', (['t_s'], {}), '(t_s)\n', (3352, 3357), True, 'imp...
__all__ = ['interp1d', 'interp2d', 'lagrange', 'PPoly', 'BPoly', 'NdPPoly', 'RegularGridInterpolator', 'interpn'] import itertools import warnings import numpy as np from numpy import (array, transpose, searchsorted, atleast_1d, atleast_2d, ravel, poly1d, asarray, intp) import scipy.spe...
[ "numpy.moveaxis", "numpy.amin", "numpy.ravel", "numpy.empty", "scipy.special.comb", "numpy.ones", "numpy.isnan", "numpy.argsort", "scipy.special.poch", "numpy.arange", "numpy.interp", "numpy.atleast_2d", "numpy.zeros_like", "numpy.logical_not", "numpy.transpose", "numpy.empty_like", ...
[((2335, 2346), 'numpy.poly1d', 'poly1d', (['(0.0)'], {}), '(0.0)\n', (2341, 2346), False, 'from numpy import array, transpose, searchsorted, atleast_1d, atleast_2d, ravel, poly1d, asarray, intp\n'), ((2383, 2395), 'numpy.poly1d', 'poly1d', (['w[j]'], {}), '(w[j])\n', (2389, 2395), False, 'from numpy import array, tran...
# -*- coding: utf-8 -*- """ 影像繪製 繪製特徵點 """ import cv2 import numpy as np import matplotlib.pyplot as plt def plt_image_show(image, color=None, title=None, savepath=""): plt.imshow(image, cmap=color) plt.title(title) plt.savefig(savepath) plt.show() def plt_keypoints(im, gd=None, pr=None, savedir="...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "cv2.cvtColor", "matplotlib.pyplot.imshow", "matplotlib.pyplot.scatter", "numpy.min", "numpy.max", "cv2.rectangle", "matplotlib.pyplot.savefig" ]
[((177, 206), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image'], {'cmap': 'color'}), '(image, cmap=color)\n', (187, 206), True, 'import matplotlib.pyplot as plt\n'), ((211, 227), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (220, 227), True, 'import matplotlib.pyplot as plt\n'), ((232, 253),...
import time import tensorflow as tf import numpy as np from six.moves import cPickle # def var(t, requires_grad=False): # if cuda.device_count() > 0: # return Variable(t.cuda(), requires_grad=requires_grad) # else: # return Variable(t, requires_grad=requires_grad) def Gaussian2D(x, mu, sigma, rho): eps = 1e-10...
[ "numpy.load", "tensorflow.reduce_sum", "tensorflow.reshape", "tensorflow.train.AdamOptimizer", "tensorflow.matmul", "tensorflow.sqrt", "tensorflow.nn.softmax", "tensorflow.one_hot", "tensorflow.add_n", "tensorflow.placeholder", "tensorflow.exp", "tensorflow.range", "tensorflow.global_variabl...
[((1109, 1147), 'numpy.load', 'np.load', (['points_file'], {'encoding': '"""bytes"""'}), "(points_file, encoding='bytes')\n", (1116, 1147), True, 'import numpy as np\n'), ((471, 505), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(norm_x ** 2)'], {'axis': '(0)'}), '(norm_x ** 2, axis=0)\n', (484, 505), True, 'import ten...
from __future__ import print_function from __future__ import absolute_import import os import numpy as np import time import logging import argparse from collections import OrderedDict import faiss import torch import torch.nn as nn from models import SupResNet, SSLResNet from utils import ( get_features, ge...
[ "os.mkdir", "argparse.ArgumentParser", "utils.get_fpr", "numpy.mean", "numpy.linalg.norm", "os.path.join", "numpy.unique", "logging.FileHandler", "numpy.copy", "numpy.std", "torch.load", "faiss.Kmeans", "models.SupResNet", "models.SSLResNet", "utils.get_roc_sklearn", "numpy.cov", "to...
[((939, 1016), 'faiss.Kmeans', 'faiss.Kmeans', (['ftrain.shape[1]', 'nclusters'], {'niter': '(100)', 'verbose': '(False)', 'gpu': '(False)'}), '(ftrain.shape[1], nclusters, niter=100, verbose=False, gpu=False)\n', (951, 1016), False, 'import faiss\n'), ((1896, 1915), 'numpy.min', 'np.min', (['din'], {'axis': '(0)'}), '...
from functools import partial import numpy as np import torch import torch.nn as nn from estimation_methods.abstract_estimation_method import \ AbstractEstimationMethod from utils.torch_utils import np_to_tensor, torch_to_np, torch_softplus from utils.train_network_flexible import train_network_flexible class S...
[ "estimation_methods.abstract_estimation_method.AbstractEstimationMethod.__init__", "functools.partial", "numpy.einsum", "numpy.ones", "torch.nn.Linear", "utils.train_network_flexible.train_network_flexible", "torch.nn.Module.__init__", "utils.torch_utils.np_to_tensor", "torch.nn.LeakyReLU", "torch...
[((553, 616), 'estimation_methods.abstract_estimation_method.AbstractEstimationMethod.__init__', 'AbstractEstimationMethod.__init__', (['self', 'rho_generator', 'rho_dim'], {}), '(self, rho_generator, rho_dim)\n', (586, 616), False, 'from estimation_methods.abstract_estimation_method import AbstractEstimationMethod\n')...
import csv import sys from glob import glob from PIL import Image from PIL import ImageFont from PIL import ImageDraw from natsort import natsorted as nsd from Levenshtein import distance as dst import numpy as np def min_diff(text, queries): dffs = [dst(text, x[1]) for x in queries] idx = dffs.index(min(dffs)...
[ "PIL.Image.new", "csv.reader", "Levenshtein.distance", "numpy.zeros", "PIL.Image.open", "PIL.Image.fromarray", "PIL.ImageDraw.Draw" ]
[((2031, 2046), 'PIL.Image.open', 'Image.open', (['f1n'], {}), '(f1n)\n', (2041, 2046), False, 'from PIL import Image\n'), ((6541, 6594), 'numpy.zeros', 'np.zeros', (['(n_its * 50, n_its * 50, 3)'], {'dtype': 'np.uint8'}), '((n_its * 50, n_its * 50, 3), dtype=np.uint8)\n', (6549, 6594), True, 'import numpy as np\n'), (...
# -*- coding: utf-8 -*- from statsmodels.compat.pandas import Appender, Substitution, to_numpy from collections.abc import Iterable import datetime as dt from types import SimpleNamespace import warnings import numpy as np import pandas as pd from scipy.stats import gaussian_kde, norm from statsmodels.tsa.base.predi...
[ "statsmodels.base.wrapper.populate_wrapper", "numpy.roots", "numpy.sum", "numpy.arctan2", "numpy.abs", "statsmodels.stats.diagnostic.het_arch", "numpy.empty", "numpy.ones", "numpy.isnan", "statsmodels.tools.validation.bool_like", "numpy.arange", "statsmodels.tools.docstring.Docstring", "stat...
[((29593, 29627), 'statsmodels.tools.docstring.Docstring', 'Docstring', (['AutoReg.predict.__doc__'], {}), '(AutoReg.predict.__doc__)\n', (29602, 29627), False, 'from statsmodels.tools.docstring import Docstring, remove_parameters\n'), ((57478, 57538), 'statsmodels.base.wrapper.populate_wrapper', 'wrap.populate_wrapper...
from pathlib import Path import numpy as np import pandas as pd from gym.utils import seeding import gym from gym import spaces import matplotlib import os matplotlib.use("Agg") import matplotlib.pyplot as plt import pickle from stable_baselines3.common.vec_env import DummyVecEnv from stable_baselines3.common import l...
[ "pandas.DataFrame", "fin_stats.stat_all", "numpy.load", "numpy.save", "rsrs.update", "numpy.ceil", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.argsort", "hashlib.sha256", "rsrs.init_rsrs", "matplotlib.use", "numpy.array", "gym.spaces.Box", "numpy.where", "stable_baselin...
[((157, 178), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (171, 178), False, 'import matplotlib\n'), ((1557, 1611), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-1)', 'high': '(1)', 'shape': '(self.action_space,)'}), '(low=-1, high=1, shape=(self.action_space,))\n', (1567, 1611), False, 'fro...
# Copyright (c) 2020, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the follow...
[ "numpy.zeros_like", "numpy.ones_like", "finn.transformation.infer_shapes.InferShapes" ]
[((3246, 3259), 'finn.transformation.infer_shapes.InferShapes', 'InferShapes', ([], {}), '()\n', (3257, 3259), False, 'from finn.transformation.infer_shapes import InferShapes\n'), ((2789, 2805), 'numpy.zeros_like', 'np.zeros_like', (['A'], {}), '(A)\n', (2802, 2805), True, 'import numpy as np\n'), ((3136, 3151), 'nump...
import dash import dash_core_components as dcc import dash_html_components as html import dash_leaflet as dl import dash_leaflet.express as dlx import db import numpy as np import pandas as pd import plotly.express as px from dash.dependencies import Output, Input from dash_extensions.javascript import assign TITLE =...
[ "numpy.mean", "dash_leaflet.Colorbar", "numpy.interp", "pandas.DataFrame", "dash_html_components.H3", "dash.Dash", "dash_html_components.Div", "dash_core_components.send_data_frame", "plotly.express.line", "dash_leaflet.GeoJSON", "dash_core_components.Interval", "dash_core_components.Download"...
[((519, 597), 'dash.Dash', 'dash.Dash', (['__name__'], {'title': 'TITLE', 'update_title': 'None', 'external_scripts': '[chroma]'}), '(__name__, title=TITLE, update_title=None, external_scripts=[chroma])\n', (528, 597), False, 'import dash\n'), ((633, 746), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Time', ...
# # Unity ML-Agents Toolkit # ## ML-Agent Learning (PPO) # Contains an implementation of PPO as described in: https://arxiv.org/abs/1707.06347 from collections import defaultdict from typing import cast import numpy as np from mlagents_envs.logging_util import get_logger from mlagents_envs.base_env import BehaviorSp...
[ "numpy.zeros_like", "numpy.sum", "mlagents_envs.logging_util.get_logger", "typing.cast", "collections.defaultdict", "numpy.append", "numpy.mean", "numpy.array", "mlagents.trainers.policy.tf_policy.TFPolicy" ]
[((738, 758), 'mlagents_envs.logging_util.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (748, 758), False, 'from mlagents_envs.logging_util import get_logger\n'), ((10572, 10588), 'numpy.zeros_like', 'np.zeros_like', (['r'], {}), '(r)\n', (10585, 10588), True, 'import numpy as np\n'), ((11290, 11328), ...
from sklearn.datasets import load_files from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.pipeline import Pipeline from nltk import FreqDist import numpy as np import nltk from...
[ "pandas.DataFrame", "sklearn.ensemble.RandomForestClassifier", "sklearn.feature_extraction.text.CountVectorizer", "matplotlib.pyplot.show", "math.sqrt", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.model_selection.train_test_split", "numpy.sin", "numpy.arange", "numpy.mean", "skle...
[((927, 993), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'use_idf': '(True)', 'smooth_idf': '(True)', 'sublinear_tf': '(False)'}), '(use_idf=True, smooth_idf=True, sublinear_tf=False)\n', (942, 993), False, 'from sklearn.feature_extraction.text import TfidfVectorizer\n'), ((1620, 1647),...
""" pyscal module for creating crystal structures. """ import pyscal.catom as pc import numpy as np import warnings def make_crystal(structure, lattice_constant = 1.00, repetitions = None, ca_ratio = 1.633, noise = 0): """ Create a basic crystal structure and return it as a list of `Atom` objects and box ...
[ "pyscal.catom.Atom", "numpy.zeros", "numpy.random.normal", "numpy.sqrt" ]
[((1933, 1951), 'numpy.zeros', 'np.zeros', (['coord_no'], {}), '(coord_no)\n', (1941, 1951), True, 'import numpy as np\n'), ((1972, 1990), 'numpy.zeros', 'np.zeros', (['coord_no'], {}), '(coord_no)\n', (1980, 1990), True, 'import numpy as np\n'), ((2011, 2029), 'numpy.zeros', 'np.zeros', (['coord_no'], {}), '(coord_no)...
import argparse import os import cv2 import numpy as np import tensorflow as tf from model import Nivdia_Model import reader FLAGS = None def visualize(image, mask): # cast image from yuv to brg. image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR) max_val = np.max(mask) min_val = np.min(mask) mask =...
[ "reader.Reader", "numpy.copy", "tensorflow.train.Saver", "cv2.cvtColor", "argparse.ArgumentParser", "os.makedirs", "tensorflow.global_variables_initializer", "tensorflow.Session", "model.Nivdia_Model", "os.path.exists", "tensorflow.placeholder", "numpy.max", "numpy.min", "tensorflow.train....
[((217, 255), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_YUV2BGR'], {}), '(image, cv2.COLOR_YUV2BGR)\n', (229, 255), False, 'import cv2\n'), ((270, 282), 'numpy.max', 'np.max', (['mask'], {}), '(mask)\n', (276, 282), True, 'import numpy as np\n'), ((297, 309), 'numpy.min', 'np.min', (['mask'], {}), '(mask)\n...
# This example requires pandas, numpy, sklearn, scipy # Inspired by an MLFlow tutorial: # https://github.com/databricks/mlflow/blob/master/example/tutorial/train.py import datetime import itertools import logging import sys from typing import Tuple import numpy as np import pandas as pd from pandas import DataFram...
[ "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.r2_score", "sklearn.metrics.mean_absolute_error", "dbnd.utils.data_combine", "matplotlib.pyplot.figure", "numpy.arange", "dbnd.dbnd_config", "dbnd_examples.pipelines.wine_quality.serving.docker.package_as_docker", "skl...
[((876, 903), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (893, 903), False, 'import logging\n'), ((1255, 1308), 'dbnd.task', 'task', ([], {'result': '"""training_set, test_set, validation_set"""'}), "(result='training_set, test_set, validation_set')\n", (1259, 1308), False, 'from dbnd...
import asyncio import discord import random import datetime import numpy import pytz import collections import pymongo import os from discord.ext import commands from cogs.utils.misc import level_up from cogs.utils.checks import is_economy_channel, has_registered from cogs.utils.embed import (passembed, errorembed) c...
[ "discord.ext.commands.command", "cogs.utils.checks.has_registered", "discord.Embed", "asyncio.sleep", "cogs.utils.embed.errorembed", "discord.Color.green", "random.choice", "discord.ext.commands.has_any_role", "cogs.utils.misc.level_up", "discord.Color.purple", "cogs.utils.embed.passembed", "d...
[((575, 593), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (591, 593), False, 'from discord.ext import commands\n'), ((599, 618), 'discord.ext.commands.is_owner', 'commands.is_owner', ([], {}), '()\n', (616, 618), False, 'from discord.ext import commands\n'), ((3254, 3287), 'discord.ext.command...
import numpy as np import torch from torch import nn from torch.nn import functional as F from torchvision.ops import nms import sys from anchors import _enumerate_shifted_anchor, generate_anchor_base from util import loc2bbox class ProposalCreator(): def __init__(self, mode, nms_thresh=0.7, ...
[ "util.loc2bbox", "torch.where", "torch.nn.Conv2d", "torch.argsort", "anchors.generate_anchor_base", "torch.cat", "torch.nn.functional.softmax", "torch.clamp", "numpy.array", "torchvision.ops.nms", "torch.from_numpy" ]
[((1136, 1160), 'torch.from_numpy', 'torch.from_numpy', (['anchor'], {}), '(anchor)\n', (1152, 1160), False, 'import torch\n'), ((1363, 1384), 'util.loc2bbox', 'loc2bbox', (['anchor', 'loc'], {}), '(anchor, loc)\n', (1371, 1384), False, 'from util import loc2bbox\n'), ((1534, 1585), 'torch.clamp', 'torch.clamp', (['roi...
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "paddle_serving_app.reader.Resize", "paddle_serving_app.reader.Normalize", "cv2.imdecode", "paddle_serving_app.reader.CenterCrop", "paddle_serving_app.reader.RGB2BGR", "paddle_serving_app.reader.Transpose", "paddle_serving_app.reader.Div", "numpy.fromstring", "numpy.concatenate" ]
[((1838, 1866), 'numpy.concatenate', 'np.concatenate', (['imgs'], {'axis': '(0)'}), '(imgs, axis=0)\n', (1852, 1866), True, 'import numpy as np\n'), ((1651, 1680), 'numpy.fromstring', 'np.fromstring', (['data', 'np.uint8'], {}), '(data, np.uint8)\n', (1664, 1680), True, 'import numpy as np\n'), ((1698, 1734), 'cv2.imde...
import copy import numpy import pytest from scipy.constants import convert_temperature from pvfit.common.constants import T_K_stc, T_degC_stc, k_B_J_per_K, minimize_scalar_bounded_options_default, q_C import pvfit.modeling.single_diode.equation as equation @pytest.fixture( # Not necessarily I-V curve solutions....
[ "pvfit.modeling.single_diode.equation.I_at_V", "pvfit.modeling.single_diode.equation.V_at_I_d1", "scipy.constants.convert_temperature", "numpy.isnan", "numpy.float64", "numpy.testing.assert_array_almost_equal", "numpy.full", "numpy.isfinite", "numpy.expm1", "pytest.raises", "pvfit.modeling.singl...
[((8647, 8800), 'pvfit.modeling.single_diode.equation.current_sum_at_diode_node', 'equation.current_sum_at_diode_node', ([], {'V_V': 'V_V', 'I_A': 'I_A', 'N_s': 'N_s', 'T_degC': 'T_degC', 'I_ph_A': 'I_ph_A', 'I_rs_1_A': 'I_rs_1_A', 'n_1': 'n_1', 'R_s_Ohm': 'R_s_Ohm', 'G_p_S': 'G_p_S'}), '(V_V=V_V, I_A=I_A, N_s=N_s, T_d...
import os import numpy as np num_posts = 0 num_replies = 0 max_replies = 0 source_ids = [] reply_ids = [] dir = "data/test/twitter-en-test-data" for x in os.listdir(dir): for y in os.listdir(f"{dir}/{x}"): source_ids.append(y) num_posts += 1 for z in os.listdir(f"{dir}/{x}/{y}"): ...
[ "numpy.max", "numpy.min", "os.listdir", "numpy.unique" ]
[((159, 174), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (169, 174), False, 'import os\n'), ((685, 700), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (695, 700), False, 'import os\n'), ((968, 1008), 'numpy.unique', 'np.unique', (['reply_ids'], {'return_counts': '(True)'}), '(reply_ids, return_counts...
from random import gammavariate import numpy as np import graphlearning as gl def generate(low, high, size, rng=None): if rng is None: data = np.random.uniform(low, high, size) else: data = rng.uniform(low, high, size) data[0] = low + 0.1 * (high - low) data[1] = low + 0.9 * (high - l...
[ "numpy.random.uniform", "numpy.where", "numpy.abs", "graphlearning.datasets.save" ]
[((369, 401), 'numpy.where', 'np.where', (['(data[:, 0] > 0.5)', '(1)', '(0)'], {}), '(data[:, 0] > 0.5, 1, 0)\n', (377, 401), True, 'import numpy as np\n'), ((635, 689), 'graphlearning.datasets.save', 'gl.datasets.save', (['data', 'labels', '"""line"""'], {'overwrite': '(True)'}), "(data, labels, 'line', overwrite=Tru...
import numpy as np import cv2 import mmcv from ..builder import PIPELINES @PIPELINES.register_module() class LoadRPDV2Annotations(object): """Load mutiple types of annotations. Args: with_bbox (bool): Whether to parse and load the bbox annotation. Default: True. with_label (bool): Whether to parse and load...
[ "cv2.line", "numpy.zeros_like", "numpy.maximum", "numpy.argsort", "numpy.nonzero", "numpy.array", "mmcv.imrescale" ]
[((1407, 1427), 'numpy.argsort', 'np.argsort', (['gt_areas'], {}), '(gt_areas)\n', (1417, 1427), True, 'import numpy as np\n'), ((4168, 4210), 'numpy.zeros_like', 'np.zeros_like', (['gt_masks[0]'], {'dtype': 'np.uint8'}), '(gt_masks[0], dtype=np.uint8)\n', (4181, 4210), True, 'import numpy as np\n'), ((3780, 3841), 'mm...
# -*- coding: utf-8 -*- # This file is part of the pyMOR project (http://www.pymor.org). # Copyright Holders: <NAME>, <NAME>, <NAME> # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) # # Contributors: <NAME> <<EMAIL>> from __future__ import absolute_import, division, print_function from nu...
[ "numpy.min", "numpy.max", "numpy.unique" ]
[((17639, 17653), 'numpy.unique', 'np.unique', (['ind'], {}), '(ind)\n', (17648, 17653), True, 'import numpy as np\n'), ((17012, 17023), 'numpy.min', 'np.min', (['ind'], {}), '(ind)\n', (17018, 17023), True, 'import numpy as np\n'), ((17028, 17039), 'numpy.max', 'np.max', (['ind'], {}), '(ind)\n', (17034, 17039), True,...
import numpy as np from scipy import stats import pandas as pd def beta_geometric_nbd_model(T, r, alpha, a, b, size=1): """ Generate artificial data according to the BG/NBD model. See [1] for model details Parameters ---------- T: array_like The length of time observing new customer...
[ "scipy.stats.beta.rvs", "numpy.sum", "numpy.random.binomial", "scipy.stats.gamma.rvs", "numpy.random.beta", "numpy.asarray", "numpy.ones", "numpy.max", "numpy.random.random", "numpy.array", "scipy.stats.expon.rvs" ]
[((968, 999), 'scipy.stats.beta.rvs', 'stats.beta.rvs', (['a', 'b'], {'size': 'size'}), '(a, b, size=size)\n', (982, 999), False, 'from scipy import stats\n'), ((1014, 1062), 'scipy.stats.gamma.rvs', 'stats.gamma.rvs', (['r'], {'scale': '(1.0 / alpha)', 'size': 'size'}), '(r, scale=1.0 / alpha, size=size)\n', (1029, 10...
#!/usr/bin/python #-*- coding: utf-8 -*- import os import glob import sys import time from sklearn import metrics import numpy import pdb def tuneThresholdfromScore(scores, labels, target_fa, target_fr = None): fpr, tpr, thresholds = metrics.roc_curve(labels, scores, pos_label=1) fnr = 1 - tpr f...
[ "numpy.absolute", "sklearn.metrics.roc_curve" ]
[((245, 291), 'sklearn.metrics.roc_curve', 'metrics.roc_curve', (['labels', 'scores'], {'pos_label': '(1)'}), '(labels, scores, pos_label=1)\n', (262, 291), False, 'from sklearn import metrics\n'), ((785, 810), 'numpy.absolute', 'numpy.absolute', (['(fnr - fpr)'], {}), '(fnr - fpr)\n', (799, 810), False, 'import numpy\...
from model_side_know_test import Model import json import pickle import torch import torch.nn as nn import torch.nn.functional as F import datetime import time import torch.optim as optim from collections import deque import math import numpy as np from pick_similar_sentences import get_similar_movie_responses device...
[ "json.load", "torch.unique", "pick_similar_sentences.get_similar_movie_responses", "torch.argmax", "torch.load", "torch.nn.CrossEntropyLoss", "torch.cat", "time.time", "pickle.load", "model_side_know_test.Model", "torch.cuda.is_available", "numpy.array", "datetime.datetime.fromtimestamp", ...
[((819, 879), 'torch.zeros', 'torch.zeros', (['(max_val + 1)'], {'requires_grad': '(False)', 'device': 'device'}), '(max_val + 1, requires_grad=False, device=device)\n', (830, 879), False, 'import torch\n'), ((3687, 3722), 'model_side_know_test.Model', 'Model', (['(256)', '(max_val + 1)', 'prob_vocab'], {}), '(256, max...
"""utils.py Shared utilities for the code for reproducing results from Dingwall and Potts, 'Mittens: an extension of glove for learning domain- specialized representations' (NAACL 2018). """ import bootstrap from collections import Counter, defaultdict import csv import numpy as np from operator import itemgetter impo...
[ "csv.reader", "pandas.read_csv", "numpy.ones", "collections.defaultdict", "numpy.mean", "numpy.random.normal", "sklearn_crfsuite.metrics.flat_f1_score", "sklearn_crfsuite.metrics.flat_precision_score", "tokenizing.WordOnlyTokenizer", "sklearn_crfsuite.metrics.sequence_accuracy_score", "bootstrap...
[((663, 716), 'tokenizing.WordOnlyTokenizer', 'WordOnlyTokenizer', ([], {'lower': '(True)', 'preserve_acronyms': '(True)'}), '(lower=True, preserve_acronyms=True)\n', (680, 716), False, 'from tokenizing import WordOnlyTokenizer\n'), ((2239, 2255), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (225...
# compute Orion import sys import numpy as np import pandas as pd n = int(sys.argv[1]) n_orion = 1662 N_eff = 10000 * n / n_orion window = 501 chrom = sys.argv[2] snvs_fn = sys.argv[3] snvs = pd.read_csv(snvs_fn, sep='\t', header=None, names=['pos', 'ac']) snvs_pos_ac = snvs.groupby('pos')['ac'].sum().reset_index()....
[ "numpy.minimum", "numpy.sum", "pandas.read_csv", "numpy.zeros", "numpy.arange", "numpy.array" ]
[((195, 259), 'pandas.read_csv', 'pd.read_csv', (['snvs_fn'], {'sep': '"""\t"""', 'header': 'None', 'names': "['pos', 'ac']"}), "(snvs_fn, sep='\\t', header=None, names=['pos', 'ac'])\n", (206, 259), True, 'import pandas as pd\n'), ((350, 406), 'numpy.minimum', 'np.minimum', (['snvs_pos_ac[:, 1]', '(2 * n - snvs_pos_ac...
import torch import torch.utils.data as data import random import math import os import logging from utils import config import pickle from tqdm import tqdm import numpy as np import pprint pp = pprint.PrettyPrinter(indent=1) import re import time import nltk from collections import deque class Lang: def __init__...
[ "numpy.load", "pickle.dump", "os.path.exists", "pprint.PrettyPrinter", "pickle.load", "collections.deque" ]
[((196, 226), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(1)'}), '(indent=1)\n', (216, 226), False, 'import pprint\n'), ((1335, 1397), 'numpy.load', 'np.load', (['"""data/empathetic-dialogue/sys_dialog_texts.train.npy"""'], {}), "('data/empathetic-dialogue/sys_dialog_texts.train.npy')\n", (1342, 1...
# Author: <NAME> <<EMAIL>> """Plot uniform time-series of one variable.""" import operator import matplotlib as mpl import numpy as np from .._celltable import Celltable from .._data_obj import ascategorial, asndvar, assub, cellname, longname from .._stats import stats from . import _base from ._base import ( Eel...
[ "numpy.any", "functools.reduce", "matplotlib.patches.Rectangle" ]
[((21767, 21782), 'numpy.any', 'np.any', (['(y.x < 0)'], {}), '(y.x < 0)\n', (21773, 21782), True, 'import numpy as np\n'), ((21787, 21802), 'numpy.any', 'np.any', (['(y.x > 0)'], {}), '(y.x > 0)\n', (21793, 21802), True, 'import numpy as np\n'), ((6070, 6097), 'functools.reduce', 'reduce', (['operator.mod', 'all_x'], ...
# Copyright The PyTorch Lightning team. # # 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 i...
[ "pl_examples.cli_lightning_logo", "torch.nn.MSELoss", "pytorch_lightning.Trainer", "numpy.random.seed", "argparse.ArgumentParser", "gym.make", "torch.utils.data.DataLoader", "torch.nn.ReLU", "torch.manual_seed", "numpy.random.random", "numpy.array", "collections.namedtuple", "torch.max", "...
[((2379, 2471), 'collections.namedtuple', 'namedtuple', (['"""Experience"""'], {'field_names': "['state', 'action', 'reward', 'done', 'new_state']"}), "('Experience', field_names=['state', 'action', 'reward', 'done',\n 'new_state'])\n", (2389, 2471), False, 'from collections import OrderedDict, deque, namedtuple\n')...
# Tests for functions in surf_plotting.py import os import tempfile import warnings import itertools from distutils.version import LooseVersion import nibabel as nb import numpy as np import pytest from numpy.testing import assert_array_equal, assert_array_almost_equal from scipy.spatial import Delaunay from nibab...
[ "nilearn.surface.surface._nearest_voxel_sampling", "os.remove", "nibabel.gifti.GiftiDataArray.from_array", "numpy.abs", "nibabel.gifti.GiftiDataArray", "numpy.diagflat", "nilearn.surface.surface._vertex_outer_normals", "nilearn.image.tests.test_resampling.rotation", "numpy.ones", "nilearn.surface....
[((906, 935), 'os.path.join', 'os.path.join', (['currdir', '"""data"""'], {}), "(currdir, 'data')\n", (918, 935), False, 'import os\n'), ((869, 894), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (884, 894), False, 'import os\n'), ((1042, 1057), 'numpy.zeros', 'np.zeros', (['(20,)'], {}), '(...
# Copyright (c) Microsoft. All rights reserved. import random import torch import numpy import subprocess class AverageMeter(object): """Computes and stores the average and current value.""" def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.su...
[ "numpy.random.seed", "random.randint", "torch.manual_seed", "subprocess.check_output", "torch.cuda.manual_seed_all", "subprocess.call", "random.seed", "torch.cuda.is_available" ]
[((607, 624), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (618, 624), False, 'import random\n'), ((629, 652), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed)\n', (646, 652), False, 'import numpy\n'), ((657, 680), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (674,...
""" Decodes sequences of tags, e.g., POS tags, given a list of contextualized word embeddings """ from typing import Optional, Any, Dict, List from overrides import overrides import numpy import torch from torch.nn.modules.linear import Linear from torch.nn.modules.adaptive import AdaptiveLogSoftmaxWithLoss import to...
[ "allennlp.nn.InitializerApplicator", "allennlp.models.model.Model.register", "torch.gather", "torch.zeros_like", "numpy.argmax", "torch.nn.modules.linear.Linear", "torch.nn.functional.softmax", "allennlp.training.metrics.CategoricalAccuracy", "torch.nn.ModuleDict", "torch.nn.modules.adaptive.Adapt...
[((3181, 3216), 'allennlp.models.model.Model.register', 'Model.register', (['"""udify_tag_decoder"""'], {}), "('udify_tag_decoder')\n", (3195, 3216), False, 'from allennlp.models.model import Model\n'), ((3685, 3708), 'allennlp.nn.InitializerApplicator', 'InitializerApplicator', ([], {}), '()\n', (3706, 3708), False, '...
#!/usr/bin/env python3 """Calculates the Frechet Inception Distance (FID) to evalulate GANs The FID metric calculates the distance between two distributions of images. Typically, we have summary statistics (mean & covariance matrix) of one of these distributions, while the 2nd distribution is given by a GAN. When run...
[ "numpy.trace", "numpy.load", "numpy.abs", "argparse.ArgumentParser", "os.unlink", "pickle.dump", "pathlib.Path", "numpy.mean", "pickle.load", "os.path.islink", "torch.device", "torch.no_grad", "numpy.atleast_2d", "loguru.logger.add", "os.path.dirname", "os.path.exists", "numpy.isfini...
[((2045, 2106), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'formatter_class': 'ArgumentDefaultsHelpFormatter'}), '(formatter_class=ArgumentDefaultsHelpFormatter)\n', (2059, 2106), False, 'from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter\n'), ((3661, 3676), 'torch.no_grad', 'torch.no_grad', ([]...
import os import time import pkg_resources import numpy as np import math import torch import torch.optim as optim import truebayes from truebayes.network import makenet from truebayes.utils import numpy2cuda from truebayes.geometry import qdim, xstops # load the standard ROMAN network # layers = [4,8,16,32,64,128...
[ "numpy.random.uniform", "numpy.digitize", "numpy.random.seed", "torch.manual_seed", "numpy.zeros", "torch.randn", "numpy.einsum", "time.time", "numpy.apply_along_axis", "numpy.sinc", "torch.cuda.is_available", "truebayes.utils.numpy2cuda", "numpy.linspace", "torch.rand", "torch.zeros", ...
[((7812, 7847), 'numpy.linspace', 'np.linspace', (['(-t_cutoff)', 't_cutoff', 'N'], {}), '(-t_cutoff, t_cutoff, N)\n', (7823, 7847), True, 'import numpy as np\n'), ((7878, 7888), 'numpy.sinc', 'np.sinc', (['y'], {}), '(y)\n', (7885, 7888), True, 'import numpy as np\n'), ((1142, 1167), 'torch.cuda.is_available', 'torch....
import torch import numpy as np import matplotlib.pyplot as plt import torchvision.models as torch_models import torchvision.transforms as transforms import torchvision.datasets as datasets import matplotlib.pyplot as plt import seaborn as sns normalize = transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994,...
[ "torchvision.models.vgg19_bn", "torch.utils.data.DataLoader", "torch.nn.DataParallel", "torchvision.datasets.CIFAR10", "torchvision.transforms.Compose", "torch.cuda.is_available", "numpy.linspace", "torchvision.transforms.Normalize", "matplotlib.pyplot.gcf", "matplotlib.pyplot.subplots", "torch....
[((257, 328), 'torchvision.transforms.Normalize', 'transforms.Normalize', (['(0.4914, 0.4822, 0.4465)', '(0.2023, 0.1994, 0.201)'], {}), '((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.201))\n', (277, 328), True, 'import torchvision.transforms as transforms\n'), ((406, 459), 'torchvision.transforms.Compose', 'transforms...
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy import os import sys import matplotlib as mpl # mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib.transforms import Bbox import nauka import numpy as np import torch from torch import nn from torch.nn import functional as F import ganground as gg...
[ "matplotlib.pyplot.title", "torch.cat", "torch.randn", "ganground.metric.kernel._pairwise_dist", "torch.no_grad", "os.path.join", "ganground.Metric", "numpy.meshgrid", "matplotlib.transforms.Bbox.from_bounds", "matplotlib.pyplot.close", "re.findall", "matplotlib.pyplot.rc", "numpy.linspace",...
[((716, 747), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': 'SMALL_SIZE'}), "('font', size=SMALL_SIZE)\n", (722, 747), True, 'import matplotlib.pyplot as plt\n'), ((787, 823), 'matplotlib.pyplot.rc', 'plt.rc', (['"""axes"""'], {'titlesize': 'SMALL_SIZE'}), "('axes', titlesize=SMALL_SIZE)\n", (793, 823), T...
# Copyright 2019 AUI, Inc. Washington DC, USA # # 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 ...
[ "numpy.meshgrid", "numpy.sum", "numpy.ravel", "numpy.argmax", "dask.array.tile", "numpy.zeros", "astropy.wcs.WCS", "numpy.max", "numpy.where", "numba.jit", "numpy.array", "numpy.arange", "numpy.exp", "dask.array.from_array", "xarray.DataArray", "numpy.cos" ]
[((1813, 1843), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (1816, 1843), False, 'from numba import jit\n'), ((1902, 1928), 'numpy.ravel', 'np.ravel', (['nd_vals[:, :, 0]'], {}), '(nd_vals[:, :, 0])\n', (1910, 1928), True, 'import numpy as np\n'), ((1937, 1963),...
"""Functions to compute polar/azimuthal averages in radial bins""" import math import warnings import numpy as np import scipy from astropy.coordinates import SkyCoord from astropy import units as u from .. gcdata import GCData from . .utils import compute_radial_averages, make_bins, convert_units, arguments_consistenc...
[ "numpy.radians", "numpy.arctan2", "math.radians", "numpy.std", "numpy.round", "numpy.any", "numpy.min", "numpy.sin", "numpy.array", "numpy.max", "numpy.linspace", "numpy.iterable", "numpy.interp", "warnings.warn", "numpy.cos", "astropy.coordinates.SkyCoord", "scipy.integrate.simps", ...
[((8881, 8903), 'numpy.linspace', 'np.linspace', (['(0)', '(5)', '(100)'], {}), '(0, 5, 100)\n', (8892, 8903), True, 'import numpy as np\n'), ((9103, 9169), 'scipy.integrate.simps', 'scipy.integrate.simps', (['(pz_matrix * kernel_matrix)'], {'x': 'z_grid', 'axis': '(1)'}), '(pz_matrix * kernel_matrix, x=z_grid, axis=1)...
import sys import torch import inspect import logging import datasets import argparse import transformers import q_model import glue_utils import numpy as np from transformers import ( DataCollatorWithPadding, EvalPrediction, Trainer, PretrainedConfig, TrainingArguments, default_data_collator, )...
[ "transformers.utils.logging.enable_default_handler", "argparse.ArgumentParser", "numpy.argmax", "datasets.utils.logging.set_verbosity", "transformers.utils.logging.set_verbosity", "transformers.DataCollatorWithPadding", "transformers.onnx.features.FeaturesManager.check_supported_model_or_raise", "insp...
[((767, 799), 'logging.getLogger', 'logging.getLogger', (['"""transformer"""'], {}), "('transformer')\n", (784, 799), False, 'import logging\n'), ((1105, 1152), 'datasets.utils.logging.set_verbosity', 'datasets.utils.logging.set_verbosity', (['log_level'], {}), '(log_level)\n', (1141, 1152), False, 'import datasets\n')...
import matplotlib.pyplot as plt import numpy as np import argparse import json ''' Given multiple benchmark data, compare them and plot the result ''' if __name__ == "__main__": benchmark_results = ["190225_lstm_sklearn_n_threads_1_tlimit_100.json", "190225_simple_sklearn_n_threads_1_tlimit_100.json"] re...
[ "json.load", "matplotlib.pyplot.subplots", "numpy.maximum.accumulate" ]
[((612, 642), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)'}), '(nrows=1, ncols=1)\n', (624, 642), True, 'import matplotlib.pyplot as plt\n'), ((440, 452), 'json.load', 'json.load', (['f'], {}), '(f)\n', (449, 452), False, 'import json\n'), ((744, 773), 'numpy.maximum.accumulate', '...
""" example cmdline: test time: python test/reproduction/so/benchmark_parallel_smbo_lightgbm.py --datasets optdigits --n 100 --n_jobs 2 --batch_size 1 --rep 1 --start_id 0 run serial: python test/reproduction/so/benchmark_parallel_smbo_lightgbm.py --datasets optdigits --runtime_limit 1200 --n_jobs 2 --batch_size 1 --...
[ "test.reproduction.test_utils.timeit", "pickle.dump", "argparse.ArgumentParser", "test.reproduction.mqsmbo_modified.mqSMBO_modified", "os.makedirs", "multiprocessing.Manager", "litebo.core.message_queue.worker.Worker", "os.path.exists", "sys.path.insert", "time.sleep", "time.time", "so_benchma...
[((659, 682), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (674, 682), False, 'import sys\n'), ((995, 1020), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1018, 1020), False, 'import argparse\n'), ((2780, 2819), 'test.reproduction.test_utils.check_datasets', '...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, logging, pickle, importlib, re, copy, random, tqdm import os.path as osp import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim import torch from utils.base_solver import...
[ "utils.dataset.get_dataloader", "numpy.sum", "numpy.concatenate", "importlib.import_module", "tensorflow.train.Saver", "os.path.exists", "run_symnet.make_parser", "tensorflow.set_random_seed", "utils.utils.create_session", "os.path.join", "logging.getLogger" ]
[((460, 485), 'logging.getLogger', 'logging.getLogger', (['"""MAIN"""'], {}), "('MAIN')\n", (477, 485), False, 'import os, logging, pickle, importlib, re, copy, random, tqdm\n'), ((500, 513), 'run_symnet.make_parser', 'make_parser', ([], {}), '()\n', (511, 513), False, 'from run_symnet import make_parser\n'), ((700, 77...
# -*- coding: utf-8 -*- # *** Basic Imports *** # import os import json import numpy as np import torch from torch.utils.data import DataLoader from datasets import load_dataset import tqdm # Custom Imports from models.metrics import test_metrics, stack_scores # *** Basic Configurations *** # # Set random values...
[ "datasets.load_dataset", "numpy.random.seed", "os.makedirs", "torch.utils.data.DataLoader", "tqdm", "torch.manual_seed", "os.path.exists", "torch.cuda.manual_seed_all", "torch.cuda.is_available", "torch.as_tensor", "models.metrics.stack_scores", "torch.no_grad", "os.path.join" ]
[((336, 360), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (350, 360), True, 'import numpy as np\n'), ((361, 388), 'torch.manual_seed', 'torch.manual_seed', (['seed_val'], {}), '(seed_val)\n', (378, 388), False, 'import torch\n'), ((392, 417), 'torch.cuda.is_available', 'torch.cuda.is_avai...
import random import cv2 import numpy as np import os def tile_function(tile_dir, input_img_path, img_number=412, tile_num=4, tile_times=20): tile = tile_num if not os.path.isdir(tile_dir): os.mkdir(tile_dir) for num_time in range(tile_times): out_img_path = os.path.join(tile_dir, "{}_{}_tile.jpg".format(img_nu...
[ "os.mkdir", "os.path.isdir", "random.shuffle", "cv2.imwrite", "numpy.zeros", "cv2.imread" ]
[((168, 191), 'os.path.isdir', 'os.path.isdir', (['tile_dir'], {}), '(tile_dir)\n', (181, 191), False, 'import os\n'), ((195, 213), 'os.mkdir', 'os.mkdir', (['tile_dir'], {}), '(tile_dir)\n', (203, 213), False, 'import os\n'), ((351, 377), 'cv2.imread', 'cv2.imread', (['input_img_path'], {}), '(input_img_path)\n', (361...
import sys import numpy as np import datetime as dattim import sharppy.sharptab.utils as utils from sharppy.sharptab.constants import * import sharppy.sharptab.thermo as thermo import sharppy.sharptab.profile as profile import sharppy.sharptab.prof_collection as prof_collection from datetime import datetime from sharpp...
[ "netCDF4.Dataset", "numpy.radians", "sharppy.sharptab.thermo.theta", "sharppy.sharptab.thermo.temp_at_mixrat", "numpy.power", "numpy.asarray", "numpy.arcsin", "datetime.datetime.strptime", "numpy.sin", "numpy.cos", "sharppy.sharptab.utils.MS2KTS", "sharppy.sharptab.prof_collection.ProfCollecti...
[((1692, 1707), 'numpy.radians', 'np.radians', (['lon'], {}), '(lon)\n', (1702, 1707), True, 'import numpy as np\n'), ((1722, 1737), 'numpy.radians', 'np.radians', (['lat'], {}), '(lat)\n', (1732, 1737), True, 'import numpy as np\n'), ((1859, 1899), 'numpy.radians', 'np.radians', (["ncfile.variables['XLONG'][0]"], {}),...
import os import sys import numpy as np import h5py BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, 'utils')) import transformations def shuffle_data(data, labels): """ Shuffle data and labels. Input: data: B,N,... numpy array...
[ "sys.path.append", "numpy.random.uniform", "os.path.abspath", "h5py.File", "numpy.random.randn", "numpy.zeros", "numpy.sin", "numpy.arange", "numpy.array", "numpy.cos", "numpy.random.choice", "numpy.squeeze", "transformations.random_rotation_matrix", "os.path.join", "numpy.random.shuffle...
[((106, 131), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (121, 131), False, 'import sys\n'), ((79, 104), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (94, 104), False, 'import os\n'), ((148, 179), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""utils"""'], {...
#! /usr/bin/env python class DetectorAPI: def __init__(self, weights_path, config_path): import json import os from frontend import YOLO os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "0" with open(config_path) as config_buffer: ...
[ "json.load", "frontend.YOLO", "utils.draw_boxes", "cv2.imwrite", "numpy.expand_dims", "time.time", "cv2.imread" ]
[((1659, 1681), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (1669, 1681), False, 'import cv2\n'), ((1763, 1786), 'cv2.imread', 'cv2.imread', (['image_path2'], {}), '(image_path2)\n', (1773, 1786), False, 'import cv2\n'), ((1840, 1878), 'utils.draw_boxes', 'draw_boxes', (['image', 'boxes', 'odapi...
import numba from numba import float64, int32 import numpy as np import math # @numba.jit((float64[:], float64[:], float64)) @numba.jit def DoCentroid(mz_array, inten_array, merge_tol = 0.01): ret_mzs = [] ret_intens = [] start_idx = 0 end_idx = 0 while start_idx < mz_array.shape[0]: e...
[ "numpy.sum", "numba.int32", "numpy.max", "numpy.array", "numba.float64", "math.log" ]
[((830, 875), 'numba.int32', 'int32', (['float64[:]', 'float64[:]', 'int32', 'float64'], {}), '(float64[:], float64[:], int32, float64)\n', (835, 875), False, 'from numba import float64, int32\n'), ((1264, 1309), 'numba.float64', 'float64', (['float64[:]', 'float64[:]', 'int32', 'int32'], {}), '(float64[:], float64[:],...
""" Copyright (c) 2018-2019 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 i...
[ "onnx.helper.make_node", "mo.graph.graph.Node", "mo.utils.unittest.graph.build_graph", "extensions.front.onnx.tanh_ext.TanhFrontExtractor.extract", "numpy.all" ]
[((883, 926), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""Tanh"""', "['X']", "['Y']"], {}), "('Tanh', ['X'], ['Y'])\n", (904, 926), False, 'import onnx\n'), ((943, 982), 'mo.utils.unittest.graph.build_graph', 'build_graph', (["{'node_0': {'pb': pb}}", '[]'], {}), "({'node_0': {'pb': pb}}, [])\n", (954, 982)...
import nltk import ssl try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: pass else: ssl._create_default_https_context = _create_unverified_https_context nltk.download('punkt') import numpy as np import os import nltk import itertools import io ## create director...
[ "os.mkdir", "numpy.save", "numpy.sum", "os.path.isdir", "numpy.std", "numpy.asarray", "numpy.zeros", "nltk.word_tokenize", "numpy.argsort", "numpy.histogram", "numpy.min", "numpy.max", "numpy.mean", "io.open", "nltk.download", "itertools.chain.from_iterable", "os.listdir" ]
[((209, 231), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (222, 231), False, 'import nltk\n'), ((582, 618), 'os.listdir', 'os.listdir', (["(train_directory + 'pos/')"], {}), "(train_directory + 'pos/')\n", (592, 618), False, 'import os\n'), ((635, 671), 'os.listdir', 'os.listdir', (["(train_...
import numpy as np def sigmoid(z): return 1.0 / (1 + np.exp(-(z))) def tanh(z): return np.tanh(z) def sin(z): return np.sin(z) def relu(z): return np.maximum(0.001, z) def softmax(Z): return np.exp(Z) / np.sum(np.exp(Z)) def der_sigmoid(z): #return sigmoid(z)*(1 - sigmoid(z)) re...
[ "numpy.exp", "numpy.sin", "numpy.maximum", "numpy.tanh" ]
[((99, 109), 'numpy.tanh', 'np.tanh', (['z'], {}), '(z)\n', (106, 109), True, 'import numpy as np\n'), ((135, 144), 'numpy.sin', 'np.sin', (['z'], {}), '(z)\n', (141, 144), True, 'import numpy as np\n'), ((171, 191), 'numpy.maximum', 'np.maximum', (['(0.001)', 'z'], {}), '(0.001, z)\n', (181, 191), True, 'import numpy ...
import random import numpy as np def _lstsq_vector(A, b, constraints=None): """Minimize || A*x - b || subject to equality constraints x_i = c_i. Let A be a matrix of shape (m, n) and b a vector of length m. This function solves the minimization problem || A*x - b || for x, subject to 0 <= r <= n equ...
[ "numpy.linalg.lstsq", "numpy.empty", "numpy.zeros", "numpy.isfinite", "numpy.matmul", "numpy.block" ]
[((1094, 1110), 'numpy.zeros', 'np.zeros', (['(n, r)'], {}), '((n, r))\n', (1102, 1110), True, 'import numpy as np\n'), ((1178, 1195), 'numpy.matmul', 'np.matmul', (['A.T', 'A'], {}), '(A.T, A)\n', (1187, 1195), True, 'import numpy as np\n'), ((1232, 1259), 'numpy.zeros', 'np.zeros', (['(2 * (P.shape[1],))'], {}), '(2 ...
# pylint: disable=line-too-long,too-many-lines,missing-docstring """UCF101 video action classification dataset. Code partially borrowed from https://github.com/bryanyzhu/two-stream-pytorch""" import os import numpy as np from mxnet import nd from mxnet.gluon.data import dataset __all__ = ['UCF101'] class UCF101(datas...
[ "numpy.stack", "os.path.join", "numpy.transpose", "os.path.exists", "numpy.zeros", "numpy.random.randint", "mxnet.nd.array", "numpy.squeeze", "os.path.expanduser", "os.listdir" ]
[((3145, 3201), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.mxnet/datasets/ucf101/rawframes"""'], {}), "('~/.mxnet/datasets/ucf101/rawframes')\n", (3163, 3201), False, 'import os\n'), ((3228, 3336), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.mxnet/datasets/ucf101/ucfTrainTestlist/ucf101_train_split_2...
import logging import os import sys import numpy as np from fedml_core.distributed.communication.message import Message from fedml_core.distributed.client.client_manager import ClientManager from .message_define import MyMessage from .utils import transform_list_to_tensor, transform_tensor_to_finite from .utils impor...
[ "logging.info", "numpy.random.randint" ]
[((7264, 7297), 'numpy.random.randint', 'np.random.randint', (['p'], {'size': '(d, 1)'}), '(p, size=(d, 1))\n', (7281, 7297), True, 'import numpy as np\n'), ((3928, 3982), 'logging.info', 'logging.info', (['"""this client has finished the training!"""'], {}), "('this client has finished the training!')\n", (3940, 3982)...
# # Simulations: effect of side reactions for charge of a lead-acid battery # import argparse import matplotlib.pyplot as plt import numpy as np import pickle import pybamm import shared_plotting from shared_solutions import model_comparison try: from config import OUTPUT_DIR except ImportError: OUTPUT_DIR = N...
[ "pybamm.lead_acid.Full", "shared_solutions.model_comparison", "pybamm.lead_acid.LOQS", "shared_plotting.plot_time_dependent_variables", "argparse.ArgumentParser", "matplotlib.pyplot.show", "pickle.dump", "pybamm.set_logging_level", "pickle.load", "shared_plotting.plot_voltages", "numpy.linspace"...
[((403, 492), 'shared_plotting.plot_voltages', 'shared_plotting.plot_voltages', (['all_variables', 't_eval', 'linestyles'], {'figsize': '(6.4, 2.5)'}), '(all_variables, t_eval, linestyles, figsize=(\n 6.4, 2.5))\n', (432, 492), False, 'import shared_plotting\n'), ((548, 579), 'matplotlib.pyplot.subplots_adjust', 'pl...
#!/usr/bin/env python '''Map functions perform operations on a stream. Important note: map functions return a *generator*, not another Streamer, so if you need it to behave like a Streamer, you have to wrap the function in a Streamer again. .. autosummary:: :toctree: generated/ buffer_stream tuples k...
[ "numpy.array", "numpy.concatenate" ]
[((605, 637), 'numpy.array', 'np.array', (['[x[key] for x in data]'], {}), '([x[key] for x in data])\n', (613, 637), True, 'import numpy as np\n'), ((678, 727), 'numpy.concatenate', 'np.concatenate', (['[x[key] for x in data]'], {'axis': 'axis'}), '([x[key] for x in data], axis=axis)\n', (692, 727), True, 'import numpy...
import warnings from copy import deepcopy import numpy as np import astropy.units as u from astropy.coordinates import BaseCoordinateFrame, Longitude, SkyCoord, get_body from astropy.time import TimeDelta from sunpy.coordinates import Heliocentric, HeliographicStonyhurst, Helioprojective from sunpy.map import ( ...
[ "numpy.abs", "sunpy.coordinates.Heliocentric", "numpy.sin", "sunpy.map.is_all_on_disk", "sunpy.map.on_disk_bounding_coordinates", "numpy.pad", "astropy.coordinates.get_body", "warnings.simplefilter", "numpy.max", "sunpy.map.is_all_off_disk", "warnings.catch_warnings", "sunpy.map.map_edges", ...
[((15638, 15759), 'astropy.coordinates.SkyCoord', 'SkyCoord', (['([rotated_x_min, rotated_x_max] * u.arcsec)', '([rotated_y_min, rotated_y_max] * u.arcsec)'], {'frame': 'coords[0].frame'}), '([rotated_x_min, rotated_x_max] * u.arcsec, [rotated_y_min,\n rotated_y_max] * u.arcsec, frame=coords[0].frame)\n', (15646, 15...
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. 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 r...
[ "pycocotools.mask.decode", "collections.defaultdict", "pathlib.Path", "numpy.arange", "torch.ones", "numpy.meshgrid", "numpy.copy", "torch.zeros", "pycocotools.mask.frPyObjects", "numpy.stack", "io.BytesIO", "numpy.asarray", "torch.from_numpy", "torch.stack", "numpy.zeros", "numpy.expa...
[((1712, 1734), 'torch.stack', 'torch.stack', (['b'], {'dim': '(-1)'}), '(b, dim=-1)\n', (1723, 1734), False, 'import torch\n'), ((2150, 2170), 'numpy.stack', 'np.stack', (['b'], {'axis': '(-1)'}), '(b, axis=-1)\n', (2158, 2170), True, 'import numpy as np\n'), ((2572, 2605), 'numpy.arange', 'np.arange', (['(0)', 'h'], ...
from types import GeneratorType import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski from scipy.spatial.distance import cdist, pdist, squareform try: from scipy.spatial.distance import wminkowski exce...
[ "numpy.maximum", "numpy.diag_indices_from", "numpy.sum", "numpy.abs", "scipy.sparse.issparse", "numpy.ones", "numpy.isnan", "sklearn.metrics.pairwise.pairwise_distances_argmin_min", "sklearn.metrics.pairwise.haversine_distances", "numpy.sin", "scipy.spatial.distance.pdist", "numpy.arange", "...
[((6858, 6919), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""metric"""', 'PAIRWISE_BOOLEAN_FUNCTIONS'], {}), "('metric', PAIRWISE_BOOLEAN_FUNCTIONS)\n", (6881, 6919), False, 'import pytest\n'), ((8389, 8460), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func"""', '[pairwise_distances, pair...
from typing import Callable, List, Optional import numpy as np from ..circuit import Circuit from ..gate import * from .backendbase import Backend _eye = np.eye(2, dtype=complex) class OneQubitGateCompactionTranspiler(Backend): """Merge one qubit gate.""" def _run_inner(self, gates, operations: List[Operat...
[ "numpy.eye", "numpy.allclose" ]
[((157, 181), 'numpy.eye', 'np.eye', (['(2)'], {'dtype': 'complex'}), '(2, dtype=complex)\n', (163, 181), True, 'import numpy as np\n'), ((1913, 1935), 'numpy.allclose', 'np.allclose', (['mat', '_eye'], {}), '(mat, _eye)\n', (1924, 1935), True, 'import numpy as np\n'), ((786, 818), 'numpy.allclose', 'np.allclose', (['s...
import cv2 import os import shutil import pickle as pkl import time import numpy as np import hashlib from IPython import embed class Logger(object): def __init__(self): self._logger = None def init(self, logdir, name='log'): if self._logger is None: import logging if ...
[ "pickle.dump", "os.remove", "pickle.load", "numpy.mean", "cv2.imencode", "shutil.rmtree", "os.path.join", "logging.FileHandler", "torch.utils.model_zoo.load_url", "os.path.exists", "torch.FloatTensor", "lmdb.open", "re.sub", "numpy.fromstring", "tqdm.tqdm", "hashlib.md5", "subprocess...
[((1213, 1224), 'time.time', 'time.time', ([], {}), '()\n', (1222, 1224), False, 'import time\n'), ((3675, 3688), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3686, 3688), False, 'from collections import OrderedDict\n'), ((3984, 4009), 'os.path.exists', 'os.path.exists', (['lmdb_file'], {}), '(lmdb_file...
# -*- coding: utf-8 -*- import logging from typing import Optional, Tuple import numpy as np from numpy import ndarray def get_continuum_points( wave: ndarray, flux: ndarray, nbins: int = 50, ntop: int = 20 ) -> Tuple[ndarray, ndarray]: """Get continuum points along a spectrum. This splits a spectrum i...
[ "numpy.poly1d", "numpy.log", "numpy.nanmedian", "numpy.polyfit", "numpy.isnan", "numpy.argsort", "numpy.sqrt" ]
[((966, 995), 'numpy.nanmedian', 'np.nanmedian', (['s_wave'], {'axis': '(-1)'}), '(s_wave, axis=-1)\n', (978, 995), True, 'import numpy as np\n'), ((1014, 1043), 'numpy.nanmedian', 'np.nanmedian', (['s_flux'], {'axis': '(-1)'}), '(s_flux, axis=-1)\n', (1026, 1043), True, 'import numpy as np\n'), ((766, 798), 'numpy.arg...
#!/usr/bin/python # -*- coding: utf-8 -*- """ This file contains the classes used to send videostreams to Twitch """ from __future__ import print_function, division import numpy as np import subprocess import signal import threading import sys try: import Queue as queue except ImportError: import queue import ...
[ "threading.Thread", "subprocess.Popen", "threading.Timer", "os.open", "os.path.exists", "numpy.ones", "numpy.clip", "time.time", "numpy.sin", "os.mkfifo", "numpy.column_stack", "queue.PriorityQueue", "sys.exit" ]
[((5736, 5829), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdin': 'subprocess.PIPE', 'stderr': 'devnullpipe', 'stdout': 'devnullpipe'}), '(command, stdin=subprocess.PIPE, stderr=devnullpipe, stdout\n =devnullpipe)\n', (5752, 5829), False, 'import subprocess\n'), ((8836, 8873), 'numpy.ones', 'np.ones', ...
import os import json from tqdm import tqdm import numpy as np from keras.preprocessing.sequence import pad_sequences def read_fb_messages(dump_path="data/messages/inbox/"): messages = [] for file in tqdm(os.listdir(dump_path)): if os.path.isdir(dump_path + file): with open(dump_path + file...
[ "tqdm.tqdm", "json.load", "os.path.isdir", "keras.preprocessing.sequence.pad_sequences", "numpy.random.choice", "os.listdir" ]
[((669, 679), 'tqdm.tqdm', 'tqdm', (['dset'], {}), '(dset)\n', (673, 679), False, 'from tqdm import tqdm\n'), ((214, 235), 'os.listdir', 'os.listdir', (['dump_path'], {}), '(dump_path)\n', (224, 235), False, 'import os\n'), ((249, 280), 'os.path.isdir', 'os.path.isdir', (['(dump_path + file)'], {}), '(dump_path + file)...
# 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...
[ "tensorflow.python.platform.test.main", "tensorflow.python.ops.array_ops.sparse_mask", "tensorflow.python.framework.ops.IndexedSlices", "numpy.array", "numpy.random.rand", "tensorflow.python.framework.ops.convert_to_tensor" ]
[((1960, 1971), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (1969, 1971), False, 'from tensorflow.python.platform import test\n'), ((1194, 1232), 'numpy.array', 'np.array', (['[0, 2, 3, 4]'], {'dtype': 'np.int32'}), '([0, 2, 3, 4], dtype=np.int32)\n', (1202, 1232), True, 'import numpy as np\n...
# -*- coding: utf-8 -*- from __future__ import print_function import numpy as np import pandas as pd from lifelines.plotting import plot_estimate from lifelines.utils import qth_survival_times class BaseFitter(object): def __init__(self, alpha=0.95): if not (0 < alpha <= 1.): raise ValueErr...
[ "lifelines.plotting.plot_estimate", "lifelines.utils.qth_survival_times", "numpy.unique", "numpy.concatenate" ]
[((837, 863), 'lifelines.plotting.plot_estimate', 'plot_estimate', (['self', '*args'], {}), '(self, *args)\n', (850, 863), False, 'from lifelines.plotting import plot_estimate\n'), ((1300, 1359), 'numpy.concatenate', 'np.concatenate', (['(other_estimate.index, self_estimate.index)'], {}), '((other_estimate.index, self_...
import time import logging import numpy as np import tensorflow as tf from ..utils.logger import ProgressBar from ..callbacks import CallbackLoc from ..callbacks import PeriodicCallback, OnceCallback, ScheduledCallback from ..ops.train_ops import process_gradients logger = logging.getLogger('neuralgym') class Tra...
[ "tensorflow.global_variables_initializer", "tensorflow.Session", "numpy.isnan", "time.time", "tensorflow.train.start_queue_runners", "tensorflow.ConfigProto", "tensorflow.assign_add", "tensorflow.summary.FileWriter", "tensorflow.global_variables", "tensorflow.summary.histogram", "tensorflow.zero...
[((278, 308), 'logging.getLogger', 'logging.getLogger', (['"""neuralgym"""'], {}), "('neuralgym')\n", (295, 308), False, 'import logging\n'), ((3064, 3140), 'tensorflow.assign_add', 'tf.assign_add', (["self.context['global_step']", '(1)'], {'name': '"""add_one_to_global_step"""'}), "(self.context['global_step'], 1, nam...
from time import sleep, time from decorator import FunctionMaker from logging.handlers import QueueHandler, QueueListener from typing import List, Tuple, Dict, Any from machin.parallel.distributed import World, get_world as gw from machin.parallel.process import Process, ProcessException import sys import dill import p...
[ "sys.platform.startswith", "itertools.repeat", "numpy.random.seed", "torch.manual_seed", "logging.StreamHandler", "pytest.fixture", "socket.socket", "time.time", "multiprocessing.get_context", "logging.Formatter", "time.sleep", "dill.dumps", "random.seed", "multiprocessing.Pipe", "machin...
[((536, 577), 'logging.getLogger', 'logging.getLogger', (['"""multi_default_logger"""'], {}), "('multi_default_logger')\n", (553, 577), False, 'import logging\n'), ((1433, 1478), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (1447, 1478),...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.data.sampler.RandomSampler", "megengine.data.dataloader.DataLoader", "time.sleep", "pytest.raises", "numpy.random.randint", "megengine.data.dataset.ArrayDataset" ]
[((767, 838), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)'], {'size': '(sample_num, 1, 32, 32)', 'dtype': 'np.uint8'}), '(0, 255, size=(sample_num, 1, 32, 32), dtype=np.uint8)\n', (784, 838), True, 'import numpy as np\n'), ((851, 906), 'numpy.random.randint', 'np.random.randint', (['(0)', '(10)'], {'si...
from orientation.setup_system import get_universe from orientation.calc_angles import get_com, get_principal_axes, dir_cosine, make_direction_cosine_matrix import MDAnalysis as mda import numpy as np import os sel = "name CA and resid 1:123" gro_file = os.path.join(os.getcwd(), "data", "b3_syst_protein_only.gro") t...
[ "os.getcwd", "numpy.allclose", "orientation.calc_angles.dir_cosine", "orientation.calc_angles.make_direction_cosine_matrix", "orientation.calc_angles.get_com", "orientation.setup_system.get_universe", "numpy.array", "numpy.eye", "orientation.calc_angles.get_principal_axes", "numpy.diagonal" ]
[((436, 469), 'orientation.setup_system.get_universe', 'get_universe', (['gro_file', 'traj_file'], {}), '(gro_file, traj_file)\n', (448, 469), False, 'from orientation.setup_system import get_universe\n'), ((269, 280), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (278, 280), False, 'import os\n'), ((344, 355), 'os.getcw...
import argparse import time import brainflow import numpy as np from brainflow.board_shim import BoardShim, BrainFlowInputParams, LogLevels, BoardIds from brainflow.data_filter import DataFilter, FilterTypes, AggOperations, WindowFunctions, DetrendOperations from brainflow.ml_model import MLModel, BrainFlowMetrics, Br...
[ "brainflow.data_filter.DataFilter.get_avg_band_powers", "brainflow.ml_model.BrainFlowModelParams", "argparse.ArgumentParser", "brainflow.board_shim.BoardShim.get_sampling_rate", "brainflow.board_shim.BrainFlowInputParams", "brainflow.board_shim.BoardShim.log_message", "brainflow.board_shim.BoardShim.get...
[((380, 415), 'brainflow.board_shim.BoardShim.enable_dev_board_logger', 'BoardShim.enable_dev_board_logger', ([], {}), '()\n', (413, 415), False, 'from brainflow.board_shim import BoardShim, BrainFlowInputParams, LogLevels, BoardIds\n'), ((431, 456), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n...
import numpy as np import pandas as pd from matplotlib import pyplot as plt from tacos_plot import scatterdense from scipy import stats as st from scipy import stats import os def geneinfo(genename, df, nfiles,metric='fpkm'): """Extimate mean and var for a ENSG gene Keyword arguments: genename -- ENSG ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.arange", "tacos_plot.scatterdense", "os.chdir", "numpy.nanmean", "pandas.DataFrame", "numpy.power", "numpy.max", "numpy.nanvar", "numpy.var", "matplotlib.pyplot.show", "numpy.aver...
[((4114, 4402), 'pandas.read_csv', 'pd.read_csv', (['"""https://www.genenames.org/cgi-bin/download/custom?col=gd_hgnc_id&col=gd_app_sym&col=gd_pub_ensembl_id&col=md_ensembl_id&col=md_eg_id&status=Approved&status=Entry%20Withdrawn&hgnc_dbtag=on&order_by=gd_app_sym_sort&format=text&submit=submit"""'], {'index_col': '[0]'...
#!/usr/bin/env python3 import numpy as np def action_to_json(action_internal): """ Lua indexes starts from 1! local ACTION_MOVE = 0 local ACTION_ATTACK_HERO = 1 local ACTION_ATTACK_CREEP = 2 local ACTION_USE_ABILITY = 3 local ACTION_ATTACK_TOWER = 4 local ACTION_MOVE_DISCRETE = 5 ...
[ "numpy.array" ]
[((3044, 3060), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (3052, 3060), True, 'import numpy as np\n')]
import matplotlib import matplotlib.pyplot as plt import numpy as np # Got from experiment es_multiple_fp_generated # Config: # configs_to_run = [ # Config(algo="chords_chordino", duration=120, letters_to_use=1, range_words=[range(2, 8)], num_sources=[1]), # Config(algo="chords_crema", duration=120, letters_t...
[ "matplotlib.pyplot.savefig", "numpy.array", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((829, 847), 'numpy.array', 'np.array', (['[0, 0.5]'], {}), '([0, 0.5])\n', (837, 847), True, 'import numpy as np\n'), ((896, 910), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (908, 910), True, 'import matplotlib.pyplot as plt\n'), ((1937, 1947), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\...
# -*- coding: utf-8 -*- """ Created on Tue Jun 2 22:43:29 2020 @author: Lyy """ import pandas as pd import numpy as np import re import random import matplotlib.patches as patches import matplotlib.pyplot as plt class Node(object): idcase = {} def __init__(self, nid, ntype, x, y): self.id = nid ...
[ "pandas.DataFrame", "re.split", "numpy.sum", "random.uniform", "pandas.read_csv", "matplotlib.patches.Rectangle", "matplotlib.patches.FancyArrowPatch", "matplotlib.pyplot.figure", "random.seed", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((3077, 3100), 'pandas.read_csv', 'pd.read_csv', (['"""link.csv"""'], {}), "('link.csv')\n", (3088, 3100), True, 'import pandas as pd\n'), ((3117, 3140), 'pandas.read_csv', 'pd.read_csv', (['"""node.csv"""'], {}), "('node.csv')\n", (3128, 3140), True, 'import pandas as pd\n'), ((3768, 3792), 'numpy.sqrt', 'np.sqrt', (...
import unittest from ddt import ddt, data, unpack import pandas as pd import numpy as np import itertools as it import math import calPosterior as targetCode @ddt class TestCalPosterior(unittest.TestCase): def setUp(self): #self.dataIndex = pd.MultiIndex.from_product([[0, 1, 2],['x', 'y']], names=['Ident...
[ "pandas.DataFrame", "calPosterior.CalPosterirLog", "ddt.data", "calPosterior.calVectorNorm", "calPosterior.calPosteriorLog", "numpy.log", "unittest.TextTestRunner", "calPosterior.calAngleLikelihoodLogModifiedForPiRangeAndMemoryDecay", "pandas.Index", "pandas.MultiIndex.from_product", "numpy.max"...
[((1520, 1541), 'ddt.data', 'data', (['(10000, 0.0001)'], {}), '((10000, 0.0001))\n', (1524, 1541), False, 'from ddt import ddt, data, unpack\n'), ((3794, 3839), 'ddt.data', 'data', (['(0.7, 0)', '(0.8, 0.78)', '(1, 0.1)', '(1, 0)'], {}), '((0.7, 0), (0.8, 0.78), (1, 0.1), (1, 0))\n', (3798, 3839), False, 'from ddt imp...
# uniform content loss + adaptive threshold + per_class_input + recursive G # improvement upon cqf37 from __future__ import division import os import scipy.io import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np import rawpy import glob # run tensforflow model on CPU only os.environ["CUDA_...
[ "numpy.maximum", "tensorflow.maximum", "numpy.mean", "glob.glob", "tensorflow.truncated_normal", "tensorflow.contrib.slim.conv2d", "tensorflow.concat", "tensorflow.placeholder", "rawpy.imread", "tensorflow.train.get_checkpoint_state", "numpy.minimum", "tensorflow.train.Saver", "os.path.basen...
[((510, 539), 'glob.glob', 'glob.glob', (["(gt_dir + '/1*.ARW')"], {}), "(gt_dir + '/1*.ARW')\n", (519, 539), False, 'import glob\n'), ((4303, 4315), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (4313, 4315), True, 'import tensorflow as tf\n'), ((4327, 4376), 'tensorflow.placeholder', 'tf.placeholder', (['tf.f...
#!/usr/bin/env python3 import collections import json import numpy as np import os import random import shutil def get_structures(): structures = {} structures_dir = "structures" if os.path.exists(structures_dir): for sid in os.listdir(structures_dir): structure_dir = os.path.join(structures_dir, sid)...
[ "os.mkdir", "json.dump", "json.load", "random.shuffle", "os.path.exists", "numpy.linspace", "os.path.join", "os.listdir", "shutil.copy" ]
[((190, 220), 'os.path.exists', 'os.path.exists', (['structures_dir'], {}), '(structures_dir)\n', (204, 220), False, 'import os\n'), ((2934, 2965), 'os.path.join', 'os.path.join', (['"""structures"""', 'sid'], {}), "('structures', sid)\n", (2946, 2965), False, 'import os\n'), ((2975, 3008), 'os.path.join', 'os.path.joi...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns arr = np.random.multinomial(n=6, pvals=[1/6, 1/6, 1/6, 1/6, 1/6, 1/6], size=6) print(arr) arr = np.random.multinomial(n=6, pvals=[1/6, 1/6, 1/6, 1/6, 1/6, 1/6], size=100) sns.distplot(arr, hist=True, kde=False) plt.show()
[ "numpy.random.multinomial", "matplotlib.pyplot.show", "seaborn.distplot" ]
[((81, 169), 'numpy.random.multinomial', 'np.random.multinomial', ([], {'n': '(6)', 'pvals': '[1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6]', 'size': '(6)'}), '(n=6, pvals=[1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6, 1 / 6],\n size=6)\n', (102, 169), True, 'import numpy as np\n'), ((173, 263), 'numpy.random.multinomial', 'np.ra...
# -*- coding: utf-8 -*- """ ===================== Cython related magics ===================== Usage ===== ``%%cython`` {CYTHON_DOC} ``%%cython_inline`` {CYTHON_INLINE_DOC} ``%%cython_pyximport`` {CYTHON_PYXIMPORT_DOC} Author: * <NAME> Parts of this code were taken from Cython.inline. """ #---------------------...
[ "imp.reload", "distutils.dir_util._path_created.clear", "os.path.isfile", "Cython.inline", "os.path.join", "Cython.Build.Dependencies.cythonize", "os.path.dirname", "os.path.exists", "IPython.utils.path.get_ipython_cache_dir", "sys.getfilesystemencoding", "distutils.core.Extension", "IPython.c...
[((3587, 3620), 'IPython.core.magic_arguments.magic_arguments', 'magic_arguments.magic_arguments', ([], {}), '()\n', (3618, 3620), False, 'from IPython.core import magic_arguments\n'), ((3626, 3838), 'IPython.core.magic_arguments.argument', 'magic_arguments.argument', (['"""-c"""', '"""--compile-args"""'], {'action': '...
import numpy as np from numpy import random def generate_label(n_sample, task = 'binaryclass', n_class = 2): if task == 'binaryclass': assert n_class == 2, 'default value 2 for n_class' label_data = random.randint(0,2,n_sample) elif task == 'multiclass': assert n_class > 2, 'n_class>2 ...
[ "numpy.random.randint", "numpy.zeros", "numpy.random.random" ]
[((221, 251), 'numpy.random.randint', 'random.randint', (['(0)', '(2)', 'n_sample'], {}), '(0, 2, n_sample)\n', (235, 251), False, 'from numpy import random\n'), ((3402, 3447), 'numpy.random.random', 'random.random', (['(self.n_sample, self.n_length)'], {}), '((self.n_sample, self.n_length))\n', (3415, 3447), False, 'f...
# # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # Author: <NAME> (<EMAIL>) # Date: 05/15/2019 # import os import torch import random import time import numpy as np import pdb from collections import defaultdict, Mapping, Sequence, OrderedD...
[ "torch.cuda.synchronize", "numpy.random.seed", "torch.utils.data.DataLoader", "torch.manual_seed", "torch.distributed.barrier", "time.time", "collections.defaultdict", "torch.save", "torch.cuda.manual_seed_all", "random.seed", "torch.cuda.empty_cache", "torch.distributed.broadcast", "os.path...
[((735, 752), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (746, 752), False, 'import random\n'), ((755, 775), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (769, 775), True, 'import numpy as np\n'), ((778, 801), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (79...
""" line_search.py: do the line search for single event. """ from copy import copy import click import numpy as np from ...setting import LINE_SEARCH_PERTURBATION_BOUNDARY from ...tasks.line_search.line_search_structure import \ calculate_weighted_misfit from ...utils.asdf_io import VirAsdf from ...utils.load_fi...
[ "copy.copy", "click.option", "numpy.argmin", "click.command", "numpy.min", "numpy.arange", "numpy.loadtxt" ]
[((3691, 3706), 'click.command', 'click.command', ([], {}), '()\n', (3704, 3706), False, 'import click\n'), ((3708, 3793), 'click.option', 'click.option', (['"""--windows_path"""'], {'required': '(True)', 'type': 'str', 'help': '"""the windows path"""'}), "('--windows_path', required=True, type=str, help='the windows p...
import numpy as np import tensorflow as tf from ivis import Ivis def test_multidimensional_inputs(): sample_data = np.ones(shape=(32, 8, 8, 3)) base_model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(4, 3, input_shape=(8, 8, 3)), tf.keras.layers.MaxPool2D(), tf.keras.layers.G...
[ "tensorflow.keras.layers.Conv2D", "ivis.Ivis", "numpy.ones", "tensorflow.keras.layers.MaxPool2D", "tensorflow.keras.layers.GlobalAveragePooling2D" ]
[((121, 149), 'numpy.ones', 'np.ones', ([], {'shape': '(32, 8, 8, 3)'}), '(shape=(32, 8, 8, 3))\n', (128, 149), True, 'import numpy as np\n'), ((364, 415), 'ivis.Ivis', 'Ivis', ([], {'model': 'base_model', 'epochs': '(5)', 'k': '(4)', 'batch_size': '(4)'}), '(model=base_model, epochs=5, k=4, batch_size=4)\n', (368, 415...
import time T0 = time.time() import logging DEBUG = True logging.basicConfig( level="DEBUG" if DEBUG else "WARNING", filename="tmp.log", format="%(asctime)s:%(levelname)s:%(funcName)s[%(lineno)d]:%(message)s", ) logger = logging.getLogger() logger.warning("Inited At %s", T0) import os import sys import d...
[ "cv2.minMaxLoc", "cv2.matchTemplate", "cv2.cvtColor", "win32gui.ReleaseDC", "cv2.imwrite", "numpy.frombuffer", "time.sleep", "win32gui.GetWindowDC", "win32ui.CreateBitmap", "datetime.datetime.strptime", "win32ui.CreateDCFromHandle", "numpy.concatenate", "cv2.warpPolar", "logging.basicConfi...
[((18, 29), 'time.time', 'time.time', ([], {}), '()\n', (27, 29), False, 'import time\n'), ((59, 220), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': "('DEBUG' if DEBUG else 'WARNING')", 'filename': '"""tmp.log"""', 'format': '"""%(asctime)s:%(levelname)s:%(funcName)s[%(lineno)d]:%(message)s"""'}), "(leve...