code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python # Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import cv2 import glob import os import sys from carlaModule import carla fr...
[ "os.mkdir", "os.remove", "pygame.event.get", "random.shuffle", "carlaModule.carla.Transform", "pygame.font.Font", "cv2.rectangle", "carlaModule.carla.Location", "cv2.imshow", "carlaModule.carla.command.SpawnActor", "pygame.display.set_mode", "numpy.reshape", "carlaModule.carla.WeatherParamet...
[((1670, 1719), 'numpy.reshape', 'np.reshape', (['array', '(image.height, image.width, 4)'], {}), '(array, (image.height, image.width, 4))\n', (1680, 1719), True, 'import numpy as np\n'), ((2114, 2142), 'pygame.font.match_font', 'pygame.font.match_font', (['font'], {}), '(font)\n', (2136, 2142), False, 'import pygame\n...
#!/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
[ "utils.audio.SpectroGram", "glumpy.gl.glEnable", "utils.audio.AudioMod", "glumpy.gloo.Program", "glumpy.gl.glBlendFunc", "numpy.sin", "utils.midi.MidiMod" ]
[((995, 1034), 'glumpy.gloo.Program', 'gloo.Program', (['vertex', 'fragment'], {'count': '(4)'}), '(vertex, fragment, count=4)\n', (1007, 1034), False, 'from glumpy import gl, gloo\n'), ((1464, 1488), 'glumpy.gl.glEnable', 'gl.glEnable', (['gl.GL_BLEND'], {}), '(gl.GL_BLEND)\n', (1475, 1488), False, 'from glumpy import...
import sys import numpy as np import pytest from tenvs.accounts.stock_account import StockAccount def mock_bars(day_num=10): closes1 = np.reshape(np.linspace(10.0, 11, day_num + 1), (day_num + 1, 1)) closes2 = np.reshape(np.linspace(10.0, 11, day_num + 1), (day_num + 1, 1)) closes3 = np.ones((day_num + 1...
[ "numpy.random.seed", "tenvs.accounts.stock_account.StockAccount", "numpy.ones", "pytest.main", "numpy.array", "numpy.linspace", "numpy.concatenate" ]
[((300, 325), 'numpy.ones', 'np.ones', (['(day_num + 1, 1)'], {}), '((day_num + 1, 1))\n', (307, 325), True, 'import numpy as np\n'), ((339, 390), 'numpy.concatenate', 'np.concatenate', (['[closes1, closes2, closes3]'], {'axis': '(1)'}), '([closes1, closes2, closes3], axis=1)\n', (353, 390), True, 'import numpy as np\n...
r''' The 1D advection-diffusion problem ---------------------------------- The equation to be solved is .. math:: \frac{\partial}{\partial t} \psi(x,t) &= -\frac{1}{w(x)} \frac{\partial}{\partial x} \left[ w(x) ~ \mathcal{F}(x,t) \right] + \dot{\psi}\\ \mathcal{F} &= U(x) \psi(x) -K(x) ~ \frac{\partial \psi}...
[ "numpy.zeros_like", "numpy.ones_like", "numpy.zeros", "numpy.diag_indices", "scipy.linalg.solve_banded", "numpy.diff", "numpy.matmul", "numpy.diag", "numpy.linalg.solve" ]
[((10995, 11008), 'numpy.zeros_like', 'zeros_like', (['K'], {}), '(K)\n', (11005, 11008), False, 'from numpy import zeros, ones, zeros_like, ones_like, matmul, diag, diag_indices, diff, newaxis\n'), ((11271, 11284), 'numpy.zeros_like', 'zeros_like', (['U'], {}), '(U)\n', (11281, 11284), False, 'from numpy import zeros,...
from ._accumulate_data import AccumulateData from ..util import MaxSamplesWarning from numpy import array, nan import warnings import numpy as np class LDTransformBayesData(AccumulateData): """ Update and store transformation data based on low-discrepancy sequences. See the stopping criterion that utilize...
[ "numpy.isreal", "numpy.zeros", "numpy.isinf", "numpy.isnan", "numpy.array", "numpy.arange", "warnings.warn", "numpy.vstack" ]
[((1456, 1504), 'numpy.arange', 'np.arange', (['self.m_min', '(self.m_max + 1)'], {'dtype': 'int'}), '(self.m_min, self.m_max + 1, dtype=int)\n', (1465, 1504), True, 'import numpy as np\n'), ((1593, 1602), 'numpy.array', 'array', (['[]'], {}), '([])\n', (1598, 1602), False, 'from numpy import array, nan\n'), ((1649, 16...
"""Module to read and parse native Phoenix Geophysics data formats of the MTU-5C Family This module implements Streamed readers for segmented-decimated continuus-decimated and native sampling rate time series formats of the MTU-5C family. """ __author__ = '<NAME>' from numpy import empty, fromfile, float32, append f...
[ "numpy.fromfile", "numpy.empty", "struct.unpack", "os.path.exists", "os.path.split", "struct.unpack_from" ]
[((644, 673), 'os.path.split', 'os.path.split', (['self.base_path'], {}), '(self.base_path)\n', (657, 673), False, 'import os\n'), ((3143, 3167), 'os.path.exists', 'os.path.exists', (['new_path'], {}), '(new_path)\n', (3157, 3167), False, 'import os\n'), ((10298, 10342), 'struct.unpack_from', 'unpack_from', (['"""BBBBB...
import pandas as pd import numpy as np dataset_train = pd.read_csv("tslatrain.csv") training_set = dataset_train.iloc[:, 1:2].values from sklearn.preprocessing import MinMaxScaler sc = MinMaxScaler(feature_range = (0, 1)) training_set_scaled = sc.fit_transform(training_set) print(training_set_scaled) #Creating the t...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "keras.layers.LSTM", "matplotlib.pyplot.legend", "sklearn.preprocessing.MinMaxScaler", "matplotlib.pyplot.ylabel", "keras.layers.Dropout", "keras.layers.Dense", "numpy.array", "numpy.reshape", "...
[((56, 84), 'pandas.read_csv', 'pd.read_csv', (['"""tslatrain.csv"""'], {}), "('tslatrain.csv')\n", (67, 84), True, 'import pandas as pd\n'), ((187, 221), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (199, 221), False, 'from sklearn.preprocessing i...
import csv import re import numpy as np import torch from torch.autograd import Variable from lyrics_prediction.word_rnn import CharBasedRNN MAX_SEQ_LEN = 69 class RNNTools: def __init__(self): self.lang = None self.model = None """Neaural network functionality""" """model utilities""...
[ "csv.reader", "torch.LongTensor", "torch.load", "numpy.exp", "lyrics_prediction.word_rnn.CharBasedRNN", "re.sub", "re.compile" ]
[((452, 528), 'lyrics_prediction.word_rnn.CharBasedRNN', 'CharBasedRNN', (['self.lang.word_count', 'hidden_size', 'n_tags', 'n_layers', 'self.lang'], {}), '(self.lang.word_count, hidden_size, n_tags, n_layers, self.lang)\n', (464, 528), False, 'from lyrics_prediction.word_rnn import CharBasedRNN\n'), ((577, 668), 'torc...
#!/usr/bin/env python import math, cv2 import numpy as np from utils import * import torch import torch.nn as nn from torchvision import models import torch.nn.functional as F class ImageEncoder(nn.Module): def __init__(self, config): super(ImageEncoder, self).__init__() self.cfg = config ...
[ "numpy.sqrt", "torch.nn.Linear" ]
[((526, 565), 'torch.nn.Linear', 'nn.Linear', (['(2048)', 'self.cfg.n_feature_dim'], {}), '(2048, self.cfg.n_feature_dim)\n', (535, 565), True, 'import torch.nn as nn\n'), ((750, 762), 'numpy.sqrt', 'np.sqrt', (['(6.0)'], {}), '(6.0)\n', (757, 762), True, 'import numpy as np\n'), ((764, 815), 'numpy.sqrt', 'np.sqrt', (...
import numpy as np import matplotlib.pyplot as plt from scipy.stats import multivariate_normal # mean and cov for the first dataset mean1 = [0,0] cov1 = [[1,0.1],[0.1,1]] # mean and cov for the second dataset mean2 = [1,1] cov2 = [[1,-0.1],[-0.1,1]] # initializing sample points data1 = np.random.multi...
[ "matplotlib.pyplot.figure", "numpy.random.multivariate_normal" ]
[((305, 352), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mean1', 'cov1', '(100)'], {}), '(mean1, cov1, 100)\n', (334, 352), True, 'import numpy as np\n'), ((370, 417), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mean2', 'cov2', '(100)'], {}), '(mean2, cov2, 100)\...
from datetime import timedelta import cv2 import numpy as np import os # i.e if video of duration 30 seconds, saves 10 frame per second = 300 frames saved in total SAVING_FRAMES_PER_SECOND = 10 def format_timedelta(td): """Utility function to format timedelta objects in a cool way (e.g 00:00:20.05) omitting ...
[ "os.mkdir", "os.path.isdir", "cv2.VideoCapture", "numpy.arange", "os.path.splitext", "datetime.timedelta", "os.path.join" ]
[((976, 1019), 'numpy.arange', 'np.arange', (['(0)', 'clip_duration', '(1 / saving_fps)'], {}), '(0, clip_duration, 1 / saving_fps)\n', (985, 1019), True, 'import numpy as np\n'), ((1096, 1124), 'os.path.splitext', 'os.path.splitext', (['video_file'], {}), '(video_file)\n', (1112, 1124), False, 'import os\n'), ((1304, ...
import lightgbm as lgb import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer import pickle from sklearn.metrics import roc_auc_score from sklearn.model_selection import train_test_split print("Loading Data ... ") # 导入数据 li = ['cate2_id','cate3_id'] column ...
[ "lightgbm.train", "numpy.argmax", "pandas.read_csv", "sklearn.feature_extraction.text.TfidfVectorizer", "lightgbm.Dataset" ]
[((344, 386), 'pandas.read_csv', 'pd.read_csv', (['"""train_a.txt"""'], {'delimiter': '"""\t"""'}), "('train_a.txt', delimiter='\\t')\n", (355, 386), True, 'import pandas as pd\n'), ((395, 437), 'pandas.read_csv', 'pd.read_csv', (['"""valid_a.txt"""'], {'delimiter': '"""\t"""'}), "('valid_a.txt', delimiter='\\t')\n", (...
import numpy as np from pystella.rf import Band from pystella.rf.rad_func import Flux2MagAB from pystella.util.phys_var import phys __author__ = 'bakl' class Star: def __init__(self, name, spec=None, is_flux_eq_luminosity=False): """Creates a Star with Spectrum instance. Required parameters: name.""" ...
[ "numpy.abs", "pystella.rf.Band.response_nu", "numpy.interp", "pystella.rf.rad_func.Flux2MagAB", "scipy.interpolate.splev", "numpy.log10", "scipy.interpolate.splrep", "scipy.integrate.simps" ]
[((4938, 4982), 'pystella.rf.Band.response_nu', 'Band.response_nu', (['self.Freq', 'self.FluxObs', 'b'], {}), '(self.Freq, self.FluxObs, b)\n', (4954, 4982), False, 'from pystella.rf import Band\n'), ((5952, 6013), 'pystella.rf.Band.response_nu', 'Band.response_nu', (['self.Freq', 'self.Flux', 'b'], {'is_freq_norm': '(...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class ResBlock(nn.Module): def __init__(self, in_channels, out_channels, group_factor=8, upsample=True): super(ResBlock, self).__init__() self.in_channels = in_channels self.out_channels = out_channels ...
[ "torch.nn.ReLU", "torch.nn.ConvTranspose2d", "torch.nn.Sequential", "numpy.log2", "torch.nn.Conv2d", "torch.cat", "torch.nn.GroupNorm", "torch.nn.Linear", "torch.nn.functional.interpolate" ]
[((373, 427), 'torch.nn.GroupNorm', 'nn.GroupNorm', (['(in_channels // group_factor)', 'in_channels'], {}), '(in_channels // group_factor, in_channels)\n', (385, 427), True, 'import torch.nn as nn\n'), ((449, 537), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels'], {'kernel_size': '(3)', 'stride': '(1)',...
import functools import itertools import operator import numpy as np from qecsim.model import StabilizerCode, cli_description from qecsim.models.rotatedtoric import RotatedToricPauli @cli_description('Rotated toric (rows INT even >= 2, cols INT even >= 2)') class RotatedToricCode(StabilizerCode): r""" Imple...
[ "qecsim.model.cli_description", "operator.index", "numpy.mod", "numpy.array", "functools.lru_cache", "itertools.chain", "qecsim.models.rotatedtoric.RotatedToricPauli" ]
[((188, 261), 'qecsim.model.cli_description', 'cli_description', (['"""Rotated toric (rows INT even >= 2, cols INT even >= 2)"""'], {}), "('Rotated toric (rows INT even >= 2, cols INT even >= 2)')\n", (203, 261), False, 'from qecsim.model import StabilizerCode, cli_description\n'), ((4165, 4186), 'functools.lru_cache',...
# bat_can.py """ BatCan - Battery Modeling in Cantera This file reads in the user input, runs the simulation, and then produces any requested output (saved data file, preliminary plots, etc.) """ # Import modules import importlib # allows us to import from user input string. import numpy as np from bat_can_i...
[ "bat_can_init.initialize", "argparse.ArgumentParser", "importlib.import_module", "numpy.hstack" ]
[((1095, 1117), 'bat_can_init.initialize', 'initialize', (['input_file'], {}), '(input_file)\n', (1105, 1117), False, 'from bat_can_init import initialize\n'), ((1881, 1946), 'importlib.import_module', 'importlib.import_module', (["('electrode_models.' + an_inputs['class'])"], {}), "('electrode_models.' + an_inputs['cl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 8 20:56:53 2019 @author: minghao """ import cv2 import numpy as np def warpFrame(frame, ratio, src_points, dst_points): frame_size = (int(ratio[0]*frame.shape[1]), int(ratio[1]*frame.shape[0])) M = cv2.getPerspectiveTransform(src_points,...
[ "cv2.warpPerspective", "cv2.circle", "cv2.putText", "cv2.getPerspectiveTransform", "cv2.cvtColor", "numpy.float32", "cv2.imread", "numpy.max", "cv2.setMouseCallback", "cv2.imshow", "cv2.inRange", "cv2.Sobel", "cv2.namedWindow" ]
[((610, 649), 'cv2.imread', 'cv2.imread', (["(imgs_path + 'um_000032.png')"], {}), "(imgs_path + 'um_000032.png')\n", (620, 649), False, 'import cv2\n'), ((991, 1015), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (1006, 1015), False, 'import cv2\n'), ((1016, 1067), 'cv2.setMouseCallback',...
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import warnings import nolds import seaborn as sns plt.ioff() sns.set(font_scale=1, font="arial") def dfa(nn=None, rpeaks=None, short=None, long=None, show=True, figsize=None, legend=True): # Check input values nn = Check_Input(nn, ...
[ "matplotlib.pyplot.ioff", "numpy.polyval", "matplotlib.pyplot.close", "numpy.asarray", "numpy.zeros", "nolds.dfa", "matplotlib.pyplot.figure", "numpy.max", "warnings.warn", "seaborn.set" ]
[((128, 138), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (136, 138), True, 'import matplotlib.pyplot as plt\n'), ((140, 175), 'seaborn.set', 'sns.set', ([], {'font_scale': '(1)', 'font': '"""arial"""'}), "(font_scale=1, font='arial')\n", (147, 175), True, 'import seaborn as sns\n'), ((635, 662), 'matplotli...
import sys import os import boto3 import random import datetime import math import time import numpy as np from concurrent import futures import sagemaker from sagemaker import get_execution_role from sagemaker.serializers import NumpySerializer def one_thread(endpoint_name, feed_data): global latency_lis...
[ "sagemaker.predictor.Predictor", "boto3.client", "sagemaker.get_execution_role", "time.sleep", "sagemaker.serializers.NumpySerializer", "time.time", "numpy.percentile", "numpy.mean", "sagemaker.Session", "concurrent.futures.ThreadPoolExecutor" ]
[((404, 423), 'sagemaker.Session', 'sagemaker.Session', ([], {}), '()\n', (421, 423), False, 'import sagemaker\n'), ((441, 461), 'sagemaker.get_execution_role', 'get_execution_role', ([], {}), '()\n', (459, 461), False, 'from sagemaker import get_execution_role\n'), ((473, 517), 'sagemaker.predictor.Predictor', 'sagema...
import os import sys import numpy as np import pandas as pd from tqdm import tqdm sys.path.append('../../') from Glucose.utils.utils import * if not os.path.exists('../../dataset/'): os.mkdir('../../dataset') assert os.path.isfile( '../../dataset/GLUCOSE.csv'), 'Please download the Glucose Dataset and Renam...
[ "sys.path.append", "os.mkdir", "tqdm.tqdm", "numpy.save", "pandas.read_csv", "os.path.exists", "os.path.isfile", "numpy.unique" ]
[((84, 109), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (99, 109), False, 'import sys\n'), ((224, 267), 'os.path.isfile', 'os.path.isfile', (['"""../../dataset/GLUCOSE.csv"""'], {}), "('../../dataset/GLUCOSE.csv')\n", (238, 267), False, 'import os\n'), ((436, 476), 'pandas.read_csv', ...
from typing import Any, Awaitable, Callable, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar import argparse import asyncio import itertools import logging import logging.handlers import math import traceback import httpx import numpy as np import toml from binancebot import binance, trader, server log...
[ "argparse.ArgumentParser", "binancebot.trader.Quantity", "logging.Formatter", "numpy.linalg.solve", "toml.load", "traceback.format_exc", "typing.TypeVar", "binancebot.server.DebugInfoServer", "asyncio.get_event_loop", "asyncio.sleep", "logging.StreamHandler", "itertools.count", "httpx.AsyncC...
[((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((360, 372), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (367, 372), False, 'from typing import Any, Awaitable, Callable, Mapping, Optional, Protocol, Sequence, Tuple, Type,...
import tensorflow as tf import numpy as np import math import matplotlib.pyplot as PLT import tflowtools as TFT import random random.seed(123) np.random.seed(123) tf.set_random_seed(123) # *********** CASE MANAGER ******** # This is a simple class for organizing the cases (training, validation and test) for a # a mac...
[ "numpy.random.seed", "tensorflow.set_random_seed", "numpy.array", "random.seed", "numpy.random.shuffle" ]
[((127, 143), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (138, 143), False, 'import random\n'), ((144, 163), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (158, 163), True, 'import numpy as np\n'), ((164, 187), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(123)'], {}), '(12...
import numpy as np import matplotlib.pyplot as plt import os import cv2 import time from tensorflow.keras.callbacks import TensorBoard from keras.utils import to_categorical #DATA COLLECTION AND CATEGORIES DEFINITION Datadir = "data" Categories = ["Benign130" , "Non-cancer130" , "Malignant130"] #print(img_array) #pr...
[ "tensorflow.keras.models.load_model", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.Dense", "random.shuffle", "tensorflow.keras.layers.Dropout", "time.time", "tensorflow.keras.layers.Activation", "numpy.array",...
[((919, 948), 'random.shuffle', 'random.shuffle', (['training_data'], {}), '(training_data)\n', (933, 948), False, 'import random\n'), ((1098, 1109), 'numpy.array', 'np.array', (['Y'], {}), '(Y)\n', (1106, 1109), True, 'import numpy as np\n'), ((1114, 1131), 'keras.utils.to_categorical', 'to_categorical', (['Y'], {}), ...
# (c) 2019-​2020, <NAME> @ ETH Zurich # Computer-assisted Applications in Medicine (CAiM) Group, Prof. <NAME> # Based on https://github.com/higgsfield/RL-Adventure-2 from network import ActorCritic import torch import numpy as np from multiprocessing_env import SubprocVecEnv from tensorboardX import SummaryWriter ...
[ "os.mkdir", "numpy.random.seed", "torch.cat", "numpy.random.randint", "numpy.mean", "torch.device", "network.ActorCritic", "multiprocessing_env.SubprocVecEnv", "logging.FileHandler", "torch.FloatTensor", "random.seed", "datetime.datetime.now", "torch.manual_seed", "torch.clamp", "torch.c...
[((468, 495), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (485, 495), False, 'import logging\n'), ((496, 610), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s | %(levelname)s : %(message)s"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format='%...
# Common input & data reading routines for the electron ID # # <NAME>, 2020 # <EMAIL> import copy import math import argparse import pprint import psutil import os import datetime import json import pickle import sys import yaml import numpy as np import torch import uproot from concurrent.futures import ThreadPoolEx...
[ "psutil.virtual_memory", "numpy.sum", "argparse.ArgumentParser", "icenet.tools.aux.jagged2tensor", "icenet.tools.io.impute_data", "yaml.safe_load", "icenet.tools.io.process_memory_use", "icenet.tools.aux.pdf_2D_hist", "icenet.tools.io.pick_vars", "numpy.isfinite", "numpy.linspace", "uproot.ope...
[((683, 708), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (706, 708), False, 'import argparse\n'), ((2414, 2536), 'icenet.tools.io.DATASET', 'io.DATASET', ([], {'func_loader': 'load_root_file_new', 'files': 'paths', 'class_id': 'class_id', 'frac': "args['frac']", 'rngseed': "args['rngseed']"...
import numpy as np import os from pipeline import newPipe from helpers import * from joblib import Parallel, delayed from sklearn.utils import resample hParams = {"iters":10, "max_iter":4000, "regularization":"l2", "multi_class":"multinomial", "subsample":10000, "mode":"tf-idf", "data":"small" } if hParams["data"]=="...
[ "numpy.load", "os.path.join", "sklearn.utils.resample", "pipeline.newPipe" ]
[((401, 433), 'numpy.load', 'np.load', (['"""../data/nik/genre.npy"""'], {}), "('../data/nik/genre.npy')\n", (408, 433), True, 'import numpy as np\n'), ((519, 572), 'numpy.load', 'np.load', (['"""../data/nik/smallword2VecGenresEncoded.npy"""'], {}), "('../data/nik/smallword2VecGenresEncoded.npy')\n", (526, 572), True, ...
""" Produce integration test data, which is tested by the `test_integration_features.py` tests. One thing to note here is that all redshifts are reasonably high. This is necessary, because low redshifts mean that neutral fractions are small, and then numerical noise gets relatively more important, and can make the com...
[ "py21cmfast.run_coeval", "py21cmfast.initial_conditions", "py21cmfast.perturb_field", "h5py.File", "os.remove", "os.path.dirname", "os.path.exists", "tempfile.mkdtemp", "py21cmfast.run_lightcone", "numpy.array", "numpy.linspace", "powerbox.get_power", "py21cmfast.perturb_halo_list", "py21c...
[((769, 794), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (784, 794), False, 'import os\n'), ((6689, 6710), 'py21cmfast.run_coeval', 'run_coeval', ([], {}), '(**options)\n', (6699, 6710), False, 'from py21cmfast import AstroParams, CosmoParams, FlagOptions, UserParams, config, determine_ha...
import torch import torch.functional as F from utils import FunctionRegistry from torch_geometric.utils import intersection_and_union as i_and_u import numpy as np test_default_cfg = { 'type': 'test' } TESTS = FunctionRegistry(default_cfg=test_default_cfg) @TESTS.register def test(model, loader): model.eval...
[ "torch.ones", "torch.stack", "numpy.zeros", "torch_geometric.utils.intersection_and_union", "torch.cat", "utils.FunctionRegistry", "torch.no_grad", "torch.isnan", "torch.tensor" ]
[((216, 262), 'utils.FunctionRegistry', 'FunctionRegistry', ([], {'default_cfg': 'test_default_cfg'}), '(default_cfg=test_default_cfg)\n', (232, 262), False, 'from utils import FunctionRegistry\n'), ((2511, 2526), 'numpy.zeros', 'np.zeros', (['(13,)'], {}), '((13,))\n', (2519, 2526), True, 'import numpy as np\n'), ((25...
#!/usr/bin/python3 r'''Test of the mrcal-convert-lensmodel tool ''' # add test for mrcal-convert-lensmodel. Should test # 1. reoptimization # 2. sampled at various distances with/without uncertainties # # splined -> opencv8 is probably the interesting direction. I can imagine # that the no-geometry sampled solve...
[ "atexit.register", "mrcal.projection_diff", "subprocess.check_output", "os.path.realpath", "tempfile.mkdtemp", "mrcal.cameramodel", "testutils.finish", "numpy.array", "shutil.rmtree", "testutils.confirm_equal" ]
[((741, 759), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (757, 759), False, 'import tempfile\n'), ((882, 906), 'atexit.register', 'atexit.register', (['cleanup'], {}), '(cleanup)\n', (897, 906), False, 'import atexit\n'), ((1050, 1085), 'mrcal.cameramodel', 'mrcal.cameramodel', (['filename_splined'], {})...
# # Licensed under the The Unlicense # """Enrolls face images into a recognition database. Database includes a label for each face and a 128D encoding created by dlib python3 training.py \ -v \ --model /usr/share/edgetpu/examples/models/ssd_mobilenet_v2_face_quant_postprocess_edgetpu.tflite \ --label ./labels.pickle ...
[ "dlib.image_window", "numpy.load", "numpy.save", "pickle.dump", "argparse.ArgumentParser", "numpy.concatenate", "cv2.cvtColor", "edgetpu.detection.engine.DetectionEngine", "os.walk", "time.sleep", "faceextractor.FaceDataExtractor", "cv2.imread", "pickle.load", "PIL.Image.fromarray", "os....
[((640, 665), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (663, 665), False, 'import argparse\n'), ((1295, 1322), 'edgetpu.detection.engine.DetectionEngine', 'DetectionEngine', (['args.model'], {}), '(args.model)\n', (1310, 1322), False, 'from edgetpu.detection.engine import DetectionEngine\...
import face_recognition import picamera import numpy as np import os camera = picamera.PiCamera() camera.resolution = (320, 240) output = np.empty((240, 320, 3), dtype=np.uint8) def createFolder(path): try: if not os.path.exists("dataset/" + path) : os.makedirs("dataset/" + path) except OSError: ...
[ "os.makedirs", "numpy.empty", "face_recognition.face_encodings", "os.path.exists", "os.chdir", "picamera.PiCamera" ]
[((78, 97), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (95, 97), False, 'import picamera\n'), ((138, 177), 'numpy.empty', 'np.empty', (['(240, 320, 3)'], {'dtype': 'np.uint8'}), '((240, 320, 3), dtype=np.uint8)\n', (146, 177), True, 'import numpy as np\n'), ((553, 583), 'os.chdir', 'os.chdir', (["('dat...
import argparse import psutil import numpy as np from pyquaternion import Quaternion from nuscenes.nuscenes import NuScenes from nuscenes.utils.data_classes import LidarPointCloud from nuscenes.utils.geometry_utils import view_points import mayavi.mlab as mlab from utils import draw_lidar, draw_gt_boxes3d def get_lid...
[ "nuscenes.utils.data_classes.LidarPointCloud.from_file_multisweep", "utils.draw_lidar", "psutil.process_iter", "mayavi.mlab.figure", "argparse.ArgumentParser", "mayavi.mlab.show", "nuscenes.nuscenes.NuScenes", "mayavi.mlab.close", "pathlib.Path", "pyquaternion.Quaternion", "utils.draw_gt_boxes3d...
[((718, 807), 'nuscenes.utils.data_classes.LidarPointCloud.from_file_multisweep', 'LidarPointCloud.from_file_multisweep', (['lyftdata', 'sample_rec', 'chan', 'ref_chan'], {'nsweeps': '(1)'}), '(lyftdata, sample_rec, chan, ref_chan,\n nsweeps=1)\n', (754, 807), False, 'from nuscenes.utils.data_classes import LidarPoi...
import numpy as np from PIL import Image import os import torch import glob from torchvision import transforms from torch.autograd import Variable import torch.nn.functional as F from model import ScNet # GPU ID os.environ["CUDA_VISIBLE_DEVICES"] = "0" # The path of data and log data_root = './data/test_img/' projec...
[ "torch.mean", "torch.autograd.Variable", "torch.load", "model.ScNet", "PIL.Image.open", "torch.nn.functional.softmax", "torchvision.transforms.ToTensor", "numpy.array", "glob.glob", "torchvision.transforms.Normalize", "torchvision.transforms.TenCrop" ]
[((411, 465), 'torchvision.transforms.Normalize', 'transforms.Normalize', (['(0.5, 0.5, 0.5)', '(0.5, 0.5, 0.5)'], {}), '((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n', (431, 465), False, 'from torchvision import transforms\n'), ((816, 823), 'model.ScNet', 'ScNet', ([], {}), '()\n', (821, 823), False, 'from model import ScNet\n...
########################################################################################## # Python stuff written by <NAME> # His email: <EMAIL> # Most functions written starting February 2019, some added as time went on # Most of these functions are translations from matlab scripts written by <NAME> # His e-mail: ...
[ "numpy.abs", "numpy.shape", "matplotlib.colors.LogNorm", "numpy.arange", "matplotlib.colors.SymLogNorm", "numpy.prod", "matplotlib.pyplot.colorbar", "math.log10", "matplotlib.pyplot.subplots", "numpy.size", "matplotlib.pyplot.show", "math.sqrt", "numpy.asarray", "matplotlib.collections.Pat...
[((1144, 1161), 'numpy.asarray', 'np.asarray', (['array'], {}), '(array)\n', (1154, 1161), True, 'import numpy as np\n'), ((2646, 2664), 'numpy.array', 'np.array', (['fieldVal'], {}), '(fieldVal)\n', (2654, 2664), True, 'import numpy as np\n'), ((4487, 4505), 'numpy.array', 'np.array', (['fieldVal'], {}), '(fieldVal)\n...
import numpy as np # We generate random points num_points = 1000 vectors_set = [] for i in xrange(num_points): x1 = np.random.normal(0.0, 0.55) y1 = x1 * 0.1 + 0.3 + np.random.normal(0.0, 0.03) vectors_set.append([x1, y1]) x_data = [v[0] for v in vectors_set] y_data = [v[1] for v in vectors_set] # The 2 lines bel...
[ "tensorflow.random_uniform", "matplotlib.pyplot.xlim", "tensorflow.square", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "tensorflow.Session", "matplotlib.pyplot.ylabel", "matplotlib.use", "tensorflow.zeros", "tensorflow.initialize_a...
[((874, 890), 'matplotlib.use', 'mpl.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (881, 890), True, 'import matplotlib as mpl\n'), ((949, 1002), 'matplotlib.pyplot.plot', 'plt.plot', (['x_data', 'y_data', '"""ro"""'], {'label': '"""Original data"""'}), "(x_data, y_data, 'ro', label='Original data')\n", (957, 1002), True...
##lots of imports. Some are unnecessary but I left a lot just to be safe... import matplotlib.pyplot as plt import matplotlib from astropy.io import fits import numpy as np import astropy.table as t import matplotlib.image as img from scipy.optimize import newton from pathlib import Path import math import matplotlib.c...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "matplotlib.pyplot.close", "numpy.asarray", "numpy.genfromtxt", "numpy.where", "astropy.io.fits.open", "matplotlib.pyplot.ylabel", "numpy.log10", "matplotlib.pyplot.xlabel", "re.sub", "matplotlib.pyplot.savefig"...
[((579, 649), 'astropy.io.fits.open', 'fits.open', (['"""/home/celeste/Documents/astro_research/drpall-v2_3_1.fits"""'], {}), "('/home/celeste/Documents/astro_research/drpall-v2_3_1.fits')\n", (588, 649), False, 'from astropy.io import fits\n'), ((816, 864), 'matplotlib.pyplot.scatter', 'plt.scatter', (['mass_total', '...
import numpy as np import time class BananaPixelEnv(): def __init__(self, env, num_frames=4): self.frame_buffer = [] self.brain_names = env.brain_names self.env = env self.num_frames = num_frames def _update_state(self): frame = np.transpose(self.env_info.visual_observa...
[ "numpy.transpose", "numpy.zeros", "numpy.int32" ]
[((410, 485), 'numpy.zeros', 'np.zeros', (['(1, frame_size[1], self.num_frames, frame_size[2], frame_size[3])'], {}), '((1, frame_size[1], self.num_frames, frame_size[2], frame_size[3]))\n', (418, 485), True, 'import numpy as np\n'), ((279, 343), 'numpy.transpose', 'np.transpose', (['self.env_info.visual_observations[0...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 3rd party imports import numpy as np __author__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2020-2021" __license__ = "MIT" __version__ = "2.3.7" __status__ = "Prototype" def norm(inp): r"""Computes the magnitude of the input field. Parameters ...
[ "numpy.sum" ]
[((903, 927), 'numpy.sum', 'np.sum', (['(inp ** 2)'], {'axis': '(1)'}), '(inp ** 2, axis=1)\n', (909, 927), True, 'import numpy as np\n')]
import threading import numpy as np import matplotlib from thimbgui import QtGui, QtWidgets, QtCore, Qt class FeatureFitWidget(QtWidgets.QWidget): slidersChanged = Signal(int) def __init__(self, features, feature_idx, parent=None): super(FeatureFitWidget, self).__init__(parent) self.displ...
[ "thimbgui.QtGui.QFileDialog.getSaveFileName", "numpy.asarray", "thimbgui.QtGui.QPushButton", "thimbgui.QtGui.QGridLayout", "numpy.min", "numpy.max", "thimbgui.QtGui.QSize", "numpy.sqrt", "thimbgui.QtGui.QCheckBox" ]
[((597, 616), 'thimbgui.QtGui.QGridLayout', 'QtGui.QGridLayout', ([], {}), '()\n', (614, 616), False, 'from thimbgui import QtGui, QtWidgets, QtCore, Qt\n'), ((1937, 1975), 'thimbgui.QtGui.QPushButton', 'QtGui.QPushButton', (['"""save measurements"""'], {}), "('save measurements')\n", (1954, 1975), False, 'from thimbgu...
import numpy as np import random from collections import namedtuple, deque from models import Actor, Critic import copy import torch import torch.nn.functional as F import torch.optim as optim UPDATE_EVERY = 1 # how often to update the network LOW_ACTION = -1 HIGH_ACTION = 1 NUM_AGENTS = 1 WARM_UP = 0 CONSECUTIVE_LEA...
[ "random.sample", "numpy.ones", "numpy.clip", "numpy.mean", "torch.no_grad", "numpy.random.randn", "models.Critic", "random.seed", "models.Actor", "numpy.var", "numpy.asarray", "torch.nn.functional.mse_loss", "numpy.square", "random.random", "torch.cuda.is_available", "numpy.vstack", ...
[((363, 388), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (386, 388), False, 'import torch\n'), ((1034, 1051), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1045, 1051), False, 'import random\n'), ((3420, 3460), 'numpy.clip', 'np.clip', (['action', 'LOW_ACTION', 'HIGH_ACTION'], ...
import matplotlib.pyplot as plt import numpy as np def extract_data( d ): return {"Re[0]x":d[:, 1], "Im[0]x":d[:, 2], "Re[0]y":d[:, 3], "Im[0]y":d[:, 4], "Re[0]z":d[:, 5], "Im[0]z":d[:, 6], "Re[1]x":d[:, 7], "Im[1]x":d[:, 8], "Re[1]y":d[:, 9], "Im[1]y":d[:,10], ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((2487, 2499), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2497, 2499), True, 'import matplotlib.pyplot as plt\n'), ((2609, 2638), 'numpy.loadtxt', 'np.loadtxt', (['"""res/ptot_1d.dat"""'], {}), "('res/ptot_1d.dat')\n", (2619, 2638), True, 'import numpy as np\n'), ((3151, 3195), 'matplotlib.pyplot.xla...
import unittest import numpy import cupy from cupy import testing import cupyx.scipy.special # NOQA def _boundary_inputs(boundary, rtol, atol): left = boundary * (1 - numpy.copysign(rtol, boundary)) - atol right = boundary * (1 + numpy.copysign(rtol, boundary)) + atol return [left, boundary, right] c...
[ "cupy.testing.shaped_arange", "numpy.copysign", "cupy.empty", "cupy.isnan", "cupy.testing.shaped_random", "cupy.testing.with_requires", "cupy.asnumpy", "cupy.testing.numpy_cupy_allclose", "cupy.testing.for_dtypes", "cupy.fuse" ]
[((1102, 1132), 'cupy.testing.with_requires', 'testing.with_requires', (['"""scipy"""'], {}), "('scipy')\n", (1123, 1132), False, 'from cupy import testing\n'), ((3324, 3354), 'cupy.testing.with_requires', 'testing.with_requires', (['"""scipy"""'], {}), "('scipy')\n", (3345, 3354), False, 'from cupy import testing\n'),...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division from __future__ import print_function import os import sys import numpy as np from enum import Enum from io import StringIO from inspect import isclass from contextlib import contextmanager from NumPyNet import activations from NumPyNet.ex...
[ "numpy.argmax", "numpy.zeros", "numpy.expand_dims", "NumPyNet.exception.NotFittedError", "numpy.mean", "numpy.lib.stride_tricks.as_strided", "numpy.max", "numpy.var", "numpy.put_along_axis" ]
[((4951, 4963), 'numpy.mean', 'np.mean', (['arr'], {}), '(arr)\n', (4958, 4963), True, 'import numpy as np\n'), ((4977, 4988), 'numpy.var', 'np.var', (['arr'], {}), '(arr)\n', (4983, 4988), True, 'import numpy as np\n'), ((5514, 5557), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, num_label)', 'dtype': 'float'}), '(sh...
import os import numpy as np import pytest from mikeio import Dfsu, Mesh from mikeio.eum import ItemInfo def test_read_all_items_returns_all_items_and_names(): filename = os.path.join("tests", "testdata", "HD2D.dfsu") dfs = Dfsu() (data, t, items) = dfs.read(filename) assert len(data) == 4 asse...
[ "mikeio.Dfsu", "mikeio.eum.ItemInfo", "numpy.zeros", "pytest.raises", "mikeio.Mesh", "os.path.join" ]
[((178, 224), 'os.path.join', 'os.path.join', (['"""tests"""', '"""testdata"""', '"""HD2D.dfsu"""'], {}), "('tests', 'testdata', 'HD2D.dfsu')\n", (190, 224), False, 'import os\n'), ((235, 241), 'mikeio.Dfsu', 'Dfsu', ([], {}), '()\n', (239, 241), False, 'from mikeio import Dfsu, Mesh\n'), ((405, 451), 'os.path.join', '...
#!/usr/local/bin/python2.7 # encoding: utf-8 ''' Axile -- Outil de conception/simulation de parapentes Nervures Classe NSpline Description : @author: puiseux @copyright: 2016 Nervures. All rights reserved. @contact: <EMAIL> ''' from numbers import Number import numpy as np import cPickle from numpy import asa...
[ "numpy.sum", "scipy.interpolate.CubicSpline", "utilitaires.lecteurs.LecteurUniversel", "numpy.ones", "numpy.linalg.norm", "scipy.interpolate.InterpolatedUnivariateSpline", "scipy.interpolate.UnivariateSpline", "numpy.savetxt", "utilitaires.utilitairesdivers.baryCentre", "numpy.loadtxt", "numpy.l...
[((4470, 4557), 'scipy.optimize.minimize_scalar', 'minimize_scalar', (['phi'], {'bounds': '(0.0, 1.0)', 'method': '"""bounded"""', 'options': "{'xatol': 1e-09}"}), "(phi, bounds=(0.0, 1.0), method='bounded', options={'xatol':\n 1e-09})\n", (4485, 4557), False, 'from scipy.optimize import minimize_scalar\n'), ((10033...
# ==BEGIN LICENSE== # # MIT License # # Copyright (c) 2018 SRI Lab, ETH Zurich # # 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 right...
[ "unittest.main", "dpfinder.utils.tf.tf_wrapper.TensorFlowWrapper", "tensorflow.reduce_sum", "numpy.ones", "tensorflow.get_variable" ]
[((1358, 1372), 'numpy.ones', 'np.ones', (['shape'], {}), '(shape)\n', (1365, 1372), True, 'import numpy as np\n'), ((1924, 1939), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1937, 1939), False, 'import unittest\n'), ((1409, 1447), 'tensorflow.get_variable', 'tf.get_variable', (['"""x"""'], {'shape': 'self.sha...
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 18:03:37 2021 @author: <NAME> """ import numpy as np #import scipy.sparse.linalg from shapely.geometry import Point, Polygon """ Caracteristicas basicas da malha """ fileName = "fechadoCorpoExt.msh" #elementSizeFactor = 0.09 import malhaModulo malha = malhaModulo...
[ "shapely.geometry.Point", "shapely.geometry.Polygon", "malhaModulo.Malha", "numpy.round", "numpy.zeros", "numpy.identity", "malhaModulo.MatrizesGlobais", "numpy.dot", "numpy.linalg.solve", "numpy.sqrt" ]
[((309, 336), 'malhaModulo.Malha', 'malhaModulo.Malha', (['fileName'], {}), '(fileName)\n', (326, 336), False, 'import malhaModulo\n'), ((568, 600), 'numpy.zeros', 'np.zeros', (['npoints'], {'dtype': '"""float"""'}), "(npoints, dtype='float')\n", (576, 600), True, 'import numpy as np\n'), ((607, 639), 'numpy.zeros', 'n...
from mesh import Mesh2D import unittest import numpy as np class TestMesh2D(unittest.TestCase): """ Test Class Mesh2D """ def test_constructor(self): # # Rectangular Mesh # mesh = Mesh2D(resolution=(3,3)) self.assertTrue(mesh.is_rectangular()) self.assert...
[ "numpy.abs", "mesh.Mesh2D" ]
[((229, 254), 'mesh.Mesh2D', 'Mesh2D', ([], {'resolution': '(3, 3)'}), '(resolution=(3, 3))\n', (235, 254), False, 'from mesh import Mesh2D\n'), ((469, 508), 'mesh.Mesh2D', 'Mesh2D', ([], {'resolution': '(1, 1)', 'periodic': '{0}'}), '(resolution=(1, 1), periodic={0})\n', (475, 508), False, 'from mesh import Mesh2D\n')...
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> and <NAME> # -------------------------------------------------------- import yaml import numpy as np import numpy.random as npr import ...
[ "numpy.ascontiguousarray", "numpy.zeros", "numpy.all", "numpy.ones", "numpy.hstack", "numpy.append", "numpy.where", "numpy.array", "numpy.random.rand", "numpy.round", "numpy.concatenate", "numpy.sqrt" ]
[((1610, 1664), 'numpy.zeros', 'np.zeros', (['(gt_boxes.shape[0], 1)'], {'dtype': 'gt_boxes.dtype'}), '((gt_boxes.shape[0], 1), dtype=gt_boxes.dtype)\n', (1618, 1664), True, 'import numpy as np\n'), ((1804, 1831), 'numpy.all', 'np.all', (['(all_rois[:, 0] == 0)'], {}), '(all_rois[:, 0] == 0)\n', (1810, 1831), True, 'im...
""" A viewer for a CSV file containing a column of paths. """ from __future__ import annotations import asyncio import numpy as np import pandas as pd from typing import Union from pathlib import Path from bokeh.io import curdoc from functools import partial from bokeh.models import Button, Div, BoxAnnotation from bok...
[ "pandas.DataFrame", "functools.partial", "bokeh.models.Div", "bokeh.models.Button", "ramjet.analysis.viewer.preloader.Preloader.from_csv_path", "numpy.isnan", "bokeh.models.BoxAnnotation", "asyncio.get_running_loop", "ramjet.photometric_database.tess_ffi_light_curve.TessFfiLightCurve", "bokeh.io.c...
[((832, 847), 'ramjet.analysis.transit_vetter.TransitVetter', 'TransitVetter', ([], {}), '()\n', (845, 847), False, 'from ramjet.analysis.transit_vetter import TransitVetter\n'), ((8085, 8154), 'pathlib.Path', 'Path', (['"""/Users/golmsche/Desktop/infer results 2020-10-09-13-21-21.csv"""'], {}), "('/Users/golmsche/Desk...
# Import routines import numpy as np import math import random # Defining hyperparameters m = 5 # number of cities, ranges from 0 ..... m-1 t = 24 # number of hours, ranges from 0 .... t-1 d = 7 # number of days, ranges from 0 ... d-1 C = 5 # Per hour fuel and other costs R = 9 # per hour revenue from a passenger ...
[ "numpy.zeros", "numpy.random.poisson", "numpy.hstack" ]
[((1589, 1611), 'numpy.zeros', 'np.zeros', (['m'], {'dtype': 'int'}), '(m, dtype=int)\n', (1597, 1611), True, 'import numpy as np\n'), ((1647, 1669), 'numpy.zeros', 'np.zeros', (['t'], {'dtype': 'int'}), '(t, dtype=int)\n', (1655, 1669), True, 'import numpy as np\n'), ((1700, 1722), 'numpy.zeros', 'np.zeros', (['d'], {...
import numpy as np from ..util.lsqr import lsqr class MultiAttributeLinearRegression(): def __init__(self): self.coefficients = None pass def fit(self,x,y): ''' :param x 二维 ndarray 类型,为输入的数据量,包含截距 例如 [[x11,x12,x13,1] [x21,x22,x23,1] ...
[ "numpy.linalg.matrix_rank" ]
[((536, 560), 'numpy.linalg.matrix_rank', 'np.linalg.matrix_rank', (['x'], {}), '(x)\n', (557, 560), True, 'import numpy as np\n')]
from typing import Optional import cv2 import numpy as np def rect_empty(rect): return rect[0] == rect[2] and rect[1] == rect[3] def rect_to_region(left, top, width, height, w=1, h=1): return [top / h, left / w, (top + height) / h, (left + width) / w] def region_reparent(region, reference_region): # ...
[ "cv2.selectROI", "cv2.cvtColor", "cv2.waitKey", "cv2.getTextSize", "numpy.clip", "numpy.array", "cv2.destroyWindow", "cv2.imshow", "cv2.resize" ]
[((1316, 1406), 'cv2.getTextSize', 'cv2.getTextSize', ([], {'text': '"""jM^"""', 'fontFace': 'font', 'fontScale': 'font_scale', 'thickness': 'thickness'}), "(text='jM^', fontFace=font, fontScale=font_scale, thickness=\n thickness)\n", (1331, 1406), False, 'import cv2\n'), ((1451, 1483), 'numpy.array', 'np.array', ([...
"""Transform a roidb into a trainable roidb by adding a bunch of metadata.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import datasets import numpy as np from model.utils.config import cfg from datasets.factory import get_imdb import PIL import pdb ...
[ "datasets.imdb.imdb", "numpy.argsort", "numpy.where", "numpy.array", "datasets.factory.get_imdb" ]
[((2686, 2706), 'numpy.array', 'np.array', (['ratio_list'], {}), '(ratio_list)\n', (2694, 2706), True, 'import numpy as np\n'), ((2725, 2747), 'numpy.argsort', 'np.argsort', (['ratio_list'], {}), '(ratio_list)\n', (2735, 2747), True, 'import numpy as np\n'), ((3757, 3776), 'datasets.factory.get_imdb', 'get_imdb', (['im...
import pickle import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import sys from warped_image import warp from image_pipeline import pipeline from fit_line import fit_polynomial from lane_pixels import find_lane_pixels # Read in the saved matrix and distortion coefficient f...
[ "numpy.zeros_like", "cv2.VideoWriter_fourcc", "numpy.copy", "cv2.bitwise_and", "warped_image.warp", "fit_line.fit_polynomial", "numpy.float32", "cv2.waitKey", "cv2.fillPoly", "cv2.VideoCapture", "pickle.load", "numpy.array", "cv2.VideoWriter", "cv2.destroyAllWindows", "image_pipeline.pip...
[((528, 574), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""harder_challenge_video.mp4"""'], {}), "('harder_challenge_video.mp4')\n", (544, 574), False, 'import cv2\n'), ((840, 871), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (862, 871), False, 'import cv2\n'), ((878, 927), 'c...
import pytest import numpy as np import os from dispersion import Material from dispersion import Spectrum @pytest.fixture def spectrum(): spectrum = Spectrum(0.5, unit='um') yield spectrum @pytest.fixture def root_path(): this_dir = os.path.dirname(os.path.abspath(__file__)) root_path = os.path.join(...
[ "os.path.abspath", "dispersion.Material", "dispersion.Spectrum", "numpy.imag", "numpy.real", "os.path.join" ]
[((155, 179), 'dispersion.Spectrum', 'Spectrum', (['(0.5)'], {'unit': '"""um"""'}), "(0.5, unit='um')\n", (163, 179), False, 'from dispersion import Spectrum\n'), ((307, 343), 'os.path.join', 'os.path.join', (['this_dir', '""".."""', '"""data"""'], {}), "(this_dir, '..', 'data')\n", (319, 343), False, 'import os\n'), (...
import sys,os import random sys.path.append(os.getcwd()) from Process.process import * import torch as th from torch_scatter import scatter_mean import torch.nn.functional as F import numpy as np from tools.earlystopping import EarlyStopping from torch_geometric.data import DataLoader from tqdm import tqdm from Process...
[ "torch.nn.functional.dropout", "torch.cat", "json.dumps", "numpy.mean", "os.path.exists", "torch.nn.functional.nll_loss", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch.nn.functional.relu", "datetime.datetime.now", "torch_scatter.scatter_mean", "torch.cuda.is_available", "Proce...
[((44, 55), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (53, 55), False, 'import os\n'), ((5333, 5379), 'tools.earlystopping.EarlyStopping', 'EarlyStopping', ([], {'patience': 'patience', 'verbose': '(True)'}), '(patience=patience, verbose=True)\n', (5346, 5379), False, 'from tools.earlystopping import EarlyStopping\n'...
from __future__ import annotations import numpy as np EPSILON = 10e-17 def vector_from_points(u: np.array, v: np.array) -> np.array: """ Return the vector 'uv', from points 'u' to 'v'. Args: u (np.array): Point 'u'. v (np.array): Point 'v'. Returns: np.array: vector """...
[ "numpy.cross", "numpy.sqrt" ]
[((1799, 1847), 'numpy.sqrt', 'np.sqrt', (['(self.a ** 2 + self.b ** 2 + self.c ** 2)'], {}), '(self.a ** 2 + self.b ** 2 + self.c ** 2)\n', (1806, 1847), True, 'import numpy as np\n'), ((2319, 2333), 'numpy.cross', 'np.cross', (['u', 'v'], {}), '(u, v)\n', (2327, 2333), True, 'import numpy as np\n')]
import pylab as pl import matplotlib from matplotlib.collections import PatchCollection import matplotlib.path as mpath import matplotlib.patches as mpatches import matplotlib.lines as mlines import matplotlib.text as text import matplotlib.font_manager as fm from matplotlib.patches import Ellipse, Circle import matpl...
[ "box.Box", "pylab.subplots_adjust", "matplotlib.font_manager.FontProperties", "matplotlib.cm.ScalarMappable", "numpy.logspace", "pylab.style.use", "seaborn.barplot", "numpy.log10", "pylab.subplot", "pylab.colorbar", "pylab.figure", "matplotlib.colors.LogNorm", "numpy.linspace", "numpy.aran...
[((502, 531), 'pylab.style.use', 'pl.style.use', (['"""seaborn-white"""'], {}), "('seaborn-white')\n", (514, 531), True, 'import pylab as pl\n'), ((2609, 2642), 'box.Box', 'ddict', ([], {'tox': 'cm.hot', 'hts': 'cm.Blues_r'}), '(tox=cm.hot, hts=cm.Blues_r)\n', (2614, 2642), True, 'from box import Box as ddict\n'), ((27...
# !/usr/bin/python3 # https://github.com/SintefManufacturing/python-urx/blob/master/urx/urrobot.py # Must be run with library from the repo # 10 July 2019 -- this works even while inputting commands from pendant from tcpUR.pyUR import PyUR import logging import time import numpy as np import sys import os import sign...
[ "numpy.set_printoptions", "logging.basicConfig", "time.sleep", "os._exit", "tcpUR.pyUR.PyUR", "numpy.array", "signal.signal", "sys.exit" ]
[((570, 624), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'keyboardInterruptHandler'], {}), '(signal.SIGINT, keyboardInterruptHandler)\n', (583, 624), False, 'import signal\n'), ((514, 524), 'sys.exit', 'sys.exit', ([], {}), '()\n', (522, 524), False, 'import sys\n'), ((556, 567), 'os._exit', 'os._exit', (['(1...
"dataset: defines some representations for data source from Zarr & Cytomine." import abc import pathlib from typing import Dict, Iterator, List, Optional, Set, Tuple, Union import numpy as np import numpy.typing as npt from sklearn.model_selection import train_test_split from cytomine.models import ( AnnotationCo...
[ "msi_zarr_analysis.ml.dataset.utils.build_class_masks", "numpy.sum", "msi_zarr_analysis.utils.iter_chunks.clean_slice_tuple", "pathlib.Path", "msi_zarr_analysis.utils.cytomine_utils.iter_annoation_single_term", "numpy.unique", "cytomine.models.AnnotationCollection", "numpy.max", "numpy.fill_diagonal...
[((3057, 3091), 'numpy.zeros', 'np.zeros', (['(n_features, n_features)'], {}), '((n_features, n_features))\n', (3065, 3091), True, 'import numpy as np\n'), ((3380, 3407), 'numpy.fill_diagonal', 'np.fill_diagonal', (['corr', '(1.0)'], {}), '(corr, 1.0)\n', (3396, 3407), True, 'import numpy as np\n'), ((3479, 3514), 'num...
import numpy as np import pybullet as p import igibson.utils.transform_utils as T from igibson.controllers import ControlType, ManipulationController from igibson.utils.filters import MovingAverageFilter # Different modes IK_MODE_COMMAND_DIMS = { "pose_absolute_ori": 6, # 6DOF (dx,dy,dz,ax,ay,az) control over po...
[ "numpy.array", "igibson.utils.transform_utils.pose2mat", "igibson.utils.transform_utils.quat2mat", "igibson.utils.transform_utils.pose_in_A_to_pose_in_B", "igibson.utils.transform_utils.axisangle2quat", "igibson.utils.transform_utils.mat2pose" ]
[((7213, 7240), 'numpy.array', 'np.array', (['default_joint_pos'], {}), '(default_joint_pos)\n', (7221, 7240), True, 'import numpy as np\n'), ((7270, 7293), 'numpy.array', 'np.array', (['joint_damping'], {}), '(joint_damping)\n', (7278, 7293), True, 'import numpy as np\n'), ((9518, 9542), 'igibson.utils.transform_utils...
# Usage: # python train_net.py -cfg ../configs/example.yaml -- learning_rate 1.0 import sys import os import argparse import time from tqdm import tqdm import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torchvision import imageio sys.path.insert(0, '../') from lib.common.tra...
[ "lib.dataset.AMASSdataset.AMASSdataset", "tqdm.tqdm", "lib.common.trainer.Trainer", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "numpy.flip", "lib.net.DeepSDF.Net", "torch.nn.functional.mse_loss", "os.path.exists", "sys.path.insert", "torch.randn", "time.time", "lib.net.test_ne...
[((275, 300), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (290, 300), False, 'import sys\n'), ((519, 544), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (542, 544), False, 'import argparse\n'), ((815, 833), 'lib.common.config.get_cfg_defaults', 'get_cfg_de...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 29 19:05:47 2019 ================================== The Refrigeration Problem ================================== Note: This method computes everything by hand, step by step. For most people, the new API for fuzzy systems will be preferable. The ...
[ "skfuzzy.control.ControlSystemSimulation", "skfuzzy.trimf", "skfuzzy.control.Rule", "numpy.arange", "skfuzzy.control.ControlSystem" ]
[((1371, 1410), 'skfuzzy.trimf', 'fuzz.trimf', (['ErroTev.universe', '[0, 1, 2]'], {}), '(ErroTev.universe, [0, 1, 2])\n', (1381, 1410), True, 'import skfuzzy as fuzz\n'), ((1558, 1597), 'skfuzzy.trimf', 'fuzz.trimf', (['ErroTev.universe', '[1, 2, 3]'], {}), '(ErroTev.universe, [1, 2, 3])\n', (1568, 1597), True, 'impor...
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[ "unittest.main", "numpy.zeros_like", "numpy.random.seed", "numpy.minimum", "hypothesis.strategies.just", "caffe2.python.core.CreateOperator", "numpy.arange", "numpy.int32", "numpy.random.rand", "hypothesis.strategies.integers", "hypothesis.strategies.floats" ]
[((4410, 4425), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4423, 4425), False, 'import unittest\n'), ((1503, 1523), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1517, 1523), True, 'import numpy as np\n'), ((1537, 1643), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""R...
"""Utils for the inclusion of exogenous processes.""" import functools import numpy as np import pandas as pd from scipy import special from respy.parallelization import parallelize_across_dense_dimensions from respy.shared import get_exogenous_from_dense_covariates from respy.shared import load_objects from respy.sh...
[ "pandas.DataFrame", "respy.shared.pandas_dot", "numpy.expand_dims", "respy.shared.get_exogenous_from_dense_covariates", "numpy.array", "numpy.column_stack", "functools.reduce", "respy.shared.load_objects" ]
[((1658, 1690), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'states.index'}), '(index=states.index)\n', (1670, 1690), True, 'import pandas as pd\n'), ((2798, 2843), 'respy.shared.load_objects', 'load_objects', (['"""transition"""', 'complex_', 'options'], {}), "('transition', complex_, options)\n", (2810, 2843),...
import numpy as np from scipy.interpolate import RegularGridInterpolator class PowerSpectrumGridInterpolator(): def __init__(self, ps_type='nonlin_matter', file_name=None, k_max=1e7): file_name = "../data/log_pk_grids/log_pk_" + ps_type + "_grid_ary.npz" if file_name is not None: fil...
[ "numpy.load", "numpy.meshgrid", "numpy.ones_like", "numpy.transpose", "numpy.min", "numpy.log10" ]
[((472, 486), 'numpy.min', 'np.min', (['z_grid'], {}), '(z_grid)\n', (478, 486), True, 'import numpy as np\n'), ((324, 342), 'numpy.load', 'np.load', (['file_name'], {}), '(file_name)\n', (331, 342), True, 'import numpy as np\n'), ((863, 888), 'numpy.meshgrid', 'np.meshgrid', (['z_ary', 'k_ary'], {}), '(z_ary, k_ary)\n...
import pandas as pd import numpy as np import os, sys import glob from scripts.constants import * from absl import flags FLAGS = flags.FLAGS ## Hparams flags.DEFINE_string("base_path", None, "Base path") flags.DEFINE_integer("start_x", 0, "start step of record") flags.DEFINE_integer("interval_x", 1, "interval of reco...
[ "pandas.DataFrame", "pandas.read_csv", "absl.flags.DEFINE_string", "numpy.around", "absl.flags.DEFINE_integer", "numpy.arange", "numpy.interp", "absl.flags.FLAGS", "os.path.join", "pandas.concat" ]
[((154, 205), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""base_path"""', 'None', '"""Base path"""'], {}), "('base_path', None, 'Base path')\n", (173, 205), False, 'from absl import flags\n'), ((206, 264), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""start_x"""', '(0)', '"""start step of recor...
# -*- coding: utf8 -*- """ ====================================== Project Name: NLP File Name: format_conv Author: czh Create Date: 2021/9/29 -------------------------------------- Change Activity: ====================================== """ import copy import numpy as np from sklearn.feature_extra...
[ "copy.deepcopy", "numpy.max", "numpy.min" ]
[((960, 988), 'copy.deepcopy', 'copy.deepcopy', (['event_so_list'], {}), '(event_so_list)\n', (973, 988), False, 'import copy\n'), ((740, 763), 'numpy.min', 'np.min', (['vectors'], {'axis': '(0)'}), '(vectors, axis=0)\n', (746, 763), True, 'import numpy as np\n'), ((800, 823), 'numpy.max', 'np.max', (['vectors'], {'axi...
import os import numpy as np import torch import torch.utils.data import pickle as pkl from torch import nn, optim from tqdm import tqdm from sklearn.metrics import r2_score from sklearn.metrics import mean_squared_error as mse from networks import HSICClassifier, MLP2Layer from ECG.train.datasets import create_datalo...
[ "networks.MLP2Layer", "os.mkdir", "torch.nn.MSELoss", "tqdm.tqdm", "pickle.dump", "os.path.join", "torch.manual_seed", "os.path.realpath", "os.path.exists", "numpy.mean", "networks.HSICClassifier", "ECG.train.datasets.create_dataloaders", "torch.no_grad", "ECG.train.train_utils.get_device"...
[((579, 600), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (596, 600), False, 'import torch\n'), ((878, 897), 'ECG.train.train_utils.get_device', 'get_device', (['cuda_id'], {}), '(cuda_id)\n', (888, 897), False, 'from ECG.train.train_utils import get_device, update_subset_list\n'), ((1087, 1212)...
# Test for testing the test tools ... uhhh boy! import numpy as np import copy from pwtools.test import tools def test_tools(): x1 = {'a': 3, type(1): 'foo', 'b': {'aa': 1, 'bb': np.array([1,2]), 'cc': {'aaa': np.array([1,2.0]), 'bbb': np....
[ "copy.deepcopy", "pwtools.test.tools.assert_dict_with_all_types_equal", "pwtools.test.tools.array_equal", "numpy.random.rand", "numpy.allclose", "pwtools.test.tools.assert_all_types_equal", "pwtools.test.tools.array_almost_equal", "numpy.array", "pwtools.test.tools.assert_all_types_almost_equal", ...
[((347, 364), 'copy.deepcopy', 'copy.deepcopy', (['x1'], {}), '(x1)\n', (360, 364), False, 'import copy\n'), ((369, 415), 'pwtools.test.tools.assert_dict_with_all_types_equal', 'tools.assert_dict_with_all_types_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (407, 415), False, 'from pwtools.test import tools\n'), ((420, 456)...
# ########################################################################### # # CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP) # (C) Cloudera, Inc. 2020 # All rights reserved. # # Applicable Open Source License: Apache 2.0 # # NOTE: Cloudera open source products are modular software products # made up of hu...
[ "sklearn.metrics.accuracy_score", "matplotlib.pyplot.box", "matplotlib.pyplot.figure", "sklearn.metrics.f1_score", "pandas.DataFrame", "matplotlib.pyplot.axvline", "sklearn.metrics.fbeta_score", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "os.path.exists", "matplotlib.pyplot.rcParams....
[((2439, 2460), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (2453, 2460), False, 'import matplotlib\n'), ((2807, 2839), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['plot_params'], {}), '(plot_params)\n', (2826, 2839), True, 'import matplotlib.pyplot as plt\n'), ((2983, 2995),...
# SPDX-License-Identifier: MIT # Copyright © 2022 <NAME> """This script validates TFLite compatibility. The script is used to replicate Github Issue #36 (https://github.com/patlevin/tfjs-to-tf/issues/36) It expects the path to a converted blazeface model (https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/de...
[ "tensorflow.lite.TFLiteConverter.from_saved_model", "numpy.zeros" ]
[((1381, 1438), 'tensorflow.lite.TFLiteConverter.from_saved_model', 'tf.lite.TFLiteConverter.from_saved_model', (['savedmodel_path'], {}), '(savedmodel_path)\n', (1421, 1438), True, 'import tensorflow as tf\n'), ((1298, 1321), 'numpy.zeros', 'np.zeros', (['(128 * 128 * 3)'], {}), '(128 * 128 * 3)\n', (1306, 1321), True...
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "numpy.array", "numpy.isnan", "pandas.Index" ]
[((6166, 6182), 'pandas.Index', 'pd.Index', (['labels'], {}), '(labels)\n', (6174, 6182), True, 'import pandas as pd\n'), ((1792, 1810), 'numpy.isnan', 'np.isnan', (['new_size'], {}), '(new_size)\n', (1800, 1810), True, 'import numpy as np\n'), ((1819, 1840), 'numpy.isnan', 'np.isnan', (['expect_size'], {}), '(expect_s...
import numpy as np from PuzzleLib import Config from PuzzleLib.Backend import gpuarray from PuzzleLib.Modules.Module import ModuleError from PuzzleLib.Modules.ConvND import ConvND class Conv2D(ConvND): def __init__(self, inmaps, outmaps, size, stride=1, pad=0, dilation=1, wscale=1.0, useBias=True, name=None, ...
[ "numpy.sum", "PuzzleLib.Backend.gpuarray.to_gpu", "numpy.random.randn", "numpy.empty", "numpy.zeros", "numpy.random.normal", "PuzzleLib.Modules.Module.ModuleError", "PuzzleLib.Cost.MSE.MSE" ]
[((2656, 2681), 'PuzzleLib.Backend.gpuarray.to_gpu', 'gpuarray.to_gpu', (['hostData'], {}), '(hostData)\n', (2671, 2681), False, 'from PuzzleLib.Backend import gpuarray\n'), ((2796, 2839), 'numpy.empty', 'np.empty', (['conv.data.shape'], {'dtype': 'np.float32'}), '(conv.data.shape, dtype=np.float32)\n', (2804, 2839), T...
import sys import numpy import scipy from jadapy import Target from jadapy.schur import schur, schur_sort from jadapy.orthogonalization import normalize, orthogonalize, orthonormalize from jadapy.correction_equation import solve_correction_equation, solve_generalized_correction_equation from jadapy.utils import dot, n...
[ "jadapy.utils.norm", "jadapy.utils.dot", "scipy.linalg.eigvals", "jadapy.schur.schur_sort", "jadapy.orthogonalization.normalize", "numpy.zeros", "jadapy.orthogonalization.orthogonalize", "scipy.linalg.eig", "jadapy.correction_equation.solve_correction_equation", "numpy.identity", "jadapy.schur.s...
[((1667, 1698), 'numpy.zeros', 'numpy.zeros', (['(num + extra)', 'ctype'], {}), '(num + extra, ctype)\n', (1678, 1698), False, 'import numpy\n'), ((1729, 1775), 'numpy.zeros', 'numpy.zeros', (['(num + extra, num + extra)', 'dtype'], {}), '((num + extra, num + extra), dtype)\n', (1740, 1775), False, 'import numpy\n'), (...
""" This code runs basic analysis on simulations that were computed using the 'one at a time analysis'. You must provide the path to the csv database with the parameters of each simulation. Functionality: 1. Plot the last concentration profile over the layer stack. 2. Plot the Rsh(t) estimated with the series resist...
[ "pnptransport.utils.geometric_series_spaced", "numpy.amin", "matplotlib.cm.get_cmap", "pandas.read_csv", "numpy.empty", "matplotlib.pyplot.figure", "numpy.arange", "os.path.join", "pandas.DataFrame", "matplotlib.colors.Normalize", "matplotlib.pyplot.close", "os.path.dirname", "matplotlib.rcP...
[((2533, 2561), 'os.path.dirname', 'os.path.dirname', (['path_to_csv'], {}), '(path_to_csv)\n', (2548, 2561), False, 'import os\n'), ((2582, 2626), 'os.path.join', 'os.path.join', (['working_path', '"""batch_analysis"""'], {}), "(working_path, 'batch_analysis')\n", (2594, 2626), False, 'import os\n'), ((2970, 3013), 'p...
""" Created on: 30 June 2019 Investigate stationarity of time series (example of security data), analytics on log-returns Provide summary statistics on the data Introduce tests (such as Augmented Dickey Fuller) to check stationarity of time series Inspiration from: https://www.analyticsvidhya.com/blog/2018/09/non-stat...
[ "pandas.DataFrame", "statsmodels.tsa.stattools.adfuller", "yfinance.download", "numpy.random.randn", "numpy.std", "datetime.datetime.now", "scipy.stats.skew", "matplotlib.pyplot.style.use", "numpy.min", "numpy.max", "pandas.Series", "scipy.stats.kurtosis", "numpy.sqrt", "pandas.set_option"...
[((601, 641), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(10)'], {}), "('display.max_columns', 10)\n", (614, 641), True, 'import pandas as pd\n'), ((642, 677), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(500)'], {}), "('display.width', 500)\n", (655, 677), True, 'import p...
import math import numpy as np #------------------------------------------------------------------------- ''' Problem 2: Multi-armed bandit problem In this problem, you will implement an AI player for Multi-armed bandit problem using UCB (Upper Confidence Bound). The main goal of this problem is to get fa...
[ "numpy.zeros", "numpy.random.choice" ]
[((1996, 2043), 'numpy.random.choice', 'np.random.choice', (['[0.0, 1.0]', '(1)'], {'p': '[1.0 - p, p]'}), '([0.0, 1.0], 1, p=[1.0 - p, p])\n', (2012, 2043), True, 'import numpy as np\n'), ((3328, 3339), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (3336, 3339), True, 'import numpy as np\n'), ((3356, 3367), 'numpy....
#!/usr/bin/env python """A script to run a set of gaussian process experiments under differing configurations.""" import argparse import json from multiprocessing.pool import Pool import numpy as np from experiments import setup_experiment EXPERIMENTS = { 'airline': setup_experiment.airline_experiment, 'bos...
[ "numpy.random.seed", "argparse.ArgumentParser", "multiprocessing.pool.Pool" ]
[((1223, 1240), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1237, 1240), True, 'import numpy as np\n'), ((2040, 2173), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Experimental framework for savigp."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}),...
""" The Tornado Framework By <NAME> University of Ottawa, Ontario, Canada E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com """ import copy import random import numpy from pympler import asizeof from archiver.archiver import Archiver from evaluators.classifier_evaluator import Predi...
[ "copy.copy", "numpy.max", "numpy.mean", "evaluators.detector_evaluator.DriftDetectionEvaluator.calculate_dl_tp_fp_fn", "random.seed", "archiver.archiver.Archiver.archive_single", "pympler.asizeof.asizeof" ]
[((1972, 1996), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (1983, 1996), False, 'import random\n'), ((7008, 7148), 'evaluators.detector_evaluator.DriftDetectionEvaluator.calculate_dl_tp_fp_fn', 'DriftDetectionEvaluator.calculate_dl_tp_fp_fn', (['self.__located_drift_points', 'self.__actual_...
import numpy as np from solver import mmica def whitening(Y, mode='sph'): ''' Whitens the data Y using sphering or pca ''' R = np.dot(Y, Y.T) / Y.shape[1] U, D, _ = np.linalg.svd(R) if mode == 'pca': W = U.T / np.sqrt(D)[:, None] Z = np.dot(W, Y) elif mode == 'sph': ...
[ "numpy.random.RandomState", "solver.mmica", "numpy.linalg.svd", "numpy.dot", "numpy.sqrt" ]
[((480, 504), 'numpy.random.RandomState', 'np.random.RandomState', (['(3)'], {}), '(3)\n', (501, 504), True, 'import numpy as np\n'), ((722, 734), 'numpy.dot', 'np.dot', (['A', 'S'], {}), '(A, S)\n', (728, 734), True, 'import numpy as np\n'), ((882, 924), 'solver.mmica', 'mmica', (['X_white'], {'max_iter': '(101)', 've...
# -*-coding:utf-8-*- import numpy as np import pickle import cv2 import os import tarfile import sys import glob import math import tensorflow as tf from six.moves import urllib ''' for data reading and data augmentation ''' def generate_vali_batch(vali_data, vali_label, vali_batch_size): offset = np.random.choi...
[ "tensorflow.image.resize_nearest_neighbor", "tensorflow.reshape", "tensorflow.multiply", "pickle.load", "numpy.random.randint", "numpy.mean", "sys.stdout.flush", "glob.glob", "tensorflow.greater_equal", "tensorflow.greater", "tensorflow.split", "os.path.join", "numpy.sqrt", "numpy.pad", ...
[((1486, 1518), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': '(2)'}), '(low=0, high=2)\n', (1503, 1518), True, 'import numpy as np\n'), ((2990, 3028), 'os.path.join', 'os.path.join', (['dest_directory', 'filename'], {}), '(dest_directory, filename)\n', (3002, 3028), False, 'import os\n'), ((...
"""Test EC-EARTH fixes.""" import unittest import numpy as np from cf_units import Unit from iris.coords import DimCoord from iris.cube import Cube, CubeList from esmvalcore.cmor._fixes.cmip5.ec_earth import Areacello, Sftlf, Sic, Tas from esmvalcore.cmor.fix import Fix class TestSic(unittest.TestCase): """Test...
[ "esmvalcore.cmor._fixes.cmip5.ec_earth.Sftlf", "esmvalcore.cmor._fixes.cmip5.ec_earth.Areacello", "esmvalcore.cmor.fix.Fix.get_fixes", "numpy.ones", "esmvalcore.cmor._fixes.cmip5.ec_earth.Tas", "iris.coords.DimCoord", "iris.cube.Cube", "cf_units.Unit", "esmvalcore.cmor._fixes.cmip5.ec_earth.Sic" ]
[((405, 443), 'iris.cube.Cube', 'Cube', (['[1.0]'], {'var_name': '"""sic"""', 'units': '"""J"""'}), "([1.0], var_name='sic', units='J')\n", (409, 443), False, 'from iris.cube import Cube, CubeList\n'), ((463, 472), 'esmvalcore.cmor._fixes.cmip5.ec_earth.Sic', 'Sic', (['None'], {}), '(None)\n', (466, 472), False, 'from ...
# -*- coding: utf-8 -*- """ Created on Mon Feb 11 15:45:02 2019 @author: huisunum """ import pickle import numpy as np import solver import logistic import svm import softmax with open('data.pkl', 'rb') as f: data = pickle.load(f, encoding='latin1') print(np.shape(data[0][0:500, :])) x_test = ...
[ "solver.Solver", "solver.train", "solver.check_accuracy", "numpy.shape", "pickle.load", "svm.SVM" ]
[((590, 637), 'svm.SVM', 'svm.SVM', ([], {'input_dim': '(20)', 'hidden_dim': '(16)', 'reg': '(0.018)'}), '(input_dim=20, hidden_dim=16, reg=0.018)\n', (597, 637), False, 'import svm\n'), ((648, 809), 'solver.Solver', 'solver.Solver', (['model', 'data_input'], {'update_rule': '"""sgd"""', 'optim_config': "{'learning_rat...
import heterocl as hcl import numpy as np def test_slice_op(): hcl.init() def kernel(A): return hcl.compute(A.shape, lambda x: A[x][8:0] + A[x][16:8]) A = hcl.placeholder((10,)) s = hcl.create_schedule(A, kernel) f = hcl.build(s) np_A = np.random.randint(10, size=(10,)) np_B = n...
[ "heterocl.compute", "numpy.zeros", "heterocl.placeholder", "numpy.random.randint", "heterocl.build", "heterocl.create_schedule", "heterocl.init", "numpy.array_equal", "heterocl.asarray" ]
[((69, 79), 'heterocl.init', 'hcl.init', ([], {}), '()\n', (77, 79), True, 'import heterocl as hcl\n'), ((179, 201), 'heterocl.placeholder', 'hcl.placeholder', (['(10,)'], {}), '((10,))\n', (194, 201), True, 'import heterocl as hcl\n'), ((210, 240), 'heterocl.create_schedule', 'hcl.create_schedule', (['A', 'kernel'], {...
#! /usr/bin/python # -*- coding: utf-8 -*- import glob import logging import os import subprocess import sys import zipfile import numpy as np # import traceback logger = logging.getLogger(__name__) import argparse if sys.version_info < (3, 0): import urllib as urllibr else: import urllib.request as urllib...
[ "os.path.abspath", "subprocess.Popen", "os.remove", "os.path.join", "fileinput.input", "os.path.isdir", "subprocess.check_output", "shutil.copy2", "numpy.zeros", "os.path.exists", "urllib.request.urlretrieve", "numpy.random.random", "subprocess.call", "re.search", "platform.system", "o...
[((174, 201), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (191, 201), False, 'import logging\n'), ((407, 432), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (422, 432), False, 'import os\n'), ((917, 1027), 'subprocess.check_output', 'subprocess.check_output'...
from config import Options import json import os import scipy.io as sio import numpy as np def options_to_json(options): keys = [a for a in dir(options) if not a.startswith('__')] b = dict() for k in keys: b[k] = getattr(options,k) return json.dumps(b) def save_options_to_file(options, filepath): with o...
[ "h5py.File", "json.load", "config.Options", "scipy.io.loadmat", "tensorflow.python.tools.inspect_checkpoint.print_tensors_in_checkpoint_file", "numpy.asarray", "numpy.zeros", "scipy.io.savemat", "json.dumps", "numpy.transpose", "cv2.imread", "numpy.reshape", "os.path.join", "cv2.resize" ]
[((252, 265), 'json.dumps', 'json.dumps', (['b'], {}), '(b)\n', (262, 265), False, 'import json\n'), ((437, 446), 'config.Options', 'Options', ([], {}), '()\n', (444, 446), False, 'from config import Options\n'), ((682, 691), 'config.Options', 'Options', ([], {}), '()\n', (689, 691), False, 'from config import Options\...
import numpy as np from keras.models import Sequential from keras.utils import to_categorical from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau from sklearn.metrics import confusion_matrix from sklearn.metrics import classification_report from keras.layers import Dense, Conv2D, Flatten, Drop...
[ "numpy.load", "numpy.argmax", "keras.models.Sequential", "sklearn.metrics.classification_report", "numpy.random.normal", "numpy.copy", "keras.layers.Flatten", "numpy.max", "keras.callbacks.ReduceLROnPlateau", "keras.utils.to_categorical", "keras.callbacks.ModelCheckpoint", "keras.layers.Dropou...
[((378, 414), 'numpy.load', 'np.load', (['"""saved/indoor_X_train_.npy"""'], {}), "('saved/indoor_X_train_.npy')\n", (385, 414), True, 'import numpy as np\n'), ((421, 458), 'numpy.load', 'np.load', (['"""saved/outdoor_X_train_.npy"""'], {}), "('saved/outdoor_X_train_.npy')\n", (428, 458), True, 'import numpy as np\n'),...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Table 4 Correlations with Kappa import our_plot_config from our_plot_config import derived_dir, tab_dir import pandas as pd import numpy as np import re # for regressions import pyhdfe from sklearn import datasets, linear_model import statsmodels.formula.api as smf fro...
[ "pandas.DataFrame", "numpy.log", "pyhdfe.create", "numpy.var", "statsmodels.formula.api.ols", "pandas.read_parquet", "statsmodels.iolib.summary2.summary_col", "re.sub" ]
[((1021, 1045), 'numpy.log', 'np.log', (["df['market_cap']"], {}), "(df['market_cap'])\n", (1027, 1045), True, 'import numpy as np\n'), ((1581, 1656), 'pyhdfe.create', 'pyhdfe.create', (["df2[['pair_fe', 'quarter_fe']].values"], {'drop_singletons': '(False)'}), "(df2[['pair_fe', 'quarter_fe']].values, drop_singletons=F...
import os os.chdir("G:/My Drive/EverythingElseBackup/Python_fun_projects/Wordle_solver") import pandas as pd import numpy as np import scipy as sp import csv from numpy import loadtxt from collections import Counter from itertools import compress import pandas as pd pl = open('possible.txt', 'r').read().r...
[ "pandas.DataFrame", "numpy.char.find", "numpy.zeros", "numpy.mean", "os.chdir" ]
[((11, 89), 'os.chdir', 'os.chdir', (['"""G:/My Drive/EverythingElseBackup/Python_fun_projects/Wordle_solver"""'], {}), "('G:/My Drive/EverythingElseBackup/Python_fun_projects/Wordle_solver')\n", (19, 89), False, 'import os\n'), ((1627, 1661), 'numpy.zeros', 'np.zeros', (['(rrun, 50)'], {'dtype': 'object'}), '((rrun, 5...
#!/usr/bin/env python import numpy as np def getEqns(N): """ String representations of equations to solve for N external particles. """ for i in reversed(range(2, N)): print("r_{} = {}u^{} - {}u^{}".format(i-1, N-i+1, N-i, N-i, N-i+1)) def mkData(N, npoint=100): U=np.linspace(0,1,npoint...
[ "matplotlib.pyplot.show", "numpy.std", "numpy.empty", "matplotlib.pyplot.scatter", "time.time", "matplotlib.pyplot.style.use", "numpy.mean", "numpy.linspace", "numpy.random.rand", "numpy.sqrt" ]
[((298, 323), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'npoint'], {}), '(0, 1, npoint)\n', (309, 323), True, 'import numpy as np\n'), ((574, 597), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (587, 597), True, 'import matplotlib.pyplot as plt\n'), ((1216, 1232), 'numpy...
# This file create a new drug-protein association matrix based on shortest-path calculations. import numpy as np import csv import networkx as nx import joblib from tqdm import tqdm import pandas as pd with open('./data/DrugsToProteins.txt', "r") as f: R_DP = [element.split() for element in f.readlines()] f.clo...
[ "networkx.shortest_path_length", "numpy.save", "numpy.zeros", "networkx.has_path", "networkx.DiGraph" ]
[((885, 897), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (895, 897), True, 'import networkx as nx\n'), ((1109, 1127), 'numpy.zeros', 'np.zeros', (['(n2, n3)'], {}), '((n2, n3))\n', (1117, 1127), True, 'import numpy as np\n'), ((1632, 1675), 'numpy.save', 'np.save', (['"""R23_enhanced_matrix.npy"""', 'R23_new']...
from math import * from prettytable import PrettyTable import numpy as np def solutions(): # x1, x2 = -7, 12 # dx = 1 x1, x2 = map(float, input('x1, x2: ').split()) dx = float(input('dx: ')) table = PrettyTable() table.field_names = ["x", "value"] rad = 3 rad = pow(rad, 2) for i in np...
[ "numpy.arange", "prettytable.PrettyTable" ]
[((222, 235), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (233, 235), False, 'from prettytable import PrettyTable\n'), ((318, 339), 'numpy.arange', 'np.arange', (['x1', 'x2', 'dx'], {}), '(x1, x2, dx)\n', (327, 339), True, 'import numpy as np\n')]
# Copyright 2020 The Google Research 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 agree...
[ "torch_scae.math_ops.normalize", "torch.distributions.Bernoulli", "torch_scae.math_ops.cross_entropy_safe", "torch.argmax", "torch_scae.math_ops.log_safe", "torch.cat", "torch.rand_like", "torch.arange", "torch.ones", "monty.collections.AttrDict", "torch_scae.nn_ext.MLP", "torch.distributions....
[((17341, 17377), 'torch_scae.math_ops.normalize', 'math_ops.normalize', (['caps_presence', '(1)'], {}), '(caps_presence, 1)\n', (17359, 17377), False, 'from torch_scae import cv_ops, math_ops\n'), ((17409, 17466), 'torch_scae.math_ops.cross_entropy_safe', 'math_ops.cross_entropy_safe', (['within_prob', '(within_prob *...
# 0.7908 ± 0.0024 import argparse import torch from tqdm import tqdm import torch.nn.functional as F from torch_geometric.data import GraphSAINTRandomWalkSampler, NeighborSampler from torch_geometric.nn import SAGEConv from torch_geometric.utils import subgraph from ogb.nodeproppred import PygNodePropPredDataset, E...
[ "argparse.ArgumentParser", "torch.nn.functional.dropout", "ogb.nodeproppred.PygNodePropPredDataset", "torch_geometric.utils.subgraph", "torch.cat", "numpy.mean", "torch.device", "torch.no_grad", "numpy.std", "torch_geometric.data.NeighborSampler", "torch.nn.functional.nll_loss", "torch.nn.func...
[((360, 387), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../.."""'], {}), "(0, '../..')\n", (375, 387), False, 'import sys\n'), ((3011, 3026), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3024, 3026), False, 'import torch\n'), ((3867, 3955), 'torch_geometric.utils.subgraph', 'subgraph', (['mask', 'data....
"""Unit tests for soundings.py.""" import copy import unittest import numpy import pandas from gewittergefahr.gg_utils import soundings from gewittergefahr.gg_utils import nwp_model_utils from gewittergefahr.gg_utils import storm_tracking_utils as tracking_utils from gewittergefahr.gg_utils import temperature_conversi...
[ "gewittergefahr.gg_utils.nwp_model_utils.get_lowest_height_name", "gewittergefahr.gg_utils.soundings._get_nwp_fields_for_sounding", "numpy.allclose", "gewittergefahr.gg_utils.moisture_conversions.specific_humidity_to_dewpoint", "numpy.full", "pandas.DataFrame", "unittest.main", "gewittergefahr.gg_util...
[((638, 688), 'gewittergefahr.gg_utils.nwp_model_utils.get_lowest_height_name', 'nwp_model_utils.get_lowest_height_name', (['MODEL_NAME'], {}), '(MODEL_NAME)\n', (676, 688), False, 'from gewittergefahr.gg_utils import nwp_model_utils\n'), ((742, 797), 'gewittergefahr.gg_utils.nwp_model_utils.get_lowest_temperature_name...
import numpy as np from hips import LPStatus, HeuristicStatus from hips.heuristics._heuristic import Heuristic from hips.models import MIPModel, Variable, HIPSArray class SimpleRounding(Heuristic): """ Implements a simple rounding heuristic, that rounds each integer variable to the closest integer of the rela...
[ "numpy.rint" ]
[((826, 844), 'numpy.rint', 'np.rint', (['var_value'], {}), '(var_value)\n', (833, 844), True, 'import numpy as np\n')]
import numpy as np import torch as t def bbox_iou(bbox1,bbox2): """计算bbox1=(x1,y1,x2,y2)和bbox2=(x3,y3,x4,y4)两个bbox的iou""" intersect_bbox = [0., 0., 0., 0.] # bbox1和bbox2的交集 if bbox1[2]<bbox2[0] or bbox1[0]>bbox2[2] or bbox1[3]<bbox2[1] or bbox1[1]>bbox2[3]: pass else: intersect_bbox[0]...
[ "dataset.tiny_dataset", "torch.ones", "torch.utils.data.DataLoader", "torch.argmax", "torch.cat", "torch.meshgrid", "torch.exp", "numpy.arange", "torch.max", "torch.arange", "torch.device", "torch.zeros", "torch.log", "torch.tensor" ]
[((986, 1103), 'torch.tensor', 't.tensor', (['[[101.30232, 65.9907], [84.436264, 106.35694], [48.126507, 66.313255]]'], {'dtype': 't.float32', 'device': 'device'}), '([[101.30232, 65.9907], [84.436264, 106.35694], [48.126507, \n 66.313255]], dtype=t.float32, device=device)\n', (994, 1103), True, 'import torch as t\n...
import os import tensorflow if tensorflow.__version__ >= '2': from tensorflow.keras.initializers import RandomNormal from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers import Input, Conv3D, ReLU, PReLU, BatchNormalization, Add, Concatenate, Cropping3D from tensorflow...
[ "tempfile.NamedTemporaryFile", "matplotlib.image.imread", "matplotlib.pyplot.imshow", "keras.layers.Cropping3D", "keras.models.Model", "matplotlib.pyplot.draw", "keras.layers.Concatenate", "keras.utils.plot_model", "matplotlib.use", "keras.layers.Add", "keras.layers.ReLU", "keras.layers.Input"...
[((664, 684), 'os.getenv', 'os.getenv', (['"""DISPLAY"""'], {}), "('DISPLAY')\n", (673, 684), False, 'import os\n'), ((694, 708), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (701, 708), True, 'import matplotlib as mpl\n'), ((4770, 4802), 'keras.models.Model', 'Model', ([], {'inputs': 'inputs', 'outpu...