code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import time
import numpy as np
import multiprocessing as mp
import ctypes
from rlpyt.samplers.base import BaseSampler
from rlpyt.samplers.utils import build_samples_buffer, build_step_buffer
from rlpyt.samplers.parallel_worker import sampling_process
from rlpyt.samplers.gpu.collectors import EvalCollector
from rlpyt.... | [
"rlpyt.utils.collections.AttrDict",
"rlpyt.samplers.utils.build_samples_buffer",
"numpy.where",
"numpy.any",
"rlpyt.utils.logging.logger.log",
"multiprocessing.RawValue",
"time.sleep",
"multiprocessing.Barrier",
"multiprocessing.Semaphore",
"rlpyt.agents.base.AgentInputs",
"multiprocessing.Queue... | [((1065, 1189), 'rlpyt.samplers.utils.build_samples_buffer', 'build_samples_buffer', (['agent', 'env', 'self.batch_spec', 'bootstrap_value'], {'agent_shared': '(True)', 'env_shared': '(True)', 'subprocess': '(False)'}), '(agent, env, self.batch_spec, bootstrap_value,\n agent_shared=True, env_shared=True, subprocess=... |
import numpy as np
def _recall_values(labels, x_absolute=False, y_absolute=False):
n_docs = len(labels)
n_pos_docs = sum(labels)
x = np.arange(1, n_docs + 1)
recall = np.cumsum(labels)
if not x_absolute:
x = x / n_docs
if y_absolute:
y = recall
else:
y = recall /... | [
"numpy.cumsum",
"numpy.linspace",
"numpy.arange"
] | [((148, 172), 'numpy.arange', 'np.arange', (['(1)', '(n_docs + 1)'], {}), '(1, n_docs + 1)\n', (157, 172), True, 'import numpy as np\n'), ((186, 203), 'numpy.cumsum', 'np.cumsum', (['labels'], {}), '(labels)\n', (195, 203), True, 'import numpy as np\n'), ((502, 519), 'numpy.cumsum', 'np.cumsum', (['labels'], {}), '(lab... |
"""Plots Grad-CAM output (guided and unguided class-activation maps)."""
import os
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as pyplot
from gewittergefahr.gg_utils import general_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.gg_utils... | [
"gewittergefahr.gg_utils.general_utils.apply_gaussian_filter",
"numpy.flip",
"numpy.log10",
"gewittergefahr.gg_utils.error_checking.assert_is_geq",
"gewittergefahr.deep_learning.cnn.read_model_metadata",
"argparse.ArgumentParser",
"numpy.repeat",
"matplotlib.use",
"gewittergefahr.scripts.plot_input_... | [((131, 152), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (145, 152), False, 'import matplotlib\n'), ((3371, 3396), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3394, 3396), False, 'import argparse\n'), ((7601, 7632), 'numpy.log10', 'numpy.log10', (['min_unguided_va... |
import os, sys
sys.path.append(os.getcwd())
import time
from utils import load, save_images, Adamp, SGDNM
import numpy as np
import torch
import torchvision
from torch import nn
from torch import autograd
from torch import optim
import cifar10
np.random.seed(1234)
torch.manual_seed(1234)
torch.cuda.manual_seed_all(123... | [
"torch.nn.ReLU",
"cifar10.load",
"torch.nn.Tanh",
"numpy.array",
"torch.nn.BatchNorm1d",
"torch.cuda.is_available",
"torch.nn.BatchNorm2d",
"torch.autograd.Varirble",
"numpy.random.seed",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable",
"torch.randn",
"torch.nn.LeakyReLU",
"to... | [((245, 265), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (259, 265), True, 'import numpy as np\n'), ((266, 289), 'torch.manual_seed', 'torch.manual_seed', (['(1234)'], {}), '(1234)\n', (283, 289), False, 'import torch\n'), ((290, 322), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all'... |
from src.datasets.util import read_files, get_vocab, pad_sequences, text_to_rank, splits, clean_doc, splitsNonInt
from sklearn.model_selection import StratifiedShuffleSplit,train_test_split
from tensorflow import keras
import numpy as np
from src.models.embedding import *
from sklearn.datasets import fetch_20newsgrou... | [
"tensorflow.keras.utils.to_categorical",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.fetch_20newsgroups",
"src.datasets.util.splitsNonInt",
"src.datasets.util.text_to_rank",
"src.datasets.util.clean_doc",
"src.datasets.util.pad_sequences",
"numpy.concatenate",
"src.datasets.util.ge... | [((398, 460), 'sklearn.datasets.fetch_20newsgroups', 'fetch_20newsgroups', ([], {'subset': '"""all"""', 'shuffle': '(True)', 'random_state': '(1)'}), "(subset='all', shuffle=True, random_state=1)\n", (416, 460), False, 'from sklearn.datasets import fetch_20newsgroups\n'), ((780, 885), 'sklearn.model_selection.train_tes... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# moldynplot.dataset.NatConTimeSeriesDataset.py
#
# Copyright (C) 2015-2017 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
Represents native contacts as a func... | [
"numpy.histogram",
"numpy.reshape",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"scipy.stats.mstats.mode",
"pandas.DataFrame"
] | [((3116, 3146), 'numpy.reshape', 'np.reshape', (['reduced', 'new_shape'], {}), '(reduced, new_shape)\n', (3126, 3146), True, 'import numpy as np\n'), ((3228, 3301), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'reduced', 'index': 'index', 'columns': 'dataframe.columns.values'}), '(data=reduced, index=index, column... |
import tensorflow as tf
import numpy as np
with tf.profiler.experimental.Profile('/home/Tiexin-RS/profiles'):
with tf.device('gpu'):
list_data = np.load('/home/Tiexin-RS/code/workspace/wjz/segment-with-nn/serving/load_test/locust_tfserving/a.npy')
payload = {"inputs": {'input_1': list_data.tolist()}... | [
"tensorflow.device",
"numpy.load",
"tensorflow.constant",
"tensorflow.profiler.experimental.Profile"
] | [((48, 108), 'tensorflow.profiler.experimental.Profile', 'tf.profiler.experimental.Profile', (['"""/home/Tiexin-RS/profiles"""'], {}), "('/home/Tiexin-RS/profiles')\n", (80, 108), True, 'import tensorflow as tf\n'), ((119, 135), 'tensorflow.device', 'tf.device', (['"""gpu"""'], {}), "('gpu')\n", (128, 135), True, 'impo... |
import os
import tkinter as tk
import numpy as np
from src.globals import current_dir
from src.preprocessor import deskew_image, dots_to_image
from src.utils import draw_digit, save_digit
class InputGUI:
def __init__(self, root, n=None):
self.root = root
self.n = n # NeuralNetwork object
self.dots = [] # A... | [
"src.preprocessor.dots_to_image",
"os.path.join",
"numpy.argmax",
"tkinter.Button",
"tkinter.Canvas",
"tkinter.Tk",
"os.path.isdir",
"os.mkdir",
"tkinter.Label",
"src.utils.draw_digit",
"src.preprocessor.deskew_image"
] | [((2946, 2953), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (2951, 2953), True, 'import tkinter as tk\n'), ((3036, 3076), 'os.path.join', 'os.path.join', (['current_dir', '"""predictions"""'], {}), "(current_dir, 'predictions')\n", (3048, 3076), False, 'import os\n'), ((3267, 3281), 'os.mkdir', 'os.mkdir', (['path'], {}),... |
import warnings
from itertools import tee, starmap
from operator import gt
from copy import copy
import numpy as np
import pandas as pd
import bioframe
def assign_view_paired(
features,
view_df,
cols_paired=["chrom1", "start1", "end1", "chrom2", "start2", "end2"],
cols_view=["chrom", "start", "end"]... | [
"pandas.Series",
"bioframe.to_ucsc_string",
"bioframe.core.checks._verify_columns",
"bioframe.core.construction.make_viewframe",
"numpy.where",
"bioframe.make_viewframe",
"pandas.merge",
"bioframe.assign_view",
"numpy.sum",
"bioframe.select",
"numpy.isfinite",
"warnings.warn",
"bioframe.over... | [((1759, 1836), 'bioframe.core.checks.is_bedframe', 'bioframe.core.checks.is_bedframe', (['features'], {'raise_errors': '(True)', 'cols': 'cols_left'}), '(features, raise_errors=True, cols=cols_left)\n', (1791, 1836), False, 'import bioframe\n'), ((1841, 1919), 'bioframe.core.checks.is_bedframe', 'bioframe.core.checks.... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the MIT License.
# To view a copy of this license, visit https://opensource.org/licenses/MIT
from bongard import LineAction, ArcAction, OneStrokeShape, BongardImage, BongardProblem, BongardImagePainter, \
BongardProblemP... | [
"bongard.util_funcs.get_attribute_sampling_candidates",
"os.path.exists",
"os.makedirs",
"numpy.random.choice",
"bongard.BongardProblemPainter",
"bongard.plot.create_visualized_bongard_problem",
"numpy.random.seed",
"bongard.BongardImage",
"bongard.util_funcs.get_human_designed_shape_annotations",
... | [((1885, 1979), 'bongard.OneStrokeShape', 'OneStrokeShape', ([], {'basic_actions': 'base_actions', 'start_coordinates': 'None', 'start_orientation': 'None'}), '(basic_actions=base_actions, start_coordinates=None,\n start_orientation=None)\n', (1899, 1979), False, 'from bongard import LineAction, ArcAction, OneStroke... |
"""
Line styles
-----------
The :meth:`pygmt.Figure.plot` method can plot lines in different styles.
The default line style is a 0.25-point wide, black, solid line, and can be
customized via the ``pen`` argument.
A *pen* in GMT has three attributes: *width*, *color*, and *style*.
The *style* attribute controls the ap... | [
"numpy.sin",
"numpy.linspace",
"pygmt.Figure"
] | [((714, 737), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(500)'], {}), '(0, 10, 500)\n', (725, 737), True, 'import numpy as np\n'), ((742, 751), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (748, 751), True, 'import numpy as np\n'), ((759, 773), 'pygmt.Figure', 'pygmt.Figure', ([], {}), '()\n', (771, 773), Fals... |
'''
This script gets a file with metadata, learning features, and target
values for each line, and plots different features against the target.
'''
FEATURE_NAMES = ['query_num_of_columns','query_num_of_rows','query_row_column_ratio','query_max_mean','query_max_outlier_percentage','query_max_skewness','query_max_kurt... | [
"numpy.mean",
"numpy.fabs",
"numpy.median",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"scipy.stats.median_absolute_deviation",
"numpy.array",
"matplotlib.pyplot.scatter",
"numpy.std",
"matplotlib.pyplot.tight_layout"
] | [((1237, 1252), 'numpy.mean', 'np.mean', (['x_data'], {}), '(x_data)\n', (1244, 1252), True, 'import numpy as np\n'), ((1265, 1279), 'numpy.std', 'np.std', (['x_data'], {}), '(x_data)\n', (1271, 1279), True, 'import numpy as np\n'), ((1293, 1308), 'numpy.mean', 'np.mean', (['y_data'], {}), '(y_data)\n', (1300, 1308), T... |
from __future__ import annotations
__all__ = ['lock_seed', 'trace', 'trace_module', 'whereami']
import gc
import inspect
import os
import random
import types
from collections.abc import Iterator
from contextlib import suppress
from itertools import islice
from types import FrameType
import numpy as np
import wrapt
... | [
"torch.manual_seed",
"itertools.islice",
"inspect.currentframe",
"inspect.getmodule",
"random.seed",
"contextlib.suppress",
"numpy.random.seed",
"gc.get_referrers",
"inspect.isfunction"
] | [((1246, 1268), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (1266, 1268), False, 'import inspect\n'), ((1307, 1336), 'itertools.islice', 'islice', (['calls', '(skip + 1)', 'None'], {}), '(calls, skip + 1, None)\n', (1313, 1336), False, 'from itertools import islice\n'), ((1419, 1439), 'itertools.i... |
"""
ucf crime class
['Normal','Abuse', 'Arrest', 'Arson', 'Assault', 'Burglary', 'Explosion', 'Fighting', 'RoadAccidents', 'Robbery', 'Shooting',
'Shoplifting', 'Stealing', 'Vandalism']
two branch ['Normal' ,'Abnormal' ]
unmerged video feature
for self-reason framwork
"""
import torch
import torch.nn as nn
from torch... | [
"net.utils.parser.load_config",
"os.path.join",
"torch.from_numpy",
"net.utils.parser.parse_args",
"numpy.load"
] | [((2199, 2211), 'net.utils.parser.parse_args', 'parse_args', ([], {}), '()\n', (2209, 2211), False, 'from net.utils.parser import parse_args, load_config\n'), ((2220, 2237), 'net.utils.parser.load_config', 'load_config', (['args'], {}), '(args)\n', (2231, 2237), False, 'from net.utils.parser import parse_args, load_con... |
import LPRLite as pr
import cv2
import os
import numpy as np
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def compute_iou(rec1, rec2):
"""
computing IoU
:param rec1: (y0, x0, y1, x1), which reflects
(top, left, bottom, right)
:param rec2: (y0, x0, y1, x1)
... | [
"cv2.imwrite",
"PIL.Image.fromarray",
"os.listdir",
"LPRLite.LPR",
"PIL.ImageFont.truetype",
"os.path.split",
"numpy.array",
"PIL.ImageDraw.Draw",
"cv2.imread"
] | [((1029, 1074), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""Font/platech.ttf"""', '(30)', '(0)'], {}), "('Font/platech.ttf', 30, 0)\n", (1047, 1074), False, 'from PIL import ImageFont\n'), ((2022, 2099), 'LPRLite.LPR', 'pr.LPR', (['"""model/cascade.xml"""', '"""model/model12.h5"""', '"""model/ocr_plate_all_gr... |
import os
import pickle
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
# ----- CONFIGURE TENSORFLOW -----
# This step might be needed in case cuDNN
# gives problems with convolutions
config = ConfigProto(... | [
"tensorflow.compat.v1.ConfigProto",
"tensorflow.compat.v1.InteractiveSession",
"callbacks.ImagesLoggingCallback",
"pandas.read_csv",
"pickle.load",
"numpy.zeros",
"datasets.celeba.dataloader.DataSequence",
"utils.file_utils.makedir_if_not_exists"
] | [((308, 321), 'tensorflow.compat.v1.ConfigProto', 'ConfigProto', ([], {}), '()\n', (319, 321), False, 'from tensorflow.compat.v1 import ConfigProto\n'), ((371, 404), 'tensorflow.compat.v1.InteractiveSession', 'InteractiveSession', ([], {'config': 'config'}), '(config=config)\n', (389, 404), False, 'from tensorflow.comp... |
# Importar paquetes
import numpy as np
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader.data as web
from scipy.stats import norm
# Función para descargar precios de cierre ajustados de varios activos a la vez:
def get_closes(tickers, start_date=None, end_date=None, fr... | [
"numpy.multiply",
"numpy.sqrt",
"pandas.read_csv",
"pandas_datareader.data.YahooDailyReader",
"numpy.empty",
"pandas.DataFrame",
"numpy.percentile",
"numpy.matrix",
"numpy.transpose"
] | [((1333, 1365), 'pandas.read_csv', 'pd.read_csv', (['"""../Data/datos.csv"""'], {}), "('../Data/datos.csv')\n", (1344, 1365), True, 'import pandas as pd\n'), ((1466, 1491), 'numpy.empty', 'np.empty', (['(numberport, 1)'], {}), '((numberport, 1))\n', (1474, 1491), True, 'import numpy as np\n'), ((1574, 1599), 'numpy.emp... |
"""Function derivatives for error propagation."""
import sys
import numpy as np
import copy
__all__ = ['derivatives', 'propagate_1', 'propagate_2']
STEP_SIZE = np.sqrt(sys.float_info.epsilon)
@np.vectorize
def _deriv_pow_0(x, y):
"""Partial derivative of x**y in x."""
if y == 0:
return 0.0
if... | [
"numpy.shape",
"numpy.sqrt",
"numpy.tan",
"numpy.power",
"numpy.exp2",
"numpy.log",
"numpy.tanh",
"numpy.square",
"numpy.empty",
"numpy.sin",
"copy.copy",
"numpy.copysign"
] | [((165, 196), 'numpy.sqrt', 'np.sqrt', (['sys.float_info.epsilon'], {}), '(sys.float_info.epsilon)\n', (172, 196), True, 'import numpy as np\n'), ((994, 1008), 'numpy.sqrt', 'np.sqrt', (['np.pi'], {}), '(np.pi)\n', (1001, 1008), True, 'import numpy as np\n'), ((558, 567), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (5... |
import argparse
from time import sleep
import numpy as np
from smartredis import Client
def init_client(nnDB):
if (nnDB==1):
client = Client(cluster=False)
else:
client = Client(cluster=True)
return client
def main():
# Import and initialize MPI
import mpi4py
mpi4py.rc.initiali... | [
"mpi4py.MPI.Init_thread",
"argparse.ArgumentParser",
"mpi4py.MPI.Is_initialized",
"smartredis.Client",
"time.sleep",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"numpy.random.uniform"
] | [((602, 641), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (625, 641), False, 'import argparse\n'), ((1865, 1887), 'numpy.zeros', 'np.zeros', (['(2)'], {'dtype': 'int'}), '(2, dtype=int)\n', (1873, 1887), True, 'import numpy as np\n'), ((147, 168), 'smartr... |
import torch
import torch.nn as nn
import numpy as np
from engine import Engine
from utils import use_cuda, resume_checkpoint
from torchvision.models import resnet18
PADDING_IDX = 0
class BertCNN(torch.nn.Module):
def __init__(self, config):
super(BertCNN, self).__init__()
self.config = config
... | [
"torch.nn.Sigmoid",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.as_tensor",
"torch.nn.Flatten",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"utils.use_cuda",
"numpy.load",
"torch.nn.Embedding"
] | [((851, 936), 'torch.nn.Embedding', 'torch.nn.Embedding', ([], {'num_embeddings': 'self.num_users', 'embedding_dim': 'self.latent_dim'}), '(num_embeddings=self.num_users, embedding_dim=self.latent_dim\n )\n', (869, 936), False, 'import torch\n'), ((2124, 2142), 'torch.nn.Sigmoid', 'torch.nn.Sigmoid', ([], {}), '()\n... |
from io import BytesIO
import gzip
import os
import os.path as op
import json
from glob import glob
import boto3
import s3fs
import numpy as np
import pandas as pd
import nibabel as nib
import dipy.data as dpd
from dipy.data.fetcher import _make_fetcher
from dipy.io.streamline import load_tractogram, load_trk
from d... | [
"numpy.union1d",
"s3fs.S3FileSystem",
"gzip.open",
"nibabel.load",
"io.BytesIO",
"numpy.array",
"nibabel.Nifti1Image.from_file_map",
"dipy.data.read_stanford_labels",
"dipy.data.read_stanford_hardi",
"numpy.arange",
"os.path.exists",
"dipy.data.fetch_stanford_hardi",
"numpy.where",
"os.pat... | [((794, 812), 'os.path.expanduser', 'op.expanduser', (['"""~"""'], {}), "('~')\n", (807, 812), True, 'import os.path as op\n'), ((3014, 3053), 'os.path.join', 'op.join', (['afq_home', '"""callosum_templates"""'], {}), "(afq_home, 'callosum_templates')\n", (3021, 3053), True, 'import os.path as op\n'), ((10683, 10713), ... |
import csv
import os
import mxnet as mx
import numpy as np
import pylab as plt
from matplotlib import ticker
from mxnet import nd, gluon, autograd
# from mxnet.contrib import amp
from mxnet.gluon.nn import HybridBlock
from mxnet.gluon.utils import split_and_load as sal
from numpy.ma import masked_array
from skimage.mea... | [
"mxnet.nd.expand_dims",
"pydicom.dataset.Dataset",
"mxnet.nd.concat",
"mxnet.gluon.model_zoo.vision.resnet18_v1",
"numpy.concatenate",
"numpy.ma.masked_array",
"numpy.round",
"pydicom.dataset.FileDataset",
"csv.writer",
"numpy.floor",
"utils.dataloader.DataLoader",
"mxnet.gluon.loss.CosineEmbe... | [((1775, 1792), 'mxnet.init.Uniform', 'mx.init.Uniform', ([], {}), '()\n', (1790, 1792), True, 'import mxnet as mx\n'), ((1808, 1828), 'mxnet.init.Normal', 'mx.init.Normal', (['(0.05)'], {}), '(0.05)\n', (1822, 1828), True, 'import mxnet as mx\n'), ((1843, 1872), 'mxnet.init.Xavier', 'mx.init.Xavier', ([], {'magnitude'... |
import numpy as np
import os
import pandas as pd
import tensorflow as tf
import skimage.transform as sktransform
import random
import matplotlib.image as mpimg
import shutil
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Conv2D, Dense, MaxPool2D, Dropout, Flatten, Lambda
fr... | [
"keras.layers.Conv2D",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.array",
"keras.layers.Dense",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"keras.optimizers.Adam",
"numpy.random.normal",
"ma... | [((1137, 1192), 'skimage.transform.resize', 'sktransform.resize', (['image[top:-bottom, :]', '(66, 200, 3)'], {}), '(image[top:-bottom, :], (66, 200, 3))\n', (1155, 1192), True, 'import skimage.transform as sktransform\n'), ((3554, 3567), 'sklearn.utils.shuffle', 'shuffle', (['x', 'y'], {}), '(x, y)\n', (3561, 3567), F... |
from __future__ import print_function
import os
import sys
import json
import argparse
import re
import numpy as np
from konlpy.tag import Mecab, Kkma
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from ..dataset import Dictionary
from ...utils.registry import dictionary_dict
def tokenize... | [
"argparse.ArgumentParser",
"konlpy.tag.Mecab",
"os.path.join",
"numpy.array",
"konlpy.tag.Kkma",
"os.path.abspath"
] | [((2475, 2500), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2498, 2500), False, 'import argparse\n'), ((2736, 2771), 'os.path.join', 'os.path.join', (['dataroot', "emb['dict']"], {}), "(dataroot, emb['dict'])\n", (2748, 2771), False, 'import os\n'), ((2869, 2904), 'os.path.join', 'os.path.j... |
#!/usr/bin/env python2
import os
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='stamp state estimate that are marked using id')
parser.add_argument('state_est',
help='state estimate file that starts with id')
pa... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.basename",
"numpy.savetxt",
"os.path.abspath",
"numpy.loadtxt"
] | [((111, 200), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""stamp state estimate that are marked using id"""'}), "(description=\n 'stamp state estimate that are marked using id')\n", (134, 200), False, 'import argparse\n'), ((659, 689), 'os.path.exists', 'os.path.exists', (['args.sta... |
# pylint: disable=import-error
from pathlib import Path
import pandas as pd
import numpy as np
import optuna
from optuna.samplers import TPESampler
from argparse import Namespace
import argparse
from PCM.optuna import (
Objective_ST,
Objective_ST_ext,
Objective_MT,
Objective_MT_withPRT,
)
from pytorch_... | [
"numpy.random.rand",
"argparse.ArgumentParser",
"pathlib.Path",
"pytorch_lightning.seed_everything",
"PCM.optuna.Objective_MT_withPRT",
"PCM.optuna.Objective_ST",
"numpy.random.randint",
"argparse.Namespace",
"PCM.optuna.Objective_MT",
"optuna.pruners.MedianPruner",
"optuna.samplers.TPESampler",... | [((386, 471), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run Optune to determine optimal model HPs"""'}), "(description='Run Optune to determine optimal model HPs'\n )\n", (409, 471), False, 'import argparse\n'), ((1208, 1231), 'pathlib.Path', 'Path', (["args['model_dir']"], {}), ... |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
import gym
import numpy as np
from dm_control import mjcf
from bisk.helpers import add_box, add_fw... | [
"logging.getLogger",
"numpy.in1d",
"numpy.any",
"gym.spaces.Box",
"numpy.deg2rad",
"numpy.linalg.norm"
] | [((395, 422), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (412, 422), False, 'import logging\n'), ((7637, 7665), 'numpy.any', 'np.any', (['(ball_wall & touching)'], {}), '(ball_wall & touching)\n', (7643, 7665), True, 'import numpy as np\n'), ((7487, 7525), 'numpy.in1d', 'np.in1d', (['... |
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, unicode_literals,
print_function)
import json
import logging
import os
import re
import subprocess
import warnings
import dlib
import numpy
import pathlib2
import six
import skimage
import skimage.color
import skimage.... | [
"file_metadata.utilities.DictNoNone",
"numpy.clip",
"file_metadata.utilities.bz2_decompress",
"file_metadata.image.svg_file.SVGFile.create",
"logging.exception",
"numpy.array",
"logging.error",
"re.search",
"numpy.mean",
"os.path.exists",
"file_metadata.image.tiff_file.TIFFFile.create",
"loggi... | [((999, 1061), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""', 'Image.DecompressionBombWarning'], {}), "('error', Image.DecompressionBombWarning)\n", (1020, 1061), False, 'import warnings\n'), ((5128, 5154), 'numpy.zeros_like', 'numpy.zeros_like', (['channels'], {}), '(channels)\n', (5144, 5154), Fal... |
# Code Generating Discrete Legendre Orthogonal Polynomials and the
# Legendre Delay Network Basis
#
# <NAME>, December 2020
#
# The code in this file is licensed under the Creative Commons Zero license.
# To the extent possible under law, <NAME> has waived all copyright and
# related or neighboring rights to this code.... | [
"numpy.linalg.matrix_rank",
"numpy.sqrt",
"numpy.linalg.pinv",
"numpy.array",
"numpy.linalg.norm",
"numpy.sin",
"numpy.arange",
"fractions.Fraction",
"numpy.linspace",
"numpy.polyval",
"numpy.linalg.lstsq",
"numpy.polynomial.Legendre",
"numpy.abs",
"numpy.eye",
"numpy.ones",
"numpy.out... | [((1352, 1369), 'numpy.zeros', 'np.zeros', (['P.shape'], {}), '(P.shape)\n', (1360, 1369), True, 'import numpy as np\n'), ((1721, 1737), 'numpy.zeros', 'np.zeros', (['(q, q)'], {}), '((q, q))\n', (1729, 1737), True, 'import numpy as np\n'), ((1921, 1930), 'numpy.eye', 'np.eye', (['q'], {}), '(q)\n', (1927, 1930), True,... |
import torch
import numpy as np
def get_topic_diversity(beta, topk):
num_topics = beta.shape[0]
list_w = np.zeros((num_topics, topk))
for k in range(num_topics):
idx = beta[k,:].argsort()[-topk:][::-1]
list_w[k,:] = idx
n_unique = len(np.unique(list_w))
TD = n_unique / (topk * num_t... | [
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.sqrt",
"nltk.corpus.stopwords.words",
"numpy.unique",
"numpy.log",
"os.path.join",
"wordcloud.WordCloud",
"numpy.sum",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplots_adjust"
] | [((114, 142), 'numpy.zeros', 'np.zeros', (['(num_topics, topk)'], {}), '((num_topics, topk))\n', (122, 142), True, 'import numpy as np\n'), ((2686, 2700), 'numpy.sqrt', 'np.sqrt', (['denom'], {}), '(denom)\n', (2693, 2700), True, 'import numpy as np\n'), ((3084, 3122), 'nltk.corpus.stopwords.words', 'nltk.corpus.stopwo... |
__author__ = '<NAME>'
import myFunctions as mf
import numpy as np
import cv2
from matplotlib import pyplot as plt
import logicFunctions as lf
img1 = cv2.imread('img1.jpg')
img3 = cv2.imread(('BlurryImage1.jpg'))
# Assignment 1:
GaussMask = 1.0/273 * np.array([[1, 4, 7, 4, 1],
... | [
"matplotlib.pyplot.imshow",
"numpy.abs",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.max",
"numpy.array",
"matplotlib.pyplot.figure",
"cv2.cvtColor",
"numpy.min",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"myFunctions.myHistPlotUint8",
"cv2.imread"
] | [((159, 181), 'cv2.imread', 'cv2.imread', (['"""img1.jpg"""'], {}), "('img1.jpg')\n", (169, 181), False, 'import cv2\n'), ((190, 220), 'cv2.imread', 'cv2.imread', (['"""BlurryImage1.jpg"""'], {}), "('BlurryImage1.jpg')\n", (200, 220), False, 'import cv2\n'), ((523, 570), 'numpy.array', 'np.array', (['[[0, -1, 0], [-1, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import pickle
import scipy.stats as stats
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from logdeep.dataset.log... | [
"logdeep.dataset.log.log_dataset",
"torch.randperm",
"pickle.dump",
"torch.load",
"tqdm.tqdm",
"pickle.load",
"logdeep.dataset.sample.session_window",
"logdeep.dataset.sample.sliding_window",
"torch.nn.functional.sigmoid",
"numpy.array",
"torch.argsort",
"torch.utils.data.DataLoader",
"torch... | [((3962, 3986), 'torch.randperm', 'torch.randperm', (['num_test'], {}), '(num_test)\n', (3976, 3986), False, 'import torch\n'), ((7691, 7702), 'time.time', 'time.time', ([], {}), '()\n', (7700, 7702), False, 'import time\n'), ((9523, 9571), 'logdeep.dataset.sample.session_window', 'session_window', (['self.output_dir']... |
import os
import copy
import scipy
import numpy as np
import matplotlib.pyplot as plt
from astropy import wcs
from astropy.io import fits
from astropy.table import Table, Column
import astropy.units as u
from astropy.coordinates import SkyCoord
from .display import display_single, SEG_CMAP
from .utils import img_cuto... | [
"sep.Background",
"copy.deepcopy",
"astropy.io.fits.open",
"copy.copy",
"os.path.islink",
"scipy.ndimage.zoom",
"scipy.ndimage.interpolation.shift",
"os.unlink",
"astropy.convolution.Box2DKernel",
"astropy.io.fits.PrimaryHDU",
"numpy.nansum",
"math.ceil",
"galsim.interpolant.Lanczos",
"ast... | [((1835, 1870), 'astropy.io.fits.PrimaryHDU', 'fits.PrimaryHDU', (['img'], {'header': 'header'}), '(img, header=header)\n', (1850, 1870), False, 'from astropy.io import fits\n'), ((2106, 2121), 'astropy.wcs.WCS', 'wcs.WCS', (['header'], {}), '(header)\n', (2113, 2121), False, 'from astropy import wcs\n'), ((4486, 4531)... |
import pandas as pd
import numpy as np
import pdb
import sys
import os
from sklearn.ensemble import GradientBoostingRegressor
from joblib import dump, load
import re
##################################################################3
# (Sept 2020 - Jared) - PG-MTL training script on 145 source lake
# Features and hyp... | [
"pandas.read_feather",
"numpy.unique",
"pandas.read_csv",
"numpy.isin",
"pandas.concat",
"pandas.DataFrame",
"sklearn.ensemble.GradientBoostingRegressor",
"joblib.dump",
"re.search"
] | [((1261, 1322), 'pandas.read_csv', 'pd.read_csv', (['"""../../metadata/pball_site_ids.csv"""'], {'header': 'None'}), "('../../metadata/pball_site_ids.csv', header=None)\n", (1272, 1322), True, 'import pandas as pd\n'), ((1355, 1424), 'pandas.read_csv', 'pd.read_csv', (['"""../../results/glm_transfer/RMSE_transfer_glm_p... |
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"numpy.random.rand",
"pandas.Index",
"mars.dataframe.DataFrame",
"mars.dataframe.Series",
"pandas.DataFrame",
"pandas.testing.assert_series_equal",
"numpy.testing.assert_array_equal"
] | [((1004, 1106), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 3, 3], [4, 2, 6], [7, 8, 9]]'], {'index': "['a1', 'a2', 'a3']", 'columns': "['x', 'y', 'z']"}), "([[1, 3, 3], [4, 2, 6], [7, 8, 9]], index=['a1', 'a2', 'a3'],\n columns=['x', 'y', 'z'])\n", (1016, 1106), True, 'import pandas as pd\n'), ((1144, 1175), 'mars.... |
"""
Package used to hold all methods related to preprocessing steps
Created on 22/06/2019
@author: nidragedd
"""
import matplotlib
# Set the matplotlib backend to a non-interactive one so figures can be saved in the background
matplotlib.use("agg")
import matplotlib.pyplot as plt
import numpy as np
import torch
from ... | [
"numpy.clip",
"matplotlib.pyplot.savefig",
"matplotlib.use",
"matplotlib.pyplot.style.use",
"numpy.array",
"src.preprocess.preprocess.process_image",
"matplotlib.pyplot.subplots"
] | [((228, 249), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (242, 249), False, 'import matplotlib\n'), ((916, 946), 'numpy.array', 'np.array', (['constants.norm_means'], {}), '(constants.norm_means)\n', (924, 946), True, 'import numpy as np\n'), ((957, 985), 'numpy.array', 'np.array', (['constan... |
import gym
from softmax import PolicyGradient
import matplotlib.pyplot as plt
import retro
import numpy as np
import cv2
class SonicDiscretizer(gym.ActionWrapper):
"""
Wrap a gym-retro environment and make it use discrete
actions for the Sonic game.
"""
# B is do nothing
# down
# def __i... | [
"softmax.PolicyGradient",
"numpy.reshape",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.array",
"cv2.cvtColor",
"cv2.resize",
"retro.make",
"matplotlib.pyplot.show"
] | [((1690, 1750), 'retro.make', 'retro.make', (['"""SonicTheHedgehog-Genesis"""', '"""GreenHillZone.Act1"""'], {}), "('SonicTheHedgehog-Genesis', 'GreenHillZone.Act1')\n", (1700, 1750), False, 'import retro\n'), ((2000, 2105), 'softmax.PolicyGradient', 'PolicyGradient', ([], {'n_actions': 'env.action_space.n', 'n_feature... |
# -*- coding: utf-8 -*-
"""
@author: GRANT_I
AstraZeneca, Macclesfield, UK
Questions to <EMAIL>
"""
# Python 3 script to fit equation 1 in manuscript to experimental data
# Total in Plasma over time
import numpy as np
from scipy.optimize import curve_fit
def plasma_total(t, k_res, cmax):
# To... | [
"scipy.optimize.curve_fit",
"numpy.exp",
"numpy.log"
] | [((671, 712), 'scipy.optimize.curve_fit', 'curve_fit', (['plasma_total', 't_8932', 'c_pl8932'], {}), '(plasma_total, t_8932, c_pl8932)\n', (680, 712), False, 'from scipy.optimize import curve_fit\n'), ((914, 923), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (920, 923), True, 'import numpy as np\n'), ((467, 494), 'nu... |
import numpy as np
import matplotlib.pyplot as plt
def plot_results():
# From https://www.delftstack.com/howto/matplotlib/how-to-plot-in-real-time-using-matplotlib/
# From https://matplotlib.org/stable/gallery/subplots_axes_and_figures/subplots_demo.html
figure1, axs = plt.subplots(2, 5, figsize=(32, ... | [
"matplotlib.pyplot.figtext",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.show"
] | [((288, 400), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(5)'], {'figsize': '(32, 18)', 'gridspec_kw': "{'width_ratios': [1, 1, 1, 1, 1], 'height_ratios': [1, 1]}"}), "(2, 5, figsize=(32, 18), gridspec_kw={'width_ratios': [1, 1, 1,\n 1, 1], 'height_ratios': [1, 1]})\n", (300, 400), True, 'import matplot... |
# -*- coding: utf-8 -*-
import gym
gym.logger.set_level(40) # suppress warnings (please remove if gives error)
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
from time import time
import itertools
import torch
torch.manual_seed(0) # set random seed
import torch.nn as nn
import torch.... | [
"torch.manual_seed",
"torch.nn.functional.softmax",
"numpy.mean",
"collections.deque",
"torch.distributions.Categorical",
"env_player.EnvPlayer",
"itertools.product",
"torch.from_numpy",
"torch.cuda.is_available",
"gym.logger.set_level",
"torch.nn.Linear",
"time.time",
"gym.make",
"torch.c... | [((36, 60), 'gym.logger.set_level', 'gym.logger.set_level', (['(40)'], {}), '(40)\n', (56, 60), False, 'import gym\n'), ((246, 266), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (263, 266), False, 'import torch\n'), ((5482, 5505), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0'... |
# Created by <NAME> on 2019-06-13.
# Copyright © 2019 <NAME>. All rights reserved.
import numpy as np
from numpy import sqrt, sin, cos, pi, e, sqrt, isclose
import matplotlib.pyplot as plt
# good place to check
# http://hyperphysics.phy-astr.gsu.edu/hbase/Kinetic/kintem.html#c2
# speed of sound
# http://hyperphy... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.title",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1410, 1431), 'numpy.arange', 'np.arange', (['(1)', '(3000)', '(1)'], {}), '(1, 3000, 1)\n', (1419, 1431), True, 'import numpy as np\n'), ((1497, 1540), 'matplotlib.pyplot.title', 'plt.title', (['"""maxwell–boltzmann distribution"""'], {}), "('maxwell–boltzmann distribution')\n", (1506, 1540), True, 'import matplotli... |
"""
Solvers
-------
This part of the package provides wrappers around Assimulo solvers.
"""
from assimulo.problem import Explicit_Problem
import numpy as np
import sys
from means.simulation import SensitivityTerm
from means.simulation.trajectory import Trajectory, TrajectoryWithSensitivityData
import inspect
from mean... | [
"inspect.getmembers",
"assimulo.solvers.Radau5ODE",
"assimulo.solvers.RungeKutta34",
"inspect.isclass",
"assimulo.solvers.LSODAR",
"assimulo.solvers.RungeKutta4",
"assimulo.solvers.sundials.CVode",
"means.util.sympyhelpers.to_one_dim_array",
"re.match",
"means.simulation.trajectory.Trajectory",
... | [((2064, 2105), 'inspect.getmembers', 'inspect.getmembers', (['sys.modules[__name__]'], {}), '(sys.modules[__name__])\n', (2082, 2105), False, 'import inspect\n'), ((3553, 3611), 're.match', 're.match', (['""".* failed with flag (-\\\\d+)"""', 'exception_message'], {}), "('.* failed with flag (-\\\\d+)', exception_mess... |
"""Implementation of 'Interpretable Counterfactual Explanations Guided by Prototypes'
Based on the original paper authored by <NAME> and <NAME>, and available at
https://arxiv.org/abs/1907.02584
We have used the implementation of the method available in the library ALIBI
(https://github.com/SeldonIO/alibi), with the ... | [
"tensorflow.compat.v1.disable_v2_behavior",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.Input",
"numpy.mean",
"os.path.exists",
"numpy.reshape",
"tensorflow.keras.layers.Conv2D",
"tensorflow.executing_eagerly",
"os.mkdir",
"tensorflow.keras.mod... | [((1010, 1044), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.compat.v1.disable_v2_behavior', ([], {}), '()\n', (1042, 1044), True, 'import tensorflow as tf\n'), ((1119, 1141), 'tensorflow.executing_eagerly', 'tf.executing_eagerly', ([], {}), '()\n', (1139, 1141), True, 'import tensorflow as tf\n'), ((7944, 7968), 't... |
from torch.utils.data import Dataset
import numpy as np
import time
from tqdm import tqdm
def binary_search(arr, k):
low = 0
high = len(arr) - 1
while low <= high:
mid = (low + high) // 2
if arr[mid] < k:
low = mid + 1
elif arr[mid] > k:
high = mid - 1
... | [
"numpy.delete",
"time.time",
"numpy.unique"
] | [((434, 457), 'numpy.unique', 'np.unique', (['ratings.T[1]'], {}), '(ratings.T[1])\n', (443, 457), True, 'import numpy as np\n'), ((916, 950), 'numpy.delete', 'np.delete', (['ratings', 'remove'], {'axis': '(0)'}), '(ratings, remove, axis=0)\n', (925, 950), True, 'import numpy as np\n'), ((1306, 1317), 'time.time', 'tim... |
#!/usr/bin/env python3
from gensim.models import KeyedVectors
from gensim.utils import tokenize
import numpy as np
from config import random_seed, word2vec_file, word2vec_dim, max_word_num
def load_word2vec():
print("Load Word2Vec from {} ...".format(word2vec_file))
return KeyedVectors.load_word2vec_format(w... | [
"gensim.utils.tokenize",
"gensim.models.KeyedVectors.load_word2vec_format",
"numpy.empty",
"numpy.random.seed",
"numpy.random.uniform",
"numpy.percentile"
] | [((285, 346), 'gensim.models.KeyedVectors.load_word2vec_format', 'KeyedVectors.load_word2vec_format', (['word2vec_file'], {'binary': '(True)'}), '(word2vec_file, binary=True)\n', (318, 346), False, 'from gensim.models import KeyedVectors\n'), ((421, 448), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(... |
import numpy as np
import matplotlib.pyplot as plt
from skimage import data, img_as_float
from skimage.segmentation import (morphological_chan_vese,
morphological_geodesic_active_contour,
inverse_gaussian_gradient,
checkerboard_level_set)
import skimage
def store_evolution_in(lst):
"""R... | [
"matplotlib.pyplot.imshow",
"numpy.copy",
"skimage.segmentation.morphological_chan_vese",
"skimage.segmentation.checkerboard_level_set",
"skimage.segmentation.inverse_gaussian_gradient",
"skimage.segmentation.morphological_geodesic_active_contour",
"numpy.zeros",
"pdb.set_trace",
"skimage.data.coins... | [((593, 631), 'skimage.segmentation.checkerboard_level_set', 'checkerboard_level_set', (['image.shape', '(6)'], {}), '(image.shape, 6)\n', (615, 631), False, 'from skimage.segmentation import morphological_chan_vese, morphological_geodesic_active_contour, inverse_gaussian_gradient, checkerboard_level_set\n'), ((753, 85... |
import numpy as np
import pytest
@pytest.fixture
def random_data(size, dtype):
rng = np.random.default_rng(2841)
data = rng.integers(-100, 100, size=size)
data = data.astype(dtype)
return data
| [
"numpy.random.default_rng"
] | [((91, 118), 'numpy.random.default_rng', 'np.random.default_rng', (['(2841)'], {}), '(2841)\n', (112, 118), True, 'import numpy as np\n')] |
import nltk
import random
import spacy
import string
import numpy as np
from nltk import ngrams
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
from spacy.tokens import Doc
np.random.seed(1234)
random.seed(1234)
stopWords = set(stopwords.words('english'))... | [
"nltk.pos_tag",
"nltk.corpus.stopwords.words",
"spacy.load",
"nltk.stem.WordNetLemmatizer",
"nltk.stem.PorterStemmer",
"random.seed",
"spacy.tokens.Doc",
"numpy.random.seed",
"nltk.ngrams"
] | [((237, 257), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (251, 257), True, 'import numpy as np\n'), ((258, 275), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (269, 275), False, 'import random\n'), ((334, 353), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n',... |
import numpy as np
def integer_sequences(L, S, nondecr=False, m=None, M=None):
"""
Generate sequences of non-negative integers.
Parameters:
L: the length of the sequences
S: the sum of the integers in each sequence
Optional parameters:
nondecr: (boolean) return o... | [
"numpy.zeros"
] | [((1795, 1822), 'numpy.zeros', 'np.zeros', (['(L, L)'], {'dtype': 'int'}), '((L, L), dtype=int)\n', (1803, 1822), True, 'import numpy as np\n')] |
import numpy as np
import pandas as pd
comaleName = r'\sc{Clear}'
class EE:
@staticmethod
def fx(x, s=0.0, h=0.5):
Z=(1 + s) * x ** 2 + 2 * (1 + h * s) * x * (1 - x) + (1 - x) ** 2
if Z>0:
return ((1 + s) * x ** 2 + (1 + h * s) * x * (1 - x)) / (Z)
else:
return 0
... | [
"pandas.Series",
"numpy.exp",
"numpy.log"
] | [((929, 941), 'pandas.Series', 'pd.Series', (['x'], {}), '(x)\n', (938, 941), True, 'import pandas as pd\n'), ((428, 437), 'numpy.log', 'np.log', (['p'], {}), '(p)\n', (434, 437), True, 'import numpy as np\n'), ((440, 453), 'numpy.log', 'np.log', (['(1 - p)'], {}), '(1 - p)\n', (446, 453), True, 'import numpy as np\n')... |
#!/usr/bin/env python
"""Simulation Utilities."""
# File to contain function necessary for the chi_square simulations
import copy
import logging
import numpy as np
def add_noise(flux, snr, use_mu=False):
"""Using the formulation 1/sigma (default) or mu/sigma from wikipedia.
https://en.wikipedia.org/wiki/S... | [
"numpy.random.normal",
"numpy.abs",
"numpy.ones_like",
"numpy.median",
"logging.warning",
"numpy.asarray",
"copy.copy",
"numpy.max",
"numpy.array",
"numpy.min",
"numpy.all"
] | [((969, 984), 'copy.copy', 'copy.copy', (['star'], {}), '(star)\n', (978, 984), False, 'import copy\n'), ((998, 1015), 'copy.copy', 'copy.copy', (['planet'], {}), '(planet)\n', (1007, 1015), False, 'import copy\n'), ((1024, 1058), 'numpy.all', 'np.all', (['(star.xaxis == planet.xaxis)'], {}), '(star.xaxis == planet.xax... |
from __future__ import division, absolute_import, print_function
__copyright__ = "Copyright (C) 2018 <NAME>"
__license__ = """
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,... | [
"loopy.register_callable_kernel",
"pyopencl.create_some_context",
"numpy.random.rand",
"loopy.make_function",
"loopy.set_options",
"loopy.GlobalArg",
"numpy.linalg.norm",
"loopy.split_iname",
"loopy.transform.callable._match_caller_callee_argument_dimension_",
"loopy.inline_callable_kernel",
"py... | [((2067, 2115), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inline"""', '[False, True]'], {}), "('inline', [False, True])\n", (2090, 2115), False, 'import pytest\n'), ((3726, 3774), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inline"""', '[False, True]'], {}), "('inline', [False, True])\... |
from keras.utils import np_utils
import numpy as np
import math
import matplotlib.pyplot as plt
class FixedChunkTest:
def __init__(self, time_delay, filename="fixed_chunk2.txt"):
'''
Chunks are written in the filename in which every line is a sequence of outputs followed by the number of the respective chunk
... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.argmax",
"matplotlib.pyplot.close",
"numpy.exp",
"numpy.random.randint",
"numpy.empty",
"numpy.array_equal",
"numpy.loadtxt",
"numpy.random.randn",
"matplotlib.pyplot.show"
] | [((486, 532), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'dtype': '"""i"""', 'delimiter': '""","""'}), "(filename, dtype='i', delimiter=',')\n", (496, 532), True, 'import numpy as np\n'), ((1428, 1450), 'numpy.asarray', 'np.asarray', (['self.chunk'], {}), '(self.chunk)\n', (1438, 1450), True, 'import numpy as np\n'... |
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import numpy
#image = "ct34"
image_ext = ".jpg"
image_list = ["ct1","ct3","ct4","ct5","ct6","ct7","ct8","ct9","ct10","ct11","ct12","ct13",
"ct14","ct15","ct16","ct17","ct18","ct19","ct20","ct21","ct22","ct23","ct24","ct25","ct26",
"ct27","ct28... | [
"numpy.copy",
"matplotlib.pyplot.gcf",
"matplotlib.image.imread",
"matplotlib.image.imsave",
"matplotlib.pyplot.title"
] | [((516, 555), 'matplotlib.image.imread', 'mpimg.imread', (['(current_image + image_ext)'], {}), '(current_image + image_ext)\n', (528, 555), True, 'import matplotlib.image as mpimg\n'), ((1555, 1606), 'matplotlib.pyplot.title', 'plt.title', (["(current_image + '_' + method + image_ext)"], {}), "(current_image + '_' + m... |
from typing import Union
class TensorAdapter:
def zeros(self, size: int, dtype: str):
raise NotImplemented()
def argmax(self, arr):
raise NotImplemented()
def get(self, tensor, pos):
raise NotImplemented()
try:
import numpy as np
class NumpyAdapter(TensorAdapter):
... | [
"numpy.argmax",
"torch.__getattribute__",
"numpy.zeros",
"torch.zeros",
"torch.argmax"
] | [((403, 430), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'dtype'}), '(size, dtype=dtype)\n', (411, 430), True, 'import numpy as np\n'), ((482, 496), 'numpy.argmax', 'np.argmax', (['arr'], {}), '(arr)\n', (491, 496), True, 'import numpy as np\n'), ((1226, 1256), 'torch.zeros', 'torch.zeros', (['size'], {'dtype': 'd... |
#libraries are imported
import numpy as np
import random
# Chess table is created
a=['|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|']
chart= np.array([a,a,a,a,a,a,a,a],dtype=object)
chart2= chart.copy()
list1=[]
# possible columns are listed and first random selection is performed
columns_list=[1,3... | [
"numpy.array",
"random.choice"
] | [((162, 210), 'numpy.array', 'np.array', (['[a, a, a, a, a, a, a, a]'], {'dtype': 'object'}), '([a, a, a, a, a, a, a, a], dtype=object)\n', (170, 210), True, 'import numpy as np\n'), ((346, 373), 'random.choice', 'random.choice', (['columns_list'], {}), '(columns_list)\n', (359, 373), False, 'import random\n'), ((617, ... |
#!/usr/bin/env python3
import os
import sys
sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src')]
sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))]
import fire
import json
import numpy as np
import tensorflow as tf
import model, sample, e... | [
"fire.Fire",
"tensorflow.get_default_session",
"torch.cuda.device_count",
"torch.cuda.is_available",
"tflex.raw_text.endswith",
"tensorflow.set_random_seed",
"tensorflow.Graph",
"argparse.ArgumentParser",
"subprocess.Popen",
"tensorflow.placeholder",
"tflex.should_quit",
"platform.system",
"... | [((377, 512), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate Text from GPT-2 from prompt"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Generate Text from GPT-2 from prompt',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (40... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 9 15:28:22 2020
@author: Ciaran
"""
def player_displacement_value_tab(events_df, metrica_attack, metrica_defence, bokeh_attack, bokeh_defence, shirt_mapping, match_list):
import metrica_to_bokeh as mtb
import Metrica_PitchControl as mpc
impor... | [
"bokeh.layouts.column",
"pitch_value_model.lastrow_generate_pitch_control_for_event",
"scipy.interpolate.interp2d",
"bokeh.models.Div",
"pitch_value_model.generate_relative_pitch_value",
"metrica_to_bokeh.plot_bokeh_surface_at_event",
"bokeh.models.Paragraph",
"bokeh.models.TableColumn",
"numpy.lins... | [((6028, 6098), 'bokeh.models.Select', 'Select', ([], {'title': '"""Select Match:"""', 'value': 'match_list[0]', 'options': 'match_list'}), "(title='Select Match:', value=match_list[0], options=match_list)\n", (6034, 6098), False, 'from bokeh.models import ColumnDataSource, Select, TextInput, Panel, Div, Button, DataTa... |
"""
Generic methods for converting data between different spatial coordinate systems.
Uses pyproj library.
"""
import firedrake as fd
import pyproj
import numpy
from abc import ABC, abstractmethod
LL_WGS84 = pyproj.Proj(proj='latlong', datum='WGS84', errcheck=True)
class CoordinateSystem(ABC):
"""
Base class... | [
"numpy.full_like",
"pyproj.transform",
"numpy.array",
"pyproj.Transformer.from_crs",
"numpy.arctan2",
"numpy.cos",
"pyproj.Proj",
"numpy.isfinite",
"numpy.sin",
"numpy.mod"
] | [((209, 266), 'pyproj.Proj', 'pyproj.Proj', ([], {'proj': '"""latlong"""', 'datum': '"""WGS84"""', 'errcheck': '(True)'}), "(proj='latlong', datum='WGS84', errcheck=True)\n", (220, 266), False, 'import pyproj\n'), ((6231, 6277), 'pyproj.transform', 'pyproj.transform', (['source_sys', 'target_sys', 'x', 'y'], {}), '(sou... |
""" Re-parametrization of LASSO regression for ESL."""
import numpy as np
from .esl_regressor import EslRegressor
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Lasso, LinearRegression, lars_path
class LassoRegressor(EslRegressor):
""" LASSO regression.
By default, predict... | [
"sklearn.linear_model.Lasso",
"numpy.average",
"numpy.searchsorted",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"numpy.zeros",
"numpy.dot",
"numpy.linalg.norm",
"sklearn.linear_model.lars_path"
] | [((1068, 1086), 'sklearn.linear_model.Lasso', 'Lasso', ([], {'alpha': 'alpha'}), '(alpha=alpha)\n', (1073, 1086), False, 'from sklearn.linear_model import Lasso, LinearRegression, lars_path\n'), ((1628, 1644), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (1642, 1644), False, 'from sklearn... |
import collections
import numpy as np
from guesswhat.statistics.abstract_plotter import *
import seaborn as sns
import pandas as pd
class SuccessDialogueLength(AbstractPlotter):
def __init__(self, path, games, logger, suffix):
super(SuccessDialogueLength, self).__init__(path, self.__class__.__name__, suf... | [
"seaborn.set_style",
"numpy.array",
"collections.defaultdict",
"pandas.DataFrame"
] | [((374, 402), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (397, 402), False, 'import collections\n'), ((821, 869), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""', "{'axes.grid': False}"], {}), "('whitegrid', {'axes.grid': False})\n", (834, 869), True, 'import seaborn as sn... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Gamut変換の特性を調べる。
"""
# 外部ライブラリのインポート
import os
import numpy as np
import matplotlib.pyplot as plt
# 自作ライブラリのインポート
import test_pattern_generator2 as tpg
import color_space as cs
import transfer_functions as tf
from CalcParameters import CalcParameters
import plot_utili... | [
"matplotlib.pyplot.savefig",
"test_pattern_generator2.get_chromaticity_image",
"test_pattern_generator2._get_cmfs_xy",
"numpy.append",
"test_pattern_generator2.get_primaries",
"os.path.abspath",
"CalcParameters.CalcParameters",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((1086, 1156), 'test_pattern_generator2.get_chromaticity_image', 'tpg.get_chromaticity_image', ([], {'xmin': 'xmin', 'xmax': 'xmax', 'ymin': 'ymin', 'ymax': 'ymax'}), '(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)\n', (1112, 1156), True, 'import test_pattern_generator2 as tpg\n'), ((1179, 1197), 'test_pattern_generator... |
#! /usr/bin/env python2.7
prefixes = ('af', 'as', 'au', 'ca', 'eu', 'na', 'sa')
import matplotlib
matplotlib.use('Agg')
import dem as d
from matplotlib import pyplot as plt
from demMethods import plotGrids
import numpy as np
import demMethods as dm
kss_to_report = [100.0, 150.0, 200.0]
a = [0, 20000, 0, 2000000]
s... | [
"numpy.log10",
"demMethods.create_density",
"numpy.flipud",
"matplotlib.use",
"numpy.where",
"numpy.sort",
"matplotlib.pyplot.colorbar",
"demMethods.extract_values_from_grid",
"numpy.array",
"numpy.ndarray.flatten",
"matplotlib.pyplot.figure",
"numpy.sum",
"numpy.cumsum",
"numpy.concatenat... | [((100, 121), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (114, 121), False, 'import matplotlib\n'), ((460, 485), 'numpy.arange', 'np.arange', (['a[0]', 'a[1]', 'dx'], {}), '(a[0], a[1], dx)\n', (469, 485), True, 'import numpy as np\n'), ((493, 518), 'numpy.arange', 'np.arange', (['a[2]', 'a[3... |
from ml_tutor.model import BaseModelRegression
import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
class LinearRegression(BaseModelRegression):
def __init__(self, learning_rate=0.0001, num_iter=100000, tol=0.00001, visual_training=True):
"""
Creates the... | [
"IPython.display.display",
"numpy.multiply",
"numpy.abs",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"time.sleep",
"sklearn.metrics.mean_squared_error",
"matplotlib.pyplot.close",
"IPython.display.clear_output",
"matplotlib.pyplot.... | [((5750, 5785), 'sklearn.metrics.mean_squared_error', 'mean_squared_error', (['real', 'predicted'], {}), '(real, predicted)\n', (5768, 5785), False, 'from sklearn.metrics import mean_squared_error\n'), ((6840, 6853), 'IPython.core.getipython.get_ipython', 'get_ipython', ([], {}), '()\n', (6851, 6853), False, 'from IPyt... |
# -*- coding:utf-8 -*-
import os
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sentencepiece as spm
import tensorflow as tf
import tensorflow.keras.backend as K
import wget
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
random_seed = 1234
random.seed(random_seed)
np.random.see... | [
"wget.download",
"pandas.read_csv",
"sentencepiece.SentencePieceProcessor",
"tensorflow.keras.callbacks.EarlyStopping",
"numpy.array",
"tensorflow.config.list_physical_devices",
"tensorflow.keras.layers.Dense",
"tensorflow.cast",
"os.path.exists",
"tensorflow.keras.layers.Input",
"os.listdir",
... | [((282, 306), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (293, 306), False, 'import random\n'), ((307, 334), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (321, 334), True, 'import numpy as np\n'), ((335, 366), 'tensorflow.random.set_seed', 'tf.random.set_... |
import numpy as np
import matplotlib.pyplot as plt
from multilayer_perceptron import MLP
from gradient_boosting_decision_tree import GBDT
from xgboost import XGBoost
from random_forest import RandomForest
from adaboost import AdaBoost
from factorization_machines import FactorizationMachines
from support_vector_machine ... | [
"numpy.random.random",
"numpy.square",
"matplotlib.pyplot.contour",
"numpy.linspace",
"numpy.array",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1492, 1539), 'matplotlib.pyplot.subplot', 'plt.subplot', (['subplot[0]', 'subplot[1]', 'subplot[2]'], {}), '(subplot[0], subplot[1], subplot[2])\n', (1503, 1539), True, 'import matplotlib.pyplot as plt\n'), ((1967, 2022), 'matplotlib.pyplot.contour', 'plt.contour', (['xx', 'yy', 'zz'], {'levels': '[0.5]', 'colors': ... |
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.animation as manimation
def output(pos, focus, zoom):
if pos <= focus:
return focus * ((pos / focus) ** zoom)
else:
return (1 - (1 - focus) * (((1 - pos) / (1 - focus)) ** zoom))
def ... | [
"matplotlib.use",
"numpy.where",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"numpy.arange"
] | [((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), False, 'import matplotlib\n'), ((1167, 1179), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1177, 1179), True, 'import matplotlib.pyplot as plt\n'), ((1185, 1206), 'matplotlib.pyplot.plot', 'plt.plot', (['[]', '[]... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
from models import Net
def train... | [
"torch.manual_seed",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"torch.nn.functional.binary_cross_entropy",
"torch.optim.lr_scheduler.StepLR",
"torch.utils.data.TensorDataset",
"torch.nn.functional.smooth_l1_loss",
"numpy.array",
"torch.cuda.is_availa... | [((1604, 1668), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Vec2Color Example"""'}), "(description='PyTorch Vec2Color Example')\n", (1627, 1668), False, 'import argparse\n'), ((3057, 3085), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (3074, ... |
import numpy as np
import torch
import matplotlib.pyplot as plt
from pathlib import Path
from matplotlib.backends.backend_pdf import PdfPages
import glob
import pandas as pd
import os
from itertools import compress
from results_utils import display_dataset_name, display_decoder_name, coef_variation, metrics, dict_mean... | [
"numpy.mean",
"pathlib.Path",
"pandas.DataFrame.from_dict",
"results_utils.metrics",
"torch.device"
] | [((414, 438), 'pathlib.Path', 'Path', (['"""../work/results/"""'], {}), "('../work/results/')\n", (418, 438), False, 'from pathlib import Path\n'), ((478, 500), 'pathlib.Path', 'Path', (['"""../work/latex/"""'], {}), "('../work/latex/')\n", (482, 500), False, 'from pathlib import Path\n'), ((513, 534), 'pathlib.Path', ... |
# Copyright (c) 2020 PaddlePaddle 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.random.random",
"paddle.fluid.tests.unittests.op_test.skip_check_grad_ci",
"numpy.random.randint",
"numpy.matmul",
"unittest.main",
"numpy.transpose",
"numpy.amax",
"numpy.round"
] | [((768, 841), 'paddle.fluid.tests.unittests.op_test.skip_check_grad_ci', 'skip_check_grad_ci', ([], {'reason': '"""DNNL\'s MatMul doesn\'t implemend grad kernel."""'}), '(reason="DNNL\'s MatMul doesn\'t implemend grad kernel.")\n', (786, 841), False, 'from paddle.fluid.tests.unittests.op_test import OpTest, skip_check_... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 02_constitutive.ipynb (unless otherwise specified).
__all__ = ['Elastic', 'PlaneStrain', 'PlaneStress', 'TransverseIsotropic', 'MMC']
# Cell
import numpy as np
from .base import BaseConstitutive, Properties
from .io import jsonReader
# Cell
class Elastic(BaseConstitutive):... | [
"numpy.block",
"numpy.eye",
"numpy.ones",
"numpy.hstack",
"numpy.array",
"numpy.zeros",
"numpy.matmul",
"numpy.diagflat"
] | [((640, 656), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (648, 656), True, 'import numpy as np\n'), ((819, 854), 'numpy.matmul', 'np.matmul', (['self.De', 'deformation.eps'], {}), '(self.De, deformation.eps)\n', (828, 854), True, 'import numpy as np\n'), ((1305, 1321), 'numpy.zeros', 'np.zeros', (['(2, ... |
#!/usr/local/sci/bin/python
# PYTHON3
#
# Author: <NAME>
# Created: 07 Jan 2019
# Last update: 07 Jan 2019
# Location: /data/local/hadkw/HADCRUH2/MARINE/EUSTACEMDS/EUSTACE_SST_MAT/
# GitHub: https://github.com/Kate-Willett/HadISDH_Marine_Build/
# -----------------------
# CODE PURPOSE AND OUTPUT
# ---------------... | [
"matplotlib.pyplot.savefig",
"numpy.where",
"matplotlib.pyplot.clf",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes",
"numpy.genfromtxt"
] | [((5298, 5328), 'numpy.array', 'np.array', (["RawData['f0'][0:NYr]"], {}), "(RawData['f0'][0:NYr])\n", (5306, 5328), True, 'import numpy as np\n'), ((5336, 5366), 'numpy.array', 'np.array', (["RawData['f5'][0:NYr]"], {}), "(RawData['f5'][0:NYr])\n", (5344, 5366), True, 'import numpy as np\n'), ((5374, 5404), 'numpy.arr... |
import numpy as np
bbox_vertices = np.array(
[
[0.0, 0.0, 0.0, 1.0],
[0.0, 0.0, 1.0, 1.0],
[0.0, 1.0, 1.0, 1.0],
[1.0, 1.0, 0.0, 1.0],
[0.0, 0.0, 0.0, 1.0],
[0.0, 1.0, 0.0, 1.0],
[1.0, 0.0, 1.0, 1.0],
[0.0, 0.0, 0.0, 1.0],
[1.0, 0.0, 0.0, 1.0]... | [
"numpy.array"
] | [((36, 905), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [1.0, \n 1.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0], [1.0, 0.0, \n 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 0.0, \n 1.0], [1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, ... |
### Author <NAME> - 29 September 2020 ###
import pandas as pd
import numpy as np
import json
from gooey import Gooey, GooeyParser
import _pickle as cPickle
from collections import Counter
import warnings
import webbrowser
import time
from sklearn.ensemble import RandomForestClassifier
from imblearn.ensemble import Bal... | [
"pandas.read_csv",
"webbrowser.open",
"time.sleep",
"numpy.array",
"sys.path.append",
"os.remove",
"pandas.read_pickle",
"pandas.DataFrame.from_dict",
"_pickle.load",
"pandas.concat",
"warnings.simplefilter",
"pandas.DataFrame",
"warnings.warn",
"pandas.Series",
"help_functions.str_to_bo... | [((435, 475), 'sys.path.append', 'sys.path.append', (["(path_main + '/Classes/')"], {}), "(path_main + '/Classes/')\n", (450, 475), False, 'import sys\n'), ((476, 514), 'sys.path.append', 'sys.path.append', (["(path_main + '/Utils/')"], {}), "(path_main + '/Utils/')\n", (491, 514), False, 'import sys\n'), ((762, 915), ... |
"""
Volumes
=======
A :class:`Volume` represents a 3D region of space with a fixed, scalar volume. It corresponds
to the "box" used in simulations. The following box types have been implemented:
.. autosummary::
:nosignatures:
Parallelepiped
TriclinicBox
Cuboid
Cube
The :class:`TriclinicBox` can ... | [
"numpy.asarray",
"numpy.cross"
] | [((2970, 3007), 'numpy.asarray', 'numpy.asarray', (['a'], {'dtype': 'numpy.float64'}), '(a, dtype=numpy.float64)\n', (2983, 3007), False, 'import numpy\n'), ((3024, 3061), 'numpy.asarray', 'numpy.asarray', (['b'], {'dtype': 'numpy.float64'}), '(b, dtype=numpy.float64)\n', (3037, 3061), False, 'import numpy\n'), ((3078,... |
# Import Libraries
import os
from pathlib import Path
import argparse
import datetime, dateutil
import json
import pickle
import numpy as np
import pandas as pd
import csv
import nltk
from nltk.tokenize import word_tokenize
nltk.download('stopwords')
nltk.download('punkt')
from nltk.tokenize import TweetTokenizer
tt ... | [
"transformers.AutoModel.from_pretrained",
"nltk.tokenize.TweetTokenizer",
"pickle.dump",
"transformers.AutoConfig.from_pretrained",
"argparse.ArgumentParser",
"nltk.download",
"pathlib.Path",
"torch.stack",
"pickle.load",
"torch.tensor",
"numpy.zeros",
"torch.cuda.is_available",
"transformer... | [((226, 252), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (239, 252), False, 'import nltk\n'), ((253, 275), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (266, 275), False, 'import nltk\n'), ((322, 338), 'nltk.tokenize.TweetTokenizer', 'TweetTokenizer', ([],... |
import math
import numpy as np
from data_utils.utils import unicode_csv_reader2
from collections import defaultdict
from sklearn.model_selection import StratifiedShuffleSplit
from utils import UnicodeWriter
class TweetCorpus:
'''Simple corpus reader.'''
'''
Format of tweets_file (comma separated) is:
C... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"math.floor",
"numpy.asarray",
"collections.defaultdict",
"data_utils.utils.unicode_csv_reader2"
] | [((4083, 4099), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (4094, 4099), False, 'from collections import defaultdict\n'), ((4125, 4141), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (4136, 4141), False, 'from collections import defaultdict\n'), ((5000, 5016), 'collections... |
#!/usr/bin/env python3
# Author: <NAME>
import os
import os.path as osp
import time
from typing import Any, Dict, List, Optional
from sklearn.metrics import r2_score, explained_variance_score
import h5py
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from pytorch_transformers impor... | [
"src.TensorboardWriter",
"torch.nn.utils.clip_grad_norm_",
"torch.cuda.device_count",
"src.get_model_class",
"numpy.argsort",
"torch.cuda.is_available",
"sklearn.metrics.r2_score",
"os.path.exists",
"src.dataset.SpikesDataset",
"pytorch_transformers.WarmupCosineSchedule",
"os.path.split",
"src... | [((871, 936), 'os.system', 'os.system', (['"""nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp"""'], {}), "('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp')\n", (880, 936), False, 'import os\n'), ((816, 841), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (839, 841), False, 'import t... |
from typing import Optional, Union
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import numpy as np
_annotation_kws = {
"horizontalalignment": "left", # if not mirror_intensity else "right",
"verticalalignment": "center",
"fontsize": 7,
"rotation": 90,
"rotation_mode": "anch... | [
"numpy.tile",
"numpy.ceil",
"matplotlib.ticker.PercentFormatter",
"matplotlib.pyplot.gca",
"numpy.floor",
"numpy.zeros",
"matplotlib.ticker.AutoLocator",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.ticker.AutoMinorLocator"
] | [((6808, 6879), 'matplotlib.pyplot.subplots', 'plt.subplots', (['n_rows', 'n_cols'], {'figsize': '(7 * n_cols, 3 * n_rows)', 'dpi': 'dpi'}), '(n_rows, n_cols, figsize=(7 * n_cols, 3 * n_rows), dpi=dpi)\n', (6820, 6879), True, 'import matplotlib.pyplot as plt\n'), ((7671, 7703), 'matplotlib.pyplot.title', 'plt.title', (... |
import convolution
import numpy as np
def kernelAsList():
return [[1,2,3,-12,3,2,1]]
def midKernel():
kernel = kernelAsList()
return np.array(kernel).reshape(1,len(kernel[0]))
def midKernelTranspose():
kernel = kernelAsList()
return np.array(kernel).reshape(len(kernel[0]),1)
def edgeDetection(ima... | [
"numpy.array"
] | [((147, 163), 'numpy.array', 'np.array', (['kernel'], {}), '(kernel)\n', (155, 163), True, 'import numpy as np\n'), ((256, 272), 'numpy.array', 'np.array', (['kernel'], {}), '(kernel)\n', (264, 272), True, 'import numpy as np\n')] |
from __future__ import division, absolute_import
import numpy as np
def bb_intersection_over_union(boxA, boxB):
"""Calculate Intersection Over Union"""
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])... | [
"numpy.where",
"numpy.ones"
] | [((1244, 1269), 'numpy.where', 'np.where', (['(histogram_y > 0)'], {}), '(histogram_y > 0)\n', (1252, 1269), True, 'import numpy as np\n'), ((1306, 1331), 'numpy.where', 'np.where', (['(histogram_x > 0)'], {}), '(histogram_x > 0)\n', (1314, 1331), True, 'import numpy as np\n'), ((1104, 1131), 'numpy.ones', 'np.ones', (... |
# -*- coding: utf-8 -*-
import os
import numpy as np
from datetime import datetime
from tempfile import mkdtemp
def read_header(f):
'''
Read header information from the first 1024 bytes of an OpenEphys file.
Parameters
----------
| f : file
| An open file handle to an OpenEphys file
... | [
"numpy.fromfile",
"numpy.reshape",
"datetime.datetime.strptime",
"numpy.float64",
"numpy.memmap",
"os.path.join",
"os.path.splitext",
"numpy.array",
"numpy.zeros",
"tempfile.mkdtemp",
"os.path.basename",
"numpy.dtype"
] | [((2337, 2379), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7, 8, 255]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7, 8, 255])\n', (2345, 2379), True, 'import numpy as np\n'), ((2677, 2697), 'tempfile.mkdtemp', 'mkdtemp', ([], {'dir': 'tmp_dir'}), '(dir=tmp_dir)\n', (2684, 2697), False, 'from tempfile import mkdtemp\n'), (... |
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
import re
import datetime
import hashlib
import random
import numpy as np
import keras
from keras.layers import Input, Embedding, Dense, Dropout
from keras.layers import LSTM, GRU
from keras.optimizers import Adam
from keras.preprocessing... | [
"keras.optimizers.Adam",
"datetime.datetime",
"numpy.identity",
"hashlib.md5",
"re.compile",
"datetime.datetime.strptime",
"h5py.File",
"numpy.array",
"keras.layers.Input",
"keras.layers.LSTM",
"os.path.basename",
"keras.models.Model",
"numpy.expand_dims",
"keras.layers.Dense",
"re.sub",... | [((519, 550), 're.compile', 're.compile', (['"""[\\\\(\\\\)@#$*;"\']+"""'], {}), '(\'[\\\\(\\\\)@#$*;"\\\']+\')\n', (529, 550), False, 'import re\n'), ((564, 606), 're.compile', 're.compile', (['"""[^a-zA-Z0-9 \\\\.\\\\-%_:/\\\\\\\\]+"""'], {}), "('[^a-zA-Z0-9 \\\\.\\\\-%_:/\\\\\\\\]+')\n", (574, 606), False, 'import r... |
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.optimize as optimize
R = 287.058; Cpd = 1005.7; Cpv = 1875; g = 9.81 # define constants
Lw = lambda T: (2.501 - 0.00237 * T) * 10**6
varsIncluded = ['timestamp', 'Pressure', 'Temperature',
'Hum... | [
"pandas.Series",
"numpy.log10",
"numpy.log",
"numpy.exp",
"scipy.optimize.fixed_point",
"pandas.read_sql",
"pandas.DataFrame.__init__",
"matplotlib.pyplot.subplots"
] | [((1956, 2027), 'pandas.read_sql', 'pd.read_sql', (['sql_query', 'conn'], {'parse_dates': "['timestamp']", 'params': 't_range'}), "(sql_query, conn, parse_dates=['timestamp'], params=t_range)\n", (1967, 2027), True, 'import pandas as pd\n'), ((643, 699), 'pandas.read_sql', 'pd.read_sql', (['sql_query', 'conn'], {'parse... |
import cv2
import os
import numpy as np
MODEL_PATH= "models"+os.sep+"face_detection"+os.sep+"caffe"+os.sep+"VGG_ILSVRC_19_layers"
PROTO_TXT = MODEL_PATH+os.sep+"deploy.prototxt.txt"
MODEL= MODEL_PATH+os.sep+"VGG_ILSVRC_19_layers.caffemodel"
class Caffe_detector():
def __init__(self):
print("[INFO] loading m... | [
"cv2.rectangle",
"cv2.dnn.readNetFromCaffe",
"cv2.imshow",
"cv2.putText",
"numpy.array",
"cv2.resize",
"cv2.waitKey",
"cv2.imread"
] | [((361, 403), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (['PROTO_TXT', 'MODEL'], {}), '(PROTO_TXT, MODEL)\n', (385, 403), False, 'import cv2\n'), ((543, 565), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (553, 565), False, 'import cv2\n'), ((2073, 2100), 'cv2.imshow', 'cv2.imshow', ... |
from src.problems.problem import Problem
from dataclasses import dataclass
import numpy as np
class Minimization2DProblem(Problem):
x_min: int = -6
y_min: int = -6
x_max: int = 6
y_max: int = 6
vtr: float
def is_solved(self, best_solution: np.ndarray):
return self.evaluate(... | [
"numpy.exp",
"numpy.array",
"numpy.sum"
] | [((471, 505), 'numpy.array', 'np.array', (['[self.x_min, self.y_min]'], {}), '([self.x_min, self.y_min])\n', (479, 505), True, 'import numpy as np\n'), ((573, 607), 'numpy.array', 'np.array', (['[self.x_max, self.y_max]'], {}), '([self.x_max, self.y_max])\n', (581, 607), True, 'import numpy as np\n'), ((796, 832), 'num... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
###
# Name: <NAME>
# Student ID: 0022707716
# Email: <EMAIL>
# Course: PHYS/CPSC/MATH 220 Fall 2018
# Assignment: CW 12
###
import numpy as np
import sombrero as sb
def test_sombrero():
"""
Checks if the first 3 and last 3 values of a known function are correct... | [
"numpy.array",
"sombrero.sombrero",
"numpy.allclose"
] | [((348, 383), 'numpy.array', 'np.array', (['[-0.9, -0.9, -0.89999998]'], {}), '([-0.9, -0.9, -0.89999998])\n', (356, 383), True, 'import numpy as np\n'), ((402, 449), 'numpy.array', 'np.array', (['[0.0, 8.99884295e-06, 1.79952436e-05]'], {}), '([0.0, 8.99884295e-06, 1.79952436e-05])\n', (410, 449), True, 'import numpy ... |
import numpy as np
from simforest.criterion import find_split_variance, find_split_theil, find_split_atkinson, find_split_index_gini
from sklearn.preprocessing import LabelEncoder
def find_split(X, y, p, q, criterion, sim_function, gamma=None):
""" Find split among direction drew on pair of data-points
Pa... | [
"sklearn.preprocessing.LabelEncoder",
"numpy.unique",
"numpy.int32",
"numpy.array",
"numpy.isnan"
] | [((1438, 1453), 'numpy.int32', 'np.int32', (['(n - 1)'], {}), '(n - 1)\n', (1446, 1453), True, 'import numpy as np\n'), ((1677, 1692), 'numpy.int32', 'np.int32', (['(n - 1)'], {}), '(n - 1)\n', (1685, 1692), True, 'import numpy as np\n'), ((1101, 1126), 'numpy.isnan', 'np.isnan', (['similarities[i]'], {}), '(similariti... |
import numpy as np
import matplotlib.pyplot as plt
plt.figure(1)
plt.clf()
plt.axis([-10, 10, -10, 10])
# Define properties of the "bouncing balls"
n = 10
pos = (20 * np.random.sample(n*2) - 10).reshape(n, 2)
vel = (0.3 * np.random.normal(size=n*2)).reshape(n, 2)
sizes = 100 * np.random.sample(n) + 100
# Colors wher... | [
"numpy.random.normal",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.figure",
"numpy.random.sample",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.axis"
] | [((52, 65), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (62, 65), True, 'import matplotlib.pyplot as plt\n'), ((66, 75), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (73, 75), True, 'import matplotlib.pyplot as plt\n'), ((76, 104), 'matplotlib.pyplot.axis', 'plt.axis', (['[-10, 10, -10, 1... |
import matplotlib.pyplot as plt
import numpy as np
from scripts import loss_funcs
from scipy.stats import norm as scipy_normal
# Grab some normal points
distribution = loss_funcs.NormalPDFLoss()
hello = {}
to_try = np.asarray([1500] * 1)
#colours = ['r', 'g', 'b', 'm', 'c', 'y']
mean = [0.0, 0.1, 0.2, 0.3, 0.4]
mean... | [
"numpy.mean",
"numpy.logical_and",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.sort",
"numpy.asarray",
"matplotlib.pyplot.plot",
"scipy.stats.norm.rvs",
"numpy.max",
"scripts.loss_funcs.NormalPDFLoss",
"numpy.linspace",
"numpy.cosh",
"numpy.std",
"numpy.cumsum",
"scipy... | [((169, 195), 'scripts.loss_funcs.NormalPDFLoss', 'loss_funcs.NormalPDFLoss', ([], {}), '()\n', (193, 195), False, 'from scripts import loss_funcs\n'), ((217, 239), 'numpy.asarray', 'np.asarray', (['([1500] * 1)'], {}), '([1500] * 1)\n', (227, 239), True, 'import numpy as np\n'), ((1940, 1952), 'matplotlib.pyplot.legen... |
import os
import sys
import cv2
import csv
import time
import torch
import torchvision
import numpy as np
# import busio
# from board import SCL
# from board import SDA
from uuid import uuid1
# from adafruit_motor import servo
# from adafruit_motor import motor
# from adafruit_pca9685 import PCA9685
from controller imp... | [
"time.sleep",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"sys.exit",
"os.path.exists",
"neural_network.Net",
"csv.writer",
"uuid.uuid1",
"torchvision.transforms.Normalize",
"numpy.interp",
"controller.PS4Controller",
"cv2.cvtColor",
"cv2.resize",
"torch.load",
"camer... | [((5104, 5119), 'controller.PS4Controller', 'PS4Controller', ([], {}), '()\n', (5117, 5119), False, 'from controller import PS4Controller\n'), ((847, 864), 'gpio_controller.ServoController.ServoController', 'ServoController', ([], {}), '()\n', (862, 864), False, 'from gpio_controller.ServoController import ServoControl... |
#!/usr/bin/env python
from load import ROOT as R
from matplotlib import pyplot as plt
import numpy as N
from matplotlib.ticker import MaxNLocator
import gna.constructors as C
from gna.bindings import DataType
from gna.unittest import *
from gna import env
from gna import context
# @floatcopy(globals()) # uncomment af... | [
"gna.constructors.Histogram",
"numpy.arange",
"gna.constructors.HistEdgesLinear"
] | [((425, 450), 'numpy.arange', 'N.arange', (['size'], {'dtype': '"""d"""'}), "(size, dtype='d')\n", (433, 450), True, 'import numpy as N\n'), ((491, 510), 'gna.constructors.Histogram', 'C.Histogram', (['edges0'], {}), '(edges0)\n', (502, 510), True, 'import gna.constructors as C\n'), ((526, 558), 'gna.constructors.HistE... |
import numpy as np
import scipy.sparse as sp
from pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix import get2DMatrix, getBCHorizontal, \
get2DUpwindMatrix
def getBoussinesq2DUpwindMatrix(N, dx, u_adv, order):
Dx = get2DUpwindMatrix(N, dx, order)
# Note: In the equations it is u_... | [
"pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix.get2DUpwindMatrix",
"scipy.sparse.vstack",
"scipy.sparse.eye",
"pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix.get2DMatrix",
"pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix.getBCHori... | [((250, 281), 'pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix.get2DUpwindMatrix', 'get2DUpwindMatrix', (['N', 'dx', 'order'], {}), '(N, dx, order)\n', (267, 281), False, 'from pySDC.implementations.problem_classes.boussinesq_helpers.build2DFDMatrix import get2DMatrix, getBCHorizontal, get2DUpw... |
import pickle
import numpy as np
import pandas as pd
from src.src_vvCV_MDMP.vv_CV_MDMP import *
from South_Function.South_function_trainer import *
##
# Example for vv_CV_MDMP
def my_func_1(X):
return 1 + X+ X**2 + torch.sin(X * math.pi) * torch.exp(-1.* X.pow(2))
def my_func_2(X):
return 1.5 + X+ 1.5*(X**2... | [
"pandas.DataFrame",
"numpy.repeat"
] | [((4520, 4617), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'VV_cvest_funcidx_methodidx_f1', 'columns': "['cv_est', 'method_idx', 'setting']"}), "(data=VV_cvest_funcidx_methodidx_f1, columns=['cv_est',\n 'method_idx', 'setting'])\n", (4532, 4617), True, 'import pandas as pd\n'), ((4993, 5090), 'pandas.DataFram... |
#!/usr/bin/env python
from txros import util
from navigator_missions.navigator import Navigator
import numpy as np
from mil_tools import rosmsg_to_numpy
from twisted.internet import defer
from mil_misc_tools import ThrowingArgumentParser
from mil_msgs.srv import CameraToLidarTransform, CameraToLidarTransformRequest
fro... | [
"mil_msgs.srv.CameraToLidarTransformRequest",
"twisted.internet.defer.returnValue",
"mil_tools.rosmsg_to_numpy",
"numpy.append",
"geometry_msgs.msg.Point",
"mil_misc_tools.ThrowingArgumentParser",
"numpy.linalg.norm"
] | [((614, 759), 'mil_misc_tools.ThrowingArgumentParser', 'ThrowingArgumentParser', ([], {'description': '"""Dock"""', 'usage': '"""Default parameters: \'runtask Docking\n \'"""'}), '(description=\'Dock\', usage=\n """Default parameters: \'runtask Docking\n ... |
import time
from subprocess import call
import numpy as np
jID = {
"rhy": 0,
"rhr": 1,
"rhp": 2,
"rk": 3,
"rap": 4,
"rar": 5,
"lhy": 6,
"lhr": 7,
"lhp": 8,
"lk": 9,
"lap": 10,
"lar": 11,
"ty": 12,
"tp": 13,
"hy": 14,
"hp": 15,
"rsp": 16,
"rsr": 1... | [
"numpy.linalg.pinv",
"numpy.matrix",
"subprocess.call",
"time.sleep"
] | [((1313, 1328), 'time.sleep', 'time.sleep', (['(3.5)'], {}), '(3.5)\n', (1323, 1328), False, 'import time\n'), ((1841, 1862), 'time.sleep', 'time.sleep', (['(5.0 + 0.5)'], {}), '(5.0 + 0.5)\n', (1851, 1862), False, 'import time\n'), ((1909, 1924), 'time.sleep', 'time.sleep', (['(5.0)'], {}), '(5.0)\n', (1919, 1924), Fa... |
import unittest
import numpy as np
from timeeval import Algorithm, TrainingType
from timeeval.adapters import FunctionAdapter
class TestAlgorithm(unittest.TestCase):
def setUp(self) -> None:
self.data = np.random.rand(10)
self.unsupervised_algorithm = Algorithm(
name="TestAlgorithm"... | [
"timeeval.adapters.FunctionAdapter.identity",
"numpy.random.rand",
"numpy.testing.assert_array_equal"
] | [((220, 238), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (234, 238), True, 'import numpy as np\n'), ((914, 962), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['self.data', 'result'], {}), '(self.data, result)\n', (943, 962), True, 'import numpy as np\n'), ((1039, 1087), 'n... |
# Copying of array
"""
# Two types of copying method:
* shallow copy
* deep copy
"""
# importing packages
import numpy as np
print("Adding two Array:")
# adding two array
arr1 = np.array([1, 3, 5, 7, 9])
arr2 = np.array([2, 4, 6, 8, 10])
# adding two array
arr = arr1 + arr2
print(arr)
pri... | [
"numpy.array"
] | [((200, 225), 'numpy.array', 'np.array', (['[1, 3, 5, 7, 9]'], {}), '([1, 3, 5, 7, 9])\n', (208, 225), True, 'import numpy as np\n'), ((234, 260), 'numpy.array', 'np.array', (['[2, 4, 6, 8, 10]'], {}), '([2, 4, 6, 8, 10])\n', (242, 260), True, 'import numpy as np\n'), ((422, 447), 'numpy.array', 'np.array', (['[1, 2, 3... |
from jax.scipy.signal import convolve2d as conv2
import jax, jax.numpy as jnp
import tqdm
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib import gridspec
from .helpers import reconstruct, reconstruct_numpy, shift_factors, compute_loadings_percent_power, get_shapes, shifted_... | [
"numpy.sqrt",
"numpy.random.rand",
"jax.numpy.max",
"jax.numpy.power",
"numpy.array",
"numpy.argsort",
"numpy.arange",
"numpy.mean",
"jax.numpy.eye",
"seaborn.color_palette",
"jax.numpy.divide",
"matplotlib.pyplot.plot",
"numpy.max",
"matplotlib.gridspec.GridSpec",
"jax.numpy.diag",
"j... | [((474, 501), 'jax.numpy.where', 'jnp.where', (['(M == 0)', 'X_hat', 'X'], {}), '(M == 0, X_hat, X)\n', (483, 501), True, 'import jax, jax.numpy as jnp\n'), ((644, 675), 'jax.scipy.signal.convolve2d', 'conv2', (['X', 'smooth_kernel', '"""same"""'], {}), "(X, smooth_kernel, 'same')\n", (649, 675), True, 'from jax.scipy.... |
import matplotlib.pylab as plt
import numpy as np
import seaborn as sns
def tank(ts=120, liters=1000, litersIn=6, litersUit=6, concGroei=0.1):
c = 0
conc = [c:= c + (litersIn * concGroei / liters) - (litersUit / liters * c) for _ in range(ts + 1)]
return conc, np.arange(ts + 1)
def plot(ts, liters, lite... | [
"matplotlib.pylab.xlim",
"seaborn.set",
"matplotlib.pylab.tight_layout",
"matplotlib.pylab.legend",
"matplotlib.pylab.title",
"matplotlib.pylab.xlabel",
"seaborn.lineplot",
"matplotlib.pylab.show",
"matplotlib.pylab.ylim",
"numpy.arange",
"matplotlib.pylab.ylabel"
] | [((459, 486), 'seaborn.set', 'sns.set', ([], {'context': '"""notebook"""'}), "(context='notebook')\n", (466, 486), True, 'import seaborn as sns\n'), ((491, 579), 'seaborn.lineplot', 'sns.lineplot', (['tsArr', 'conc'], {'label': 'f"""In={litersIn} Uit={litersUit} Groei={concGroei}"""'}), "(tsArr, conc, label=\n f'In=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.