code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# ---------------------------------------------------------- # # ---------------------- surveycomp.py --------------------- # # --------- https://github.com/jhoormann/RMCodeDump -------- # # ---------------------------------------------------------- # # Figure with SDSS RM comparison: # # got...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.yscale", "astropy.io.ascii.read", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.yticks", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotli...
[((775, 811), 'astropy.io.ascii.read', 'ascii.read', (['"""OzDES_Predict_King.txt"""'], {}), "('OzDES_Predict_King.txt')\n", (785, 811), False, 'from astropy.io import ascii\n'), ((1285, 1359), 'numpy.array', 'np.array', (["[dat['lagErrLower_hb'][minmask], dat['lagErrUpper_hb'][minmask]]"], {}), "([dat['lagErrLower_hb'...
""" Author: <NAME>. This code is written for the 3D-Human-Action-Recognition Project, started March 14 2014. """ import numpy as np import itertools class RS: """ This class generates random selection of the dataset """ def __init__(self, nbr_of_class=10, nbr_of_folds=10, ratio=...
[ "itertools.chain.from_iterable", "numpy.size", "numpy.zeros" ]
[((566, 593), 'numpy.zeros', 'np.zeros', (['(1, nbr_of_class)'], {}), '((1, nbr_of_class))\n', (574, 593), True, 'import numpy as np\n'), ((626, 653), 'numpy.zeros', 'np.zeros', (['(1, nbr_of_class)'], {}), '((1, nbr_of_class))\n', (634, 653), True, 'import numpy as np\n'), ((685, 712), 'numpy.zeros', 'np.zeros', (['(1...
import numpy as np def get_data(seed=101, mix_dim=6, task_type='linear', samples=4000): # 10kHz, 4000 samples by default # This version of the task adds laplacian noise as a source and uses a # non-linear partially non-invertible, possibly overdetermined, # transformation. np.random.seed(seed) ...
[ "numpy.stack", "numpy.random.uniform", "numpy.random.seed", "numpy.tanh", "numpy.random.laplace", "numpy.sin", "numpy.linspace", "numpy.cos", "numpy.dot" ]
[((296, 316), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (310, 316), True, 'import numpy as np\n'), ((325, 366), 'numpy.linspace', 'np.linspace', (['(0)', '(samples * 0.0001)', 'samples'], {}), '(0, samples * 0.0001, samples)\n', (336, 366), True, 'import numpy as np\n'), ((440, 464), 'numpy.sin...
import pyqtgraph as pg from .__function__ import Function as _F from scipy import signal import pandas as pd import copy import numpy as np class Function(_F): def calc(self, srcSeries, f_Hz, **kwargs): f_Hz = float(f_Hz) fs = 1.0/srcSeries.attrs["_ts"] order = int(kwargs.get("order",2)) ...
[ "pandas.Series", "copy.copy", "scipy.signal.bessel", "numpy.gradient" ]
[((360, 394), 'scipy.signal.bessel', 'signal.bessel', (['order', 'fnorm', '"""low"""'], {}), "(order, fnorm, 'low')\n", (373, 394), False, 'from scipy import signal\n'), ((476, 517), 'pandas.Series', 'pd.Series', (['newvals'], {'index': 'srcSeries.index'}), '(newvals, index=srcSeries.index)\n', (485, 517), True, 'impor...
''' PyFerret external function providing data partitioned into pieces along the ensemble axis. Each partition is the data explained by a single Empirical Orthogonal Function (EOF) and its corresponding Time Amplitude Funtion (TAF) @author: <NAME> ''' from __future__ import print_function import numpy import pyfe...
[ "numpy.outer", "pyferret.get_axis_info", "numpy.deg2rad", "pyferret.eofanal.EOFAnalysis", "pyferret.get_arg_one_val", "numpy.allclose", "numpy.zeros", "numpy.logical_and.reduce", "numpy.fabs", "numpy.array", "numpy.linspace", "numpy.cos", "numpy.log10" ]
[((2025, 2070), 'pyferret.get_arg_one_val', 'pyferret.get_arg_one_val', (['efid', 'pyferret.ARG3'], {}), '(efid, pyferret.ARG3)\n', (2049, 2070), False, 'import pyferret\n'), ((4218, 4278), 'numpy.logical_and.reduce', 'numpy.logical_and.reduce', (['defined_data'], {'axis': 'pyferret.T_AXIS'}), '(defined_data, axis=pyfe...
import numpy as np import pandas as pd from collections import namedtuple import sys def get_sample_quality(input_eventlog, input_sample): # print results to console as well? # 0 = no || 1 = yes also_print_to_console = 0 # set custom na values (exludes "NA" to keep lines with Case ID "NA") custom_...
[ "numpy.count_nonzero", "numpy.sum", "pandas.read_csv", "numpy.nanstd", "numpy.zeros", "numpy.nanmean" ]
[((477, 575), 'pandas.read_csv', 'pd.read_csv', (['input_eventlog'], {'delimiter': '""";"""', 'keep_default_na': '(False)', 'na_values': 'custom_na_values'}), "(input_eventlog, delimiter=';', keep_default_na=False, na_values\n =custom_na_values)\n", (488, 575), True, 'import pandas as pd\n'), ((588, 684), 'pandas.re...
"""Bigquery Custom Module Module serves for custome classes and functions to access Google's bigquery """ # IMPORTS # ------- # internal constants __ENV_VAR_NAME__ = "GOOGLE_APPLICATION_CREDENTIALS" # Standard libraries import os import numpy as np import pandas as pd import ipdb # 3rd party libraries from googl...
[ "numpy.array", "pandas.option_context" ]
[((6910, 6956), 'pandas.option_context', 'pd.option_context', (['"""display.max_colwidth"""', '(999)'], {}), "('display.max_colwidth', 999)\n", (6927, 6956), True, 'import pandas as pd\n'), ((3911, 3932), 'numpy.array', 'np.array', (['schema_list'], {}), '(schema_list)\n', (3919, 3932), True, 'import numpy as np\n')]
""" Filename: plot_trend_scatter.py Author: <NAME>, <EMAIL> Description: Calculate metric trend for each model and plot scatter points """ # Import general Python modules import os, sys, pdb import numpy import argparse import iris import matplotlib import matplotlib.pyplot as plt import seaborn #seab...
[ "matplotlib.pyplot.title", "general_io.check_iris_var", "argparse.ArgumentParser", "numpy.polyfit", "os.path.join", "sys.path.append", "matplotlib.pyplot.axvline", "timeseries.calc_trend", "iris.FUTURE.context", "matplotlib.pyplot.subplots", "matplotlib.pyplot.axhline", "matplotlib.pyplot.get_...
[((374, 385), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (383, 385), False, 'import os, sys, pdb\n'), ((554, 587), 'os.path.join', 'os.path.join', (['repo_dir', '"""modules"""'], {}), "(repo_dir, 'modules')\n", (566, 587), False, 'import os, sys, pdb\n'), ((588, 616), 'sys.path.append', 'sys.path.append', (['modules_d...
import numpy as np import argparse import matplotlib.pyplot as plt import cv2 from tensorflow import keras from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Flatten from tensorflow.keras.layers import Conv2D from tensorflow.keras.optimizers import Adam from tens...
[ "numpy.argmax", "cv2.rectangle", "cv2.cvtColor", "keras.layers.Flatten", "cv2.destroyAllWindows", "keras.layers.MaxPooling2D", "cv2.resize", "tensorflow.keras.models.load_model", "cv2.waitKey", "keras.layers.Dropout", "cv2.ocl.setUseOpenCL", "keras.layers.Conv2D", "keras.layers.BatchNormaliz...
[((894, 906), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (904, 906), False, 'from keras.models import Model, Sequential\n'), ((2006, 2041), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""model.h5"""'], {}), "('model.h5')\n", (2029, 2041), False, 'from tensorflow import keras\n'),...
from IPython import display as ipythondisplay from PIL import Image import tensorflow as tf import numpy as np import gym def render_episode(env: gym.Env, model: tf.keras.Model, max_steps: int): screen = env.render(mode="rgb_array") im = Image.fromarray(screen) images = [im] state = tf.constant(env....
[ "PIL.Image.fromarray", "numpy.squeeze", "tensorflow.constant", "tensorflow.expand_dims" ]
[((248, 271), 'PIL.Image.fromarray', 'Image.fromarray', (['screen'], {}), '(screen)\n', (263, 271), False, 'from PIL import Image\n'), ((401, 425), 'tensorflow.expand_dims', 'tf.expand_dims', (['state', '(0)'], {}), '(state, 0)\n', (415, 425), True, 'import tensorflow as tf\n'), ((580, 616), 'tensorflow.constant', 'tf....
#!/usr/bin/env python from __future__ import print_function import argparse import xml.dom.minidom import gsd.fl import gsd.hoomd import numpy from collections import OrderedDict def parse_typenames(typename_list): ntypes = 0; mapping = OrderedDict(); for t in typename_list: if t not in mapping: ...
[ "collections.OrderedDict", "numpy.array", "argparse.ArgumentParser" ]
[((247, 260), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (258, 260), False, 'from collections import OrderedDict\n'), ((398, 466), 'numpy.array', 'numpy.array', (['[mapping[t] for t in typename_list]'], {'dtype': 'numpy.uint32'}), '([mapping[t] for t in typename_list], dtype=numpy.uint32)\n', (409, 466...
# %% [markdown] # # Sample the $k=5$ rules # We need to get a subset of k=5 rules to run PID on that isnt just me picking. # We have a big list of rules sorted by lambda so we can use that. Let's pull # out like 30 from each lambda value or something and make a new list of rules # for PID, other information theoretic ...
[ "numpy.random.default_rng", "casim.CA1D.CA1D", "pandas.DataFrame" ]
[((504, 527), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (525, 527), True, 'import numpy as np\n'), ((1037, 1065), 'casim.CA1D.CA1D', 'CA1D', (['(5)', '(0)'], {'random_seed': '(1234)'}), '(5, 0, random_seed=1234)\n', (1041, 1065), False, 'from casim.CA1D import CA1D\n'), ((1163, 1216), 'pand...
""" Onsager calculator module: Interstitialcy mechanism and Vacancy-mediated mechanism Class to create an Onsager "calculator", which brings two functionalities: 1. determines *what* input is needed to compute the Onsager (mobility, or L) tensors 2. constructs the function that calculates those tensors, given the inpu...
[ "scipy.linalg.solve", "onsager.crystal.yaml.dump", "numpy.sum", "numpy.abs", "onsager.crystalStars.VectorStarSet.loadhdf5", "onsager.GFcalc.GFCrystalcalc", "onsager.crystalStars.doublelist2flatlistindex", "numpy.allclose", "numpy.ones", "numpy.hsplit", "numpy.isclose", "numpy.exp", "numpy.di...
[((31190, 31266), 'collections.namedtuple', 'collections.namedtuple', (['"""vacancyThermoKinetics"""', '"""pre betaene preT betaeneT"""'], {}), "('vacancyThermoKinetics', 'pre betaene preT betaeneT')\n", (31212, 31266), False, 'import copy, collections, itertools, warnings\n'), ((90217, 90330), 'onsager.crystal.yaml.ad...
from __future__ import division, print_function import sys import pytest from numpy.testing import assert_almost_equal from ..lightcurve import LightCurve, KeplerLightCurve, TessLightCurve from ..lightcurvefile import KeplerLightCurveFile from ..correctors import KeplerCBVCorrector, PLDCorrector from ..search import...
[ "numpy.testing.assert_almost_equal", "pytest.mark.skipif" ]
[((1261, 1348), 'pytest.mark.skipif', 'pytest.mark.skipif', (['bad_optional_imports'], {'reason': '"""PLD requires celerite and fbpca"""'}), "(bad_optional_imports, reason=\n 'PLD requires celerite and fbpca')\n", (1279, 1348), False, 'import pytest\n'), ((2959, 3046), 'pytest.mark.skipif', 'pytest.mark.skipif', (['...
# -*- coding: utf-8 -*- """ Created on Sun Dec 6 13:32:42 2020 @author: 11627 """ # loss.py import torch.nn as nn import torch import numpy as np class EntropyLoss(nn.Module): def __init__(self, reduction='mean'): super().__init__() self.reduction = reduction def forwar...
[ "torch.mean", "torch.nn.BCELoss", "numpy.log2", "torch.log2", "torch.sigmoid", "torch.nn.Softmax2d", "torch.sum", "torch.nn.Sigmoid" ]
[((350, 371), 'torch.sigmoid', 'torch.sigmoid', (['logits'], {}), '(logits)\n', (363, 371), False, 'import torch\n'), ((532, 569), 'torch.sum', 'torch.sum', (['elementwise_entropy'], {'dim': '(1)'}), '(elementwise_entropy, dim=1)\n', (541, 569), False, 'import torch\n'), ((657, 680), 'torch.mean', 'torch.mean', (['sum_...
import pandas as pd import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import matplotlib.pyplot as plt import tensorflow as tf import logging tf.get_logger().setLevel(logging.ERROR) import time # import matplotlib.pyplot as plt import cv2 import numpy as np import pickle from sklearn.model_selection import train_test_s...
[ "tensorflow.keras.layers.Cropping2D", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.Reshape", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Concatenate", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.backend.int_shape", "t...
[((142, 157), 'tensorflow.get_logger', 'tf.get_logger', ([], {}), '()\n', (155, 157), True, 'import tensorflow as tf\n'), ((8239, 8274), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(height, width, depth)'}), '(shape=(height, width, depth))\n', (8244, 8274), False, 'from tensorflow.keras.layers import Drop...
# qk2.py # 1D earthquake simulation with slip-weakening friction # author: <NAME> import numpy as np from matplotlib import pyplot as plt import matplotlib.cm as cm class Fault(object): ''' Class and methods that implement 1D crack propoagation with linear slip-weakening friction. ''' # OBJECT METHODS # constru...
[ "matplotlib.pyplot.show", "matplotlib.cm.get_cmap", "numpy.argmax", "numpy.fft.fft", "numpy.zeros", "numpy.max", "numpy.min", "numpy.where", "numpy.exp", "numpy.array", "numpy.log10", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((2500, 2530), 'numpy.zeros', 'np.zeros', (['(self.nx, self.nout)'], {}), '((self.nx, self.nout))\n', (2508, 2530), True, 'import numpy as np\n'), ((2567, 2597), 'numpy.zeros', 'np.zeros', (['(self.nx, self.nout)'], {}), '((self.nx, self.nout))\n', (2575, 2597), True, 'import numpy as np\n'), ((2632, 2662), 'numpy.zer...
import pygame from enum import IntEnum import random from random import randint as rInt import numpy as np import copy from statistics import mean import pickle from lib import GeneticAlgorithm as GA from lib import neuralNetwork as NN from lib import snakesGame class NeuralNets(): def __init__(self): se...
[ "numpy.matrix", "pickle.dump", "lib.GeneticAlgorithm.FitnessProportionateSelection", "lib.GeneticAlgorithm.CrossOverFFNN", "numpy.argsort", "lib.neuralNetwork.NeuralNet", "pickle.load", "statistics.mean" ]
[((2358, 2389), 'pickle.dump', 'pickle.dump', (['save', 'saveFile', '(-1)'], {}), '(save, saveFile, -1)\n', (2369, 2389), False, 'import pickle\n'), ((2554, 2575), 'pickle.load', 'pickle.load', (['saveFile'], {}), '(saveFile)\n', (2565, 2575), False, 'import pickle\n'), ((3416, 3439), 'numpy.argsort', 'np.argsort', (['...
import os import torch import glob import numpy as np import imageio import cv2 import math import time import argparse from model.dehaze_sgid_pff import DEHAZE_SGID_PFF class Traverse_Logger: def __init__(self, result_dir, filename='inference_log.txt'): self.log_file_path = os.path.join(res...
[ "os.mkdir", "argparse.ArgumentParser", "cv2.filter2D", "math.sqrt", "os.path.basename", "torch.load", "imageio.imread", "os.path.exists", "cv2.getGaussianKernel", "time.time", "numpy.mean", "numpy.array", "model.dehaze_sgid_pff.DEHAZE_SGID_PFF", "numpy.squeeze", "torch.no_grad", "os.pa...
[((7983, 8044), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Image-Dehaze-Inference"""'}), "(description='Image-Dehaze-Inference')\n", (8006, 8044), False, 'import argparse\n'), ((304, 338), 'os.path.join', 'os.path.join', (['result_dir', 'filename'], {}), '(result_dir, filename)\n', (...
import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry import json import pandas as pd import numpy as np import pathlib import streamlit as st import getYfData as yfd from time import sleep import time from datetime import datetime from datetime import timedelta from dateutil.r...
[ "pandas.DataFrame", "json.dump", "streamlit.error", "streamlit.cache", "math.ceil", "pandas.merge", "dateutil.relativedelta.relativedelta", "streamlit.write", "time.sleep", "pathlib.Path", "datetime.datetime.strptime", "datetime.timedelta", "requests.get", "getYfData.get_yf_float_outstand_...
[((17366, 17400), 'streamlit.cache', 'st.cache', ([], {'suppress_st_warning': '(True)'}), '(suppress_st_warning=True)\n', (17374, 17400), True, 'import streamlit as st\n'), ((2777, 2817), 'pathlib.Path', 'pathlib.Path', (['f"""{p}"""', 'f"""{filename}.json"""'], {}), "(f'{p}', f'{filename}.json')\n", (2789, 2817), Fals...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from src.TweetParser import TweetParser MAX_SEQUENCE_LENGTH = 250 # The number of of words to consider in each review, extend shorter reviews truncate longer reviews...
[ "numpy.load", "numpy.random.seed", "src.TweetParser.TweetParser", "tensorflow.reset_default_graph", "tensorflow.contrib.rnn.DropoutWrapper", "tensorflow.placeholder", "tensorflow.cast", "tensorflow.train.Saver", "tensorflow.nn.embedding_lookup", "tensorflow.global_variables_initializer", "src.Tw...
[((382, 414), 'numpy.load', 'np.load', (['"""../data/wordsList.npy"""'], {}), "('../data/wordsList.npy')\n", (389, 414), True, 'import numpy as np\n'), ((637, 669), 'numpy.load', 'np.load', (['"""../data/idsMatrix.npy"""'], {}), "('../data/idsMatrix.npy')\n", (644, 669), True, 'import numpy as np\n'), ((747, 800), 'src...
import numpy as np import random as rand class Particle(object): best_pos = None """docstring for Particle""" def __init__(self, initial_position, initial_velocity, initial_fitness): super(Particle).__init__() self.position = initial_position self.velocity = initial_velocity ...
[ "random.random", "numpy.around" ]
[((506, 519), 'random.random', 'rand.random', ([], {}), '()\n', (517, 519), True, 'import random as rand\n'), ((533, 546), 'random.random', 'rand.random', ([], {}), '()\n', (544, 546), True, 'import random as rand\n'), ((788, 817), 'numpy.around', 'np.around', (['result'], {'decimals': '(4)'}), '(result, decimals=4)\n'...
import torch import numpy as np import mmcv def reduce_vision(x,mask_size): quater_size = mask_size // 4 base = ((0,quater_size*2),(quater_size,quater_size*3),(quater_size*2,quater_size*4)) layers = [x[:,i:i+1][:,:,base[i%3][0]:base[i%3][1],base[i//3][0]:base[i//3][1]] for i in range(9)] layers = torch...
[ "torch.Tensor", "numpy.zeros", "torch.cat", "torch.FloatTensor" ]
[((315, 339), 'torch.cat', 'torch.cat', (['layers'], {'dim': '(1)'}), '(layers, dim=1)\n', (324, 339), False, 'import torch\n'), ((494, 556), 'torch.cat', 'torch.cat', (['[res.pos_bboxes for res in sampling_results]'], {'dim': '(0)'}), '([res.pos_bboxes for res in sampling_results], dim=0)\n', (503, 556), False, 'impor...
import random import numpy as np D = 0 C = 1 def strategy(hist, mem): turns = hist.shape[1] if turns == 0: return D, [5, 0] if turns < 5: if hist[1,-1] == C: mem[1] += 1 return D, mem window = mem[0] sucker = mem[1] sucker -= 0.25 if hist[1,-1] == C: if hist[0,-1] == C:...
[ "numpy.sum" ]
[((608, 633), 'numpy.sum', 'np.sum', (['hist[1, -window:]'], {}), '(hist[1, -window:])\n', (614, 633), True, 'import numpy as np\n')]
# import the pygame module, so you can use it from paddle import Paddle from ball4sol import Ball #hack: put constants in a tuple from collections import namedtuple import pygame import numpy as np import csv #Tutorial from: # https://dr0id.bitbucket.io/legacy/pygame_tutorial00.html # define a main function def main...
[ "csv.writer", "pygame.event.get", "pygame.display.set_mode", "pygame.Color", "pygame.Rect", "joblib.load", "pygame.init", "pygame.display.update", "numpy.random.randint", "numpy.array", "collections.namedtuple", "pygame.time.get_ticks", "pygame.display.set_caption", "pygame.time.Clock", ...
[((369, 382), 'pygame.init', 'pygame.init', ([], {}), '()\n', (380, 382), False, 'import pygame\n'), ((387, 430), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Pong ML Train"""'], {}), "('Pong ML Train')\n", (413, 430), False, 'import pygame\n'), ((757, 832), 'collections.namedtuple', 'namedtuple', ...
import control import numpy as np class Control: def __init__(self, model): # Bind model self.model = model # Desired x_pos self.xd = 0.0 # Compute desired K if self.model.name == 'Pendulum': desired_eigenvalues = [-2, -8, -9, -10...
[ "control.place", "numpy.linalg.inv" ]
[((397, 469), 'control.place', 'control.place', (['self.model.A_cont', 'self.model.B_cont', 'desired_eigenvalues'], {}), '(self.model.A_cont, self.model.B_cont, desired_eigenvalues)\n', (410, 469), False, 'import control\n'), ((616, 634), 'numpy.linalg.inv', 'np.linalg.inv', (['Acl'], {}), '(Acl)\n', (629, 634), True, ...
from building import Building from room import Room from course import Course from student import Student import numpy as np import psycopg2 import random import csv from datetime import datetime, timedelta from ctdb_utility_lib.utility import ( _execute_statement, connect_to_db, add_person, add_room, ...
[ "ctdb_utility_lib.utility.connect_to_db", "random.randint", "ctdb_utility_lib.utility._execute_statement", "datetime.datetime", "room.Room", "random.random", "numpy.random.randint", "datetime.timedelta", "course.Course", "building.Building" ]
[((366, 387), 'random.randint', 'random.randint', (['(9)', '(20)'], {}), '(9, 20)\n', (380, 387), False, 'import random\n'), ((402, 417), 'random.random', 'random.random', ([], {}), '()\n', (415, 417), False, 'import random\n'), ((5214, 5258), 'ctdb_utility_lib.utility._execute_statement', '_execute_statement', (['con'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import random random.seed(42) import numpy as np np.random.seed(42) import matplotlib.pyplot as plt import cvxpy as cp from sklearn_lvq import GmlvqModel, LgmlvqModel from sklearn.metrics import roc_auc_score from sklearn.model_selection import train_test_split from sklear...
[ "numpy.random.uniform", "plotting.plot_classification_dataset", "numpy.random.seed", "numpy.abs", "numpy.array_equal", "sklearn.preprocessing.OneHotEncoder", "sklearn.metrics.roc_auc_score", "cvxpy.norm1", "plotting.plot_distmat", "random.seed", "numpy.array", "cvxpy.Problem", "cvxpy.Variabl...
[((61, 76), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (72, 76), False, 'import random\n'), ((96, 114), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (110, 114), True, 'import numpy as np\n'), ((461, 493), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'categories': '"""au...
import os import subprocess import RPi.GPIO as GPIO import time import spidev # To communicate with SPI devices from numpy import interp # To scale values import smbus bus = smbus.SMBus(1) EEPROM = 0x50 # 24LC256 i2c bus address TEMP = 0x4F #os.system("python stats.py") try : bus.writ...
[ "RPi.GPIO.setmode", "spidev.SpiDev", "RPi.GPIO.setup", "os.system", "time.sleep", "RPi.GPIO.PWM", "RPi.GPIO.input", "numpy.interp", "RPi.GPIO.setwarnings", "smbus.SMBus" ]
[((186, 200), 'smbus.SMBus', 'smbus.SMBus', (['(1)'], {}), '(1)\n', (197, 200), False, 'import smbus\n'), ((726, 739), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (736, 739), False, 'import time\n'), ((786, 810), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (798, 810), True, 'impo...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ diego_benchmark/diego_titanic.py was created on 2019/04/06. file in :relativeFile Author: Charles_Lai Email: <EMAIL> """ from sklearn.preprocessing import LabelEncoder from base_benchmark import simple_diego import pandas as pd import numpy as np train_df_raw = pd....
[ "pandas.DataFrame", "pandas.read_csv", "pandas.get_dummies", "pandas.merge", "sklearn.preprocessing.LabelEncoder", "numpy.where", "pandas.Series", "pandas.qcut", "base_benchmark.simple_diego" ]
[((317, 354), 'pandas.read_csv', 'pd.read_csv', (['"""data/titanic/train.csv"""'], {}), "('data/titanic/train.csv')\n", (328, 354), True, 'import pandas as pd\n'), ((369, 405), 'pandas.read_csv', 'pd.read_csv', (['"""data/titanic/test.csv"""'], {}), "('data/titanic/test.csv')\n", (380, 405), True, 'import pandas as pd\...
import numpy as np from PuzzleLib.Backend import gpuarray from PuzzleLib.Backend.Dnn import PoolMode, poolNd, poolNdBackward from PuzzleLib.Modules.Pool3D import Pool3D class AvgPool3D(Pool3D): def __init__(self, size=2, stride=2, pad=0, includePad=True, name=None): super().__init__(size, stride, pad, name) se...
[ "PuzzleLib.Backend.Dnn.poolNd", "numpy.random.randn", "numpy.empty", "numpy.zeros", "numpy.mean", "PuzzleLib.Backend.Dnn.poolNdBackward" ]
[((1063, 1157), 'numpy.zeros', 'np.zeros', ([], {'shape': '(batchsize, maps, d + 2 * pad, h + 2 * pad, w + 2 * pad)', 'dtype': 'np.float32'}), '(shape=(batchsize, maps, d + 2 * pad, h + 2 * pad, w + 2 * pad),\n dtype=np.float32)\n', (1071, 1157), True, 'import numpy as np\n'), ((1228, 1276), 'numpy.empty', 'np.empty...
import os os.environ["CUDA_VISIBLE_DEVICES"] = '1' from datetime import date, datetime, timedelta import pandas as pd from django.forms import model_to_dict from django.http import JsonResponse, QueryDict from django.views.decorators.csrf import csrf_exempt from rest_framework.decorators import api_view from rest_fram...
[ "keras.models.load_model", "userPortrait.text_process.Clean_Cut_Stop", "weiboCrawler.models.WeiboUser.objects.filter", "numpy.sum", "keras.preprocessing.sequence.pad_sequences", "django.http.JsonResponse", "rest_framework.response.Response", "gensim.models.Word2Vec.load", "os.path.join", "weiboCra...
[((764, 789), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (779, 789), False, 'import os\n'), ((802, 844), 'os.path.join', 'os.path.join', (['module_dir', '"""word2vec.model"""'], {}), "(module_dir, 'word2vec.model')\n", (814, 844), False, 'import os\n'), ((880, 918), 'gensim.models.Word2Ve...
""" Module used to analyze the cycles within the data """ import numpy as np def get_pv_inds(test_data, num_per_cycle=2, num_ind_skip=0): """ Get peak and valley indices (can have more than 2 peaks/valleys per cycle) :param test_data: test data as dictionary, must contain 'stp' key with step numbers :typ...
[ "numpy.where", "numpy.sqrt" ]
[((1435, 1477), 'numpy.sqrt', 'np.sqrt', (['(deps ** 2 + 1.0 / 3.0 * dgam ** 2)'], {}), '(deps ** 2 + 1.0 / 3.0 * dgam ** 2)\n', (1442, 1477), True, 'import numpy as np\n'), ((3481, 3541), 'numpy.where', 'np.where', (["(test_data['stp'][1:] - test_data['stp'][:-1] > tol)"], {}), "(test_data['stp'][1:] - test_data['stp'...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Classes to filter lineages. """ from __future__ import print_function import numpy as np from tunacell.filters.main import FilterGeneral, bounded, intersect from tunacell.filters.cells import FilterData from io import StringIO class FilterLineage(FilterGeneral): ...
[ "numpy.amin", "tunacell.filters.main.bounded", "numpy.amax", "tunacell.filters.cells.FilterData", "tunacell.filters.main.intersect" ]
[((3504, 3518), 'numpy.amin', 'np.amin', (['times'], {}), '(times)\n', (3511, 3518), True, 'import numpy as np\n'), ((3534, 3548), 'numpy.amax', 'np.amax', (['times'], {}), '(times)\n', (3541, 3548), True, 'import numpy as np\n'), ((3560, 3645), 'tunacell.filters.main.bounded', 'bounded', (['(tmax - tmin)'], {'lower_bo...
import copy import numpy as np import os import pickle from pprint import pprint from dabstract.utils import safe_import_module from typing import Union, List, Optional, TypeVar, Callable, Dict, Iterable tvProcessingChain = TypeVar("ProcessingChain") class Processor: """base class for processor""" def __i...
[ "copy.deepcopy", "pickle.dump", "dabstract.utils.safe_import_module", "dabstract.abstract.abstract.SelectAbstract", "numpy.shape", "os.path.isfile", "pickle.load", "pprint.pprint", "dabstract.abstract.abstract.MapAbstract", "typing.TypeVar" ]
[((227, 253), 'typing.TypeVar', 'TypeVar', (['"""ProcessingChain"""'], {}), "('ProcessingChain')\n", (234, 253), False, 'from typing import Union, List, Optional, TypeVar, Callable, Dict, Iterable\n'), ((3356, 3377), 'copy.deepcopy', 'copy.deepcopy', (['kwargs'], {}), '(kwargs)\n', (3369, 3377), False, 'import copy\n')...
from argparse import ArgumentParser from pathlib import Path import numpy as np from torch import randperm parser = ArgumentParser() parser.add_argument('lang') parser.add_argument('size', type=int, help='vocab size (in thousands)') parser.add_argument('val-ratio', type=float) args = parser.parse_args() n = args.size...
[ "numpy.load", "numpy.save", "argparse.ArgumentParser", "pathlib.Path" ]
[((117, 133), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (131, 133), False, 'from argparse import ArgumentParser\n'), ((541, 558), 'numpy.load', 'np.load', (['src_path'], {}), '(src_path)\n', (548, 558), True, 'import numpy as np\n'), ((747, 797), 'numpy.save', 'np.save', (['tra_dst_path', 'ind_tra'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This software is under a BSD license. See LICENSE.txt for details. import numpy as np from DTMask import DTMask class DTMeshGrid2D(object): """2D Grid object. This class corresponds to DataTank's DTMeshGrid2D object. """ dt_type = ("2D M...
[ "numpy.squeeze", "numpy.arange", "DTMask.DTMask.from_data_file" ]
[((1129, 1157), 'numpy.arange', 'np.arange', (['x', '(n * dx + x)', 'dx'], {}), '(x, n * dx + x, dx)\n', (1138, 1157), True, 'import numpy as np\n'), ((1176, 1204), 'numpy.arange', 'np.arange', (['y', '(m * dy + y)', 'dy'], {}), '(y, m * dy + y, dy)\n', (1185, 1204), True, 'import numpy as np\n'), ((2417, 2443), 'numpy...
""" Performs logistic Kriging """ import sys import argparse import pickle as pkl import numpy as np import pandas as pd import geopandas as gp import pymc3 as pm from savsnet.logistic2D import logistic2D from savsnet.gis_util import gen_raster, make_masked_raster, raster2coords def get_mean(x): return np.mean(...
[ "savsnet.gis_util.raster2coords", "savsnet.gis_util.gen_raster", "pickle.dump", "numpy.sum", "argparse.ArgumentParser", "pandas.read_csv", "savsnet.gis_util.make_masked_raster", "pymc3.gp.util.kmeans_inducing_points", "savsnet.logistic2D.logistic2D", "numpy.mean", "pandas.to_datetime", "pandas...
[((312, 330), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (319, 330), True, 'import numpy as np\n'), ((548, 619), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fit Binomial GP timeseries model"""'}), "(description='Fit Binomial GP timeseries model')\n", (571, 619...
""" Main code to run our experiments. Usage: main_our [options] main_our -h | --help Options: -h, --help Print this. --dataset=<d> Dataset. --data_directory=<dir> Data directory. --rnn_hidden_neurons=<size> --keep_prob=<value> --learning_r...
[ "sys.stdout.write", "tensorflow.train.Coordinator", "docopt.docopt", "tensorflow.get_collection", "tensorflow.reset_default_graph", "models.ShimaokaClassificationModel.read_local_variables_and_params", "numpy.empty", "pandas.read_csv", "numpy.argmax", "tensorflow.initialize_local_variables", "os...
[((3604, 3626), 'plotly.graph_objs.Figure', 'go.Figure', ([], {'data': 'traces'}), '(data=traces)\n', (3613, 3626), True, 'import plotly.graph_objs as go\n'), ((3631, 3691), 'plotly.offline.plot', 'plotly.offline.plot', (['fig'], {'filename': 'filename', 'auto_open': '(False)'}), '(fig, filename=filename, auto_open=Fal...
# based on https://geoffruddock.com/adaboost-from-scratch-in-python/ from __future__ import annotations from typing import Union import numpy as np from sklearn.tree import DecisionTreeClassifier class AdaBoost: """AdaBoost Parameters: ----------- n_estimators: int Number of weak learners ...
[ "numpy.log", "numpy.zeros", "numpy.ones", "sklearn.tree.DecisionTreeClassifier", "numpy.exp", "numpy.dot" ]
[((439, 481), 'numpy.zeros', 'np.zeros', ([], {'shape': 'n_estimators', 'dtype': 'object'}), '(shape=n_estimators, dtype=object)\n', (447, 481), True, 'import numpy as np\n'), ((511, 539), 'numpy.zeros', 'np.zeros', ([], {'shape': 'n_estimators'}), '(shape=n_estimators)\n', (519, 539), True, 'import numpy as np\n'), ((...
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.colors import LogNorm import matplotlib import os import sys import appaloosa import pandas as pd import datetime import warnings from scipy.optimize import curve_fit, minimize from astropy.stats import funcs import emcee impo...
[ "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.yscale", "appaloosa.analysis.FlareEqn", "numpy.nanmedian", "pandas.read_csv", "appaloosa.analysis._Perror", "appaloosa.analysis.MH2008_age", "numpy.ones", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", ...
[((1186, 1221), 'pandas.read_csv', 'pd.read_csv', (['kicfile'], {'delimiter': '"""|"""'}), "(kicfile, delimiter='|')\n", (1197, 1221), True, 'import pandas as pd\n'), ((1235, 1300), 'pandas.read_table', 'pd.read_table', (['condorfile'], {'delimiter': '""","""', 'skiprows': '(1)', 'header': 'None'}), "(condorfile, delim...
# Author: <NAME> (<EMAIL>) 08/25/2016 """Neural network model base class.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys from utils import util from easydict import EasyDict as edict import numpy as np import tensorflow as tf de...
[ "tensorflow.contrib.layers.xavier_initializer", "tensorflow.reduce_sum", "tensorflow.nn.zero_fraction", "tensorflow.trainable_variables", "tensorflow.clip_by_value", "tensorflow.get_collection", "tensorflow.maximum", "tensorflow.identity", "tensorflow.reshape", "tensorflow.constant_initializer", ...
[((525, 552), 'tensorflow.get_collection', 'tf.get_collection', (['"""losses"""'], {}), "('losses')\n", (542, 552), True, 'import tensorflow as tf\n'), ((721, 752), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['l.op.name', 'l'], {}), '(l.op.name, l)\n', (738, 752), True, 'import tensorflow as tf\n'), ((1115, 118...
# -*- coding: utf-8 -*- """ @date: 2020/5/9 下午8:26 @file: random_mirror.py @author: zj @description: """ from numpy import random class RandomMirror(object): def __call__(self, image, boxes, classes): _, width, _ = image.shape if random.randint(2): image = image[:, ::-1] ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "cv2.cvtColor", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "cv2.imread", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.array" ]
[((546, 588), 'cv2.imread', 'cv2.imread', (['"""../../../datasets/003123.jpg"""'], {}), "('../../../datasets/003123.jpg')\n", (556, 588), False, 'import cv2\n'), ((599, 635), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (611, 635), False, 'import cv2\n'), ((648, 678)...
import math import numpy as np class use_ARIS(object): """ This class is used to convert the atmosphere data that is obtained from ARIS to a useful datatype. It loads in the atmosphere data, converts it to a matrix and converts the Extra Path Length to the precipitable water vapor using the Smith-...
[ "numpy.zeros", "numpy.array", "numpy.concatenate", "math.ceil" ]
[((3101, 3136), 'math.ceil', 'math.ceil', (['(max_distance / self.grid)'], {}), '(max_distance / self.grid)\n', (3110, 3136), False, 'import math\n'), ((4276, 4301), 'numpy.array', 'np.array', (['self.pwv_matrix'], {}), '(self.pwv_matrix)\n', (4284, 4301), True, 'import numpy as np\n'), ((4784, 4959), 'numpy.array', 'n...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 21 13:34:32 2018 # quality metrics @authors: <NAME>, <NAME> """ import numpy as np def nrmse(im1, im2): rmse = np.sqrt(np.sum((im2 - im1) ** 2) / float(im1.size)) max_val = max(np.max(im1), np.max(im2)) min_val = min(np.min(im1), np.min(...
[ "numpy.max", "numpy.sum", "numpy.min" ]
[((256, 267), 'numpy.max', 'np.max', (['im1'], {}), '(im1)\n', (262, 267), True, 'import numpy as np\n'), ((269, 280), 'numpy.max', 'np.max', (['im2'], {}), '(im2)\n', (275, 280), True, 'import numpy as np\n'), ((300, 311), 'numpy.min', 'np.min', (['im1'], {}), '(im1)\n', (306, 311), True, 'import numpy as np\n'), ((31...
import sys import scipy.io as sio from pprint import pprint import matplotlib.pyplot as plt import numpy as np # h(X(i)) = theta_0 + theta_1 * X1(i) def normalize(x): return (x - x.min())/(x.max() - x.min()) # theta = (X.T X)^(-1)(X.T)(Y) def normal_equation(X, y): theta = [] m = np.size(x) b...
[ "matplotlib.pyplot.title", "numpy.size", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.ones", "numpy.append", "matplotlib.pyplot.figure", "numpy.array", "numpy.reshape", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabe...
[((483, 516), 'numpy.array', 'np.array', (['[5, 15, 25, 35, 45, 55]'], {}), '([5, 15, 25, 35, 45, 55])\n', (491, 516), True, 'import numpy as np\n'), ((539, 571), 'numpy.array', 'np.array', (['[15, 11, 2, 8, 25, 32]'], {}), '([15, 11, 2, 8, 25, 32])\n', (547, 571), True, 'import numpy as np\n'), ((733, 759), 'matplotli...
# -*- coding: utf-8 -*- import json import base64 import datetime import io import os import glob import pandas as pd import numpy as np import dash_table import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State from app import app, indicator from core ...
[ "pandas.read_csv", "base64.b64decode", "core.prepare.Prepare", "core.define.Define", "numpy.round", "os.path.join", "app.indicator", "pandas.DataFrame", "dash_html_components.Div", "dash.dependencies.State", "os.path.exists", "core.fselect.Select", "pandas.concat", "io.BytesIO", "core.ev...
[((427, 438), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (436, 438), False, 'import os\n'), ((453, 489), 'os.path.join', 'os.path.join', (['current_path', '"""market"""'], {}), "(current_path, 'market')\n", (465, 489), False, 'import os\n'), ((643, 675), 'base64.b64decode', 'base64.b64decode', (['content_string'], {})...
import unittest import numpy as np import ndhist class Test(unittest.TestCase): def test_ndhist_basic_slicing(self): """Tests if the basic slicing a la numpy works properly. """ axis_0 = ndhist.axes.linear(-1, 3, 1) h = ndhist.ndhist((axis_0,)) self.assertFalse(h.is_view)...
[ "unittest.main", "ndhist.ndhist", "ndhist.axes.linear", "numpy.all" ]
[((2653, 2668), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2666, 2668), False, 'import unittest\n'), ((218, 246), 'ndhist.axes.linear', 'ndhist.axes.linear', (['(-1)', '(3)', '(1)'], {}), '(-1, 3, 1)\n', (236, 246), False, 'import ndhist\n'), ((260, 284), 'ndhist.ndhist', 'ndhist.ndhist', (['(axis_0,)'], {}),...
#判定图像的合成模式 import cv2 import numpy as np import sys from skimage import feature from pathlib import Path def search_hcms(img): ratio_x = 300/img.shape[1] img = cv2.resize(img,dsize=(0,0),dst=None,fx=ratio_x,fy=ratio_x) img = cv2.GaussianBlur(img,(3,3),0.3) # gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ...
[ "cv2.GaussianBlur", "cv2.getTickFrequency", "cv2.waitKey", "cv2.getTickCount", "cv2.imshow", "pathlib.Path", "numpy.where", "numpy.array", "cv2.rectangle", "cv2.destroyAllWindows", "cv2.resize", "cv2.matchTemplate" ]
[((169, 232), 'cv2.resize', 'cv2.resize', (['img'], {'dsize': '(0, 0)', 'dst': 'None', 'fx': 'ratio_x', 'fy': 'ratio_x'}), '(img, dsize=(0, 0), dst=None, fx=ratio_x, fy=ratio_x)\n', (179, 232), False, 'import cv2\n'), ((238, 272), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img', '(3, 3)', '(0.3)'], {}), '(img, (3, 3), ...
from __future__ import print_function, division import scipy #from keras.datasets import mnist #from keras_contrib.layers.normalization import InstanceNormalization from keras.layers import Input, Dense, Reshape, Flatten, Dropout, Concatenate from keras.layers import BatchNormalization, Activation, ZeroPadding2D from ...
[ "numpy.abs", "numpy.ones", "keras.models.Model", "numpy.mean", "keras.layers.Input", "keras.layers.convolutional.UpSampling2D", "matplotlib.pyplot.close", "numpy.add", "matplotlib.pyplot.subplots", "datetime.datetime.now", "numpy.save", "numpy.average", "data_loader_gray.DataLoader", "kera...
[((692, 717), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (710, 717), True, 'import matplotlib.pyplot as plt\n'), ((1038, 1125), 'data_loader_gray.DataLoader', 'DataLoader', ([], {'dataset_name': 'self.dataset_name', 'img_res': '(self.img_rows, self.img_cols)'}), '(datase...
import os from io import BytesIO from urllib.request import urlopen from zipfile import ZipFile import numpy as np import matplotlib.pyplot as plt from scipy.special import xlogy from pandas import DataFrame, Series, concat, qcut, cut from sklearn.model_selection import train_test_split from sklearn.metrics import au...
[ "matplotlib.pyplot.title", "numpy.maximum", "numpy.sum", "sklearn.model_selection.train_test_split", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.unique", "pandas.DataFrame", "numpy.power", "os.path.exists", "urllib.request.urlopen", "numpy.cumsum", "numpy.max", "pan...
[((2530, 2643), 'sklearn.model_selection.train_test_split', 'train_test_split', (['*arrays'], {'random_state': 'random_state', 'shuffle': 'shuffle', 'test_size': 'test_size', 'stratify': 'stratify'}), '(*arrays, random_state=random_state, shuffle=shuffle,\n test_size=test_size, stratify=stratify)\n', (2546, 2643), F...
import cv2 import numpy as np import subprocess cap=cv2.VideoCapture(0) while True: _,gray=cap.read() #gray=cv2.pyrMeanShiftFiltering(gray,10,30) gray=cv2.blur(gray,ksize=(5,5)) gray=cv2.cvtColor(gray,cv2.COLOR_BGR2GRAY) gray=cv2.resize(gray,(300,200)) Sobel=cv2.Sobel(gray,ddep...
[ "cv2.approxPolyDP", "cv2.arcLength", "cv2.boxPoints", "cv2.floodFill", "cv2.minAreaRect", "cv2.rectangle", "cv2.imshow", "cv2.contourArea", "cv2.cvtColor", "cv2.imwrite", "cv2.drawContours", "cv2.destroyAllWindows", "cv2.boundingRect", "cv2.resize", "numpy.int0", "cv2.bitwise_not", "...
[((61, 80), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (77, 80), False, 'import cv2\n'), ((1909, 1932), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1930, 1932), False, 'import cv2\n'), ((178, 206), 'cv2.blur', 'cv2.blur', (['gray'], {'ksize': '(5, 5)'}), '(gray, ksize=(5, 5...
import torch import math import torch.nn.functional as Func import torch.nn as nn import numpy as np import random from nalu import NALU_mutiple_cells from nac import NAC_multiple_cells, Recurrent_NAC #from reccurent_nac import Recurrent_NAC def generate_data_interpolation(arithmetic_type, num_vals_for_sum, num_train,...
[ "numpy.load", "nalu.NALU_mutiple_cells", "torch.sum", "numpy.std", "torch.sqrt", "torch.nn.functional.mse_loss", "torch.FloatTensor", "numpy.mean", "torch.pow", "nac.Recurrent_NAC", "torch.no_grad", "torch.abs", "numpy.random.shuffle", "torch.from_numpy" ]
[((739, 759), 'torch.FloatTensor', 'torch.FloatTensor', (['X'], {}), '(X)\n', (756, 759), False, 'import torch\n'), ((846, 872), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (863, 872), True, 'import numpy as np\n'), ((1503, 1523), 'torch.FloatTensor', 'torch.FloatTensor', (['X'], {}),...
# **************************************************************************** # @test_man_helpers.py # # @copyright 2022 Elektronische Fahrwerksysteme GmbH and Audi AG. All rights reserved. # # @license Apache v2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fil...
[ "numpy.testing.assert_array_equal", "numpy.testing.assert_array_almost_equal_nulp", "os.path.dirname", "osc_generator.tools.man_helpers.calc_opt_acc_thresh", "numpy.array", "osc_generator.tools.man_helpers.label_maneuvers", "os.path.join", "osc_generator.tools.man_helpers.create_speed_model" ]
[((1628, 1698), 'os.path.join', 'os.path.join', (['test_data_dir', '"""2017-04-04_Testfeld_A9_Nord_offset.xodr"""'], {}), "(test_data_dir, '2017-04-04_Testfeld_A9_Nord_offset.xodr')\n", (1640, 1698), False, 'import os\n'), ((1034, 1059), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1049, 1...
import numpy as np import pandas as pd import pyflux as pf # Set up some data to use for the tests noise = np.random.normal(0,1,400) y = np.zeros(400) x1 = np.random.normal(0,1,400) x2 = np.random.normal(0,1,400) for i in range(1,len(y)): y[i] = 0.1*y[i-1] + noise[i] + 0.1*x1[i] - 0.3*x2[i] data = pd.DataFrame([y,...
[ "pandas.DataFrame", "pyflux.Skewt", "numpy.zeros", "numpy.isnan", "numpy.array", "numpy.random.normal" ]
[((109, 136), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(400)'], {}), '(0, 1, 400)\n', (125, 136), True, 'import numpy as np\n'), ((139, 152), 'numpy.zeros', 'np.zeros', (['(400)'], {}), '(400)\n', (147, 152), True, 'import numpy as np\n'), ((158, 185), 'numpy.random.normal', 'np.random.normal', (['(0...
from .base_dataset import BaseDataset from .builder import DATASETS import os import numpy as np @DATASETS.register_module() class MyCvprRobust(BaseDataset): def __init__(self, test_out_path=None, track2_demo_test_out_path=None, *args, **kv): super(MyCvprRobust, self).__init__(*args, **kv) self.t...
[ "json.dump", "numpy.argmax", "os.path.basename", "numpy.max", "numpy.array", "os.path.join", "os.listdir", "numpy.vstack" ]
[((544, 584), 'os.path.join', 'os.path.join', (['self.data_prefix', '"""images"""'], {}), "(self.data_prefix, 'images')\n", (556, 584), False, 'import os\n'), ((611, 654), 'os.path.join', 'os.path.join', (['self.data_prefix', '"""label.txt"""'], {}), "(self.data_prefix, 'label.txt')\n", (623, 654), False, 'import os\n'...
"""Discount functions.""" # Copyright (c) 2022, RTE (https://www.rte-france.com) # See AUTHORS.txt # SPDX-License-Identifier: Apache-2.0 (see LICENSE.txt) # This file is part of ReLife, an open source Python library for asset # management based on reliability theory and lifetime data analysis. from abc import ABC, ab...
[ "numpy.ones_like", "numpy.ma.MaskedArray", "numpy.where", "numpy.exp", "numpy.log1p" ]
[((3007, 3024), 'numpy.exp', 'np.exp', (['(-rate * t)'], {}), '(-rate * t)\n', (3013, 3024), True, 'import numpy as np\n'), ((3289, 3318), 'numpy.ma.MaskedArray', 'np.ma.MaskedArray', (['rate', 'mask'], {}), '(rate, mask)\n', (3306, 3318), True, 'import numpy as np\n'), ((3980, 4009), 'numpy.ma.MaskedArray', 'np.ma.Mas...
#!/usr/bin/env python # standard library from __future__ import division import os import sys import warnings import json import distutils import distutils.dir_util import datetime from collections import OrderedDict # external from pkg_resources import parse_version import numpy as np from sympy import latex from sy...
[ "pythreejs.AnimationMixer", "IPython.html.widgets.HBox", "json.dumps", "pythreejs.AmbientLight", "os.path.join", "warnings.simplefilter", "os.path.dirname", "os.path.exists", "IPython.html.widgets.Button", "IPython.display.display", "IPython.html.widgets.FloatText", "IPython.html.widgets.HTML"...
[((702, 750), 'warnings.simplefilter', 'warnings.simplefilter', (['"""once"""', 'PyDyImportWarning'], {}), "('once', PyDyImportWarning)\n", (723, 750), False, 'import warnings\n'), ((783, 817), 'pkg_resources.parse_version', 'parse_version', (['IPython.__version__'], {}), '(IPython.__version__)\n', (796, 817), False, '...
import numpy as np class AttnResult(): """A class just to store the results of analyze_attn_dep""" def __init__(self, L, H, dependencies, dmax=0, BOS=False, cats=None, delta=10): D = len(dependencies) self.score_dep = np.zeros((L, H, len(dependencies), 2, 2)) # The [L,H,D,2,2] array counting...
[ "numpy.zeros" ]
[((573, 601), 'numpy.zeros', 'np.zeros', (['(D, 2 * delta + 1)'], {}), '((D, 2 * delta + 1))\n', (581, 601), True, 'import numpy as np\n'), ((730, 756), 'numpy.zeros', 'np.zeros', (['(2 * delta + 1,)'], {}), '((2 * delta + 1,))\n', (738, 756), True, 'import numpy as np\n'), ((837, 851), 'numpy.zeros', 'np.zeros', (['(D...
from itertools import combinations import numpy as np from sklearn.metrics import auc, roc_curve import torch from src.metrics import Meter, frr, far class FVMeter(Meter): def __init__(self, dist='euclidean', override_name='fv_meter'): """ abstract class of metrics for a given verification probl...
[ "numpy.zeros_like", "numpy.sum", "numpy.ones_like", "sklearn.metrics.roc_curve", "torch.norm", "numpy.zeros", "numpy.hstack", "sklearn.metrics.auc", "numpy.sort", "numpy.array", "src.metrics.frr", "torch.sum" ]
[((515, 547), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {'dtype': 'np.int32'}), '((2, 2), dtype=np.int32)\n', (523, 547), True, 'import numpy as np\n'), ((4600, 4627), 'numpy.sum', 'np.sum', (['(recognized * labels)'], {}), '(recognized * labels)\n', (4606, 4627), True, 'import numpy as np\n'), ((4658, 4693), 'numpy.sum'...
""" Copyright (c) 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
[ "numpy.ones_like", "sklearn.model_selection.train_test_split", "numpy.square", "pgbm_nb.PGBM", "datasets.get_dataset", "datasets.get_fold" ]
[((1657, 1677), 'datasets.get_dataset', 'get_dataset', (['dataset'], {}), '(dataset)\n', (1668, 1677), False, 'from datasets import get_dataset, get_fold\n'), ((1713, 1739), 'datasets.get_fold', 'get_fold', (['dataset', 'data', '(0)'], {}), '(dataset, data, 0)\n', (1721, 1739), False, 'from datasets import get_dataset,...
import numpy as np import json from glob import glob import h5py import pandas as pd from scipy.ndimage import zoom as imresize import sys import os.path from scipy.linalg import inv import torch import torchvision import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import utils class T...
[ "h5py.File", "numpy.concatenate", "pandas.read_csv", "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.expand_dims", "utils.min_max_normalize", "numpy.int", "numpy.random.permutation", "numpy.intersect1d", "sys.exit" ]
[((566, 592), 'pandas.read_csv', 'pd.read_csv', (['self.data_csv'], {}), '(self.data_csv)\n', (577, 592), True, 'import pandas as pd\n'), ((1090, 1134), 'numpy.random.permutation', 'np.random.permutation', (['num_positive_subjects'], {}), '(num_positive_subjects)\n', (1111, 1134), True, 'import numpy as np\n'), ((1168,...
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import itertools import statsmodels.api as sm import sklearn import sklearn.ensemble from sklearn.model_selection import StratifiedKFold, cross_val_score, LeaveOneOut, LeavePOut, GridSearchCV import sklearn.linear_model import ...
[ "matplotlib.pyplot.title", "sklearn.model_selection.GridSearchCV", "matplotlib.pyplot.clf", "numpy.ones", "numpy.mean", "numpy.arange", "matplotlib.pyplot.gca", "numpy.interp", "numpy.round", "warnings.simplefilter", "matplotlib.pyplot.colorbar", "sklearn.metrics.make_scorer", "numpy.max", ...
[((330, 388), 'seaborn.set', 'sns.set', ([], {'style': '"""darkgrid"""', 'palette': '"""muted"""', 'font_scale': '(1.5)'}), "(style='darkgrid', palette='muted', font_scale=1.5)\n", (337, 388), True, 'import seaborn as sns\n'), ((1742, 1751), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1749, 1751), True, 'imp...
import sys import threading import glob from PIL import Image import random import argparse import keras from keras.models import Model from keras.layers import * from keras.callbacks import TensorBoard, ModelCheckpoint, EarlyStopping from tiramisu.model import create_tiramisu from camvid.mapping import ...
[ "numpy.stack", "argparse.ArgumentParser", "random.randint", "keras.callbacks.ModelCheckpoint", "keras.models.Model", "tiramisu.model.create_tiramisu", "threading.Lock", "random.random", "camvid.mapping.map_labels", "keras.callbacks.TensorBoard", "keras.callbacks.EarlyStopping", "numpy.arange",...
[((392, 496), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script for training The One Hundred Layers Tiramisu network."""'}), "(description=\n 'Script for training The One Hundred Layers Tiramisu network.')\n", (415, 496), False, 'import argparse\n'), ((5543, 5575), 'glob.glob', 'g...
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: <NAME> ## Email: <EMAIL> ## Copyright (c) 2020 ## ## LICENSE file in the root directory of this source tree ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ from encoding.transforms.autoaug import * i...
[ "torchvision.transforms.RandomAffine", "numpy.asarray", "albumentations.HueSaturationValue", "albumentations.ElasticTransform", "PIL.Image.fromarray", "imgaug.augmenters.EdgeDetect" ]
[((570, 585), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (580, 585), True, 'import numpy as np\n'), ((594, 626), 'albumentations.ElasticTransform', 'A.ElasticTransform', ([], {'sigma': 'v', 'p': '(1)'}), '(sigma=v, p=1)\n', (612, 626), True, 'import albumentations as A\n'), ((676, 699), 'PIL.Image.fromarr...
#!/usr/bin/env python import os import re import sys import h5py import random import numpy as np from tqdm import tqdm poi = np.array([]) def dist(point1): global poi return np.linalg.norm(point1-poi) # One way to reach a specified number of points, is to remove points from "bigger" pointclouds # The idea i...
[ "os.remove", "h5py.File", "re.split", "os.path.exists", "random.choice", "numpy.argpartition", "numpy.mean", "numpy.linalg.norm", "numpy.array" ]
[((127, 139), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (135, 139), True, 'import numpy as np\n'), ((185, 213), 'numpy.linalg.norm', 'np.linalg.norm', (['(point1 - poi)'], {}), '(point1 - poi)\n', (199, 213), True, 'import numpy as np\n'), ((2892, 2919), 'os.path.exists', 'os.path.exists', (['output_file'], {}...
# todo: delete/move file? import gaussian_estimators as ge import numpy as np from scipy.stats import multivariate_normal X1 = np.arange(5) X2 = np.arange(9) Y1 = np.array([[1, 2], [1, 1], [2, 15]]) Y2 = np.random.multivariate_normal(np.array([0,15,7]), np.array([[1,0,0],[0,1,0],[0,0,1]]), size=50, check_valid='warn'...
[ "gaussian_estimators.UnivariateGaussian", "gaussian_estimators.MultivariateGaussian", "numpy.allclose", "gaussian_estimators.MultivariateGaussian.log_likelihood", "numpy.array", "numpy.arange", "scipy.stats.multivariate_normal.pdf", "numpy.random.multivariate_normal", "gaussian_estimators.Univariate...
[((129, 141), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (138, 141), True, 'import numpy as np\n'), ((147, 159), 'numpy.arange', 'np.arange', (['(9)'], {}), '(9)\n', (156, 159), True, 'import numpy as np\n'), ((165, 200), 'numpy.array', 'np.array', (['[[1, 2], [1, 1], [2, 15]]'], {}), '([[1, 2], [1, 1], [2, 1...
# Cf. https://github.com/ppwwyyxx/tensorpack/blob/master/examples/FasterRCNN/train.py # and https://github.com/ppwwyyxx/tensorpack/blob/master/examples/FasterRCNN/model.py import tensorflow as tf import numpy as np from functools import partial from datasets import DataKeys from network.ConvolutionalLayers import Con...
[ "tensorflow.reduce_sum", "network.FasterRCNN_utils.decode_bbox_target", "tensorflow.trainable_variables", "tensorflow.identity", "tensorflow.gather_nd", "tensorflow.reshape", "tensorflow.nn.l2_normalize", "tensorflow.get_variable_scope", "tensorflow.matmul", "network.FasterRCNN_utils.clip_boxes", ...
[((845, 886), 'numpy.array', 'np.array', (['[10, 10, 5, 5]'], {'dtype': '"""float32"""'}), "([10, 10, 5, 5], dtype='float32')\n", (853, 886), True, 'import numpy as np\n'), ((26750, 26951), 'functools.partial', 'partial', (['_create_reid_loss_for_id'], {'reid_loss_per_class': 'reid_loss_per_class', 'reid_loss_worst_exa...
import sys import os import json import numpy as np import pandas as pd from collections import OrderedDict from math import factorial import matplotlib # Make it possible to run matplotlib in SSH NO_DISPLAY = 'DISPLAY' not in os.environ or os.environ['DISPLAY'] == '' if NO_DISPLAY: matplotlib.use('Agg') else: ...
[ "matplotlib.pyplot.title", "numpy.abs", "pandas.read_csv", "sys.stdout.flush", "numpy.convolve", "matplotlib.pyplot.tight_layout", "numpy.linalg.pinv", "pandas.DataFrame", "numpy.int", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "matplotlib.pyplot.axhline", "matplotlib.pyplot.s...
[((288, 309), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (302, 309), False, 'import matplotlib\n'), ((320, 344), 'matplotlib.use', 'matplotlib.use', (['"""Qt4Agg"""'], {}), "('Qt4Agg')\n", (334, 344), False, 'import matplotlib\n'), ((583, 638), 'pandas.read_csv', 'pd.read_csv', (['self.data_f...
import numpy as np from scipy.io import wavfile def framing(signal, frame_length, frame_step, window_func=lambda x: np.ones((x,))): """Frame a signal into overlapping frames. :param signal: the audio signal to frame. :param frame_length: length of each frame measured in samples. :param frame_step: num...
[ "numpy.absolute", "numpy.load", "numpy.fft.rfft", "numpy.sum", "numpy.ones", "scipy.io.wavfile.read", "numpy.mean", "numpy.arange", "numpy.pad", "numpy.zeros_like", "numpy.multiply", "numpy.transpose", "numpy.append", "numpy.max", "numpy.log10", "numpy.save", "numpy.ceil", "numpy.a...
[((697, 733), 'numpy.zeros', 'np.zeros', (['(num_frames, frame_length)'], {}), '((num_frames, frame_length))\n', (705, 733), True, 'import numpy as np\n'), ((1443, 1471), 'numpy.fft.rfft', 'np.fft.rfft', (['frames', 'num_fft'], {}), '(frames, num_fft)\n', (1454, 1471), True, 'import numpy as np\n'), ((1483, 1508), 'num...
#!/usr/bin/python3 # -*- coding: UTF-8 -*- __author__ = 'zd' import numpy as np from model_utils import log def viterbi(x, pi, A, B, word2id, id2tag, tag2id): """ viterbi algorithm :param x: user input string / sentence :param pi: initial probability of tags :param A: 给定tag,每个单词出现的概率(发射概率) :...
[ "model_utils.log", "numpy.zeros", "numpy.argmax" ]
[((598, 621), 'numpy.zeros', 'np.zeros', (['(T, num_tags)'], {}), '((T, num_tags))\n', (606, 621), True, 'import numpy as np\n'), ((1220, 1240), 'numpy.argmax', 'np.argmax', (['dp[T - 1]'], {}), '(dp[T - 1])\n', (1229, 1240), True, 'import numpy as np\n'), ((741, 751), 'model_utils.log', 'log', (['pi[j]'], {}), '(pi[j]...
"""Tests for `domicolor` module.""" from typing import Generator import numpy as np import pytest import domicolor from domicolor.domicolor import color_histogram @pytest.fixture def version() -> Generator[str, None, None]: """Sample pytest fixture.""" yield domicolor.__version__ def test_color_histogram(...
[ "domicolor.domicolor.color_histogram", "numpy.zeros", "numpy.all" ]
[((384, 407), 'numpy.zeros', 'np.zeros', (['(100, 100, 3)'], {}), '((100, 100, 3))\n', (392, 407), True, 'import numpy as np\n'), ((419, 441), 'domicolor.domicolor.color_histogram', 'color_histogram', (['image'], {}), '(image)\n', (434, 441), False, 'from domicolor.domicolor import color_histogram\n'), ((504, 529), 'nu...
"""Creates occlusion maps.""" import copy import argparse import numpy from ml4tc.io import example_io from ml4tc.utils import satellite_utils from ml4tc.machine_learning import neural_net from ml4tc.machine_learning import occlusion SEPARATOR_STRING = '\n\n' + '*' * 50 + '\n\n' MODEL_FILE_ARG_NAME = 'input_model_fi...
[ "ml4tc.io.example_io.find_cyclones", "ml4tc.machine_learning.occlusion.write_file", "copy.deepcopy", "ml4tc.machine_learning.occlusion.get_occlusion_maps", "argparse.ArgumentParser", "ml4tc.machine_learning.neural_net.create_inputs", "ml4tc.machine_learning.neural_net.find_metafile", "ml4tc.machine_le...
[((1979, 2004), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2002, 2004), False, 'import argparse\n'), ((3979, 4017), 'ml4tc.machine_learning.neural_net.read_model', 'neural_net.read_model', (['model_file_name'], {}), '(model_file_name)\n', (4000, 4017), False, 'from ml4tc.machine_learning i...
import logging as lg import matplotlib.colors as co import matplotlib.pyplot as pp import numpy as np import os import png import rawpy as rp logger = lg.getLogger('deluminate') def process_directory_raw(raw_file_extension: str, degree: int, path: str = None, demosaic_parameters: dict = Non...
[ "logging.basicConfig", "numpy.logical_and", "numpy.median", "matplotlib.pyplot.imshow", "png.Writer", "png.Reader", "numpy.clip", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "numpy.max", "numpy.random.rand", "rawpy.imread", "os.listdir", "logging.getLogger", "matplotlib.co...
[((152, 178), 'logging.getLogger', 'lg.getLogger', (['"""deluminate"""'], {}), "('deluminate')\n", (164, 178), True, 'import logging as lg\n'), ((932, 948), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (942, 948), False, 'import os\n'), ((885, 914), 'logging.basicConfig', 'lg.basicConfig', ([], {'level': 'lg...
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ Sparse Regression ================= We demonstrate how to do (fully Bayesian) sparse linear regression using the approach described in [1]. This approach is particularly suitable for situations with many feature dimensions (large ...
[ "numpyro.infer.MCMC", "numpyro.set_platform", "numpy.random.seed", "argparse.ArgumentParser", "numpy.sum", "jax.random.PRNGKey", "numpyro.distributions.HalfCauchy", "numpyro.distributions.InverseGamma", "numpyro.set_host_device_count", "jax.numpy.transpose", "numpy.random.randn", "jax.numpy.li...
[((1200, 1215), 'jax.numpy.square', 'np.square', (['eta1'], {}), '(eta1)\n', (1209, 1215), True, 'import jax.numpy as np\n'), ((1229, 1244), 'jax.numpy.square', 'np.square', (['eta2'], {}), '(eta2)\n', (1238, 1244), True, 'import jax.numpy as np\n'), ((3025, 3041), 'jax.numpy.zeros', 'np.zeros', (['(2, P)'], {}), '((2,...
# coding: utf-8 import numpy as np import re with open('chr22.phastCons100way.wigFix') as phast_file, \ open('chr22.phyloP100way.wigFix') as phylo_file: phylo_pos, phast_pos = 0, 0 phylo_lines = iter(phylo_file) phast_lines = iter(phast_file) phylos = [] phasts = [] try: while ...
[ "numpy.corrcoef", "re.search" ]
[((1226, 1253), 'numpy.corrcoef', 'np.corrcoef', (['phylos', 'phasts'], {}), '(phylos, phasts)\n', (1237, 1253), True, 'import numpy as np\n'), ((541, 578), 're.search', 're.search', (['"""start=(\\\\d+)"""', 'phylo_line'], {}), "('start=(\\\\d+)', phylo_line)\n", (550, 578), False, 'import re\n'), ((866, 903), 're.sea...
""" Copyright MIT and Harvey Mudd College MIT License Summer 2020 Lab 3C - Depth Camera Wall Parking """ ######################################################################################## # Imports ######################################################################################## import sys import cv2 as...
[ "numpy.polyfit", "sys.path.insert", "racecar_core.create_racecar", "numpy.mean", "numpy.arange", "pidcontroller.PID" ]
[((369, 404), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../library"""'], {}), "(0, '../../library')\n", (384, 404), False, 'import sys\n'), ((683, 712), 'racecar_core.create_racecar', 'racecar_core.create_racecar', ([], {}), '()\n', (710, 712), False, 'import racecar_core\n'), ((1071, 1104), 'pidcontroller....
import importlib import pickle import os import re import random import time import argparse import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import Categorical from sklearn....
[ "torch.distributions.Categorical", "numpy.sum", "numpy.argmax", "pandas.read_csv", "numpy.mean", "torch.nn.Softmax", "numpy.exp", "torch.device", "numpy.interp", "numpy.unique", "sklearn.metrics.log_loss", "numpy.cumsum", "numpy.max", "torch.Tensor", "numpy.finfo", "torch.nn.Linear", ...
[((4428, 4457), 'torch.device', 'torch.device', (["self.opt['dev']"], {}), "(self.opt['dev'])\n", (4440, 4457), False, 'import torch\n'), ((4674, 4685), 'time.time', 'time.time', ([], {}), '()\n', (4683, 4685), False, 'import time\n'), ((6183, 6201), 'torch.distributions.Categorical', 'Categorical', (['probs'], {}), '(...
import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix from sklearn.metrics import roc_curve class RocCurvesPlot(): def __init__(self,classes=['EM', 'Hadronic', 'MIP', 'undef']): self.classes = classes self.primary_class = 0 s...
[ "numpy.sum", "sklearn.metrics.roc_curve", "numpy.argmax", "numpy.zeros", "numpy.equal", "numpy.reshape", "sklearn.metrics.confusion_matrix", "matplotlib.pyplot.subplots", "numpy.delete", "sklearn.metrics.ConfusionMatrixDisplay" ]
[((539, 565), 'numpy.argmax', 'np.argmax', (['true_id'], {'axis': '(1)'}), '(true_id, axis=1)\n', (548, 565), True, 'import numpy as np\n'), ((2317, 2351), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(9, 6)'}), '(1, 1, figsize=(9, 6))\n', (2329, 2351), True, 'import matplotlib.pyplot as ...
import os import sys from pymatgen.io.cif import CifWriter from pymatgen.core.structure import Structure from pymatgen.ext.matproj import MPRester from autocat import adsorption from ase.db import connect from pymatgen.core.surface import SlabGenerator, generate_all_slabs from pymatgen.io.ase import AseAtomsAdaptor fro...
[ "os.remove", "scipy.cluster.hierarchy.fcluster", "numpy.abs", "scipy.cluster.hierarchy.linkage", "pymatgen.core.surface.generate_all_slabs", "pymatgen.io.cif.CifWriter", "os.path.isfile", "ase.visualize.plot.plot_atoms", "glob.glob", "numpy.round", "os.chdir", "pandas.DataFrame", "pymatgen.i...
[((823, 834), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (832, 834), False, 'import os\n'), ((839, 860), 'os.chdir', 'os.chdir', (['current_dir'], {}), '(current_dir)\n', (847, 860), False, 'import os\n'), ((921, 951), 'os.path.isdir', 'os.path.isdir', (['"""orig_cif_data"""'], {}), "('orig_cif_data')\n", (934, 951), ...
import os import sys from distutils.core import Extension from setuptools import setup home_folder = os.path.expanduser("~") user_site_packages_folder = "{0}/.local/lib/python{1}.{2}/site-packages".format(home_folder, sys.version_info[0], ...
[ "sys.path.append", "numpy.get_include", "os.path.expanduser", "setuptools.setup" ]
[((103, 126), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (121, 126), False, 'import os\n'), ((1402, 2116), 'setuptools.setup', 'setup', ([], {'name': 'NAME', 'version': 'VERSION', 'url': '"""http://autonlab.org"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description':...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Dec-28-20 23:10 # @Author : <NAME> (<EMAIL>) # @RefLink : https://www.cnblogs.com/belter/p/6711160.html import os import numpy as np from datetime import datetime from xor_gate_nn.datasets.keras_fn.datasets import XOR_Dataset from xor_gate_nn.model...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "os.makedirs", "numpy.log", "matplotlib.pyplot.imshow", "numpy.asarray", "numpy.zeros", "matplotlib.pyplot.ylabel", "datetime.datetime.now", "matplotlib.pyplot.colorbar", "numpy.array", "numpy.exp", "numpy.linspace", "numpy.random.rand",...
[((1103, 1122), 'numpy.dot', 'np.dot', (['theta1', 'a_1'], {}), '(theta1, a_1)\n', (1109, 1122), True, 'import numpy as np\n'), ((1202, 1221), 'numpy.dot', 'np.dot', (['theta2', 'a_2'], {}), '(theta2, a_2)\n', (1208, 1221), True, 'import numpy as np\n'), ((1424, 1446), 'numpy.zeros', 'np.zeros', (['theta1.shape'], {}),...
# Copyright 2021 Huawei Technologies Co., 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 agreed to...
[ "os.mkdir", "numpy.random.uniform", "argparse.ArgumentParser", "mindspore.load_checkpoint", "mindspore.load_param_into_net", "os.path.exists", "src.net.CoarseNet", "mindspore.Tensor", "src.net.FineNet", "os.path.join" ]
[((1129, 1199), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MindSpore Depth Estimation Demo"""'}), "(description='MindSpore Depth Estimation Demo')\n", (1152, 1199), False, 'import argparse\n'), ((911, 936), 'os.path.exists', 'os.path.exists', (['input_dir'], {}), '(input_dir)\n', (92...
import numpy import pytest from chainer_chemistry.dataset.splitters.random_splitter import RandomSplitter from chainer_chemistry.datasets import NumpyTupleDataset @pytest.fixture def dataset(): a = numpy.random.random((10, 10)) b = numpy.random.random((10, 8)) c = numpy.random.random((10, 1)) return ...
[ "chainer_chemistry.dataset.splitters.random_splitter.RandomSplitter", "chainer_chemistry.datasets.NumpyTupleDataset", "pytest.raises", "numpy.random.random", "numpy.array_equal" ]
[((205, 234), 'numpy.random.random', 'numpy.random.random', (['(10, 10)'], {}), '((10, 10))\n', (224, 234), False, 'import numpy\n'), ((243, 271), 'numpy.random.random', 'numpy.random.random', (['(10, 8)'], {}), '((10, 8))\n', (262, 271), False, 'import numpy\n'), ((280, 308), 'numpy.random.random', 'numpy.random.rando...
#!/usr/bin/env python # coding: utf-8 ########################### import h5py from skimage.measure import label, regionprops import numpy as np import cv2 import os import sys import csv import warnings from datetime import datetime warnings.filterwarnings('ignore') ################################## h5_file = sys.argv...
[ "h5py.File", "numpy.count_nonzero", "csv.writer", "numpy.sum", "warnings.filterwarnings", "os.path.realpath", "cv2.imread", "skimage.measure.label", "numpy.squeeze", "datetime.datetime.now", "skimage.measure.regionprops" ]
[((233, 266), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (256, 266), False, 'import warnings\n'), ((629, 652), 'h5py.File', 'h5py.File', (['h5_file', '"""r"""'], {}), "(h5_file, 'r')\n", (638, 652), False, 'import h5py\n'), ((747, 771), 'numpy.squeeze', 'np.squeeze', (...
import laspy import os import numpy as np import json class Las_Reader(object): def __init__(self, json_file): pass def _load_las(self): pass def __getitem__(self, i): return self.las[i] def __len__(self): return len(self.las) def get_raw(...
[ "os.path.abspath", "json.load", "numpy.abs", "laspy.LasData", "laspy.ExtraBytesParams", "laspy.LasHeader", "numpy.logical_not", "os.path.exists", "laspy.read", "numpy.hstack", "os.path.isfile", "numpy.array", "os.path.join", "os.listdir", "numpy.vstack" ]
[((2148, 2172), 'os.path.exists', 'os.path.exists', (['las_path'], {}), '(las_path)\n', (2162, 2172), False, 'import os\n'), ((2611, 2636), 'os.path.isfile', 'os.path.isfile', (['json_file'], {}), '(json_file)\n', (2625, 2636), False, 'import os\n'), ((1396, 1410), 'numpy.vstack', 'np.vstack', (['pos'], {}), '(pos)\n',...
import csv import heapq import pickle from collections import Counter from functools import partial from statistics import stdev import numpy as np import sklearn from imblearn.over_sampling import SMOTE from keras.models import load_model from keras.wrappers.scikit_learn import KerasClassifier from nltk import word_t...
[ "keras.models.load_model", "pickle.dump", "VAE_train.train_BVAE.get_text_data", "decision_tree.learn_local_decision_tree", "heapq.heappushpop", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.model_selection.train_test_split", "numpy.allclose", "sklearn.preprocessing.MinMaxScaler", "sk...
[((871, 904), 'DNN_base.TextsToSequences', 'TextsToSequences', ([], {'num_words': '(35000)'}), '(num_words=35000)\n', (887, 904), False, 'from DNN_base import TextsToSequences, Padder, create_model\n'), ((914, 925), 'DNN_base.Padder', 'Padder', (['(140)'], {}), '(140)\n', (920, 925), False, 'from DNN_base import TextsT...
# Author: <NAME> <<EMAIL>> """ Calculate sensitivity and specificity metrics: - Precision - Recall - F-score """ import numpy as np from data_io import imread def cal_prf_metrics(pred_list, gt_list, thresh_step=0.01): final_accuracy_all = [] for thresh in np.arange(0.0, 1.0, thresh_step): print(t...
[ "numpy.arange", "numpy.sum" ]
[((271, 303), 'numpy.arange', 'np.arange', (['(0.0)', '(1.0)', 'thresh_step'], {}), '(0.0, 1.0, thresh_step)\n', (280, 303), True, 'import numpy as np\n'), ((1156, 1187), 'numpy.sum', 'np.sum', (['((pred == 1) & (gt == 1))'], {}), '((pred == 1) & (gt == 1))\n', (1162, 1187), True, 'import numpy as np\n'), ((1191, 1222)...
import numpy as np from lmfit import minimize, Parameters, Parameter from astropy import units as u from .. import spectrum from functions import * class Fitter(): """ A class for multi-component fitting to spectroscopic data of ices. This is the heart of Omnifit, which receives spectra from the spectrum modu...
[ "numpy.less_equal", "numpy.sum", "numpy.all", "numpy.isinf", "numpy.isfinite", "numpy.any", "numpy.max", "lmfit.minimize", "numpy.greater_equal", "numpy.vstack", "lmfit.Parameters" ]
[((7607, 7660), 'lmfit.minimize', 'minimize', (['self.__fit_residual', 'self.fitpars'], {}), '(self.__fit_residual, self.fitpars, **kwargs)\n', (7615, 7660), False, 'from lmfit import minimize, Parameters, Parameter\n'), ((9231, 9247), 'numpy.any', 'np.any', (['fitrange'], {}), '(fitrange)\n', (9237, 9247), True, 'impo...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Title: listing_cleaning.py Description: Split the previewAmenityNames into four seperate amenity, calculate Bayesian average rating from original rating data, merge response rate data from CSV downloaded from insideairbnb.com, and correct data type of the master datase...
[ "pandas.read_csv", "pandas.merge", "numpy.mean", "numpy.median" ]
[((431, 516), 'pandas.read_csv', 'pd.read_csv', (['"""../data_collection/listings_clean_copy.csv"""'], {'header': '(0)', 'index_col': '(0)'}), "('../data_collection/listings_clean_copy.csv', header=0, index_col=0\n )\n", (442, 516), True, 'import pandas as pd\n'), ((1612, 1697), 'pandas.read_csv', 'pd.read_csv', (['...
#!/usr/bin/python import os import pandas import argparse import numpy as np from scipy import integrate import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from yggdrasil.interface.YggInterface import * def Protein_translation_RNA(t, y, L, U, D, mRNA): """ Defines ODE function Conversion ...
[ "os.path.abspath", "matplotlib.pyplot.savefig", "scipy.integrate.ode", "argparse.ArgumentParser", "pandas.read_csv", "pandas.merge", "matplotlib.pyplot.figure", "numpy.arange", "numpy.vstack", "matplotlib.gridspec.GridSpec", "os.path.join", "pandas.to_numeric" ]
[((939, 964), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (954, 964), False, 'import os\n'), ((2296, 2342), 'numpy.arange', 'np.arange', (['t_start', '(t_final + delta_t)', 'delta_t'], {}), '(t_start, t_final + delta_t, delta_t)\n', (2305, 2342), True, 'import numpy as np\n'), ((2811, 2869...
import open3d as o3d import numpy as np import copy def draw_registration_result(source, target, transformation): source_temp = copy.deepcopy(source) target_temp = copy.deepcopy(target) source_temp.paint_uniform_color([1, 0.706, 0]) target_temp.paint_uniform_color([0, 0.651, 0.929]) source_temp.tr...
[ "copy.deepcopy", "open3d.geometry.PointCloud", "open3d.visualization.draw_geometries", "open3d.registration.TransformationEstimationPointToPlane", "numpy.eye" ]
[((134, 155), 'copy.deepcopy', 'copy.deepcopy', (['source'], {}), '(source)\n', (147, 155), False, 'import copy\n'), ((174, 195), 'copy.deepcopy', 'copy.deepcopy', (['target'], {}), '(target)\n', (187, 195), False, 'import copy\n'), ((348, 409), 'open3d.visualization.draw_geometries', 'o3d.visualization.draw_geometries...
"""Delta III Launch Vehicle Ascent problem. NOTE: THIS EXAMPLE IS INCOMPLETE AND IS NOT CURRENTLY SOLVABLE USING PYCOLLO. Example 6.15 from <NAME>. (2010). Practical methods for optimal control and estimation using nonlinear programming - 2nd Edition. Society for Industrial and Applied Mathematics, p336 - 345. Attri...
[ "sympy.Symbol", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pycollo.OptimalControlProblem", "sympy.cos", "sympy.sqrt", "matplotlib.pyplot.figure", "sympy.exp", "sympy.sin", "numpy.sqrt" ]
[((4247, 4264), 'sympy.Symbol', 'sym.Symbol', (['"""r_x"""'], {}), "('r_x')\n", (4257, 4264), True, 'import sympy as sym\n'), ((4271, 4288), 'sympy.Symbol', 'sym.Symbol', (['"""r_y"""'], {}), "('r_y')\n", (4281, 4288), True, 'import sympy as sym\n'), ((4295, 4312), 'sympy.Symbol', 'sym.Symbol', (['"""r_z"""'], {}), "('...
from dmmath.utils import ConstParams from dmmath.nlp.nlp_utils import DMMathDatasetReader from dmmath.nlp.tp_transformer import TPTransformer from dmmath.nlp.mix_transformer import MixTransformer from allennlp.predictors.predictor import Predictor from allennlp.nn import util import torch import sys import os import ar...
[ "allennlp.nn.util.move_to_device", "os.makedirs", "argparse.ArgumentParser", "logging.basicConfig", "torch.manual_seed", "dmmath.nlp.nlp_utils.DMDataSet", "numpy.zeros", "allennlp.predictors.predictor.Predictor.register" ]
[((427, 447), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (444, 447), False, 'import torch\n'), ((451, 483), 'allennlp.predictors.predictor.Predictor.register', 'Predictor.register', (['"""my_seq2seq"""'], {}), "('my_seq2seq')\n", (469, 483), False, 'from allennlp.predictors.predictor import Predi...
import imutils import cv2 import numpy as np # load the image, convert it to grayscale, blur it slightly, and threshold it image = cv2.imread('1.png') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) gray = cv2.GaussianBlur(gray, (5, 5), 0) # threshold the image, then perform a series of erosions + dilations to remove ...
[ "cv2.GaussianBlur", "cv2.contourArea", "cv2.circle", "cv2.dilate", "cv2.cvtColor", "numpy.argmax", "cv2.imwrite", "cv2.moments", "cv2.imshow", "cv2.waitKey", "cv2.threshold", "cv2.imread", "cv2.rectangle", "cv2.erode", "cv2.boundingRect", "cv2.findContours" ]
[((132, 151), 'cv2.imread', 'cv2.imread', (['"""1.png"""'], {}), "('1.png')\n", (142, 151), False, 'import cv2\n'), ((159, 198), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (171, 198), False, 'import cv2\n'), ((206, 239), 'cv2.GaussianBlur', 'cv2.GaussianBlur'...
import numpy as np import tensorflow as tf import math from scipy.special import logsumexp from tqdm import tqdm import ExpUtil as util class SGPRN: def __init__(self, config, label=None, init_type=2): print('Initialize Scalable GPRN ...') self.config = config if...
[ "ExpUtil.Kernel_ARD", "tensorflow.reduce_sum", "numpy.abs", "tensorflow.diag_part", "tensorflow.matmul", "tensorflow.Variable", "numpy.exp", "numpy.random.normal", "scipy.special.logsumexp", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.abs", "tensorflow.size", "tensorflow...
[((1600, 1657), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', (['util.tf_type', '[None, self.in_d]'], {}), '(util.tf_type, [None, self.in_d])\n', (1624, 1657), True, 'import tensorflow as tf\n'), ((1683, 1740), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', (['util.tf_type', '[None, s...
#! /usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (C) 2015 map[dot]plus[dot]plus[dot]help[at]gmail License: http://www.apache.org/licenses/LICENSE-2.0 ''' from mapsys import * import math import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.set_printoptions", "matplotlib.pyplot.show", "mpl_toolkits.mplot3d.Axes3D", "matplotlib.pyplot.plot", "matplotlib.rcParams.update", "matplotlib.pyplot.legend", "math.sin", "matplotlib.pyplot.figure", "matplotlib.ticker.FormatStrForma...
[((400, 432), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (419, 432), True, 'import numpy as np\n'), ((433, 467), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (452, 467), True, 'import numpy as np\n'), ((468, 512)...
# /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification,...
[ "numpy.divide", "libpymo.scaleLayerParams", "aimet_tensorflow.keras.utils.weight_tensor_utils.WeightTensorUtils.transpose_from_tf_to_libpymo_format", "libpymo.scaleDepthWiseSeparableLayer", "libpymo.BNParamsHighBiasFold", "libpymo.updateBias", "libpymo.LayerParams", "aimet_common.utils.AimetLogger.get...
[((2150, 2222), 'aimet_common.utils.AimetLogger.get_area_logger', 'AimetLogger.get_area_logger', (['AimetLogger.LogAreas.CrosslayerEqualization'], {}), '(AimetLogger.LogAreas.CrosslayerEqualization)\n', (2177, 2222), False, 'from aimet_common.utils import AimetLogger\n'), ((4662, 4692), 'collections.deque', 'collection...
import gym import numpy as np import numpy.matlib from ..core import Agent # S: Susceptibles # I : (infected) asymptomatic, infected, undetected # D: (detected) asymptomatic, infected, detected # A: (ailing) symptomatic, infected, undetected # R: (recognized) symptomatic, infected, detected # T: (threatened) acutely...
[ "numpy.random.uniform", "numpy.sum", "numpy.array", "gym.spaces.Box" ]
[((2832, 2887), 'gym.spaces.Box', 'gym.spaces.Box', (['(0)', 'np.inf'], {'shape': '(4,)', 'dtype': 'np.float64'}), '(0, np.inf, shape=(4,), dtype=np.float64)\n', (2846, 2887), False, 'import gym\n'), ((2944, 2999), 'gym.spaces.Box', 'gym.spaces.Box', (['(0)', 'np.inf'], {'shape': '(1,)', 'dtype': 'np.float64'}), '(0, n...
# coding:utf-8 import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt from sklearn import preprocessing import time, datetime import utils def main(): # extract station id list in Beijing df_airq = pd.read_csv('./data/microsoft_urban_air_data/airquality.csv') stati...
[ "pandas.read_csv", "scipy.stats.pearsonr", "numpy.isnan", "numpy.mean", "numpy.array", "numpy.unique" ]
[((249, 310), 'pandas.read_csv', 'pd.read_csv', (['"""./data/microsoft_urban_air_data/airquality.csv"""'], {}), "('./data/microsoft_urban_air_data/airquality.csv')\n", (260, 310), True, 'import pandas as pd\n'), ((2755, 2766), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2763, 2766), True, 'import numpy as np\n'),...