code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
## Copyright 2020 UT-Battelle, LLC. See LICENSE.txt for more information. ### # @author <NAME>, <NAME>, <NAME>, <NAME> # <EMAIL> # # Modification: # Baseline code # Date: Apr, 2020 # ************************************************************************** ### import os import numpy as np ...
[ "numpy.append", "numpy.array", "argparse.ArgumentParser", "shlex.split" ]
[((1013, 1025), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1021, 1025), True, 'import numpy as np\n'), ((1053, 1065), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1061, 1065), True, 'import numpy as np\n'), ((1089, 1101), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1097, 1101), True, 'import num...
# 04_bin.py # 二值化: 将特征值转换为0或1两个值中的一个 import numpy as np import sklearn.preprocessing as sp raw_samples = np.array([[65.5, 89.0, 73.0], [55.0, 99.0, 98.5], [45.0, 22.5, 60.0]]) bin_samples = raw_samples.copy() # 复制数组 mask1 = bin_samples < 60 # 挑选出小于60的 mask2 = bin_sampl...
[ "sklearn.preprocessing.Binarizer", "numpy.array" ]
[((106, 176), 'numpy.array', 'np.array', (['[[65.5, 89.0, 73.0], [55.0, 99.0, 98.5], [45.0, 22.5, 60.0]]'], {}), '([[65.5, 89.0, 73.0], [55.0, 99.0, 98.5], [45.0, 22.5, 60.0]])\n', (114, 176), True, 'import numpy as np\n'), ((512, 538), 'sklearn.preprocessing.Binarizer', 'sp.Binarizer', ([], {'threshold': '(59)'}), '(t...
####Please do not remove lines below#### from lmfit import Parameters import numpy as np import sys import os import math sys.path.append(os.path.abspath('.')) sys.path.append(os.path.abspath('./Functions')) sys.path.append(os.path.abspath('./Fortran_routines/')) from functools import lru_cache ####Please do not remove...
[ "os.path.abspath", "numpy.sum", "math.sqrt", "numpy.append", "numpy.max", "numpy.diff", "numpy.array", "numpy.exp", "numpy.linspace", "functools.lru_cache", "lmfit.Parameters" ]
[((138, 158), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (153, 158), False, 'import os\n'), ((176, 206), 'os.path.abspath', 'os.path.abspath', (['"""./Functions"""'], {}), "('./Functions')\n", (191, 206), False, 'import os\n'), ((224, 262), 'os.path.abspath', 'os.path.abspath', (['"""./Fortran_...
""" Usage: crop_floorplan.py <src> <dst> [--padding=<padding>] [--low=<low_t>] [--high=<high_t>] [--show] Options: -h --help Show this screen """ import cv2 import numpy as np from docopt import docopt PADDING = 5 # this function crops images. It has the assumption that only the pixels with low_t or smaller ...
[ "docopt.docopt", "cv2.cvtColor", "cv2.imwrite", "cv2.waitKey", "cv2.imread", "numpy.where", "cv2.imshow" ]
[((1896, 1911), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1902, 1911), False, 'from docopt import docopt\n'), ((1985, 2006), 'cv2.imread', 'cv2.imread', (['floorplan'], {}), '(floorplan)\n', (1995, 2006), False, 'import cv2\n'), ((2368, 2394), 'cv2.imwrite', 'cv2.imwrite', (['dest', 'cropped'], {}),...
# ======================================================================== # # Imports # # ======================================================================== import os import re import numpy as np import numpy.testing as npt import matplotlib as mpl mpl.use("Agg") import matplotlib.pyplot as plt import pandas as...
[ "pandas.DataFrame", "unittest.main", "matplotlib.pyplot.loglog", "matplotlib.pyplot.tight_layout", "os.path.abspath", "numpy.log", "pandas.read_csv", "matplotlib.pyplot.close", "re.match", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.pyp...
[((257, 271), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (264, 271), True, 'import matplotlib as mpl\n'), ((2265, 2383), 'pandas.DataFrame', 'pd.DataFrame', (['lst'], {'columns': "['resolution', 'dx', 'rho_mms_err', 'u_mms_err', 'v_mms_err', 'w_mms_err',\n 'p_mms_err']"}), "(lst, columns=['resolu...
""" Defines the ArrayDataSource class.""" # Major library imports from numpy import array, isfinite, ones, ndarray import numpy as np # Enthought library imports from traits.api import Any, Constant, Int, Tuple # Chaco imports from .base import NumericalSequenceTrait, reverse_map_1d, SortOrderTrait from .abstract_da...
[ "numpy.nanargmin", "numpy.argmax", "traits.api.Constant", "numpy.isfinite", "numpy.argmin", "numpy.array", "numpy.nanargmax", "numpy.issubdtype" ]
[((871, 884), 'numpy.isfinite', 'isfinite', (['min'], {}), '(min)\n', (879, 884), False, 'from numpy import array, isfinite, ones, ndarray\n'), ((1319, 1332), 'numpy.isfinite', 'isfinite', (['max'], {}), '(max)\n', (1327, 1332), False, 'from numpy import array, isfinite, ones, ndarray\n'), ((1982, 2000), 'traits.api.Co...
# Copyright 2021-2 <NAME>. See LICENSE. # # Using metadata & panoramas pulled down from Google Street View in step 2, # this generates a voronoi diagram for each city. One point & panorama # corresponds to one poly in the diagram--unless out of bounds. City bounds # are pulled down from OSM and water is clipped out to ...
[ "textwrap.dedent", "shapely.affinity.affine_transform", "json.load", "shapely.ops.unary_union", "shapely.strtree.STRtree", "os.makedirs", "geovoronoi.coords_to_points", "imageio.imread", "numpy.zeros", "geovoronoi.points_to_coords", "numpy.mean", "osmnx.geometries_from_place", "pyproj.Transf...
[((940, 984), 'geopandas.read_file', 'gpd.read_file', (['"""land-polygons-complete-3857"""'], {}), "('land-polygons-complete-3857')\n", (953, 984), True, 'import geopandas as gpd\n'), ((996, 1027), 'shapely.strtree.STRtree', 'STRtree', (['land_polygons.geometry'], {}), '(land_polygons.geometry)\n', (1003, 1027), False,...
""" Basic character model. Stolen from keras: https://github.com/keras-team/keras/blob/master/examples/lstm_text_generation.py """ from __future__ import print_function from keras.callbacks import LambdaCallback from keras.callbacks import TensorBoard from keras.models import load_model from keras.models import Sequen...
[ "sys.stdout.write", "keras.models.load_model", "numpy.sum", "argparse.ArgumentParser", "numpy.argmax", "numpy.random.multinomial", "time.strftime", "keras.callbacks.LambdaCallback", "os.path.isfile", "sys.stdout.flush", "numpy.exp", "argparse.ArgumentTypeError", "numpy.asarray", "keras.cal...
[((806, 819), 'numpy.exp', 'np.exp', (['preds'], {}), '(preds)\n', (812, 819), True, 'import numpy as np\n'), ((875, 909), 'numpy.random.multinomial', 'np.random.multinomial', (['(1)', 'preds', '(1)'], {}), '(1, preds, 1)\n', (896, 909), True, 'import numpy as np\n'), ((921, 938), 'numpy.argmax', 'np.argmax', (['probas...
from MCTS import MCTS from MCTS2 import MCTS2 from NeuralNet import NeuralNet from Game import Game import numpy as np class NN(NeuralNet): def __init__(self,game:Game): self.game = game def predict(self, board): return np.ones(self.game.action_size())/self.game.action_size(), 0 class TestGame(Game): ...
[ "tictactoe.TicTacToeGame.TicTacToeGame", "MCTS.MCTS", "numpy.zeros", "timeit.default_timer" ]
[((1738, 1754), 'tictactoe.TicTacToeGame.TicTacToeGame', 'TicTacToeGame', (['(3)'], {}), '(3)\n', (1751, 1754), False, 'from tictactoe.TicTacToeGame import TicTacToeGame\n'), ((2484, 2507), 'MCTS.MCTS', 'MCTS', (['game', 'nn2', 'config'], {}), '(game, nn2, config)\n', (2488, 2507), False, 'from MCTS import MCTS\n'), ((...
# imports #region import os import pandas as pd import numpy as np import seaborn as sns import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from libs.utils import * from libs.plots import * from libs.extensions import * plt.ioff() #endregion # --- CHARTS GENERATION --- # Can I ge...
[ "seaborn.lineplot", "matplotlib.pyplot.ioff", "seaborn.scatterplot", "pandas.read_csv", "matplotlib.patches.Rectangle", "numpy.float_", "matplotlib.pyplot.text", "matplotlib.use", "numpy.linspace", "matplotlib.pyplot.subplots", "numpy.sqrt" ]
[((121, 135), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (128, 135), True, 'import matplotlib as mpl\n'), ((253, 263), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (261, 263), True, 'import matplotlib.pyplot as plt\n'), ((1010, 1053), 'pandas.read_csv', 'pd.read_csv', (['"""data\\\\data1....
""" A high-dimensional example on the "Energy Efficiency" UCI dataset: https://archive.ics.uci.edu/ml/datasets/Energy+efficiency. This is a regression test with (standardized) 8-dimensional input and 1-dimensional output. We use positive constraints: - For points where dimension X_3 is in the range [-2.0, -1.0], th...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "logging.basicConfig", "matplotlib.pyplot.legend", "data.uci.energyset", "logging.info", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib.pyplot.rc", "torch.Tensor", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabe...
[((768, 795), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 4)'}), '(figsize=(10, 4))\n', (778, 795), True, 'import matplotlib.pyplot as plt\n'), ((796, 850), 'matplotlib.pyplot.title', 'plt.title', (['"""Regression on X_3 (test set)"""'], {'fontsize': '(14)'}), "('Regression on X_3 (test set)', font...
import numpy as np def expand_columns(tokamak_data): init_cols = tokamak_data.columns for col in init_cols: if any(tokamak_data[col].isnull()) : continue if col.startswith("imp_") : for other_col in init_cols: if not other_col.startswith("tok_") : continue tokamak_data[f"_{col}_{oth...
[ "numpy.log10", "numpy.abs", "numpy.unique" ]
[((1523, 1548), 'numpy.abs', 'np.abs', (['tokamak_data[col]'], {}), '(tokamak_data[col])\n', (1529, 1548), True, 'import numpy as np\n'), ((784, 819), 'numpy.unique', 'np.unique', (['tokamak_data[col].values'], {}), '(tokamak_data[col].values)\n', (793, 819), True, 'import numpy as np\n'), ((1380, 1407), 'numpy.log10',...
#Multibody DYNAMICS CALCULATION #import necessary packages import numpy as np import pandas as pd # USEFUL FUNCTIONS def ATransformMatrix (theta): #A ATransform = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]]) return ATransform def ATransformMatrixT...
[ "pandas.DataFrame", "numpy.size", "numpy.zeros", "numpy.identity", "numpy.transpose", "numpy.sin", "numpy.array", "numpy.linalg.inv", "numpy.linalg.norm", "numpy.matmul", "numpy.cos" ]
[((805, 838), 'numpy.array', 'np.array', (['[[0], [0]]'], {'dtype': 'float'}), '([[0], [0]], dtype=float)\n', (813, 838), True, 'import numpy as np\n'), ((852, 900), 'numpy.array', 'np.array', (['[[-lengthLink2 / 2], [0]]'], {'dtype': 'float'}), '([[-lengthLink2 / 2], [0]], dtype=float)\n', (860, 900), True, 'import nu...
import numpy import pytest from fragile.core import Bounds from fragile.optimize import FunctionMapper from fragile.optimize.models import NormalContinuous @pytest.fixture(scope="class") def mapper(): def potential_well(x): return numpy.sum((x - 1) ** 2, 1) - 1 bounds = Bounds.from_tuples([(-10, 10)...
[ "numpy.sum", "fragile.optimize.models.NormalContinuous", "fragile.optimize.FunctionMapper.from_function", "pytest.fixture", "fragile.core.Bounds.from_tuples" ]
[((160, 189), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (174, 189), False, 'import pytest\n'), ((654, 683), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (668, 683), False, 'import pytest\n'), ((291, 331), 'fragile.core.Bounds.fro...
#!/usr/bin/env python import codecs import argparse import csv import random #from gensim.models.word2vec import Word2Vec from gensim.models.keyedvectors import KeyedVectors from collections import defaultdict import numpy as np from copy import deepcopy """ Arguments will be passed via a dictionary arg """ #parser...
[ "copy.deepcopy", "csv.reader", "codecs.open", "numpy.savez_compressed", "numpy.array", "random.seed" ]
[((1841, 1864), 'copy.deepcopy', 'deepcopy', (['orig_synonyms'], {}), '(orig_synonyms)\n', (1849, 1864), False, 'from copy import deepcopy\n'), ((689, 728), 'codecs.open', 'codecs.open', (['filename'], {'encoding': '"""utf-8"""'}), "(filename, encoding='utf-8')\n", (700, 728), False, 'import codecs\n'), ((752, 805), 'c...
from typing import List, Tuple import os import json import numpy as np import torch from PIL import Image DATA_DIR = 'data/Images/' NAMES_TO_IDS_FN = "data/names_to_ids.json" class IndoorDataset(torch.utils.data.Dataset): def __init__(self, file_names: List[str]): self.file_names = file_names ...
[ "numpy.load", "json.load", "numpy.save", "numpy.asarray", "os.path.exists", "PIL.Image.open", "torch.Tensor" ]
[((1393, 1414), 'torch.Tensor', 'torch.Tensor', (['feature'], {}), '(feature)\n', (1405, 1414), False, 'import torch\n'), ((515, 527), 'json.load', 'json.load', (['f'], {}), '(f)\n', (524, 527), False, 'import json\n'), ((934, 960), 'os.path.exists', 'os.path.exists', (['feature_fn'], {}), '(feature_fn)\n', (948, 960),...
############################################################################# # Copyright (C) 2020-2021 German Aerospace Center (DLR-SC) # # Authors: # # Contact: <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
[ "pandas.DataFrame", "unittest.main", "pandas.testing.assert_frame_equal", "numpy.array_equal", "numpy.zeros", "memilio.epidata.getPopulationData.get_population_data", "pandas.read_json", "memilio.epidata.getPopulationData.get_age_population_data", "unittest.mock.patch", "memilio.epidata.getPopulat...
[((1257, 1320), 'collections.namedtuple', 'namedtuple', (['"""Data"""', '"""filename item columns_wanted filename_out"""'], {}), "('Data', 'filename item columns_wanted filename_out')\n", (1267, 1320), False, 'from collections import namedtuple\n'), ((4417, 4434), 'numpy.zeros', 'np.zeros', (['(18, 2)'], {}), '((18, 2)...
import itertools from typing import Iterator, List import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np from bfgn.reporting import samples from bfgn.reporting.visualizations import subplots LABEL_CLASSIFICATION = "CLASSIFICATION" LABEL_REGRESSION = "REGRESSION" def plot_classif...
[ "matplotlib.pyplot.subplot", "numpy.ceil", "numpy.nanmax", "matplotlib.pyplot.legend", "numpy.nanmin", "numpy.histogram", "matplotlib.pyplot.figure", "numpy.array", "numpy.max", "numpy.min", "matplotlib.pyplot.ylabel", "matplotlib.gridspec.GridSpec", "numpy.round", "itertools.repeat" ]
[((1841, 1863), 'itertools.repeat', 'itertools.repeat', (['None'], {}), '(None)\n', (1857, 1863), False, 'import itertools\n'), ((11337, 11384), 'numpy.histogram', 'np.histogram', (['data'], {'bins': 'bins', 'range': 'hist_range'}), '(data, bins=bins, range=hist_range)\n', (11349, 11384), True, 'import numpy as np\n'),...
import json import os import albumentations as alb import numpy as np import pandas as pd import pytorch_lightning as pl import torch from albumentations.pytorch import ToTensorV2 from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import MultiLabelBinarizer from torch...
[ "pandas.DataFrame", "albumentations.pytorch.ToTensorV2", "albumentations.HorizontalFlip", "torch.utils.data.DataLoader", "albumentations.Resize", "pandas.read_csv", "sklearn.model_selection.train_test_split", "albumentations.SafeRotate", "transformers.BeitFeatureExtractor.from_pretrained", "sklear...
[((431, 519), 'transformers.BeitFeatureExtractor.from_pretrained', 'BeitFeatureExtractor.from_pretrained', (['"""microsoft/beit-base-patch16-224-pt22k-ft22k"""'], {}), "(\n 'microsoft/beit-base-patch16-224-pt22k-ft22k')\n", (467, 519), False, 'from transformers import BeitFeatureExtractor\n'), ((561, 584), 'pandas.r...
#! /usr/bin/env python """ Model based control for turtlebot with vanilla policy gradient in crib environment Navigate towards preset goal Author: LinZHanK (<EMAIL>) Inspired by: https://github.com/openai/spinningup/blob/master/spinup/examples/pg_math/1_simple_pg.py """ from __future__ import absolute_import, divi...
[ "tensorflow.one_hot", "gym.make", "tensorflow.global_variables_initializer", "tensorflow.nn.log_softmax", "tensorflow.layers.dense", "tensorflow.reduce_mean", "tensorflow.placeholder", "tensorflow.multinomial", "numpy.mean", "utils.obs_to_state", "rospy.init_node", "numpy.array", "tensorflow...
[((766, 831), 'tensorflow.layers.dense', 'tf.layers.dense', (['x'], {'units': 'sizes[-1]', 'activation': 'output_activation'}), '(x, units=sizes[-1], activation=output_activation)\n', (781, 831), True, 'import tensorflow as tf\n'), ((991, 1009), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (999, 1009), F...
import numpy as np import pandas as pd import math import scipy.spatial as ss import seaborn from functools import reduce import warnings from ..tools.utils import update_dict, flatten from ..vectorfield.utils import get_jacobian from ..dynamo_logger import main_info_insert_adata, main_info, main_warning from .utils i...
[ "numpy.sum", "numpy.abs", "numpy.argmax", "mpl_toolkits.axes_grid1.inset_locator.inset_axes", "numpy.exp", "scipy.spatial.cKDTree", "matplotlib.pyplot.tight_layout", "numpy.round", "numpy.unique", "pandas.DataFrame", "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.meshgrid", "w...
[((722, 734), 'pandas.Series', 'pd.Series', (['x'], {}), '(x)\n', (731, 734), True, 'import pandas as pd\n'), ((3991, 4004), 'numpy.unique', 'np.unique', (['gx'], {}), '(gx)\n', (4000, 4004), True, 'import numpy as np\n'), ((10242, 10262), 'numpy.unique', 'np.unique', (['pairs_mat'], {}), '(pairs_mat)\n', (10251, 10262...
# This file is part of the QuTIpy package. # https://github.com/sumeetkhatri/QuTIpy # # Copyright (c) 2022 <NAME>. # --.- ..- - .. .--. -.-- # # # SPDX-License-Identifier: AGPL-3.0 # # This program is free software: you can redistribute it and/or mod...
[ "qutipy.channels.generate_channel_isometry", "qutipy.channels.Choi_to_Natural", "qutipy.channels.completely_dephasing_channel", "numpy.round", "qutipy.channels.dephasing_channel", "qutipy.channels.Choi_representation", "qutipy.channels.Pauli_channel_coeffs", "qutipy.channels.channel_scalar_multiply", ...
[((1504, 1577), 'numpy.array', 'np.array', (['[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]'], {}), '([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])\n', (1512, 1577), True, 'import numpy as np\n'), ((1590, 1604), 'numpy.sqrt', 'np.sqrt', (['(1 / 2)'], {}), '(1 / 2)\n', (1597, 1604), ...
import math import numpy as np import pandas as pd from sklearn import preprocessing, cross_validation, svm from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from matplotlib import style import datetime from sklearn.preprocessing import LabelEncoder from sklearn.random_projection import ...
[ "sklearn.cross_validation.train_test_split", "pandas.read_csv", "numpy.std", "sklearn.preprocessing.LabelEncoder", "sklearn.ensemble.RandomForestRegressor", "sklearn.linear_model.LinearRegression", "numpy.argsort", "numpy.array" ]
[((1082, 1106), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (1093, 1106), True, 'import pandas as pd\n'), ((1117, 1140), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (1128, 1140), True, 'import pandas as pd\n'), ((1576, 1707), 'sklearn.ensemble.Random...
from __future__ import division import numpy as np np.set_printoptions(precision=6) import preprocessing class mnnb(object): def __init__(self, alpha=1.0): self.alpha = alpha def fit(self, X, y): y = preprocessing.label_ke_numerik(y) # Mengambil index Ham dan Spa...
[ "numpy.set_printoptions", "numpy.log", "numpy.unique", "numpy.where", "preprocessing.label_ke_numerik", "numpy.vstack" ]
[((53, 85), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(6)'}), '(precision=6)\n', (72, 85), True, 'import numpy as np\n'), ((246, 279), 'preprocessing.label_ke_numerik', 'preprocessing.label_ke_numerik', (['y'], {}), '(y)\n', (276, 279), False, 'import preprocessing\n'), ((386, 398), 'numpy.un...
import numpy as np import math from scipy.stats import entropy #------------------------------------------------------------------ def cosine(x, y): """ Compute the cosine similarity between two vectors x and y. """ x=normalize(x) y=normalize(y) return np.dot(x,y.T) #-----------------------------------------...
[ "numpy.sum", "numpy.log", "scipy.stats.entropy", "numpy.max", "numpy.linalg.norm", "numpy.exp", "numpy.dot", "numpy.sqrt" ]
[((264, 278), 'numpy.dot', 'np.dot', (['x', 'y.T'], {}), '(x, y.T)\n', (270, 278), True, 'import numpy as np\n'), ((421, 438), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {}), '(x)\n', (435, 438), True, 'import numpy as np\n'), ((1141, 1162), 'numpy.sqrt', 'np.sqrt', (['(2 * pi * var)'], {}), '(2 * pi * var)\n', (11...
import numpy as np import time from pyscf import gto, scf, fci """This module transforms AO integrals to MO basis Obtains RHF energy and MO coefficients from pyscf and calculates second order Moller Plesset energy Three SLOW implementations """ mol = gto.M( atom = [['H', (0, 0, 0)], ['H', (1, 0, 0)], ...
[ "numpy.zeros", "numpy.einsum", "time.clock", "pyscf.scf.hf.SCF", "pyscf.gto.M" ]
[((253, 404), 'pyscf.gto.M', 'gto.M', ([], {'atom': "[['H', (0, 0, 0)], ['H', (1, 0, 0)], ['H', (2, 0, 0)], ['H', (3, 0, 0)], [\n 'H', (4, 0, 0)], ['H', (5, 0, 0)]]", 'basis': '"""sto-3g"""', 'verbose': '(0)'}), "(atom=[['H', (0, 0, 0)], ['H', (1, 0, 0)], ['H', (2, 0, 0)], ['H', (3,\n 0, 0)], ['H', (4, 0, 0)], ['...
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # Startwerte S0, I0, R0 = 0.99,0.01, 0.0 # Annahmen zur Infektionsrate und zur Heilungsrate transm, recov = 3.2, 0.23 max_t = 20 #Zeit[Tage] # Flatten the Curve # transm, recov = 0.5, 0.14 # max_t = 50 def deriv(u, ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.integrate.odeint", "matplotlib.pyplot.legend", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((491, 524), 'numpy.linspace', 'np.linspace', (['(0)', 'max_t', '(10 * max_t)'], {}), '(0, max_t, 10 * max_t)\n', (502, 524), True, 'import numpy as np\n'), ((530, 572), 'scipy.integrate.odeint', 'odeint', (['deriv', 'y0', 'T'], {'args': '(transm, recov)'}), '(deriv, y0, T, args=(transm, recov))\n', (536, 572), False,...
import os import sys import serial import os import numpy as np import time import requests import datetime def thresholding_algo(y, lag, threshold, influence): signals = np.zeros(len(y)) # Build array of zeros to hold signals filteredY = np.array(y) # Insert current points in another array avgFilter = [0]...
[ "serial.Serial", "numpy.std", "numpy.asarray", "datetime.datetime.utcnow", "numpy.mean", "numpy.array" ]
[((248, 259), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (256, 259), True, 'import numpy as np\n'), ((380, 397), 'numpy.mean', 'np.mean', (['y[0:lag]'], {}), '(y[0:lag])\n', (387, 397), True, 'import numpy as np\n'), ((470, 486), 'numpy.std', 'np.std', (['y[0:lag]'], {}), '(y[0:lag])\n', (476, 486), True, 'import...
"""Pannable, zoomable graph area with axes and gridlines.""" from functools import partial import imgui import numpy as np from concur.extra_widgets.pan_zoom import PanZoom, pan_zoom import concur.draw as draw from concur.core import lift, orr, optional, map margins = [50, 10, -10, -20] class Frame(PanZoom): ...
[ "concur.draw.line", "functools.partial", "numpy.zeros_like", "numpy.ones_like", "numpy.ceil", "concur.core.optional", "concur.core.lift", "concur.draw.rect_filled", "concur.draw.rect", "numpy.matmul", "numpy.log10", "concur.core.orr" ]
[((1334, 1376), 'concur.draw.rect_filled', 'draw.rect_filled', (['*tf.view_s', '(1, 1, 1, 1)'], {}), '(*tf.view_s, (1, 1, 1, 1))\n', (1350, 1376), True, 'import concur.draw as draw\n'), ((3377, 3409), 'concur.core.orr', 'orr', (['(xtick_labels + ytick_labels)'], {}), '(xtick_labels + ytick_labels)\n', (3380, 3409), Fal...
"""Commonly used plot routines.""" from common.data_provider import DataProvider from common import transform_data from common import constants as cn from common_python.dataframe import util_dataframe from common_python.plots import util_plots as cup from common_python.statistics import util_statistics import matplot...
[ "common_python.statistics.util_statistics.calcLogSL", "matplotlib.pyplot.show", "common_python.plots.util_plots.plotTrinaryHeatmap", "seaborn.clustermap", "common_python.statistics.util_statistics.filterZeroVarianceRows", "sklearn.cluster.KMeans", "common.transform_data.makeTrinaryData", "numpy.isnan"...
[((2881, 2949), 'common_python.plots.util_plots.plotTrinaryHeatmap', 'cup.plotTrinaryHeatmap', (['df_plot'], {'ax': 'ax', 'is_plot': '(False)'}), '(df_plot, ax=ax, **plot_kwargs, is_plot=False)\n', (2903, 2949), True, 'from common_python.plots import util_plots as cup\n'), ((3472, 3548), 'common.transform_data.makeTrin...
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
[ "pandas.DataFrame", "numpy.full", "numpy.sum", "scipy.linalg.inv", "numpy.diag" ]
[((3896, 3910), 'numpy.sum', 'np.sum', (['n_jd_P'], {}), '(n_jd_P)\n', (3902, 3910), True, 'import numpy as np\n'), ((3946, 3968), 'numpy.sum', 'np.sum', (['n_ji_V'], {'axis': '(1)'}), '(n_ji_V, axis=1)\n', (3952, 3968), True, 'import numpy as np\n'), ((3982, 4004), 'numpy.sum', 'np.sum', (['n_ji_V'], {'axis': '(0)'}),...
#=============================================AI================================================== # Data Visualizable for Preliminary Testing # Sourced from https://matplotlib.org/index.html # Pie Chart from https://matplotlib.org/gallery/pie_and_polar_charts/pie_features.html#sphx-glr-gallery-pie-and-polar-charts-pie...
[ "matplotlib.pyplot.show", "csv.writer", "csv.reader", "pandas.read_csv", "numpy.asarray", "matplotlib.pyplot.subplots" ]
[((1678, 1692), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1690, 1692), True, 'import matplotlib.pyplot as plt\n'), ((2297, 2307), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2305, 2307), True, 'import matplotlib.pyplot as plt\n'), ((4035, 4068), 'pandas.read_csv', 'pd.read_csv', (['c...
"""Licensed under a 3-clause BSD style license - see LICENSE.rst. Make sure that the basic plots in imexamine are working as expected. """ import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_array_equal from imexam.imexamine import Imexamine try: import matplotlib.pypl...
[ "astropy.convolution.Gaussian2DKernel", "photutils.aperture_photometry", "photutils.CircularAperture", "matplotlib.pyplot.close", "packaging.version.parse", "numpy.testing.assert_array_equal", "numpy.zeros", "astropy.modeling.models.Gaussian2D", "imexam.imexamine.Imexamine", "numpy.argsort", "py...
[((640, 673), 'numpy.zeros', 'np.zeros', (['(100, 100)'], {'dtype': 'float'}), '((100, 100), dtype=float)\n', (648, 673), True, 'import numpy as np\n'), ((760, 800), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_MATPLOTLIB"""'], {}), "('not HAS_MATPLOTLIB')\n", (778, 800), False, 'import pytest\n'), ((1075,...
"""The module provides a class ``MonteCarlo`` which is an implementation of the Monte Carlo method and a class ``MonteCarloOpt`` which allows the user to perform a Monte Carlo run to find optimised financial portfolios, given an intial portfolio. """ import numpy as np import pandas as pd import matplotlib.pylab as p...
[ "pandas.DataFrame", "matplotlib.pylab.colorbar", "matplotlib.pylab.scatter", "matplotlib.pylab.legend", "numpy.sum", "numpy.asarray", "finquant.quants.annualised_portfolio_quantities", "numpy.random.random", "numpy.array", "matplotlib.pylab.title" ]
[((1173, 1191), 'numpy.asarray', 'np.asarray', (['result'], {}), '(result)\n', (1183, 1191), True, 'import numpy as np\n'), ((4626, 4733), 'finquant.quants.annualised_portfolio_quantities', 'annualised_portfolio_quantities', (['w', 'self.return_means', 'self.cov_matrix', 'self.risk_free_rate', 'self.freq'], {}), '(w, s...
"""Visualize numpy predictions overlayed on original images.""" import argparse from pathlib import Path import cv2 import numpy as np from natsort import natsorted, ns from PIL import Image from tqdm import tqdm from utils.misc import is_image_file from utils.vis import vis_mask from utils.colors import colormap d...
[ "moviepy.video.VideoClip.VideoClip", "numpy.load", "utils.colors.colormap", "utils.misc.is_image_file", "PIL.Image.fromarray", "numpy.unique" ]
[((1278, 1288), 'utils.colors.colormap', 'colormap', ([], {}), '()\n', (1286, 1288), False, 'from utils.colors import colormap\n'), ((1904, 1922), 'numpy.load', 'np.load', (['mask_path'], {}), '(mask_path)\n', (1911, 1922), True, 'import numpy as np\n'), ((2385, 2431), 'numpy.unique', 'np.unique', (['all_frames_mask'],...
import os.path import numpy as np import pandas as pd import gutils from gutils import get_raw_graph, block_sampling, parsebed import random def get_segment_count(cropped_header_length, patch_size): if cropped_header_length % patch_size != 0: return int(cropped_header_length / patch_size) + 1 else: ...
[ "gutils.get_raw_graph", "gutils.autofill_indicators", "gutils.block_sampling", "numpy.zeros", "gutils.parsebed", "pandas.concat" ]
[((581, 676), 'gutils.get_raw_graph', 'get_raw_graph', (['chrom_name', 'image_txt_dir', 'resolution', 'chrom_sizes_path'], {'filter_by_nan': '(False)'}), '(chrom_name, image_txt_dir, resolution, chrom_sizes_path,\n filter_by_nan=False)\n', (594, 676), False, 'from gutils import get_raw_graph, block_sampling, parsebe...
# Import all modules import numpy as np import tensorflow as tf # Learning rate schedule def lr_schedule(epoch): initial_learning_rate = 0.001 decay_per_epoch = 0.99 lrate = initial_learning_rate * (decay_per_epoch ** epoch) print(f"Learning rate = {lrate:.5f}") return lrate # Class fo...
[ "numpy.less", "numpy.random.randint" ]
[((911, 938), 'numpy.less', 'np.less', (['current', 'self.best'], {}), '(current, self.best)\n', (918, 938), True, 'import numpy as np\n'), ((1951, 1995), 'numpy.random.randint', 'np.random.randint', (['(50)', '(self.x.shape[1] - 100)'], {}), '(50, self.x.shape[1] - 100)\n', (1968, 1995), True, 'import numpy as np\n')]
""" .. _platonic_example: Platonic Solids ~~~~~~~~~~~~~~~ PyVista wraps the ``vtk.vtkPlatonicSolidSource`` filter as :func:`pyvista.PlatonicSolid`. """ import numpy as np import pyvista as pv from pyvista import examples ############################################################################### # We can either...
[ "pyvista.examples.download_teapot", "numpy.array", "pyvista.Plotter", "pyvista.PlatonicSolid" ]
[((1157, 1183), 'pyvista.examples.download_teapot', 'examples.download_teapot', ([], {}), '()\n', (1181, 1183), False, 'from pyvista import examples\n'), ((1751, 1787), 'pyvista.Plotter', 'pv.Plotter', ([], {'window_size': '[1000, 1000]'}), '(window_size=[1000, 1000])\n', (1761, 1787), True, 'import pyvista as pv\n'), ...
import re import time import argparse import os import cv2 import ogr import osr from osgeo import gdal import numpy as np import math from demo.test_gdal import imagexy2geo,geo2imagexy,geo2lonlat from shapely.geometry import Point,Polygon # 多边形 from tqdm import tqdm # import DOTA_devkit.polyiou as polyiou def readT...
[ "os.path.join", "shapely.geometry.Polygon", "ogr.GetDriverByName", "ogr.RegisterAll", "demo.test_gdal.imagexy2geo", "re.findall", "numpy.array", "osgeo.gdal.SetConfigOption", "osgeo.gdal.Open", "osgeo.gdal.GetDriverByName", "os.listdir", "demo.test_gdal.geo2lonlat" ]
[((348, 367), 'osgeo.gdal.Open', 'gdal.Open', (['fileName'], {}), '(fileName)\n', (357, 367), False, 'from osgeo import gdal\n'), ((743, 772), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""GTiff"""'], {}), "('GTiff')\n", (763, 772), False, 'from osgeo import gdal\n'), ((890, 942), 'osgeo.gdal.SetConfigOpt...
# coding=utf-8 # date: 2018/12/22, 13:48 # name: smz import numpy as np import matplotlib.pyplot as plt def generate_data(num_classes, sample_size, mean, cov, diffs, one_hot=True): """ 样本: 年龄 肿瘤大小 良性/恶性 args: sample_size: 样本的个数 mean: 同类样本中,一个样本不同维度的均值 cov: 同类样本中,一个样本不同纬度之间的协方...
[ "numpy.save", "numpy.random.seed", "matplotlib.pyplot.show", "numpy.random.shuffle", "numpy.random.randn", "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.expand_dims", "numpy.hstack", "matplotlib.pyplot.figure", "numpy.random.multivariate_normal", "numpy.eye", "numpy.concatenate" ]
[((655, 719), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mean', 'cov'], {'size': 'samples_per_class'}), '(mean, cov, size=samples_per_class)\n', (684, 719), True, 'import numpy as np\n'), ((729, 756), 'numpy.zeros', 'np.zeros', (['samples_per_class'], {}), '(samples_per_class)\n', (737, 756...
""" Test tighly focused beams by comparing the E/H field from two methods: (i) Directly integrating the far-field angular spectrum to obtain focal fields (ii) Using the expansion coefficients around the center of the beam """ import numpy as np import miepy import pytest nm = 1e-9 wav = 600*nm k = 2*np.pi/wav...
[ "miepy.sources.hermite_gaussian_beam", "miepy.vsh.expand_E", "numpy.meshgrid", "numpy.allclose", "miepy.sources.gaussian_beam", "miepy.sources.laguerre_gaussian_beam", "numpy.linspace", "miepy.coordinates.cart_to_sph", "miepy.vsh.expand_H", "miepy.sources.bigaussian_beam", "miepy.coordinates.vec...
[((365, 400), 'numpy.linspace', 'np.linspace', (['(-200 * nm)', '(200 * nm)', '(2)'], {}), '(-200 * nm, 200 * nm, 2)\n', (376, 400), True, 'import numpy as np\n'), ((401, 436), 'numpy.linspace', 'np.linspace', (['(-200 * nm)', '(200 * nm)', '(2)'], {}), '(-200 * nm, 200 * nm, 2)\n', (412, 436), True, 'import numpy as n...
from argparse import ArgumentParser import numpy as np from elasticai.creator.vhdl.precomputed_scalar_function import Tanh from elasticai.creator.vhdl.vhdl_formatter.vhdl_formatter import format_vhdl def main(): arg_parser = ArgumentParser() arg_parser.add_argument( "--file", help="filepath ...
[ "elasticai.creator.vhdl.vhdl_formatter.vhdl_formatter.format_vhdl", "argparse.ArgumentParser", "numpy.linspace" ]
[((233, 249), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (247, 249), False, 'from argparse import ArgumentParser\n'), ((653, 685), 'elasticai.creator.vhdl.vhdl_formatter.vhdl_formatter.format_vhdl', 'format_vhdl', ([], {'file_path': 'file_path'}), '(file_path=file_path)\n', (664, 685), False, 'from ...
import os import sys import h5py import keras import numpy as np from keras_metrics import precision, recall from keras.models import model_from_json from sklearn.metrics import accuracy_score, confusion_matrix, \ precision_score, recall_score sys.path.insert(1, os.path.join(sys.path[0], '..', '..', '..')) sys.path...
[ "keras.optimizers.Adadelta", "keras_metrics.recall", "numpy.argmax", "sklearn.metrics.accuracy_score", "numpy.expand_dims", "sklearn.metrics.recall_score", "features.helpers.data_helpers.get_test_data", "sklearn.metrics.precision_score", "features.helpers.data_helpers.plot_confusion_matrix", "skle...
[((1417, 1440), 'features.helpers.data_helpers.get_test_data', 'get_test_data', (['ML_MODEL'], {}), '(ML_MODEL)\n', (1430, 1440), False, 'from features.helpers.data_helpers import plot_confusion_matrix, get_test_data, write_acc_prec_recall_f1\n'), ((1692, 1722), 'numpy.expand_dims', 'np.expand_dims', (['x_test'], {'axi...
""" Hook for benchmarking models and logging average example times. """ import logging import numpy as np from typing import List from . import AbstractHook from ..types import TimeProfile class Benchmark(AbstractHook): """ Log mean and median example times via standard :py:mod:`logging`. .. code-block:...
[ "numpy.median", "numpy.mean" ]
[((1505, 1527), 'numpy.mean', 'np.mean', (['example_times'], {}), '(example_times)\n', (1512, 1527), True, 'import numpy as np\n'), ((1615, 1639), 'numpy.median', 'np.median', (['example_times'], {}), '(example_times)\n', (1624, 1639), True, 'import numpy as np\n')]
import numpy as np import unittest from abi.misc.dataset import Dataset class TestDataset(unittest.TestCase): def test_batches(self): obs = np.arange(3*2*1).reshape((3,2,1)) act = np.arange(3*2*1).reshape((3,2,1)) lengths = np.arange(3) dataset = Dataset(obs, act, lengths, batch_...
[ "unittest.main", "numpy.testing.assert_array_equal", "numpy.arange", "abi.misc.dataset.Dataset" ]
[((835, 850), 'unittest.main', 'unittest.main', ([], {}), '()\n', (848, 850), False, 'import unittest\n'), ((256, 268), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n', (265, 268), True, 'import numpy as np\n'), ((287, 342), 'abi.misc.dataset.Dataset', 'Dataset', (['obs', 'act', 'lengths'], {'batch_size': '(2)', 's...
from pymethylprocess.general_machine_learning import MachineLearning from pymethylprocess.MethylationDataTypes import MethylationArray, MethylationArrays from sklearn.svm import SVC from sklearn.metrics import accuracy_score, r2_score import pandas as pd, numpy as np import argparse import pickle from umap import UMAP ...
[ "argparse.ArgumentParser", "pymethylprocess.general_machine_learning.MachineLearning", "numpy.hstack", "umap.UMAP", "pymethylprocess.MethylationDataTypes.MethylationArray.from_pickle" ]
[((621, 643), 'umap.UMAP', 'UMAP', ([], {'n_components': '(100)'}), '(n_components=100)\n', (625, 643), False, 'from umap import UMAP\n'), ((1075, 1361), 'pymethylprocess.general_machine_learning.MachineLearning', 'MachineLearning', (['model'], {'options': "{'penalty': 'l2', 'verbose': 3, 'n_jobs': 35, 'class_weight': ...
import gym import matplotlib.pyplot as plt import numpy as np from gym import wrappers import pickle pos_space = np.linspace(-1.2, 0.6, 12) vel_space = np.linspace(-0.07, 0.07, 20) def get_state(observation): pos, vel = observation pos_bin = int(np.digitize(pos, pos_space)) vel_bin = int(np.digitize(vel,...
[ "gym.make", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.zeros", "numpy.random.random", "numpy.array", "numpy.linspace", "numpy.random.choice", "numpy.digitize", "matplotlib.pyplot.savefig" ]
[((114, 140), 'numpy.linspace', 'np.linspace', (['(-1.2)', '(0.6)', '(12)'], {}), '(-1.2, 0.6, 12)\n', (125, 140), True, 'import numpy as np\n'), ((153, 181), 'numpy.linspace', 'np.linspace', (['(-0.07)', '(0.07)', '(20)'], {}), '(-0.07, 0.07, 20)\n', (164, 181), True, 'import numpy as np\n'), ((423, 463), 'numpy.array...
#!/usr/bin/env python3 import sys, getopt import os import pandas as p import numpy as np import scipy.stats as ss import scipy as sp import scipy.misc as spm import math import argparse import pickle from numpy import array, log, exp from scipy.special import gammaln from scipy.optimize import minimize_scalar from ...
[ "argparse.ArgumentParser", "pandas.read_csv", "numpy.zeros", "numpy.ones", "numpy.argmin", "numpy.min", "numpy.mean", "numpy.where", "numpy.reshape", "numpy.delete", "sys.exit" ]
[((540, 563), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'bool'}), '(N, dtype=bool)\n', (548, 563), True, 'import numpy as np\n'), ((967, 999), 'numpy.zeros', 'np.zeros', (['(G1, G2)'], {'dtype': 'np.int'}), '((G1, G2), dtype=np.int)\n', (975, 999), True, 'import numpy as np\n'), ((1479, 1504), 'argparse.ArgumentPars...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Dec 1 16:30:36 2017 @author: yhsui """ from math import sqrt from numpy import concatenate import numpy as np from pandas import read_csv from pandas import DataFrame from pandas import concat from sklearn.preprocessing import MinMaxScaler from sklear...
[ "pandas.DataFrame", "numpy.random.seed", "numpy.abs", "pandas.read_csv", "keras.layers.LSTM", "sklearn.preprocessing.MinMaxScaler", "sklearn.preprocessing.LabelEncoder", "keras.layers.Dense", "numpy.array", "keras.models.Sequential", "pandas.concat", "numpy.concatenate", "sklearn.metrics.mea...
[((661, 676), 'pandas.DataFrame', 'DataFrame', (['data'], {}), '(data)\n', (670, 676), False, 'from pandas import DataFrame\n'), ((1127, 1147), 'pandas.concat', 'concat', (['cols'], {'axis': '(1)'}), '(cols, axis=1)\n', (1133, 1147), False, 'from pandas import concat\n'), ((1546, 1566), 'numpy.random.seed', 'np.random....
from concurrent import futures from datetime import datetime, timedelta import math import os from typing import Union import cartopy.feature import fiona.crs from matplotlib import pyplot, quiver import numpy import pyproj import scipy.interpolate import shapely.geometry import xarray from PyOFS import get_logger, u...
[ "numpy.sum", "math.atan2", "matplotlib.pyplot.axes", "numpy.empty", "numpy.ravel", "numpy.isnan", "numpy.sin", "numpy.arange", "numpy.nanmean", "numpy.meshgrid", "PyOFS.model.rtofs.RTOFSDataset", "numpy.cumsum", "numpy.max", "datetime.timedelta", "math.cos", "numpy.linspace", "concur...
[((339, 364), 'PyOFS.get_logger', 'get_logger', (['"""PyOFS.track"""'], {}), "('PyOFS.track')\n", (349, 364), False, 'from PyOFS import get_logger, utilities\n'), ((34137, 34190), 'numpy.sqrt', 'numpy.sqrt', (['(differences[0] ** 2 + differences[1] ** 2)'], {}), '(differences[0] ** 2 + differences[1] ** 2)\n', (34147, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pandas as pd import numpy as np import glob import csv import os # export options csv_tf = True #.csv, default csv_sep = '\t' db_tf = True #.sl3 sqlite3 db pickle_tf = True #.pkl pickle of pandas dataframe #hdf5_tf = True #.h5, not working json_tf = True #.json # ...
[ "json.load", "pandas.read_csv", "json.dumps", "numpy.where", "sqlite3.connect", "pandas.to_datetime", "glob.glob", "numpy.select", "pandas.concat", "pandas.to_numeric" ]
[((1719, 1764), 'numpy.select', 'np.select', (['conditions', 'choice'], {'default': 'df.sex'}), '(conditions, choice, default=df.sex)\n', (1728, 1764), True, 'import numpy as np\n'), ((1795, 1836), 'pandas.to_numeric', 'pd.to_numeric', (["df['age']"], {'errors': '"""coerce"""'}), "(df['age'], errors='coerce')\n", (1808...
#!/usr/bin/env python3 import numpy def read_array(nrows): return numpy.array([input().split() for _ in range(nrows)], int) n, m, _ = map(int, input().split()) # don't need p a = read_array(n) b = read_array(m) print(numpy.concatenate([a, b]))
[ "numpy.concatenate" ]
[((225, 250), 'numpy.concatenate', 'numpy.concatenate', (['[a, b]'], {}), '([a, b])\n', (242, 250), False, 'import numpy\n')]
# coding: utf-8 from scipy.linalg import solve_toeplitz from scipy.stats import norm import numpy as np class SDAR(object): def __init__(self, r=0.9, k=5): self.r = r self.k = k self.C = np.zeros(k+1) self.x = np.zeros(k+1) self.mu = 0.0 self.sigma = 0.0 def up...
[ "numpy.roll", "numpy.zeros", "scipy.stats.norm.pdf", "numpy.mean", "scipy.linalg.solve_toeplitz", "numpy.dot" ]
[((217, 232), 'numpy.zeros', 'np.zeros', (['(k + 1)'], {}), '(k + 1)\n', (225, 232), True, 'import numpy as np\n'), ((248, 263), 'numpy.zeros', 'np.zeros', (['(k + 1)'], {}), '(k + 1)\n', (256, 263), True, 'import numpy as np\n'), ((352, 370), 'numpy.roll', 'np.roll', (['self.x', '(1)'], {}), '(self.x, 1)\n', (359, 370...
import numpy as np from lstm_method import LstmParam, LstmNetwork class ToyLossLayer: """ Computes square loss with first element of hidden layer array. """ @classmethod def loss(self, pred, label): return (pred[0] - label) ** 2 @classmethod def bottom_diff(self, pred, label): ...
[ "lstm_method.LstmNetwork", "numpy.zeros_like", "numpy.random.seed", "numpy.random.random", "lstm_method.LstmParam" ]
[((494, 511), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (508, 511), True, 'import numpy as np\n'), ((629, 658), 'lstm_method.LstmParam', 'LstmParam', (['mem_cell_ct', 'x_dim'], {}), '(mem_cell_ct, x_dim)\n', (638, 658), False, 'from lstm_method import LstmParam, LstmNetwork\n'), ((674, 697), 'lstm_...
import imlib as im import numpy as np import pylib as py import tensorflow as tf import tf2lib as tl from skimage.metrics import peak_signal_noise_ratio as psnr from skimage.metrics import structural_similarity as ssim import data import module # ======================================================================...
[ "pylib.mkdir", "pylib.arg", "pylib.join", "pylib.args", "module.ResnetGenerator", "numpy.array", "skimage.metrics.structural_similarity", "data.make_dataset", "skimage.metrics.peak_signal_noise_ratio" ]
[((520, 618), 'pylib.arg', 'py.arg', (['"""--experiment_dir"""'], {'default': '"""/home/Alexandrite/smin/cycle_git/data/pre_output/0118/4"""'}), "('--experiment_dir', default=\n '/home/Alexandrite/smin/cycle_git/data/pre_output/0118/4')\n", (526, 618), True, 'import pylib as py\n'), ((614, 657), 'pylib.arg', 'py.arg...
import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import sys sys.path.append("../../sd") sys.path.append("../../sd_cartopy") import os import glob from netCDF4 import Dataset import numpy as np from scipy.interpolate import interp1d, interp2d from scipy import array import datetime as dt from py...
[ "pickle.dump", "numpy.abs", "numpy.sum", "matplotlib.pyplot.figure", "pickle.load", "numpy.arange", "glob.glob", "scipy.interpolate.interp1d", "matplotlib.colors.SymLogNorm", "sys.path.append", "netCDF4.Dataset", "nrlmsise00.msise_model", "numpy.meshgrid", "os.path.exists", "pysolar.sola...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((84, 111), 'sys.path.append', 'sys.path.append', (['"""../../sd"""'], {}), "('../../sd')\n", (99, 111), False, 'import sys\n'), ((112, 147), 'sys.path.append', 'sys.path.append', (['"""../../sd_ca...
from cv2 import filter2D as filter import numpy as np def sharpen(image): kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]]) print("Creating the new image...") newImage = filter(image, -1, kernel) return newImage
[ "numpy.array", "cv2.filter2D" ]
[((89, 136), 'numpy.array', 'np.array', (['[[0, -1, 0], [-1, 5, -1], [0, -1, 0]]'], {}), '([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])\n', (97, 136), True, 'import numpy as np\n'), ((189, 214), 'cv2.filter2D', 'filter', (['image', '(-1)', 'kernel'], {}), '(image, -1, kernel)\n', (195, 214), True, 'from cv2 import filter2D a...
import numpy as np def hard_pulse(a, b, b1): """Apply hard pulse rotation to input magnetization. Args: theta (complex float): complex B1 value in radian. Returns: array: magnetization array after hard pulse rotation, in representation consistent with input. """ c = ...
[ "numpy.abs", "numpy.array", "numpy.exp", "numpy.concatenate" ]
[((1248, 1272), 'numpy.concatenate', 'np.concatenate', (['(a, [0])'], {}), '((a, [0]))\n', (1262, 1272), True, 'import numpy as np\n'), ((1281, 1305), 'numpy.concatenate', 'np.concatenate', (['([0], b)'], {}), '(([0], b))\n', (1295, 1305), True, 'import numpy as np\n'), ((3184, 3196), 'numpy.array', 'np.array', (['b1']...
from __future__ import print_function import datetime import glob import json import multiprocessing import os import pickle import sys import warnings from string import digits import re import matplotlib.pyplot as plt import numpy as np import pandas as pd from dateutil import parser from gensim.models import KeyedV...
[ "matplotlib.pyplot.title", "nltk.tokenize.RegexpTokenizer", "sklearn.feature_extraction.text.CountVectorizer", "pickle.dump", "sklearn.preprocessing.StandardScaler", "numpy.logspace", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "sklearn.model_selection.cross_val_sco...
[((1325, 1347), 'seaborn.set', 'sns.set', ([], {'style': '"""ticks"""'}), "(style='ticks')\n", (1332, 1347), True, 'import seaborn as sns\n'), ((1548, 1610), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (1571, ...
#!/usr/bin/python # -*- coding:utf-8 -*- """ pos tagger for building a LSTM based pos tagging model. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import time import numpy as np import tensorflow as tf import o...
[ "tensorflow.reduce_sum", "tensorflow.trainable_variables", "tensorflow.reshape", "tensorflow.get_variable_scope", "tensorflow.matmul", "tensorflow.assign", "tensorflow.Variable", "tensorflow.global_variables", "numpy.exp", "os.path.join", "tensorflow.contrib.rnn.DropoutWrapper", "tensorflow.va...
[((4044, 4055), 'time.time', 'time.time', ([], {}), '()\n', (4053, 4055), False, 'import time\n'), ((5209, 5230), 'numpy.exp', 'np.exp', (['(costs / iters)'], {}), '(costs / iters)\n', (5215, 5230), True, 'import numpy as np\n'), ((739, 788), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[batch_size, num_s...
import pandas as pds import numpy as np def get_weights(serie, bins): a, b = np.histogram(serie, bins=bins) weights = 1/(a[1:]/np.sum(a[1:])) weights = np.insert(weights, 0,1) weights_Serie = pds.Series(index = serie.index, data=1) for i in range(1, bins): weights_Serie[(serie>b[i]) & (ser...
[ "numpy.histogram", "numpy.sum", "pandas.Series", "numpy.insert" ]
[((83, 113), 'numpy.histogram', 'np.histogram', (['serie'], {'bins': 'bins'}), '(serie, bins=bins)\n', (95, 113), True, 'import numpy as np\n'), ((166, 190), 'numpy.insert', 'np.insert', (['weights', '(0)', '(1)'], {}), '(weights, 0, 1)\n', (175, 190), True, 'import numpy as np\n'), ((210, 247), 'pandas.Series', 'pds.S...
""" Provides a Linear Operator for the Curvelet transform to interface with PyLops. """ import pyct as ct import numpy as np from pylops import LinearOperator from itertools import product def _fdct_docs(dimension): if dimension == 2: doc = "2D" elif dimension == 3: doc = "3D" else: ...
[ "numpy.dtype", "numpy.core.multiarray.normalize_axis_index", "numpy.zeros", "numpy.prod", "numpy.array", "numpy.issubdtype" ]
[((2668, 2683), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (2676, 2683), True, 'import numpy as np\n'), ((2695, 2735), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.complexfloating'], {}), '(dtype, np.complexfloating)\n', (2708, 2735), True, 'import numpy as np\n'), ((4333, 4374), 'numpy.zeros', 'np...
import sys sys.path.append('C:\PhD_Chalmers\Python\Lib\site-packages') ## adding directory import pandas as pd import numpy as np import matplotlib.pyplot as plt import datetime today = datetime.date.today() from m1_Class_Plants import pp_list,fuel_list,biomass from m2_demand_slices import q0_hr_slice,q0t,ava...
[ "matplotlib.pyplot.title", "m3_1_availability.fun_availability", "pandas.set_option", "sys.path.append", "pandas.DataFrame", "numpy.append", "numpy.reshape", "pandas.concat", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "m5_utilization.fun_pp_utilization", "m3_2_dispatch_order.fun_ran...
[((14, 77), 'sys.path.append', 'sys.path.append', (['"""C:\\\\PhD_Chalmers\\\\Python\\\\Lib\\\\site-packages"""'], {}), "('C:\\\\PhD_Chalmers\\\\Python\\\\Lib\\\\site-packages')\n", (29, 77), False, 'import sys\n'), ((194, 215), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (213, 215), False, 'import ...
"""CactusBladeElem module containing CactusBladeElem class.""" import numpy as np from common_utils import load_data, df_subset_time_index class CactusBladeElem(object): """Class to manage CACTUS blade element data. Attributes ---------- data : Pandas dataframe Raw blade element data. f...
[ "common_utils.df_subset_time_index", "common_utils.load_data", "numpy.zeros" ]
[((521, 545), 'common_utils.load_data', 'load_data', (['self.filename'], {}), '(self.filename)\n', (530, 545), False, 'from common_utils import load_data, df_subset_time_index\n'), ((1422, 1473), 'common_utils.df_subset_time_index', 'df_subset_time_index', (['df', 'time_index', 'time_col_name'], {}), '(df, time_index, ...
# Author: <NAME> # License: BSD-2-Clause import numpy as np from scipy import sparse from sklearn.utils.extmath import row_norms from sklearn.utils import check_random_state from ..dataset_fast import get_dataset from .loss_fast import Squared, SquaredHinge, Logistic, Hinge from ..random_feature.maji_berg import Sp...
[ "sklearn.utils.extmath.row_norms", "scipy.sparse.diags", "sklearn.utils.check_random_state", "numpy.zeros" ]
[((2868, 2902), 'sklearn.utils.extmath.row_norms', 'row_norms', (['X_trans.T'], {'squared': '(True)'}), '(X_trans.T, squared=True)\n', (2877, 2902), False, 'from sklearn.utils.extmath import row_norms\n'), ((3024, 3061), 'sklearn.utils.check_random_state', 'check_random_state', (['self.random_state'], {}), '(self.rando...
# -*- coding: utf-8 -*- import argparse as ap import numpy as np import pylab as pyl import kostka parser = ap.ArgumentParser() parser.add_argument("--number", "-n", type=int, default=100, help=u"Počet hodů kostkou") parser.add_argument("--pocetstran", type=int, default=6, help=u"Počet stran kostky") parser.add_arg...
[ "argparse.ArgumentParser", "kostka.Kostka", "numpy.zeros", "pylab.subplots", "numpy.arange" ]
[((112, 131), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {}), '()\n', (129, 131), True, 'import argparse as ap\n'), ((786, 806), 'numpy.zeros', 'np.zeros', (['pocetstran'], {}), '(pocetstran)\n', (794, 806), True, 'import numpy as np\n'), ((854, 885), 'kostka.Kostka', 'kostka.Kostka', (['pocetstran', 'vahy'],...
""" Heuristic algorithms to use as baseline. Only work as multi-agent, not central (would be the same anyways). """ import copy import random import numpy as np from shapely.geometry import Point from deepcomp.agent.base import MultiAgent class Heuristic3GPP(MultiAgent): """ Agent that is always connected t...
[ "shapely.geometry.Point", "numpy.argmax", "random.Random", "copy.copy", "numpy.mean" ]
[((1072, 1092), 'numpy.argmax', 'np.argmax', (["obs['dr']"], {}), "(obs['dr'])\n", (1081, 1092), True, 'import numpy as np\n'), ((4893, 4908), 'random.Random', 'random.Random', ([], {}), '()\n', (4906, 4908), False, 'import random\n'), ((5410, 5433), 'copy.copy', 'copy.copy', (['self.bs_list'], {}), '(self.bs_list)\n',...
""" logistic_regression_GD.py (author: <NAME> / git: ankonzoid) """ import os, random import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import log_loss def sigmoid(z): return 1.0 / (1.0 + np.exp(-z)) def split(fracs, N, seed): def is_intersect(arr1, arr2): ...
[ "matplotlib.pyplot.show", "numpy.abs", "random.uniform", "random.Random", "sklearn.metrics.log_loss", "numpy.zeros", "matplotlib.pyplot.figure", "random.seed", "numpy.array", "numpy.random.normal", "numpy.exp", "numpy.dot", "numpy.intersect1d" ]
[((645, 673), 'numpy.array', 'np.array', (['indices'], {'dtype': 'int'}), '(indices, dtype=int)\n', (653, 673), True, 'import numpy as np\n'), ((3877, 3892), 'random.seed', 'random.seed', (['(10)'], {}), '(10)\n', (3888, 3892), False, 'import os, random\n'), ((4535, 4566), 'sklearn.metrics.log_loss', 'log_loss', (['y_t...
import sqlite3 import time import datetime import random import marshal import numpy as np import matplotlib.pyplot as plt from PIL import Image def create_table(): conn = sqlite3.connect('Face_Database.db') c = conn.cursor() print("Connected to SQLite") c.execute("CREATE TABLE IF NOT EX...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.close", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "marshal.loads", "matplotlib.pyplot.axis", "PIL.Image.open", "marshal.dumps", "sqlite3.connect", "matplotlib.pyplot.xticks", "numpy.array", "matplotlib.pyplot.pie", "matplotlib.pyplot.y...
[((189, 224), 'sqlite3.connect', 'sqlite3.connect', (['"""Face_Database.db"""'], {}), "('Face_Database.db')\n", (204, 224), False, 'import sqlite3\n'), ((4596, 4634), 'matplotlib.pyplot.bar', 'plt.bar', (['x_pos', 'percent'], {'color': '"""green"""'}), "(x_pos, percent, color='green')\n", (4603, 4634), True, 'import ma...
import os, random, sys import numpy as np from diffpy.Structure import loadStructure, Structure, Lattice from diffpy.srreal.pdfcalculator import DebyePDFCalculator sys.path.append(os.getcwd()) random.seed(14) # 'Random' numbers class simPDFs_xyz: def __init__(self): # print("{} has been created.".forma...
[ "random.uniform", "os.getcwd", "diffpy.srreal.pdfcalculator.DebyePDFCalculator", "diffpy.Structure.loadStructure", "random.seed", "numpy.arange" ]
[((194, 209), 'random.seed', 'random.seed', (['(14)'], {}), '(14)\n', (205, 209), False, 'import os, random, sys\n'), ((181, 192), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (190, 192), False, 'import os, random, sys\n'), ((570, 613), 'numpy.arange', 'np.arange', (['self.rmin', 'self.rmax', 'self.rstep'], {}), '(self....
#!/usr/bin/env python """ # > Various modules for handling data # # Maintainer: Jahid (email: <EMAIL>) # Interactive Robotics and Vision Lab (http://irvlab.cs.umn.edu/) # Any part of this repo can be used for academic and educational purposes only """ from __future__ import division from __future__ import absolute_imp...
[ "numpy.asarray", "os.walk", "os.path.exists", "numpy.flipud", "random.random", "numpy.fliplr", "numpy.array", "numpy.arange", "scipy.misc.imresize", "os.path.join", "fnmatch.fnmatch", "scipy.misc.imread" ]
[((662, 677), 'random.random', 'random.random', ([], {}), '()\n', (675, 677), False, 'import random\n'), ((1364, 1387), 'numpy.asarray', 'np.asarray', (['image_paths'], {}), '(image_paths)\n', (1374, 1387), True, 'import numpy as np\n'), ((1494, 1521), 'scipy.misc.imresize', 'misc.imresize', (['img', 'img_res'], {}), '...
import paddle import paddle.nn as nn import numpy as np class MetricsCalculator(object): def __init__(self): super().__init__() def get_sample_f1(self, y_pred, y_true): y_pred = paddle.greater_than(y_pred, paddle.to_tensor(0.)).cast('int64') return 2. * paddle.sum(y_true * y_pred) / p...
[ "paddle.einsum", "paddle.sum", "paddle.to_tensor", "paddle.nn.Linear", "paddle.ones_like", "paddle.reshape", "paddle.arange", "paddle.stack", "paddle.sin", "paddle.cos", "numpy.where", "paddle.expand", "paddle.split" ]
[((1568, 1638), 'paddle.nn.Linear', 'nn.Linear', (['self.hidden_size', '(self.entity_type_num * self.inner_dim * 2)'], {}), '(self.hidden_size, self.entity_type_num * self.inner_dim * 2)\n', (1577, 1638), True, 'import paddle.nn as nn\n'), ((1842, 1892), 'paddle.arange', 'paddle.arange', (['(0)', '(output_dim // 2)'], ...
import sys import os import click #add to path to search interpreter parent directory sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) import numpy as np import pandas as pd from src.processing.data_management import load_pipeline from src.config import config, logging_config from src.processing...
[ "pandas.DataFrame", "src.processing.data_management.load_pipeline", "os.path.dirname", "src.config.logging_config.get_logger", "click.option", "click.command", "src.processing.validation.validate_inputs", "numpy.exp" ]
[((406, 441), 'src.config.logging_config.get_logger', 'logging_config.get_logger', (['__name__'], {}), '(__name__)\n', (431, 441), False, 'from src.config import config, logging_config\n'), ((523, 566), 'src.processing.data_management.load_pipeline', 'load_pipeline', ([], {'file_name': 'pipeline_file_name'}), '(file_na...
#!/usr/bin/env python3 """ This script tests the performance of different solvers """ import sys from pathlib import Path PACKAGE_PATH = Path(__file__).resolve().parents[1] sys.path.insert(0, str(PACKAGE_PATH)) import numpy as np from pde import CahnHilliardPDE, Controller, DiffusionPDE, ScalarField, UnitGrid from ...
[ "pde.DiffusionPDE", "pde.CahnHilliardPDE", "numpy.allclose", "pde.UnitGrid", "pde.solvers.ImplicitSolver", "pathlib.Path", "pde.ScalarField.random_uniform", "pde.solvers.ScipySolver", "pde.solvers.ExplicitSolver", "pde.Controller" ]
[((837, 875), 'pde.UnitGrid', 'UnitGrid', (['[size, size]'], {'periodic': '(False)'}), '([size, size], periodic=False)\n', (845, 875), False, 'from pde import CahnHilliardPDE, Controller, DiffusionPDE, ScalarField, UnitGrid\n'), ((888, 920), 'pde.ScalarField.random_uniform', 'ScalarField.random_uniform', (['grid'], {})...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 12 13:34:33 2022 @author: oronald """ #Import required libraries import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras.models import Model import numpy as np import pandas as pd import matplotlib as mpl import matplotlib...
[ "matplotlib.pyplot.title", "numpy.load", "tensorflow.keras.layers.MaxPooling2D", "pandas.read_csv", "cartopy.feature.NaturalEarthFeature", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib.colors.TwoSlopeNorm", "numpy.nanmean", "matplotlib.lines.Line2D", "n...
[((469, 538), 'numpy.load', 'np.load', (['"""C:/python_work/phd/paper2/new_data/no2/no2_model_train.npy"""'], {}), "('C:/python_work/phd/paper2/new_data/no2/no2_model_train.npy')\n", (476, 538), True, 'import numpy as np\n'), ((551, 623), 'numpy.load', 'np.load', (['"""C:/python_work/phd/paper2/new_data/no2/no2_model_v...
import numpy as np class Conv1D: def __call__(self, x, weight, bias, padding, dilation): x = np.pad(x, ((0, 0), (padding, padding))).T in_len, _ = x.shape _, _, kernel_len = weight.shape out_len = int(in_len - (dilation * (kernel_len-1))) k_indices = np.arange(kernel_len)...
[ "numpy.pad", "numpy.tensordot", "numpy.arange", "numpy.tile" ]
[((299, 320), 'numpy.arange', 'np.arange', (['kernel_len'], {}), '(kernel_len)\n', (308, 320), True, 'import numpy as np\n'), ((339, 377), 'numpy.tile', 'np.tile', (['k_indices[None]', '(out_len, 1)'], {}), '(k_indices[None], (out_len, 1))\n', (346, 377), True, 'import numpy as np\n'), ((108, 147), 'numpy.pad', 'np.pad...
import numpy as np import math class Environment(): def __init__(self): self.lambda_in = np.array([3,2]) self.lambda_req = np.array([3,4]) self.max_car = 20 self.action_list = list(range(-5,6)) print(self.action_list) self.prob_matrix_0 = None self.prob_matr...
[ "numpy.zeros", "numpy.exp", "numpy.array", "numpy.ones" ]
[((103, 119), 'numpy.array', 'np.array', (['[3, 2]'], {}), '([3, 2])\n', (111, 119), True, 'import numpy as np\n'), ((145, 161), 'numpy.array', 'np.array', (['[3, 4]'], {}), '([3, 4])\n', (153, 161), True, 'import numpy as np\n'), ((1178, 1218), 'numpy.zeros', 'np.zeros', (['(mat_size, mat_size, act_size)'], {}), '((ma...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np from .math import fit_gaussian import warnings from scipy.ndimage import center_of_mass from scipy.ndimage.interpolation import...
[ "scipy.ndimage.center_of_mass", "scipy.optimize.minimize", "numpy.sum", "numpy.abs", "numpy.argmax", "numpy.zeros", "scipy.ndimage.interpolation.shift", "numpy.sign", "numpy.convolve" ]
[((8810, 8828), 'scipy.ndimage.center_of_mass', 'center_of_mass', (['IM'], {}), '(IM)\n', (8824, 8828), False, 'from scipy.ndimage import center_of_mass\n'), ((9714, 9756), 'numpy.convolve', 'np.convolve', (['QL_raw0', 'QL_raw0'], {'mode': '"""full"""'}), "(QL_raw0, QL_raw0, mode='full')\n", (9725, 9756), True, 'import...
from PIL.Image import NONE import numpy as np # Math import matplotlib.pyplot as plt # Gráficos import pickle # Serialização #/*===========================HELPER FUNCTIONS START=======================*/ # [Sigmoid funciona melhor com os dados normalizados, entre [0,1] ] def sigmoid(x:int, d...
[ "numpy.random.uniform", "pickle.dump", "numpy.maximum", "numpy.tanh", "matplotlib.pyplot.show", "numpy.sum", "numpy.dot", "numpy.ones", "pickle.load", "numpy.array", "numpy.exp", "numpy.array_equal", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((784, 794), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (791, 794), True, 'import numpy as np\n'), ((990, 1006), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (1000, 1006), True, 'import numpy as np\n'), ((8585, 8605), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Epochs"""'], {}), "('Epochs')\n...
import json import multiprocessing as mp import os import pickle import queue from multiprocessing import Process import cv2 as cv import numpy as np from keras.applications.inception_resnet_v2 import preprocess_input from tqdm import tqdm from Base.config import image_folder, img_size, channel, num_train_samples, SE...
[ "pickle.dump", "numpy.empty", "Base.utils.get_best_model", "pickle.load", "numpy.linalg.norm", "numpy.mean", "multiprocessing.Process.__init__", "Base.triplets.select_train_triplets", "os.path.join", "numpy.std", "cv2.cvtColor", "numpy.max", "keras.backend.clear_session", "cv2.resize", "...
[((4485, 4503), 'Base.utils.get_train_images', 'get_train_images', ([], {}), '()\n', (4501, 4503), False, 'from Base.utils import get_best_model, get_train_images\n'), ((3684, 3702), 'Base.utils.get_train_images', 'get_train_images', ([], {}), '()\n', (3700, 3702), False, 'from Base.utils import get_best_model, get_tra...
import io import cv2 import numpy as np import pycocotools.mask as coco_mask_util from paddle.fluid.core import PaddleTensor from config import YOLOv3_img_resize_to, YOLOv4_img_resize_to ################################################## # CV related utils ################################################...
[ "numpy.minimum", "numpy.maximum", "numpy.meshgrid", "numpy.copy", "numpy.concatenate", "numpy.dot", "numpy.zeros", "numpy.expand_dims", "numpy.where", "numpy.linalg.norm", "numpy.swapaxes", "numpy.linspace", "io.open", "numpy.array", "numpy.sin", "cv2.resize" ]
[((1667, 1689), 'numpy.swapaxes', 'np.swapaxes', (['img', '(1)', '(2)'], {}), '(img, 1, 2)\n', (1678, 1689), True, 'import numpy as np\n'), ((1700, 1722), 'numpy.swapaxes', 'np.swapaxes', (['img', '(1)', '(0)'], {}), '(img, 1, 0)\n', (1711, 1722), True, 'import numpy as np\n'), ((1946, 1969), 'numpy.copy', 'np.copy', (...
from numpy import sqrt from .qubit import Qubit __all__ = [ 'ket' ] def ket(sym): states = { '0': Qubit(1, 0), '1': Qubit(0, 1), '+': Qubit(1/sqrt(2), 1/sqrt(2)), '-': Qubit(1/sqrt(2), -1/sqrt(2)), } return states[sym]
[ "numpy.sqrt" ]
[((177, 184), 'numpy.sqrt', 'sqrt', (['(2)'], {}), '(2)\n', (181, 184), False, 'from numpy import sqrt\n'), ((188, 195), 'numpy.sqrt', 'sqrt', (['(2)'], {}), '(2)\n', (192, 195), False, 'from numpy import sqrt\n'), ((219, 226), 'numpy.sqrt', 'sqrt', (['(2)'], {}), '(2)\n', (223, 226), False, 'from numpy import sqrt\n')...
""" Extracts frames from a video and stores triplets for network consumption """ from absl import app from absl import flags import numpy as np import cv2 from collections import deque from os import path, walk, makedirs flags.DEFINE_string('input_dir', None, 'Input video file') flags.DEFINE_integer('img_height', 128...
[ "cv2.resize", "os.makedirs", "cv2.imwrite", "os.walk", "numpy.zeros", "absl.flags.mark_flag_as_required", "absl.flags.DEFINE_string", "cv2.imread", "os.path.isfile", "absl.app.run", "absl.flags.DEFINE_integer", "os.path.join", "collections.deque" ]
[((223, 281), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input_dir"""', 'None', '"""Input video file"""'], {}), "('input_dir', None, 'Input video file')\n", (242, 281), False, 'from absl import flags\n'), ((282, 344), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""img_height"""', '(128)', '"""...
#!/usr/local/bin/python # -*- coding: utf-8 -*- import csv import os import numpy as np from sklearn.cross_validation import train_test_split from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score, c...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.clf", "sklearn.metrics.accuracy_score", "sklearn.metrics.classification_report", "matplotlib.pyplot.figure", "matplotlib.pyplot.tick_params", "os.path.dirname", "matplotlib.pyplot.colorbar", "sklearn.ensemble.RandomForestClassifier", "matplotlib.pyplot...
[((723, 776), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', (['(10)'], {'oob_score': '(True)', 'n_jobs': '(-1)'}), '(10, oob_score=True, n_jobs=-1)\n', (745, 776), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((958, 996), 'sklearn.metrics.confusion_matrix', 'confusion_matrix',...
from typing import Any, List, Union, Optional import time import gym import numpy as np from ding.envs import BaseEnv, BaseEnvTimestep, FrameStackWrapper from ding.torch_utils import to_ndarray, to_list from ding.envs.common.common_function import affine_transform from ding.utils import ENV_REGISTRY @ENV_REGISTRY.reg...
[ "numpy.random.seed", "gym.make", "ding.torch_utils.to_ndarray", "numpy.float32", "gym.wrappers.Monitor", "ding.envs.BaseEnvTimestep", "numpy.random.randint", "gym.spaces.Box", "ding.envs.common.common_function.affine_transform", "ding.utils.ENV_REGISTRY.register" ]
[((304, 342), 'ding.utils.ENV_REGISTRY.register', 'ENV_REGISTRY.register', (['"""bipedalwalker"""'], {}), "('bipedalwalker')\n", (325, 342), False, 'from ding.utils import ENV_REGISTRY\n'), ((1977, 2003), 'numpy.random.seed', 'np.random.seed', (['self._seed'], {}), '(self._seed)\n', (1991, 2003), True, 'import numpy as...
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from sklearn.datasets import make_blobs from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score, silhouette_samples, calinski_harabaz_score, \ homogeneity_score, completeness...
[ "sklearn.metrics.completeness_score", "numpy.random.uniform", "numpy.random.seed", "matplotlib.pyplot.show", "numpy.ndarray", "numpy.sum", "sklearn.cluster.KMeans", "sklearn.metrics.calinski_harabaz_score", "sklearn.datasets.make_blobs", "sklearn.metrics.silhouette_score", "sklearn.metrics.homog...
[((428, 448), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (442, 448), True, 'import numpy as np\n'), ((530, 627), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'nb_samples', 'n_features': '(2)', 'centers': '(3)', 'cluster_std': '(1.5)', 'random_state': '(1000)'}), '(n_samples=...
""" Python interface for ceq chemical equilibrium calculator References: "Computer Program for Calculation of Complex Equilibrium Compositions and Applications" Nasa Reference Publication 1311, October 1995 <NAME> and <NAME> "NASA Glenn Coefficients for Calculating Thermodynamic Properties of Individu...
[ "numpy.zeros", "numpy.log", "numpy.array", "ctypes.c_double" ]
[((1178, 1186), 'numpy.array', 'array', (['M'], {}), '(M)\n', (1183, 1186), False, 'from numpy import array, zeros, log\n'), ((1208, 1220), 'numpy.array', 'array', (['lewis'], {}), '(lewis)\n', (1213, 1220), False, 'from numpy import array, zeros, log\n'), ((4273, 4286), 'numpy.zeros', 'zeros', (['(3, 9)'], {}), '((3, ...
import logging import time import numpy as np from scipy.stats import chi2 from ..models import pv, ais from ..pyTarget import Target from munkres import munkres # https://github.com/jfrelinger/cython-munkres-wrapper # import pymunkres # https://github.com/erikliland/munkres # import scipy.optimize.linear_sum_assignm...
[ "numpy.sum", "numpy.array_str", "numpy.empty", "numpy.ones", "pymht.utils.simulator.generateInitialTargets", "numpy.arange", "numpy.linalg.norm", "numpy.set_printoptions", "numpy.copy", "numpy.logical_not", "numpy.max", "numpy.asarray", "numpy.array2string", "time.sleep", "numpy.hstack",...
[((582, 609), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (599, 609), False, 'import logging\n'), ((5028, 5039), 'time.time', 'time.time', ([], {}), '()\n', (5037, 5039), False, 'import time\n'), ((22414, 22461), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(1)'...
import numpy as np import os from torchvision.datasets import VisionDataset from torchvision.datasets.folder import default_loader from torchvision.datasets.utils import download_url from torchvision.datasets.utils import extract_archive class Aircraft(VisionDataset): """`FGVC-Aircraft <http://www.robots.ox.ac.uk...
[ "os.path.exists", "torchvision.datasets.utils.download_url", "torchvision.datasets.utils.extract_archive", "os.path.join", "numpy.unique" ]
[((1356, 1409), 'os.path.join', 'os.path.join', (['"""fgvc-aircraft-2013b"""', '"""data"""', '"""images"""'], {}), "('fgvc-aircraft-2013b', 'data', 'images')\n", (1368, 1409), False, 'import os\n'), ((2181, 2291), 'os.path.join', 'os.path.join', (['self.root', '"""fgvc-aircraft-2013b"""', '"""data"""', "('images_%s_%s....
# -*- coding: utf-8 -*- """ Created on Sat Dec 8 13:02:14 2018 @author: initial-h """ import tensorflow as tf import tensorlayer as tl from tensorlayer.layers import * import os import numpy as np class PolicyValueNet(): def __init__(self, board_width, board_height, block, init_model=None, transfer_model=None,...
[ "numpy.load", "tensorflow.trainable_variables", "tensorflow.multiply", "tensorflow.global_variables", "numpy.random.randint", "numpy.rot90", "numpy.exp", "tensorlayer.layers.FlattenLayer", "tensorflow.InteractiveSession", "tensorflow.variable_scope", "tensorlayer.layers.DenseLayer", "tensorflo...
[((875, 898), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (896, 898), True, 'import tensorflow as tf\n'), ((947, 1035), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.planes_num, board_height, board_width]'}), '(tf.float32, shape=[None, self.planes_nu...
import cv2 import shutil import numpy as np from pathlib import Path from tqdm import tqdm from numpy import loadtxt import seaborn as sns from utils import get_all_files_in_folder labels_map = {0: 'pig', 1: 'ladle', 2: 'gates', 3: 'person', 4: 'red_pants', ...
[ "cv2.putText", "cv2.getTextSize", "numpy.clip", "pathlib.Path", "cv2.rectangle", "shutil.rmtree" ]
[((1277, 1352), 'cv2.rectangle', 'cv2.rectangle', (['output', '(box[0], box[1])', '(box[2], box[3])', 'color', 'thickness'], {}), '(output, (box[0], box[1]), (box[2], box[3]), color, thickness)\n', (1290, 1352), False, 'import cv2\n'), ((1790, 1858), 'cv2.rectangle', 'cv2.rectangle', (['im', 'c1', 'c2', 'color'], {'thi...
import numpy as np from kprototypes import KPrototypes from sklearn.utils import check_random_state from time import time import os from utilities import WriteImg, Brief _patchSize = (33, 17, 5) #_nbytes = (3, 5, 2) _nbytes = (6, 10, 4) _sigma = (4.0, 2.0, 0.0) class Clusterer: def __init__(self, img_ambient, siz...
[ "utilities.WriteImg", "utilities.Brief", "numpy.load", "sklearn.utils.check_random_state", "numpy.save", "os.makedirs", "numpy.copy", "kprototypes.KPrototypes._mean_mode", "os.path.isdir", "numpy.zeros", "numpy.iinfo", "time.time", "os.path.isfile", "numpy.where" ]
[((645, 677), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (663, 677), False, 'from sklearn.utils import check_random_state\n'), ((1310, 1316), 'time.time', 'time', ([], {}), '()\n', (1314, 1316), False, 'from time import time\n'), ((2289, 2295), 'time.time', 'ti...
""" Implementatio of tile coding (chapter 9.5.4) for example 10.1 of "Reinforcement learning" by Sutton and Barto """ import numpy as np class feature_vecs(): """Tile coding for the Mountain car example 10.1 from Sutton and Barto's "Reinforcement Learning" """ def __init__(self, dims, nr_tilings, tiles_p...
[ "numpy.random.uniform", "numpy.abs", "numpy.zeros", "numpy.argmin", "numpy.array", "numpy.linspace", "numpy.prod" ]
[((2890, 2911), 'numpy.array', 'np.array', (['(-1.2, 0.5)'], {}), '((-1.2, 0.5))\n', (2898, 2911), True, 'import numpy as np\n'), ((2923, 2946), 'numpy.array', 'np.array', (['(-0.07, 0.07)'], {}), '((-0.07, 0.07))\n', (2931, 2946), True, 'import numpy as np\n'), ((2963, 2985), 'numpy.array', 'np.array', (['(dim1, dim2)...
from numpy import sqrt def comp_width_wire(self): """Return bar width Parameters ---------- self : CondType22 A CondType22 object Returns ------- W: float Width of the bar [m] """ if self.parent is not None and self.parent.parent is not None: Wbar = self...
[ "numpy.sqrt" ]
[((379, 394), 'numpy.sqrt', 'sqrt', (['self.Sbar'], {}), '(self.Sbar)\n', (383, 394), False, 'from numpy import sqrt\n')]
import numpy as np import matplotlib.pyplot as plt from scipy import ndimage from skimage import io, draw img = io.imread("/home/chuan/soil/particle/clump/testMGH2D/ellipse.png") # io.imshow(img) # io.show() dist_img = ndimage.distance_transform_edt(img) io.imshow(dist_img, cmap="gray") io.show() dist_img...
[ "scipy.ndimage.distance_transform_edt", "skimage.draw.set_color", "matplotlib.pyplot.show", "numpy.argmax", "matplotlib.pyplot.axes", "skimage.io.show", "numpy.nonzero", "numpy.array", "matplotlib.pyplot.Circle", "skimage.io.imshow", "skimage.io.imread" ]
[((118, 184), 'skimage.io.imread', 'io.imread', (['"""/home/chuan/soil/particle/clump/testMGH2D/ellipse.png"""'], {}), "('/home/chuan/soil/particle/clump/testMGH2D/ellipse.png')\n", (127, 184), False, 'from skimage import io, draw\n'), ((230, 265), 'scipy.ndimage.distance_transform_edt', 'ndimage.distance_transform_edt...
# coding=utf-8 # Copyright 2021 The Deeplab2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
[ "absl.testing.absltest.main", "numpy.isclose", "pycocotools.mask.decode", "numpy.array" ]
[((4328, 4343), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (4341, 4343), False, 'from absl.testing import absltest\n'), ((854, 939), 'numpy.array', 'np.array', (['[[[1, 1], [1, 1]], [[0, 0], [0, 1]], [[0, 0], [0, 0]]]'], {'dtype': 'np.uint8'}), '([[[1, 1], [1, 1]], [[0, 0], [0, 1]], [[0, 0], [0, 0...
#!/usr/bin/env python """ functions required for precomputing the barycentric trees utilises the special properties of the trees to compute and store them in a very compact (barycentric) format. this can be done very efficiently, enabling trees for very large (e.g. high dimensional) problems. due to the nested (recur...
[ "minterpy.dds.get_node_positions", "minterpy.dds.dds_1_dimensional", "minterpy.dds.get_leaf_idxs", "numpy.empty", "numba.njit", "numpy.zeros", "numpy.max", "minterpy.dds.get_direct_child_idxs", "numpy.array_equal", "numpy.eye", "numba.typed.List", "minterpy.utils.eval_newt_polys_on" ]
[((1194, 1210), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cache=True)\n', (1198, 1210), False, 'from numba import njit\n'), ((2587, 2603), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cache=True)\n', (2591, 2603), False, 'from numba import njit\n'), ((5943, 5959), 'numba.njit', 'njit', ([], {'cache': '(T...
import os import numpy as np import tensorflow as tf from absl import flags FLAGS = flags.FLAGS flags.DEFINE_integer('oov_bucket_size', 1, "The number of out-of-vocabulary buckets") flags.DEFINE_integer('batch_size', 128, 'Batch size') flags.DEFINE_integer('num_steps', 20, 'Number of steps') flags.DEFINE_float('learni...
[ "tensorflow.math.tanh", "tensorflow.identity", "tensorflow.reshape", "numpy.ones", "tensorflow.matmul", "tensorflow.split", "os.path.join", "tensorflow.clip_by_global_norm", "tensorflow.IndexedSlices", "tensorflow.random.uniform", "tensorflow.math.sigmoid", "tensorflow.dtypes.cast", "tensorf...
[((97, 186), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""oov_bucket_size"""', '(1)', '"""The number of out-of-vocabulary buckets"""'], {}), "('oov_bucket_size', 1,\n 'The number of out-of-vocabulary buckets')\n", (117, 186), False, 'from absl import flags\n'), ((183, 236), 'absl.flags.DEFINE_integer',...
from abc import abstractmethod, ABCMeta import numpy as np import copy CONFIGURATIONS = ['transparent', 'opaque_dataset', 'opaque_process'] class QuantifyingDisparity(metaclass=ABCMeta): def __init__(self, workers, attributes, configuration="transparent", f=None, selected=0.1, bins="preset"): """ ...
[ "numpy.random.uniform", "copy.deepcopy" ]
[((1798, 1820), 'copy.deepcopy', 'copy.deepcopy', (['workers'], {}), '(workers)\n', (1811, 1820), False, 'import copy\n'), ((4872, 4906), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(0.8)', 'high': '(1)'}), '(low=0.8, high=1)\n', (4889, 4906), True, 'import numpy as np\n'), ((4978, 5012), 'numpy.random.u...
#!/usr/bin/env python3 ################################################################################ # This application is based on the NVIDIA Deepstream SDK demo apps # located at: https://github.com/NVIDIA-AI-IOT/deepstream_python_apps # In particular the deepstream-imagedata-multistream is taken as the basis ####...
[ "argparse.ArgumentParser", "face_recognition.compare_faces", "numpy.argmin", "pathlib.Path", "pickle.load", "cv2.rectangle", "sys.path.append", "cv2.cvtColor", "cv2.imwrite", "face_recognition.face_encodings", "os.path.exists", "gi.repository.Gst.Caps.from_string", "gi.repository.Gst.Bin.add...
[((434, 456), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (449, 456), False, 'import sys\n'), ((487, 519), 'gi.require_version', 'gi.require_version', (['"""Gst"""', '"""1.0"""'], {}), "('Gst', '1.0')\n", (505, 519), False, 'import gi\n'), ((10056, 10101), 'cv2.cvtColor', 'cv2.cvtColor', (['...