code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def get_triangles(): m = ((50-10*(5**(1/2)))**(1/2))/10 n = ((50+10*(5**(1/2)))**(1/2))/10 # print(m, n) viewpoints = [[m, 0, n], [-m, 0, n], [m, 0, -n], [-m, 0, -n], [0, n, m], [0, n, -m], [0...
[ "matplotlib.pyplot.show", "mpl_toolkits.mplot3d.Axes3D", "numpy.asarray", "matplotlib.pyplot.figure", "numpy.array", "numpy.linalg.norm" ]
[((2917, 2929), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2927, 2929), True, 'import matplotlib.pyplot as plt\n'), ((2935, 2950), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', ([], {'fig': 'fig'}), '(fig=fig)\n', (2941, 2950), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((3003, 3027), 'numpy.asar...
from typing import Sequence, Any import pandas as pd import numpy as np from skimage.exposure import equalize_hist from skimage.metrics import structural_similarity as ssim from tqdm import tqdm import ngram_heatmap from plot_data import getSarcasmDf from utilitys import widgets def bigramSimilarity(condList: Sequen...
[ "pandas.DataFrame", "tqdm.tqdm", "plot_data.getSarcasmDf", "ngram_heatmap.tokenize", "skimage.metrics.structural_similarity", "ngram_heatmap.makeBigramImage", "numpy.round" ]
[((442, 488), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'condList', 'index': 'condList'}), '(columns=condList, index=condList)\n', (454, 488), True, 'import pandas as pd\n'), ((647, 686), 'tqdm.tqdm', 'tqdm', (['condList', '"""Getting bigram images"""'], {}), "(condList, 'Getting bigram images')\n", (651, 68...
import numpy as np from numpy.testing import assert_allclose import torch as th from gluonnlp.torch import attention_cell as ac def check_attention_cell_basic(attention_cell, q_channel, k_channel, v_channel, use_mask, multi_head=False, num_heads=None, layout='NTK'): for query_length...
[ "torch.norm", "numpy.ones", "torch.randn", "gluonnlp.torch.attention_cell.MultiHeadAttentionCell", "torch.rand", "numpy.testing.assert_allclose", "torch.sum" ]
[((608, 664), 'torch.randn', 'th.randn', (['batch_size', 'query_length', 'num_heads', 'q_channel'], {}), '(batch_size, query_length, num_heads, q_channel)\n', (616, 664), True, 'import torch as th\n'), ((690, 744), 'torch.randn', 'th.randn', (['batch_size', 'mem_length', 'num_heads', 'k_channel'], {}), '(batch_size, me...
from likurai.model import BayesianNeuralNetwork from likurai.layer import BayesianDense, Likelihood from sklearn.datasets import load_iris from sklearn.metrics import classification_report, log_loss from theano import shared from sklearn import ensemble from sklearn.preprocessing import OneHotEncoder from sklearn.utils...
[ "sklearn.datasets.load_iris", "likurai.layer.BayesianDense", "likurai.model.BayesianNeuralNetwork", "likurai.layer.Likelihood", "sklearn.preprocessing.OneHotEncoder", "sklearn.metrics.log_loss", "sklearn.metrics.classification_report", "sklearn.ensemble.GradientBoostingClassifier", "theano.shared", ...
[((521, 532), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (530, 532), False, 'from sklearn.datasets import load_iris\n'), ((584, 597), 'sklearn.utils.shuffle', 'shuffle', (['X', 'y'], {}), '(X, y)\n', (591, 597), False, 'from sklearn.utils import shuffle\n'), ((1205, 1228), 'likurai.model.BayesianNeura...
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import numpy as np import sys i = sys.argv[1] uf = sys.argv[2] size = sys.argv[3] page = sys.argv[4] latency_path = "./log/latency_" + str(i) + "_" + str(uf) + "k_" + str(size) + "_" + str(page) + "_0.log" prepare_path = ...
[ "numpy.mean", "numpy.sum" ]
[((894, 911), 'numpy.mean', 'np.mean', (['prepares'], {}), '(prepares)\n', (901, 911), True, 'import numpy as np\n'), ((921, 939), 'numpy.mean', 'np.mean', (['overheads'], {}), '(overheads)\n', (928, 939), True, 'import numpy as np\n'), ((805, 821), 'numpy.sum', 'np.sum', (['latencys'], {}), '(latencys)\n', (811, 821),...
# -*- coding: utf-8 -*- # ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS) # # This program is free software; you can redistribute it and/or modify it under # the t...
[ "nicos.core.Attach", "nicos.core.listof", "nicos.core.Override", "numpy.interp", "nicos.core.errors.ConfigurationError" ]
[((1793, 1858), 'nicos.core.Attach', 'Attach', (['"""Motor to drive when moving this logical motor"""', 'Moveable'], {}), "('Motor to drive when moving this logical motor', Moveable)\n", (1799, 1858), False, 'from nicos.core import Attach, Moveable, Override, Param, listof\n'), ((1942, 1967), 'nicos.core.Override', 'Ov...
import json import numpy as np def create_minutely(time, hours): minutely = [{"key": time + 60*x, "value": np.random.normal(25, 1) + (x/60)%300} for x in range(60*hours)] return minutely def create_hourly(time): hourly = [{"key": time + 3600*x, "value": np.random.normal(20, 1) + x%5} for x in range(24)] return ho...
[ "numpy.random.normal", "json.dumps" ]
[((403, 469), 'json.dumps', 'json.dumps', (['hour'], {'separators': "(',', ': ')", 'sort_keys': '(True)', 'indent': '(4)'}), "(hour, separators=(',', ': '), sort_keys=True, indent=4)\n", (413, 469), False, 'import json\n'), ((657, 726), 'json.dumps', 'json.dumps', (['min_day'], {'separators': "(',', ': ')", 'sort_keys'...
""" # ============================================================================= # | Project: [MuJoCo Practivces] | Title: Python + mujoco-py | Author: <NAME> | Email: [Moses ] <EMAIL> | Creation Date: Monday, September 7th, 2020 # ==================================================...
[ "modules.simulation.Simulation", "numpy.set_printoptions", "modules.utils.my_mkdir", "docopt.docopt", "modules.utils.my_print", "modules.utils.my_rmdir", "modules.utils.args_cleanup", "shutil.copyfile", "modules.controllers.PID_Controller" ]
[((5319, 5414), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': 'Constants.PRINT_LW', 'suppress': '(True)', 'precision': 'Constants.PREC'}), '(linewidth=Constants.PRINT_LW, suppress=True, precision=\n Constants.PREC)\n', (5338, 5414), True, 'import numpy as np\n'), ((5606, 5648), 'docopt.docopt',...
""" source: https://github.com/llSourcell/Q-learning-for-trading.git """ import gym from gym import spaces from gym.utils import seeding import numpy as np import itertools import model class TradingEnv(gym.Env): """ A 3-stock (AAPL, IBM, MSFT) trading environment. State: [# of stock owned, current stock price...
[ "numpy.sum", "numpy.roll", "numpy.zeros", "gym.spaces.Discrete", "gym.spaces.MultiDiscrete", "numpy.split", "model.lstm", "itertools.product", "gym.utils.seeding.np_random" ]
[((1190, 1224), 'gym.spaces.Discrete', 'spaces.Discrete', (['(3 ** self.n_stock)'], {}), '(3 ** self.n_stock)\n', (1205, 1224), False, 'from gym import spaces\n'), ((1628, 1718), 'gym.spaces.MultiDiscrete', 'spaces.MultiDiscrete', (['(stock_range + price_range + cash_in_hand_range + estimates_range)'], {}), '(stock_ran...
#coding: utf-8 """ TODO: unfinished """ import os import sys import json import shutil import copy import torch import torch.nn as nn import numpy as np import pandas as pd from torch.autograd import Variable from tensorboardX import SummaryWriter from abc import ABCMeta, abstractmethod import socket from datetime impo...
[ "copy.deepcopy", "os.remove", "logging.FileHandler", "os.makedirs", "torch.load", "os.rename", "os.path.exists", "numpy.isfinite", "numpy.isnan", "torch.save", "torch.no_grad", "os.path.join" ]
[((1086, 1134), 'os.path.join', 'os.path.join', (['self.save_path', 'self.scaffold_name'], {}), '(self.save_path, self.scaffold_name)\n', (1098, 1134), False, 'import os\n'), ((1940, 1969), 'logging.FileHandler', 'logging.FileHandler', (['log_file'], {}), '(log_file)\n', (1959, 1969), False, 'import logging\n'), ((1435...
import pickle import numpy as np import re import sys with open(sys.argv[1], 'rb') as handle: dict_out = pickle.load(handle) U = np.array(dict_out['10 metre U wind component']['values']) V = np.array(dict_out['10 metre V wind component']['values']) W = np.sqrt(U**2+V**2) dict_out['Wind Speed']={'values':W,'...
[ "pickle.dump", "pickle.load", "numpy.array", "re.findall", "numpy.sqrt" ]
[((139, 196), 'numpy.array', 'np.array', (["dict_out['10 metre U wind component']['values']"], {}), "(dict_out['10 metre U wind component']['values'])\n", (147, 196), True, 'import numpy as np\n'), ((201, 258), 'numpy.array', 'np.array', (["dict_out['10 metre V wind component']['values']"], {}), "(dict_out['10 metre V ...
import numpy as np from contextlib import contextmanager import os import sys def unique_rows(a): order = np.lexsort(a.T) a = a[order] diff = np.diff(a, axis=0) ui = np.ones(len(a), 'bool') ui[1:] = (diff != 0).any(axis=1) return a[ui] def merge_dicts(*dict_args): ''' Given any numbe...
[ "numpy.lexsort", "os.dup", "sys.stdout.fileno", "numpy.diff", "sys.stdout.flush" ]
[((112, 127), 'numpy.lexsort', 'np.lexsort', (['a.T'], {}), '(a.T)\n', (122, 127), True, 'import numpy as np\n'), ((156, 174), 'numpy.diff', 'np.diff', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (163, 174), True, 'import numpy as np\n'), ((772, 791), 'sys.stdout.fileno', 'sys.stdout.fileno', ([], {}), '()\n', (789, 791...
#Import the libraries import pandas as pd import numpy as np import requests import matplotlib.pyplot as plt import yfinance as yf import datetime import math from datetime import timedelta from pypfopt.efficient_frontier import EfficientFrontier from pypfopt import risk_models from pypfopt import expected_returns fr...
[ "pypfopt.risk_models.sample_cov", "pandas.DataFrame", "matplotlib.pyplot.show", "datetime.datetime.today", "yfinance.download", "pandas.read_csv", "pypfopt.efficient_frontier.EfficientFrontier", "pandas.DatetimeIndex", "datetime.datetime.strptime", "datetime.timedelta", "pandas.to_datetime", "...
[((1116, 1154), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'index_col': '(False)'}), '(filename, index_col=False)\n', (1127, 1154), True, 'import pandas as pd\n'), ((1634, 1688), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['lastDateEntry', 'DATE_FORMAT'], {}), '(lastDateEntry, DATE_FORMAT)\n', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 29 04:04:53 2021 @author: shahin75 """ # thermal state imports import numpy as np import random from tenpy.networks.mps import MPS from tenpy.networks.mpo import MPO from tenpy.networks.site import SpinHalfSite import scipy.linalg as la class t...
[ "numpy.trace", "numpy.einsum", "numpy.shape", "numpy.mean", "numpy.exp", "tenpy.networks.mps.MPS.canonical_form_finite", "numpy.eye", "numpy.swapaxes", "numpy.reshape", "numpy.kron", "numpy.tensordot", "scipy.linalg.eig", "tenpy.networks.site.SpinHalfSite", "numpy.dot", "tenpy.networks.m...
[((17097, 17128), 'numpy.einsum', 'np.einsum', (['"""abdeik->abiedk"""', 'W1'], {}), "('abdeik->abiedk', W1)\n", (17106, 17128), True, 'import numpy as np\n'), ((17375, 17386), 'numpy.eye', 'np.eye', (['chi'], {}), '(chi)\n', (17381, 17386), True, 'import numpy as np\n'), ((17407, 17418), 'numpy.eye', 'np.eye', (['chi'...
# Copyright 2020 Google LLC # 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...
[ "fqe.util.alpha_beta_electrons", "copy.deepcopy", "fqe.util.vdot", "numpy.copy" ]
[((1354, 1377), 'copy.deepcopy', 'copy.deepcopy', (['ketstate'], {}), '(ketstate)\n', (1367, 1377), False, 'import copy\n'), ((1497, 1516), 'fqe.util.vdot', 'vdot', (['brastate', 'out'], {}), '(brastate, out)\n', (1501, 1516), False, 'from fqe.util import alpha_beta_electrons, vdot\n'), ((2196, 2219), 'copy.deepcopy', ...
import numpy as np from sklearn.metrics import pairwise_distances_argmin_min def resample(path, spacing=1): """Resample a path (linearly) according to maximum distance between points Args: path (np.array): points of path, shaped as number points x number of features. spacing (int, optional): ...
[ "sklearn.metrics.pairwise_distances_argmin_min", "numpy.mean", "numpy.linalg.norm", "numpy.arange", "numpy.concatenate" ]
[((511, 535), 'numpy.arange', 'np.arange', (['path.shape[0]'], {}), '(path.shape[0])\n', (520, 535), True, 'import numpy as np\n'), ((967, 991), 'numpy.concatenate', 'np.concatenate', (['new_path'], {}), '(new_path)\n', (981, 991), True, 'import numpy as np\n'), ((1676, 1717), 'sklearn.metrics.pairwise_distances_argmin...
import numba from numba import jit, prange import numpy as np import nltk from ProcessEntropy.Preprocessing import * @jit(nopython=True, fastmath=True, parallel=True) def get_all_self_lambdas(source, lambdas): """ Internal function. Finds the Lambda value for each index in the source. Lambda value...
[ "matplotlib.pyplot.show", "numpy.sum", "numpy.log2", "numpy.zeros", "numpy.array", "numba.jit", "numba.prange" ]
[((121, 169), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'fastmath': '(True)', 'parallel': '(True)'}), '(nopython=True, fastmath=True, parallel=True)\n', (124, 169), False, 'from numba import jit, prange\n'), ((854, 866), 'numba.prange', 'prange', (['(1)', 'N'], {}), '(1, N)\n', (860, 866), False, 'from numba impo...
import argparse import multiprocessing from concurrent.futures import ProcessPoolExecutor import csv from pathlib import Path import urllib.request import urllib.parse import astropy.io.fits.header import numpy as np import matplotlib.pyplot as plt from PIL import Image from reproject import reproject_exact, mosaicking...
[ "csv.reader", "argparse.ArgumentParser", "numpy.nan_to_num", "concurrent.futures.ProcessPoolExecutor", "numpy.clip", "pathlib.Path", "astroquery.astrometry_net.AstrometryNet", "matplotlib.pyplot.imshow", "numpy.stack", "matplotlib.pyplot.show", "reproject.mosaicking.find_optimal_celestial_wcs", ...
[((4259, 4284), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4282, 4284), False, 'import argparse\n'), ((5258, 5277), 'pathlib.Path', 'Path', (['args.imgs_csv'], {}), '(args.imgs_csv)\n', (5262, 5277), False, 'from pathlib import Path\n'), ((5989, 6010), 'concurrent.futures.ProcessPoolExecut...
# Importing the basic Image library from PIL import Image import numpy, serial, time BAUDRATE = 9600 def openSerial(port): ser = serial.Serial(port, baudrate = BAUDRATE, parity = serial.PARITY_NONE, stopbits = 1, bytesize = 8) print("Using [ " + ser.name + " ]") def processImage(imageLoc): # Openi...
[ "serial.Serial", "numpy.asarray", "time.sleep", "PIL.Image.open" ]
[((134, 228), 'serial.Serial', 'serial.Serial', (['port'], {'baudrate': 'BAUDRATE', 'parity': 'serial.PARITY_NONE', 'stopbits': '(1)', 'bytesize': '(8)'}), '(port, baudrate=BAUDRATE, parity=serial.PARITY_NONE, stopbits=\n 1, bytesize=8)\n', (147, 228), False, 'import numpy, serial, time\n'), ((352, 372), 'PIL.Image....
# MIT License # # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
[ "pandas.DataFrame", "pandas.read_csv", "numpy.std", "numpy.identity", "numpy.max", "numpy.linalg.matrix_power", "numpy.min", "sklearn.preprocessing.normalize", "numpy.mean" ]
[((1741, 1776), 'pandas.read_csv', 'pd.read_csv', (['path_to_feature_values'], {}), '(path_to_feature_values)\n', (1752, 1776), True, 'import pandas as pd\n'), ((2398, 2425), 'pandas.read_csv', 'pd.read_csv', (['path_to_labels'], {}), '(path_to_labels)\n', (2409, 2425), True, 'import pandas as pd\n'), ((3979, 4004), 'p...
import numpy as np import pandas as pd def build_chart(array, min_label_percentage=0.05): sizes = pd.value_counts(array) N = array.shape[0] out_labels = [] out_sizes = [] others_size = 0 for index, values in sizes.iteritems(): if (values/N) > min_label_percentage: out_l...
[ "numpy.array", "pandas.value_counts" ]
[((103, 125), 'pandas.value_counts', 'pd.value_counts', (['array'], {}), '(array)\n', (118, 125), True, 'import pandas as pd\n'), ((518, 537), 'numpy.array', 'np.array', (['out_sizes'], {}), '(out_sizes)\n', (526, 537), True, 'import numpy as np\n')]
import numpy as np import warnings from .explainer import Explainer class LinearExplainer(Explainer): """ Computes SHAP values for a linear model, optionally accounting for inter-feature correlations. This computes the SHAP values for a linear model and can account for the correlations among the input fea...
[ "numpy.outer", "numpy.zeros", "numpy.arange", "numpy.matmul", "numpy.dot", "numpy.cov", "warnings.warn", "numpy.random.shuffle" ]
[((4987, 5003), 'numpy.zeros', 'np.zeros', (['(M, M)'], {}), '((M, M))\n', (4995, 5003), True, 'import numpy as np\n'), ((5025, 5041), 'numpy.zeros', 'np.zeros', (['(M, M)'], {}), '((M, M))\n', (5033, 5041), True, 'import numpy as np\n'), ((5056, 5082), 'numpy.arange', 'np.arange', (['M'], {'dtype': 'np.int'}), '(M, dt...
"""utility functions for the models module""" from concurrent.futures import ProcessPoolExecutor as Pool from itertools import islice from typing import Callable, Iterable, Iterator, List, TypeVar import numpy as np from tqdm import tqdm T = TypeVar('T') def batches(it: Iterable[T], chunk_size: int) -> Iterator[List...
[ "tqdm.tqdm", "concurrent.futures.ProcessPoolExecutor", "numpy.array", "itertools.islice", "typing.TypeVar" ]
[((244, 256), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (251, 256), False, 'from typing import Callable, Iterable, Iterator, List, TypeVar\n'), ((1036, 1047), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1044, 1047), True, 'import numpy as np\n'), ((916, 938), 'concurrent.futures.ProcessPoolExecut...
import argparse import logging import numpy as np from human import Man, Child from robot import Qolo, Wheelchair, Pepper from controller import NoControl, AdmittanceController, PassiveDSController from simulator import Simulator human_class = { "man": Man, "child": Child, } robot_class = { "qolo": Qolo...
[ "numpy.save", "argparse.ArgumentParser", "numpy.linspace", "simulator.Simulator" ]
[((545, 640), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""HRC"""', 'description': '"""Simulation of robot and human collision"""'}), "(prog='HRC', description=\n 'Simulation of robot and human collision')\n", (568, 640), False, 'import argparse\n'), ((1741, 1908), 'simulator.Simulator', '...
import matplotlib.pylab as pylab import matplotlib.pyplot as plt import numpy as np class ToyPlot(object): def __init__(self, x_range, y_range): range_x = np.linspace(x_range[0], x_range[1], 100) range_y = np.linspace(y_range[0], y_range[1], 100) self.extent = [x_range[0], x_range[1], y_ra...
[ "numpy.meshgrid", "matplotlib.pyplot.contour", "numpy.arange", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((169, 209), 'numpy.linspace', 'np.linspace', (['x_range[0]', 'x_range[1]', '(100)'], {}), '(x_range[0], x_range[1], 100)\n', (180, 209), True, 'import numpy as np\n'), ((228, 268), 'numpy.linspace', 'np.linspace', (['y_range[0]', 'y_range[1]', '(100)'], {}), '(y_range[0], y_range[1], 100)\n', (239, 268), True, 'impor...
#! /usr/bin/env python # Copyright 2019. IBM All Rights Reserved. # Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www...
[ "os.makedirs", "argparse.ArgumentParser", "tensorflow_serving.apis.predict_pb2.PredictRequest", "os.path.isdir", "tensorflow.python.keras.preprocessing.image.img_to_array", "grpc.insecure_channel", "tensorflow.python.keras.preprocessing.image.load_img", "tensorflow.python.keras.applications.vgg16.prep...
[((1717, 1742), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1740, 1742), False, 'import argparse\n'), ((2156, 2191), 'os.path.join', 'os.path.join', (['data_dir', '_IMAGES_DIR'], {}), '(data_dir, _IMAGES_DIR)\n', (2168, 2191), False, 'import os\n'), ((3274, 3298), 'os.listdir', 'os.listdir'...
from transformers import AutoModelForSequenceClassification, AutoTokenizer from typing import List import numpy as np import torch.nn import torch from nboost.models.rerank.base import RerankModel from nboost import defaults class PtBertModel(RerankModel): def __init__(self, *args, **kwargs): super().__i...
[ "torch.cuda.synchronize", "numpy.extract", "numpy.argsort", "transformers.AutoTokenizer.from_pretrained", "torch.cuda.is_available", "transformers.AutoModelForSequenceClassification.from_pretrained", "torch.device", "numpy.squeeze", "torch.no_grad", "torch.tensor" ]
[((732, 798), 'transformers.AutoModelForSequenceClassification.from_pretrained', 'AutoModelForSequenceClassification.from_pretrained', (['self.model_dir'], {}), '(self.model_dir)\n', (782, 798), False, 'from transformers import AutoModelForSequenceClassification, AutoTokenizer\n'), ((824, 869), 'transformers.AutoTokeni...
#!/usr/bin/env python # matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from scipy.stats import boxcox, boxcox_normplot, boxcox_normmax class BoxCox(object): @staticmethod def transform(samples, shape): samples = np.asarray(samples) return boxcox(samples, shape) ...
[ "matplotlib.pyplot.show", "scipy.stats.boxcox", "numpy.power", "numpy.asarray", "scipy.stats.boxcox_normplot", "matplotlib.pyplot.figure", "scipy.stats.boxcox_normmax", "numpy.exp" ]
[((257, 276), 'numpy.asarray', 'np.asarray', (['samples'], {}), '(samples)\n', (267, 276), True, 'import numpy as np\n'), ((292, 314), 'scipy.stats.boxcox', 'boxcox', (['samples', 'shape'], {}), '(samples, shape)\n', (298, 314), False, 'from scipy.stats import boxcox, boxcox_normplot, boxcox_normmax\n'), ((386, 402), '...
from mint import Grid, getIntegralsInXYZ, getIntegralsInLonLat, VectorInterp import numpy import pytest from pathlib import Path DATA_DIR = Path(__file__).absolute().parent.parent.parent / Path('data') @pytest.fixture def filename(): return str(DATA_DIR / Path('lfric_diag_wind.nc')) @pytest.fixture def grid(fi...
[ "netCDF4.Dataset", "mint.VectorInterp", "matplotlib.pylab.title", "numpy.zeros", "numpy.ones", "mint.getIntegralsInLonLat", "pathlib.Path", "matplotlib.pylab.quiver", "numpy.fabs", "numpy.linspace", "mint.getIntegralsInXYZ", "mint.Grid", "matplotlib.pylab.show" ]
[((190, 202), 'pathlib.Path', 'Path', (['"""data"""'], {}), "('data')\n", (194, 202), False, 'from pathlib import Path\n'), ((338, 344), 'mint.Grid', 'Grid', ([], {}), '()\n', (342, 344), False, 'from mint import Grid, getIntegralsInXYZ, getIntegralsInLonLat, VectorInterp\n'), ((696, 736), 'numpy.zeros', 'numpy.zeros',...
import cv2 import h5py import scipy from scipy import ndimage import hashlib import numpy as np import os import re import sys import time import tifffile from skimage import transform from skimage import feature import random def find_majority_element_in_list(k): myMap = {} maximum = ( '', 0 ) # (occurring e...
[ "numpy.flip", "unicodedata.numeric", "time.time", "numpy.cumsum", "numpy.finfo", "sys.stdout.flush", "numpy.exp", "numpy.interp", "sys.stderr.write", "numpy.unique" ]
[((1272, 1330), 'numpy.unique', 'np.unique', (['source'], {'return_inverse': '(True)', 'return_counts': '(True)'}), '(source, return_inverse=True, return_counts=True)\n', (1281, 1330), True, 'import numpy as np\n'), ((1400, 1439), 'numpy.unique', 'np.unique', (['template'], {'return_counts': '(True)'}), '(template, ret...
#!/usr/bin/env python3 import argparse from collections import Counter from itertools import combinations from math import lgamma, log, factorial import numpy as np import operator import os import pandas as pd from functools import reduce import sys import time import warnings ############################### ##### A...
[ "pandas.DataFrame", "os.makedirs", "numpy.log", "pandas.read_csv", "collections.Counter", "os.path.exists", "time.time", "itertools.combinations", "numpy.array", "warnings.warn", "math.log", "math.lgamma" ]
[((562, 575), 'math.lgamma', 'lgamma', (['(n + x)'], {}), '(n + x)\n', (568, 575), False, 'from math import lgamma, log, factorial\n'), ((576, 585), 'math.lgamma', 'lgamma', (['x'], {}), '(x)\n', (582, 585), False, 'from math import lgamma, log, factorial\n'), ((27521, 27532), 'time.time', 'time.time', ([], {}), '()\n'...
import numpy as np class Dense: def __init__(self, size, activation=None, init_method=None): """ size: Tuple holding number of neurons in the input and the output activation: Activation function -'elu': Exponential Linear Unit function -'relu': Rectified linear acti...
[ "numpy.maximum", "numpy.sum", "numpy.random.randn", "numpy.zeros", "numpy.ones", "numpy.exp", "numpy.random.normal", "numpy.sqrt" ]
[((2563, 2579), 'numpy.maximum', 'np.maximum', (['(0)', 'Z'], {}), '(0, Z)\n', (2573, 2579), True, 'import numpy as np\n'), ((1373, 1401), 'numpy.zeros', 'np.zeros', (['(1, self.out_size)'], {}), '((1, self.out_size))\n', (1381, 1401), True, 'import numpy as np\n'), ((2081, 2114), 'numpy.sum', 'np.sum', (['dZ'], {'axis...
import streamlit as st import numpy as np import pandas as pd import math st.title("Graphs") def square(x): return x**2 def exp_dec(x): return math.e ** (x/-8) * math.cos(x) x = [] for loop in np.arange(-2, 2.1, .1): x.append(loop) y = [square(v) for v in x] df = pd.DataFrame(zip(x, y), columns=['x', 'y...
[ "streamlit.line_chart", "math.sin", "streamlit.title", "numpy.arange", "math.cos" ]
[((75, 93), 'streamlit.title', 'st.title', (['"""Graphs"""'], {}), "('Graphs')\n", (83, 93), True, 'import streamlit as st\n'), ((205, 228), 'numpy.arange', 'np.arange', (['(-2)', '(2.1)', '(0.1)'], {}), '(-2, 2.1, 0.1)\n', (214, 228), True, 'import numpy as np\n'), ((347, 364), 'streamlit.line_chart', 'st.line_chart',...
import os import re import csv import numpy as np from itertools import groupby from copy import deepcopy import numpy as np def numpy_kl_div(p, q): return np.sum(np.where(p != 0, p * np.log(p / q), 0)) def flatten(nested_elems): return [elem for elems in nested_elems for elem in elems] def stratify(data, c...
[ "copy.deepcopy", "numpy.log", "numpy.amax", "numpy.array", "numpy.random.choice" ]
[((1455, 1477), 'copy.deepcopy', 'deepcopy', (['subset_sizes'], {}), '(subset_sizes)\n', (1463, 1477), False, 'from copy import deepcopy\n'), ((190, 203), 'numpy.log', 'np.log', (['(p / q)'], {}), '(p / q)\n', (196, 203), True, 'import numpy as np\n'), ((3553, 3586), 'numpy.random.choice', 'np.random.choice', (['larges...
import unittest import timeout_decorator from gradescope_utils.autograder_utils.decorators import weight import numpy as np from manipulation.utils import LoadDataResource class TestSegmentationAndGrasp(unittest.TestCase): def __init__(self, test_name, notebook_locals): super().__init__(test_name) ...
[ "manipulation.utils.LoadDataResource", "numpy.asarray", "numpy.linalg.norm", "gradescope_utils.autograder_utils.decorators.weight", "timeout_decorator.timeout" ]
[((367, 376), 'gradescope_utils.autograder_utils.decorators.weight', 'weight', (['(4)'], {}), '(4)\n', (373, 376), False, 'from gradescope_utils.autograder_utils.decorators import weight\n'), ((382, 413), 'timeout_decorator.timeout', 'timeout_decorator.timeout', (['(10.0)'], {}), '(10.0)\n', (407, 413), False, 'import ...
import numpy as np from prince_cr.util import get_2Dinterp_object, get_interp_object, info, get_AZN from .base import CrossSectionBase class ResponseFunction(object): """Redistribution Function based on Crossection model The response function is the angular average crosssection """ def __init__...
[ "prince_cr.util.info", "scipy.integrate.cumtrapz", "numpy.zeros", "prince_cr.util.get_2Dinterp_object", "prince_cr.util.get_AZN" ]
[((1695, 1716), 'numpy.zeros', 'np.zeros', (['ygrid.shape'], {}), '(ygrid.shape)\n', (1703, 1716), True, 'import numpy as np\n'), ((4060, 4110), 'scipy.integrate.cumtrapz', 'integrate.cumtrapz', (['(egrid * cross_section)'], {'x': 'egrid'}), '(egrid * cross_section, x=egrid)\n', (4078, 4110), False, 'from scipy import ...
import numpy as np import base64 from enum import IntEnum import io from collections import defaultdict, namedtuple import itertools from pathlib import Path import json from sklearn.metrics import f1_score from forager_server_api.models import Dataset, DatasetItem, Annotation import calendar import time import math O...
[ "forager_server_api.models.Dataset.objects.get", "forager_server_api.models.DatasetItem.objects.in_bulk", "io.BytesIO", "numpy.load", "json.loads", "math.ceil", "forager_server_api.models.DatasetItem.objects.filter", "math.floor", "calendar.timegm", "base64.b64decode", "collections.defaultdict",...
[((421, 493), 'pathlib.Path', 'Path', (['"""/home/fpoms/forager/indexes/2d2b13f9-3b30-4e51-8ab9-4e8a03ba1f03"""'], {}), "('/home/fpoms/forager/indexes/2d2b13f9-3b30-4e51-8ab9-4e8a03ba1f03')\n", (425, 493), False, 'from pathlib import Path\n'), ((1166, 1201), 'collections.namedtuple', 'namedtuple', (['"""Tag"""', '"""ca...
import hydroDL from hydroDL.data import dbCsv from hydroDL.utils import grid from hydroDL.post import plot import numpy as np import matplotlib.pyplot as plt rootDB = hydroDL.pathSMAP['DB_L3_NA'] tRange = [20150401, 20160401] df = dbCsv.DataframeCsv( rootDB=rootDB, subset='CONUSv2f1', tRange=tRange) lat, lon = d...
[ "matplotlib.rcParams.update", "numpy.zeros", "numpy.where", "hydroDL.data.dbCsv.DataframeCsv", "matplotlib.pyplot.subplots", "numpy.unique" ]
[((234, 302), 'hydroDL.data.dbCsv.DataframeCsv', 'dbCsv.DataframeCsv', ([], {'rootDB': 'rootDB', 'subset': '"""CONUSv2f1"""', 'tRange': 'tRange'}), "(rootDB=rootDB, subset='CONUSv2f1', tRange=tRange)\n", (252, 302), False, 'from hydroDL.data import dbCsv\n'), ((514, 558), 'numpy.unique', 'np.unique', (['codeLst[:, 0]']...
import os import sys sys.path.append("../") import pickle import numpy as np from tensorflow.keras.utils import Sequence from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping from tensorflow.keras.losses import SparseCategoricalCrossentropy from official.nlp import optimization from sklearn.utils impo...
[ "sys.path.append", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "neurallog.data_loader.load_supercomputers", "numpy.argmax", "neurallog.models.NeuralLog", "numpy.zeros", "official.nlp.optimization.create_optimizer", "tensorflow.keras.callbacks.ModelCheckpoint", "numpy.array", "numpy.re...
[((22, 44), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (37, 44), False, 'import sys\n'), ((1926, 2069), 'official.nlp.optimization.create_optimizer', 'optimization.create_optimizer', ([], {'init_lr': 'init_lr', 'num_train_steps': 'num_train_steps', 'num_warmup_steps': 'num_warmup_steps', 'o...
""" Baisc spatial utility functions. """ import numpy as np from numpy import cos, sin, deg2rad, arctan, arctan2, arcsin, arccos, sqrt, abs import itertools import logging from pyrolite.util.math import isclose logging.getLogger(__name__).addHandler(logging.NullHandler()) logger = logging.getLogger(__name__) def _sp...
[ "numpy.vectorize", "numpy.abs", "numpy.arctan2", "numpy.deg2rad", "numpy.isnan", "numpy.rad2deg", "numpy.sin", "numpy.array", "logging.NullHandler", "itertools.product", "numpy.cos", "numpy.linspace", "logging.getLogger" ]
[((283, 310), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (300, 310), False, 'import logging\n'), ((251, 272), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (270, 272), False, 'import logging\n'), ((678, 690), 'numpy.abs', 'abs', (['(λ1 - λ2)'], {}), '(λ1 - λ2)\n', (6...
import json from climpy.interactive import ValueChanger import panel as pn import xarray as xr import numpy from numpy import array import holoviews as hv # Used for selection_expr as string from holoviews.util.transform import dim # noqa: F401 from holoviews.element.selection import spatial_select from climate_simu...
[ "climate_simulation_platform.message_broker.send_preprocessing_message", "holoviews.plotting.list_cmaps", "numpy.zeros", "climate_simulation_platform.db.load_file", "json.dumps", "xarray.Dataset", "numpy.rint", "numpy.where", "panel.layout.HSpacer", "climate_simulation_platform.db.save_revision", ...
[((477, 501), 'holoviews.plotting.list_cmaps', 'hv.plotting.list_cmaps', ([], {}), '()\n', (499, 501), True, 'import holoviews as hv\n'), ((712, 736), 'numpy.zeros', 'numpy.zeros', (['bathy.shape'], {}), '(bathy.shape)\n', (723, 736), False, 'import numpy\n'), ((6261, 6306), 'numpy.where', 'numpy.where', (['(self.ds.Oc...
import numpy as np from scipy import stats import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info) a = np.array([0, 0, 0, 1, 1, 1, 1]) b = np.arange(7) pearson1 = stats.pearsonr(a, b) a1 = a * 1e90 b1 = b * 1e90 pearson2 = stats.pearsonr(a1, b1) print(pearson1 , pearson2) # see https...
[ "numpy.allclose", "numpy.array", "numpy.arange", "scipy.stats.pearsonr" ]
[((138, 169), 'numpy.array', 'np.array', (['[0, 0, 0, 1, 1, 1, 1]'], {}), '([0, 0, 0, 1, 1, 1, 1])\n', (146, 169), True, 'import numpy as np\n'), ((174, 186), 'numpy.arange', 'np.arange', (['(7)'], {}), '(7)\n', (183, 186), True, 'import numpy as np\n'), ((198, 218), 'scipy.stats.pearsonr', 'stats.pearsonr', (['a', 'b'...
import torch import numpy as np from PIL import Image import os def mkdirs(paths): if isinstance(paths, list) and not isinstance(paths, str): for path in paths: mkdir(path) else: mkdir(paths) def mkdir(path): if not os.path.exists(path): os.makedirs(path) def tens...
[ "os.mkdir", "os.makedirs", "os.path.isdir", "os.path.exists", "numpy.transpose", "numpy.tile", "PIL.Image.fromarray", "os.path.join" ]
[((922, 950), 'PIL.Image.fromarray', 'Image.fromarray', (['image_numpy'], {}), '(image_numpy)\n', (937, 950), False, 'from PIL import Image\n'), ((262, 282), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (276, 282), False, 'import os\n'), ((292, 309), 'os.makedirs', 'os.makedirs', (['path'], {}), '(pa...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 11 16:13:26 2020 @author: <NAME> In this code a Hamiltonian Neural Network is designed and employed to solve a system of two differential equations obtained by Hamilton's equations for the the Hamiltonian of nonlinear oscillator. """ import numpy a...
[ "matplotlib.pyplot.loglog", "numpy.ones", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "torch.ones", "scipy.integrate.odeint", "numpy.savetxt", "torch.exp", "numpy.linspace", "torch.nn.Linear", "copy.deepcopy", "torch.randn_like", "matplotlib.pyplot.ylim", "matplotlib.pypl...
[((1646, 1671), 'numpy.linspace', 'np.linspace', (['t0', 't_max', 'N'], {}), '(t0, t_max, N)\n', (1657, 1671), True, 'import numpy as np\n'), ((7306, 7318), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (7316, 7318), True, 'import matplotlib.pyplot as plt\n'), ((7319, 7354), 'matplotlib.pyplot.loglog', 'p...
from django.shortcuts import render import pandas as pd import pickle import numpy as np from sklearn.preprocessing import StandardScaler # Create your views here. def liverApp(request): return render(request, 'liver-app.html', {}) def liverApp_result(request): context = {} df = {} input_data = [] ...
[ "django.shortcuts.render", "numpy.array", "numpy.concatenate" ]
[((200, 237), 'django.shortcuts.render', 'render', (['request', '"""liver-app.html"""', '{}'], {}), "(request, 'liver-app.html', {})\n", (206, 237), False, 'from django.shortcuts import render\n'), ((1633, 1678), 'django.shortcuts.render', 'render', (['request', '"""liver_result.html"""', 'context'], {}), "(request, 'l...
import numpy as np import base64 import json from werkzeug.wrappers import Request, Response import params as yamnet_params import yamnet as yamnet_model DEFAULT_TOP_N = 5 def decode_audio(audio_bytes): return np.frombuffer(base64.b64decode(audio_bytes), dtype="float32") def make_app(make_predict_func): ...
[ "functools.partial", "argparse.ArgumentParser", "params.Params", "werkzeug.wrappers.Request", "bjoern.run", "base64.b64decode", "json.dumps", "numpy.argsort", "yamnet.yamnet_frames_model", "numpy.mean", "yamnet.class_names" ]
[((1057, 1079), 'params.Params', 'yamnet_params.Params', ([], {}), '()\n', (1077, 1079), True, 'import params as yamnet_params\n'), ((1093, 1133), 'yamnet.yamnet_frames_model', 'yamnet_model.yamnet_frames_model', (['params'], {}), '(params)\n', (1125, 1133), True, 'import yamnet as yamnet_model\n'), ((1192, 1240), 'yam...
# -*- coding: utf-8 -*- """ @created on: 27/03/19, @author: <NAME>, @version: v0.0.1 Description: Sphinx Documentation Status: ..todo:: """ import numpy as np import pandas as pd import traceback pd.set_option('display.max_rows', 1000) pd.set_option('display.max_columns', 1000) def encode_continuous_column(data...
[ "pandas.DataFrame", "traceback.print_exc", "numpy.log", "pandas.pivot_table", "pandas.read_csv", "pandas.set_option" ]
[((202, 241), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(1000)'], {}), "('display.max_rows', 1000)\n", (215, 241), True, 'import pandas as pd\n'), ((242, 284), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(1000)'], {}), "('display.max_columns', 1000)\n", (255, 284), Tru...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import argparse import pdb import numpy as np import tensorflow as tf from google.protobuf import text_format from waymo_open_dataset.metrics.python import detection_metrics from waymo_open_dataset.p...
[ "tensorflow.test.main", "os.path.join", "tensorflow.compat.v1.placeholder", "os.path.exists", "tensorflow.zeros_like", "tensorflow.compat.v1.disable_eager_execution", "google.protobuf.text_format.Merge", "numpy.array", "waymo_open_dataset.protos.metrics_pb2.Objects", "tensorflow.Graph", "tensorf...
[((9196, 9234), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (9232, 9234), True, 'import tensorflow as tf\n'), ((9239, 9253), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (9251, 9253), True, 'import tensorflow as tf\n'), ((554, 575), 'waymo_open_...
"""Module with functionalities shared among energy systems.""" import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages def create_multipage_pdf(file_name='plots.pdf', figs=None, dpi=300, mute=False):...
[ "matplotlib.colors.LinearSegmentedColormap.from_list", "pandas.DataFrame", "matplotlib.backends.backend_pdf.PdfPages", "matplotlib.style.use", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "pandas.DatetimeIndex", "matplotlib.pyplot.figure", "matplotlib.pyplot.rcParams.update", "numpy.ar...
[((3141, 3181), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (['mpl.rcParamsDefault'], {}), '(mpl.rcParamsDefault)\n', (3160, 3181), True, 'import matplotlib as mpl\n'), ((3207, 3231), 'matplotlib.style.use', 'mpl.style.use', (['"""default"""'], {}), "('default')\n", (3220, 3231), True, 'import matplotlib as mp...
import math, time, random import numpy as np import tensorflow as tf def train1(): feature_columns = [tf.feature_column.numeric_column("x", shape=[1])] estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns) x_train = np.array([1., 2., 3., 4.]) y_train = np.array([0., -1., -2., -3.]) ...
[ "tensorflow.get_collection", "numpy.ones", "tensorflow.matmul", "tensorflow.Variable", "random.randint", "tensorflow.placeholder", "tensorflow.summary.FileWriter", "tensorflow.summary.histogram", "tensorflow.gradients", "tensorflow.name_scope", "tensorflow.summary.merge_all", "tensorflow.summa...
[((172, 233), 'tensorflow.estimator.LinearRegressor', 'tf.estimator.LinearRegressor', ([], {'feature_columns': 'feature_columns'}), '(feature_columns=feature_columns)\n', (200, 233), True, 'import tensorflow as tf\n'), ((249, 279), 'numpy.array', 'np.array', (['[1.0, 2.0, 3.0, 4.0]'], {}), '([1.0, 2.0, 3.0, 4.0])\n', (...
#! /usr/bin/python3 from numpy import array, zeros, mean, eye, squeeze, newaxis from numpy.random import rand from scipy.linalg import cho_factor, cho_solve, norm from mat_util import load, save, save_text from matplotlib import pyplot as plt def shrinkage(a, k): return (abs(a-k)-abs(a+k))/2 + a newmat = False; u...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "mat_util.save_text", "numpy.zeros", "mat_util.load", "numpy.mean", "scipy.linalg.norm", "numpy.random.rand", "numpy.eye", "numpy.squeeze", "mat_util.save" ]
[((1326, 1339), 'numpy.zeros', 'zeros', (['(n, p)'], {}), '((n, p))\n', (1331, 1339), False, 'from numpy import array, zeros, mean, eye, squeeze, newaxis\n'), ((1344, 1357), 'numpy.zeros', 'zeros', (['(n, p)'], {}), '((n, p))\n', (1349, 1357), False, 'from numpy import array, zeros, mean, eye, squeeze, newaxis\n'), ((1...
import path_magic from function_space import FunctionSpace import numpy as np from mesh import CrazyMesh from forms import Form from hodge import hodge from coboundaries import d from _assembling import assemble_, integral1d_ from assemble import assemble import matplotlib.pyplot as plt import scipy.io from scipy impor...
[ "matplotlib.pyplot.title", "numpy.shape", "numpy.sin", "matplotlib.pyplot.contourf", "_assembling.integral1d_", "inner_product.inner", "matplotlib.pyplot.colorbar", "scipy.sparse.linalg.spsolve", "numpy.size", "matplotlib.pyplot.show", "numpy.ceil", "mesh.CrazyMesh", "_assembling.assemble_",...
[((938, 983), 'mesh.CrazyMesh', 'CrazyMesh', (['(2)', '(nx, ny)', '((-1, 1), (-1, 1))', 'c'], {}), '(2, (nx, ny), ((-1, 1), (-1, 1)), c)\n', (947, 983), False, 'from mesh import CrazyMesh\n'), ((1082, 1126), 'function_space.FunctionSpace', 'FunctionSpace', (['mesh', '"""0-ext_gauss"""', '(px, py)'], {}), "(mesh, '0-ext...
import numpy as np from ddCRP import statistics from sklearn.metrics import normalized_mutual_info_score as NMI def test_normalize(): """ Test to check feature normalization. """ data = np.asarray( [[-1, 0, 1], [1, 2, 3]]) mu = data.mean(0) stdev = data.std(0) ...
[ "ddCRP.statistics.NMI", "numpy.asarray", "ddCRP.statistics.Normalize", "sklearn.metrics.normalized_mutual_info_score" ]
[((206, 241), 'numpy.asarray', 'np.asarray', (['[[-1, 0, 1], [1, 2, 3]]'], {}), '([[-1, 0, 1], [1, 2, 3]])\n', (216, 241), True, 'import numpy as np\n'), ((383, 409), 'ddCRP.statistics.Normalize', 'statistics.Normalize', (['data'], {}), '(data)\n', (403, 409), False, 'from ddCRP import statistics\n'), ((477, 501), 'num...
import numpy as np # To do # Update graph representation def component_idx(tile_rank, idx): """ Inputs: _______ tile_rank : int Outputs: _______ range : np.array (L,) Vector with """ init = tile_rank[:idx].sum() length = tile_rank[id...
[ "numpy.zeros", "numpy.isnan", "numpy.hstack", "numpy.nonzero", "numpy.arange", "numpy.vstack", "numpy.repeat" ]
[((334, 377), 'numpy.arange', 'np.arange', (['init', '(init + length)'], {'dtype': '"""int"""'}), "(init, init + length, dtype='int')\n", (343, 377), True, 'import numpy as np\n'), ((1814, 1842), 'numpy.zeros', 'np.zeros', (['(num_total_tiles,)'], {}), '((num_total_tiles,))\n', (1822, 1842), True, 'import numpy as np\n...
from tqdm import tqdm import torch import numpy as np from torchvision import transforms import cv2 @torch.no_grad() def p_sample_ddim(self, x, c, t, index): b, *_, device = *x.shape, x.device e_t = self.model.apply_model(x, t, c) alphas = self.ddim_alphas alphas_prev = self.ddim_alphas_prev sqrt...
[ "tqdm.tqdm", "numpy.flip", "cv2.cvtColor", "torch.full", "torchvision.transforms.Normalize", "torch.no_grad", "cv2.resize", "torchvision.transforms.ToTensor" ]
[((102, 117), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (115, 117), False, 'import torch\n'), ((948, 963), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (961, 963), False, 'import torch\n'), ((1816, 1831), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1829, 1831), False, 'import torch\n'), ((2636...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # import matplotlib.pyplot as plt import numpy as np from scipy.linalg import norm, solve def spline(d, nspline): """The inputs are: * d: the displacement (or velocity) time series. * n: the number of spline segments (or, the number of knots - 1). The ...
[ "scipy.linalg.solve", "numpy.sum", "numpy.zeros", "numpy.where", "numpy.linspace" ]
[((559, 595), 'numpy.linspace', 'np.linspace', (['mind', 'maxd', '(nspline + 1)'], {}), '(mind, maxd, nspline + 1)\n', (570, 595), True, 'import numpy as np\n'), ((667, 685), 'numpy.zeros', 'np.zeros', (['(nk, nk)'], {}), '((nk, nk))\n', (675, 685), True, 'import numpy as np\n'), ((1399, 1417), 'numpy.zeros', 'np.zeros...
"""Reads the DeepFashion dataset and provides a python interface to the same. """ import os import numpy as np import matplotlib.pyplot as plt import pickle class DeepFashion: def __init__(self, dataset_path): # The constants img_folder_name = "img" eval_folder_name = "Eval" anno...
[ "pickle.dump", "numpy.asarray", "numpy.zeros", "os.path.exists", "pickle.load", "os.path.join" ]
[((878, 918), 'os.path.join', 'os.path.join', (['self.path', 'img_folder_name'], {}), '(self.path, img_folder_name)\n', (890, 918), False, 'import os\n'), ((943, 984), 'os.path.join', 'os.path.join', (['self.path', 'eval_folder_name'], {}), '(self.path, eval_folder_name)\n', (955, 984), False, 'import os\n'), ((1009, 1...
""" @file @brief Manipulate data for training. """ import numpy from onnxruntime import OrtValue class OrtDataLoader: """ Draws consecutive random observations from a dataset by batch. It iterates over the datasets by drawing *batch_size* consecutive observations. :param X: features :param y:...
[ "onnxruntime.OrtValue.ortvalue_from_numpy", "numpy.random.randint", "numpy.ascontiguousarray" ]
[((820, 846), 'numpy.ascontiguousarray', 'numpy.ascontiguousarray', (['X'], {}), '(X)\n', (843, 846), False, 'import numpy\n'), ((864, 890), 'numpy.ascontiguousarray', 'numpy.ascontiguousarray', (['y'], {}), '(y)\n', (887, 890), False, 'import numpy\n'), ((1843, 1869), 'numpy.random.randint', 'numpy.random.randint', ([...
import sys import cv2 import numpy as np import glob import os # values to adjust threshold_margin = 5 erode_kernal_size = 2 erode_iterations = 2 dilute_kernal_size = 5 dilute_interations = 3 root_image_folder = sys.argv[1] root_output_folder = sys.argv[2] def max_index(array): max_value = max(array) for i i...
[ "cv2.GaussianBlur", "os.path.abspath", "os.makedirs", "cv2.dilate", "cv2.waitKey", "cv2.calcHist", "cv2.threshold", "cv2.imwrite", "cv2.cvtColor", "numpy.ones", "numpy.zeros", "os.path.basename", "cv2.imread", "cv2.drawContours", "glob.glob", "cv2.erode", "cv2.imshow", "cv2.findCon...
[((1721, 1755), 'os.path.abspath', 'os.path.abspath', (['root_image_folder'], {}), '(root_image_folder)\n', (1736, 1755), False, 'import os\n'), ((1770, 1807), 'glob.glob', 'glob.glob', (["(root_image_path + '/*.tif')"], {}), "(root_image_path + '/*.tif')\n", (1779, 1807), False, 'import glob\n'), ((1860, 1906), 'os.ma...
# Parts of this file are modified from Tensorflow tutorial, licensed under the # Apache License, Version 2.0, https://www.apache.org/licenses/LICENSE-2.0 # Copyright 2018 The TensorFlow Authors. All Rights Reserved. """Dataset download and creation, as well as other data-related functions.""" import collections import ...
[ "tensorflow.image.grayscale_to_rgb", "collections.defaultdict", "tensorflow.image.decode_png", "pathlib.Path", "gan.util.download_file", "numpy.random.randint", "shutil.rmtree", "os.path.join", "shutil.copy", "numpy.full", "cv2.imwrite", "os.path.dirname", "os.path.exists", "tarfile.open",...
[((541, 568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (558, 568), False, 'import logging\n'), ((635, 669), 'os.path.join', 'os.path.join', (['data_dir', 'class_name'], {}), '(data_dir, class_name)\n', (647, 669), False, 'import os\n'), ((674, 711), 'os.makedirs', 'os.makedirs', (['...
from __future__ import division import collections import numpy as np from numpy import random class MarkovException(Exception): """Exception raised when there is a problem with a markov chain """ pass class MarkovChain: """Markov Chain modeling Args: pi (list) : A vector containing the p...
[ "numpy.copy", "numpy.zeros", "numpy.identity", "numpy.where", "numpy.linalg.inv", "numpy.random.randint", "numpy.dot", "numpy.concatenate", "numpy.diagonal" ]
[((1558, 1569), 'numpy.copy', 'np.copy', (['pi'], {}), '(pi)\n', (1565, 1569), True, 'import numpy as np\n'), ((1596, 1615), 'numpy.copy', 'np.copy', (['transition'], {}), '(transition)\n', (1603, 1615), True, 'import numpy as np\n'), ((1786, 1810), 'numpy.dot', 'np.dot', (['self._N', 'self._R'], {}), '(self._N, self._...
import numpy as np from ex1.data_perturb import DataPerturb class DataPerturbUniform(DataPerturb): def __init__(self, k=1.0): self.k = k @property def k(self): return self._k @k.setter def k(self, value): self._k = float(value) def perturb_data(self, x): no...
[ "numpy.random.random_sample" ]
[((326, 363), 'numpy.random.random_sample', 'np.random.random_sample', ([], {'size': 'x.shape'}), '(size=x.shape)\n', (349, 363), True, 'import numpy as np\n')]
import json import numpy as np import tensorflow as tf import torch def post_processing(reg_list, cls_list, num_classes, image_size, feature_map_wh_list, min_boxes, center_variance, size_variance, conf_threshold=0.6, nms_max_output_size=100, nms_iou_threshold=0.3, top_k=100): ...
[ "tensorflow.keras.layers.Reshape", "tensorflow.clip_by_value", "numpy.product", "torch.device", "tensorflow.keras.layers.Concatenate", "tensorflow.gather", "tensorflow.nn.top_k", "tensorflow.keras.layers.Softmax", "tensorflow.concat", "numpy.transpose", "tensorflow.exp", "numpy.reshape", "nu...
[((945, 986), 'tensorflow.boolean_mask', 'tf.boolean_mask', ([], {'tensor': 'result', 'mask': 'mask'}), '(tensor=result, mask=mask)\n', (960, 986), True, 'import tensorflow as tf\n'), ((1029, 1213), 'tensorflow.image.non_max_suppression', 'tf.image.non_max_suppression', ([], {'boxes': 'result[..., -4:]', 'scores': 'res...
import numpy as np import cv2 from PIL import Image import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt from tkinter import * from tkinter import filedialog from tkinter import messagebox import os class staticClass: selc_im_path="" grnd_path="" save_path="" root = Tk() #main root...
[ "cv2.waitKey", "cv2.imwrite", "cv2.destroyAllWindows", "tkinter.filedialog.askopenfilename", "tkinter.filedialog.askdirectory", "cv2.imread", "matplotlib.use", "numpy.mean", "cv2.imshow", "tkinter.messagebox.showerror", "numpy.all" ]
[((70, 91), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (84, 91), False, 'import matplotlib\n'), ((434, 462), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (460, 462), False, 'from tkinter import filedialog\n'), ((785, 813), 'tkinter.filedialog.askopenfi...
import torch import numpy as np from torch.distributions import constraints, Distribution from relie.utils.so3_tools import so3_uniform_random class SO3Prior(Distribution): domain = constraints.real codomain = constraints.real event_dim = 2 def __init__(self, device=None, dtype=None): super(...
[ "relie.utils.so3_tools.so3_uniform_random", "numpy.log", "torch.Size", "numpy.prod" ]
[((435, 447), 'torch.Size', 'torch.Size', ([], {}), '()\n', (445, 447), False, 'import torch\n'), ((462, 476), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (469, 476), True, 'import numpy as np\n'), ((673, 701), 'numpy.log', 'np.log', (['(1 / (8 * np.pi ** 2))'], {}), '(1 / (8 * np.pi ** 2))\n', (679, 701), T...
'''Black box false discovery rate (FDR) control for treatment effects. We use the two-groups empirical Bayes approach for the treatment effects and fit a collection of deep networks as the empirical prior.''' from __future__ import print_function import sys import numpy as np import torch import torch.autograd as autog...
[ "torch.nn.Dropout", "numpy.ones", "sys.stdout.flush", "numpy.arange", "numpy.round", "utils.create_folds", "normix.predictive_recursion", "numpy.copy", "torch.FloatTensor", "normix.empirical_null", "normix.GridDistribution", "torch.Tensor", "numpy.linspace", "torch.nn.Linear", "scipy.sta...
[((2866, 2884), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (2882, 2884), False, 'import sys\n'), ((2902, 2949), 'numpy.linspace', 'np.linspace', (['min_alt_z', 'max_alt_z', 'num_alt_bins'], {}), '(min_alt_z, max_alt_z, num_alt_bins)\n', (2913, 2949), True, 'import numpy as np\n'), ((2971, 3039), 'normix....
from GAN.utils import read_and_save import numpy as np import os import matplotlib.pyplot as plt import tensorflow as tf from keras.initializers import RandomNormal from keras import Input, Model from keras.layers import Concatenate, Conv2D, BatchNormalization from keras.layers import LeakyReLU, Activation, Dropout, Co...
[ "keras.models.load_model", "numpy.load", "numpy.ones", "numpy.random.randint", "keras.initializers.RandomNormal", "GAN.utils.read_and_save", "matplotlib.pyplot.close", "matplotlib.pyplot.imshow", "os.path.exists", "keras.layers.LeakyReLU", "keras.Model", "keras.layers.Dropout", "keras.optimi...
[((10497, 10514), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (10504, 10514), True, 'import numpy as np\n'), ((837, 862), 'keras.initializers.RandomNormal', 'RandomNormal', ([], {'stddev': '(0.02)'}), '(stddev=0.02)\n', (849, 862), False, 'from keras.initializers import RandomNormal\n'), ((922, 951), '...
# In this program I try to show the efficasy of hand detection using the gamma correction. # https://www.youtube.com/watch?v=Khy8U_zXDC4 # Usage: python demo_realsense_gamma_analysis.py cfg/yolo-hands.cfg backup/hands/000570.weights # from utils_orgyolo import * import utils_orgyolo as uyolo import numpy as np from da...
[ "cv2.resize", "darknet.Darknet", "pyrealsense2.pipeline", "cv2.waitKey", "collections.deque", "pyrealsense2.config", "cv2.LUT", "utils_orgyolo.plot_boxes_cv2", "numpy.mean", "numpy.arange", "cv2.imshow", "utils_orgyolo.do_detect", "utils_orgyolo.load_class_names" ]
[((730, 751), 'cv2.LUT', 'cv2.LUT', (['image', 'table'], {}), '(image, table)\n', (737, 751), False, 'import cv2\n'), ((801, 817), 'darknet.Darknet', 'Darknet', (['cfgfile'], {}), '(cfgfile)\n', (808, 817), False, 'from darknet import Darknet\n'), ((1005, 1038), 'utils_orgyolo.load_class_names', 'uyolo.load_class_names...
from PIL import Image from PIL import ImageTk from scipy.spatial import distance as dist import tkinter as tki import threading from imutils import perspective from imutils import contours import imutils import numpy as np import cv2 class TallyhoApp: def __init__(self, videoStream): self.videoStream = vid...
[ "cv2.GaussianBlur", "cv2.cv.BoxPoints", "imutils.contours.sort_contours", "cv2.boxPoints", "cv2.minAreaRect", "tkinter.Frame", "imutils.is_cv2", "cv2.erode", "imutils.resize", "tkinter.Label", "cv2.contourArea", "scipy.spatial.distance.euclidean", "cv2.dilate", "tkinter.Button", "cv2.cvt...
[((571, 579), 'tkinter.Tk', 'tki.Tk', ([], {}), '()\n', (577, 579), True, 'import tkinter as tki\n'), ((629, 649), 'tkinter.Frame', 'tki.Frame', (['self.root'], {}), '(self.root)\n', (638, 649), True, 'import tkinter as tki\n'), ((749, 809), 'tkinter.Label', 'tki.Label', (['bottomPanel'], {'text': '"""Calibration width...
#!/usr/bin/env python """ vreckon and vdist are iterative algorithms. How much does PyPy help over Cpython? Hmm, PyPy is slower than Cpython.. $ pypy3 tests/benchmark_vincenty.py 10000 2.1160879135131836 0.06056046485900879 $ python tests/benchmark_vincenty.py 10000 0.3325080871582031 0.02107095718383789 """ from ti...
[ "argparse.ArgumentParser", "time.time", "pymap3d.vincenty.vreckon", "numpy.random.random", "pymap3d.vincenty.vdist" ]
[((500, 519), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (516, 519), True, 'import numpy as np\n'), ((529, 548), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (545, 548), True, 'import numpy as np\n'), ((560, 566), 'time.time', 'time', ([], {}), '()\n', (564, 566), False, 'from ...
#!/usr/bin/env python3 try: import numpy as np except ImportError: pass import re import sys import inspect import os def printerr(m): sys.stderr.write(str(m) + "\n") def ReadVtkPoly(f, verbose=False): """ Reads vtk points, polygons and fields from legacy VTK file. f: `str` or file-like ...
[ "os.path.basename", "numpy.fromfile", "numpy.empty", "numpy.frombuffer", "numpy.dtype", "re.findall", "inspect.stack" ]
[((889, 922), 'os.path.basename', 'os.path.basename', (['caller.filename'], {}), '(caller.filename)\n', (905, 922), False, 'import os\n'), ((794, 809), 'inspect.stack', 'inspect.stack', ([], {}), '()\n', (807, 809), False, 'import inspect\n'), ((2580, 2607), 'numpy.empty', 'np.empty', (['(num_points, dim)'], {}), '((nu...
#!/usr/bin/env python3 import numpy as np import os from multi_isotope_calculator import Multi_isotope DATA_PATH = '../data/' CORE_MASS = 110820 # in kg REFUELLING_TIME = 6 # in days SEPARATION_EFFICIENCY = 0.97 SIM_DUR = 729 # in days def main(): spent_natU_fname = os.path.join(DATA_PATH, "SERP...
[ "numpy.load", "numpy.std", "numpy.mean", "numpy.array", "multi_isotope_calculator.Multi_isotope", "os.path.join" ]
[((279, 342), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""SERPENT_outputs_NatU_percentages.npy"""'], {}), "(DATA_PATH, 'SERPENT_outputs_NatU_percentages.npy')\n", (291, 342), False, 'import os\n'), ((1629, 1756), 'multi_isotope_calculator.Multi_isotope', 'Multi_isotope', (["{'234': 0.0054, '235': (0.7204, 90.0, ...
import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import plotly.offline as py import plotly.graph_objs as go import colorlover as cl sns.set() ################################################################################ # PROGRE...
[ "sys.stdout.write", "matplotlib.pyplot.tight_layout", "plotly.offline.iplot", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.zeros", "matplotlib.pyplot.subplots", "numpy.insert", "numpy.mean", "sys...
[((190, 199), 'seaborn.set', 'sns.set', ([], {}), '()\n', (197, 199), True, 'import seaborn as sns\n'), ((1460, 1482), 'sys.stdout.write', 'sys.stdout.write', (['text'], {}), '(text)\n', (1476, 1482), False, 'import sys\n'), ((1487, 1505), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1503, 1505), False, '...
import numpy as np from numpy.random.mtrand import RandomState from agents import AbstractFeatureProvider, ViewsFeaturesProvider, Model, ModelBasedAgent from reco_gym import Configuration organic_user_count_args = { 'num_products': 10, 'random_seed': np.random.randint(2 ** 31 - 1), # Select a Product ran...
[ "numpy.sum", "numpy.argmax", "numpy.zeros", "numpy.random.mtrand.RandomState", "numpy.random.randint", "numba.jit", "agents.ViewsFeaturesProvider", "reco_gym.Configuration" ]
[((1706, 1724), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (1709, 1724), False, 'from numba import jit\n'), ((261, 291), 'numpy.random.randint', 'np.random.randint', (['(2 ** 31 - 1)'], {}), '(2 ** 31 - 1)\n', (278, 291), True, 'import numpy as np\n'), ((4566, 4604), 'reco_gym.Configuration'...
import cv2 import numpy as np import pyrealsense2 as rs from centersnap import CenterSnap from centersnap.utils import load_img_NOCS, Open3dVisualizer REALSENSE_MAT_640 = np.array([[428.907 , 0. , 321.383 , 0. ], [ 0. , 428.611 , 241.602 , 0. ], ...
[ "cv2.resize", "pyrealsense2.pipeline_wrapper", "pyrealsense2.pipeline", "cv2.waitKey", "numpy.asarray", "centersnap.utils.Open3dVisualizer", "pyrealsense2.align", "pyrealsense2.config", "numpy.array", "cv2.hconcat", "centersnap.CenterSnap", "cv2.imshow", "cv2.namedWindow" ]
[((174, 292), 'numpy.array', 'np.array', (['[[428.907, 0.0, 321.383, 0.0], [0.0, 428.611, 241.602, 0.0], [0.0, 0.0, 1.0,\n 0.0], [0.0, 0.0, 0.0, 1.0]]'], {}), '([[428.907, 0.0, 321.383, 0.0], [0.0, 428.611, 241.602, 0.0], [0.0,\n 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])\n', (182, 292), True, 'import numpy as np\n')...
import abc import asyncio import functools import importlib import sys import tokenize from collections import Awaitable, Iterable, OrderedDict from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor from threading import Thread import numpy as np from ._bootstrap import get_current_user, open_resource...
[ "tokenize.open", "importlib.import_module", "asyncio.set_event_loop", "numpy.array", "asyncio.wait", "concurrent.futures.ThreadPoolExecutor", "asyncio.new_event_loop" ]
[((12425, 12473), 'importlib.import_module', 'importlib.import_module', (['appdata.module.fullname'], {}), '(appdata.module.fullname)\n', (12448, 12473), False, 'import importlib\n'), ((7456, 7476), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {}), '()\n', (7474, 7476), False, 'from concurrent.fu...
"""Tools for saving and loading trajectories without requiring the `imitation` or `tensorflow` packages to be installed.""" import gzip from pickle import Unpickler from typing import List, NamedTuple, Optional import gym import numpy as np from magical.benchmarks import ( # comment to stop yapf touching import ...
[ "numpy.stack", "gym.make", "magical.benchmarks.update_magical_env_name", "gzip.GzipFile", "pickle.Unpickler" ]
[((2315, 2375), 'magical.benchmarks.update_magical_env_name', 'update_magical_env_name', (['base_env_name'], {'preproc': 'preproc_name'}), '(base_env_name, preproc=preproc_name)\n', (2338, 2375), False, 'from magical.benchmarks import DEFAULT_PREPROC_ENTRY_POINT_WRAPPERS, update_magical_env_name\n'), ((4589, 4612), 'gy...
from sklearn.model_selection import train_test_split from sklearn.utils import shuffle import numpy as np import random import pandas as pd from google.cloud import storage import io #import tensorflow as tf class Dataset: def __init__(self, data_files_path, sampling_size, test_size): self.data_files_path ...
[ "io.StringIO", "sklearn.model_selection.train_test_split", "google.cloud.storage.Client", "sklearn.utils.shuffle", "numpy.concatenate", "google.cloud.storage.Blob" ]
[((809, 825), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (823, 825), False, 'from google.cloud import storage\n'), ((889, 937), 'google.cloud.storage.Blob', 'storage.Blob', (['(directory_path + file_name)', 'bucket'], {}), '(directory_path + file_name, bucket)\n', (901, 937), False, 'from google...
from numpy.random import seed from numpy.random import randn from backend.stat.mean_tests import run_paired_t_test, run_wilcoxon_signed_rank_test if __name__ == "__main__": seed(1) sample1 = 5 * randn(100) + 50 sample2 = 5 * randn(100) + 49 print() print("Paired T-Test") stat, p = run_paired_t...
[ "backend.stat.mean_tests.run_wilcoxon_signed_rank_test", "numpy.random.seed", "backend.stat.mean_tests.run_paired_t_test", "numpy.random.randn" ]
[((178, 185), 'numpy.random.seed', 'seed', (['(1)'], {}), '(1)\n', (182, 185), False, 'from numpy.random import seed\n'), ((308, 375), 'backend.stat.mean_tests.run_paired_t_test', 'run_paired_t_test', (['sample1', 'sample2'], {'alpha': '(0.05)', 'print_results': '(True)'}), '(sample1, sample2, alpha=0.05, print_results...
''' Copyright (C) 2020 Shandong University This program is licensed under the GNU General Public License 3.0 (https://www.gnu.org/licenses/gpl-3.0.html). Any derivative work obtained under this license must be licensed under the GNU General Public License as published by the Free Software F...
[ "os.popen", "numpy.array" ]
[((2288, 2310), 'os.popen', 'os.popen', (['"""nvidia-smi"""'], {}), "('nvidia-smi')\n", (2296, 2310), False, 'import os\n'), ((1917, 1928), 'numpy.array', 'np.array', (['s'], {}), '(s)\n', (1925, 1928), True, 'import numpy as np\n')]
import typing import numpy as np from xbbo.surrogate.base import SurrogateModel # from xbbo.surrogate.transfer.rf_with_instances import RandomForestWithInstances from xbbo.surrogate.prf import RandomForestWithInstances # from xbbo.utils.util import get_types class RandomForestEnsemble(SurrogateModel): def __init__...
[ "xbbo.surrogate.prf.RandomForestWithInstances", "numpy.nan_to_num", "numpy.zeros", "numpy.random.RandomState", "numpy.hstack" ]
[((401, 426), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (422, 426), True, 'import numpy as np\n'), ((1069, 1107), 'xbbo.surrogate.prf.RandomForestWithInstances', 'RandomForestWithInstances', (['cs'], {'rng': 'rng'}), '(cs, rng=rng)\n', (1094, 1107), False, 'from xbbo.surrogate.prf i...
import unittest import numpy as np from fit1d.model import ModelMock from fit1d.outlier import OutLierMock from fit1d.fit1d import Fit1DMock, FitResults class TestFit1D(unittest.TestCase): def setUp(self): self.x = np.linspace(-15.0, 15.0, num=50) self.y = self.x self.model = ModelMock({"p...
[ "fit1d.model.ModelMock", "fit1d.outlier.OutLierMock", "numpy.array", "numpy.linspace", "numpy.array_equal", "fit1d.fit1d.Fit1DMock" ]
[((229, 261), 'numpy.linspace', 'np.linspace', (['(-15.0)', '(15.0)'], {'num': '(50)'}), '(-15.0, 15.0, num=50)\n', (240, 261), True, 'import numpy as np\n'), ((307, 333), 'fit1d.model.ModelMock', 'ModelMock', (["{'param1': 5.5}"], {}), "({'param1': 5.5})\n", (316, 333), False, 'from fit1d.model import ModelMock\n'), (...
#%% import json import os import os.path from funcy import lmap, merge, lcat from cmdstanpy import CmdStanModel import numpy as np import statsmodels.api as sm #%% def load_data(path): with open(path, 'r') as fh: return json.load(fh) def load_all(directory: str): paths = (os.path.join(directory, f) f...
[ "cmdstanpy.CmdStanModel", "numpy.full_like", "funcy.lmap", "json.load", "statsmodels.api.OLS", "os.path.join", "os.listdir", "numpy.concatenate" ]
[((1463, 1499), 'cmdstanpy.CmdStanModel', 'CmdStanModel', ([], {'stan_file': '"""model.stan"""'}), "(stan_file='model.stan')\n", (1475, 1499), False, 'from cmdstanpy import CmdStanModel\n'), ((2374, 2395), 'numpy.full_like', 'np.full_like', (['ln1', '(-1)'], {}), '(ln1, -1)\n', (2386, 2395), True, 'import numpy as np\n...
import numpy as np import tensorflow as tf from neupy import init from neupy.utils import asfloat, as_tuple, tf_utils from neupy.exceptions import LayerConnectionError, WeightInitializationError from neupy.core.properties import ( NumberProperty, TypedListProperty, ParameterProperty, IntProperty, ) from .base ...
[ "tensorflow.clip_by_value", "tensorflow.nn.tanh", "tensorflow.maximum", "neupy.core.properties.ParameterProperty", "neupy.core.properties.TypedListProperty", "tensorflow.matmul", "numpy.arange", "neupy.core.properties.IntProperty", "tensorflow.nn.softmax", "tensorflow.nn.relu", "tensorflow.nn.el...
[((2107, 2145), 'neupy.core.properties.IntProperty', 'IntProperty', ([], {'minval': '(1)', 'allow_none': '(True)'}), '(minval=1, allow_none=True)\n', (2118, 2145), False, 'from neupy.core.properties import NumberProperty, TypedListProperty, ParameterProperty, IntProperty\n'), ((2159, 2178), 'neupy.core.properties.Param...
import torch import src from src import Metrics, utils import collections import os import numpy as np from PIL import Image class Eval: def __init__(self, L): self.Loader = L self.scores = collections.OrderedDict() for val in L.vals: self.scores[val] = src.Score(val, L) def...
[ "numpy.uint8", "os.makedirs", "os.path.exists", "src.Score", "collections.OrderedDict", "src.Metrics.getOutPuts" ]
[((210, 235), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (233, 235), False, 'import collections\n'), ((294, 311), 'src.Score', 'src.Score', (['val', 'L'], {}), '(val, L)\n', (303, 311), False, 'import src\n'), ((464, 539), 'src.Metrics.getOutPuts', 'Metrics.getOutPuts', (['Model', "valdata[...
""" bpz: Bayesian Photo-Z estimation Reference: Benitez 2000, ApJ, 536, p.571 Usage: python bpz.py catalog.cat Needs a catalog.columns file which describes the contents of catalog.cat """ from __future__ import print_function from __future__ import division from builtins import str from builtins import ...
[ "coetools.pause", "past.utils.old_div", "numpy.greater", "numpy.ones", "numpy.arange", "sys.stdout.flush", "glob.glob", "builtins.range", "os.path.join", "pylab.title", "os.path.exists", "coetools.params_cl", "numpy.less", "numpy.less_equal", "os.path.basename", "pylab.ioff", "shelve...
[((1410, 1421), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1419, 1421), False, 'import os\n'), ((8163, 8191), 'glob.glob', 'glob.glob', (["(fil_dir + '*.res')"], {}), "(fil_dir + '*.res')\n", (8172, 8191), False, 'import glob\n'), ((8365, 8393), 'glob.glob', 'glob.glob', (["(sed_dir + '*.sed')"], {}), "(sed_dir + '*....
import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.ensemble import ExtraTreesClassifier from visualize.feature_plots import load_unsw_feature_names def autolabel(rects, label): """Attach a text label above each bar displaying its height""" for (i, rect) in en...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "visualize.feature_plots.load_unsw_feature_names", "numpy.std", "numpy.argsort", "sklearn.ensemble.ExtraTreesClassifier", "matplotlib.pyplot.figure", "sklearn.decomposition.PCA", "matplotlib.pyplot.savefig" ]
[((638, 713), 'sklearn.ensemble.ExtraTreesClassifier', 'ExtraTreesClassifier', ([], {'n_estimators': '(250)', 'criterion': '"""entropy"""', 'random_state': '(0)'}), "(n_estimators=250, criterion='entropy', random_state=0)\n", (658, 713), False, 'from sklearn.ensemble import ExtraTreesClassifier\n'), ((859, 933), 'numpy...
# 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...
[ "random.sample", "numpy.arange", "cytoolz.concat" ]
[((1287, 1325), 'random.sample', 'random.sample', (['sample_pool', 'num_sample'], {}), '(sample_pool, num_sample)\n', (1300, 1325), False, 'import random\n'), ((3552, 3600), 'numpy.arange', 'np.arange', (['(0)', 'input_ids.shape[1]'], {'dtype': 'np.int64'}), '(0, input_ids.shape[1], dtype=np.int64)\n', (3561, 3600), Tr...
import tensorflow as tf from src.utils.read_dataset import read_and_parse_sharded_dataset, parse_camera_tfrecord_example from absl import app from absl import flags from time import time import numpy as np import os tf.enable_eager_execution() FLAGS = flags.FLAGS flags.DEFINE_string('inference_graph_path', 'saved_mod...
[ "tensorflow.Session", "numpy.expand_dims", "tensorflow.GraphDef", "tensorflow.concat", "absl.flags.DEFINE_string", "tensorflow.ConfigProto", "time.time", "numpy.mean", "absl.flags.DEFINE_integer", "absl.app.run", "tensorflow.Graph", "tensorflow.enable_eager_execution", "numpy.squeeze", "te...
[((217, 244), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (242, 244), True, 'import tensorflow as tf\n'), ((266, 412), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""inference_graph_path"""', '"""saved_models/optimized_faster_rcnn/frozen_inference_graph.pb"""', '"""Path...
"""Chi distribution.""" import numpy from scipy import special from ..baseclass import Dist from ..operators.addition import Add class chi(Dist): """Chi distribution.""" def __init__(self, df=1): Dist.__init__(self, df=df) def _pdf(self, x, df): return x**(df-1.)*numpy.exp(-x*x*0.5)/(2....
[ "scipy.special.gamma", "numpy.exp", "scipy.special.gammainc", "scipy.special.gammaincinv" ]
[((418, 457), 'scipy.special.gammainc', 'special.gammainc', (['(df * 0.5)', '(0.5 * x * x)'], {}), '(df * 0.5, 0.5 * x * x)\n', (434, 457), False, 'from scipy import special\n'), ((353, 376), 'scipy.special.gamma', 'special.gamma', (['(df * 0.5)'], {}), '(df * 0.5)\n', (366, 376), False, 'from scipy import special\n'),...
# -*- coding: utf-8 -*- """ Created on Wed Oct 18 15:10:19 2017 @author: fd1014 """ from __future__ import print_function import types import numpy as np import matplotlib.pyplot as plt import matplotlib import granulometry import hk import generate_gaussianRF as grf import timeit matplotlib.rcParam...
[ "matplotlib.rc", "hk.summary_statistics", "numpy.ones", "matplotlib.pyplot.figure", "numpy.mean", "generate_gaussianRF.generate", "matplotlib.rcParams.update", "granulometry.RandomDisks", "numpy.max", "numpy.linspace", "numpy.log10", "matplotlib.pyplot.show", "generate_gaussianRF.power_law",...
[((302, 369), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 14, 'axes.labelsize': 16}"], {}), "({'font.size': 14, 'axes.labelsize': 16})\n", (328, 369), False, 'import matplotlib\n'), ((371, 418), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {'family': '"""Times New Roman"""'}), "('...
import tensorflow as tf import time from tensorflow.python.client import timeline import numpy as np import logging as log IMAGE = tf.placeholder(tf.float64) DEPTH = tf.placeholder(tf.float64) def _image_op(x): y = x ** 0.45 # gamma correction y = tf.clip_by_value(y, 0, 1) y = y * 255. y = tf.cast(...
[ "tensorflow.abs", "logging.debug", "tensorflow.clip_by_value", "logging.basicConfig", "tensorflow.Session", "tensorflow.transpose", "tensorflow.stack", "tensorflow.placeholder", "tensorflow.cast", "time.time", "tensorflow.RunMetadata", "tensorflow.python.client.timeline.Timeline", "numpy.ran...
[((133, 159), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float64'], {}), '(tf.float64)\n', (147, 159), True, 'import tensorflow as tf\n'), ((168, 194), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float64'], {}), '(tf.float64)\n', (182, 194), True, 'import tensorflow as tf\n'), ((261, 286), 'tensorflow.clip...
# -*- coding: utf-8 -*- """ Created on Mon May 11 14:34:08 2020 @author: <NAME> (<EMAIL>), Finnish Meteorological Institute) Olli's python implementation of ESA SNAP s2toolbox biophysical processor and computation of vegetation indices. See ATBD at https://step.esa.int/docs/extra/ATBD_S2ToolBox_L2B_V1.1.pdf And java...
[ "numpy.radians", "io.BytesIO", "numpy.zeros_like", "numpy.ones_like", "numpy.copy", "xarray.concat", "numpy.any", "numpy.shape", "xarray.DataArray", "requests.get", "xarray.apply_ufunc" ]
[((1817, 1838), 'requests.get', 'requests.get', (['res_url'], {}), '(res_url)\n', (1829, 1838), False, 'import requests\n'), ((4311, 4341), 'numpy.any', 'np.any', (['bad_input_mask'], {'axis': '(0)'}), '(bad_input_mask, axis=0)\n', (4317, 4341), True, 'import numpy as np\n'), ((4915, 4930), 'numpy.copy', 'np.copy', (['...
import sys import typing import numba as nb import numpy as np @nb.njit( (nb.i8, nb.i8[:, :]), cache=True, ) def solve( n: int, g: np.array, ) -> typing.NoReturn: indeg = np.zeros( n, dtype=np.int64, ) for v in g[:, 1]: indeg[v] += 1 g = g[g[:, 0].argsort()] i = np.searchsorted( g[:...
[ "numba.njit", "numpy.zeros", "numpy.arange", "sys.stdin.read" ]
[((67, 108), 'numba.njit', 'nb.njit', (['(nb.i8, nb.i8[:, :])'], {'cache': '(True)'}), '((nb.i8, nb.i8[:, :]), cache=True)\n', (74, 108), True, 'import numba as nb\n'), ((184, 211), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (192, 211), True, 'import numpy as np\n'), ((416, 443)...
# noinspection PyPackageRequirements import datawrangler as dw import numpy as np import seaborn as sns from matplotlib import pyplot as plt import quail import warnings def get_bounds(data, bounds): data = [d for d in data.values.ravel() if not np.isnan(d)] return [np.percentile(data, p) for p in bounds] ...
[ "matplotlib.pyplot.xlim", "numpy.digitize", "seaborn.histplot", "warnings.simplefilter", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.clf", "numpy.unique", "numpy.isnan", "numpy.percentile", "numpy.arange", "datawrangler.core.update_dict", "matplotlib.pyplot.ylabel"...
[((518, 583), 'seaborn.histplot', 'sns.histplot', (['data'], {'kde': '(True)', 'color': '"""k"""', 'bins': 'bins', 'edgecolor': '"""w"""'}), "(data, kde=True, color='k', bins=bins, edgecolor='w')\n", (530, 583), True, 'import seaborn as sns\n'), ((588, 614), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['x'], {'fontsize'...
# coding=utf-8 # Copyright 2022 The Balloon Learning Environment 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 require...
[ "numpy.random.randint" ]
[((4677, 4713), 'numpy.random.randint', 'np.random.randint', (['self._num_actions'], {}), '(self._num_actions)\n', (4694, 4713), True, 'import numpy as np\n')]
import xarray as xr import numpy as np import pandas as pd from tqdm.auto import tqdm def load_all_dataset( data_path_root, parameter_list, show_progress=True ): dss = [] if show_progress: ps = tqdm(parameter_list) else: ps = parameter_list for parameter in ps: ...
[ "xarray.merge", "tqdm.auto.tqdm", "numpy.arange", "pandas.Timedelta", "xarray.open_mfdataset", "numpy.prod" ]
[((478, 491), 'xarray.merge', 'xr.merge', (['dss'], {}), '(dss)\n', (486, 491), True, 'import xarray as xr\n'), ((236, 256), 'tqdm.auto.tqdm', 'tqdm', (['parameter_list'], {}), '(parameter_list)\n', (240, 256), False, 'from tqdm.auto import tqdm\n'), ((394, 444), 'xarray.open_mfdataset', 'xr.open_mfdataset', (['f"""{da...
from rsopt.codes.runner.Runner import Runner from libensemble.message_numbers import WORKER_DONE, WORKER_KILL, TASK_FAILED import os, logging import numpy as np from time import sleep def sim_function_with_runner(H, persis_info, sim_specs, libE_info): logger = logging.getLogger('libensemble') logger.info('sim...
[ "os.getcwd", "numpy.zeros", "logging.getLogger", "time.sleep" ]
[((267, 299), 'logging.getLogger', 'logging.getLogger', (['"""libensemble"""'], {}), "('libensemble')\n", (284, 299), False, 'import os, logging\n'), ((1211, 1220), 'time.sleep', 'sleep', (['st'], {}), '(st)\n', (1216, 1220), False, 'from time import sleep\n'), ((2220, 2247), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtyp...
from molSimplify.Scripts.cellbuilder_tools import * from molSimplify.Classes import mol3D from molSimplify.Informatics.autocorrelation import* from molSimplify.Informatics.misc_descriptors import* from molSimplify.Informatics.graph_analyze import* from molSimplify.Informatics.RACassemble import * import os import numpy...
[ "pandas.DataFrame", "os.mkdir", "os.path.basename", "pandas.read_csv", "os.path.getsize", "molSimplify.Classes.mol3D", "os.path.dirname", "os.path.isdir", "os.path.exists", "numpy.nonzero", "numpy.array", "scipy.sparse.csgraph.connected_components", "pymatgen.io.cif.CifParser", "numpy.uniq...
[((16145, 16240), 'scipy.sparse.csgraph.connected_components', 'sparse.csgraph.connected_components', ([], {'csgraph': 'adj_matrix', 'directed': '(False)', 'return_labels': '(True)'}), '(csgraph=adj_matrix, directed=False,\n return_labels=True)\n', (16180, 16240), False, 'from scipy import sparse\n'), ((2313, 2337),...
#!/usr/bin/python # Imports import pandas as pd import numpy as np from collections import Counter import tqdm import math, os from sklearn.metrics import mean_squared_error from scipy.sparse.csgraph import minimum_spanning_tree as mst_nsim from scipy.sparse.linalg import svds from scipy.sparse import csr_matrix from...
[ "pandas.DataFrame", "pandas.melt", "scipy.sparse.linalg.svds", "pandas.read_pickle", "os.path.isfile", "numpy.mean", "scipy.sparse.csr_matrix", "numpy.dot", "numpy.diag", "implicit.als.AlternatingLeastSquares", "pandas.concat", "sklearn.metrics.mean_squared_error" ]
[((1312, 1326), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1324, 1326), True, 'import pandas as pd\n'), ((3102, 3143), 'scipy.sparse.linalg.svds', 'svds', (['Checkins_demeaned', 'latent_dimension'], {}), '(Checkins_demeaned, latent_dimension)\n', (3106, 3143), False, 'from scipy.sparse.linalg import svds\n'...