code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.metrics import (auc, confusion_matrix, precision_recall_curve, r2_score, roc_curve) def best_scores(allstars_model): keys = list(allstars_model.best_scores.keys()) values = allstars_model.best_scor...
[ "matplotlib.pyplot.grid", "sklearn.metrics.auc", "matplotlib.pyplot.barh", "sklearn.metrics.precision_recall_curve", "numpy.array", "sklearn.metrics.roc_curve", "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((384, 408), 'matplotlib.pyplot.title', 'plt.title', (['"""Best scores"""'], {}), "('Best scores')\n", (393, 408), True, 'import matplotlib.pyplot as plt\n'), ((413, 435), 'matplotlib.pyplot.barh', 'plt.barh', (['keys', 'values'], {}), '(keys, values)\n', (421, 435), True, 'import matplotlib.pyplot as plt\n'), ((440, ...
#! /usr/bin/env python3 # Copyright(c) 2017-2018 Intel Corporation. # License: MIT See LICENSE file in root directory. GREEN = '\033[1;32m' RED = '\033[1;31m' NOCOLOR = '\033[0m' YELLOW = '\033[1;33m' try: from openvino.inference_engine import IENetwork, ExecutableNetwork, IECore import openvino.inference_en...
[ "os.listdir", "sys.exit", "openvino.inference_engine.IENetwork", "queue.Queue", "numpy.argsort", "datetime.datetime.now", "os.path.isfile", "openvino.inference_engine.IECore", "os.path.isdir", "time.time", "threading.Thread", "cv2.resize", "threading.Barrier", "cv2.imread" ]
[((14365, 14391), 'cv2.imread', 'cv2.imread', (['image_filename'], {}), '(image_filename)\n', (14375, 14391), False, 'import cv2\n'), ((14404, 14429), 'cv2.resize', 'cv2.resize', (['image', '(w, h)'], {}), '(image, (w, h))\n', (14414, 14429), False, 'import cv2\n'), ((15411, 15444), 'queue.Queue', 'queue.Queue', (['INF...
# yellowbrick.cluster.silhouette # Implements visualizers using the silhouette metric for cluster evaluation. # # Author: <NAME> <<EMAIL>> # Created: Mon Mar 27 10:09:24 2017 -0400 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: silhouette.py [57b563b] <EMAIL> $ """ Impl...
[ "matplotlib.ticker.MultipleLocator", "sklearn.metrics.silhouette_samples", "sklearn.metrics.silhouette_score", "numpy.arange" ]
[((4916, 4943), 'sklearn.metrics.silhouette_score', 'silhouette_score', (['X', 'labels'], {}), '(X, labels)\n', (4932, 4943), False, 'from sklearn.metrics import silhouette_score, silhouette_samples\n'), ((4979, 5008), 'sklearn.metrics.silhouette_samples', 'silhouette_samples', (['X', 'labels'], {}), '(X, labels)\n', (...
import numpy as np import pytest from ome_zarr.scale import Scaler class TestScaler: @pytest.fixture( params=( (1, 2, 1, 256, 256), (3, 512, 512), (256, 256), ), ids=["5D", "3D", "2D"], ) def shape(self, request): return request.param ...
[ "pytest.fixture", "pytest.mark.skip", "numpy.random.default_rng", "ome_zarr.scale.Scaler" ]
[((93, 193), 'pytest.fixture', 'pytest.fixture', ([], {'params': '((1, 2, 1, 256, 256), (3, 512, 512), (256, 256))', 'ids': "['5D', '3D', '2D']"}), "(params=((1, 2, 1, 256, 256), (3, 512, 512), (256, 256)), ids\n =['5D', '3D', '2D'])\n", (107, 193), False, 'import pytest\n'), ((1794, 1849), 'pytest.mark.skip', 'pyte...
# BSD 3-Clause License # Copyright (c) 2019, regain authors # 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 # lis...
[ "sklearn.model_selection.StratifiedShuffleSplit", "numpy.sqrt", "sklearn.model_selection._validation._aggregate_score_dicts", "numpy.array", "netanalytics.graphlets.GCD", "sklearn.utils._joblib.delayed", "sklearn.metrics.scorer._check_multimetric_scoring", "sklearn.base.is_classifier", "numpy.sort",...
[((2350, 2381), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (2371, 2381), False, 'import warnings\n'), ((6401, 6418), 'numpy.sum', 'np.sum', (['xi_matrix'], {}), '(xi_matrix)\n', (6407, 6418), True, 'import numpy as np\n'), ((2940, 2978), 'numpy.triu_indices_from', 'np.triu...
#!/usr/bin/env python # -*- noplot -*- """ This example demonstrates how to set a hyperlinks on various kinds of elements. This currently only works with the SVG backend. """ import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt f = plt.figure() s = plt.scatter...
[ "matplotlib.pyplot.imshow", "matplotlib.mlab.bivariate_normal", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter", "numpy.meshgrid", "numpy.arange" ]
[((292, 304), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (302, 304), True, 'import matplotlib.pyplot as plt\n'), ((309, 342), 'matplotlib.pyplot.scatter', 'plt.scatter', (['[1, 2, 3]', '[4, 5, 6]'], {}), '([1, 2, 3], [4, 5, 6])\n', (320, 342), True, 'import matplotlib.pyplot as plt\n'), ((451, 463), 'm...
import cv2 import numpy as np cap = cv2.VideoCapture(0) #intensity of green blue_lower=np.array([100,150,0]) blue_upper=np.array([140,255,255]) kernel_open=np.ones((5,5)) kernel_close=np.ones((15,15)) while True: ret,photo= cap.read() img=cv2.resize(photo,(340,220)) # convert image to HSv imgHsv=cv2.c...
[ "cv2.rectangle", "cv2.drawContours", "numpy.ones", "cv2.inRange", "cv2.imshow", "numpy.array", "cv2.morphologyEx", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.cvtColor", "cv2.findContours", "cv2.resize", "cv2.waitKey", "cv2.boundingRect" ]
[((37, 56), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (53, 56), False, 'import cv2\n'), ((88, 111), 'numpy.array', 'np.array', (['[100, 150, 0]'], {}), '([100, 150, 0])\n', (96, 111), True, 'import numpy as np\n'), ((121, 146), 'numpy.array', 'np.array', (['[140, 255, 255]'], {}), '([140, 255, 255...
import numpy as np import pandas as pd class Simulation: ''' Simulate a process of randomly selecting one of N coins, flipping the selected coin a certain number of times, and then repeating this a few times ''' def __init__(self, n_sequences=10, n_reps_per_sequence=7...
[ "numpy.ones", "numpy.log", "numpy.exp", "numpy.array", "numpy.sum", "numpy.random.seed", "numpy.concatenate", "numpy.random.uniform", "numpy.random.binomial" ]
[((387, 407), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (401, 407), True, 'import numpy as np\n'), ((2258, 2320), 'numpy.concatenate', 'np.concatenate', (["(theta['bernoulli_p'], theta['multinomial_p'])"], {}), "((theta['bernoulli_p'], theta['multinomial_p']))\n", (2272, 2320), True, 'import nu...
#!/usr/bin/env python # ase.py # Created by <NAME> on 2017-09-12. # Email: <EMAIL> # Copyright (c) 2017. All rights reserved. import numpy as np from typing import Sequence, TypeVar, Union, Dict import networkx import os from scipy.stats import norm from scipy.stats import rankdata from sklearn.decomposition import...
[ "graspy.utils.pass_to_ranks", "d3m.primitive_interfaces.base.CallResult", "numpy.mean", "d3m.container.ndarray", "graspy.embed.AdjacencySpectralEmbed", "graspy.embed.OmnibusEmbed", "numpy.sum", "os.path.dirname", "numpy.random.seed" ]
[((5340, 5360), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (5354, 5360), True, 'import numpy as np\n'), ((6930, 6986), 'graspy.embed.AdjacencySpectralEmbed', 'graspyASE', ([], {'n_components': 'max_dimension', 'n_elbows': 'n_elbows'}), '(n_components=max_dimension, n_elbows=n_elbows)\n', (6939...
"""This module defines the DataSeries class, the elementary data structure of ixdat An ixdat DataSeries is a wrapper around a numpy array containing the metadata needed to combine it with other DataSeries. Typically this means a reference to the time variable corresponding to the rows of the array. The time variable i...
[ "numpy.array", "numpy.ones" ]
[((10044, 10071), 'numpy.ones', 'np.ones', (['tseries.data.shape'], {}), '(tseries.data.shape)\n', (10051, 10071), True, 'import numpy as np\n'), ((9765, 9777), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (9773, 9777), True, 'import numpy as np\n'), ((9794, 9809), 'numpy.array', 'np.array', (['value'], {}), '(va...
import numpy as np from numpy.testing import assert_array_equal from nose.tools import assert_raises from pyriemann.classification import (MDM, FgMDM, KNearestNeighbor, TSclassifier) def generate_cov(Nt, Ne): """Generate a set of cavariances matrices for test purpose.""" ...
[ "pyriemann.classification.KNearestNeighbor", "pyriemann.classification.FgMDM", "numpy.testing.assert_array_equal", "numpy.diag", "nose.tools.assert_raises", "numpy.array", "numpy.sum", "pyriemann.classification.TSclassifier", "numpy.empty", "numpy.random.RandomState", "pyriemann.classification.M...
[((325, 352), 'numpy.random.RandomState', 'np.random.RandomState', (['(1234)'], {}), '(1234)\n', (346, 352), True, 'import numpy as np\n'), ((489, 511), 'numpy.empty', 'np.empty', (['(Nt, Ne, Ne)'], {}), '((Nt, Ne, Ne))\n', (497, 511), True, 'import numpy as np\n'), ((672, 693), 'pyriemann.classification.MDM', 'MDM', (...
import cv2 import sys, os, glob, re import json from os.path import join, dirname, abspath, realpath, isdir from os import makedirs import numpy as np from shutil import rmtree from ipdb import set_trace from .bench_utils.bbox_helper import rect_2_cxy_wh, cxy_wh_2_rect def center_error(rects1, rects2): """Center e...
[ "numpy.clip", "numpy.prod", "cv2.rectangle", "numpy.less_equal", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "numpy.arange", "os.walk", "numpy.mean", "numpy.greater", "cv2.moveWindow", "numpy.asarray", "numpy.stack", "numpy.linspace", "os.path.isdir", "numpy.maximum", "cv...
[((1192, 1234), 'numpy.maximum', 'np.maximum', (['rects1[..., 0]', 'rects2[..., 0]'], {}), '(rects1[..., 0], rects2[..., 0])\n', (1202, 1234), True, 'import numpy as np\n'), ((1244, 1286), 'numpy.maximum', 'np.maximum', (['rects1[..., 1]', 'rects2[..., 1]'], {}), '(rects1[..., 1], rects2[..., 1])\n', (1254, 1286), True...
import os import re import sys, time import numpy as np final=''#global vars to save results of op fresult=''#global vars to save results of for fcall=''#global vars to save results of call def check(newcontext): nc=newcontext #TODO:cannot deal with multiple problems,need help lk=nc.count('(') rk=nc.count(')') l...
[ "sys.stdout.flush", "re.compile", "re.match", "numpy.exp", "re.sub", "re.findall", "os.system", "sys.stdout.write" ]
[((728, 755), 're.sub', 're.sub', (['"""return """', '""""""', 'line'], {}), "('return ', '', line)\n", (734, 755), False, 'import re\n'), ((760, 790), 're.sub', 're.sub', (['"""\\\\[\'.*\'\\\\]"""', '""""""', 'line'], {}), '("\\\\[\'.*\'\\\\]", \'\', line)\n', (766, 790), False, 'import re\n'), ((795, 825), 're.sub', ...
import os from statistics import mean import multiprocessing as mp import numpy as np import datetime from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels my_frame = np.expand_dims(np.full((300,300,3), 1, np.uint8), axis=0) labels = load_labels('/labelmap.txt') ###### # Minima...
[ "statistics.mean", "frigate.edgetpu.EdgeTPUProcess", "multiprocessing.Process", "datetime.datetime.now", "numpy.full", "frigate.edgetpu.load_labels" ]
[((275, 303), 'frigate.edgetpu.load_labels', 'load_labels', (['"""/labelmap.txt"""'], {}), "('/labelmap.txt')\n", (286, 303), False, 'from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels\n'), ((1848, 1864), 'frigate.edgetpu.EdgeTPUProcess', 'EdgeTPUProcess', ([], {}), '()\n', (1...
import numpy as np import scipy import scipy.stats as stats import torch from sklearn.metrics import roc_auc_score from netquery.decoders import BilinearMetapathDecoder, TransEMetapathDecoder, BilinearDiagMetapathDecoder, BilinearBlockDiagMetapathDecoder, BilinearBlockDiagPos2FeatMatMetapathDecoder, SetIntersection, Si...
[ "logging.getLogger", "logging.StreamHandler", "math.floor", "netquery.decoders.BilinearDiagMetapathDecoder", "torch.LongTensor", "torch.cuda.device_count", "netquery.decoders.BilinearBlockDiagMetapathDecoder", "torch.cuda.is_available", "numpy.mean", "netquery.attention.IntersectDotProductAttentio...
[((4537, 4554), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (4548, 4554), False, 'import random\n'), ((7060, 7077), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (7071, 7077), False, 'import random\n'), ((26140, 26278), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO...
import os import sys TRASH = [ 'bottle', 'cup', 'fork', 'knife', 'spoon' 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake' ] YOLO_PATH = os.path.join(sys.path[0], 'yc') IMAGE_PATH = os.path.join(sys.path[0]...
[ "cv2.dnn.blobFromImage", "keras.preprocessing.image.img_to_array", "cv2.rectangle", "keras.backend.image_data_format", "os.path.join", "numpy.argmax", "model_def.load_model", "cv2.putText", "keras.preprocessing.image.ImageDataGenerator", "numpy.array", "PIL.ImageDraw.Draw", "numpy.random.seed"...
[((251, 282), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""yc"""'], {}), "(sys.path[0], 'yc')\n", (263, 282), False, 'import os\n'), ((296, 334), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""input.jpg"""'], {}), "(sys.path[0], 'input.jpg')\n", (308, 334), False, 'import os\n'), ((905, 936), 'model_def.l...
""" Basic Unit testing for helper_functions.py """ import random import pandas as pd import numpy as np import pytest from lambdata import helper_functions df = pd.DataFrame( np.random.randint(0, 100, size=(100, 4)), columns=list('ABCD')) def test_null_count(): """ testing null count is zero """...
[ "numpy.random.randint", "lambdata.helper_functions.WrangledDataFrame" ]
[((182, 222), 'numpy.random.randint', 'np.random.randint', (['(0)', '(100)'], {'size': '(100, 4)'}), '(0, 100, size=(100, 4))\n', (199, 222), True, 'import numpy as np\n'), ((339, 377), 'lambdata.helper_functions.WrangledDataFrame', 'helper_functions.WrangledDataFrame', (['df'], {}), '(df)\n', (373, 377), False, 'from ...
#!/usr/bin/env python import numpy as np from pars import Inp_Pars class Forward_Rates(object): """ Description: ------------ For a given fitted financial model, compute a realization of future IRs (or transformed IRs). Parameters: ----------- X_0 : ~float The current IR (or t...
[ "numpy.exp", "numpy.cumprod" ]
[((1199, 1274), 'numpy.exp', 'np.exp', (['((mu - sigma ** 2.0 / 2.0) * Inp_Pars.dt + sigma * self.random_array)'], {}), '((mu - sigma ** 2.0 / 2.0) * Inp_Pars.dt + sigma * self.random_array)\n', (1205, 1274), True, 'import numpy as np\n'), ((1349, 1365), 'numpy.cumprod', 'np.cumprod', (['step'], {}), '(step)\n', (1359,...
import copy import pickle import random import os import torch import torch.nn.functional as F import torch.distributed as dist import numpy as np from torch.autograd import Variable from gym.spaces import Discrete, Box import ped_env import rl from rl.utils.miscellaneous import str_key def set_dict(target_dict, v...
[ "torch.from_numpy", "numpy.array", "torch.nn.functional.softmax", "numpy.mean", "torch.eye", "numpy.stack", "numpy.vstack", "numpy.random.seed", "numpy.concatenate", "torch.distributed.get_world_size", "random.choice", "pickle.load", "torch.distributed.all_reduce", "torch.cuda.manual_seed_...
[((788, 804), 'random.choice', 'random.choice', (['A'], {}), '(A)\n', (801, 804), False, 'import random\n'), ((3819, 3852), 'torch.nn.functional.softmax', 'F.softmax', (['(y / temperature)'], {'dim': '(1)'}), '(y / temperature, dim=1)\n', (3828, 3852), True, 'import torch.nn.functional as F\n'), ((5075, 5114), 'numpy.v...
''' Created on Jan 8, 2016 @author: <NAME> ''' import caffe from fast_rcnn.config import cfg from roi_data_layer.minibatch import get_minibatch import numpy as np import yaml from multiprocessing import Process, Queue class PoseLossLayer(caffe.Layer): """ Pose loss layer that computes the biternion loss...
[ "numpy.where", "numpy.sum", "numpy.dot", "numpy.zeros", "numpy.cos", "numpy.linalg.norm", "numpy.sin", "numpy.zeros_like" ]
[((1360, 1393), 'numpy.zeros', 'np.zeros', (['bottom[0].data.shape[0]'], {}), '(bottom[0].data.shape[0])\n', (1368, 1393), True, 'import numpy as np\n'), ((1453, 1486), 'numpy.zeros', 'np.zeros', (['bottom[0].data.shape[0]'], {}), '(bottom[0].data.shape[0])\n', (1461, 1486), True, 'import numpy as np\n'), ((1543, 1581)...
# -*- coding: utf-8 -*- import numpy as np import cv2, os, lda if __name__ == "__main__": # set parameter for experiment nTopics = 8 # create folder for saving result if not os.path.exists("result"): os.mkdir("result") # create folder for showing fitting process if not os.path.exists("visualization"): os...
[ "os.path.exists", "numpy.zeros", "os.mkdir", "lda.LDA", "cv2.imread" ]
[((401, 437), 'numpy.zeros', 'np.zeros', (['(1000, 16)'], {'dtype': 'np.uint8'}), '((1000, 16), dtype=np.uint8)\n', (409, 437), True, 'import numpy as np\n'), ((651, 660), 'lda.LDA', 'lda.LDA', ([], {}), '()\n', (658, 660), False, 'import cv2, os, lda\n'), ((182, 206), 'os.path.exists', 'os.path.exists', (['"""result""...
# -*- coding: utf-8 -*- """ This is the script to generate a Circle dataset. Credits to https://github.com/hyounesy/TFPlaygroundPSA/blob/master/src/dataset.py. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import random import os im...
[ "os.path.exists", "random.uniform", "matplotlib.pyplot.savefig", "numpy.sqrt", "matplotlib.use", "numpy.zeros", "os.mkdir", "matplotlib.pyplot.scatter", "numpy.cos", "numpy.sin", "numpy.load", "numpy.save" ]
[((336, 357), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (350, 357), False, 'import matplotlib\n'), ((937, 963), 'numpy.zeros', 'np.zeros', (['[num_samples, 2]'], {}), '([num_samples, 2])\n', (945, 963), True, 'import numpy as np\n'), ((1992, 2016), 'os.path.exists', 'os.path.exists', (['"""....
import os import sys import PIL import math import time import json import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torchvision from pathlib import Path from PIL import Image, ImageOps, ImageFilter from torch import nn, optim from torchvision import transforms,...
[ "torch.nn.CrossEntropyLoss", "pandas.read_csv", "torch.cuda.is_available", "os.listdir", "pathlib.Path", "json.dumps", "torchvision.transforms.ToTensor", "torchvision.transforms.RandomResizedCrop", "torchvision.models.resnet50", "torch.utils.data.sampler.SubsetRandomSampler", "numpy.floor", "t...
[((653, 677), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (675, 677), False, 'import torch\n'), ((678, 699), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (695, 699), False, 'import torch\n'), ((1630, 1655), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), ...
''' Random Breakout AI player @author: <NAME> <<EMAIL>> ''' import gym import numpy import random import pandas if __name__ == '__main__': env = gym.make('Breakout-v0') env.monitor.start('/tmp/breakout-experiment-1', force=True) # video_callable=lambda count: count % 10 == 0) goal_average_ste...
[ "numpy.ndarray", "gym.make" ]
[((155, 178), 'gym.make', 'gym.make', (['"""Breakout-v0"""'], {}), "('Breakout-v0')\n", (163, 178), False, 'import gym\n'), ((381, 397), 'numpy.ndarray', 'numpy.ndarray', (['(0)'], {}), '(0)\n', (394, 397), False, 'import numpy\n'), ((514, 530), 'numpy.ndarray', 'numpy.ndarray', (['(0)'], {}), '(0)\n', (527, 530), Fals...
import pytest from ipyplotly.basevalidators import StringValidator import numpy as np # Fixtures # -------- @pytest.fixture() def validator(): return StringValidator('prop', 'parent') @pytest.fixture() def validator_values(): return StringValidator('prop', 'parent', values=['foo', 'BAR', '']) @pytest.fixt...
[ "ipyplotly.basevalidators.StringValidator", "pytest.mark.parametrize", "numpy.array", "pytest.raises", "pytest.fixture" ]
[((111, 127), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (125, 127), False, 'import pytest\n'), ((193, 209), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (207, 209), False, 'import pytest\n'), ((309, 325), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (323, 325), False, 'import pytest\n'), (...
import sys import numpy as np import skvideo.io import concurrent.futures import time def _detect_black_bars_from_video(frames, blackbar_threshold=16, max_perc_to_trim=.2): """ :param frames: [num_frames, height, width, 3] :param blackbar_threshold: Pixels must be this intense for us to not trim :param...
[ "numpy.stack", "time.time" ]
[((1873, 1889), 'numpy.stack', 'np.stack', (['frames'], {}), '(frames)\n', (1881, 1889), True, 'import numpy as np\n'), ((3742, 3753), 'time.time', 'time.time', ([], {}), '()\n', (3751, 3753), False, 'import time\n'), ((4711, 4727), 'numpy.stack', 'np.stack', (['frames'], {}), '(frames)\n', (4719, 4727), True, 'import ...
import numpy as np import torch def evaluate_performance(environment, policy, GAMMA, agent): pi = policy.table.detach().numpy().T pi = np.exp(pi) / np.sum(np.exp(pi), axis=1)[:, None] nS, nA = pi.shape mu0 = np.full(nS, 1/nS) pi2 = np.tile(pi, (1, nS)) * np.kron(np.eye(nS), np.ones((1, nA))) ...
[ "numpy.tile", "numpy.eye", "numpy.ones", "numpy.exp", "numpy.array", "numpy.sum", "numpy.full", "numpy.arange" ]
[((228, 247), 'numpy.full', 'np.full', (['nS', '(1 / nS)'], {}), '(nS, 1 / nS)\n', (235, 247), True, 'import numpy as np\n'), ((487, 498), 'numpy.array', 'np.array', (['r'], {}), '(r)\n', (495, 498), True, 'import numpy as np\n'), ((752, 763), 'numpy.array', 'np.array', (['P'], {}), '(P)\n', (760, 763), True, 'import n...
import os import sys import numpy as np import matplotlib.pyplot as plt def plot_loss(history): plt.plot(history[0], label='Training') plt.plot(history[1], label='Validation') plt.title('Training Curves') plt.legend() plt.grid() plt.ylabel('loss') plt.xlabel('epoch') plt.tight_layout...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.path.isfile", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "numpy.genfromtxt", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((103, 141), 'matplotlib.pyplot.plot', 'plt.plot', (['history[0]'], {'label': '"""Training"""'}), "(history[0], label='Training')\n", (111, 141), True, 'import matplotlib.pyplot as plt\n'), ((146, 186), 'matplotlib.pyplot.plot', 'plt.plot', (['history[1]'], {'label': '"""Validation"""'}), "(history[1], label='Validati...
import os import time from collections import deque import numpy as np import tensorflow as tf from ppo2 import explained_variance, mean_or_nan, swap_and_flatten from utils import loghandler from utils.distributions import CategoricalPdType """ Implementation of Advantage Actor Critic (A2C): Advantage Actor Cri...
[ "tensorflow.train.Checkpoint", "tensorflow.GradientTape", "tensorflow.keras.layers.Dense", "tensorflow.reduce_mean", "tensorflow.cast", "tensorflow.clip_by_global_norm", "ppo2.mean_or_nan", "collections.deque", "numpy.asarray", "utils.distributions.CategoricalPdType", "tensorflow.square", "ten...
[((10111, 10138), 'utils.loghandler.LogHandler', 'loghandler.LogHandler', (['conf'], {}), '(conf)\n', (10132, 10138), False, 'from utils import loghandler\n'), ((10616, 10633), 'collections.deque', 'deque', ([], {'maxlen': '(100)'}), '(maxlen=100)\n', (10621, 10633), False, 'from collections import deque\n'), ((10684, ...
from scipy.stats import kstest from scipy.stats import norm import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm # create data with specific distribution # data = np.random.normal(0, 1, 1000) data = np.random.uniform(0, 1, 50) # KS test and output the results test_stat = kste...
[ "scipy.stats.kstest", "statsmodels.api.distributions.ECDF", "numpy.random.uniform", "matplotlib.pyplot.step", "matplotlib.pyplot.show" ]
[((237, 264), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(50)'], {}), '(0, 1, 50)\n', (254, 264), True, 'import numpy as np\n'), ((316, 336), 'scipy.stats.kstest', 'kstest', (['data', '"""norm"""'], {}), "(data, 'norm')\n", (322, 336), False, 'from scipy.stats import kstest\n'), ((451, 478), 'statsmo...
import infery, numpy as np model = infery.load(model_path='resnet_dynamic_1_1.pkl', framework_type='trt', inference_hardware='gpu') inputs = np.random.random((16, 3, 224, 224)).astype('float32') model.predict(inputs) model.benchmark(batch_size=16)
[ "numpy.random.random", "infery.load" ]
[((35, 135), 'infery.load', 'infery.load', ([], {'model_path': '"""resnet_dynamic_1_1.pkl"""', 'framework_type': '"""trt"""', 'inference_hardware': '"""gpu"""'}), "(model_path='resnet_dynamic_1_1.pkl', framework_type='trt',\n inference_hardware='gpu')\n", (46, 135), False, 'import infery, numpy as np\n'), ((142, 177...
import numpy as np import scipy from ... import spectrum from ... import utilits as ut def ica_kurtosis(x, order, mode = 'full'): ''' FUNCTION IN TEST Max-kurtosis Independent Component Analysis (ICA) References ------------------------ [1] http://www.cs.nyu.edu/~roweis/kica.html ...
[ "scipy.linalg.sqrtm", "numpy.linalg.eig", "numpy.conj", "numpy.asanyarray", "numpy.square", "numpy.dot" ]
[((488, 514), 'scipy.linalg.sqrtm', 'scipy.linalg.sqrtm', (['invCov'], {}), '(invCov)\n', (506, 514), False, 'import scipy\n'), ((525, 537), 'numpy.dot', 'np.dot', (['W', 'X'], {}), '(W, X)\n', (531, 537), True, 'import numpy as np\n'), ((621, 644), 'numpy.dot', 'np.dot', (['(gg * Xcw)', 'Xcw.T'], {}), '(gg * Xcw, Xcw....
#!/usr/bin/env python # wujian@2019 import argparse import numpy as np from libs.ssl import ml_ssl, srp_ssl, music_ssl from libs.data_handler import SpectrogramReader, NumpyReader from libs.utils import get_logger, EPSILON from libs.opts import StftParser, str2tuple logger = get_logger(__name__) def add_wta(mas...
[ "argparse.ArgumentParser", "numpy.where", "libs.data_handler.NumpyReader", "libs.ssl.srp_ssl", "numpy.max", "numpy.stack", "numpy.linspace", "libs.utils.get_logger", "libs.opts.str2tuple", "libs.ssl.music_ssl", "numpy.load", "libs.data_handler.SpectrogramReader", "libs.ssl.ml_ssl" ]
[((282, 302), 'libs.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (292, 302), False, 'from libs.utils import get_logger, EPSILON\n'), ((402, 431), 'numpy.stack', 'np.stack', (['masks_list'], {'axis': '(-1)'}), '(masks_list, axis=-1)\n', (410, 431), True, 'import numpy as np\n'), ((447, 464), 'num...
# - import modules - # import os, sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns if not os.path.exists('pyAp') and os.path.exists('../pyAp'): # hack to allow scripts to be placed in subdirectories next to pyAp: sys.path.insert(1, os.path.abspath('..')) from pyAp i...
[ "os.path.exists", "pyAp.pyAp_tools.ap_mc", "seaborn.kdeplot", "pyAp.pyApthermo.ApThermo", "pyAp.pyAp_tools.yes_or_no", "pandas.read_excel", "pandas.DataFrame", "numpy.percentile", "os.path.abspath", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((441, 478), 'pandas.read_excel', 'pd.read_excel', (['"""data_calc_water.xlsx"""'], {}), "('data_calc_water.xlsx')\n", (454, 478), True, 'import pandas as pd\n'), ((711, 725), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (723, 725), True, 'import pandas as pd\n'), ((811, 827), 'pandas.DataFrame', 'pd.DataFram...
#!/usr/bin/env python # coding: utf-8 from evidently.analyzers.base_analyzer import Analyzer import pandas as pd from pandas.api.types import is_numeric_dtype import numpy as np from scipy.stats import ks_2samp, chisquare class DataDriftAnalyzer(Analyzer): def calculate(self, reference_data: pd.DataFrame, produ...
[ "pandas.api.types.is_numeric_dtype", "scipy.stats.chisquare", "scipy.stats.ks_2samp", "numpy.isfinite" ]
[((3941, 3964), 'scipy.stats.chisquare', 'chisquare', (['f_exp', 'f_obs'], {}), '(f_exp, f_obs)\n', (3950, 3964), False, 'from scipy.stats import ks_2samp, chisquare\n'), ((889, 927), 'pandas.api.types.is_numeric_dtype', 'is_numeric_dtype', (['reference_data[name]'], {}), '(reference_data[name])\n', (905, 927), False, ...
"""Classes that represent the state of the entire system and entities within. These classes wrap protobufs, which are basically a fancy NamedTuple that is generated by the `build` Makefile target. You can read more about protobufs online, but mainly they're helpful for serializing data over the network.""" import log...
[ "logging.getLogger", "orbitx.strings.RADIATOR_NAMES.index", "orbitx.orbitx_pb2.PhysicalState", "orbitx.strings.COMPONENT_NAMES.index", "numpy.asarray", "orbitx.orbitx_pb2.Navmode.values", "vpython.vector", "numpy.array", "orbitx.strings.COOLANT_LOOP_NAMES.index", "orbitx.orbitx_pb2.EngineeringStat...
[((504, 523), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (521, 523), False, 'import logging\n'), ((2180, 2203), 'orbitx.orbitx_pb2.Navmode.values', 'protos.Navmode.values', ([], {}), '()\n', (2201, 2203), True, 'from orbitx import orbitx_pb2 as protos\n'), ((3273, 3328), 'vpython.vector', 'vpython.vect...
# Import libraries import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier # Load the train and test datasets to create two DataFrames train = pd.read_csv('train.csv') test=pd.read_csv('test.csv') #Print the `head` of the train and test dataframes print(train.head()) print(test.hea...
[ "pandas.DataFrame", "numpy.array", "sklearn.ensemble.RandomForestClassifier", "pandas.read_csv" ]
[((180, 204), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (191, 204), True, 'import pandas as pd\n'), ((210, 233), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (221, 233), True, 'import pandas as pd\n'), ((1366, 1461), 'sklearn.ensemble.RandomForestCl...
#****************************************************************************** # # tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow # Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME> # # This program is free software, distributed under the terms of the # Apache License, Version 2.0 ...
[ "numpy.rollaxis", "numpy.array", "numpy.rot90", "numpy.linalg.norm", "numpy.sin", "numpy.arange", "imageio.get_writer", "uniio.readUni", "numpy.less", "numpy.flip", "numpy.reshape", "uniio.writeUni", "numpy.isscalar", "numpy.asarray", "numpy.max", "numpy.stack", "numpy.linspace", "...
[((1200, 1208), 'random.seed', 'seed', (['(42)'], {}), '(42)\n', (1204, 1208), False, 'from random import seed, random, randrange\n'), ((719, 748), 'imp.find_module', 'imp.find_module', (['"""matplotlib"""'], {}), "('matplotlib')\n", (734, 748), False, 'import imp\n'), ((38705, 38722), 'numpy.asarray', 'np.asarray', ([...
''' analysis ~~~~~~~~ This module collects all useful functions to be used by the worker when performing a fuzzing analysis ''' import os import random import string from config import Config import logging as logger import time import worker_timeout as wt import shutil import seeds_generator as sg import ast import ...
[ "sklearn.feature_selection.mutual_info_classif", "os.listdir", "config.Config", "seeds_generator.generate_seeds", "os.path.join", "logging.warning", "time.sleep", "logging.exception", "numpy.append", "numpy.array", "jni_extractor.method_abstraction.SootMethod", "os.path.isdir", "numpy.exp", ...
[((436, 444), 'config.Config', 'Config', ([], {}), '()\n', (442, 444), False, 'from config import Config\n'), ((493, 524), 'os.path.join', 'os.path.join', (['WORKSPACE', '"""libs"""'], {}), "(WORKSPACE, 'libs')\n", (505, 524), False, 'import os\n'), ((533, 566), 'os.path.join', 'os.path.join', (['WORKSPACE', '"""inputs...
import torch import torch.nn as nn import numpy as np from sklearn.linear_model import LogisticRegression as Logit from scipy.optimize import brentq from models.layers import StochasticLinear as SLinear from models.layers import NotStochasticLinear as Linear from models.layers import BoundedStochasticModel class SMin...
[ "scipy.optimize.brentq", "models.layers.StochasticLinear", "torch.nn.Linear", "numpy.linalg.norm", "models.layers.NotStochasticLinear" ]
[((512, 554), 'models.layers.StochasticLinear', 'SLinear', (['input_dim', 'output_dim'], {'bias': '(False)'}), '(input_dim, output_dim, bias=False)\n', (519, 554), True, 'from models.layers import StochasticLinear as SLinear\n'), ((855, 896), 'models.layers.NotStochasticLinear', 'Linear', (['input_dim', 'output_dim'], ...
import numpy as np class surface: def __init__(self, vertices=[[0.,0.,0.], [1.,0.,0.], [0.,1.,0.]], reflectivity=1.): if (type(vertices) != list): raise ValueError("vertices must be of type list") if (len(vertices) != 3): raise ValueError("Surface must have ...
[ "numpy.roll", "numpy.cross", "numpy.argmax", "numpy.invert", "numpy.sum", "numpy.array", "numpy.dot" ]
[((550, 568), 'numpy.array', 'np.array', (['vertices'], {}), '(vertices)\n', (558, 568), True, 'import numpy as np\n'), ((650, 737), 'numpy.cross', 'np.cross', (['(self.vertices[1] - self.vertices[0])', '(self.vertices[2] - self.vertices[0])'], {}), '(self.vertices[1] - self.vertices[0], self.vertices[2] - self.\n v...
# -*- coding: utf-8 -*- # @Brief: 实现模型分类的网络,MAML与网络结构无关,重点在训练过程 from tensorflow.keras import layers, models, losses import tensorflow as tf import numpy as np class MAML: def __init__(self, input_shape, num_classes): """ MAML模型类,需要两个模型,一个是作为真实更新的权重θ,另一个是用来做θ'的更新 :param input_shape: 模型输入sh...
[ "tensorflow.keras.layers.Conv2D", "numpy.argmax", "tensorflow.keras.layers.BatchNormalization", "tensorflow.GradientTape", "numpy.array", "tensorflow.keras.losses.sparse_categorical_crossentropy", "tensorflow.keras.layers.Dense", "tensorflow.reduce_mean", "tensorflow.keras.layers.Flatten", "tensor...
[((774, 883), 'tensorflow.keras.layers.Conv2D', 'layers.Conv2D', ([], {'filters': '(64)', 'kernel_size': '(3)', 'padding': '"""same"""', 'activation': '"""relu"""', 'input_shape': 'self.input_shape'}), "(filters=64, kernel_size=3, padding='same', activation='relu',\n input_shape=self.input_shape)\n", (787, 883), Fal...
import os import numpy as np import json import random from PIL import Image from PIL import ImageDraw import torch from torch.utils.data import Dataset, DataLoader import torchvision.transforms as transforms class DatasetBase(Dataset): """Base dataset for VITON-GAN. """ def __init__(self, opt, mode, data_...
[ "PIL.Image.open", "PIL.Image.new", "os.path.join", "torch.from_numpy", "numpy.array", "PIL.ImageDraw.Draw", "torch.flip", "torchvision.transforms.Normalize", "json.load", "random.random", "torchvision.transforms.ToTensor", "torch.zeros", "torch.cat" ]
[((6153, 6168), 'random.random', 'random.random', ([], {}), '()\n', (6166, 6168), False, 'import random\n'), ((408, 441), 'os.path.join', 'os.path.join', (['opt.data_root', 'mode'], {}), '(opt.data_root, mode)\n', (420, 441), False, 'import os\n'), ((3027, 3084), 'torch.zeros', 'torch.zeros', (['point_num', 'self.fine_...
""" This is for Kaggle's Northeastern SMILE Lab - Recognizing Faces in the Wild playground competition: https://www.kaggle.com/c/recognizing-faces-in-the-wild The general model will be to create feature vectors of each face, then compare their Euclidean distance to get a value. I will use a second NN to make the fina...
[ "tensorflow.keras.backend.epsilon", "pandas.read_csv", "tensorflow.python.keras.preprocessing.image.load_img", "tensorflow.keras.layers.Dense", "tensorflow.keras.models.load_model", "os.walk", "os.path.exists", "tensorflow.keras.callbacks.ReduceLROnPlateau", "numpy.stack", "pandas.DataFrame", "t...
[((1253, 1325), 'os.path.join', 'os.path.join', (['"""E:\\\\"""', '"""datasets"""', '"""kaggle-recognizing-faces-in-the-wild"""'], {}), "('E:\\\\', 'datasets', 'kaggle-recognizing-faces-in-the-wild')\n", (1265, 1325), False, 'import os\n'), ((1339, 1372), 'os.path.join', 'os.path.join', (['dataset_dir', '"""test"""'], ...
import mmcv import numpy as np import pytest from os import path as osp from mmdet3d.core.bbox import DepthInstance3DBoxes from mmdet3d.datasets.pipelines import (LoadAnnotations3D, LoadPointsFromFile, LoadPointsFromMultiSweeps) def test_load_points_from_indoor_file(): sun...
[ "mmdet3d.datasets.pipelines.LoadPointsFromMultiSweeps", "os.path.join", "numpy.equal", "numpy.array", "numpy.zeros", "pytest.raises", "mmdet3d.core.bbox.DepthInstance3DBoxes", "mmcv.load", "mmdet3d.datasets.pipelines.LoadAnnotations3D", "mmdet3d.datasets.pipelines.LoadPointsFromFile" ]
[((332, 383), 'mmcv.load', 'mmcv.load', (['"""./tests/data/sunrgbd/sunrgbd_infos.pkl"""'], {}), "('./tests/data/sunrgbd/sunrgbd_infos.pkl')\n", (341, 383), False, 'import mmcv\n'), ((420, 460), 'mmdet3d.datasets.pipelines.LoadPointsFromFile', 'LoadPointsFromFile', (['(6)'], {'shift_height': '(True)'}), '(6, shift_heigh...
import numpy as np from collections import deque import random class Buffer: def __init__(self, max_size=1000, seed=None): self.buffer = deque(maxlen=max_size) self.max_size = max_size random.seed(seed) @property def size(self): return len(self.buffer) def sam...
[ "random.sample", "collections.deque", "random.seed", "numpy.array", "numpy.float32", "numpy.random.RandomState" ]
[((151, 173), 'collections.deque', 'deque', ([], {'maxlen': 'max_size'}), '(maxlen=max_size)\n', (156, 173), False, 'from collections import deque\n'), ((215, 232), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (226, 232), False, 'import random\n'), ((383, 413), 'random.sample', 'random.sample', (['self.buf...
import cv2 import numpy as np from PIL import Image import random import datetime import os from shutil import copyfile MATE_PROBABILTY = 0.35 MUTATION_PROBABILITY = 0.45 HARD_MUTATION_PROBABILITY = 0.6 ADD_GEN = 5 POPULATION = 10 CIRCLES = 1 FILENAME = "monalisa" ref = Image.open("../img/" + FILENAME + ".jpg") r...
[ "random.sample", "PIL.Image.open", "random.uniform", "PIL.Image.fromarray", "os.makedirs", "numpy.array", "numpy.zeros", "cv2.addWeighted", "shutil.copyfile", "cv2.circle", "datetime.datetime.now", "random.randint" ]
[((277, 318), 'PIL.Image.open', 'Image.open', (["('../img/' + FILENAME + '.jpg')"], {}), "('../img/' + FILENAME + '.jpg')\n", (287, 318), False, 'from PIL import Image\n'), ((325, 338), 'numpy.array', 'np.array', (['ref'], {}), '(ref)\n', (333, 338), True, 'import numpy as np\n'), ((348, 381), 'numpy.zeros', 'np.zeros'...
# -*- coding = utf-8 -*- # @Time : 2022/2/3 10:17 # @Author : 戎昱 # @File : makeImageSets.py # @Software : PyCharm # @Contact : <EMAIL> # @github : https://github.com/SekiroRong import os import random import numpy as np from config import kitti_root # kitti_root = r'G:\carla' video_path = kitti_root + r'\...
[ "numpy.random.choice", "os.listdir", "os.path.join" ]
[((346, 381), 'os.path.join', 'os.path.join', (['video_path', '"""image_2"""'], {}), "(video_path, 'image_2')\n", (358, 381), False, 'import os\n'), ((962, 1025), 'numpy.random.choice', 'np.random.choice', (['images_filenames', 'train_length'], {'replace': '(False)'}), '(images_filenames, train_length, replace=False)\n...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Test for smoothing with kernels """ import numpy as np from numpy.random import random_integers as randint from nipy import load_image from nipy.algorithms.kernel_smooth import LinearFilter from nipy.c...
[ "nipy.algorithms.kernel_smooth.LinearFilter", "nipy.core.api.Image", "numpy.product", "nipy.algorithms.kernel_smooth.fwhm2sigma", "numpy.corrcoef", "numpy.random.random_integers", "nipy.load_image", "numpy.argmax", "numpy.indices", "numpy.zeros", "nipy.testing.assert_equal", "nipy.algorithms.k...
[((637, 657), 'nipy.load_image', 'load_image', (['anatfile'], {}), '(anatfile)\n', (647, 657), False, 'from nipy import load_image\n'), ((673, 712), 'nipy.algorithms.kernel_smooth.LinearFilter', 'LinearFilter', (['anat.coordmap', 'anat.shape'], {}), '(anat.coordmap, anat.shape)\n', (685, 712), False, 'from nipy.algorit...
import json import logging import os import tempfile import pandas as pd import warnings from io import StringIO from os import getcwd from os.path import abspath, dirname, join from pathlib import Path from shutil import rmtree from numpy.testing import assert_array_equal from pandas.testing import assert_frame_equa...
[ "logging.getLogger", "logging.StreamHandler", "nose.tools.eq_", "pandas.read_csv", "nose.tools.assert_equal", "pathlib.Path", "nose.tools.raises", "os.unlink", "tempfile.NamedTemporaryFile", "io.StringIO", "numpy.testing.assert_array_equal", "rsmtool.configuration_parser.ConfigurationParser", ...
[((694, 711), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (701, 711), False, 'from os.path import abspath, dirname, join\n'), ((786, 811), 'nose.tools.raises', 'raises', (['FileNotFoundError'], {}), '(FileNotFoundError)\n', (792, 811), False, 'from nose.tools import assert_equal, assert_not_equal,...
# Copyright 2017 <NAME> Society # Distributed under the BSD-3 Software license, # (See accompanying file ./LICENSE.txt or copy at # https://opensource.org/licenses/BSD-3-Clause) """ Wasserstein Auto-Encoder models """ import sys import time import os import logging from math import sqrt, cos, sin, pi import numpy as...
[ "utils.create_dir", "tensorflow.shape", "loss_functions.moments_loss", "tensorflow.reduce_sum", "numpy.array2string", "model_nn.continuous_decoder", "tensorflow.gfile.IsDirectory", "numpy.array", "tensorflow.nn.softmax", "tensorflow.cast", "logging.error", "tensorflow.log", "tensorflow.clip_...
[((960, 1006), 'logging.error', 'logging.error', (['"""Building the Tensorflow Graph"""'], {}), "('Building the Tensorflow Graph')\n", (973, 1006), False, 'import logging\n'), ((1057, 1069), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1067, 1069), True, 'import tensorflow as tf\n'), ((1457, 1478), 'tensorflo...
from collections import defaultdict import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm from estimators import npeet_entropy, gcmi_entropy from utils.algebra import entropy_normal_theoretic from utils.common import set_seed, timer_profile, Timer from utils.constants import RESULTS_DIR IMAGES_ENT...
[ "estimators.npeet_entropy", "utils.algebra.entropy_normal_theoretic", "matplotlib.pyplot.ylabel", "numpy.log", "numpy.random.exponential", "numpy.repeat", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "utils.common.set_seed", "numpy.linspace", "matplotlib.pyplot.savefig", "numpy.random...
[((1823, 1890), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(0)', 'high': 'sigma', 'size': '(n_features, n_features)'}), '(low=0, high=sigma, size=(n_features, n_features))\n', (1840, 1890), True, 'import numpy as np\n'), ((2013, 2077), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal',...
""" Script for showing results of GFDL-CM3 experiments Author : <NAME> Date : 21 July 2021 Version : 4 - subsamples random weight class (#8) for mmmean """ ### Import packages import sys import matplotlib.pyplot as plt import numpy as np import cmocean as cmocean import warnings warnings.simplefilter(ac...
[ "numpy.arange", "numpy.asarray", "sys.exit", "warnings.simplefilter", "numpy.genfromtxt", "warnings.filterwarnings", "matplotlib.pyplot.rc", "numpy.set_printoptions" ]
[((296, 358), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (317, 358), False, 'import warnings\n'), ((359, 421), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'Depre...
import _tkinter import PIL import numpy as np from tkinter import * from tkinter import filedialog from PIL import Image, ImageTk # global variables path = '' message = '' img = None img_as_np_array = None width = None height = None popup_window = None popup_window2 = None # create window and set title window = Tk() ...
[ "numpy.packbits", "PIL.Image.open", "PIL.ImageTk.PhotoImage", "numpy.stack", "numpy.ndarray.flatten", "numpy.dtype", "tkinter.filedialog.askopenfilename" ]
[((821, 958), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""/"""', 'title': '"""Select image:"""', 'filetype': "(('png', '*.png'), ('jpg', '*.jpg'), ('jpeg', '*.jpeg'))"}), "(initialdir='/', title='Select image:', filetype=\n (('png', '*.png'), ('jpg', '*.jpg'), ('jpeg',...
import numpy as np import matplotlib.pyplot as plt from ..wind_profile_clustering.read_requested_data import get_wind_data from .single_loc_plots import plot_figure_5a from .plot_maps import plot_all # TODO import all functions needed # TODO add processing functionality # TODO add plot maps single functions # TODO c...
[ "numpy.amax", "numpy.sqrt", "numpy.argmax" ]
[((4325, 4394), 'numpy.sqrt', 'np.sqrt', (["(data['wind_speed_east'] ** 2 + data['wind_speed_north'] ** 2)"], {}), "(data['wind_speed_east'] ** 2 + data['wind_speed_north'] ** 2)\n", (4332, 4394), True, 'import numpy as np\n'), ((4866, 4920), 'numpy.amax', 'np.amax', (['v_req_alt[:, floor_id:ceiling_id + 1]'], {'axis':...
from torch.utils.data.sampler import Sampler from torch.utils.data.sampler import BatchSampler import torch import numpy as np import itertools from collections import OrderedDict class _RepeatSampler(object): """ Sampler that repeats forever. Args: sampler (Sampler) """ def __init__(sel...
[ "torch.cholesky_solve", "torch.unique", "collections.OrderedDict.fromkeys", "torch.eye", "torch.cholesky", "itertools.chain.from_iterable", "numpy.sum", "torch.cuda.is_available", "torch.matmul", "torch.reshape", "torch.zeros", "numpy.arange", "numpy.random.shuffle" ]
[((8288, 8326), 'torch.reshape', 'torch.reshape', (['prediction_x', '[P, T, Q]'], {}), '(prediction_x, [P, T, Q])\n', (8301, 8326), False, 'import torch\n'), ((8354, 8394), 'torch.reshape', 'torch.reshape', (['mu', '[latent_dim, P, T, 1]'], {}), '(mu, [latent_dim, P, T, 1])\n', (8367, 8394), False, 'import torch\n'), (...
from dassl.engine import TRAINER_REGISTRY,TrainerXU from dassl.data import DataManager from torch.utils.data import Dataset as TorchDataset from dassl.optim import build_optimizer, build_lr_scheduler from dassl.utils import count_num_param import torch import torch.nn as nn from torch.nn import functional as F from das...
[ "dassl.engine.TRAINER_REGISTRY.register", "dassl.engine.trainer_tmp.SimpleNet", "torch.nn.CrossEntropyLoss", "dassl.optim.build_optimizer", "dassl.utils.count_num_param", "dassl.utils.MetricMeter", "numpy.array", "torch.nn.Linear", "torch.no_grad", "dassl.optim.build_lr_scheduler" ]
[((416, 443), 'dassl.engine.TRAINER_REGISTRY.register', 'TRAINER_REGISTRY.register', ([], {}), '()\n', (441, 443), False, 'from dassl.engine import TRAINER_REGISTRY, TrainerXU\n'), ((4324, 4339), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4337, 4339), False, 'import torch\n'), ((647, 668), 'torch.nn.CrossEntr...
#!/usr/bin/env python3 import os import sys import argparse import operator import math import numpy as np parser = argparse.ArgumentParser(description='Process output of Kraken run on contigs.') parser.add_argument('-c','--contig', default="", help='per-contig output from Kraken') parser.add_argument('-r','--report'...
[ "operator.itemgetter", "numpy.setdiff1d", "argparse.ArgumentParser", "math.log" ]
[((118, 197), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process output of Kraken run on contigs."""'}), "(description='Process output of Kraken run on contigs.')\n", (141, 197), False, 'import argparse\n'), ((6404, 6437), 'numpy.setdiff1d', 'np.setdiff1d', (['all_ranks', 'ranklist']...
from profiles import * import numpy as np import matplotlib.pyplot as plt NUM_GENS = 35 NUM_ROUNDS = 100 INITIAL_PROFILE = defectors_with_some_tft() def run_simulation(init_profile: dict, num_gens, num_rounds): dist = { 'gens': np.linspace(1, num_gens, num_gens) } init_gen = populationize(init_pr...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "numpy.zeros", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((990, 1058), 'matplotlib.pyplot.title', 'plt.title', (['"""Changes to population distribution with respect to time"""'], {}), "('Changes to population distribution with respect to time')\n", (999, 1058), True, 'import matplotlib.pyplot as plt\n'), ((1063, 1087), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Generat...
import os import re import nltk import numpy as np from sklearn import feature_extraction from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics import jaccard_similarity_score from tqdm import tqdm from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer import pickle _wnl = nltk.Wor...
[ "vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer", "pickle.dump", "sklearn.metrics.pairwise.cosine_similarity", "nltk.word_tokenize", "nltk.WordNetLemmatizer", "numpy.asarray", "numpy.argmax", "pickle.load", "os.path.isfile", "numpy.array", "sklearn.feature_extraction.text.TfidfVectoriz...
[((312, 336), 'nltk.WordNetLemmatizer', 'nltk.WordNetLemmatizer', ([], {}), '()\n', (334, 336), False, 'import nltk\n'), ((1004, 1025), 'numpy.load', 'np.load', (['feature_file'], {}), '(feature_file)\n', (1011, 1025), True, 'import numpy as np\n'), ((3261, 3272), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (3269,...
# coding: utf-8 # # Model # In[551]: get_ipython().run_line_magic('config', "InlineBackend.figure_format = 'retina'") from __future__ import division import pandas as pd import numpy as np import matplotlib.pyplot as plt from collections import Counter from itertools import groupby from math import sqrt # ### C...
[ "numpy.mean", "pandas.read_csv", "numpy.average", "numpy.square", "matplotlib.pyplot.suptitle", "numpy.array_split", "numpy.sum", "numpy.apply_along_axis", "numpy.setdiff1d", "numpy.take", "collections.Counter", "numpy.std", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((8777, 8898), 'pandas.read_csv', 'pd.read_csv', (["(directoryPath + '/iris.data')"], {'names': "['sepalLength', 'sepalWidth', 'petalLength', 'petalWidth', 'target']"}), "(directoryPath + '/iris.data', names=['sepalLength',\n 'sepalWidth', 'petalLength', 'petalWidth', 'target'])\n", (8788, 8898), True, 'import pand...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter import numpy as np def mixup_data(x, y, alpha): # https://github.com/vikasverma1077/manifold_mixup/blob/master/supervised/utils.py '''Compute the mixup data. Return mixed inputs, pairs of targets...
[ "numpy.clip", "numpy.random.beta", "torch.randperm", "torch.eye", "torch.exp", "torch.pow", "numpy.exp", "torch.nn.functional.log_softmax", "torch.zeros" ]
[((371, 399), 'numpy.random.beta', 'np.random.beta', (['alpha', 'alpha'], {}), '(alpha, alpha)\n', (385, 399), True, 'import numpy as np\n'), ((1441, 1471), 'numpy.clip', 'np.clip', (['(1 - lam)', 'eps', '(1 - eps)'], {}), '(1 - lam, eps, 1 - eps)\n', (1448, 1471), True, 'import numpy as np\n'), ((1114, 1128), 'torch.z...
from array import array import numpy as np import struct import sys import os class MNISTLoader: def __init__(self, path): self.path = path self.train_img_fname = 'train-images-idx3-ubyte' self.train_lbl_fname = 'train-labels-idx1-ubyte' self.train_images, self.train_labels = [], ...
[ "numpy.array", "os.path.join" ]
[((674, 719), 'os.path.join', 'os.path.join', (['self.path', 'self.train_img_fname'], {}), '(self.path, self.train_img_fname)\n', (686, 719), False, 'import os\n'), ((733, 778), 'os.path.join', 'os.path.join', (['self.path', 'self.train_lbl_fname'], {}), '(self.path, self.train_lbl_fname)\n', (745, 778), False, 'import...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Aerodynamic loads # <NAME> class Loads: def __init__(self): self.ys = [] # spanwise stations self.chds = [] # chord self.data = {} # coordinates and pressure coefficient self.cls = [] # lift self.cms = [] # moment positive no...
[ "numpy.hstack", "numpy.sin", "numpy.deg2rad", "numpy.zeros", "numpy.vstack", "numpy.savetxt", "numpy.min", "numpy.cos", "matplotlib.pyplot.draw", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((610, 637), 'numpy.zeros', 'np.zeros', (['(pts.shape[0], 1)'], {}), '((pts.shape[0], 1))\n', (618, 637), True, 'import numpy as np\n'), ((726, 751), 'numpy.hstack', 'np.hstack', (['(pts, x_c, cp)'], {}), '((pts, x_c, cp))\n', (735, 751), True, 'import numpy as np\n'), ((905, 922), 'numpy.deg2rad', 'np.deg2rad', (['al...
from sympy import * from matplotlib import pyplot as plt import numpy as np from random import randint y, n = symbols('y n') f = cos(y*log(n+1))/cos(y*log(n))*(1+1/n)**(-1/2) # print(limit(f,n,oo)) maximum recursion limit exceeded .... print( cos(y*log(n+1))/cos(y*log(n)) == cos(y*log(1+1/n))-tan(y*log(n))*sin...
[ "numpy.log", "numpy.linspace", "matplotlib.pyplot.plot", "matplotlib.pyplot.show" ]
[((359, 383), 'numpy.linspace', 'np.linspace', (['(2)', 'M', '(M - 1)'], {}), '(2, M, M - 1)\n', (370, 383), True, 'import numpy as np\n'), ((619, 635), 'matplotlib.pyplot.plot', 'plt.plot', (['n1', 'y1'], {}), '(n1, y1)\n', (627, 635), True, 'from matplotlib import pyplot as plt\n'), ((635, 651), 'matplotlib.pyplot.pl...
### tensorflow==2.3.0 ### https://ai.googleblog.com/2020/08/on-device-real-time-body-pose-tracking.html ### https://google.github.io/mediapipe/solutions/pose ### https://www.tensorflow.org/api_docs/python/tf/keras/Model ### https://www.tensorflow.org/lite/guide/ops_compatibility ### https://www.tensorflow.org/api_do...
[ "tensorflow.python.keras.backend.concatenate", "tensorflow.shape", "tensorflow.raw_ops.MaxPoolWithArgmax", "tensorflow.python.framework.convert_to_constants.convert_variables_to_constants_v2", "tensorflow.cast", "tensorflow.python.keras.utils.conv_utils.normalize_tuple", "tensorflow.size", "tensorflow...
[((6431, 6490), 'tensorflow.keras.Input', 'Input', ([], {'shape': '(height, width, 4)', 'batch_size': '(1)', 'name': '"""input"""'}), "(shape=(height, width, 4), batch_size=1, name='input')\n", (6436, 6490), False, 'from tensorflow.keras import Model, Input\n'), ((9183, 9289), 'tensorflow.raw_ops.MaxPoolWithArgmax', 't...
import pickle import numpy as np import pytest import pandas as pd from copy import deepcopy from veritastool.metrics.modelrates import * from veritastool.model.model_container import ModelContainer from veritastool.fairness.customer_marketing import CustomerMarketing import sys sys.path.append("veritastool/examples/cu...
[ "numpy.random.choice", "veritastool.model.model_container.ModelContainer", "pickle.load", "numpy.array", "pandas.DataFrame", "veritastool.fairness.customer_marketing.CustomerMarketing", "sys.path.append" ]
[((280, 346), 'sys.path.append', 'sys.path.append', (['"""veritastool/examples/customer_marketing_example"""'], {}), "('veritastool/examples/customer_marketing_example')\n", (295, 346), False, 'import sys\n'), ((505, 528), 'pickle.load', 'pickle.load', (['input_file'], {}), '(input_file)\n', (516, 528), False, 'import ...
import copy import numpy as np import timeit import torch import torch.nn as nn from torch.utils.data import BatchSampler, SubsetRandomSampler import rl_sandbox.constants as c from rl_sandbox.algorithms.cem.cem import CEMQ from rl_sandbox.auxiliary_tasks.auxiliary_tasks import AuxiliaryTask class GRAC: def __i...
[ "rl_sandbox.auxiliary_tasks.auxiliary_tasks.AuxiliaryTask", "numpy.mean", "timeit.default_timer", "torch.nn.utils.clip_grad_norm_", "torch.max", "torch.tensor", "rl_sandbox.algorithms.cem.cem.CEMQ", "torch.no_grad", "torch.clamp", "torch.cat", "torch.device" ]
[((390, 405), 'rl_sandbox.auxiliary_tasks.auxiliary_tasks.AuxiliaryTask', 'AuxiliaryTask', ([], {}), '()\n', (403, 405), False, 'from rl_sandbox.auxiliary_tasks.auxiliary_tasks import AuxiliaryTask\n'), ((3331, 3686), 'rl_sandbox.algorithms.cem.cem.CEMQ', 'CEMQ', ([], {'cov_noise_init': 'self._cov_noise_init', 'cov_noi...
""" Example: basic integration Basic example using the vegas_wrapper helper """ from vegasflow.configflow import DTYPE import time import numpy as np import tensorflow as tf from vegasflow.vflow import vegas_wrapper from vegasflow.plain import plain_wrapper # MC integration setup dim = 4 ncalls = np.int32(...
[ "numpy.sqrt", "vegasflow.vflow.vegas_wrapper", "numpy.int32", "tensorflow.range", "tensorflow.constant", "tensorflow.square", "tensorflow.cast", "time.time", "tensorflow.exp" ]
[((311, 329), 'numpy.int32', 'np.int32', (['(100000.0)'], {}), '(100000.0)\n', (319, 329), True, 'import numpy as np\n'), ((449, 478), 'tensorflow.constant', 'tf.constant', (['(0.1)'], {'dtype': 'DTYPE'}), '(0.1, dtype=DTYPE)\n', (460, 478), True, 'import tensorflow as tf\n'), ((490, 523), 'tensorflow.cast', 'tf.cast',...
import os import numpy as np from interface.camera_calibration import ModelImage dir_path = os.path.dirname(os.path.realpath(__file__)) class RobertSquashCourtImage(ModelImage): def __init__(self): self.K = np.matrix([[-524.79644775, 0., 293.28320922], [ 0., ...
[ "os.path.realpath", "numpy.array", "numpy.matrix", "os.path.join" ]
[((111, 137), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (127, 137), False, 'import os\n'), ((223, 328), 'numpy.matrix', 'np.matrix', (['[[-524.79644775, 0.0, 293.28320922], [0.0, -523.37878418, 226.37976338], [\n 0.0, 0.0, 1.0]]'], {}), '([[-524.79644775, 0.0, 293.28320922], [0.0, -...
"""Code to generate full mock LCs.""" import numpy as np import kali import kali.carma import pandas as pd import sys from joblib import Parallel, delayed sys.path.insert(0, '/home/mount/lsst_cadence') from lsstlc import * # derived LSST lightcurve sub-class def genLC(params, save_dir): """Generating simulated l...
[ "sys.path.insert", "pandas.read_csv", "joblib.Parallel", "kali.carma.CARMATask", "numpy.array", "joblib.delayed" ]
[((155, 201), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/mount/lsst_cadence"""'], {}), "(0, '/home/mount/lsst_cadence')\n", (170, 201), False, 'import sys\n'), ((501, 527), 'kali.carma.CARMATask', 'kali.carma.CARMATask', (['(2)', '(1)'], {}), '(2, 1)\n', (521, 527), False, 'import kali\n'), ((575, 641), '...
from pydantic import BaseModel from icolos.core.workflow_steps.schrodinger.base import StepSchrodingerBase import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.csgraph import shortest_path from icolos.utils.enums.step_enums import StepFepPlusEnum from typing import List import time import os from ic...
[ "os.listdir", "scipy.sparse.csgraph.shortest_path", "os.path.join", "time.sleep", "icolos.utils.enums.step_enums.StepFepPlusEnum", "numpy.zeros", "scipy.sparse.csr_matrix" ]
[((369, 386), 'icolos.utils.enums.step_enums.StepFepPlusEnum', 'StepFepPlusEnum', ([], {}), '()\n', (384, 386), False, 'from icolos.utils.enums.step_enums import StepFepPlusEnum\n'), ((4798, 4830), 'numpy.zeros', 'np.zeros', (['(len_nodes, len_nodes)'], {}), '((len_nodes, len_nodes))\n', (4806, 4830), True, 'import num...
from scipy.linalg import toeplitz import numpy as np from cooltools.lib.numutils import LazyToeplitz n = 100 m = 150 c = np.arange(1, n + 1) r = np.r_[1, np.arange(-2, -m, -1)] L = LazyToeplitz(c, r) T = toeplitz(c, r) def test_symmetric(): for si in [ slice(10, 20), slice(0, 150), slic...
[ "cooltools.lib.numutils.LazyToeplitz", "numpy.allclose", "scipy.linalg.toeplitz", "numpy.arange" ]
[((123, 142), 'numpy.arange', 'np.arange', (['(1)', '(n + 1)'], {}), '(1, n + 1)\n', (132, 142), True, 'import numpy as np\n'), ((184, 202), 'cooltools.lib.numutils.LazyToeplitz', 'LazyToeplitz', (['c', 'r'], {}), '(c, r)\n', (196, 202), False, 'from cooltools.lib.numutils import LazyToeplitz\n'), ((207, 221), 'scipy.l...
#!/usr/bin/python3 import numpy as np import matplotlib.pyplot as plt from math import pi ### falling_sphere.py ### ### Script to calculate the finite differences ### solution for the falling sphere in a viscous fluid ### (Stokes' law). ### ### Compared against analytical solution. ##################### #### Paramet...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.exp", "numpy.zeros", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((892, 904), 'numpy.zeros', 'np.zeros', (['nt'], {}), '(nt)\n', (900, 904), True, 'import numpy as np\n'), ((963, 975), 'numpy.zeros', 'np.zeros', (['nt'], {}), '(nt)\n', (971, 975), True, 'import numpy as np\n'), ((2416, 2450), 'numpy.linspace', 'np.linspace', (['(0)', '((nt - 1) * dt)', '(200)'], {}), '(0, (nt - 1) ...
#!/usr/bin/env python3 import json import math import numpy as np import re import sys from terminaltables import AsciiTable from termcolor import colored from scipy.stats import ttest_ind p_value_significance_threshold = 0.001 min_iterations = 10 min_runtime_ns = 59 * 1000 * 1000 * 1000 min_iterations_disabling_min_...
[ "numpy.mean", "re.escape", "termcolor.colored", "numpy.array", "terminaltables.AsciiTable", "scipy.stats.ttest_ind", "json.load", "math.isnan" ]
[((13082, 13104), 'terminaltables.AsciiTable', 'AsciiTable', (['table_data'], {}), '(table_data)\n', (13092, 13104), False, 'from terminaltables import AsciiTable\n'), ((3995, 4018), 'terminaltables.AsciiTable', 'AsciiTable', (['table_lines'], {}), '(table_lines)\n', (4005, 4018), False, 'from terminaltables import Asc...
import numpy as np np.random.seed(9453) from time_series_augmentation_toolkit import DN import pickle with open('labeldata.pkl','rb') as f: data = pickle.load(f) output = [] for d in data: this_output = d.copy() r = np.random.choice([3,5,10,15,20], size=4, p=[0.1,0.5,0.3,0.05,0.05]) this_...
[ "pickle.dump", "numpy.random.choice", "pickle.load", "numpy.array", "numpy.random.seed" ]
[((19, 39), 'numpy.random.seed', 'np.random.seed', (['(9453)'], {}), '(9453)\n', (33, 39), True, 'import numpy as np\n'), ((152, 166), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (163, 166), False, 'import pickle\n'), ((243, 318), 'numpy.random.choice', 'np.random.choice', (['[3, 5, 10, 15, 20]'], {'size': '(4)...
import numpy as np import torch import torch.nn as nn from ....ops.iou3d_nms import iou3d_nms_utils class CenterTargetLayer(nn.Module): def __init__(self, roi_sampler_cfg): super().__init__() self.roi_sampler_cfg = roi_sampler_cfg def forward(self, batch_dict): """ Args: ...
[ "numpy.random.rand", "torch.from_numpy", "torch.min", "torch.cat", "numpy.round", "numpy.random.permutation" ]
[((6891, 6927), 'torch.cat', 'torch.cat', (['(fg_inds, bg_inds)'], {'dim': '(0)'}), '((fg_inds, bg_inds), dim=0)\n', (6900, 6927), False, 'import torch\n'), ((4881, 4957), 'numpy.round', 'np.round', (['(self.roi_sampler_cfg.FG_RATIO * self.roi_sampler_cfg.ROI_PER_IMAGE)'], {}), '(self.roi_sampler_cfg.FG_RATIO * self.ro...
#!/usr/bin/env python # coding: utf-8 import numpy as np import os from astropy.table import Table, vstack from collections import OrderedDict ## Import some helper functions, you can see their definitions by uncomenting the bash shell command from desispec.workflow.exptable import default_obstypes_for_exptable fr...
[ "astropy.table.Table", "desispec.io.util.create_camword", "desiutil.log.get_logger", "numpy.array", "numpy.ndarray", "desispec.workflow.utils.pathjoin", "desispec.workflow.exptable.default_obstypes_for_exptable", "desispec.workflow.utils.define_variable_from_environment", "desispec.io.util.differenc...
[((8941, 9040), 'desispec.workflow.utils.define_variable_from_environment', 'define_variable_from_environment', ([], {'env_name': '"""DESI_SPECTRO_REDUX"""', 'var_descr': '"""The specprod path"""'}), "(env_name='DESI_SPECTRO_REDUX', var_descr=\n 'The specprod path')\n", (8973, 9040), False, 'from desispec.workflow.u...
# -*- coding: utf-8 -*- # # Copyright 2018-2020 Data61, CSIRO # # 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 applicabl...
[ "stellargraph.layer.graphsage.AttentionalAggregator", "pytest.approx", "numpy.ones_like", "stellargraph.layer.graphsage.MaxPoolingAggregator", "tensorflow.keras.activations.get", "tensorflow.keras.models.model_from_json", "tensorflow.keras.initializers.ones", "stellargraph.layer.graphsage.MeanAggregat...
[((1173, 1190), 'stellargraph.layer.graphsage.MeanAggregator', 'MeanAggregator', (['(2)'], {}), '(2)\n', (1187, 1190), False, 'from stellargraph.layer.graphsage import GraphSAGE, MeanAggregator, MaxPoolingAggregator, MeanPoolingAggregator, AttentionalAggregator\n'), ((1454, 1514), 'stellargraph.layer.graphsage.MeanAggr...
####################################################################### # Copyright (C) # # 2018 <NAME> (<EMAIL>) # # Permission given to modify the code as long as you keep this # # declaration at the top ...
[ "matplotlib.use", "numpy.argmax", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((577, 600), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (591, 600), False, 'import matplotlib\n'), ((1001, 1019), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (1013, 1019), True, 'import matplotlib.pyplot as plt\n'), ((1041, 1069), 'numpy.linspace', 'np...
import torch import numpy as np from ialgebra.utils.utils_data import preprocess_fn from ialgebra.utils.utils_interpreter import resize_postfn, generate_map device = 'cuda' if torch.cuda.is_available() else 'cpu' class Interpreter(object): def __init__(self, pretrained_model=None, dataset=None, target_layer=None...
[ "torch.tensor", "torch.cuda.is_available", "numpy.concatenate" ]
[((177, 202), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (200, 202), False, 'import torch\n'), ((1758, 1797), 'numpy.concatenate', 'np.concatenate', (['interpreter_map'], {'axis': '(0)'}), '(interpreter_map, axis=0)\n', (1772, 1797), True, 'import numpy as np\n'), ((1827, 1869), 'numpy.conc...
#!/usr/bin/env python import os from copy import deepcopy import numpy as np from numpy.testing import assert_array_equal import gippy as gp import unittest import gippy.test as gpt class GeoImageTests(unittest.TestCase): prefix = 'test-' def setUp(self): """ Configure options """ gp.Option...
[ "os.path.exists", "gippy.test.get_test_image", "gippy.Options.set_chunksize", "gippy.GeoImage", "numpy.array", "numpy.zeros", "gippy.GeoImage.create", "gippy.Options.set_verbose", "copy.deepcopy", "numpy.testing.assert_array_equal", "os.remove" ]
[((311, 336), 'gippy.Options.set_verbose', 'gp.Options.set_verbose', (['(1)'], {}), '(1)\n', (333, 336), True, 'import gippy as gp\n'), ((345, 374), 'gippy.Options.set_chunksize', 'gp.Options.set_chunksize', (['(4.0)'], {}), '(4.0)\n', (369, 374), True, 'import gippy as gp\n'), ((455, 475), 'gippy.test.get_test_image',...
import random import re import sys sys.path.append("../../") import pandas as pd import numpy as np from demo import * # just utility so we don't clobber original dataframe def cp(d): return df.copy() def code(db_node): return db.get_code(db_node) def run(db_node): func = db.get_executable(db_node) ...
[ "pandas.read_csv", "numpy.random.choice", "pdb.post_mortem", "random.seed", "numpy.random.seed", "sys.path.append" ]
[((35, 60), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (50, 60), False, 'import sys\n'), ((661, 712), 'pandas.read_csv', 'pd.read_csv', (['"""../../demo-data/loan.csv"""'], {'nrows': '(1000)'}), "('../../demo-data/loan.csv', nrows=1000)\n", (672, 712), True, 'import pandas as pd\n'), ...
import torch, mmcv import torch.nn as nn from mmcv.cnn import normal_init, kaiming_init from mmdet.core import distance2bbox, bbox_overlaps, force_fp32, multi_apply, multiclass_nms, multiclass_nms_idx from mmdet.ops import ConvModule, Scale from ..builder import build_loss from ..registry import HEADS from ..utils imp...
[ "mmdet.ops.CropSplit", "mmcv.cnn.kaiming_init", "torch.nn.ReLU", "torch.nn.Sequential", "mmdet.ops.CropSplitGt", "torch.sqrt", "numpy.array", "mmdet.core.bbox_overlaps", "torch.sum", "torch.nn.functional.interpolate", "mmdet.ops.DeformConv", "torch.arange", "torch.nn.GroupNorm", "mmcv.imre...
[((535, 613), 'torch.cat', 'torch.cat', (['((boxes[:, 2:] + boxes[:, :2]) / 2, boxes[:, 2:] - boxes[:, :2])', '(1)'], {}), '(((boxes[:, 2:] + boxes[:, :2]) / 2, boxes[:, 2:] - boxes[:, :2]), 1)\n', (544, 613), False, 'import torch, mmcv\n'), ((2503, 2536), 'torch.clamp', 'torch.clamp', (['x1'], {'min': '(0)', 'max': '(...
from typing import Optional, Any from functools import lru_cache import numpy as np from .form import Form, FormDict from ..basis import Basis from skfem.generic_utils import HashableNdArray class BilinearForm(Form): """A bilinear form for finite element assembly. Bilinear forms are defined using functions...
[ "functools.lru_cache", "skfem.generic_utils.HashableNdArray", "numpy.zeros_like", "numpy.zeros" ]
[((3913, 3935), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(128)'}), '(maxsize=128)\n', (3922, 3935), False, 'from functools import lru_cache\n'), ((2522, 2548), 'skfem.generic_utils.HashableNdArray', 'HashableNdArray', (['ubasis.dx'], {}), '(ubasis.dx)\n', (2537, 2548), False, 'from skfem.generic_utils impo...
""" Module for shapefile resampling methods. This code was originailly developed by <NAME>. (https://github.com/basaks) See `uncoverml.scripts.shiftmap_cli` for a resampling CLI. """ import tempfile import os from os.path import abspath, exists, splitext from os import remove import logging import geopandas as gpd im...
[ "logging.getLogger", "numpy.ones", "numpy.unique", "geopandas.read_file", "pandas.core.reshape.tile._bins_to_cuts", "numpy.max", "geopandas.GeoDataFrame", "numpy.linspace", "shapely.geometry.Polygon", "numpy.min", "pandas.concat", "numpy.random.RandomState", "numpy.random.shuffle" ]
[((603, 630), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (620, 630), False, 'import logging\n'), ((3840, 3932), 'pandas.core.reshape.tile._bins_to_cuts', 'pd.core.reshape.tile._bins_to_cuts', (['target', 'bin_edges'], {'labels': '(False)', 'include_lowest': '(True)'}), '(target, bin_e...
from sorted_nearest import makewindows from sorted_nearest import maketiles import numpy as np def _windows(df, kwargs): window_size = kwargs["window_size"] idxs, starts, ends = makewindows(df.index.values, df.Start.values, df.End.values, window_size) df = df.reind...
[ "numpy.maximum", "sorted_nearest.makewindows", "numpy.minimum", "sorted_nearest.maketiles" ]
[((191, 264), 'sorted_nearest.makewindows', 'makewindows', (['df.index.values', 'df.Start.values', 'df.End.values', 'window_size'], {}), '(df.index.values, df.Start.values, df.End.values, window_size)\n', (202, 264), False, 'from sorted_nearest import makewindows\n'), ((852, 923), 'sorted_nearest.maketiles', 'maketiles...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from collections import Counter from maskrcnn_benchmark.layers.misc import Conv2d from maskrcnn_benchmark.layers import FrozenBatchNorm2d class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, se...
[ "torch.nn.ReLU", "torch.nn.Sequential", "maskrcnn_benchmark.layers.misc.Conv2d", "torch.nn.functional.avg_pool2d", "torch.nn.functional.relu6", "collections.Counter", "torch.nn.Conv2d", "numpy.array", "torch.nn.Linear", "maskrcnn_benchmark.layers.FrozenBatchNorm2d", "torch.nn.ReLU6" ]
[((3386, 3408), 'torch.nn.ReLU6', 'nn.ReLU6', ([], {'inplace': '(True)'}), '(inplace=True)\n', (3394, 3408), True, 'import torch.nn as nn\n'), ((4489, 4505), 'collections.Counter', 'Counter', (['indices'], {}), '(indices)\n', (4496, 4505), False, 'from collections import Counter\n'), ((408, 438), 'torch.nn.functional.r...
import os import sys import unittest import numpy from os.path import join as pjn import QENSmodels # resolve path to reference_data this_module_path = sys.modules[__name__].__file__ data_dir = pjn(os.path.dirname(this_module_path), 'reference_data') class TestChudleyElliotDiffusion(unittest.TestCase): """ Test...
[ "numpy.testing.assert_array_almost_equal", "numpy.ones", "QENSmodels.hwhmChudleyElliotDiffusion", "os.path.join", "os.path.dirname", "numpy.zeros", "unittest.main", "numpy.arange", "QENSmodels.sqwChudleyElliotDiffusion" ]
[((200, 233), 'os.path.dirname', 'os.path.dirname', (['this_module_path'], {}), '(this_module_path)\n', (215, 233), False, 'import os\n'), ((4830, 4845), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4843, 4845), False, 'import unittest\n'), ((886, 928), 'QENSmodels.hwhmChudleyElliotDiffusion', 'QENSmodels.hwhmC...
""" https://github.com/google/microscopeimagequality/blob/main/microscopeimagequality/prediction.py """ import logging import sys import numpy import tensorflow import cytokit.miq.constants import cytokit.miq.evaluation # logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) _SPLIT_NAME = 'test' _TFRECORD_F...
[ "logging.getLogger", "tensorflow.Graph", "tensorflow.shape", "numpy.ones", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.train.Saver", "numpy.zeros", "tensorflow.constant", "numpy.expand_dims", "tensorflow.reshape", "tensorflow.expand_dims", "logging.info", "tensorflow.zeros"...
[((376, 403), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (393, 403), False, 'import logging\n'), ((6530, 6632), 'numpy.zeros', 'numpy.zeros', (['(patches_per_column * patch_width, patches_per_row * patch_width)'], {'dtype': 'numpy.uint16'}), '((patches_per_column * patch_width, patche...
# Tensorflow is not supported on Python 3.8. I used Python 3.7 to write this program. # Packages to pip install: tensorflow (using 2.1.0), numpy, pillow, tkinter import numpy as np import tensorflow as tf from PIL import Image from tensorflow.keras.models import load_model, model_from_json from tkinter.filedial...
[ "numpy.array", "PIL.Image.open", "tensorflow.keras.models.load_model", "tkinter.filedialog.askopenfilename" ]
[((459, 475), 'tensorflow.keras.models.load_model', 'load_model', (['root'], {}), '(root)\n', (469, 475), False, 'from tensorflow.keras.models import load_model, model_from_json\n'), ((707, 718), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (715, 718), True, 'import numpy as np\n'), ((745, 762), 'tkinter.filedialog...
import os import pytrec_eval import numpy as np from capreolus.utils.loginit import get_logger from capreolus.searcher import Searcher logger = get_logger(__name__) VALID_METRICS = {"P", "map", "map_cut", "ndcg_cut", "Rprec", "recip_rank", "set_recall"} CUT_POINTS = [5, 10, 15, 20, 30, 100, 200, 500, 1000] def _v...
[ "os.listdir", "capreolus.utils.loginit.get_logger", "os.path.join", "numpy.array", "capreolus.searcher.Searcher.load_trec_run" ]
[((147, 167), 'capreolus.utils.loginit.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'from capreolus.utils.loginit import get_logger\n'), ((2958, 2989), 'capreolus.searcher.Searcher.load_trec_run', 'Searcher.load_trec_run', (['runfile'], {}), '(runfile)\n', (2980, 2989), False, 'from...
from qcodes.instrument.base import Instrument from qcodes.utils import validators as vals from qcodes.instrument.parameter import ManualParameter import numpy as np class SimControlCZ_v2(Instrument): """ Noise and other parameters for cz_superoperator_simulation_v2 Created for VCZ simulation """ ...
[ "qcodes.utils.validators.Numbers", "qcodes.utils.validators.Callable", "qcodes.utils.validators.Strings", "qcodes.utils.validators.Arrays", "numpy.array", "qcodes.utils.validators.Bool" ]
[((630, 644), 'qcodes.utils.validators.Numbers', 'vals.Numbers', ([], {}), '()\n', (642, 644), True, 'from qcodes.utils import validators as vals\n'), ((896, 910), 'qcodes.utils.validators.Numbers', 'vals.Numbers', ([], {}), '()\n', (908, 910), True, 'from qcodes.utils import validators as vals\n'), ((1162, 1176), 'qco...
''' Extensions to Numpy, including finding array elements and smoothing data. Highlights: - ``sc.findinds()``: find indices of an array matching a condition - ``sc.findnearest()``: find nearest matching value - ``sc.smooth()``: simple smoothing of 1D or 2D arrays - ``sc.smoothinterp()``: linear interpo...
[ "numpy.convolve", "numpy.random.rand", "numpy.argsort", "numpy.array", "numpy.isfinite", "numpy.arange", "numpy.random.random", "numpy.exp", "numpy.linspace", "numpy.concatenate", "pandas.DataFrame", "warnings.warn", "numpy.ones", "numpy.isnan", "numpy.nonzero", "numpy.interp", "nump...
[((1438, 1474), 'numpy.isclose', 'np.isclose', ([], {'a': 'val1', 'b': 'val2'}), '(a=val1, b=val2, **kwargs)\n', (1448, 1474), True, 'import numpy as np\n'), ((7550, 7565), 'numpy.zeros', 'np.zeros', (['nrows'], {}), '(nrows)\n', (7558, 7565), True, 'import numpy as np\n'), ((8681, 8723), 'numpy.intersect1d', 'np.inter...
import os import numpy as np from stompy.spatial import field datadir=os.path.join( os.path.dirname(__file__), 'data') #depth_bin_file = '/home/rusty/classes/research/spatialdata/us/ca/suntans/bathymetry/compiled2/final.bin' def test_xyz(): depth_bin_file = os.path.join(datadir,'depth.xyz') f = field.XYZT...
[ "stompy.spatial.field.XYZText", "numpy.allclose", "os.path.join", "os.path.dirname", "numpy.array", "stompy.spatial.field.XYZField" ]
[((87, 112), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'import os\n'), ((267, 301), 'os.path.join', 'os.path.join', (['datadir', '"""depth.xyz"""'], {}), "(datadir, 'depth.xyz')\n", (279, 301), False, 'import os\n'), ((310, 345), 'stompy.spatial.field.XYZText', 'field....
import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import kornia from codes.models.resnet import resnet18 import matplotlib from codes.models.region_proposal_network import RegionProposalNetwork import cv2 from codes.EX_CONST import Const import matplotlib.pyplot as plt mat...
[ "codes.models.region_proposal_network.RegionProposalNetwork", "torch.from_numpy", "torch.pow", "numpy.array", "torch.nn.functional.interpolate", "numpy.arange", "numpy.delete", "numpy.exp", "numpy.round", "kornia.vflip", "numpy.ones", "matplotlib.use", "torch.norm", "torch.cuda.empty_cache...
[((317, 338), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (331, 338), False, 'import matplotlib\n'), ((5343, 5387), 'cv2.applyColorMap', 'cv2.applyColorMap', (['feature', 'cv2.COLORMAP_JET'], {}), '(feature, cv2.COLORMAP_JET)\n', (5360, 5387), False, 'import cv2\n'), ((5455, 5489), 'cv2.imwrit...
from ..transformers.series_to_tabular import RandomIntervalSegmenter from ..utils.testing import generate_df_from_array from ..utils.transformations import tabularize import pytest import pandas as pd import numpy as np N_ITER = 10 # Test output format and dimensions. def test_output_format_dim(): for n_cols in ...
[ "numpy.random.normal", "pytest.raises", "numpy.ones" ]
[((1155, 1180), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(10)'}), '(size=10)\n', (1171, 1180), True, 'import numpy as np\n'), ((967, 992), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (980, 992), False, 'import pytest\n'), ((503, 517), 'numpy.ones', 'np.ones', (['n_obs'], {...
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import matplotlib.pyplot as plt import numpy as np import glob import os from matplotlib import rcParams rcParams['font.family'] = 'sans-serif' rcParams['font.sans-serif'] = ['Hiragino Maru Gothic Pro', 'Yu Gothic', 'Meirio', 'Takao', 'IPAexGothic',...
[ "matplotlib.pyplot.grid", "pandas.read_csv", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.fill_between", "numpy.argsort", "pandas.to_datetime", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.ylim", "glob.glob", "numpy.eye", "matplotlib.pyplot.savefig", "numpy.ones"...
[((764, 794), 'glob.glob', 'glob.glob', (['"""data_hospital/x_*"""'], {}), "('data_hospital/x_*')\n", (773, 794), False, 'import glob\n'), ((1050, 1104), 'pandas.read_csv', 'pd.read_csv', (['"""data_Kokudo/w_distance.csv"""'], {'index_col': '(0)'}), "('data_Kokudo/w_distance.csv', index_col=0)\n", (1061, 1104), True, '...
import tensorflow as tf import numpy as np import tools.processing as pre text = pre.get_text("data/ref_text2.txt") sentences = text.replace("\n", ";") vocab = pre.Vocabulary(sentences) embedding_dimension = 3 word2index_map = {} index = 0 # for sent in sentences: # for word in sent.lower().split(): # i...
[ "tools.processing.Vocabulary", "tensorflow.reset_default_graph", "tensorflow.get_variable", "tensorflow.Session", "tensorflow.train.Saver", "tools.processing.get_text", "numpy.argsort", "numpy.dot", "tensorflow.name_scope", "tensorflow.square" ]
[((82, 116), 'tools.processing.get_text', 'pre.get_text', (['"""data/ref_text2.txt"""'], {}), "('data/ref_text2.txt')\n", (94, 116), True, 'import tools.processing as pre\n'), ((161, 186), 'tools.processing.Vocabulary', 'pre.Vocabulary', (['sentences'], {}), '(sentences)\n', (175, 186), True, 'import tools.processing a...
import numpy as np from specklepy.utils.box import Box class SubWindow(Box): @classmethod def from_str(cls, s=None, full=None, order='yx'): # Create full box window if no string provided if s is None: return cls(indexes=None) # Unravel coordinates from string in...
[ "numpy.where", "numpy.array" ]
[((565, 602), 'numpy.where', 'np.where', (['(indexes == 0)', 'None', 'indexes'], {}), '(indexes == 0, None, indexes)\n', (573, 602), True, 'import numpy as np\n'), ((1194, 1232), 'numpy.array', 'np.array', (['[x_min, x_max, y_min, y_max]'], {}), '([x_min, x_max, y_min, y_max])\n', (1202, 1232), True, 'import numpy as n...