code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import qctests.AOML_gradient import util.testingProfile import numpy def test_AOML_gradient_boundaries(): ''' Test critical values in AOML check unphysical giant numbers to avoid some floating point errors ''' p = util.testingProfile.fakeProfile([500000,400000,299999], [100000,200000,300000]) ...
[ "numpy.array_equal", "numpy.zeros" ]
[((374, 400), 'numpy.zeros', 'numpy.zeros', (['(3)'], {'dtype': 'bool'}), '(3, dtype=bool)\n', (385, 400), False, 'import numpy\n'), ((452, 480), 'numpy.array_equal', 'numpy.array_equal', (['qc', 'truth'], {}), '(qc, truth)\n', (469, 480), False, 'import numpy\n'), ((699, 725), 'numpy.zeros', 'numpy.zeros', (['(3)'], {...
try: import cplex except: from solver import * import sys import numpy as np from utils import * from lp_encoding import * import copy epsilon=1.0/(255) def negate(dnn, act_inst, test, nc_layer, nc_pos, base_constraints): var_names=copy.copy(base_constraints.var_names) var_names_vect=copy.copy(base_constrai...
[ "cplex.Cplex", "numpy.zeros", "copy.copy", "numpy.unravel_index", "sys.exit" ]
[((242, 279), 'copy.copy', 'copy.copy', (['base_constraints.var_names'], {}), '(base_constraints.var_names)\n', (251, 279), False, 'import copy\n'), ((297, 330), 'copy.copy', 'copy.copy', (['base_constraints.names'], {}), '(base_constraints.names)\n', (306, 330), False, 'import copy\n'), ((343, 374), 'copy.copy', 'copy...
'''This module contains functions that will be used in riverbuilder project.''' import numpy as np import math from random import random import random as rd import copy def modx(array): '''Return an array is in range [0, 2*pi]''' xmin = np.amin(array) xmax = np.amax(array) xlen = xmax-xmin return ...
[ "numpy.amin", "numpy.sin", "numpy.arange", "numpy.linalg.norm", "numpy.append", "math.cos", "numpy.random.shuffle", "numpy.stack", "numpy.vectorize", "math.sqrt", "numpy.square", "numpy.cross", "math.sin", "random.random", "numpy.cos", "numpy.dot", "numpy.amax", "numpy.array", "n...
[((247, 261), 'numpy.amin', 'np.amin', (['array'], {}), '(array)\n', (254, 261), True, 'import numpy as np\n'), ((273, 287), 'numpy.amax', 'np.amax', (['array'], {}), '(array)\n', (280, 287), True, 'import numpy as np\n'), ((1212, 1226), 'numpy.amax', 'np.amax', (['array'], {}), '(array)\n', (1219, 1226), True, 'import...
from enum import Enum import numpy as np class Direction(Enum): UP = 1 RIGHT = 2 DOWN = -1 LEFT = -2 @classmethod def get_directions(cls): return (Direction.UP, Direction.RIGHT, Direction.DOWN, Direction.LEFT) def get_opposite(self):...
[ "numpy.pad", "numpy.array2string", "numpy.random.choice" ]
[((1949, 1974), 'numpy.random.choice', 'np.random.choice', (['options'], {}), '(options)\n', (1965, 1974), True, 'import numpy as np\n'), ((2356, 2441), 'numpy.array2string', 'np.array2string', (['grid'], {'formatter': "{'int': lambda x: ' ' if x == 0 else f'{x:2d}'}"}), "(grid, formatter={'int': lambda x: ' ' if x =...
# Plot image to screen import cv2 import numpy import matplotlib from xarray.core.dataarray import DataArray from plotnine.ggplot import ggplot from plantcv.plantcv import params from plantcv.plantcv.classes import PSII_data from matplotlib import pyplot as plt from plantcv.plantcv import fatal_error from plantcv.plant...
[ "plantcv.plantcv._show_dataarray._show_dataarray", "matplotlib.pyplot.show", "cv2.cvtColor", "matplotlib.pyplot.imshow", "numpy.shape", "matplotlib.pyplot.figure", "plantcv.plantcv.fatal_error" ]
[((640, 656), 'numpy.shape', 'numpy.shape', (['img'], {}), '(img)\n', (651, 656), False, 'import numpy\n'), ((877, 889), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (887, 889), True, 'from matplotlib import pyplot as plt\n'), ((963, 973), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (971, 973...
# Copyright 2020 The TensorStore Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "compute_percentiles.compute_percentiles", "reshard_tensor.reshard_tensor_xy2xt", "numpy.testing.assert_array_equal", "numpy.min", "numpy.max", "numpy.arange", "numpy.reshape", "reshard_tensor.reshard_tensor_xt2xy", "compute_percentiles.get_window", "tensorstore.open", "numpy.testing.assert_arra...
[((1284, 1311), 'os.path.join', 'os.path.join', (['tmp_path', '"""a"""'], {}), "(tmp_path, 'a')\n", (1296, 1311), False, 'import os\n'), ((1328, 1355), 'os.path.join', 'os.path.join', (['tmp_path', '"""b"""'], {}), "(tmp_path, 'b')\n", (1340, 1355), False, 'import os\n'), ((1387, 1399), 'numpy.prod', 'np.prod', (['dim'...
#coding=utf-8 import cv2 import numpy as np import matplotlib.pyplot as plt import serial import time serialPort="COM5" baudRate=115200 ser=serial.Serial(serialPort, baudRate, timeout=1) time.sleep(1) MicaPic = cv2.imread("../img/w1.png") croppedsrc = MicaPic[371:463, 0:512] cv2.imshow('cr',croppedsrc) cv2.imwrite("c...
[ "numpy.ones", "numpy.shape", "matplotlib.pyplot.figure", "cv2.imshow", "serial.Serial", "cv2.line", "cv2.cvtColor", "cv2.imwrite", "matplotlib.pyplot.imshow", "cv2.convertScaleAbs", "cv2.destroyAllWindows", "cv2.Laplacian", "cv2.bitwise_not", "matplotlib.pyplot.show", "cv2.waitKey", "c...
[((141, 187), 'serial.Serial', 'serial.Serial', (['serialPort', 'baudRate'], {'timeout': '(1)'}), '(serialPort, baudRate, timeout=1)\n', (154, 187), False, 'import serial\n'), ((188, 201), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (198, 201), False, 'import time\n'), ((213, 240), 'cv2.imread', 'cv2.imread', (...
import numpy as np import matplotlib.pyplot as plt import utils import copy import torch import torchvision.transforms as transforms import torchvision.datasets as datasets import torch.utils.data as td import logging import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="0" loggi...
[ "numpy.load", "logging.getLogger", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "torch.utils.data.DataLoader", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "os.path.exists", "copy.deepcopy", "matplotlib.pyplot.legend", "torch.max", "matplotlib.pyplot...
[((624, 699), 'torch.utils.data.DataLoader', 'td.DataLoader', (['cifar_test'], {'batch_size': '(10000)', 'shuffle': '(False)', 'pin_memory': '(True)'}), '(cifar_test, batch_size=10000, shuffle=False, pin_memory=True)\n', (637, 699), True, 'import torch.utils.data as td\n'), ((879, 920), 'numpy.load', 'np.load', (["(dat...
""" Write some fixed size examples in a tfrecord, then read them one at the time or in batch (all the tensors have the same shape, so this is ok) Run from the top folder as: python3 -m tests.batching.test_write_read_fixed """ import unittest import numpy as np import tensorflow as tf from dataset.shared import dir_t...
[ "unittest.main", "tensorflow.train.Coordinator", "tensorflow.global_variables_initializer", "tensorflow.reshape", "tensorflow.Session", "tensorflow.train.start_queue_runners", "tensorflow.local_variables_initializer", "numpy.random.random", "numpy.array", "numpy.arange", "tensorflow.FixedLenFeat...
[((3447, 3462), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3460, 3462), False, 'import unittest\n'), ((517, 565), 'numpy.array', 'np.array', (['[4, 8, 15, 16, 23, 42]'], {'dtype': 'np.int64'}), '([4, 8, 15, 16, 23, 42], dtype=np.int64)\n', (525, 565), True, 'import numpy as np\n'), ((588, 628), 'numpy.array',...
import sys import numpy as np from PyQt5 import QtWidgets from PyQt5.QtCore import pyqtSlot, pyqtSignal, QRunnable, QThreadPool, QObject from ui_files.ui_SeabreezeGui import Ui_MainWindow from seabreeze.spectrometers import Spectrometer, SeaBreezeError import time import os from datetime import datetime import pyqtgrap...
[ "PyQt5.QtCore.pyqtSignal", "PyQt5.QtCore.pyqtSlot", "PyQt5.QtWidgets.QFileDialog.getExistingDirectory", "qdarkstyle.load_stylesheet", "pyqtgraph.mkColor", "PyQt5.QtCore.QThreadPool", "numpy.zeros", "time.time", "numpy.array", "seabreeze.spectrometers.Spectrometer.from_serial_number", "pyqtgraph....
[((508, 530), 'pyqtgraph.mkColor', 'pg.mkColor', (['(25)', '(35)', '(45)'], {}), '(25, 35, 45)\n', (518, 530), True, 'import pyqtgraph as pg\n'), ((579, 591), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (589, 591), False, 'from PyQt5.QtCore import pyqtSlot, pyqtSignal, QRunnable, QThreadPool, QObject\n')...
import numpy as np from blueprint import datasets, estimators, plot_utils if __name__ == '__main__': # set random number generator seed np.random.seed(0) # set floating point formatting when printing np.set_printoptions(formatter = {'float': '{:.5f}'.format}) # load data dataset = datasets.tsne_2d x...
[ "numpy.set_printoptions", "numpy.random.seed", "blueprint.plot_utils.scatter", "blueprint.estimators.KMeans" ]
[((143, 160), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (157, 160), True, 'import numpy as np\n'), ((212, 269), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'formatter': "{'float': '{:.5f}'.format}"}), "(formatter={'float': '{:.5f}'.format})\n", (231, 269), True, 'import numpy as np\n'), ...
import numpy as np import pymesh from math import sqrt import csv def compute_vertices_to_mesh_distances(groundtruth_vertices, grundtruth_landmark_points, predicted_mesh_vertices, predicted_mesh_faces, predicted_mesh_landmark_points, out_fi...
[ "csv.reader", "csv.writer", "math.sqrt", "numpy.zeros", "numpy.linalg.svd", "numpy.linalg.norm", "numpy.array", "numpy.linalg.det", "numpy.dot", "pymesh.distance_to_mesh", "numpy.sqrt" ]
[((2345, 2384), 'numpy.array', 'np.array', (['grundtruth_landmark_points[4]'], {}), '(grundtruth_landmark_points[4])\n', (2353, 2384), True, 'import numpy as np\n'), ((2778, 2819), 'numpy.linalg.norm', 'np.linalg.norm', (['(nose_bridge - nose_bottom)'], {}), '(nose_bridge - nose_bottom)\n', (2792, 2819), True, 'import ...
import datetime import pandas as pd import numpy as np from bokeh.models import ColumnDataSource def get_work_df(): """ Takes a gtimelog DataFrame, and removes the non-work categories """ gt_df = _get_raw_df() gt_df = gt_df[~gt_df.activity.str.contains(r'\*\*\*')] return gt_df def get_proce...
[ "bokeh.models.ColumnDataSource", "datetime.datetime.today", "datetime.datetime", "numpy.where", "pandas.to_datetime", "datetime.timedelta", "pandas.read_table" ]
[((457, 487), 'datetime.datetime', 'datetime.datetime', (['(2015)', '(7)', '(10)'], {}), '(2015, 7, 10)\n', (474, 487), False, 'import datetime\n'), ((1042, 1072), 'datetime.datetime', 'datetime.datetime', (['(2015)', '(7)', '(10)'], {}), '(2015, 7, 10)\n', (1059, 1072), False, 'import datetime\n'), ((1777, 1802), 'dat...
import os import numpy as np import torch import torch.utils.model_zoo as model_zoo from sklearn.metrics import accuracy_score from torch.autograd import Variable from torch.optim import lr_scheduler import mlp from data_reader import BatchImageGenerator from utils import sgd, crossentropyloss, fix_seed, write_log, c...
[ "torch.optim.lr_scheduler.StepLR", "numpy.argmax", "utils.write_log", "numpy.mean", "data_reader.BatchImageGenerator", "utils.compute_accuracy", "os.path.join", "torch.utils.model_zoo.load_url", "torch.load", "os.path.exists", "utils.fix_seed", "torch.autograd.Variable", "numpy.all", "nump...
[((502, 512), 'utils.fix_seed', 'fix_seed', ([], {}), '()\n', (510, 512), False, 'from utils import sgd, crossentropyloss, fix_seed, write_log, compute_accuracy\n'), ((607, 645), 'mlp.Net', 'mlp.Net', ([], {'num_classes': 'flags.num_classes'}), '(num_classes=flags.num_classes)\n', (614, 645), False, 'import mlp\n'), ((...
import c3py # import the python interface to the c3 library import numpy as np import matplotlib.pyplot as plt np.random.seed(10) def func(x): return x[:, 0]**2 + x[:, 1]**2 + x[:, 0] * x[:, 1] + np.sin(np.sum(x, axis=1)) \ + x[:,0] * x[:,-1] + x[:, -1]**2.0 * np.cos(x[:, 0]) LB = -1.0 ...
[ "numpy.random.seed", "numpy.sum", "numpy.linalg.norm", "numpy.cos", "numpy.random.rand", "c3py.FunctionTrain" ]
[((112, 130), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (126, 130), True, 'import numpy as np\n'), ((503, 528), 'numpy.random.rand', 'np.random.rand', (['Ntrain', '(2)'], {}), '(Ntrain, 2)\n', (517, 528), True, 'import numpy as np\n'), ((563, 587), 'numpy.random.rand', 'np.random.rand', (['Ntest'...
import numpy as np import pandas as pd class BitrodeData: """ Bitrode discharge data. Parameters ---------- path : str Path to Bitrode discharge data file. Attributes ---------- time : dataframe series Time from experimental data [s] current : dataframe series ...
[ "pandas.read_csv", "numpy.where" ]
[((993, 1023), 'pandas.read_csv', 'pd.read_csv', (['path'], {'header': 'None'}), '(path, header=None)\n', (1004, 1023), True, 'import pandas as pd\n'), ((1127, 1150), 'numpy.where', 'np.where', (["(df[14] == 'S')"], {}), "(df[14] == 'S')\n", (1135, 1150), True, 'import numpy as np\n')]
from __future__ import division import numpy as np # linear algebra import pandas as pd import seaborn as sns from sklearn.utils import shuffle from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn import ...
[ "logging.basicConfig", "pandas.read_csv", "sklearn.model_selection.train_test_split", "logging.StreamHandler", "logging.info", "numpy.array", "sklearn.svm.SVC", "sklearn.metrics.confusion_matrix" ]
[((525, 631), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'format': 'FORMAT', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%I"""'}), "(stream=sys.stdout, format=FORMAT, level=logging.INFO,\n datefmt='%Y-%m-%d %H:%M:%I')\n", (544, 631), False, 'import logging, sys\n'), ((637,...
import numpy as np import pandas as pd import sys import click from os.path import join from tqdm import tqdm from GIData import GIData from GIData.utils import sparsity ''' The file contains the complete SGA genetic interaction dataset in a tab-delimited format with columns: [ 'Query Strain ID', 'Query a...
[ "GIData.utils.sparsity", "numpy.argmax", "pandas.read_csv", "numpy.asarray", "click.option", "numpy.isnan", "click.command", "numpy.max", "re.compile" ]
[((2809, 2824), 'click.command', 'click.command', ([], {}), '()\n', (2822, 2824), False, 'import click\n'), ((2826, 2861), 'click.option', 'click.option', (['"""-i"""', '"""--input"""', '"""fp"""'], {}), "('-i', '--input', 'fp')\n", (2838, 2861), False, 'import click\n'), ((2863, 2891), 'click.option', 'click.option', ...
import pickle import re from pathlib import Path import nltk import numpy as np import pandas as pd from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer from nltk.tokenize import TweetTokenizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train...
[ "sklearn.feature_extraction.text.CountVectorizer", "nltk.stem.RSLPStemmer", "sklearn.model_selection.train_test_split", "nltk.stem.porter.PorterStemmer", "nltk.tokenize.TweetTokenizer", "pathlib.Path", "numpy.array", "nltk.corpus.stopwords.words", "nltk.download", "re.sub" ]
[((333, 354), 'nltk.download', 'nltk.download', (['"""rslp"""'], {}), "('rslp')\n", (346, 354), False, 'import nltk\n'), ((355, 381), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (368, 381), False, 'import nltk\n'), ((394, 430), 'pathlib.Path', 'Path', (['"""model"""', '"""finalized_m...
#!/usr/bin/env python import os import pickle import tensorflow as tf import torch import numpy as np import tf_util import gym import load_policy import torch.optim as optim import torch.nn as nn import torch.nn.functional as F def load_data(filename): with open(filename, 'rb') as f: return pickle.loads(f...
[ "torch.nn.MSELoss", "torch.nn.ReLU", "argparse.ArgumentParser", "torch.save", "numpy.shape", "torch.nn.Linear", "numpy.squeeze", "torch.from_numpy" ]
[((901, 926), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (924, 926), False, 'import argparse\n'), ((1539, 1584), 'torch.from_numpy', 'torch.from_numpy', (["expert_data['observations']"], {}), "(expert_data['observations'])\n", (1555, 1584), False, 'import torch\n'), ((1655, 1695), 'torch.fr...
#!/usr/bin/env python """A reimplementation of the 50-layer MSRA residual net.""" # pylint: disable=wrong-import-position, invalid-name, no-member import logging as _logging import cv2 as _cv2 import numpy as _np import barrista.design as _ds _LOGGER = _logging.getLogger() _netspec = _ds.NetSpecification([[128, 3, ...
[ "barrista.design.SoftmaxWithLossLayer", "barrista.design.ReLULayer", "logging.basicConfig", "barrista.design.BatchNormLayer", "barrista.design.SoftmaxLayer", "cv2.imwrite", "numpy.zeros", "barrista.design.PoolingLayer", "barrista.design.NetSpecification", "barrista.design.AccuracyLayer", "barris...
[((256, 276), 'logging.getLogger', '_logging.getLogger', ([], {}), '()\n', (274, 276), True, 'import logging as _logging\n'), ((289, 433), 'barrista.design.NetSpecification', '_ds.NetSpecification', (['[[128, 3, 32, 32], [128]]'], {'inputs': "['data', 'labels']", 'predict_inputs': "['data']", 'predict_input_shapes': '[...
""" nc_info.py Support routines for georef netCDF routines """ import os import netCDF4 import datetime as dt import numpy as np def write_simple_netCDF_file(nc_fname, overwrite=False): """An example of writing a simply-referenced netCDF file Sample panoply settings: Stereographic -160E 63...
[ "netCDF4.Dataset", "os.remove", "numpy.subtract", "netCDF4.date2num", "numpy.zeros", "datetime.datetime", "os.path.isfile", "numpy.array", "datetime.timedelta", "numpy.linspace", "numpy.add" ]
[((713, 1235), 'numpy.array', 'np.array', (['[[254, 254, 254, 254, 253, 173, 155, 139, 133, 142], [254, 254, 254, 254, \n 253, 162, 141, 138, 145, 152], [254, 254, 254, 254, 254, 253, 141, 143,\n 151, 150], [254, 254, 254, 254, 254, 253, 153, 149, 154, 154], [254, \n 254, 254, 254, 253, 160, 142, 144, 153, 154...
# coding: utf-8 """ Fast coordinate transformation from Galactocentric to Heliocentric """ from __future__ import division, print_function __author__ = "adrn <<EMAIL>>" # Standard library import os, sys # Third-party import numpy as np from astropy import log as logger import astropy.units as u import astropy.coor...
[ "numpy.random.uniform", "gary.coordinates.hel_to_gal_xyz", "numpy.allclose", "gary.coordinates.gal_xyz_to_hel", "numpy.random.normal", "astropy.units.dimensionless_angles" ]
[((947, 1037), 'gary.coordinates.hel_to_gal_xyz', 'sc.hel_to_gal_xyz', (['(l, b, d)'], {'pm': '(mul, mub)', 'vr': 'vr', 'vlsr': '([0.0, 0.0, 0.0] * u.km / u.s)'}), '((l, b, d), pm=(mul, mub), vr=vr, vlsr=[0.0, 0.0, 0.0] * u\n .km / u.s)\n', (964, 1037), True, 'import gary.coordinates as sc\n'), ((1517, 1535), 'numpy...
""" Copyright (c) 2011, 2012, Regents of the University of California 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 l...
[ "numpy.ones", "numpy.prod", "numpy.array", "uuid.UUID", "smap.ops.grouping.GroupByTimeOperator.__init__", "numpy.convolve", "smap.operators.Operator.__init__", "smap.operators.ParallelSimpleOperator.__init__", "numpy.vstack", "re.compile" ]
[((1916, 1945), 'numpy.array', 'np.array', (['inputs'], {'dtype': 'float'}), '(inputs, dtype=float)\n', (1924, 1945), True, 'import numpy as np\n'), ((2429, 2458), 'numpy.array', 'np.array', (['inputs'], {'dtype': 'float'}), '(inputs, dtype=float)\n', (2437, 2458), True, 'import numpy as np\n'), ((2470, 2495), 'numpy.v...
from collections import defaultdict from pprint import pprint from typing import Dict, List from dataclasses import dataclass import numpy as np import torch from tqdm import tqdm from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, AutoConfig, T5ForConditionalGeneration, ) fr...
[ "transformers.AutoConfig.from_pretrained", "numpy.vectorize", "numpy.zeros", "transformers.T5ForConditionalGeneration.from_pretrained", "collections.defaultdict", "transformers.AutoTokenizer.from_pretrained", "numpy.argsort", "numpy.max", "numpy.logical_or", "transformers.AutoModelForSequenceClass...
[((2225, 2248), 'numpy.vectorize', 'np.vectorize', (['idx2label'], {}), '(idx2label)\n', (2237, 2248), True, 'import numpy as np\n'), ((2320, 2367), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['pretrained_model'], {}), '(pretrained_model)\n', (2349, 2367), False, 'from transformers ...
import numpy as np def gendata(n=10000,d=1): return 4+2*np.random.random(size=(n,d))
[ "numpy.random.random" ]
[((66, 95), 'numpy.random.random', 'np.random.random', ([], {'size': '(n, d)'}), '(size=(n, d))\n', (82, 95), True, 'import numpy as np\n')]
import numpy as np from fnc_chrono_spatial_modelling import (find_clusters) from fnc_common import (get_unique_2d) def generate_production_area_maps(solutions, raster_shape, neighbours, production_areas): # generates raster maps of production areas around habitation areas # inputs: # solutions[si, i, pi] = True/F...
[ "numpy.array", "fnc_chrono_spatial_modelling.find_clusters", "numpy.where", "numpy.zeros" ]
[((828, 882), 'numpy.zeros', 'np.zeros', (['(phases_n, raster_shape[0], raster_shape[1])'], {}), '((phases_n, raster_shape[0], raster_shape[1]))\n', (836, 882), True, 'import numpy as np\n'), ((1056, 1087), 'fnc_chrono_spatial_modelling.find_clusters', 'find_clusters', (['idxs', 'neighbours'], {}), '(idxs, neighbours)\...
from pprint import pprint import time import torch import torch.nn as nn from layers import SimpleLSTMEncoderLayer, SimpleLSTMDecoderLayer class LSTMEncoderDecoder(nn.Module): def __init__(self, w2i, i2w, embedding_dim, encoder_hidden_dim, decoder_hidden_dim, encoder_n_layers, decoder_n_layers, encoder_drop...
[ "torch.load", "torch.nn.CrossEntropyLoss", "torch.randn", "time.time", "torch.save", "torch.cuda.is_available", "numpy.array", "torch.zeros", "torch.no_grad" ]
[((1031, 1056), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1054, 1056), False, 'import torch\n'), ((1407, 1447), 'torch.randn', 'torch.randn', (['(3)', '(2)', '(2)'], {'requires_grad': '(True)'}), '(3, 2, 2, requires_grad=True)\n', (1418, 1447), False, 'import torch\n'), ((2097, 2118), 'to...
from __future__ import print_function import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.autograd import Variable import numpy as np import torch.nn.functional as F import sys sys.path.append("./expansion_penalty/") import expansion_penalty_module as expansion sys.path.append...
[ "sys.path.append", "torch.mean", "torch.ones", "torch.nn.ReLU", "torch.nn.Tanh", "torch.nn.Conv1d", "torch.nn.BatchNorm1d", "torch.cat", "MDS_module.gather_operation", "expansion_penalty_module.expansionPenaltyModule", "torch.max", "numpy.array", "torch.nn.Linear", "torch.zeros" ]
[((220, 259), 'sys.path.append', 'sys.path.append', (['"""./expansion_penalty/"""'], {}), "('./expansion_penalty/')\n", (235, 259), False, 'import sys\n'), ((305, 330), 'sys.path.append', 'sys.path.append', (['"""./MDS/"""'], {}), "('./MDS/')\n", (320, 330), False, 'import sys\n'), ((513, 538), 'torch.nn.Conv1d', 'torc...
import os import numpy as np import matplotlib import matplotlib.pyplot as plt save_path = os.path.abspath("../images") def compute_metadata_accuracies(Y_hat, Y, metadata): correct = (np.argmax(Y_hat, axis=1) == np.argmax(Y, axis=1)) * 1 accuracies = {i: 0 for i in metadata} counts = {i: 0 for i in met...
[ "matplotlib.pyplot.tight_layout", "os.path.abspath", "os.makedirs", "os.path.join", "numpy.argmax", "numpy.std", "matplotlib.rcParams.update", "os.path.exists", "numpy.mean", "numpy.linspace", "matplotlib.pyplot.subplots", "numpy.unique" ]
[((94, 122), 'os.path.abspath', 'os.path.abspath', (['"""../images"""'], {}), "('../images')\n", (109, 122), False, 'import os\n'), ((606, 625), 'numpy.unique', 'np.unique', (['metadata'], {}), '(metadata)\n', (615, 625), True, 'import numpy as np\n'), ((1083, 1104), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(1...
import codecs import re from collections import defaultdict from random import choice, random import numpy as np def edit_distance(str1, str2): """Simple Levenshtein implementation for evalm.""" table = np.zeros([len(str2) + 1, len(str1) + 1]) for i in range(1, len(str2) + 1): table[i][0] = table...
[ "numpy.flip", "codecs.open", "re.split", "numpy.argsort", "numpy.argpartition" ]
[((2607, 2626), 'numpy.flip', 'np.flip', (['indices', '(0)'], {}), '(indices, 0)\n', (2614, 2626), True, 'import numpy as np\n'), ((1065, 1100), 'codecs.open', 'codecs.open', (['filename', '"""r"""', '"""utf-8"""'], {}), "(filename, 'r', 'utf-8')\n", (1076, 1100), False, 'import codecs\n'), ((1455, 1490), 'codecs.open'...
"""Align given rasters to given bounding box and projection.""" import logging import multiprocessing import os import re import shutil import sys from osgeo import gdal from osgeo import osr from pygeoprocessing.geoprocessing import _create_latitude_m2_area_column import ecoshard import numpy import pygeoprocessing i...
[ "os.makedirs", "logging.basicConfig", "pygeoprocessing.warp_raster", "numpy.copy", "numpy.empty", "os.path.basename", "numpy.ones", "pygeoprocessing.raster_calculator", "osgeo.gdal.SetCacheMax", "multiprocessing.cpu_count", "numpy.isclose", "shutil.copyfile", "ecoshard.hash_file", "pygeopr...
[((337, 362), 'osgeo.gdal.SetCacheMax', 'gdal.SetCacheMax', (['(2 ** 27)'], {}), '(2 ** 27)\n', (353, 362), False, 'from osgeo import gdal\n'), ((362, 536), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s (%(relativeCreated)d) %(levelname)s %(name)s [%(funcName)s:...
#!/usr/bin/env python import os import pickle import numpy as np from skimage.transform import resize from cropLettersFromImage import getWords DataDirectory = "./DataSet/" Categories = os.listdir(DataDirectory) filename = "finalized_model.sav" try: loaded_model = pickle.load(open(filename, "rb")) except: p...
[ "numpy.array", "cropLettersFromImage.getWords", "skimage.transform.resize", "os.listdir" ]
[((189, 214), 'os.listdir', 'os.listdir', (['DataDirectory'], {}), '(DataDirectory)\n', (199, 214), False, 'import os\n'), ((435, 452), 'cropLettersFromImage.getWords', 'getWords', (['Captcha'], {}), '(Captcha)\n', (443, 452), False, 'from cropLettersFromImage import getWords\n'), ((539, 565), 'skimage.transform.resize...
import numpy as np import dpmm from test_utils import timer @timer def test_GaussianMeanKnownVariance(): """Test broadcasting rules for GaussianMeanKnownVariance prior.""" # Test sample() method: prior = dpmm.GaussianMeanKnownVariance(1.0, 1.0, 1.0) arr = prior.sample() assert isinstance(arr, floa...
[ "numpy.eye", "dpmm.GaussianMeanKnownVariance", "numpy.ndenumerate", "numpy.testing.assert_raises", "dpmm.NormInvGamma", "dpmm.NormInvWish", "numpy.empty", "numpy.zeros", "dpmm.InvGamma", "numpy.array", "numpy.arange", "dpmm.NormInvChi2" ]
[((218, 263), 'dpmm.GaussianMeanKnownVariance', 'dpmm.GaussianMeanKnownVariance', (['(1.0)', '(1.0)', '(1.0)'], {}), '(1.0, 1.0, 1.0)\n', (248, 263), False, 'import dpmm\n'), ((899, 944), 'dpmm.GaussianMeanKnownVariance', 'dpmm.GaussianMeanKnownVariance', (['(1.0)', '(1.0)', '(1.0)'], {}), '(1.0, 1.0, 1.0)\n', (929, 94...
""" File: examples/nonlinear/sampler.py Author: <NAME> Date: 24 Mar 2018 Description: Example showing a simple use case of the Sampler class to sample a GaussianLoglikelihood object using the 'fisher_update' restart_mode. """ import os import numpy as np import matplotlib.pyplot as pl from di...
[ "distpy.JumpingDistributionSet", "pylinex.GaussianModel", "os.remove", "numpy.random.seed", "matplotlib.pyplot.show", "numpy.ones_like", "distpy.GaussianJumpingDistribution", "distpy.InfiniteUniformDistribution", "pylinex.BurnRule", "distpy.DistributionSet", "matplotlib.pyplot.figure", "pyline...
[((593, 613), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (607, 613), True, 'import numpy as np\n'), ((882, 916), 'numpy.linspace', 'np.linspace', (['(99)', '(101)', 'num_channels'], {}), '(99, 101, num_channels)\n', (893, 916), True, 'import numpy as np\n'), ((970, 993), 'pylinex.GaussianModel',...
import sys import os from io import StringIO from pkg_resources import resource_filename from textwrap import dedent from tempfile import TemporaryDirectory from unittest import mock import pytest from wqio.tests import helpers import numpy from matplotlib import pyplot from pybmpdb import summary ...
[ "textwrap.dedent", "io.StringIO", "tempfile.TemporaryDirectory", "unittest.mock.Mock", "pytest.fixture", "pkg_resources.resource_filename", "numpy.array", "wqio.tests.helpers.assert_bigstring_equal", "pybmpdb.summary.DatasetSummary", "os.path.join" ]
[((337, 366), 'unittest.mock.Mock', 'mock.Mock', ([], {'spec': 'pyplot.Figure'}), '(spec=pyplot.Figure)\n', (346, 366), False, 'from unittest import mock\n'), ((2320, 2407), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[(True, True), (True, False), (False, False), (False, True)]'}), '(params=[(True, True), (Tru...
# coding:utf-8 import os import gc import importlib import numpy as np import pandas as pd import tensorflow as tf from tqdm import tqdm from scipy.special import logit, expit from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import LabelEncoder from sklearn.metrics import roc_auc_score np...
[ "tensorflow.random.set_seed", "tensorflow.py_function", "tqdm.tqdm", "numpy.random.seed", "os.path.join", "importlib.import_module", "numpy.zeros", "sklearn.preprocessing.LabelEncoder", "scipy.special.expit", "gc.collect", "scipy.special.logit", "sklearn.model_selection.StratifiedKFold", "te...
[((318, 335), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (332, 335), True, 'import numpy as np\n'), ((336, 357), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(7)'], {}), '(7)\n', (354, 357), True, 'import tensorflow as tf\n'), ((358, 388), 'pandas.set_option', 'pd.set_option', (['"""max_ro...
#from quantumbomb import state_probability from explodingquantumbomb import succes_probability from matplotlib import pyplot as plt import numpy as np if __name__ == '__main__': error_range = [0.01, 0.05, 0.1, 0.2 , 0.3] xdata_list = np.zeros((5,25)) ydata_list = np.zeros((5,25)) for i in range(len(e...
[ "explodingquantumbomb.succes_probability", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((245, 262), 'numpy.zeros', 'np.zeros', (['(5, 25)'], {}), '((5, 25))\n', (253, 262), True, 'import numpy as np\n'), ((279, 296), 'numpy.zeros', 'np.zeros', (['(5, 25)'], {}), '((5, 25))\n', (287, 296), True, 'import numpy as np\n'), ((667, 704), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""probability measuring 0"...
""" Connect to the FPGA inside of this file """ import os import EggNet import EggNet.Reader import numpy as np BASE_DIR = os.path.dirname(os.path.abspath(__file__)) TRAIN_IMAGES = os.path.join(BASE_DIR, '../train-images-idx3-ubyte.gz') TRAIN_LABELS = os.path.join(BASE_DIR, '../train-labels-idx1-ubyte.gz') TEST_IMAG...
[ "psutil.virtual_memory", "os.path.join", "psutil.cpu_count", "os.path.abspath", "psutil.swap_memory", "psutil.net_io_counters", "platform.uname", "socket.gethostname", "datetime.timedelta", "numpy.reshape", "EggNet.FpiLeNet.init_npz", "datetime.datetime.fromtimestamp", "psutil.net_if_addrs",...
[((184, 239), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""../train-images-idx3-ubyte.gz"""'], {}), "(BASE_DIR, '../train-images-idx3-ubyte.gz')\n", (196, 239), False, 'import os\n'), ((255, 310), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""../train-labels-idx1-ubyte.gz"""'], {}), "(BASE_DIR, '../train-label...
""" Author: <NAME> 2020-04-27 Data preprocessing pipeline. Separated from model implementation and training. """ import os import time from pdb import set_trace as BP import numpy as np import pandas as pd import tools # local import def processing_main(): ''' Main wrapper of the input pipe. Steps: 1....
[ "pandas.DataFrame", "numpy.sum", "os.getcwd", "pandas.get_dummies", "tools.process_url", "tools.get_time_schema", "time.time", "tools.scale_trends", "tools.apply_processing_transformations" ]
[((805, 816), 'time.time', 'time.time', ([], {}), '()\n', (814, 816), False, 'import time\n'), ((1199, 1222), 'pandas.DataFrame', 'pd.DataFrame', (['page_vars'], {}), '(page_vars)\n', (1211, 1222), True, 'import pandas as pd\n'), ((1352, 1377), 'pandas.get_dummies', 'pd.get_dummies', (['page_vars'], {}), '(page_vars)\n...
#!/usr/bin/python2.5 # # Copyright 2014 <NAME>. # # Author: <NAME> (<EMAIL>) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # t...
[ "numpy.arange", "numpy.exp", "numpy.linspace", "numpy.sign", "numpy.cos", "numpy.log10", "numpy.round" ]
[((3139, 3176), 'numpy.linspace', 'numpy.linspace', (['(1.0 / 4096)', '(1.0)', '(1025)'], {}), '(1.0 / 4096, 1.0, 1025)\n', (3153, 3176), False, 'import numpy\n'), ((3609, 3636), 'numpy.exp', 'numpy.exp', (['(-8.0 * (1.0 - x))'], {}), '(-8.0 * (1.0 - x))\n', (3618, 3636), False, 'import numpy\n'), ((2148, 2171), 'numpy...
# Modelo preditivo de classificaçãp para prever o valor de uma variável binária (true ou false) a partir de dados numéricos # Exercício desenvolvido no curso Formação Cientista de Dados (https://www.datascienceacademy.com.br/pages/formacao-cientista-de-dados) # LinkedIn: https://www.linkedin.com/in/carlos-carvalho-9320...
[ "pandas.DataFrame", "numpy.random.seed", "warnings.filterwarnings", "sklearn.linear_model.LogisticRegression", "numpy.random.random", "sklearn.decomposition.PCA", "numpy.random.randint", "sklearn.pipeline.Pipeline" ]
[((531, 564), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (554, 564), False, 'import warnings\n'), ((597, 614), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (611, 614), True, 'import numpy as np\n'), ((995, 1012), 'numpy.random.seed', 'np.random.seed',...
import torch import collections import random import numpy as np import pickle import json import sys import os from tqdm import tqdm, trange from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from torch.utils.data.distributed import DistributedSampler curPath = os.path.abspath(o...
[ "pickle.dump", "fine_tuning_based_on_bert.span_utils._check_is_max_context", "numpy.random.seed", "pytorch_pretrained_bert.optimization.BertAdam", "torch.utils.data.RandomSampler", "pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained", "json.dumps", "torch.cuda.device_count", "collect...
[((383, 408), 'sys.path.append', 'sys.path.append', (['rootPath'], {}), '(rootPath)\n', (398, 408), False, 'import sys\n'), ((21935, 22020), 'collections.namedtuple', 'collections.namedtuple', (['"""RawResult"""', "['unique_id', 'start_logits', 'end_logits']"], {}), "('RawResult', ['unique_id', 'start_logits', 'end_log...
"""Contains classes for computing and reporting evaluation metrics.""" from collections import defaultdict import os from tqdm import tqdm from scipy.stats import spearmanr, pearsonr import numpy as np import json import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns sns.set(...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.xlim", "seaborn.heatmap", "os.path.join", "matplotlib.pyplot.clf", "matplotlib.pyplot.ylim", "scipy.stats.spearmanr", "matplotlib.pyplot.yticks", "numpy.argmin", "collections.defaultdict", "matplotlib.pyplot.text",...
[((243, 257), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (250, 257), True, 'import matplotlib as mpl\n'), ((312, 337), 'seaborn.set', 'sns.set', ([], {'style': '"""darkgrid"""'}), "(style='darkgrid')\n", (319, 337), True, 'import seaborn as sns\n'), ((17386, 17407), 'numpy.argmin', 'np.argmin', (['p...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import sys # Usage plot_filter_size_dist.py acc_len_taxid.txt [nodes.dmp] points=100 overlap_len=300 max_fp=0.05 hash_functions=3 kmer_size=19 max_size=0 #0 for default (1.5x min), in MB rank="species" def parse_input(file): colu...
[ "matplotlib.pyplot.show", "numpy.amin", "math.ceil", "numpy.geomspace", "math.floor", "numpy.percentile", "pandas.read_table", "matplotlib.pyplot.subplots", "sys.exit" ]
[((2270, 2320), 'numpy.geomspace', 'np.geomspace', (['min_bin_len', 'max_bin_len'], {'num': 'points'}), '(min_bin_len, max_bin_len, num=points)\n', (2282, 2320), True, 'import numpy as np\n'), ((4407, 4417), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4415, 4417), True, 'import matplotlib.pyplot as plt\n')...
import cv2 as cv from spatialmath import base from ansitable import ANSITable, Column from machinevisiontoolbox.base import color_bgr import matplotlib.pyplot as plt import numpy as np from spatialmath import base def plot_box(ax=None, bbox=None, bl=None, tl=None, br=None, tr=None, wh=None, centre=None, ...
[ "cv2.putText", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.gca", "machinevisiontoolbox.Image", "cv2.getTextSize", "numpy.zeros", "matplotlib.pyplot.Rectangle", "matplotlib.pyplot.draw", "matplotlib.pyplot.text", "machinevisiontoolbox.idisp", "numpy.random.randint", ...
[((2951, 3075), 'matplotlib.pyplot.Rectangle', 'plt.Rectangle', (['xy', 'w', 'h'], {'edgecolor': 'color', 'facecolor': 'fillcolor', 'fill': 'fill', 'alpha': 'alpha', 'linewidth': 'thickness', 'clip_on': '(True)'}), '(xy, w, h, edgecolor=color, facecolor=fillcolor, fill=fill,\n alpha=alpha, linewidth=thickness, clip_...
import numpy as np from math import log from openrec.legacy.utils.evaluators import Evaluator class NDCG(Evaluator): def __init__(self, ndcg_at, name='NDCG'): self._ndcg_at = np.array(ndcg_at) super(NDCG, self).__init__(etype='rank', name=name) def compute(self, rank_above, negative...
[ "math.log", "numpy.array" ]
[((198, 215), 'numpy.array', 'np.array', (['ndcg_at'], {}), '(ndcg_at)\n', (206, 215), True, 'import numpy as np\n'), ((453, 466), 'math.log', 'log', (['(i + 2)', '(2)'], {}), '(i + 2, 2)\n', (456, 466), False, 'from math import log\n'), ((574, 587), 'math.log', 'log', (['(r + 2)', '(2)'], {}), '(r + 2, 2)\n', (577, 58...
import numpy as np import os from os.path import isfile from os.path import join import json import helper import torch import torchvision import torch.nn.functional as F from torchvision import datasets, transforms, models import matplotlib.pyplot as plt import random from torch.utils.data import DataLoader from...
[ "json.load", "random.randint", "input_args.args_input", "torch.load", "PIL.Image.open", "torch.exp", "numpy.array", "torch.cuda.is_available", "torch.device", "torchvision.models.vgg16", "torch.no_grad", "os.path.join", "os.listdir" ]
[((541, 553), 'input_args.args_input', 'args_input', ([], {}), '()\n', (551, 553), False, 'from input_args import args_input\n'), ((883, 905), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (897, 905), False, 'import random\n'), ((1261, 1306), 'torch.load', 'torch.load', (["(filepath + '/' + ...
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
[ "torch.topk", "argparse.ArgumentParser", "numpy.ones", "torch.nn.functional.softmax", "torch.nn.Linear", "torch.sum" ]
[((4801, 4850), 'torch.nn.Linear', 'nn.Linear', (['self.latent_size', '(self.latent_size * 2)'], {}), '(self.latent_size, self.latent_size * 2)\n', (4810, 4850), False, 'from torch import nn\n'), ((4879, 4924), 'torch.nn.Linear', 'nn.Linear', (['(self.latent_size * 2)', 'self.seq_len'], {}), '(self.latent_size * 2, sel...
from pepper.framework.backend.abstract.microphone import AbstractMicrophone from pepper.framework.infra.event.api import EventBus from pepper.framework.infra.resource.api import ResourceManager import pyaudio import numpy as np class SystemMicrophone(AbstractMicrophone): """ System Microphone Parameters...
[ "numpy.frombuffer", "pyaudio.PyAudio" ]
[((777, 794), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (792, 794), False, 'import pyaudio\n'), ((1175, 1207), 'numpy.frombuffer', 'np.frombuffer', (['in_data', 'np.int16'], {}), '(in_data, np.int16)\n', (1188, 1207), True, 'import numpy as np\n')]
################## # Convolve several PDFs/CDFs together. ################## import os import sys import math import pdb import numpy as np from numpy.random import uniform from numpy import convolve, cumsum, histogram, linspace import matplotlib.pyplot as plt def pdf(dir_mcmc, dir_out, N_jackknife, prefix, N_burn): ...
[ "matplotlib.pyplot.figure", "numpy.histogram" ]
[((594, 620), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 7)'}), '(figsize=(8, 7))\n', (604, 620), True, 'import matplotlib.pyplot as plt\n'), ((525, 555), 'numpy.histogram', 'histogram', (['i[1][:, 4]'], {'bins': '(50)'}), '(i[1][:, 4], bins=50)\n', (534, 555), False, 'from numpy import convolve, c...
""" Codes for gas, oil, and water PVT correlations @author: <NAME> @email: <EMAIL> """ """ GAS """ def gas_pseudoprops(temp, pressure, sg, x_h2s, x_co2): """ Calculate Gas Pseudo-critical and Pseudo-reduced Pressure and Temperature * Pseudo-critical properties For range: 0.57 < sg < 1.68 (Sutton, 1985) ...
[ "numpy.log", "scipy.optimize.fsolve", "numpy.exp" ]
[((2431, 2448), 'scipy.optimize.fsolve', 'fsolve', (['f', '[1, 1]'], {}), '(f, [1, 1])\n', (2437, 2448), False, 'from scipy.optimize import fsolve\n'), ((10324, 10339), 'numpy.exp', 'np.exp', (['ln_coil'], {}), '(ln_coil)\n', (10330, 10339), True, 'import numpy as np\n'), ((4100, 4127), 'numpy.exp', 'np.exp', (['(x * r...
import os import sys import torch import numpy as np from glob import glob from torch.utils.data import Dataset from src.io.psee_loader import PSEELoader class PseeDataset(Dataset): def __init__(self, root, transform=None): self.paths = glob(os.path.join(root, "**/*.dat"), recursive=True) self.n...
[ "numpy.pad", "numpy.stack", "src.io.psee_loader.PSEELoader", "os.path.dirname", "torch.as_tensor", "os.path.join" ]
[((1745, 1769), 'torch.as_tensor', 'torch.as_tensor', (['lengths'], {}), '(lengths)\n', (1760, 1769), False, 'import torch\n'), ((1783, 1806), 'torch.as_tensor', 'torch.as_tensor', (['labels'], {}), '(labels)\n', (1798, 1806), False, 'import torch\n'), ((723, 739), 'src.io.psee_loader.PSEELoader', 'PSEELoader', (['path...
import torch import torch.nn as nn from torch.autograd import Variable import torch.utils.data as Data from torch.autograd import Variable import matplotlib.pyplot as plt import numpy as np import os import torch.nn.functional as F from prettytable import PrettyTable import time timePoint1 = time.time() p...
[ "torch.nn.MSELoss", "torch.nn.ReLU", "torch.utils.data.DataLoader", "torch.autograd.Variable", "torch.load", "torch.nn.Conv1d", "numpy.zeros", "time.time", "torch.save", "torch.nn.Linear", "numpy.array", "torch.utils.data.TensorDataset", "numpy.loadtxt", "prettytable.PrettyTable", "os.li...
[((306, 317), 'time.time', 'time.time', ([], {}), '()\n', (315, 317), False, 'import time\n'), ((2053, 2065), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2063, 2065), True, 'import torch.nn as nn\n'), ((2179, 2199), 'os.listdir', 'os.listdir', (['trainDIR'], {}), '(trainDIR)\n', (2189, 2199), False, 'import os...
import numpy as np from grid2op.dtypes import dt_float from grid2op.Reward import BaseReward class FlowLimitAndBlackoutReward(BaseReward): def __init__(self): BaseReward.__init__(self) def initialize(self, env): self.reward_min = dt_float(-env.backend.n_line) self.reward_max = dt_float...
[ "numpy.divide", "grid2op.Reward.BaseReward.__init__", "grid2op.dtypes.dt_float", "numpy.sign" ]
[((172, 197), 'grid2op.Reward.BaseReward.__init__', 'BaseReward.__init__', (['self'], {}), '(self)\n', (191, 197), False, 'from grid2op.Reward import BaseReward\n'), ((256, 285), 'grid2op.dtypes.dt_float', 'dt_float', (['(-env.backend.n_line)'], {}), '(-env.backend.n_line)\n', (264, 285), False, 'from grid2op.dtypes im...
import os from chatbot_agent.agent import PipelineAgent from chatbot_agent.session import BiSession from chatbot_agent.evaluator.multiwoz_eval import MultiWozEvaluator from pprint import pprint import random import numpy as np import torch import matplotlib.pyplot as plt from chatbot_agent.reporter import Reporter from...
[ "matplotlib.pyplot.title", "os.mkdir", "numpy.random.seed", "chatbot_agent.reporter.Reporter", "matplotlib.pyplot.bar", "logging.getLogger", "matplotlib.pyplot.figure", "chatbot_agent.evaluator.multiwoz_eval.MultiWozEvaluator", "numpy.mean", "pprint.pprint", "matplotlib.pyplot.tick_params", "o...
[((1141, 1168), 'pprint.pprint', 'pprint', (['sess.evaluator.goal'], {}), '(sess.evaluator.goal)\n', (1147, 1168), False, 'from pprint import pprint\n'), ((2184, 2211), 'pprint.pprint', 'pprint', (['sess.evaluator.goal'], {}), '(sess.evaluator.goal)\n', (2190, 2211), False, 'from pprint import pprint\n'), ((2743, 2763)...
"""Abstract Sampling for Abstract Mixture Models Implements an abstract MCMC sampler for an abstract Mixture Model. Support is natively provided for standard Gibbs Sampling following Algorithm 3 (Neal, 2000), split merge samplers (Jain & Neal, 2004) and all combinations of these two methods. Notes ----- Use by provid...
[ "numpy.zeros", "bmcc.core.update_mixture", "bmcc.core.count_clusters", "bmcc.core.update_components", "bmcc.core.inspect_mixture" ]
[((4566, 4631), 'numpy.zeros', 'np.zeros', (['(self.__BASE_HIST_SIZE, data.shape[0])'], {'dtype': 'np.uint16'}), '((self.__BASE_HIST_SIZE, data.shape[0]), dtype=np.uint16)\n', (4574, 4631), True, 'import numpy as np\n'), ((6243, 6271), 'bmcc.core.count_clusters', 'count_clusters', (['self.__model'], {}), '(self.__model...
from numpy import sin def comp_surface(self): """Compute the Slot total surface (by analytical computation). Caution, the top of the Slot is an Arc Parameters ---------- self : SlotDC A SlotDC object Returns ------- S: float Slot total surface [m**2] """ [ ...
[ "numpy.sin" ]
[((799, 809), 'numpy.sin', 'sin', (['alpha'], {}), '(alpha)\n', (802, 809), False, 'from numpy import sin\n')]
""" Pre-processor for images Includes: - Light-related algorithms: light estimation and normalization - Depth normalization algorithms: matrix and depth image. - Auxiliaries """ import math import numpy as np from file_manager import Picture_Manager from file_manager import Sample_Manager from file...
[ "cv2.resize", "cv2.equalizeHist", "cv2.GaussianBlur", "numpy.uint8", "cv2.medianBlur", "cv2.cvtColor", "file_manager.Sample_Manager", "file_manager.Picture_Manager", "cv2.fastNlMeansDenoising", "numpy.vstack", "cv2.mean", "cv2.pow" ]
[((384, 401), 'file_manager.Picture_Manager', 'Picture_Manager', ([], {}), '()\n', (399, 401), False, 'from file_manager import Picture_Manager\n'), ((416, 432), 'file_manager.Sample_Manager', 'Sample_Manager', ([], {}), '()\n', (430, 432), False, 'from file_manager import Sample_Manager\n'), ((462, 479), 'file_manager...
from typing import Dict, Optional, Union, cast import numpy as np import pandas as pd from fseval.pipeline.estimator import Estimator from fseval.types import AbstractEstimator, AbstractMetric, Callback class UploadFeatureImportances(AbstractMetric): def _build_table(self, feature_vector: np.ndarray): "...
[ "typing.cast", "numpy.asarray", "pandas.DataFrame" ]
[((1775, 1806), 'numpy.asarray', 'np.asarray', (['feature_importances'], {}), '(feature_importances)\n', (1785, 1806), True, 'import numpy as np\n'), ((2912, 2935), 'typing.cast', 'cast', (['Estimator', 'ranker'], {}), '(Estimator, ranker)\n', (2916, 2935), False, 'from typing import Dict, Optional, Union, cast\n'), ((...
''' Adapted from <NAME> Re-created with numpy by <NAME> ''' import numpy as np import random import pandas as pd def feature_type(data): threshold = 10 listdata = [] datatype = [] for i in range(len(data[0]) -1): row = list(data[:,i]) number_of_diff_data = len(set(row)) listdata.append(number_of_diff_data) ...
[ "numpy.sum", "random.randint", "numpy.concatenate", "numpy.argmax", "random.sample", "pandas.read_csv", "numpy.random.randint", "numpy.unique" ]
[((503, 526), 'random.randint', 'random.randint', (['(0)', '(9999)'], {}), '(0, 9999)\n', (517, 526), False, 'import random\n'), ((668, 714), 'random.sample', 'random.sample', ([], {'population': 'indices', 'k': 'test_size'}), '(population=indices, k=test_size)\n', (681, 714), False, 'import random\n'), ((1372, 1394), ...
# import Python packages import json import os from typing import List # import third party packages from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks import httpx import numpy import pandas import plotly import plotly.express as px from sqlalchemy import select, and_ from sqlalchemy.future import...
[ "pandas.DataFrame", "pandas.Timestamp", "sqlalchemy.sql.func.count", "plotly.io.to_json", "sqlalchemy.and_", "sqlalchemy.select", "numpy.datetime64", "fastapi.HTTPException", "pandas.DatetimeIndex", "sqlalchemy.orm.Session", "httpx.AsyncClient", "sqlalchemy.sql.func.sum", "pandas.to_datetime...
[((711, 767), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/haveyouseenx"""', 'tags': "['haveyouseenx']"}), "(prefix='/haveyouseenx', tags=['haveyouseenx'])\n", (720, 767), False, 'from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks\n'), ((860, 880), 'fastapi.Depends', 'Depends', (['get_alch...
#!/usr/bin/env python3 import time, sys import dlib import numpy as np import cozmo # Load trained detector model detector = dlib.simple_object_detector("detector.svm") # Initialize window for results win = dlib.image_window() def displayImage(image): # Convert to numpy array img = np.array(image.raw_image) start...
[ "dlib.image_window", "cozmo.connect", "time.time", "time.sleep", "numpy.array", "dlib.simple_object_detector", "cozmo.setup_basic_logging", "sys.exit" ]
[((126, 169), 'dlib.simple_object_detector', 'dlib.simple_object_detector', (['"""detector.svm"""'], {}), "('detector.svm')\n", (153, 169), False, 'import dlib\n'), ((208, 227), 'dlib.image_window', 'dlib.image_window', ([], {}), '()\n', (225, 227), False, 'import dlib\n'), ((287, 312), 'numpy.array', 'np.array', (['im...
#!/eecs/research/asr/mingbin/python-workspace/hopeless/bin/python import numpy, argparse, logging, time, cPickle, codecs, copy from itertools import product, chain # ================================================================================ if __name__ == '__main__': logger = logging.getLogger() logg...
[ "copy.deepcopy", "argparse.ArgumentParser", "logging.basicConfig", "cPickle.load", "cPickle.dump", "numpy.arange", "logging.getLogger" ]
[((292, 311), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (309, 311), False, 'import numpy, argparse, logging, time, cPickle, codecs, copy\n'), ((316, 411), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(forma...
import numpy as np import tensorflow as tfcheck if tfcheck.__version__[0] == '2': import tensorflow.compat.v1 as tf else: import tensorflow as tf import os from sklearn.model_selection import train_test_split def STG_FS(X_in,Y_in,num_runs=10,lam=1): # print(os.environ['CUDA_VISIBLE_DEVICES']) X_in = X_in....
[ "os.mkdir", "numpy.load", "numpy.sum", "numpy.maximum", "tensorflow.clip_by_value", "numpy.argmax", "tensorflow.constant_initializer", "sklearn.model_selection.train_test_split", "numpy.empty", "tensorflow.nn.tanh", "time.strftime", "numpy.argsort", "tensorflow.matmul", "numpy.savez_compre...
[((677, 740), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X_short', 'Y_in'], {'test_size': '(0.1)', 'random_state': '(42)'}), '(X_short, Y_in, test_size=0.1, random_state=42)\n', (693, 740), False, 'from sklearn.model_selection import train_test_split\n'), ((17147, 17177), 'time.strftime', 'time....
import pickle import os import numpy as np # import librosa def get_audio_pth(dir_pth): '''针对task2或task3的一个测试组,返回其中各个音频的地址 Args: dir_pth: 例:'./dataset/task2/test/0' Returns: audio_addr: 该测试组内各个音频的地址 ''' audio_addr = [] for file_name in os.listdir(dir_pth): file_pth = ...
[ "numpy.save", "numpy.argmax", "os.path.isdir", "numpy.power", "numpy.amax", "pickle.load", "os.listdir" ]
[((280, 299), 'os.listdir', 'os.listdir', (['dir_pth'], {}), '(dir_pth)\n', (290, 299), False, 'import os\n'), ((617, 632), 'pickle.load', 'pickle.load', (['fp'], {}), '(fp)\n', (628, 632), False, 'import pickle\n'), ((754, 776), 'numpy.power', 'np.power', (['audio_all', '(2)'], {}), '(audio_all, 2)\n', (762, 776), Tru...
# coding=utf8 from torch.utils.data import Dataset, DataLoader from tqdm import tqdm from transformers import AutoTokenizer import json import torch import pytorch_lightning as pl import os class LCSTSDataset(Dataset): ''' Dataset Used for LCSTS summary task. ''' def __init__(self, data_path, args): ...
[ "tqdm.tqdm", "json.loads", "torch.utils.data.DataLoader", "transformers.AutoTokenizer.from_pretrained", "numpy.mean", "os.path.join", "torch.tensor" ]
[((372, 445), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['args.pretrained_model_path'], {'use_fast': '(False)'}), '(args.pretrained_model_path, use_fast=False)\n', (401, 445), False, 'from transformers import AutoTokenizer\n'), ((942, 953), 'tqdm.tqdm', 'tqdm', (['lines'], {}), '(l...
# -*- coding: utf-8 -*- """ Created on Sat Oct 17 11:10:12 2020 @author: ifeanyi.ezukwoke """ import os import pandas as pd import numpy as np from sklearn.cluster import KMeans from numpy.linalg import inv, det class GMM(object): '''Guassian Mixture Model Parameters: --------------...
[ "numpy.sum", "numpy.log", "numpy.abs", "numpy.argmax", "sklearn.cluster.KMeans", "numpy.zeros", "numpy.identity", "numpy.array", "numpy.linalg.inv", "numpy.dot", "numpy.linalg.det", "numpy.diagonal" ]
[((1079, 1094), 'numpy.sum', 'np.sum', (['log_lhd'], {}), '(log_lhd)\n', (1085, 1094), True, 'import numpy as np\n'), ((2725, 2759), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {'dtype': 'np.float64'}), '((n, 1), dtype=np.float64)\n', (2733, 2759), True, 'import numpy as np\n'), ((4649, 4673), 'numpy.zeros', 'np.zeros', ([...
import numpy as np from mahjong.shanten import Shanten from tqdm import tqdm from itertools import combinations_with_replacement, permutations from utils import * np.random.seed(0) shanten = Shanten() cases = [] kokusi = [0, 8, 9, 17, 18, 26, 27, 28, 29, 30, 31, 32, 33] for tile in kokusi: flatten = kokusi + [ti...
[ "mahjong.shanten.Shanten", "numpy.random.seed" ]
[((165, 182), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (179, 182), True, 'import numpy as np\n'), ((193, 202), 'mahjong.shanten.Shanten', 'Shanten', ([], {}), '()\n', (200, 202), False, 'from mahjong.shanten import Shanten\n')]
import torch from torch import nn import numpy as np from layers.baselayer import Layer class ReLuLayer(Layer): def __init__(self, in_features, out_features, bias=True, is_first=False, omega_0=30, c=6, initialization=None): super().__init__(in_features, out_features, bias, is_first, ome...
[ "torch.relu", "torch.no_grad", "torch.nn.ReLU", "numpy.sqrt" ]
[((350, 359), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (357, 359), False, 'from torch import nn\n'), ((1108, 1132), 'torch.relu', 'torch.relu', (['intermediate'], {}), '(intermediate)\n', (1118, 1132), False, 'import torch\n'), ((413, 428), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (426, 428), False, 'im...
import time import numpy as np import pybullet as pb import argparse from nuro_arm.robot.robot_arm import RobotArm def generate_waypts(): '''Generates circular path in cartesian space ''' R = 0.06 num_waypts = 100 center = np.array((0.19, 0, 0.025)) angles = np.linspace(0, 2*np.pi, num=num_way...
[ "pybullet.addUserDebugLine", "argparse.ArgumentParser", "pybullet.configureDebugVisualizer", "numpy.zeros", "pybullet.resetDebugVisualizerCamera", "time.sleep", "numpy.sin", "numpy.array", "pybullet.getDebugVisualizerCamera", "numpy.linspace", "numpy.cos", "nuro_arm.robot.robot_arm.RobotArm" ]
[((245, 271), 'numpy.array', 'np.array', (['(0.19, 0, 0.025)'], {}), '((0.19, 0, 0.025))\n', (253, 271), True, 'import numpy as np\n'), ((285, 326), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)'], {'num': 'num_waypts'}), '(0, 2 * np.pi, num=num_waypts)\n', (296, 326), True, 'import numpy as np\n'), ((561, 608...
# Copyright 2021 wngfra. # SPDX-License-Identifier: Apache-2.0 import glob import os import re import numpy as np from bidict import bidict from numpy.lib.stride_tricks import sliding_window_view from torch.utils.data import Dataset class Texture: """ Create a bidict from a texture name list.""" def __init__...
[ "numpy.load", "numpy.fft.rfft", "numpy.abs", "bidict.bidict", "scipy.signal.resample", "os.path.basename", "numpy.std", "os.walk", "numpy.mean", "re.search", "os.path.join" ]
[((372, 380), 'bidict.bidict', 'bidict', ([], {}), '()\n', (378, 380), False, 'from bidict import bidict\n'), ((1546, 1595), 'os.path.join', 'os.path.join', (['self.root_dir', 'self.filelist[index]'], {}), '(self.root_dir, self.filelist[index])\n', (1558, 1595), False, 'import os\n'), ((1615, 1632), 'numpy.load', 'np.l...
import heapq import multiprocessing as mp import random import numpy as np import torch from cogdl.datasets import build_dataset from cogdl.models import build_model from sklearn.metrics import roc_auc_score from tqdm import tqdm from . import BaseTask, register_task def recall(rank, ground_truth, N): return le...
[ "numpy.sum", "cogdl.datasets.build_dataset", "numpy.asfarray", "numpy.asarray", "heapq.nlargest", "sklearn.metrics.roc_auc_score", "numpy.mean", "numpy.array", "torch.cuda.is_available", "cogdl.models.build_model", "multiprocessing.Pool", "numpy.arange", "numpy.random.shuffle" ]
[((644, 654), 'numpy.mean', 'np.mean', (['r'], {}), '(r)\n', (651, 654), True, 'import numpy as np\n'), ((846, 859), 'numpy.asarray', 'np.asarray', (['r'], {}), '(r)\n', (856, 859), True, 'import numpy as np\n'), ((3084, 3137), 'heapq.nlargest', 'heapq.nlargest', (['K_max', 'item_score'], {'key': 'item_score.get'}), '(...
import matplotlib.pyplot as plt import numpy as np import pandas as pd import bs4 as bs import requests import yfinance as yf import datetime import io import cv2 import skimage import datetime import os.path as path from PIL import Image from pandas_datareader import data as pdr from skimage import measure from skimag...
[ "cv2.imdecode", "numpy.random.default_rng", "skimage.measure.block_reduce", "matplotlib.pyplot.figure", "numpy.arange", "pandas.DataFrame", "cv2.cvtColor", "matplotlib.pyplot.close", "numpy.max", "tempfile.mkdtemp", "numpy.reshape", "pandas.concat", "io.BytesIO", "pandas_datareader.data.ge...
[((591, 603), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (601, 603), False, 'import io\n'), ((750, 774), 'cv2.imdecode', 'cv2.imdecode', (['img_arr', '(1)'], {}), '(img_arr, 1)\n', (762, 774), False, 'import cv2\n'), ((785, 821), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BG...
#!/usr/bin/env python import numpy as np from six.moves import range from landlab import Component, CLOSED_BOUNDARY from ...utils.decorators import use_file_name_or_kwds class SoilInfiltrationGreenAmpt(Component): """Infiltrate surface water into a soil following the Green-Ampt method. This code is based ...
[ "numpy.where", "numpy.zeros", "numpy.sum", "numpy.all" ]
[((10793, 10828), 'numpy.zeros', 'np.zeros', (['self.grid.number_of_nodes'], {}), '(self.grid.number_of_nodes)\n', (10801, 10828), True, 'import numpy as np\n'), ((12004, 12056), 'numpy.where', 'np.where', (['(self._water_depth <= self.potential_infilt)'], {}), '(self._water_depth <= self.potential_infilt)\n', (12012, ...
import collections import numpy import ltron.ldraw.colors as ldraw_colors #import ltron.ldraw.paths as ldraw_paths from ltron.ldraw.parts import LDRAW_PARTS from ltron.ldraw.commands import LDrawImportCommand from ltron.ldraw.documents import ( LDrawMPDMainFile, LDrawMPDInternalFile, LDrawLDR, LDrawDA...
[ "numpy.array", "ltron.ldraw.colors.get_color_rgb" ]
[((2216, 2277), 'ltron.ldraw.colors.get_color_rgb', 'ldraw_colors.get_color_rgb', (['self.color_index', '(128, 128, 128)'], {}), '(self.color_index, (128, 128, 128))\n', (2242, 2277), True, 'import ltron.ldraw.colors as ldraw_colors\n'), ((2385, 2413), 'numpy.array', 'numpy.array', (['self.color_byte'], {}), '(self.col...
import torch import torch.nn.functional as F import torch.optim as optim from model import Model from video_dataset import Dataset from tensorboard_logger import log_value import utils import numpy as np from torch.autograd import Variable from classificationMAP import getClassificationMAP as cmAP from detect...
[ "detectionMAP.getDetectionMAP", "numpy.zeros_like", "scipy.io.loadmat", "torch.autograd.Variable", "torch.set_default_tensor_type", "numpy.shape", "utils.write_to_file", "numpy.array", "classificationMAP.getClassificationMAP", "torch.no_grad", "torch.from_numpy" ]
[((383, 438), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['"""torch.cuda.FloatTensor"""'], {}), "('torch.cuda.FloatTensor')\n", (412, 438), False, 'import torch\n'), ((1413, 1444), 'numpy.array', 'np.array', (['instance_logits_stack'], {}), '(instance_logits_stack)\n', (1421, 1444), True, 'impor...
import numpy as np from matplotlib import pyplot as plt import readwav import single_filter_analysis import integrate import figlatex nphotons = [1] length = 2000 leftmargin = 100 rep = 1 filename = 'darksidehd/nuvhd_lf_3x_tile57_77K_64V_6VoV_1.wav' ########################### data = readwav.readwav(filename, mmap=...
[ "readwav.readwav", "single_filter_analysis.single_filter_analysis", "readwav.spurious_signals", "numpy.flatnonzero", "integrate.filter", "numpy.sort", "numpy.arange", "matplotlib.pyplot.subplots" ]
[((289, 326), 'readwav.readwav', 'readwav.readwav', (['filename'], {'mmap': '(False)'}), '(filename, mmap=False)\n', (304, 326), False, 'import readwav\n'), ((488, 553), 'integrate.filter', 'integrate.filter', (['data'], {'bslen': '(8000)', 'length_ma': '(1470)', 'delta_ma': '(1530)'}), '(data, bslen=8000, length_ma=14...
#!/usr/bin/env python """ Evaluates a trained model by predicting new synthetic images and calculating the image similarity and the angle error """ import glob import logging import multiprocessing as mp import os import pickle import random import tempfile from argparse import Namespace from functools import partial...
[ "argparse.Namespace", "pickle.dump", "wormpose.commands._log_parameters", "numpy.random.seed", "argparse.ArgumentParser", "numpy.abs", "wormpose.config.experiment_config.load_config", "multiprocessing.set_start_method", "numpy.argmin", "wormpose.pose.eigenworms.theta_to_modes", "numpy.mean", "...
[((1412, 1433), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (1431, 1433), False, 'import logging\n'), ((1443, 1470), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1460, 1470), False, 'import logging\n'), ((1565, 1713), 'pickle.dump', 'pickle.dump', (["(kwargs['image_...
# # exp paddle model generator # import numpy as np from save_model import saveModel import sys def exp(name: str, x): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): node_x = paddle.static.data(name='x', shape=x.shape, dtyp...
[ "paddle.static.data", "paddle.static.cpu_places", "paddle.enable_static", "paddle.static.Program", "paddle.fluid.layers.exp", "save_model.saveModel", "paddle.static.Executor", "numpy.random.rand", "paddle.static.default_startup_program" ]
[((143, 165), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (163, 165), False, 'import paddle\n'), ((272, 330), 'paddle.static.data', 'paddle.static.data', ([], {'name': '"""x"""', 'shape': 'x.shape', 'dtype': 'x.dtype'}), "(name='x', shape=x.shape, dtype=x.dtype)\n", (290, 330), False, 'import padd...
import argparse import cv2 import glob import numpy as np import os import time # This tool is intended for evaluation of different background subtraction algorithms presented in OpenCV. # Several presets with different settings are available. You can see them below. # This tool measures quality metrics as well as sp...
[ "argparse.ArgumentParser", "os.path.basename", "os.path.isdir", "os.path.dirname", "time.time", "cv2.imread", "numpy.mean", "os.path.join", "os.listdir" ]
[((2299, 2310), 'time.time', 'time.time', ([], {}), '()\n', (2308, 2310), False, 'import time\n'), ((4531, 4646), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate all background subtractors using Change Detection 2014 dataset"""'}), "(description=\n 'Evaluate all background sub...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import copy import numpy as np from pydoc import locate from random import shuffle from crlapi.core import CLModel from f...
[ "torch.utils.data.ConcatDataset", "importlib.import_module", "torch.utils.data.DataLoader", "torch.nn.Sequential", "pydoc.locate", "torch.FloatTensor", "torch.nn.functional.cross_entropy", "numpy.mean", "torch.nn.Module.__init__", "crlapi.get_class", "torch.utils.data.random_split", "torch.nn....
[((728, 752), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (746, 752), True, 'import torch.nn as nn\n'), ((2269, 2407), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['evaluation_dataset'], {'batch_size': "evaluation_args['batch_size']", 'num_workers': "evaluation_args[...
# Server, Client # -*- coding: utf-8 -*- # 导入常用的库 from flask import Flask, jsonify, request from utils import Config, Logger, CharsetMapper import torchvision.transforms as transforms from PIL import Image import torch.nn.functional as F import numpy as np import cv2 import PIL import torch import tqdm import glob impo...
[ "utils.Config", "importlib.import_module", "torch.load", "flask.Flask", "os.path.dirname", "torch.nn.functional.softmax", "utils.CharsetMapper", "logging.info", "os.path.isfile", "time.time", "numpy.array", "flask.jsonify", "PIL.Image.open", "torch.device", "torch.tensor", "torchvision...
[((400, 415), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'from flask import Flask, jsonify, request\n'), ((2740, 2775), 'utils.Config', 'Config', (['"""configs/train_abinet.yaml"""'], {}), "('configs/train_abinet.yaml')\n", (2746, 2775), False, 'from utils import Config, Logger, Char...
# -*- coding: utf-8 -*- """ Play the game with trained weight stored in trained """ import tensorflow as tf import numpy as np import pandas as pd from copy import deepcopy import random import math import time from tkinter import * from random import randrange import helpers from game import * import tensorflow.com...
[ "tensorflow.compat.v1.nn.relu", "numpy.argmax", "tensorflow.compat.v1.placeholder", "pandas.read_csv", "tensorflow.compat.v1.constant", "tensorflow.compat.v1.concat", "numpy.zeros", "tensorflow.compat.v1.matmul", "math.log", "tensorflow.compat.v1.Session", "tensorflow.compat.v1.nn.conv2d", "te...
[((333, 357), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (355, 357), True, 'import tensorflow.compat.v1 as tf\n'), ((1789, 1799), 'tensorflow.compat.v1.Graph', 'tf.Graph', ([], {}), '()\n', (1797, 1799), True, 'import tensorflow.compat.v1 as tf\n'), ((5469, 5500), 'tensorflo...
"""Transforms for UNet. Many methods are taken from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/63974. """ __author__ = '<NAME>, <NAME>' import cv2 import random import numpy as np class PrepareImageAndMask(object): """Prepare images and masks like fixing channel numbers.""" def...
[ "numpy.random.uniform", "cv2.warpPerspective", "numpy.meshgrid", "random.uniform", "cv2.getPerspectiveTransform", "numpy.random.rand", "numpy.zeros", "cv2.copyMakeBorder", "numpy.clip", "cv2.remap", "numpy.sin", "numpy.array", "numpy.random.randint", "numpy.cos", "numpy.linspace", "num...
[((3410, 3437), 'numpy.zeros', 'np.zeros', (['width', 'np.float32'], {}), '(width, np.float32)\n', (3418, 3437), True, 'import numpy as np\n'), ((3805, 3833), 'numpy.zeros', 'np.zeros', (['height', 'np.float32'], {}), '(height, np.float32)\n', (3813, 3833), True, 'import numpy as np\n'), ((4203, 4222), 'numpy.meshgrid'...
import os import time import pdb import math import numpy as np import pybullet as p import gym from gym import error, spaces, utils from gym.utils import seeding from stable_baselines3 import DDPG from stable_baselines3.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise from stable_baselines3.ddpg.pol...
[ "stable_baselines3.common.env_checker.check_env", "numpy.zeros", "numpy.ones", "time.time", "stable_baselines3.DDPG", "gym_pybullet_drones.envs.RLCrazyFlieAviary.RLCrazyFlieAviary" ]
[((686, 727), 'gym_pybullet_drones.envs.RLCrazyFlieAviary.RLCrazyFlieAviary', 'RLCrazyFlieAviary', ([], {'gui': '(True)', 'record': '(False)'}), '(gui=True, record=False)\n', (703, 727), False, 'from gym_pybullet_drones.envs.RLCrazyFlieAviary import RLCrazyFlieAviary\n'), ((846, 895), 'stable_baselines3.common.env_chec...
# Copyright 2016-2017 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
[ "trappy.SysTrace", "numpy.isnan" ]
[((1235, 1279), 'trappy.SysTrace', 'trappy.SysTrace', (['"""trace.html"""'], {'events': 'events'}), "('trace.html', events=events)\n", (1250, 1279), False, 'import trappy\n'), ((2015, 2044), 'trappy.SysTrace', 'trappy.SysTrace', (['"""trace.html"""'], {}), "('trace.html')\n", (2030, 2044), False, 'import trappy\n'), ((...
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as ptch from network import Config # angle_1 - angle_2 # contains direction in range [-3.14, 3.14] def find_angle_diff(angle_1, angle_2): angle_diff_raw = angle_1 - angle_2 angle_diff = (angle_diff_raw + np.pi) % (2 * np.pi) - np.pi ...
[ "matplotlib.pyplot.title", "numpy.abs", "numpy.argmax", "matplotlib.pyplot.clf", "numpy.shape", "matplotlib.pyplot.figure", "numpy.sin", "matplotlib.pyplot.arrow", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.draw", "matplotlib.pyplot.pause", "matplotlib.pyplot.legend", "matplotlib.pyplo...
[((979, 1000), 'numpy.shape', 'np.shape', (['cadrl_state'], {}), '(cadrl_state)\n', (987, 1000), True, 'import numpy as np\n'), ((7357, 7451), 'matplotlib.pyplot.Circle', 'plt.Circle', (['(-host_dist_to_goal, 0.0)'], {'radius': 'host_radius', 'fc': '"""w"""', 'ec': 'plt_colors_local[0]'}), "((-host_dist_to_goal, 0.0), ...
#!/usr/bin/env python # encoding:utf-8 # @Time : 2019/12/9 # @Author : 胡茂海 # @Site : # @File : bins.py import pandas as pd import numpy as np def get_bins(y,x,drop_ratio=1.0,n=3): df1 = pd.DataFrame({'x':x,'y':y}) justmiss = df1[['x','y']][df1.x.isnull()] notmiss = df1[['x','y']][df1.x.notnull()] ...
[ "pandas.DataFrame", "numpy.log", "pandas.read_csv", "pandas.cut", "numpy.linspace" ]
[((199, 229), 'pandas.DataFrame', 'pd.DataFrame', (["{'x': x, 'y': y}"], {}), "({'x': x, 'y': y})\n", (211, 229), True, 'import pandas as pd\n'), ((1223, 1249), 'pandas.DataFrame', 'pd.DataFrame', (['{}'], {'index': '[]'}), '({}, index=[])\n', (1235, 1249), True, 'import pandas as pd\n'), ((2688, 2714), 'pandas.read_cs...
import cv2 import numpy as np import pandas as pd from matplotlib import pyplot as plt import os from src.conf import CORRELATIONS_DAYS, BATCH_LEN, STOCKS_TO_WATCH, \ LABEL_TO_PREDICT, CORR_ANALYSIS_PKL from src.visualization.matplot_graphs import plot_stock from src.data_functions.data_load import get_dataframe ...
[ "matplotlib.pyplot.show", "src.data_functions.data_load.get_dataframe", "os.getcwd", "cv2.imshow", "cv2.waitKeyEx", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.array", "src.visualization.matplot_graphs.plot_stock", "pandas.read_pickle", "matplotlib.pyplot.xticks", "matpl...
[((539, 551), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (549, 551), True, 'from matplotlib import pyplot as plt\n'), ((979, 1002), 'matplotlib.pyplot.xticks', 'plt.xticks', ([], {'rotation': '(90)'}), '(rotation=90)\n', (989, 1002), True, 'from matplotlib import pyplot as plt\n'), ((1035, 1053), 'matp...
import torchvision import os import wandb import torch import matplotlib.pyplot as plt import matplotlib.colors as colors import numpy as np def plot_recon(x, xhat, s_dir, e, wandb_on): x_path = os.path.join(s_dir, f'{e}_x.png') xhat_path = os.path.join(s_dir, f'{e}_xrecon.png') diff_path = os.path.join(s...
[ "torch.ones_like", "numpy.zeros_like", "os.path.join", "os.makedirs", "matplotlib.colors.Normalize", "torch.sqrt", "matplotlib.pyplot.close", "torch.cat", "matplotlib.pyplot.subplots", "torchvision.utils.save_image", "wandb.Image", "torch.abs", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((201, 234), 'os.path.join', 'os.path.join', (['s_dir', 'f"""{e}_x.png"""'], {}), "(s_dir, f'{e}_x.png')\n", (213, 234), False, 'import os\n'), ((251, 289), 'os.path.join', 'os.path.join', (['s_dir', 'f"""{e}_xrecon.png"""'], {}), "(s_dir, f'{e}_xrecon.png')\n", (263, 289), False, 'import os\n'), ((306, 348), 'os.path...
# -*- coding: utf-8 -*- """pln_pp_6Rs_BP_ImgNt.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1VoKtcArqmQ160GUE-7gB4eNXjny_epPF """ from google.colab import drive drive.mount('/content/drive') img_rows, img_cols = 224, 224 #number of rows and c...
[ "keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.layers.Dense", "numpy.expand_dims", "tensorflow.keras.models.Model", "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.load_img", "glob.glob", "tensorflow.keras.applications.ResNet50", "google.colab.drive.mount", ...
[((238, 267), 'google.colab.drive.mount', 'drive.mount', (['"""/content/drive"""'], {}), "('/content/drive')\n", (249, 267), False, 'from google.colab import drive\n'), ((562, 582), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (580, 582), False, 'from keras.preprocessing.image...
import numpy as np #Funcion que calcula la matriz resultante C despues de aplicar la operacion convolucion de A*B def convolucion(A, B): C_filas = len(A) - len(B) + 1 C_columnas = len(A[0]) - len(B[0]) + 1 C = np.zeros((C_filas, C_columnas)) for i in range(len(C)): for j in range(len(C[0])): ...
[ "numpy.zeros", "numpy.array" ]
[((631, 648), 'numpy.array', 'np.array', (['Matriz1'], {}), '(Matriz1)\n', (639, 648), True, 'import numpy as np\n'), ((653, 669), 'numpy.array', 'np.array', (['Filtro'], {}), '(Filtro)\n', (661, 669), True, 'import numpy as np\n'), ((908, 925), 'numpy.array', 'np.array', (['Matriz2'], {}), '(Matriz2)\n', (916, 925), T...
import os import json import argparse import numpy as np from model import build_model, save_weights DATA_DIR = '../data' LOG_DIR = '../logs' BATCH_SIZE = 16 SEQ_LENGTH = 64 class TrainLogger(object): def __init__(self, file): self.file = os.path.join(LOG_DIR, file) self.epochs = 0 wit...
[ "json.dump", "numpy.average", "argparse.ArgumentParser", "os.makedirs", "model.save_weights", "model.build_model", "numpy.asarray", "numpy.zeros", "os.path.exists", "os.path.join" ]
[((1743, 1790), 'model.build_model', 'build_model', (['BATCH_SIZE', 'SEQ_LENGTH', 'vocab_size'], {}), '(BATCH_SIZE, SEQ_LENGTH, vocab_size)\n', (1754, 1790), False, 'from model import build_model, save_weights\n'), ((1939, 1997), 'numpy.asarray', 'np.asarray', (['[char_to_idx[c] for c in text]'], {'dtype': 'np.int32'})...
from __future__ import print_function, division import numpy as np import sys import scipy.stats as stats from mpi4py import MPI try: from bipymc.demc import DeMcMpi from bipymc.mc_plot import mc_plot except: # add to path sys.path.append('../.') from bipymc.demc import DeMcMpi from bipymc.mc_pl...
[ "sys.path.append", "bipymc.mc_plot.mc_plot.plot_mcmc_params", "numpy.random.seed", "numpy.abs", "numpy.log", "numpy.random.randn", "bipymc.mc_plot.mc_plot.plot_mcmc_chain", "numpy.isfinite", "scipy.stats.norm.pdf", "numpy.array", "sys.stdout.flush", "numpy.exp", "numpy.random.rand", "bipym...
[((338, 356), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (352, 356), True, 'import numpy as np\n'), ((2040, 2066), 'numpy.array', 'np.array', (['[-0.8, 4.5, 0.2]'], {}), '([-0.8, 4.5, 0.2])\n', (2048, 2066), True, 'import numpy as np\n'), ((2081, 2264), 'bipymc.demc.DeMcMpi', 'DeMcMpi', (['lnprob'...
#################### # Birthday paradox # #################### import pandas as pd import numpy as np import matplotlib.pyplot as plt # Calculate probability number_people = np.arange(0,100) days = 365 prob = 1 prob_not = [] prob_yes = [] for i in number_people: individual = (days-i)/days prob = prob*individu...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.vlines", "matplotlib.pyplot.text", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplo...
[((176, 193), 'numpy.arange', 'np.arange', (['(0)', '(100)'], {}), '(0, 100)\n', (185, 193), True, 'import numpy as np\n'), ((528, 556), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 4.5)'}), '(figsize=(8, 4.5))\n', (538, 556), True, 'import matplotlib.pyplot as plt\n'), ((556, 624), 'matplotlib.pyplo...
#!/usr/bin/env python # coding=utf-8 import os import random import numpy as np import scipy import mne from hypyp import prep from hypyp import stats from hypyp import utils from hypyp import analyses def test_metaconn_matrix_2brains(epochs): """ Test metaconn_matrix_2brains """ # TODO: test metacon...
[ "hypyp.analyses.compute_sync", "hypyp.utils.merge", "scipy.sparse.bsr_matrix", "hypyp.analyses.compute_single_freq", "hypyp.stats.statsCond", "time.time", "mne.preprocessing.ICA.get_components", "mne.connectivity.spectral_connectivity", "numpy.array", "random.seed", "hypyp.stats.con_matrix", "...
[((519, 566), 'hypyp.stats.con_matrix', 'stats.con_matrix', (['epochs.epo1', 'freq'], {'draw': '(False)'}), '(epochs.epo1, freq, draw=False)\n', (535, 566), False, 'from hypyp import stats\n'), ((586, 647), 'hypyp.analyses.indexes_connectivity_interbrains', 'analyses.indexes_connectivity_interbrains', (['epochs.epoch_m...
''' Schema of aquisition information. ''' import re import os from datetime import datetime import numpy as np import scipy.io as sio import datajoint as dj from tqdm import tqdm from . import reference, subject, utilities schema = dj.schema(dj.config['custom'].get('database.prefix', '') + 'acquisition') @schema c...
[ "numpy.where", "numpy.array", "scipy.io.loadmat" ]
[((2339, 2407), 'scipy.io.loadmat', 'sio.loadmat', (['sess_data_file'], {'struct_as_record': '(False)', 'squeeze_me': '(True)'}), '(sess_data_file, struct_as_record=False, squeeze_me=True)\n', (2350, 2407), True, 'import scipy.io as sio\n'), ((4241, 4339), 'numpy.array', 'np.array', (['[sess_data.trialIds[tr] for tr in...
#!/usr/bin/env python3 # Copyright (c) 2019 Intel Labs. # authors: <NAME> (<EMAIL>) # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This is a benchmarking script for CARLA. It serves to analyze the performance of CARLA in different scenarios a...
[ "psutil.virtual_memory", "math.isinf", "cpuinfo.get_cpu_info", "argparse.ArgumentParser", "numpy.mean", "glob.glob", "tr.tr", "numpy.std", "threading.Lock", "pygame.quit", "carla.Transform", "subprocess.check_output", "shutil.which", "pygame.init", "carla.Location", "pygame.time.Clock"...
[((687, 698), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (695, 698), False, 'import sys\n'), ((8118, 8139), 'numpy.array', 'np.array', (['list_values'], {}), '(list_values)\n', (8126, 8139), True, 'import numpy as np\n'), ((8152, 8170), 'numpy.mean', 'np.mean', (['np_values'], {}), '(np_values)\n', (8159, 8170), T...
import unittest import numpy as np from dezero import Variable from dezero.utils import gradient_check, array_equal import dezero.functions as F class TestAdd(unittest.TestCase): def test_forward1(self): x0 = np.array([1, 2, 3]) x1 = Variable(np.array([1, 2, 3])) y = x0 + x1 res =...
[ "dezero.utils.array_equal", "numpy.random.randn", "numpy.isscalar", "dezero.utils.gradient_check", "numpy.array" ]
[((224, 243), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (232, 243), True, 'import numpy as np\n'), ((347, 366), 'numpy.array', 'np.array', (['[2, 4, 6]'], {}), '([2, 4, 6])\n', (355, 366), True, 'import numpy as np\n'), ((680, 701), 'numpy.random.randn', 'np.random.randn', (['(3)', '(3)'], {}), '...