code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# This implementation is based on https://github.com/weihua916/powerful-gnns and https://github.com/chrsmrrs/k-gnn/tree/master/examples import os.path as osp import numpy as np import time import torch from torch import nn import torch.nn.functional as F from torch_geometric.datasets import TUDataset from torch_geometr...
[ "torch_geometric.data.dataloader.Collater", "numpy.random.seed", "torch.optim.lr_scheduler.StepLR", "torch_geometric.utils.degree", "torch.arange", "torch.no_grad", "torch.nn.functional.nll_loss", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch.nn.functional.relu", "torch_geometric....
[((9518, 9538), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (9535, 9538), False, 'import torch\n'), ((9543, 9560), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (9557, 9560), True, 'import numpy as np\n'), ((12878, 12901), 'torch.stack', 'torch.stack', (['acc'], {'dim': '(0)'}), '...
import numpy as np matrix = np.matrix( [[3, 6, 7], [2, 7, 9], [5, 8, 6]]) eigvals = np.linalg.eigvals(matrix) print(eigvals)
[ "numpy.matrix", "numpy.linalg.eigvals" ]
[((29, 73), 'numpy.matrix', 'np.matrix', (['[[3, 6, 7], [2, 7, 9], [5, 8, 6]]'], {}), '([[3, 6, 7], [2, 7, 9], [5, 8, 6]])\n', (38, 73), True, 'import numpy as np\n'), ((100, 125), 'numpy.linalg.eigvals', 'np.linalg.eigvals', (['matrix'], {}), '(matrix)\n', (117, 125), True, 'import numpy as np\n')]
import os import numpy as np import acpc_python_client as acpc from tools.game_tree.builder import GameTreeBuilder from tools.game_tree.node_provider import StrategyTreeNodeProvider from tools.walk_trees import walk_trees from tools.game_tree.nodes import HoleCardsNode, ActionNode, BoardCardsNode def _action_to_str...
[ "tools.game_tree.node_provider.StrategyTreeNodeProvider", "os.makedirs", "os.path.dirname", "os.path.exists", "acpc_python_client.read_game_file", "numpy.copyto", "tools.walk_trees.walk_trees" ]
[((1501, 1529), 'os.path.dirname', 'os.path.dirname', (['output_path'], {}), '(output_path)\n', (1516, 1529), False, 'import os\n'), ((2935, 2969), 'tools.walk_trees.walk_trees', 'walk_trees', (['on_node', 'strategy_tree'], {}), '(on_node, strategy_tree)\n', (2945, 2969), False, 'from tools.walk_trees import walk_trees...
import numpy as np from keras import layers from keras.utils.generic_utils import register_keras_serializable from keras.utils.tf_utils import shape_type_conversion from ...backbone import Backbone from ...backbone.utils import patch_config @register_keras_serializable(package='SegMe>FBAMatting') class Encoder(layers...
[ "numpy.zeros", "keras.utils.generic_utils.register_keras_serializable", "keras.layers.InputSpec" ]
[((244, 299), 'keras.utils.generic_utils.register_keras_serializable', 'register_keras_serializable', ([], {'package': '"""SegMe>FBAMatting"""'}), "(package='SegMe>FBAMatting')\n", (271, 299), False, 'from keras.utils.generic_utils import register_keras_serializable\n'), ((479, 537), 'keras.layers.InputSpec', 'layers.I...
__author__ = "<NAME>" #encoding="utf-8" # -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import matplotlib.pyplot as plt batch_size = 100 z_dim = 100 LABEL = 10 def montage(images): if isinstance(images, list): images = np.array(images) img_h = images.shape[1] img_w = images.sha...
[ "numpy.random.uniform", "matplotlib.pyplot.show", "tensorflow.train.import_meta_graph", "tensorflow.global_variables_initializer", "matplotlib.pyplot.imshow", "numpy.zeros", "tensorflow.Session", "matplotlib.pyplot.axis", "numpy.ones", "tensorflow.train.latest_checkpoint", "numpy.array", "tens...
[((836, 848), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (846, 848), True, 'import tensorflow as tf\n'), ((902, 955), 'tensorflow.train.import_meta_graph', 'tf.train.import_meta_graph', (['"""./mnist_cgan-60000.meta"""'], {}), "('./mnist_cgan-60000.meta')\n", (928, 955), True, 'import tensorflow as tf\n'), (...
import Stain_seperation.stain_Norm_Vahadane as Norm_Vahadane import cv2 import numpy as np import matplotlib.pyplot as plt from pandas import DataFrame def getImage(filepath): img_data = cv2.imread(filepath) img_data = cv2.cvtColor(img_data, cv2.COLOR_BGR2RGB) return img_data def Neg_area(img1_path, img...
[ "pandas.DataFrame", "matplotlib.pyplot.subplot", "Stain_seperation.stain_Norm_Vahadane.normalizer", "matplotlib.pyplot.show", "numpy.sum", "cv2.cvtColor", "cv2.imwrite", "matplotlib.pyplot.imshow", "numpy.asarray", "cv2.imread", "matplotlib.pyplot.figure" ]
[((193, 213), 'cv2.imread', 'cv2.imread', (['filepath'], {}), '(filepath)\n', (203, 213), False, 'import cv2\n'), ((229, 270), 'cv2.cvtColor', 'cv2.cvtColor', (['img_data', 'cv2.COLOR_BGR2RGB'], {}), '(img_data, cv2.COLOR_BGR2RGB)\n', (241, 270), False, 'import cv2\n'), ((479, 505), 'Stain_seperation.stain_Norm_Vahadan...
import pickle import random import time from datetime import datetime import matplotlib.pyplot as plt import gym from keras import Sequential from keras.layers import Dense, Lambda from tensorflow import keras import tensorflow as tf from tensorflow.keras import layers import numpy as np import inverted_pendulum cl...
[ "pickle.dump", "numpy.sum", "numpy.argmax", "random.sample", "numpy.mean", "tensorflow.keras.layers.concatenate", "tensorflow.keras.square", "tensorflow.keras.callbacks.EarlyStopping", "numpy.std", "tensorflow.keras.Input", "inverted_pendulum.PendulumEnv", "numpy.max", "tensorflow.keras.opti...
[((20757, 20788), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'sharex': '(True)'}), '(2, 1, sharex=True)\n', (20769, 20788), True, 'import matplotlib.pyplot as plt\n'), ((22121, 22131), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (22129, 22131), True, 'import matplotlib.pyplot as plt\n')...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from standard_program import run_standard_program, calculate_succes_program, training_program import timeit sns.set(font_scale=2.0) def wrapper(func, *args, **kwargs): def wrapped(): return func(*args, **kwargs) return wrapped h...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.arange", "timeit.timeit", "seaborn.set", "standard_program.run_standard_program" ]
[((182, 205), 'seaborn.set', 'sns.set', ([], {'font_scale': '(2.0)'}), '(font_scale=2.0)\n', (189, 205), True, 'import seaborn as sns\n'), ((374, 429), 'standard_program.run_standard_program', 'run_standard_program', (['hypercolumns', 'minicolumns', 'epochs'], {}), '(hypercolumns, minicolumns, epochs)\n', (394, 429), F...
#!/usr/bin/env python # encoding: utf-8 """ @Author: yangwenhao @Contact: <EMAIL> @Software: PyCharm @File: LossFunction.py @Time: 2020/1/8 3:46 PM @Overview: """ import torch import torch.nn as nn from geomloss import SamplesLoss import numpy as np class CenterLoss(nn.Module): """Center loss. Reference: ...
[ "torch.cat", "torch.randn", "torch.nn.CosineSimilarity", "torch.arange", "torch.nn.functional.sigmoid", "torch.nn.functional.normalize", "geomloss.SamplesLoss", "torch.exp", "torch.nn.functional.log_softmax", "torch.log", "torch.ge", "torch.nn.Parameter", "torch.mean", "torch.norm", "tor...
[((10666, 10700), 'torch.cat', 'torch.cat', (['[source, target]'], {'dim': '(0)'}), '([source, target], dim=0)\n', (10675, 10700), False, 'import torch\n'), ((710, 754), 'torch.randn', 'torch.randn', (['self.num_classes', 'self.feat_dim'], {}), '(self.num_classes, self.feat_dim)\n', (721, 754), False, 'import torch\n')...
# script to generate files for the curve shapes # each block of code generates one curve shape # neon typeface reference: (Thanks, Emil!) # http://fenotype.1001fonts.com/neon-fonts.html import pickle import os import math import pygame import numpy as np # general function to reset radian angle to [-pi, pi) def rese...
[ "pygame.draw.line", "pygame.draw.circle", "pygame.display.set_mode", "numpy.zeros", "pygame.init", "math.sin", "numpy.max", "pygame.display.update", "numpy.min", "numpy.array", "math.cos" ]
[((28316, 28329), 'pygame.init', 'pygame.init', ([], {}), '()\n', (28327, 28329), False, 'import pygame\n'), ((28385, 28411), 'numpy.max', 'np.max', (['node_poses'], {'axis': '(0)'}), '(node_poses, axis=0)\n', (28391, 28411), True, 'import numpy as np\n'), ((28427, 28453), 'numpy.min', 'np.min', (['node_poses'], {'axis...
from utils import * import numpy import matplotlib.pyplot as plt import os, os.path from scipy.constants import pi, hbar, e vf = 1.1e6 # Use C/m^2 def delta_phi_gr(sigma): fac = hbar * vf / e * numpy.sqrt(pi * numpy.abs(sigma) / e) return fac * numpy.sign(sigma) quantities = ("V", "c_p", "c_n", "zflux_cp", "...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.yscale", "numpy.abs", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.genfromtxt", "numpy.isnan", "matplotlib.pyplot.figure", "matplotlib.pyplot.style.use", "numpy.array", "numpy.arange", "numpy.linspace", ...
[((3268, 3298), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2.5, 2.5)'}), '(figsize=(2.5, 2.5))\n', (3278, 3298), True, 'import matplotlib.pyplot as plt\n'), ((1192, 1216), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""science"""'], {}), "('science')\n", (1205, 1216), True, 'import matplotlib.p...
# -*- coding: utf-8 -*- # Problem Set 5: Modeling Temperature Change # Name: <NAME> # Collaborators: # Time: 5:00 import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import r2_score import re # cities in our weather data CITIES = [ 'BOSTON', 'SEATTLE', 'SAN DIEGO', 'PHOENIX', '...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.polyfit", "numpy.polyval", "matplotlib.pyplot.legend", "sklearn.metrics.r2_score", "numpy.append", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((17104, 17121), 'numpy.array', 'np.array', (['y_daily'], {}), '(y_daily)\n', (17112, 17121), True, 'import numpy as np\n'), ((3724, 3746), 'numpy.array', 'np.array', (['temperatures'], {}), '(temperatures)\n', (3732, 3746), True, 'import numpy as np\n'), ((5734, 5758), 'numpy.array', 'np.array', (['annual_average'], ...
# Copyright (c) 2019, MD2K Center of Excellence # - <NAME> <<EMAIL>>, <NAME> <<EMAIL>> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above co...
[ "geopy.distance.great_circle", "shapely.geometry.multipoint.MultiPoint", "numpy.float64", "pyspark.sql.types.IntegerType", "numpy.unique", "sklearn.cluster.DBSCAN", "pandas.DataFrame", "pyspark.sql.types.DoubleType", "cerebralcortex.algorithms.utils.util.update_metadata", "math.radians", "pandas...
[((2302, 2347), 'pyspark.sql.functions.pandas_udf', 'pandas_udf', (['schema', 'PandasUDFType.GROUPED_MAP'], {}), '(schema, PandasUDFType.GROUPED_MAP)\n', (2312, 2347), False, 'from pyspark.sql.functions import pandas_udf, PandasUDFType\n'), ((3049, 3307), 'cerebralcortex.algorithms.utils.util.update_metadata', 'update_...
""" This module contains the TreePredictor class which is used for prediction. """ # Author: <NAME> import numpy as np from .common import Y_DTYPE from ._predictor import _predict_from_raw_data from ._predictor import _predict_from_binned_data from ._predictor import _compute_partial_dependence class T...
[ "numpy.empty" ]
[((2191, 2226), 'numpy.empty', 'np.empty', (['X.shape[0]'], {'dtype': 'Y_DTYPE'}), '(X.shape[0], dtype=Y_DTYPE)\n', (2199, 2226), True, 'import numpy as np\n'), ((3189, 3224), 'numpy.empty', 'np.empty', (['X.shape[0]'], {'dtype': 'Y_DTYPE'}), '(X.shape[0], dtype=Y_DTYPE)\n', (3197, 3224), True, 'import numpy as np\n')]
import numpy as np from ..utils_numpy import check_dtype, unpack def test_check_dtype(): dtype = check_dtype(None, "mean", np.arange(10, dtype=int), 10) assert np.issubdtype(dtype, np.floating) def test_unpack(): """Keep this test, in case unpack might get reimplemented again at some point.""" group...
[ "numpy.issubdtype", "numpy.max", "numpy.arange", "numpy.random.shuffle", "numpy.repeat" ]
[((170, 203), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.floating'], {}), '(dtype, np.floating)\n', (183, 203), True, 'import numpy as np\n'), ((327, 340), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (336, 340), True, 'import numpy as np\n'), ((345, 373), 'numpy.random.shuffle', 'np.random.shuffle',...
import numpy as np import matplotlib.pyplot as plt km = 59.26 # 阻塞密度 um = 28.56 # 最佳速度 def draw(): # 1 横坐表是流量,纵坐标是速度 # 2 横坐标是密度,纵坐标是速度 # 3 横坐标是密度,纵坐标是流量 u1 = np.arange(100) q1 = km * u1 * np.exp(-u1/um) plt.subplot(221) plt.plot(q1, u1) plt.xlabel("flow") plt.ylabel("speed") pl...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.plot", "numpy.arange", "numpy.exp", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((176, 190), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (185, 190), True, 'import numpy as np\n'), ((229, 245), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(221)'], {}), '(221)\n', (240, 245), True, 'import matplotlib.pyplot as plt\n'), ((250, 266), 'matplotlib.pyplot.plot', 'plt.plot', (['q1', 'u1'],...
#!/usr/bin/env python # coding: utf-8 # # Mask R-CNN - Train on Shapes Dataset # # # This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the net...
[ "sys.path.append", "mrcnn.model.load_image_gt", "numpy.asarray", "train_test.ShapesConfig", "mrcnn.model.MaskRCNN", "os.path.join", "os.listdir", "train_test.DrugDataset" ]
[((944, 1019), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs/shapes20190307T1102/mask_rcnn_shapes_0050.h5"""'], {}), "(ROOT_DIR, 'logs/shapes20190307T1102/mask_rcnn_shapes_0050.h5')\n", (956, 1019), False, 'import os\n'), ((1032, 1062), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"""'], {}), "(ROOT_D...
import torch import numpy as np import bisect IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif'] def has_file_allowed_extension(filename, extensions=IMG_EXTENSIONS): """Checks if a file is an allowed extension. Args: filename (string): path to a file extensions (iterab...
[ "bisect.bisect_right", "numpy.array" ]
[((3955, 4002), 'bisect.bisect_right', 'bisect.bisect_right', (['self.cumulative_sizes', 'idx'], {}), '(self.cumulative_sizes, idx)\n', (3974, 4002), False, 'import bisect\n'), ((1056, 1079), 'numpy.array', 'np.array', (['dataset[i][1]'], {}), '(dataset[i][1])\n', (1064, 1079), True, 'import numpy as np\n'), ((1809, 18...
import numpy as np def gradient_descent( derivative_fun, initial_guess, multiplier=0.01, precision=0.0001, max_iter=500 ): x = initial_guess x_list = [x] for n in range(1, max_iter): x = x - multiplier * derivative_fun(x) x_list.append(x) if abs(x-x_list[-2]) <...
[ "numpy.array" ]
[((529, 545), 'numpy.array', 'np.array', (['x_list'], {}), '(x_list)\n', (537, 545), True, 'import numpy as np\n')]
import sys import os import numpy as np import threading from crackclosuresim2 import crackopening_from_tensile_closure from crackclosuresim2 import load_closurestress from crackclosuresim2 import crack_model_normal_by_name from crackclosuresim2 import crack_model_shear_by_name from angled_friction_model.angled_fric...
[ "traceback.print_exc", "crackclosuresim2.crackopening_from_tensile_closure", "angled_friction_model.angled_friction_model.integrate_power", "numpy.zeros", "threading.Lock", "crackclosuresim2.load_closurestress", "numpy.array", "numpy.exp", "crackclosuresim2.crack_model_shear_by_name", "crackclosur...
[((7999, 8038), 'numpy.array', 'np.array', (["testgrid['log_mu']"], {'dtype': '"""d"""'}), "(testgrid['log_mu'], dtype='d')\n", (8007, 8038), True, 'import numpy as np\n'), ((8053, 8096), 'numpy.array', 'np.array', (["testgrid['log_msqrtR']"], {'dtype': '"""d"""'}), "(testgrid['log_msqrtR'], dtype='d')\n", (8061, 8096)...
# -------------------------------------------------------------------------- # # PACKAGES # # -------------------------------------------------------------------------- # import numpy as np import matplotlib.pyplot as plt import yaml import pandas as pd...
[ "matplotlib.pyplot.figure", "yaml.safe_load", "matplotlib.pyplot.gca", "numpy.zeros_like", "scipy.optimize.fsolve", "numpy.max", "matplotlib.pyplot.semilogy", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.subplo...
[((1812, 1850), 'numpy.zeros_like', 'np.zeros_like', (['self.planet.time_vector'], {}), '(self.planet.time_vector)\n', (1825, 1850), True, 'import numpy as np\n'), ((1874, 1912), 'numpy.zeros_like', 'np.zeros_like', (['self.planet.time_vector'], {}), '(self.planet.time_vector)\n', (1887, 1912), True, 'import numpy as n...
import collections import torch import os import pandas as pd import torch.nn as nn from tqdm import tqdm import numpy as np EPS = 1e-12 class AverageMeter(object): def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 ...
[ "torch.nn.MSELoss", "os.makedirs", "torch.cosh", "torch.load", "os.path.exists", "torch.empty", "torch.cat", "numpy.mean", "pandas.Series", "collections.OrderedDict", "torch.no_grad", "torch.isnan", "torch.tensor" ]
[((713, 738), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (736, 738), False, 'import collections\n'), ((1707, 1725), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (1723, 1725), False, 'import torch\n'), ((3565, 3583), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (358...
import os os.chdir(os.path.dirname(os.path.abspath(__file__))) import numpy as np import torch from skimage.metrics import peak_signal_noise_ratio from matplotlib.pyplot import imread, imsave from skimage.transform import resize import time import sys sys.path.append('../') from admm_utils import * from torch import...
[ "sys.path.append", "os.path.abspath", "os.makedirs", "torch.zeros_like", "torch.randn", "time.time", "torch.clamp", "torch.cuda.is_available", "matplotlib.pyplot.imsave", "skimage.transform.resize", "glob.glob", "numpy.savez", "matplotlib.pyplot.imread", "torch.tensor", "torch.from_numpy...
[((254, 276), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (269, 276), False, 'import sys\n'), ((3253, 3278), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3276, 3278), False, 'import torch\n'), ((3420, 3444), 'os.makedirs', 'os.makedirs', (['results_dir'], {}), '(r...
""" Copyright 2019 Samsung SDS 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...
[ "brightics.common.datasets.load_iris", "brightics.function.extraction.array_column_conversion.array_to_columns", "os.path.abspath", "brightics.function.extraction.array_column_conversion.columns_to_array", "HtmlTestRunner.HTMLTestRunner", "numpy.testing.assert_array_equal" ]
[((1066, 1077), 'brightics.common.datasets.load_iris', 'load_iris', ([], {}), '()\n', (1075, 1077), False, 'from brightics.common.datasets import load_iris\n'), ((1292, 1394), 'brightics.function.extraction.array_column_conversion.columns_to_array', 'columns_to_array', (['self.testdata'], {'input_cols': 'input_cols', '...
import logging import re import unittest from unittest.mock import MagicMock import numpy as np import pytest from smac.runhistory.runhistory import RunHistory from smac.tae.serial_runner import SerialRunner from autoPyTorch.api.base_task import BaseTask, _pipeline_predict from autoPyTorch.constants import TABULAR_...
[ "numpy.full", "autoPyTorch.api.base_task.BaseTask", "unittest.mock.MagicMock", "autoPyTorch.pipeline.tabular_classification.TabularClassificationPipeline", "smac.runhistory.runhistory.RunHistory", "unittest.mock.Mock", "numpy.zeros", "numpy.ones", "autoPyTorch.api.base_task._pipeline_predict", "nu...
[((465, 571), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fit_dictionary_tabular"""', "['classification_categorical_only']"], {'indirect': '(True)'}), "('fit_dictionary_tabular', [\n 'classification_categorical_only'], indirect=True)\n", (488, 571), False, 'import pytest\n'), ((3438, 3544), 'pytest.m...
# Copyright (c) 2021 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...
[ "paddlenlp.data.Pad", "argparse.ArgumentParser", "numpy.argmax", "paddle.enable_static", "paddlenlp.transformers.ErnieTinyTokenizer.from_pretrained", "numpy.array", "scipy.special.softmax", "paddle_serving_client.Client" ]
[((867, 892), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (890, 892), False, 'import argparse\n'), ((4310, 4318), 'paddle_serving_client.Client', 'Client', ([], {}), '()\n', (4316, 4318), False, 'from paddle_serving_client import Client\n'), ((4530, 4578), 'paddlenlp.transformers.ErnieTinyTo...
from pathlib import Path import pandas as pd import numpy as np from matplotlib import pyplot as plt from itertools import product from kornia.utils.one_hot import one_hot from utils.patch_utils import load_image, load_mask from sklearn.metrics import confusion_matrix, classification_report import torch def get_img_gt...
[ "torch.mean", "pandas.DataFrame", "numpy.empty_like", "sklearn.metrics.classification_report", "kornia.utils.one_hot.one_hot", "pathlib.Path", "numpy.array", "utils.patch_utils.load_image", "utils.patch_utils.load_mask", "numpy.arange", "sklearn.metrics.confusion_matrix", "torch.sum", "panda...
[((359, 384), 'pathlib.Path', 'Path', (['f"""./data/{subset}/"""'], {}), "(f'./data/{subset}/')\n", (363, 384), False, 'from pathlib import Path\n'), ((397, 427), 'pathlib.Path', 'Path', (['"""./results/predictions/"""'], {}), "('./results/predictions/')\n", (401, 427), False, 'from pathlib import Path\n'), ((1498, 151...
import pysmurf import matplotlib.pyplot as plt import scipy.signal as signal import numpy as np import os plt.ioff() config_file = '/usr/local/src/pysmurf/cfg_files/experiment_fp28_docker.cfg' S = pysmurf.SmurfControl(make_logfile=False,epics_root='test_epics2', cfg_file=config_file, offline=...
[ "pysmurf.SmurfControl", "scipy.signal.welch", "matplotlib.pyplot.ioff", "numpy.zeros", "numpy.where", "numpy.arange", "yaml.safe_load", "os.path.join", "numpy.sqrt" ]
[((107, 117), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (115, 117), True, 'import matplotlib.pyplot as plt\n'), ((199, 306), 'pysmurf.SmurfControl', 'pysmurf.SmurfControl', ([], {'make_logfile': '(False)', 'epics_root': '"""test_epics2"""', 'cfg_file': 'config_file', 'offline': '(True)'}), "(make_logfile=...
import numpy as np import matplotlib.pyplot as plt def generate_point_cloud(n:int, d:int = 2, seed=1234) -> np.ndarray: """Generates an array of d dimensional points in the range of [0, 1). The function generates n points. The result is stored in a n x d numpy array. Args: n (int): The number of dis...
[ "numpy.random.get_state", "numpy.random.rand", "numpy.random.seed", "numpy.random.set_state" ]
[((667, 688), 'numpy.random.get_state', 'np.random.get_state', ([], {}), '()\n', (686, 688), True, 'import numpy as np\n'), ((693, 713), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (707, 713), True, 'import numpy as np\n'), ((727, 747), 'numpy.random.rand', 'np.random.rand', (['n', 'd'], {}), '(n...
def test_custom_dr(): from dolo import yaml_import, simulate, time_iteration import numpy as np from dolo.numeric.decision_rule import CustomDR model = yaml_import("examples/models/rbc.yaml") values = {"n": "0.33 + z*0.01", "i": "delta*k-0.07*(k-9.35497829)"} edr = CustomDR(values, model) ...
[ "dolo.yaml_import", "numpy.array", "dolo.numeric.decision_rule.CustomDR", "dolo.time_iteration" ]
[((170, 209), 'dolo.yaml_import', 'yaml_import', (['"""examples/models/rbc.yaml"""'], {}), "('examples/models/rbc.yaml')\n", (181, 209), False, 'from dolo import yaml_import, simulate, time_iteration\n'), ((294, 317), 'dolo.numeric.decision_rule.CustomDR', 'CustomDR', (['values', 'model'], {}), '(values, model)\n', (30...
#!/usr/bin/env python # coding: utf-8 # # Analysis of a nonlinear and a linear version of a global carbon cycle model # # In this notebook we take the simple global carbon cycle model introduced by Rodhe and Björkström (1979). This model consists of the three compartments atmosphere (A), terrestrial biosphere (T), an...
[ "matplotlib.pyplot.title", "numpy.maximum", "sympy.Matrix", "matplotlib.pyplot.figure", "numpy.arange", "scipy.interpolate.interp1d", "numpy.sqrt", "os.path.exists", "numpy.loadtxt", "sympy.Function", "matplotlib.pyplot.show", "numpy.ones_like", "matplotlib.pyplot.ylim", "CompartmentalSyst...
[((3608, 3624), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (3616, 3624), True, 'import numpy as np\n'), ((4193, 4205), 'sympy.symbols', 'symbols', (['"""t"""'], {}), "('t')\n", (4200, 4205), False, 'from sympy import Matrix, symbols, Symbol, Function, latex\n'), ((4274, 4296), 'sympy.symbols', 'symbols'...
# -*- coding: utf-8 -*- import functools import os from collections import Counter from multiprocessing import Pool as ThreadPool from random import sample import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np import pandas as pd from apps.kemures.kernel.config.global_var import MAX_TH...
[ "pandas.DataFrame", "functools.partial", "matplotlib.ticker.MultipleLocator", "os.makedirs", "matplotlib.pyplot.hist", "matplotlib.pyplot.axes", "matplotlib.pyplot.close", "pandas.merge", "os.getcwd", "os.path.exists", "matplotlib.pyplot.figure", "multiprocessing.Pool", "numpy.array_split", ...
[((1311, 1402), 'pandas.merge', 'pd.merge', (['self.__song_msd_df', 'song_by_track_df'], {'how': '"""left"""', 'left_on': '"""id"""', 'right_on': '"""id"""'}), "(self.__song_msd_df, song_by_track_df, how='left', left_on='id',\n right_on='id')\n", (1319, 1402), True, 'import pandas as pd\n'), ((1452, 1549), 'pandas.m...
import seaborn as sb import numpy as np import osmnx as ox from geopy.distance import distance from matplotlib import pyplot as plt def evaluate_coverage_distance(df): sb.set_style("dark") f, axes = plt.subplots(2, 2, figsize=(12,8)) axes[0][0].title.set_text(f"Coverage of [2011-2015]: {len(df)} / 5000 = ...
[ "seaborn.set_style", "matplotlib.pyplot.show", "numpy.ones_like", "numpy.tril", "numpy.square", "osmnx.graph_from_place", "osmnx.plot.plot_graph", "seaborn.countplot", "osmnx.simplify_graph", "geopy.distance.distance", "matplotlib.pyplot.subplots" ]
[((174, 194), 'seaborn.set_style', 'sb.set_style', (['"""dark"""'], {}), "('dark')\n", (186, 194), True, 'import seaborn as sb\n'), ((209, 244), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(12, 8)'}), '(2, 2, figsize=(12, 8))\n', (221, 244), True, 'from matplotlib import pyplot as plt\n'...
import datetime import re import pytz import copy import numpy as np import matplotlib.pyplot as plt def get_timestamp(line_str): time_re = re.search(r"^\[2.*\] INFO", line_str) time_re = re.search(r"^\[2.*\]", time_re.group(0)) if time_re: time_str = time_re.group(0) date_time_obj = datetime.datetime.strptime...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "numpy.asarray", "datetime.datetime", "datetime.datetime.strptime", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "re.search", "matplotlib.pyplot.savefig" ]
[((142, 180), 're.search', 're.search', (['"""^\\\\[2.*\\\\] INFO"""', 'line_str'], {}), "('^\\\\[2.*\\\\] INFO', line_str)\n", (151, 180), False, 'import re\n'), ((733, 770), 're.search', 're.search', (['""".*Train: \\\\[.*"""', 'line_str'], {}), "('.*Train: \\\\[.*', line_str)\n", (742, 770), False, 'import re\n'), (...
import numpy as np import vaex def ensure_string_arguments(*args): result = [] for arg in args: result.append(vaex.utils._ensure_string_from_expression(arg)) return result class DataFrameAccessorMetrics(): '''Common metrics for evaluating machine learning tasks. This DataFrame Accessor...
[ "numpy.trace", "numpy.sum", "numpy.abs", "vaex.utils._ensure_string_from_expression", "numpy.dot", "numpy.diag", "numpy.sqrt" ]
[((9051, 9080), 'numpy.trace', 'np.trace', (['C'], {'dtype': 'np.float64'}), '(C, dtype=np.float64)\n', (9059, 9080), True, 'import numpy as np\n'), ((129, 175), 'vaex.utils._ensure_string_from_expression', 'vaex.utils._ensure_string_from_expression', (['arg'], {}), '(arg)\n', (170, 175), False, 'import vaex\n'), ((915...
"""Test NNDC data queries.""" import numpy as np import pandas as pd from becquerel.tools import nndc import pytest def ufloats_overlap_range(ufloats, vmin, vmax): """Return whether the +/- 1 sigma range overlaps the value range.""" vals = [] sigmas = [] for val in ufloats: if isinstance(val,...
[ "pandas.DataFrame", "pytest.raises", "numpy.isclose", "numpy.array", "becquerel.tools.nndc._parse_float_uncertainty", "becquerel.tools.nndc.WALLET_DECAY_MODE.items", "pytest.mark.skip", "becquerel.tools.nndc.DECAYRAD_RADIATION_TYPE.items" ]
[((494, 508), 'numpy.array', 'np.array', (['vals'], {}), '(vals)\n', (502, 508), True, 'import numpy as np\n'), ((522, 538), 'numpy.array', 'np.array', (['sigmas'], {}), '(sigmas)\n', (530, 538), True, 'import numpy as np\n'), ((25361, 25552), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '(\'query kwarg "dec...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Reads a .wav or other input file and writes out one or more mel or log spectrograms. For usage information, call with --help. Author: <NAME> and <NAME> """ import wave from itertools import izip, chain from optparse import OptionParser import numpy as np from filt...
[ "numpy.fft.rfft", "numpy.abs", "numpy.maximum", "optparse.OptionParser", "numpy.angle", "numpy.mean", "numpy.exp", "numpy.power", "numpy.empty_like", "numpy.linspace", "numpy.hanning", "numpy.log10", "numpy.log1p", "h5py.File", "numpy.save", "numpy.frombuffer", "subprocess.check_outp...
[((871, 896), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (883, 896), False, 'from optparse import OptionParser\n'), ((5895, 5912), 'wave.open', 'wave.open', (['infile'], {}), '(infile)\n', (5904, 5912), False, 'import wave\n'), ((6252, 6290), 'numpy.frombuffer', 'np.frombuffer...
#! /usr/bin/env python3 import numpy as np import note_utils as note import h5py import note_decompose as nde import scipy.signal as signal import adaptfilt as ada def wave2vol(data=None, spread=None, detect_type='peak'): """ convert AC audio into DC volume, do this by dicing up the audio and picking the peak or t...
[ "h5py.File", "numpy.abs", "numpy.ceil", "numpy.copy", "numpy.roll", "numpy.sum", "adaptfilt.nlms", "numpy.zeros", "numpy.greater", "numpy.append", "note_decompose.decompose", "numpy.repeat" ]
[((1675, 1700), 'numpy.repeat', 'np.repeat', (['volume', 'spread'], {}), '(volume, spread)\n', (1684, 1700), True, 'import numpy as np\n'), ((646, 662), 'numpy.copy', 'np.copy', (['fp[key]'], {}), '(fp[key])\n', (653, 662), True, 'import numpy as np\n'), ((698, 711), 'numpy.copy', 'np.copy', (['data'], {}), '(data)\n',...
import numpy as np import six def get_conv_outsize(size, k, s, p, cover_all=False, d=1): """Calculates output size of convolution. This function takes the size of input feature map, kernel, stride, and pooling of one particular dimension, then calculates the output feature map size of that dimension. ...
[ "numpy.pad", "six.moves.range", "numpy.zeros", "numpy.arange", "numpy.tile", "numpy.ndarray" ]
[((2399, 2413), 'numpy.tile', 'np.tile', (['i0', 'C'], {}), '(i0, C)\n', (2406, 2413), True, 'import numpy as np\n'), ((2983, 3043), 'numpy.pad', 'np.pad', (['x', '((0, 0), (0, 0), (p, p), (p, p))'], {'mode': '"""constant"""'}), "(x, ((0, 0), (0, 0), (p, p), (p, p)), mode='constant')\n", (2989, 3043), True, 'import num...
import numpy as np def find_continguous_regions(condition): """Finds contiguous True regions of the boolean array "condition". Returns a 2D array where the first column is the start index of the region and the second column is the end index. https://stackoverflow.com/questions/4494404/find-large-numb...
[ "numpy.diff" ]
[((449, 467), 'numpy.diff', 'np.diff', (['condition'], {}), '(condition)\n', (456, 467), True, 'import numpy as np\n')]
import numpy as np import tensorflow as tf slim = tf.contrib.slim DEFAULT_PADDING = 'SAME' # weight and bais wrappers def weight_variable(name, shape): """ Create a weight variable with appropriate initialization :param name: weight name :param shape: weight shape :return: initialized weight vari...
[ "tensorflow.split", "tensorflow.range", "tensorflow.nn.relu", "tensorflow.reshape", "tensorflow.nn.bias_add", "tensorflow.variable_scope", "tensorflow.constant", "tensorflow.nn.sigmoid", "tensorflow.concat", "tensorflow.matmul", "tensorflow.ones_like", "tensorflow.nn.conv2d", "tensorflow.sca...
[((346, 390), 'tensorflow.truncated_normal_initializer', 'tf.truncated_normal_initializer', ([], {'stddev': '(0.01)'}), '(stddev=0.01)\n', (377, 390), True, 'import tensorflow as tf\n'), ((402, 481), 'tensorflow.get_variable', 'tf.get_variable', (["('W_' + name)"], {'dtype': 'tf.float32', 'shape': 'shape', 'initializer...
import matplotlib.pyplot as plt import math as Math import numpy as np from itertools import islice def point_line_distance (p1, p2, p3): dy = p1[1]-p2[1] dx = p1[0]-p2[0] if (dy == 0): return abs(p1[1] - p3[1]) if (dx == 0): return abs(p1[0] - p3[0]) slope = dy/dx a = - slope b = 1 c = slop...
[ "matplotlib.pyplot.title", "math.atan", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "math.sqrt", "itertools.islice", "numpy.sign" ]
[((1168, 1210), 'math.sqrt', 'Math.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (1177, 1210), True, 'import math as Math\n'), ((1552, 1580), 'math.sqrt', 'Math.sqrt', (['(dx * dx + dy * dy)'], {}), '(dx * dx + dy * dy)\n', (1561, 1580), True, 'import math as Math\n'), ((310...
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
[ "pandas.DataFrame", "skimpy.viz.plotting.timetrace_plot", "pandas.read_csv", "skimpy.simulations.reactor.make_batch_reactor", "skimpy.viz.escher.plot_fluxes", "skimpy.io.yaml.load_yaml_model", "numpy.array", "skimpy.analysis.oracle.load_pytfa_solution.load_concentrations", "numpy.linspace", "skimp...
[((1725, 1766), 'skimpy.simulations.reactor.make_batch_reactor', 'make_batch_reactor', (['"""single_species.yaml"""'], {}), "('single_species.yaml')\n", (1743, 1766), False, 'from skimpy.simulations.reactor import make_batch_reactor\n'), ((1937, 1968), 'pytfa.io.json.load_json_model', 'load_json_model', (['path_to_tmod...
#!/usr/bin/env python """ Signal I/O classes ================== Classes for reading and writing numpy [1]_ arrays containing sampled or time-encoded signals from and to HDF5 files using PyTables [2]_. - ReadArray, WriteArray - I/O classes for basic types. - ReadSignal, WriteSignal ...
[ "atexit.register", "warnings.simplefilter", "tables.Atom.from_sctype", "numpy.zeros", "tables.openFile", "tables.StringCol", "warnings.write", "tables.FloatCol", "tables.Filters", "numpy.random.rand", "tempfile.mktemp", "numpy.all", "warnings.close" ]
[((1020, 1066), 'warnings.simplefilter', 'w.simplefilter', (['"""ignore"""', 't.NaturalNameWarning'], {}), "('ignore', t.NaturalNameWarning)\n", (1034, 1066), True, 'import warnings as w\n'), ((9358, 9380), 'tables.StringCol', 't.StringCol', (['(64)'], {'pos': '(1)'}), '(64, pos=1)\n', (9369, 9380), True, 'import table...
import logging import os import subprocess import time import warnings from functools import partial from typing import Union import numpy as np from PySide2 import QtCore, QtGui, QtWidgets from PySide2.QtCore import Signal, Slot from deepethogram.file_io import VideoReader # these define the parameters of the deepet...
[ "numpy.sum", "PySide2.QtGui.QColor", "numpy.ones", "numpy.arange", "PySide2.QtWidgets.QScrollBar", "numpy.tile", "PySide2.QtWidgets.QPushButton", "PySide2.QtGui.QPen", "PySide2.QtWidgets.QHBoxLayout", "PySide2.QtCore.Slot", "numpy.meshgrid", "deepethogram.file_io.VideoReader", "numpy.append"...
[((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((1364, 1375), 'PySide2.QtCore.Signal', 'Signal', (['int'], {}), '(int)\n', (1370, 1375), False, 'from PySide2.QtCore import Signal, Slot\n'), ((1394, 1405), 'PySide2.QtCore.Signal', 'Sign...
import sys import os import numpy as np import time from scipy.io import savemat from langevinfts import * # -------------- initialize ------------ # OpenMP environment variables os.environ["MKL_NUM_THREADS"] = "1" # always 1 os.environ["OMP_STACKSIZE"] = "1G" os.environ["OMP_MAX_ACTIVE_LEVELS"] = "2" ...
[ "numpy.std", "time.time", "numpy.cos", "sys.exit", "numpy.prod", "numpy.sqrt" ]
[((3575, 3586), 'time.time', 'time.time', ([], {}), '()\n', (3584, 3586), False, 'import time\n'), ((6544, 6556), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (6552, 6556), False, 'import sys\n'), ((5087, 5105), 'numpy.sqrt', 'np.sqrt', (['multi_dot'], {}), '(multi_dot)\n', (5094, 5105), True, 'import numpy as np\...
# Imports import numpy as np import matplotlib.pyplot as pl import matplotlib as mpl from ipywidgets import interact, widgets # Defining most constant values and calculations def base_ad(lv): return 58.376 + (lv-1) * 3.2 def raw_spell_dmg(base, ad_ratio = 0, ap_ratio = 0, ap = 0, ad = 0): return base + ad_rat...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "ipywidgets.widgets.FloatSlider", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.gca", "matplotlib.colors.hsv_to_rgb", "matplotlib.pyplot.ylabel", "numpy.asscalar", "matplotlib.pyplot.xlabel", ...
[((2495, 2518), 'numpy.linspace', 'np.linspace', (['(0)', '(600)', '(30)'], {}), '(0, 600, 30)\n', (2506, 2518), True, 'import numpy as np\n'), ((3138, 3164), 'matplotlib.pyplot.figure', 'pl.figure', ([], {'figsize': '(16, 9)'}), '(figsize=(16, 9))\n', (3147, 3164), True, 'import matplotlib.pyplot as pl\n'), ((3168, 31...
""" RHEAS module for retrieving maximum, minimum temperature and wind speed from the MERRA Reanalysis. .. module:: merra :synopsis: Retrieve MERRA meteorological data .. moduleauthor:: <NAME> <<EMAIL>> """ import netCDF4 as netcdf import numpy as np import os from datetime import timedelta import dbio import dat...
[ "datasets.dates", "netCDF4.Dataset", "os.remove", "numpy.amin", "dbio.writeGeotif", "numpy.zeros", "numpy.argsort", "dbio.ingest", "numpy.sort", "numpy.where", "datetime.timedelta", "numpy.amax", "numpy.mean", "numpy.sqrt", "logging.getLogger", "netCDF4.num2date" ]
[((372, 408), 'datasets.dates', 'datasets.dates', (['dbname', '"""wind.merra"""'], {}), "(dbname, 'wind.merra')\n", (386, 408), False, 'import datasets\n'), ((620, 647), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (637, 647), False, 'import logging\n'), ((752, 771), 'netCDF4.Dataset', ...
#!/usr/bin/env python3 import util import numpy as np import rospy import cv2 import message_filters from std_msgs.msg import UInt16 from sensor_msgs.msg import Image, CompressedImage, PointCloud2 import sensor_msgs.point_cloud2 as pc2 from geometry_msgs.msg import Point from visualization_msgs.msg import Marker from...
[ "cv_bridge.CvBridge", "rospy.Subscriber", "rospy.Publisher", "rospy.get_param", "bag_detection.msg.PathPos", "numpy.array", "rospy.init_node", "sensor_msgs.point_cloud2.read_points", "message_filters.Subscriber", "rospy.spin", "message_filters.TimeSynchronizer", "util.get_gtf" ]
[((476, 535), 'rospy.get_param', 'rospy.get_param', (['"""bag_path_detection/path_rgb_camera_topic"""'], {}), "('bag_path_detection/path_rgb_camera_topic')\n", (491, 535), False, 'import rospy\n'), ((565, 626), 'rospy.get_param', 'rospy.get_param', (['"""bag_path_detection/path_depth_camera_topic"""'], {}), "('bag_path...
# Class for reading and writing IM7 files # Stripped down version of <NAME>'s IM module https://bitbucket.org/fleming79/im/ import ReadIM import sys import os import numpy as np from re import findall def map_D(D, a, b, dtype): """Generic mapping from coordinates to pixel position using slope a intersect b ...
[ "sys.exc_info", "numpy.round", "ReadIM.BufferTypeAlt", "os.path.abspath", "ReadIM.get_Buffer_andAttributeList", "os.path.dirname", "numpy.logical_not", "re.findall", "os.path.basename", "ReadIM.DestroyAttributeListSafe", "ReadIM.extra.createBuffer", "ReadIM.extra.att2dict", "ReadIM.load_Attr...
[((554, 586), 'numpy.array', 'np.array', (['(d * a + b)'], {'dtype': 'dtype'}), '(d * a + b, dtype=dtype)\n', (562, 586), True, 'import numpy as np\n'), ((628, 660), 're.findall', 'findall', (['"""[0123456789.-]+"""', 'line'], {}), "('[0123456789.-]+', line)\n", (635, 660), False, 'from re import findall\n'), ((2449, 2...
import os import tensorflow as tf from tensorflow import keras from imutils import paths import cv2 import pickle from helpers import resize_to_fit import numpy as np from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split LETTER_IMAGES_FOLDER = 'extracted_letter_images' D...
[ "pickle.dump", "sklearn.preprocessing.LabelBinarizer", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Dense", "cv2.cvtColor", "sklearn.model_selection.train_test_split", "numpy.expand_dims", "cv2.imread", "numpy.array", "tensorflow.keras.optimi...
[((2378, 2394), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (2386, 2394), True, 'import numpy as np\n'), ((2493, 2555), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'labels'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(data, labels, test_size=0.25, random_state=0)\n',...
# -*- coding: utf-8 -*- """ Created on Sun Feb 24 13:43:26 2019 @author: <NAME> """ """ This script contains routines composing the pypStag Visualisation ToolKit """ from .stagError import * import numpy as np import h5py def im(textMessage,pName,verbose): """Print verbose internal message. This function depe...
[ "h5py.File", "numpy.uint8", "numpy.asarray", "numpy.zeros", "numpy.array", "numpy.int32", "scipy.spatial.ConvexHull" ]
[((2163, 2174), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2171, 2174), True, 'import numpy as np\n'), ((2187, 2198), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (2195, 2198), True, 'import numpy as np\n'), ((2211, 2222), 'numpy.array', 'np.array', (['z'], {}), '(z)\n', (2219, 2222), True, 'import numpy as ...
""" Copyright 2020 The OneFlow 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 applicable law or agr...
[ "unittest.main", "oneflow.compatible.single_client.experimental.model.TrainingConfig", "numpy.full", "tempfile.TemporaryDirectory", "oneflow.compatible.single_client.experimental.model.ValidationConfig", "numpy.sum", "numpy.random.randn", "numpy.allclose", "oneflow.compatible.single_client.experimen...
[((4839, 4854), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4852, 4854), False, 'import unittest\n'), ((998, 1027), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1025, 1027), False, 'import tempfile\n'), ((1083, 1104), 'numpy.random.randn', 'np.random.randn', (['(2)', '(3)'],...
from numpy.lib.ufunclike import isposinf from smac.env.multiagentenv import MultiAgentEnv import numpy as np import gym from gym.envs.registration import register from sys import stderr import numpy as np import matplotlib.pyplot as plt import os import datetime class ForagingEnv(MultiAgentEnv): def __init__(sel...
[ "numpy.sum", "numpy.random.seed", "gym.make", "numpy.concatenate", "os.makedirs", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.axis", "os.path.exists", "datetime.datetime.now", "matplotlib.pyplot.figure", "numpy.array", "os.path.join", "numpy.all" ]
[((873, 893), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (887, 893), True, 'import numpy as np\n'), ((955, 972), 'numpy.zeros', 'np.zeros', (['players'], {}), '(players)\n', (963, 972), True, 'import numpy as np\n'), ((1360, 1376), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (1368, 1...
""" Code to test working with xarray DataArrays that are too big to fit in RAM. Result: I was able to initialize an array with a scalar broadcast into several large dimensions, but it was slow used more than available RAM. Trying to subsequently do mat with the array was even slower. So this is not a solution. """ ...
[ "numpy.arange", "time.time" ]
[((470, 476), 'time.time', 'time', ([], {}), '()\n', (474, 476), False, 'from time import time\n'), ((511, 524), 'numpy.arange', 'np.arange', (['NT'], {}), '(NT)\n', (520, 524), True, 'import numpy as np\n'), ((531, 544), 'numpy.arange', 'np.arange', (['NR'], {}), '(NR)\n', (540, 544), True, 'import numpy as np\n'), ((...
"""Тестирование метрик.""" from types import SimpleNamespace import numpy as np import pandas as pd import pytest from poptimizer.portfolio import metrics, portfolio @pytest.fixture(scope="module", name="single") def make_metrics(): """Подготовка тестовых данных.""" positions = {"BSPB": 4890, "FESH": 1300, ...
[ "poptimizer.portfolio.portfolio.Portfolio", "poptimizer.portfolio.metrics.MetricsResample", "pytest.fixture", "numpy.array", "pytest.approx", "poptimizer.portfolio.metrics.MetricsSingle", "types.SimpleNamespace" ]
[((171, 216), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'name': '"""single"""'}), "(scope='module', name='single')\n", (185, 216), False, 'import pytest\n'), ((3276, 3323), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'name': '"""resample"""'}), "(scope='module', name='res...
from granger_causality import granger_causality import pandas as pd import numpy as np our_data = pd.read_csv("natural_data2.csv") our_data = our_data[np.where(our_data['Year']==1880)[0][0]:] print(granger_causality(our_data,['Ozone','WMGHG','Land_Use','Orbital'],'Temperature',lags=3,our_type='trend',list_subcausalit...
[ "pandas.read_csv", "granger_causality.granger_causality", "numpy.where" ]
[((99, 131), 'pandas.read_csv', 'pd.read_csv', (['"""natural_data2.csv"""'], {}), "('natural_data2.csv')\n", (110, 131), True, 'import pandas as pd\n'), ((200, 341), 'granger_causality.granger_causality', 'granger_causality', (['our_data', "['Ozone', 'WMGHG', 'Land_Use', 'Orbital']", '"""Temperature"""'], {'lags': '(3)...
## @ingroup Methods-Power-Battery-Sizing # initialize_from_energy_and_power.py # # Created: Feb 2015, <NAME> # Modified: Feb 2016, <NAME> # Feb 2016, <NAME> # Feb 2016, <NAME> # ---------------------------------------------------------------------- # Imports # -----------------------------------...
[ "numpy.maximum", "SUAVE.Methods.Utilities.soft_max.soft_max" ]
[((1417, 1450), 'SUAVE.Methods.Utilities.soft_max.soft_max', 'soft_max', (['energy_mass', 'power_mass'], {}), '(energy_mass, power_mass)\n', (1425, 1450), False, 'from SUAVE.Methods.Utilities.soft_max import soft_max\n'), ((1482, 1517), 'numpy.maximum', 'np.maximum', (['energy_mass', 'power_mass'], {}), '(energy_mass, ...
import os import numpy as np import json from io import BytesIO import time import argparse import requests from cli import DefaultArgumentParser from client import Client from s3client import ObjectStorageClient from zounds.persistence import DimensionEncoder, DimensionDecoder import zounds from mp3encoder import enc...
[ "zounds.SR44100", "cli.DefaultArgumentParser", "http.client.get_sounds", "json.dumps", "pathlib.Path", "mp3encoder.encode_mp3", "http.client.upsert_featurebot", "soundfile.info", "json.loads", "zounds.persistence.DimensionEncoder", "numpy.fromstring", "http.client.get_annotations", "zounds.p...
[((11034, 11083), 'client.Client', 'Client', (['args.annotate_api_endpoint'], {'logger': 'logger'}), '(args.annotate_api_endpoint, logger=logger)\n', (11040, 11083), False, 'from client import Client\n'), ((11113, 11280), 's3client.ObjectStorageClient', 'ObjectStorageClient', ([], {'endpoint': 'args.s3_endpoint', 'regi...
from typing import Callable import gin import numpy as np from cid.memory import EpisodicReplayMemory @gin.configurable(blacklist=['example', 'episode_len']) class HERReplayMemory(EpisodicReplayMemory): """Memory that implements hindsight experience replay""" def __init__(self, example, size, episode_len, ...
[ "numpy.random.randint", "gin.configurable" ]
[((107, 161), 'gin.configurable', 'gin.configurable', ([], {'blacklist': "['example', 'episode_len']"}), "(blacklist=['example', 'episode_len'])\n", (123, 161), False, 'import gin\n'), ((2156, 2222), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': 'self._current_size', 'size': 'batch_size'}), '...
import numpy as np def generate_data(degree, num_datapoints, noise, minimum, maximum): coef = np.random.random(degree+1) coef /= np.linalg.norm(coef) x = np.random.random(num_datapoints)*(maximum-minimum)+minimum y = np.power(x.reshape(-1,1), np.repeat(np.arange(degree+1).reshape(1,-1), num_datapoints,...
[ "numpy.random.random", "numpy.linalg.norm", "numpy.arange", "numpy.random.randn" ]
[((99, 127), 'numpy.random.random', 'np.random.random', (['(degree + 1)'], {}), '(degree + 1)\n', (115, 127), True, 'import numpy as np\n'), ((138, 158), 'numpy.linalg.norm', 'np.linalg.norm', (['coef'], {}), '(coef)\n', (152, 158), True, 'import numpy as np\n'), ((167, 199), 'numpy.random.random', 'np.random.random', ...
# -*- coding: utf-8 -*- """ Created on Tue Apr 12 11:41:50 2022 @author: s103567 """ import numpy as np import MDAnalysis.analysis.leaflet import MDAnalysis as mda import pytest import shocker.src.vesicle_data as vd from shocker.src.vesicle_data import VolArea def test_center_of_geometry(): ...
[ "MDAnalysis.Universe", "shocker.src.vesicle_data.center_of_geometry", "numpy.array", "shocker.src.vesicle_data.VolArea" ]
[((381, 420), 'numpy.array', 'np.array', (['[2.66666667, 2.33333333, 3.0]'], {}), '([2.66666667, 2.33333333, 3.0])\n', (389, 420), True, 'import numpy as np\n'), ((569, 616), 'MDAnalysis.Universe', 'mda.Universe', (['"""test_data/vesicle_data_test.gro"""'], {}), "('test_data/vesicle_data_test.gro')\n", (581, 616), True...
import os import sys import numpy import math from matplotlib import pyplot, cm subsets = ['train', 'test'] counter_ids = ['TN', 'FP', 'FN', 'TP'] if __name__ == '__main__': # title = 'not specified' filenames = list() to_png = False # i = 1 while i < len(sys.argv): if sys.argv[i...
[ "matplotlib.pyplot.show", "os.makedirs", "matplotlib.cm.get_cmap", "os.path.basename", "matplotlib.pyplot.axes", "matplotlib.cm.ScalarMappable", "numpy.zeros", "numpy.array", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.savefig" ]
[((2881, 2904), 'matplotlib.cm.get_cmap', 'cm.get_cmap', (['"""jet"""', '(100)'], {}), "('jet', 100)\n", (2892, 2904), False, 'from matplotlib import pyplot, cm\n'), ((4451, 4516), 'matplotlib.pyplot.subplots_adjust', 'pyplot.subplots_adjust', ([], {'bottom': '(0.0)', 'top': '(1.0)', 'left': '(0.05)', 'right': '(0.8)'}...
import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import math import seaborn as sns import collections mpl.use('TkAgg') sns.set() LOC_DICT = {2: 'upper left', 6: 'center left', 3: 'lower left', 9: 'upper center', 8: 'lower...
[ "matplotlib.pyplot.title", "seaborn.set_style", "seaborn.heatmap", "numpy.ndenumerate", "seaborn.barplot", "math.floor", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.arange", "numpy.column_stack", "collections.OrderedDict", "seaborn.set", "seaborn.set_context", "numpy.unique" ]
[((151, 167), 'matplotlib.use', 'mpl.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (158, 167), True, 'import matplotlib as mpl\n'), ((168, 177), 'seaborn.set', 'sns.set', ([], {}), '()\n', (175, 177), True, 'import seaborn as sns\n'), ((8184, 8210), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whit...
import os import gc import re import json import random import numpy as np import pandas as pd import scipy.io as sio from tqdm import tqdm import matplotlib.pyplot as plt from daisy.utils.data import incorporate_in_ml100k from scipy.sparse import csr_matrix from collections import defaultdict from IPython import embe...
[ "scipy.io.loadmat", "pandas.read_csv", "random.sample", "collections.defaultdict", "gc.collect", "os.path.join", "numpy.unique", "pandas.DataFrame", "json.loads", "os.path.exists", "numpy.insert", "numpy.max", "matplotlib.pyplot.subplots", "pandas.concat", "pandas.to_datetime", "os.lis...
[((603, 619), 'pandas.DataFrame', 'pd.DataFrame', (['[]'], {}), '([])\n', (615, 619), True, 'import pandas as pd\n'), ((633, 651), 'numpy.unique', 'np.unique', (['df.user'], {}), '(df.user)\n', (642, 651), True, 'import numpy as np\n'), ((1611, 1643), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(...
from .. import sanitize from .. import utils import numpy as np import pandas as pd import scipy.sparse as sp import warnings def _parse_header(header, n_expected, header_type="gene_names"): """Parse row or column names from a file. Parameters ---------- header : `str` filename, array-like or `None`...
[ "pandas.DataFrame", "pandas.read_csv", "scipy.sparse.issparse", "scipy.sparse.csr_matrix", "warnings.warn", "pandas.DataFrame.sparse.from_spmatrix", "numpy.unique" ]
[((3497, 3586), 'warnings.warn', 'warnings.warn', (['"""Duplicate gene names detected! Forcing dense matrix."""', 'RuntimeWarning'], {}), "('Duplicate gene names detected! Forcing dense matrix.',\n RuntimeWarning)\n", (3510, 3586), False, 'import warnings\n'), ((3736, 3915), 'warnings.warn', 'warnings.warn', (['"""D...
# Copyright 2022 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
[ "numpy.sum" ]
[((1945, 1961), 'numpy.sum', 'np.sum', (['bit_vals'], {}), '(bit_vals)\n', (1951, 1961), True, 'import numpy as np\n')]
from torchvision import datasets, transforms, models from torch import nn, optim, utils, device as device_, cuda import torch.nn.functional as F import numpy as np from sklearn import metrics import time dataset_train = datasets.MNIST( './data', train=True, download=True, transform=transforms.ToTens...
[ "torch.nn.Dropout", "torch.utils.data.DataLoader", "sklearn.metrics.accuracy_score", "torch.nn.Conv2d", "torch.nn.CrossEntropyLoss", "time.perf_counter", "numpy.mean", "torch.cuda.is_available", "torch.nn.Linear", "torch.nn.MaxPool2d", "torchvision.transforms.ToTensor" ]
[((468, 554), 'torch.utils.data.DataLoader', 'utils.data.DataLoader', (['dataset_train'], {'batch_size': '(1000)', 'shuffle': '(True)', 'num_workers': '(4)'}), '(dataset_train, batch_size=1000, shuffle=True,\n num_workers=4)\n', (489, 554), False, 'from torch import nn, optim, utils, device as device_, cuda\n'), ((6...
from pathlib import Path import logging import functools import numpy as np import pandas as pd from minisom import MiniSom from scipy.spatial.distance import cdist logger = logging.getLogger(__name__) class SOMCalculator: """ Interface for SOM Calculations. Interface to calculate SOM calculations ...
[ "pandas.DataFrame", "numpy.median", "numpy.argpartition", "numpy.array", "functools.lru_cache", "minisom.MiniSom", "logging.getLogger" ]
[((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((569, 614), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(128)', 'typed': '(False)'}), '(maxsize=128, typed=False)\n', (588, 614), False, 'import functools\n'), ((1272,...
from sunpy.net import jsoc from sunpy.net import Fido, attrs as a import sunpy.map from sunpy.time import parse_time import numpy as np from helicity_flux import helicity_energy __author__ = "<NAME>" __email__ = "<EMAIL>" ___status__ = "Production" def __main__(): """launch the computation of relative helicity fl...
[ "sunpy.net.attrs.jsoc.Notify", "sunpy.net.attrs.jsoc.Series", "sunpy.net.attrs.jsoc.Segment", "sunpy.net.jsoc.JSOCClient", "sunpy.net.attrs.jsoc.PrimeKey", "sunpy.net.attrs.Time", "numpy.array", "sunpy.time.parse_time", "helicity_flux.helicity_energy" ]
[((2794, 2855), 'helicity_flux.helicity_energy', 'helicity_energy', (['Br1', 'Bt1', 'Bp1', 'idx_t0', 'Br2', 'Bt2', 'Bp2', 'idx_t1'], {}), '(Br1, Bt1, Bp1, idx_t0, Br2, Bt2, Bp2, idx_t1)\n', (2809, 2855), False, 'from helicity_flux import helicity_energy\n'), ((434, 451), 'sunpy.net.jsoc.JSOCClient', 'jsoc.JSOCClient', ...
from BGA import BGA import numpy as np from matplotlib import pyplot as plt # define hyper-parameters pop_size = 60 dim = 30 num_gen = 200 mut_rate = 1/dim cross_rate = 0.9 construction = 2 problem = 2 num_runs = 30 # initialize the variables gen_best_values = np.zeros((num_runs, num_gen)) gen_avg_values = np.zeros...
[ "matplotlib.pyplot.plot", "numpy.median", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.max", "numpy.mean", "numpy.min", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "BGA.BGA" ]
[((265, 294), 'numpy.zeros', 'np.zeros', (['(num_runs, num_gen)'], {}), '((num_runs, num_gen))\n', (273, 294), True, 'import numpy as np\n'), ((312, 341), 'numpy.zeros', 'np.zeros', (['(num_runs, num_gen)'], {}), '((num_runs, num_gen))\n', (320, 341), True, 'import numpy as np\n'), ((356, 374), 'numpy.zeros', 'np.zeros...
''' Linear Regression using Normal Equation ''' import numpy as np X = 2 * np.random.rand(100, 1) y = 4 + 3 * X + np.random.randn(100,1) # Adding 1 to each instance of X X_b = np.c_[np.ones((100,1)), X] # Calculating the value of Theta that minimizes the cost function theta_best = np.linalg.inv(X_b.T.dot(X_b)).dot(...
[ "matplotlib.pyplot.show", "numpy.random.randn", "matplotlib.pyplot.axes", "numpy.ones", "sklearn.linear_model.LinearRegression", "numpy.array", "numpy.random.rand" ]
[((404, 424), 'numpy.array', 'np.array', (['[[0], [2]]'], {}), '([[0], [2]])\n', (412, 424), True, 'import numpy as np\n'), ((591, 601), 'matplotlib.pyplot.axes', 'plt.axes', ([], {}), '()\n', (599, 601), True, 'import matplotlib.pyplot as plt\n'), ((653, 663), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6...
# -*- coding: utf-8 -*- import numpy as np ar = np.array A = ar([[3, 0, 0, 0], [2, 1, 0, 0], [1, 5, 1, 0], [7, 9, 8, 4]]) b = ar([-9, 6, 2, 5]) bb= ar([b, b]).T b_p = b n = 4 for i in range(n): #xi = b[i] / A[i, i] xi = b_p[0] / A[i, i] print('x',i, '=', ...
[ "numpy.linalg.solve", "numpy.matmul" ]
[((642, 675), 'numpy.linalg.solve', 'np.linalg.solve', (['A[:n, :n]', 'b[:n]'], {}), '(A[:n, :n], b[:n])\n', (657, 675), True, 'import numpy as np\n'), ((826, 851), 'numpy.matmul', 'np.matmul', (['A[n:, :n]', 'X_1'], {}), '(A[n:, :n], X_1)\n', (835, 851), True, 'import numpy as np\n')]
#%% import json import colorsys from pathlib import Path import numpy as np from pprint import pprint from colour import Color import copy # %% s = json.loads( Path("/Users/chaichontat/Downloads/vscode-theme-darcula/themes/darculaori.json").read_text() ) ori = copy.deepcopy(s) out = "" def run(d): global o...
[ "colour.Color", "copy.deepcopy", "numpy.clip", "json.dumps", "pathlib.Path" ]
[((267, 283), 'copy.deepcopy', 'copy.deepcopy', (['s'], {}), '(s)\n', (280, 283), False, 'import copy\n'), ((1747, 1760), 'json.dumps', 'json.dumps', (['s'], {}), '(s)\n', (1757, 1760), False, 'import json\n'), ((1653, 1730), 'pathlib.Path', 'Path', (['"""/Users/chaichontat/Downloads/vscode-theme-darcula/themes/darcula...
# -*- coding: utf-8 -*- """ Created on Tue Mar 27 19:23:41 2018 @author: alber """ import os import glob import pandas as pd import re import numpy as np import pickle from nltk.corpus import stopwords from nltk.stem import SnowballStemmer from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.u...
[ "data_preprocessing.corpus_generation", "sklearn.ensemble.RandomForestClassifier", "data_preprocessing.word_vector", "pandas.DataFrame", "pickle.dump", "os.path.abspath", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "nltk.stem.SnowballStemmer", "sklearn.preprocessi...
[((1132, 1158), 'nltk.stem.SnowballStemmer', 'SnowballStemmer', (['"""english"""'], {}), "('english')\n", (1147, 1158), False, 'from nltk.stem import SnowballStemmer\n'), ((1217, 1238), 'data_preprocessing.obtain_train_corpus', 'obtain_train_corpus', ([], {}), '()\n', (1236, 1238), False, 'from data_preprocessing impor...
import time, datetime import numpy as np from pathline import Pathline #============================================================================== class Frontline(object): """ Frontline class calculate the frontline of a flow Attributes ---------- segment: numpy array of floats The or...
[ "numpy.array", "datetime.timedelta", "pathline.Pathline", "time.time" ]
[((1188, 1199), 'time.time', 'time.time', ([], {}), '()\n', (1197, 1199), False, 'import time, datetime\n'), ((1430, 1450), 'numpy.array', 'np.array', (['self.front'], {}), '(self.front)\n', (1438, 1450), True, 'import numpy as np\n'), ((1258, 1299), 'pathline.Pathline', 'Pathline', (['self.birth', 'self.lifetime', 'po...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 14 21:40:18 2021 @author: peter """ import numpy as np import matplotlib.pyplot as plt from pathlib import Path from vsd_cancer.functions import cancer_functions as canf import tifffile import pandas as pd import scipy.ndimage as ndimage impo...
[ "scipy.ndimage.binary_dilation", "numpy.sum", "pandas.read_csv", "scipy.ndimage.gaussian_filter", "numpy.zeros", "numpy.ones", "vsd_cancer.functions.cancer_functions.lab2masks", "numpy.percentile", "pathlib.Path", "numpy.where", "numpy.array", "tifffile.imread", "f.general_functions.to_8_bit...
[((432, 458), 'pathlib.Path', 'Path', (['figure_dir', '"""videos"""'], {}), "(figure_dir, 'videos')\n", (436, 458), False, 'from pathlib import Path\n'), ((1261, 1305), 'pathlib.Path', 'Path', (['save_dir', '"""ratio_stacks"""', 'trial_string'], {}), "(save_dir, 'ratio_stacks', trial_string)\n", (1265, 1305), False, 'f...
import os, sys import tensorflow as tf from PIL import Image import numpy as np from .DATA_HDR import * from .MODEL_HDR import * from .FUNCTION import * from .PREPROCESSING_HDR import * print(current_time() + ', exp = %s, load_model path = %s' % (FLAGS['num_exp_HDR'], os.path.dirname(os.path.abspath(__file__)))) os.e...
[ "numpy.pad", "tensorflow.image.resize_images", "os.remove", "os.path.abspath", "tensorflow.as_dtype", "tensorflow.compat.v1.variable_scope", "tensorflow.compat.v1.train.Saver", "PIL.Image.open", "tensorflow.compat.v1.local_variables_initializer", "tensorflow.compat.v1.Session", "tensorflow.place...
[((1331, 1396), 'tensorflow.compat.v1.train.Saver', 'tf.compat.v1.train.Saver', ([], {'var_list': 'netG.weights', 'max_to_keep': 'None'}), '(var_list=netG.weights, max_to_keep=None)\n', (1355, 1396), True, 'import tensorflow as tf\n'), ((1414, 1466), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], ...
# -*- coding: utf-8 -*- """ Decision Tree Classifier Class Module """ import numpy as np import math from auxiliary_functions import select_limiar class NODE: 'Class that implements the node structure for a Decision Tree' def __init__(self, depth=0, minSamplesNode=5, minPercentage=0.8, maxDepth=6): ...
[ "numpy.divide", "numpy.argmax", "numpy.zeros", "numpy.amax", "numpy.argsort", "auxiliary_functions.select_limiar", "numpy.arange" ]
[((848, 865), 'numpy.zeros', 'np.zeros', (['(Nc, 1)'], {}), '((Nc, 1))\n', (856, 865), True, 'import numpy as np\n'), ((1021, 1042), 'numpy.divide', 'np.divide', (['counter', 'N'], {}), '(counter, N)\n', (1030, 1042), True, 'import numpy as np\n'), ((1082, 1103), 'numpy.argmax', 'np.argmax', (['percentage'], {}), '(per...
import pytest import numpy as np import torch from torch import nn import torch_testing as tt from gym.spaces import Box from rlil.environments import State from rlil.policies import SoftDeterministicPolicy STATE_DIM = 2 ACTION_DIM = 3 @pytest.fixture def setUp(): torch.manual_seed(2) space = Box(np.array([-...
[ "torch.manual_seed", "torch.randn", "rlil.policies.SoftDeterministicPolicy", "numpy.array", "torch.nn.Linear" ]
[((272, 292), 'torch.manual_seed', 'torch.manual_seed', (['(2)'], {}), '(2)\n', (289, 292), False, 'import torch\n'), ((510, 558), 'rlil.policies.SoftDeterministicPolicy', 'SoftDeterministicPolicy', (['model', 'optimizer', 'space'], {}), '(model, optimizer, space)\n', (533, 558), False, 'from rlil.policies import SoftD...
""" General networks for pytorch. Algorithm-specific networks should go else-where. """ import numpy as np import torch from torch import nn as nn from torch.nn import functional as F from torchkit import pytorch_utils as ptu from torchkit.core import PyTorchModule from torchkit.modules import LayerNorm relu_name = ...
[ "torch.nn.Sequential", "torch.nn.Conv2d", "math.floor", "torch.cat", "torchkit.modules.LayerNorm", "torch.nn.Linear", "torch.reshape", "numpy.prod" ]
[((2956, 3032), 'math.floor', 'floor', (['((h_w[0] + 2 * pad - dilation * (kernel_size[0] - 1) - 1) / stride + 1)'], {}), '((h_w[0] + 2 * pad - dilation * (kernel_size[0] - 1) - 1) / stride + 1)\n', (2961, 3032), False, 'from math import floor\n'), ((3061, 3137), 'math.floor', 'floor', (['((h_w[1] + 2 * pad - dilation ...
import numpy as np from triplet import Point import matplotlib.pyplot as plt def plot_environment(env, snake=None, fig=None): fig = fig if fig else plt.figure() ax = fig.gca() points = np.array([[obs.x, obs.y, (2 * obs.radius) ** 2] for obs in env.obstacles]) axes = fig.add_subplot(111) ax.set_xlim...
[ "numpy.arctan2", "matplotlib.pyplot.plot", "numpy.arcsin", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "matplotlib.pyplot.Circle", "numpy.cos", "numpy.sign", "triplet.Point", "numpy.sqrt" ]
[((198, 272), 'numpy.array', 'np.array', (['[[obs.x, obs.y, (2 * obs.radius) ** 2] for obs in env.obstacles]'], {}), '([[obs.x, obs.y, (2 * obs.radius) ** 2] for obs in env.obstacles])\n', (206, 272), True, 'import numpy as np\n'), ((709, 735), 'numpy.sqrt', 'np.sqrt', (['(dx ** 2 + dy ** 2)'], {}), '(dx ** 2 + dy ** 2...
import json import pandas as pd import pickle as pkl import re, os, glob import numpy as np import re import sys from collections import defaultdict import nltk import string from gensim.models import Phrases from gensim.utils import SaveLoad from gensim.models.phrases import Phraser from nltk.corpus import stopwords ...
[ "gensim.utils.SaveLoad.load", "nltk.tokenize.RegexpTokenizer", "pickle.dump", "nltk.stem.PorterStemmer", "nltk.stem.WordNetLemmatizer", "json.loads", "pandas.read_csv", "timeit.default_timer", "nltk.corpus.wordnet.synsets", "pandas.read_pickle", "collections.defaultdict", "numpy.argsort", "n...
[((645, 660), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (658, 660), False, 'from nltk.stem import PorterStemmer, WordNetLemmatizer\n'), ((667, 686), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (684, 686), False, 'from nltk.stem import PorterStemmer, WordNetLemmatizer\n'), (...
import numpy as np from . import DiffAgentBase class DiffAgentSpeculative(DiffAgentBase.DiffAgentBase): def prediction(self, observation): self.diff = np.random.randint(0, self.space.spaces[2].n) def act(self, ob): self.current_prediction = (self.diff + ob) % self.space.spaces[2].n ...
[ "numpy.random.randint" ]
[((167, 211), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.space.spaces[2].n'], {}), '(0, self.space.spaces[2].n)\n', (184, 211), True, 'import numpy as np\n')]
import gc, logging, os import numpy as np from collections import Counter import tensorflow as tf from tensorflow.contrib import crf import util from basic_models import Model, CFG, dense class CWS(Model): cfg = Model.cfg.copy() cfg.emb_file = os.path.join(cfg.data_dir, 'w2v_100.txt') cfg.emb_dim = 100 ...
[ "tensorflow.get_collection", "tensorflow.reshape", "tensorflow.Variable", "numpy.arange", "os.path.join", "util.ngram_all", "tensorflow.add_n", "basic_models.dense", "basic_models.Model.cfg.copy", "tensorflow.concat", "tensorflow.variable_scope", "tensorflow.placeholder", "numpy.max", "col...
[((219, 235), 'basic_models.Model.cfg.copy', 'Model.cfg.copy', ([], {}), '()\n', (233, 235), False, 'from basic_models import Model, CFG, dense\n'), ((255, 296), 'os.path.join', 'os.path.join', (['cfg.data_dir', '"""w2v_100.txt"""'], {}), "(cfg.data_dir, 'w2v_100.txt')\n", (267, 296), False, 'import gc, logging, os\n')...
# -*- coding: utf-8 -*- import numpy as np from keras import backend as K from keras.layers import InputSpec, Layer, Dense, Convolution2D from keras import constraints from keras import initializations from ternary_ops import ternarize class Clip(constraints.Constraint): def __init__(self, min_val...
[ "keras.backend.dot", "ternary_ops.ternarize", "keras.backend.floatx", "keras.initializations.get", "keras.backend.clip", "numpy.sqrt" ]
[((659, 700), 'keras.backend.clip', 'K.clip', (['p', 'self.min_value', 'self.max_value'], {}), '(p, self.min_value, self.max_value)\n', (665, 700), True, 'from keras import backend as K\n'), ((2163, 2193), 'keras.initializations.get', 'initializations.get', (['"""uniform"""'], {}), "('uniform')\n", (2182, 2193), False,...
#!/usr/bin/env python # Cluster_Ensembles/src/Cluster_Ensembles/Cluster_Ensembles.py; # Author: <NAME> for the GC Yuan Lab # Affiliation: Harvard University # Contact: <EMAIL>, <EMAIL> """Cluster_Ensembles is a package for combining multiple partitions into a consolidated clustering. The combinatorial optimization...
[ "six.moves.range", "warnings.filterwarnings", "numpy.seterr", "metis.adjlist_to_metis", "numpy.empty", "numpy.asanyarray", "numpy.zeros", "numpy.ones", "numpy.isfinite", "gc.collect", "numpy.rint", "numpy.append", "numpy.where", "functools.reduce", "metis.part_graph" ]
[((1551, 1578), 'numpy.seterr', 'np.seterr', ([], {'invalid': '"""ignore"""'}), "(invalid='ignore')\n", (1560, 1578), True, 'import numpy as np\n'), ((1581, 1643), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (...
import aclabtools import numpy as np import pylab as pl choose = aclabtools.choose def bernstein(i, n, t): """ Returns the bernstein polynomial for i, n and t """ return choose(n, i) * (t ** i) * ((1 - t) ** (n - i)) def bezier(points): """ Returns bezier curve coordinates from points """ def b(t)...
[ "numpy.divide", "numpy.multiply", "numpy.empty", "numpy.array", "numpy.linspace", "numpy.add", "pylab.plot" ]
[((547, 563), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2))\n', (555, 563), True, 'import numpy as np\n'), ((577, 599), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(101)'], {}), '(0, 1, 101)\n', (588, 599), True, 'import numpy as np\n'), ((1145, 1161), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2...
import time import sys import os from os.path import join from datetime import datetime import numpy as np from scipy import spatial import math sys.path.append('../../../') import gsom.applications.video_highlights.static_features.data_parser as Parser import gsom.applications.video_highlights.static_features.reclu...
[ "sys.path.append", "gsom.util.kmeans_cluster_gsom.KMeansSOM", "scipy.spatial.distance.cosine", "math.exp", "os.makedirs", "gsom.core4.core_controller.Controller", "gsom.params.params.GeneraliseParameters", "os.path.exists", "time.time", "gsom.applications.video_highlights.static_features.data_pars...
[((146, 174), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (161, 174), False, 'import sys\n'), ((1906, 1936), 'os.path.join', 'join', (['"""output/"""', 'experiment_id'], {}), "('output/', experiment_id)\n", (1910, 1936), False, 'from os.path import join\n'), ((2351, 2387), 'os.pa...
# Copyright (c) 2021 Graphcore Ltd. All rights reserved. import numpy as np def check_loaded_weights(model, all_initial_weights): for layer, initial_weights in zip(model.layers, all_initial_weights): weights = layer.get_weights() print(f"Layer name {layer.name}") print(f"No. of weights in ...
[ "numpy.array_equal" ]
[((428, 466), 'numpy.array_equal', 'np.array_equal', (['weight', 'initial_weight'], {}), '(weight, initial_weight)\n', (442, 466), True, 'import numpy as np\n')]
import numpy as np from ._safpy import ffi, lib class AfSTFT(): """.""" def __init__(self, num_ch_in, num_ch_out, hopsize, fs, HYBRIDMODE=True, LOWDELAYMODE=False): """ Call Constructor. Parameters ---------- num_ch_in : TYPE DESCRIPTION....
[ "numpy.ascontiguousarray", "numpy.zeros", "numpy.ones", "numpy.atleast_2d" ]
[((2315, 2352), 'numpy.zeros', 'np.zeros', (['num_bands'], {'dtype': 'np.float32'}), '(num_bands, dtype=np.float32)\n', (2323, 2352), True, 'import numpy as np\n'), ((3236, 3262), 'numpy.atleast_2d', 'np.atleast_2d', (['in_frame_td'], {}), '(in_frame_td)\n', (3249, 3262), True, 'import numpy as np\n'), ((3285, 3336), '...
#----------------------------------------------------------------------------- #Copyright (c) 2018 <NAME>, <NAME>, <NAME> #danielhn<at>ece.ubc.ca #Permission to use, copy, and modify this software and its documentation is #hereby granted only under the following terms and conditions. Both the #above copyright notice an...
[ "sys.path.append", "subprocess.Popen", "numpy.load", "argparse.ArgumentParser", "os.getcwd", "numpy.square", "time.time", "processMif.getModelsimMem", "os.chdir" ]
[((1410, 1435), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (1425, 1435), False, 'import subprocess, os, time, sys\n'), ((1536, 1590), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""LeFlow Test Set"""'}), "(description='LeFlow Test Set')\n", (1559, 1590)...
""" =========================================== Semantic Image Segmentation on Pascal VOC =========================================== This example demonstrates learning a superpixel CRF for semantic image segmentation. To run the experiment, please download the pre-processed data from: http://www.ais.uni-bonn.de/deep_l...
[ "numpy.sum", "numpy.hstack", "pystruct.models.EdgeFeatureGraphCRF", "numpy.mean", "pystruct.utils.SaveLogger" ]
[((1275, 1426), 'pystruct.models.EdgeFeatureGraphCRF', 'crfs.EdgeFeatureGraphCRF', ([], {'inference_method': '"""qpbo"""', 'class_weight': 'class_weights', 'symmetric_edge_features': '[0, 1]', 'antisymmetric_edge_features': '[2]'}), "(inference_method='qpbo', class_weight=\n class_weights, symmetric_edge_features=[0...
import numpy as np import pandas as pd ENSEMBL_2_GENE_SYMBOLS = '/local/scratch/rv340/hugo/genes_ENSEMBL_to_official_gene.csv' def ENSEMBL_to_gene_symbols(ENSEMBL_symbols, file=ENSEMBL_2_GENE_SYMBOLS): def _ENSEMBL_to_gene_symbols(file): df = pd.read_csv(file, header=None) df.columns = ['ensemble...
[ "numpy.random.uniform", "numpy.random.binomial", "numpy.std", "pandas.read_csv", "numpy.unique", "numpy.argsort", "numpy.mean", "numpy.array", "numpy.concatenate" ]
[((971, 989), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (978, 989), True, 'import numpy as np\n'), ((1000, 1017), 'numpy.std', 'np.std', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (1006, 1017), True, 'import numpy as np\n'), ((1340, 1378), 'numpy.array', 'np.array', (['[s[::-1] for s in sampl_...
import math import numpy as np import rospy import config as config from strategy.strategy import Strategy from soccer_msgs.msg import GameState from robot import Robot HAVENT_SEEN_THE_BALL_TIMEOUT = 10 class DummyStrategy(Strategy): def __init__(self): self.havent_seen_the_ball_timeout = HAVENT_SEEN_TH...
[ "math.atan2", "config.position_map_goal", "math.sin", "rospy.loginfo", "numpy.linalg.norm", "math.cos" ]
[((508, 694), 'config.position_map_goal', 'config.position_map_goal', (['config.ENEMY_GOAL_POSITION', 'game_properties.team_color', 'game_properties.is_first_half', '(game_properties.secondary_state == GameState.STATE_PENALTYSHOOT)'], {}), '(config.ENEMY_GOAL_POSITION, game_properties.\n team_color, game_properties....
from collections import deque from itertools import islice import numpy as onp from .._base.errors import InsufficientCacheError, EpisodeDoneError from ._base import BaseRewardTracer from ._transition import TransitionBatch __all__ = ( 'NStep', ) class NStep(BaseRewardTracer): r""" A short-term cache ...
[ "numpy.power", "numpy.arange", "itertools.islice", "collections.deque" ]
[((1003, 1012), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (1008, 1012), False, 'from collections import deque\n'), ((1037, 1046), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (1042, 1046), False, 'from collections import deque\n'), ((1162, 1191), 'numpy.power', 'onp.power', (['self.gamma', 'self.n'...
# Copyright (C) 2020 GreenWaves Technologies, SAS # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This progr...
[ "logging.getLogger", "numpy.prod" ]
[((1029, 1068), 'logging.getLogger', 'logging.getLogger', (["('nntool.' + __name__)"], {}), "('nntool.' + __name__)\n", (1046, 1068), False, 'import logging\n'), ((9197, 9232), 'numpy.prod', 'np.prod', (['self.in_dims[1].shape[:-2]'], {}), '(self.in_dims[1].shape[:-2])\n', (9204, 9232), True, 'import numpy as np\n')]
import pytest from numpy import log, sqrt from investment_simulator import portfolios as ps from investment_simulator.portfolios import PortfolioResults, InvestmentResults @pytest.fixture def simulation_parameters_fixture(): return [0.5, 0.5], [0.1, 0.1], [[0.001, 0.0], [0.0, 0.001]] def test_monte_carlo(simul...
[ "investment_simulator.portfolios.growth_simulation", "numpy.log", "investment_simulator.portfolios.simulation_parameters", "pytest.approx", "numpy.sqrt" ]
[((375, 508), 'investment_simulator.portfolios.growth_simulation', 'ps.growth_simulation', (['simulation_parameters_fixture[0]', 'simulation_parameters_fixture[1]', 'simulation_parameters_fixture[2]', 'steps'], {}), '(simulation_parameters_fixture[0],\n simulation_parameters_fixture[1], simulation_parameters_fixture...
import numpy as np from typing import Final from fractions import Fraction """-------------------------------------- # Constants ! # -------------------------------------- # 1/Shape of Matrix ( Game strategies ) # Basically : 2x2 Game --------------------------------------""" DIM: Final = (2, 2) # Because we have ...
[ "fractions.Fraction", "numpy.dtype" ]
[((387, 405), 'numpy.dtype', 'np.dtype', (['int', 'int'], {}), '(int, int)\n', (395, 405), True, 'import numpy as np\n'), ((3397, 3408), 'fractions.Fraction', 'Fraction', (['p'], {}), '(p)\n', (3405, 3408), False, 'from fractions import Fraction\n'), ((3443, 3454), 'fractions.Fraction', 'Fraction', (['q'], {}), '(q)\n'...
from unittest import TestCase import trw.train import numpy as np import time import torch def make_volume_torch(batch): print('JOB starte', batch['path']) batch['volume'] = torch.zeros([1, 91, 110, 91], dtype=torch.float) time.sleep(2) return batch class TestSequenceReservoirPerformance(TestCase): ...
[ "torch.zeros", "numpy.asarray", "time.time", "time.sleep" ]
[((184, 232), 'torch.zeros', 'torch.zeros', (['[1, 91, 110, 91]'], {'dtype': 'torch.float'}), '([1, 91, 110, 91], dtype=torch.float)\n', (195, 232), False, 'import torch\n'), ((237, 250), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (247, 250), False, 'import time\n'), ((1154, 1165), 'time.time', 'time.time', ([...