code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# def functions are not used purposefully. Code will be condensed once it is approved. The code is verbose considering jit, but it is not critical. # pip3 is assumed to be installed. Replace pip3 with pip in if pip is used instead. # First few lines of code will install and setup HD-BET from https://github.com/MIC-DKF...
[ "os.path.exists", "numpy.eye", "nibabel.save", "nipype.interfaces.fsl.FLIRT", "nibabel.load", "numpy.add", "os.rename", "numpy.array", "numpy.zeros", "os.system", "os.remove" ]
[((2267, 2309), 'os.rename', 'os.rename', (['MNI_name', '"""MNI-template.nii.gz"""'], {}), "(MNI_name, 'MNI-template.nii.gz')\n", (2276, 2309), False, 'import os\n'), ((2314, 2353), 'os.rename', 'os.rename', (['T1w_name', '"""input-t1w.nii.gz"""'], {}), "(T1w_name, 'input-t1w.nii.gz')\n", (2323, 2353), False, 'import o...
from datetime import datetime import numpy as np from typedecorator import params, returns from roadnet import RoadNetwork from utils import greate_circle_distance from graph import seq2graph __all__ = ['Trajectory'] class Trajectory(object): """ An object to represent the daily mobility of individuals. ...
[ "graph.seq2graph", "utils.greate_circle_distance", "typedecorator.params", "numpy.average" ]
[((3414, 3448), 'typedecorator.params', 'params', ([], {'self': 'object', 'locs': '[object]'}), '(self=object, locs=[object])\n', (3420, 3448), False, 'from typedecorator import params, returns\n'), ((4074, 4119), 'typedecorator.params', 'params', ([], {'self': 'object', 'road_network': 'RoadNetwork'}), '(self=object, ...
import numpy as np import cv2 import numba def prim_mst(graph, W, N): visited = np.zeros(N, dtype=bool) mst = - np.ones(N, dtype=np.int) cost = np.inf * np.ones(N) pi = np.zeros(N) # Start from the pixel at (0, 0) visited[0] = True mst[0] = 0 cost[1], pi[1] = graph[0, 1], 0 # cost be...
[ "cv2.imwrite", "numpy.unique", "numpy.random.rand", "numpy.ones", "numpy.where", "numpy.asarray", "numpy.sum", "numpy.zeros", "numpy.random.randint", "numpy.min", "numpy.argmin", "numpy.zeros_like", "numpy.arange" ]
[((86, 109), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'bool'}), '(N, dtype=bool)\n', (94, 109), True, 'import numpy as np\n'), ((187, 198), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (195, 198), True, 'import numpy as np\n'), ((7586, 7601), 'numpy.ones', 'np.ones', (['(H, W)'], {}), '((H, W))\n', (7593, 7601)...
""" Responsible for production of data visualisations and rendering this data as inline base64 data for various django templates to use. """ from datetime import datetime, timedelta from collections import Counter, defaultdict from typing import Iterable, Callable import numpy as np import pandas as pd import matplotli...
[ "plotnine.ggplot", "app.models.all_available_dates", "plotnine.scales.scale_y_log10", "plotnine.coord_flip", "plotnine.geom_bar", "plotnine.aes", "plotnine.geom_smooth", "plotnine.scale_fill_cmap", "datetime.timedelta", "pandas.to_datetime", "pandas.date_range", "matplotlib.dates.ConciseDateFo...
[((1985, 2001), 'lazydict.LazyDictionary', 'LazyDictionary', ([], {}), '()\n', (1999, 2001), False, 'from lazydict import LazyDictionary\n'), ((4554, 4585), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['rows'], {}), '(rows)\n', (4579, 4585), True, 'import pandas as pd\n'), ((4637, 4656), 'app.data.pr...
import torch import time import matplotlib.pyplot as plt import torch import torch.nn as nn import numpy as np from joblib import load def split_train_eval_test(ids,train_scenes,test_scenes, eval_prop = 0.8): test_ids,train_ids,eval_ids = [],[],[] train = {} for id_ in ids: scene = id_.split("_")...
[ "torch.ones", "torch.mean", "torch.load", "matplotlib.pyplot.plot", "torch.sqrt", "torch.FloatTensor", "numpy.sum", "torch.nn.MSELoss", "numpy.argwhere", "torch.sum", "torch.save", "joblib.load", "torch.no_grad", "time.time", "torch.zeros", "torch.cat", "matplotlib.pyplot.show" ]
[((1128, 1139), 'time.time', 'time.time', ([], {}), '()\n', (1137, 1139), False, 'import time\n'), ((2814, 2825), 'time.time', 'time.time', ([], {}), '()\n', (2823, 2825), False, 'import time\n'), ((4911, 4939), 'torch.save', 'torch.save', (['state', 'save_path'], {}), '(state, save_path)\n', (4921, 4939), False, 'impo...
from fastai.conv_learner import * from fastai.dataset import * from tensorboard_cb_old import * #from iterstrat.ml_stratifiers import MultilabelStratifiedKFold import pandas as pd import numpy as np import os from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score import scipy.optimiz...
[ "os.listdir", "pandas.read_csv", "collections.Counter", "itertools.chain.from_iterable", "numpy.stack", "pandas.concat", "warnings.filterwarnings" ]
[((479, 512), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (502, 512), False, 'import warnings\n'), ((2160, 2183), 'pandas.read_csv', 'pd.read_csv', (['LABELS_ext'], {}), '(LABELS_ext)\n', (2171, 2183), True, 'import pandas as pd\n'), ((2413, 2432), 'collections.Counter'...
from collections import defaultdict from typing import Dict, List import numpy from overrides import overrides from ..instance import TextInstance, IndexedInstance from ...dataset import TextDataset from ...data_indexer import DataIndexer def __can_be_converted_to_multiple_true_false(dataset: TextDataset) -> bool: ...
[ "numpy.asarray", "collections.defaultdict" ]
[((3405, 3422), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3416, 3422), False, 'from collections import defaultdict\n'), ((6025, 6046), 'numpy.asarray', 'numpy.asarray', (['inputs'], {}), '(inputs)\n', (6038, 6046), False, 'import numpy\n'), ((5955, 5971), 'numpy.asarray', 'numpy.asarray', (...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from cogdl.layers import SELayer from .. import BaseModel from cogdl.layers import MLP, GATLayer, GINLayer from cogdl.utils import batch_sum_pooling, batch_mean_pooling, batch_max_pooling from cogdl.layers import Set2Set class App...
[ "cogdl.layers.MLP", "torch.nn.Dropout", "torch.nn.ReLU", "numpy.sqrt", "torch.device", "torch.nn.ModuleList", "torch.Tensor", "torch.nn.functional.normalize", "torch.nn.BatchNorm1d", "torch.is_tensor", "torch.cat", "cogdl.layers.GATLayer", "torch.nn.functional.relu", "torch.nn.Linear", "...
[((787, 796), 'torch.nn.functional.relu', 'F.relu', (['h'], {}), '(h)\n', (793, 796), True, 'import torch.nn.functional as F\n'), ((2023, 2038), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2036, 2038), True, 'import torch.nn as nn\n'), ((2065, 2080), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\...
import numpy as np import math def kepler_3rd(planet_x, p1, p2, a1): """Function that gets as input the orbital period of a planet in years and returns the orbital distance of a planet to the Sun. Input: Planet of interest(planet_x), orbital period planet Earth(p1) days, orbital period planet x(p2) days, dista...
[ "numpy.array", "numpy.cbrt" ]
[((976, 995), 'numpy.array', 'np.array', (['[P, V, T]'], {}), '([P, V, T])\n', (984, 995), True, 'import numpy as np\n'), ((414, 450), 'numpy.cbrt', 'np.cbrt', (['(p2 ** 2 * a1 ** 3 / p1 ** 2)'], {}), '(p2 ** 2 * a1 ** 3 / p1 ** 2)\n', (421, 450), True, 'import numpy as np\n')]
import copy from PyQt4 import QtGui import numpy as np from core.region.region import Region from gui.graph_widget.edge import Edge from gui.graph_widget.graph_line import LineType, GraphLine from gui.graph_widget.node import Node from gui.graph_widget_loader import FROM_TOP, SPACE_BETWEEN_HOR, SPACE_BETWEEN_VER, GAP...
[ "PyQt4.QtGui.QColor", "PyQt4.QtGui.QGraphicsTextItem", "numpy.zeros", "gui.graph_widget.edge.Edge", "gui.img_controls.gui_utils.cvimg2qtpixmap" ]
[((942, 967), 'PyQt4.QtGui.QGraphicsTextItem', 'QtGui.QGraphicsTextItem', ([], {}), '()\n', (965, 967), False, 'from PyQt4 import QtGui\n'), ((1148, 1202), 'numpy.zeros', 'np.zeros', (['(self.height, self.width, 3)'], {'dtype': 'np.uint8'}), '((self.height, self.width, 3), dtype=np.uint8)\n', (1156, 1202), True, 'impor...
import numpy as np class FirFilter: def __init__(self, filter_coeff: np.ndarray, buffer_init = 0): self._buffer = np.zeros(len(filter_coeff)) * buffer_init self._filter_coeff = np.flip(filter_coeff,0) self.last_filtered_value = None def filter(self, input: float) -> float: # pu...
[ "numpy.flip", "numpy.unwrap", "numpy.sum" ]
[((198, 222), 'numpy.flip', 'np.flip', (['filter_coeff', '(0)'], {}), '(filter_coeff, 0)\n', (205, 222), True, 'import numpy as np\n'), ((617, 658), 'numpy.sum', 'np.sum', (['(self._buffer * self._filter_coeff)'], {}), '(self._buffer * self._filter_coeff)\n', (623, 658), True, 'import numpy as np\n'), ((1490, 1545), 'n...
""" Author : <NAME> 01 October 2021 Hacktoberfest Mozilla Campus Club Cummins College of Engineering for Women Pune """ import re import numpy as np #makes all the ones that are part of the same island 0 def remove_ones(x,y): global r global c global grid #check that indices x and y exist in grid if (x<0 or...
[ "re.sub", "numpy.reshape" ]
[((1423, 1447), 'numpy.reshape', 'np.reshape', (['grid', '(r, c)'], {}), '(grid, (r, c))\n', (1433, 1447), True, 'import numpy as np\n'), ((1329, 1352), 're.sub', 're.sub', (['"""[^0-1]"""', '""""""', 's'], {}), "('[^0-1]', '', s)\n", (1335, 1352), False, 'import re\n')]
from random import randint import matplotlib.pyplot as plt import numpy as np class Solution: def rand5(self): r7 = randint(1, 7) while r7 > 5: r7 = randint(1, 7) return r7 soln = Solution() randint_sample = np.array([randint(1, 5) for i in range(10_000)]) rand5_sample = np.array([soln.rand5() for i in ra...
[ "matplotlib.pyplot.hist", "numpy.hstack", "matplotlib.pyplot.title", "random.randint", "matplotlib.pyplot.show" ]
[((343, 368), 'numpy.hstack', 'np.hstack', (['randint_sample'], {}), '(randint_sample)\n', (352, 368), True, 'import numpy as np\n'), ((369, 397), 'matplotlib.pyplot.hist', 'plt.hist', (['hist1'], {'bins': '"""auto"""'}), "(hist1, bins='auto')\n", (377, 397), True, 'import matplotlib.pyplot as plt\n'), ((398, 434), 'ma...
"""<https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm>""" import sys import numba as nb import numpy as np input = sys.stdin.readline # Dijkstra algorithm without priority queue (this is slow for sparse graphs) @nb.njit("i8[:](i8,i8[:,:],i8,i8)", cache=True) def dijkstra(V, G, s, INF): # Shortest path from v...
[ "numpy.full", "numba.njit" ]
[((219, 265), 'numba.njit', 'nb.njit', (['"""i8[:](i8,i8[:,:],i8,i8)"""'], {'cache': '(True)'}), "('i8[:](i8,i8[:,:],i8,i8)', cache=True)\n", (226, 265), True, 'import numba as nb\n'), ((339, 387), 'numpy.full', 'np.full', ([], {'shape': 'V', 'fill_value': 'INF', 'dtype': 'np.int64'}), '(shape=V, fill_value=INF, dtype=...
from typing import Dict import numpy as np from amazon_review import AmazonReview from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, EarlyStoppingCallback, EvalPrediction, Trainer, Tra...
[ "sklearn.metrics.accuracy_score", "sklearn.metrics.f1_score", "transformers.EarlyStoppingCallback", "transformers.TrainingArguments", "numpy.argmax", "sklearn.metrics.precision_score", "transformers.AutoModelForSequenceClassification.from_pretrained", "sklearn.metrics.recall_score", "transformers.Au...
[((423, 446), 'amazon_review.AmazonReview', 'AmazonReview', ([], {'lang': '"""ja"""'}), "(lang='ja')\n", (435, 446), False, 'from amazon_review import AmazonReview\n'), ((559, 635), 'transformers.AutoModelForSequenceClassification.from_pretrained', 'AutoModelForSequenceClassification.from_pretrained', (['model_name'], ...
# -*- coding: utf-8 -*- """ Created on Thu Sep 15 16:40:12 2016 @author: mark This file contains methods for calculating kinetics values that don't necessarily require cantera or another outside less known software package. all rates are currently only in kcal/mol (except arrhenius) """ # -*- coding: utf-8 -*- im...
[ "numpy.exp", "numpy.log10" ]
[((1257, 1273), 'numpy.log10', 'np.log10', (['F_cent'], {}), '(F_cent)\n', (1265, 1273), True, 'import numpy as np\n'), ((1369, 1395), 'numpy.log10', 'np.log10', (['reduced_pressure'], {}), '(reduced_pressure)\n', (1377, 1395), True, 'import numpy as np\n'), ((415, 437), 'numpy.exp', 'np.exp', (['(-ea / T / Rkin)'], {}...
"""This module contains the mathematical formulas to calculate several stock indicators """ __author__ = '<NAME>' __version__ = '1.0' import numpy as np def movingaverage(values, window): """Calculates a Simple Moving Average Args: values (int): The integer value of the current moving average ...
[ "numpy.convolve", "numpy.zeros_like", "numpy.diff", "numpy.repeat" ]
[((526, 563), 'numpy.convolve', 'np.convolve', (['values', 'weights', '"""valid"""'], {}), "(values, weights, 'valid')\n", (537, 563), True, 'import numpy as np\n'), ((917, 932), 'numpy.diff', 'np.diff', (['prices'], {}), '(prices)\n', (924, 932), True, 'import numpy as np\n'), ((1067, 1088), 'numpy.zeros_like', 'np.ze...
### prop predict RNN-LSTM ### ## tensor board ## import tensorflow as tf import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from tensorflow.contrib import rnn import warnings warnings.filterwarnings('ignore') tf.set_random_seed(777) tf.reset_default_...
[ "pandas.read_csv", "matplotlib.pyplot.ylabel", "numpy.array", "tensorflow.control_dependencies", "tensorflow.nn.dropout", "tensorflow.set_random_seed", "tensorflow.GPUOptions", "tensorflow.placeholder", "tensorflow.contrib.layers.fully_connected", "matplotlib.pyplot.plot", "matplotlib.pyplot.xla...
[((244, 277), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (267, 277), False, 'import warnings\n'), ((279, 302), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(777)'], {}), '(777)\n', (297, 302), True, 'import tensorflow as tf\n'), ((303, 327), 'tensorflow.reset...
from __future__ import absolute_import from chainer import backend from chainer import Variable import numpy as np class ReplayBuffer(object): """ Buffer for handling the experience replay. Args: size (int): buffer size p (float): probability to evoke the past experience return_variab...
[ "chainer.Variable", "chainer.backend.get_array_module", "numpy.random.rand", "numpy.random.randint" ]
[((988, 999), 'chainer.Variable', 'Variable', (['x'], {}), '(x)\n', (996, 999), False, 'from chainer import Variable\n'), ((1093, 1126), 'chainer.backend.get_array_module', 'backend.get_array_module', (['samples'], {}), '(samples)\n', (1117, 1126), False, 'from chainer import backend\n'), ((1455, 1480), 'numpy.random.r...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Useful utilities """ import sys import numpy as np from numpy import array, zeros import csv from happyfuntokenizing import Tokenizer TOKENIZER = Tokenizer(preserve_case=True) from happyfuntokenizing import Tokenizer TOKENIZER = Tokenizer(preserve_case=True) import i...
[ "os.path.exists", "itertools.islice", "numpy.allclose", "numpy.array", "numpy.zeros", "happyfuntokenizing.Tokenizer" ]
[((198, 227), 'happyfuntokenizing.Tokenizer', 'Tokenizer', ([], {'preserve_case': '(True)'}), '(preserve_case=True)\n', (207, 227), False, 'from happyfuntokenizing import Tokenizer\n'), ((282, 311), 'happyfuntokenizing.Tokenizer', 'Tokenizer', ([], {'preserve_case': '(True)'}), '(preserve_case=True)\n', (291, 311), Fal...
import numpy as np import pickle import glob from collections import defaultdict import os import sys splits = {1, 2, 3, 4} data_name = {'f1'} # {"f1", "f2", "f3", "f4", "f5"} data_per = 0.35 base_dir = sys.argv[1] ground_truth_dir = base_dir + 'groundTruth/' #sys.argv[1] # "/mnt/ssd/all_users/dipika/ms_tcn/data/50sal...
[ "numpy.random.choice", "collections.defaultdict", "numpy.unique", "os.path.join" ]
[((562, 579), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (573, 579), False, 'from collections import defaultdict\n'), ((1074, 1139), 'numpy.random.choice', 'np.random.choice', (['activity_with_vid_dict[activity]'], {'size': 'amt_data'}), '(activity_with_vid_dict[activity], size=amt_data)\n', ...
import numpy as np from scipy.signal import convolve2d from dataclasses import dataclass, field from copy import deepcopy from typing import List, Tuple import os from environments.environment_abc import Environment, State, Action @dataclass class HomebrewConnect4State(State): board: np.ndarray = field(default_fa...
[ "scipy.signal.convolve2d", "numpy.eye", "numpy.random.choice", "numpy.fliplr", "numpy.where", "numpy.array", "numpy.zeros", "copy.deepcopy", "numpy.transpose", "dataclasses.field" ]
[((488, 515), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (493, 515), False, 'from dataclasses import dataclass, field\n'), ((2276, 2316), 'numpy.array', 'np.array', (['[[1, 1, 1, 1]]'], {'dtype': 'np.uint8'}), '([[1, 1, 1, 1]], dtype=np.uint8)\n', (2284, 2316), True, 'i...
import cv2 import numpy as np from daug.transforms import build_transformation_matrix # TODO: test shear, flip, and translate def run_rotation_scale_tests(n=10): heights = np.random.randint(16, 512, size=n) widths = np.random.randint(16, 512, size=n) thetas = (2 * np.pi) * np.random.random(n) scales...
[ "numpy.allclose", "numpy.random.random", "daug.transforms.build_transformation_matrix", "numpy.random.randint", "cv2.getRotationMatrix2D" ]
[((179, 213), 'numpy.random.randint', 'np.random.randint', (['(16)', '(512)'], {'size': 'n'}), '(16, 512, size=n)\n', (196, 213), True, 'import numpy as np\n'), ((227, 261), 'numpy.random.randint', 'np.random.randint', (['(16)', '(512)'], {'size': 'n'}), '(16, 512, size=n)\n', (244, 261), True, 'import numpy as np\n'),...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import numpy as np from .... import units as u from ... import FK4NoETerms, FK4 from ....time import Time from ....table import Table...
[ "os.path.abspath", "numpy.degrees", "os.path.join", "numpy.radians" ]
[((598, 623), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (613, 623), False, 'import os\n'), ((672, 710), 'os.path.join', 'os.path.join', (['ROOT', '"""fk4_no_e_fk4.csv"""'], {}), "(ROOT, 'fk4_no_e_fk4.csv')\n", (684, 710), False, 'import os\n'), ((1028, 1053), 'numpy.radians', 'np.radians...
import os import numpy as np import utils.eval_metrics as em import config as cfg import torch import pandas as pd import torch.nn as nn from sklearn.metrics import confusion_matrix, accuracy_score, classification_report, multilabel_confusion_matrix def train(Model, Trainloader, Optimizer, Criterion, Epoch): ""...
[ "torch.cuda.empty_cache", "torch.tensor", "numpy.vstack", "utils.eval_metrics.print_multilabel_report" ]
[((3116, 3138), 'numpy.vstack', 'np.vstack', (['true_labels'], {}), '(true_labels)\n', (3125, 3138), True, 'import numpy as np\n'), ((3151, 3167), 'numpy.vstack', 'np.vstack', (['preds'], {}), '(preds)\n', (3160, 3167), True, 'import numpy as np\n'), ((3221, 3289), 'utils.eval_metrics.print_multilabel_report', 'em.prin...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ____________developed by <NAME>____________________ # _________collaboration with <NAME>____________ import threading from ._client_robot import ClientRobot import time import Pyro4 import cv2 from urllib import request, parse, error import numpy as np def track(image...
[ "cv2.inRange", "time.sleep", "cv2.imshow", "numpy.array", "cv2.circle", "cv2.cvtColor", "cv2.moments", "threading.Thread", "cv2.GaussianBlur", "cv2.waitKey" ]
[((1318, 1373), 'threading.Thread', 'threading.Thread', ([], {'target': 'run_camera', 'args': '(bot.camera,)'}), '(target=run_camera, args=(bot.camera,))\n', (1334, 1373), False, 'import threading\n'), ((1436, 1449), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1446, 1449), False, 'import time\n'), ((334, 368),...
""" Tests data reading and writing operation, along with condition generation """ import pytest import numpy as np import pandas as pd import os from shutil import rmtree from numpy.testing import assert_equal, assert_allclose from matplotlib.figure import Figure from xsugar import Experiment, ureg from sugarplot impor...
[ "os.listdir", "numpy.testing.assert_equal", "matplotlib.figure.Figure", "sugarplot.prettifyPlot", "os.path.isfile", "sugarplot.assert_figures_equal", "pandas.DataFrame" ]
[((592, 659), 'pandas.DataFrame', 'pd.DataFrame', (["{'Time (ms)': [1, 2, 3], 'Current (mV)': [4, 4.5, 6]}"], {}), "({'Time (ms)': [1, 2, 3], 'Current (mV)': [4, 4.5, 6]})\n", (604, 659), True, 'import pandas as pd\n'), ((973, 1038), 'os.path.isfile', 'os.path.isfile', (["(path_data['figures_full_path'] + filename_desi...
import glob import numpy as np tmp=np.zeros(17) list_daily=glob.glob('/mnt/r01/data/goes-poes_ghrsst/daily/*.nc') list_daily.sort() i=0 for y in range(2003,2019): print("y = "+str(y)) for j in range(0,len(list_daily)): if str(y) in list_daily[j]: tmp[i]=tmp[i]+1 i=i+1
[ "numpy.zeros", "glob.glob" ]
[((36, 48), 'numpy.zeros', 'np.zeros', (['(17)'], {}), '(17)\n', (44, 48), True, 'import numpy as np\n'), ((60, 114), 'glob.glob', 'glob.glob', (['"""/mnt/r01/data/goes-poes_ghrsst/daily/*.nc"""'], {}), "('/mnt/r01/data/goes-poes_ghrsst/daily/*.nc')\n", (69, 114), False, 'import glob\n')]
''' Pretty print: python3 -m json.tool < some.json ''' import json import argparse import os import numpy as np import cv2 import matplotlib.pyplot as plt def load_json(data_path, jsfile): with open(os.path.join(data_path, jsfile), 'r') as f: js = json.load(f) return js def generate_dataset(arg...
[ "matplotlib.pyplot.imshow", "cv2.fillPoly", "numpy.reshape", "numpy.ones", "argparse.ArgumentParser", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.imread", "os.path.join", "os.path.splitext", "numpy.array", "numpy.concatenate", "js...
[((3383, 3408), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3406, 3408), False, 'import argparse\n'), ((266, 278), 'json.load', 'json.load', (['f'], {}), '(f)\n', (275, 278), False, 'import json\n'), ((659, 697), 'os.path.join', 'os.path.join', (['args.data_path', 'filename'], {}), '(args.d...
import random import numpy as np import math location=np.loadtxt('city_location.txt') num_ant=200 #蚂蚁个数 num_city=30 #城市个数 alpha=1 #信息素影响因子 beta=1 #期望影响因子 info=0.1 #信息素的挥发率 Q=1 #常数 count_iter = 0 iter_max = 500 #dis_new=1000 #========================================== #对称矩阵,两个城市之间的距离 def distance_p...
[ "random.uniform", "numpy.ones", "numpy.power", "numpy.diag", "numpy.array", "numpy.zeros", "numpy.loadtxt" ]
[((61, 92), 'numpy.loadtxt', 'np.loadtxt', (['"""city_location.txt"""'], {}), "('city_location.txt')\n", (71, 92), True, 'import numpy as np\n'), ((1054, 1072), 'numpy.array', 'np.array', (['dis_list'], {}), '(dis_list)\n', (1062, 1072), True, 'import numpy as np\n'), ((1157, 1190), 'numpy.diag', 'np.diag', (['([1.0 / ...
from Modules.Utils.ApplyFunctions import * from Modules.ModelSelection.CrossValidation import CrossValidation from Modules.DataAugmentations.DataAugmentationDefault import * from Modules.Embeddings.EmbeddingDefault import * from Modules.Kernels.KernelDefault import * import itertools import numpy as np import pandas a...
[ "numpy.mean", "tqdm.tqdm", "itertools.product", "Modules.ModelSelection.CrossValidation.CrossValidation", "pandas.DataFrame", "numpy.random.shuffle" ]
[((1160, 1204), 'tqdm.tqdm', 'tqdm', (['hyperparameters_data_augmentation_dict'], {}), '(hyperparameters_data_augmentation_dict)\n', (1164, 1204), False, 'from tqdm import tqdm\n'), ((5480, 5559), 'Modules.ModelSelection.CrossValidation.CrossValidation', 'CrossValidation', (['computed_df_dct', 'model'], {'cv': 'cv', 'n...
# -*- coding: utf-8 -*- """ This script saves the input file for the horseshoe problem. """ __version__ = '1.0' __author__ = '<NAME>' import sys import numpy as np import numpy.matlib sys.path.append(r'C:\BELLA') from src.divers.excel import autofit_column_widths from src.divers.excel import delete_file ...
[ "src.divers.excel.autofit_column_widths", "src.BELLA.save_set_up.save_multipanel", "src.BELLA.save_set_up.save_materials", "src.BELLA.obj_function.ObjFunction", "numpy.ones", "src.BELLA.constraints.Constraints", "src.BELLA.panels.Panel", "src.BELLA.materials.Material", "numpy.array", "src.divers.e...
[((197, 225), 'sys.path.append', 'sys.path.append', (['"""C:\\\\BELLA"""'], {}), "('C:\\\\BELLA')\n", (212, 225), False, 'import sys\n'), ((854, 875), 'src.divers.excel.delete_file', 'delete_file', (['filename'], {}), '(filename)\n', (865, 875), False, 'from src.divers.excel import delete_file\n'), ((3573, 3610), 'nump...
# @Author : <NAME> # @Email : <EMAIL> from shapely.geometry.polygon import Polygon, Point, LineString import CoreFiles.GeneralFunctions as GrlFct from geomeppy.geom.polygons import Polygon2D, Polygon3D,break_polygons from geomeppy import IDF from geomeppy.geom import core_perim import os import shutil import BuildO...
[ "numpy.array", "numpy.linalg.norm", "geomeppy.geom.polygons.Polygon3D", "shapely.geometry.polygon.LineString", "os.path.exists", "itertools.product", "matplotlib.pyplot.plot", "geomeppy.geom.core_perim.CheckFootprintNodes", "numpy.dot", "re.finditer", "os.mkdir", "geomeppy.geom.polygons.Polygo...
[((38886, 38897), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (38894, 38897), True, 'import numpy as np\n'), ((38906, 38917), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (38914, 38917), True, 'import numpy as np\n'), ((38926, 38937), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (38934, 38937), True, 'impo...
''' Visualization for RGB results. ''' import sys, os cur_file_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(cur_file_path, '..')) import importlib, time, math, shutil, csv, random import numpy as np import cv2 import torch import torch.nn as nn from torch.utils.data import Dataset...
[ "viz.utils.create_multi_comparison_images", "numpy.array", "torch.cuda.is_available", "viz.utils.create_video", "os.path.exists", "matplotlib.pyplot.imshow", "os.listdir", "matplotlib.pyplot.close", "os.path.isdir", "utils.config.SplitLineParser", "matplotlib.pyplot.scatter", "matplotlib.pyplo...
[((87, 113), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (103, 113), False, 'import sys, os\n'), ((131, 164), 'os.path.join', 'os.path.join', (['cur_file_path', '""".."""'], {}), "(cur_file_path, '..')\n", (143, 164), False, 'import sys, os\n'), ((1648, 1710), 'utils.config.SplitLinePars...
from pathlib import Path import numpy as np import torch.nn as nn class FeatureExtractor(object): def __init__(self): super(FeatureExtractor).__init__() def initialize(self, trainer): self.feature_path = trainer.logger.log_path / 'features' if not self.feature_path.exists(): ...
[ "numpy.mean", "numpy.vstack" ]
[((714, 739), 'numpy.mean', 'np.mean', (['mat'], {'axis': '(2, 3)'}), '(mat, axis=(2, 3))\n', (721, 739), True, 'import numpy as np\n'), ((869, 903), 'numpy.vstack', 'np.vstack', (['(module.extracted, mat)'], {}), '((module.extracted, mat))\n', (878, 903), True, 'import numpy as np\n')]
from sklearn.model_selection import StratifiedKFold, KFold, train_test_split from sklearn.metrics import roc_auc_score, make_scorer, average_precision_score, precision_recall_curve, accuracy_score, \ f1_score, auc, mean_squared_error from sklearn.linear_model import RidgeCV, LassoCV, ElasticNet, SGDClassifier, SGDR...
[ "sklearn.model_selection.GridSearchCV", "data.DataProvider", "sklearn.metrics.auc", "sklearn.metrics.roc_auc_score", "sklearn.model_selection.StratifiedKFold", "scipy.stats.pearsonr", "sklearn.model_selection.KFold", "sklearn.linear_model.SGDClassifier", "sklearn.ensemble.RandomForestRegressor", "...
[((820, 878), 'sklearn.metrics.precision_recall_curve', 'precision_recall_curve', ([], {'y_true': 'y_true', 'probas_pred': 'y_score'}), '(y_true=y_true, probas_pred=y_score)\n', (842, 878), False, 'from sklearn.metrics import roc_auc_score, make_scorer, average_precision_score, precision_recall_curve, accuracy_score, f...
#! /usr/bin/env python import rospy from nav_msgs.msg import Odometry from visualization_msgs.msg import Marker from std_msgs.msg import Header, ColorRGBA from geometry_msgs.msg import Pose, Point, Vector3, Quaternion import matplotlib.pyplot as plt import numpy as np POS_SCALE = 0.01 MSE_PLOT_MAX_TIME = 120 # in ...
[ "geometry_msgs.msg.Vector3", "rospy.Subscriber", "rospy.is_shutdown", "rospy.init_node", "rospy.get_time", "std_msgs.msg.ColorRGBA", "numpy.array", "matplotlib.pyplot.figure", "std_msgs.msg.Header", "rospy.Rate", "numpy.vstack", "rospy.spin", "geometry_msgs.msg.Point", "rospy.Duration", ...
[((5491, 5549), 'rospy.init_node', 'rospy.init_node', (['"""trajectory_markers_node"""'], {'anonymous': '(True)'}), "('trajectory_markers_node', anonymous=True)\n", (5506, 5549), False, 'import rospy\n'), ((5620, 5634), 'rospy.Rate', 'rospy.Rate', (['(10)'], {}), '(10)\n', (5630, 5634), False, 'import rospy\n'), ((710,...
import numpy as np import scipy as sp import logging import doctest import unittest import os.path import time from pysnptools.pstreader import PstData, PstNpz, PstHdf5 from pysnptools.util import create_directory_if_necessary from pysnptools.kernelreader.test import _fortesting_JustCheckExists class TestLoader(unitte...
[ "logging.basicConfig", "unittest.TestSuite", "numpy.random.normal", "numpy.testing.assert_array_almost_equal", "pysnptools.pstreader.PstNpz", "pysnptools.pstreader.PstData", "pysnptools.util.create_directory_if_necessary", "pysnptools.pstreader.PstNpz.write", "pysnptools.kernelreader.test._fortestin...
[((11941, 11963), 'unittest.TestSuite', 'unittest.TestSuite', (['[]'], {}), '([])\n', (11959, 11963), False, 'import unittest\n'), ((12184, 12223), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (12203, 12223), False, 'import logging\n'), ((12261, 12300), 'unitt...
#! /usr/bin/env python import rpy2.robjects as robjects import numpy as np import matplotlib.pyplot as plt import sys import csv import time import os import math def compute_rsquared(\ baseline,\ prediction,\ total_points): mean_y = 0.0 for i in range(total_points): mean_y += baseline[i]...
[ "datetime.datetime", "time.split", "math.pow", "rpy2.robjects.FloatVector", "time.time_ns", "numpy.array", "os.system" ]
[((1557, 1593), 'os.system', 'os.system', (['"""mkdir -p grid-search.db"""'], {}), "('mkdir -p grid-search.db')\n", (1566, 1593), False, 'import os\n'), ((5797, 5833), 'os.system', 'os.system', (['"""mkdir -p grid-search.db"""'], {}), "('mkdir -p grid-search.db')\n", (5806, 5833), False, 'import os\n'), ((10416, 10452)...
import numpy as np import tensorflow as tf from tensorflow import keras import tensorflow.keras.layers as layers from tensorflow.keras.layers import Layer, Conv1D, Conv2D, MaxPooling2D, Dense, Flatten, Reshape, UpSampling2D, Concatenate, Dropout from tensorflow.keras.models import Model from tensorflow.keras.losses im...
[ "tensorflow.keras.callbacks.TensorBoard", "matplotlib.rcParams.update", "json.dumps", "callbacks.LogImageCallback", "matplotlib.pyplot.style.use", "models.ConvolutionalAutoencoder", "matplotlib.pyplot.close", "tensorflow.keras.callbacks.EarlyStopping", "datetime.datetime.now", "numpy.expand_dims",...
[((590, 606), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (599, 606), True, 'import matplotlib.pyplot as plt\n'), ((607, 636), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-deep"""'], {}), "('seaborn-deep')\n", (620, 636), True, 'import matplotlib.pyplot as plt\n'), ((637, ...
""" <NAME> 2014 August 21 Various utilities for calculating angular separations. """ import matplotlib.pyplot as plt import numpy from astropy import units as u from astropy.coordinates import SkyCoord def rmSingles(fluxcomponent, targetstring='target'): """ Filter out targets in fluxcomponent that ha...
[ "numpy.histogram", "numpy.median", "numpy.sqrt", "numpy.roll", "matplotlib.pyplot.plot", "astropy.coordinates.SkyCoord", "matplotlib.pyplot.fill_between", "numpy.array", "numpy.zeros", "numpy.random.uniform", "numpy.cos", "numpy.std" ]
[((402, 421), 'numpy.zeros', 'numpy.zeros', (['nindiv'], {}), '(nindiv)\n', (413, 421), False, 'import numpy\n'), ((6468, 6494), 'numpy.zeros', 'numpy.zeros', (['[nsim, nbins]'], {}), '([nsim, nbins])\n', (6479, 6494), False, 'import numpy\n'), ((7093, 7123), 'numpy.median', 'numpy.median', (['supersep'], {'axis': '(0)...
import pandas as pd import matplotlib.pyplot as plt import numpy as np import json from random import randint from matplotlib.lines import Line2D from sklearn.cluster import KMeans from scipy.spatial import distance from sklearn.externals import joblib data = pd.read_csv('Hsapiens-9606-201603-2016-RNASeq-Quantile-Canc...
[ "pandas.read_csv", "sklearn.externals.joblib.load", "numpy.asarray", "numpy.zeros", "numpy.ndarray.tolist", "numpy.nan_to_num" ]
[((261, 365), 'pandas.read_csv', 'pd.read_csv', (['"""Hsapiens-9606-201603-2016-RNASeq-Quantile-CancerGenomeAtlas-v1.GEM.txt"""'], {'sep': '"""\t"""'}), "(\n 'Hsapiens-9606-201603-2016-RNASeq-Quantile-CancerGenomeAtlas-v1.GEM.txt',\n sep='\\t')\n", (272, 365), True, 'import pandas as pd\n'), ((393, 539), 'pandas....
from hepaccelerate.utils import Results, Dataset, Histogram, choose_backend, JaggedStruct import uproot import numpy import numpy as np import unittest import os from uproot_methods.classes.TH1 import from_numpy USE_CUDA = bool(int(os.environ.get("HEPACCELERATE_CUDA", 0))) class TestJaggedStruct(unittest.TestCase): ...
[ "uproot.recreate", "numpy.ones_like", "hepaccelerate.utils.choose_backend", "numpy.random.normal", "numpy.sqrt", "os.environ.get", "hepaccelerate.utils.Dataset", "numpy.array", "numpy.linspace", "uproot_methods.classes.TH1.from_numpy", "numpy.sum", "uproot.open", "unittest.main", "numpy.al...
[((601, 634), 'hepaccelerate.utils.choose_backend', 'choose_backend', ([], {'use_cuda': 'USE_CUDA'}), '(use_cuda=USE_CUDA)\n', (615, 634), False, 'from hepaccelerate.utils import Results, Dataset, Histogram, choose_backend, JaggedStruct\n'), ((2189, 2222), 'hepaccelerate.utils.choose_backend', 'choose_backend', ([], {'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ File name: load_data.py Author: locke Date created: 2020/3/25 下午7:00 """ import time import numpy as np class AlignmentData: def __init__(self, data_dir="data/DBP15K/ja_en", rate=0.3, share=False, swap=False, val=0.0, with_r=False): t_ =...
[ "numpy.array", "time.time", "numpy.random.shuffle" ]
[((321, 332), 'time.time', 'time.time', ([], {}), '()\n', (330, 332), False, 'import time\n'), ((908, 939), 'numpy.random.shuffle', 'np.random.shuffle', (['self.ill_idx'], {}), '(self.ill_idx)\n', (925, 939), True, 'import numpy as np\n'), ((2482, 2507), 'numpy.random.shuffle', 'np.random.shuffle', (['triple'], {}), '(...
import numpy as np from .Observable import Subject class ObservableArray(np.ndarray, Subject): def __init__(self, *args, **kwargs): Subject.__init__(self) np.ndarray.__init__(self) def _notify(self, to_return): """ if hasattr(to_return, "_observers") and hasattr(sel...
[ "numpy.ndarray.__init__", "numpy.asarray" ]
[((181, 206), 'numpy.ndarray.__init__', 'np.ndarray.__init__', (['self'], {}), '(self)\n', (200, 206), True, 'import numpy as np\n'), ((1366, 1382), 'numpy.asarray', 'np.asarray', (['self'], {}), '(self)\n', (1376, 1382), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- from parser.metric import AttachmentMethod from parser.parser import BiaffineParser import torch import torch.nn as nn import torch.optim as optim from pytorch_pretrained_bert import BertAdam from pytorch_pretrained_bert import BertTokenizer from datetime import datetime, timedelta from tqdm ...
[ "torch.split", "torch.nn.CrossEntropyLoss", "tqdm.tqdm", "torch.stack", "torch.cuda.device_count", "datetime.datetime.now", "numpy.array", "torch.cuda.is_available", "parser.parser.BiaffineParser.load", "torch.no_grad", "datetime.timedelta", "parser.metric.AttachmentMethod", "torch.device" ]
[((6489, 6504), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6502, 6504), False, 'import torch\n'), ((8885, 8900), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8898, 8900), False, 'import torch\n'), ((9940, 9955), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9953, 9955), False, 'import torch\n')...
import os import cv2 import numpy as np import networkx as nx import matplotlib.pyplot as plt from sys import argv class Graph: def __init__(self, adjacency_list: str): """ Initialize a graph using an adjacency list as text input :param adjacency_list: location of graph in txt format ...
[ "networkx.draw_networkx_edges", "matplotlib.pyplot.savefig", "numpy.ones", "networkx.spring_layout", "networkx.Graph", "networkx.draw_networkx", "cv2.VideoWriter", "networkx.draw_networkx_nodes", "cv2.destroyAllWindows", "cv2.VideoWriter_fourcc", "os.system", "cv2.imread" ]
[((3861, 3950), 'os.system', 'os.system', (["('gcc euler_tour.c -std=c99 -o euler_tour && ./euler_tour ' + adjacency_txt)"], {}), "('gcc euler_tour.c -std=c99 -o euler_tour && ./euler_tour ' +\n adjacency_txt)\n", (3870, 3950), False, 'import os\n'), ((1059, 1122), 'numpy.ones', 'np.ones', (['(self.num_vertices, sel...
import numpy as np import matplotlib.pyplot as plt from skimage import io import cv2 def equalize(img): x_max = img.max() s = img.size h = np.zeros(256) for i in range(256): h[i] = np.count_nonzero(img == i) out = np.zeros_like(img) for i in range(256): out[img == i] = x_max /...
[ "matplotlib.pyplot.imshow", "numpy.zeros_like", "numpy.count_nonzero", "skimage.io.imread", "matplotlib.pyplot.figure", "numpy.zeros", "cv2.cvtColor", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show" ]
[((379, 431), 'skimage.io.imread', 'io.imread', (['"""./dataset/images/imori_256x256_dark.png"""'], {}), "('./dataset/images/imori_256x256_dark.png')\n", (388, 431), False, 'from skimage import io\n'), ((439, 476), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (451,...
import pytest import numpy as np from orix.vector.neo_euler import Rodrigues, Homochoric from orix.quaternion.rotation import Rotation """ Rodrigues """ @pytest.mark.parametrize( "rotation, expected", [ (Rotation([1, 0, 0, 0]), [0, 0, 0]), (Rotation([0.9239, 0.2209, 0.2209, 0.2209]), [0.239...
[ "numpy.allclose", "pytest.mark.xfail", "orix.quaternion.rotation.Rotation", "orix.vector.neo_euler.Rodrigues", "orix.vector.neo_euler.Rodrigues.from_rotation", "orix.vector.neo_euler.Homochoric.from_rotation" ]
[((1089, 1142), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'strict': '(True)', 'reason': 'AttributeError'}), '(strict=True, reason=AttributeError)\n', (1106, 1142), False, 'import pytest\n'), ((410, 443), 'orix.vector.neo_euler.Rodrigues.from_rotation', 'Rodrigues.from_rotation', (['rotation'], {}), '(rotation)\n'...
import numpy as np """[Recreates the adjacency matrix with which the steady state probabilities get multiplied iteratively The adjacency matrix A of a set of pages (nodes) defines the linking structure] Returns: [numpy Matrix] -- [The matrix with which the steady state probabilities will get multipled] """ de...
[ "numpy.sum", "numpy.zeros", "numpy.transpose", "numpy.matrix" ]
[((620, 650), 'numpy.zeros', 'np.zeros', (['(num_urls, num_urls)'], {}), '((num_urls, num_urls))\n', (628, 650), True, 'import numpy as np\n'), ((1842, 1865), 'numpy.zeros', 'np.zeros', (['(1, num_urls)'], {}), '((1, num_urls))\n', (1850, 1865), True, 'import numpy as np\n'), ((2058, 2098), 'numpy.transpose', 'np.trans...
import os import cv2 as cv import numpy as np # STEP 1 : Selecting Data For Modeling # ____________________________________________________________________________ # Read Cascade Classifier from haar_face.xml haar_cascade = cv.CascadeClassifier('../haar_face.xml') # Location of Training dataset DIR = './train' feat...
[ "os.listdir", "os.path.join", "cv2.face.LBPHFaceRecognizer_create", "numpy.array", "cv2.cvtColor", "cv2.CascadeClassifier", "cv2.imread" ]
[((227, 267), 'cv2.CascadeClassifier', 'cv.CascadeClassifier', (['"""../haar_face.xml"""'], {}), "('../haar_face.xml')\n", (247, 267), True, 'import cv2 as cv\n'), ((499, 514), 'os.listdir', 'os.listdir', (['DIR'], {}), '(DIR)\n', (509, 514), False, 'import os\n'), ((1540, 1574), 'numpy.array', 'np.array', (['features'...
""" Copyright 2017 <NAME>, <NAME> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistrib...
[ "llops.operators.Vstack", "numpy.argsort", "numpy.sin", "operator.itemgetter", "numpy.arange", "llops.operators.Convolution", "numpy.delete", "numpy.real", "llops.operators._GradientOperator", "numpy.concatenate", "skimage.draw.line", "numpy.round", "llops.conj", "matplotlib.pyplot.savefig...
[((4157, 4176), 'numpy.sum', 'np.sum', (['kernel_best'], {}), '(kernel_best)\n', (4163, 4176), True, 'import numpy as np\n'), ((4207, 4243), 'llops.cast', 'yp.cast', (['kernel_best', 'dtype', 'backend'], {}), '(kernel_best, dtype, backend)\n', (4214, 4243), True, 'import llops as yp\n'), ((5829, 5849), 'llops.size', 'y...
""" Module used to train the noise remover model,save it to HDF5 format, and later use it. """ import glob import PIL import cv2 import numpy as np from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.layers import InputLayer, Conv2D, MaxPooling2D, UpSampling2D from tensorflow.keras.losses ...
[ "PIL.Image.open", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.UpSampling2D", "tensorflow.keras.layers.MaxPooling2D", "numpy.random.random", "base_model.ModelNotLoadedError", "numpy.asarray", "base_model.ModelNotBuiltError", "tensorflow.keras.optimizers.Adam", "numpy.array", "cv2.a...
[((1129, 1152), 'glob.glob', 'glob.glob', (["(path + '\\\\*')"], {}), "(path + '\\\\*')\n", (1138, 1152), False, 'import glob\n'), ((1617, 1633), 'numpy.array', 'np.array', (['X_imgs'], {}), '(X_imgs)\n', (1625, 1633), True, 'import numpy as np\n'), ((3623, 3670), 'numpy.array', 'np.array', (['gaussian_noise_imgs'], {'...
""" License ------- Copyright (C) 2021 - <NAME> You can use this software, redistribute it, and/or modify it under the terms of the Creative Commons Attribution 4.0 International Public License. Explanation --------- This module contains the statistical model of the COVID-19 vaccination campaign described in a...
[ "numpy.mean", "argparse.ArgumentParser", "numpy.random.poisson", "numpy.std", "numpy.log", "numpy.array", "numpy.quantile", "collections.defaultdict", "plot.plot_model_results", "numpy.vstack", "numpy.random.uniform", "functools.lru_cache", "datetime.timedelta", "time.time", "pandas.date...
[((4919, 4950), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(10)'}), '(maxsize=10)\n', (4938, 4950), False, 'import functools\n'), ((6055, 6066), 'time.time', 'time.time', ([], {}), '()\n', (6064, 6066), False, 'import time\n'), ((6080, 6126), 'pandas.date_range', 'pd.date_range', (['start_date', 'e...
import numpy as np import pandas as pd import random import torch from transformers import pipeline from sentence_transformers import SentenceTransformer import warnings warnings.filterwarnings('ignore') # backend model for zero shot object categorizer classifier_zero_shot = pipeline("zero-shot-classification") def ...
[ "sentence_transformers.SentenceTransformer", "pandas.read_csv", "torch.topk", "numpy.argmax", "torch.argmax", "transformers.pipeline", "torch.norm", "warnings.filterwarnings", "torch.dot" ]
[((170, 203), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (193, 203), False, 'import warnings\n'), ((278, 314), 'transformers.pipeline', 'pipeline', (['"""zero-shot-classification"""'], {}), "('zero-shot-classification')\n", (286, 314), False, 'from transformers import ...
import numpy as np from matplotlib import __version__ as mpl_version from matplotlib import get_backend from matplotlib.path import Path from matplotlib.pyplot import close, subplots from matplotlib.widgets import LassoSelector from numpy import asanyarray, asarray, max, min, swapaxes from packaging import version fro...
[ "matplotlib.path.Path", "matplotlib.widgets.LassoSelector", "numpy.asarray", "matplotlib.get_backend", "numpy.max", "numpy.asanyarray", "matplotlib.pyplot.close", "numpy.zeros", "numpy.min", "numpy.meshgrid", "packaging.version.parse", "matplotlib.pyplot.subplots", "numpy.arange", "numpy.a...
[((3322, 3339), 'numpy.asarray', 'asarray', (['heatmaps'], {}), '(heatmaps)\n', (3329, 3339), False, 'from numpy import asanyarray, asarray, max, min, swapaxes\n'), ((4218, 4228), 'numpy.asarray', 'asarray', (['X'], {}), '(X)\n', (4225, 4228), False, 'from numpy import asanyarray, asarray, max, min, swapaxes\n'), ((423...
from PyQt5 import QtCore, QtGui, QtWidgets import numpy as np from keras.preprocessing import image from keras.layers import Dense from keras.models import model_from_json from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPooling2D from keras.layers import Flatten from ker...
[ "keras.preprocessing.image.img_to_array", "keras.layers.Conv2D", "keras.preprocessing.image.ImageDataGenerator", "PyQt5.QtWidgets.QApplication", "keras.layers.Dense", "PyQt5.QtWidgets.QFileDialog.getOpenFileName", "PyQt5.QtWidgets.QTextEdit", "numpy.max", "PyQt5.QtWidgets.QStatusBar", "PyQt5.QtWid...
[((8485, 8517), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (8507, 8517), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((8535, 8558), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (8556, 8558), False, 'from PyQt5 import QtCore, QtG...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pandas as pd import numpy as np import matplotlib.pyplot as plt from cvxopt import matrix, solvers from datetime import datetime, date import quandl assets = ['AAPL', # Apple 'KO', # Coca-Cola 'DIS', # Disney 'XOM',...
[ "numpy.sqrt", "matplotlib.pyplot.ylabel", "numpy.array", "matplotlib.pyplot.margins", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.max", "numpy.linspace", "numpy.dot", "cvxopt.matrix", "pandas.DataFrame", "scipy.optimize.minimize", "matplotlib.pyplot.title", "cvxopt.solvers...
[((694, 722), 'pandas.concat', 'pd.concat', (['hist_data'], {'axis': '(1)'}), '(hist_data, axis=1)\n', (703, 722), True, 'import pandas as pd\n'), ((1191, 1213), 'numpy.zeros', 'np.zeros', (['n_portfolios'], {}), '(n_portfolios)\n', (1199, 1213), True, 'import numpy as np\n'), ((1228, 1250), 'numpy.zeros', 'np.zeros', ...
import numpy as np import numpy.random import matplotlib.pyplot as plt import random # 设置常量 # HIDDEN_LAYER_NUM = 隐层的个数 # LEARNING_RATE = 学习率 # NET_DEEP_ARRAY = 神经网络的深度(输入层X为0)对应的神经元个数 # DEFAULT_TRAIN_TIMES = 默认训练次数 LEARNING_RATE = 1.2 NET_DEEP_ARRAY = [] DEFAULT_TRAIN_TIMES = 5000 # RANDOM_SEED = 随机数的种子 RANDOM_SEED = ...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.log", "numpy.tanh", "numpy.squeeze", "numpy.exp", "numpy.array", "numpy.dot", "numpy.sum", "numpy.zeros", "matplotlib.pyplot.title", "numpy.maximum", "numpy.random.randn", "random.randint", "numpy....
[((665, 690), 'matplotlib.pyplot.title', 'plt.title', (['"""week4 深层神经网络"""'], {}), "('week4 深层神经网络')\n", (674, 690), True, 'import matplotlib.pyplot as plt\n'), ((695, 716), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""x/times"""'], {}), "('x/times')\n", (705, 716), True, 'import matplotlib.pyplot as plt\n'), ((721...
from data_utils.data_manager import DataManager from prototype.prototype import Prototype from embedding.embeddings import Embeddings from embedding.embeddings_service import EmbeddingsService #from embedding.elmo_embeddings import ElmoEmbeddings from embedding.bert_embeddings import BertEmbeddings from embedding.embed...
[ "classifiers.bert_classifier.BertClassifier", "embedding.embeddings.Embeddings", "prototype.prototype.Prototype", "numpy.array", "classifiers.bert_classifier.BertTrainConfig", "sys.exit", "data_utils.data_manager.DataManager", "numpy.random.RandomState", "argparse.ArgumentParser", "numpy.random.se...
[((1471, 1498), 'numpy.random.RandomState', 'np.random.RandomState', (['(3333)'], {}), '(3333)\n', (1492, 1498), True, 'import numpy as np\n'), ((5599, 5651), 'sklearn.metrics.precision_recall_fscore_support', 'precision_recall_fscore_support', (['labels', 'predictions'], {}), '(labels, predictions)\n', (5630, 5651), F...
import numpy as np from ..util.backend_functions import backend as bd from .diffractive_element import DOE from ..util.image_handling import convert_graymap_image_to_hsvmap_image, rescale_img_to_custom_coordinates from PIL import Image from pathlib import Path """ MPL 2.0 License Copyright (c) 2022, <NAME> All righ...
[ "numpy.flip", "numpy.array", "numpy.asarray", "pathlib.Path" ]
[((1393, 1423), 'pathlib.Path', 'Path', (['self.amplitude_mask_path'], {}), '(self.amplitude_mask_path)\n', (1397, 1423), False, 'from pathlib import Path\n'), ((1639, 1663), 'numpy.asarray', 'np.asarray', (['rescaled_img'], {}), '(rescaled_img)\n', (1649, 1663), True, 'import numpy as np\n'), ((1793, 1811), 'numpy.fli...
import json import numpy as np import torch from classifier.classifier_getter import get_classifier from dataset import loader from embedding.embedding import get_embedding from tools.tool import parse_args, print_args, set_seed def to_tensor(data, cuda, exclude_keys=[]): ''' Convert all values in the da...
[ "tools.tool.parse_args", "tools.tool.set_seed", "dataset.loader.load_dataset", "json.loads", "torch.load", "json.dumps", "embedding.embedding.get_embedding", "torch.from_numpy", "tools.tool.print_args", "numpy.array", "numpy.concatenate", "classifier.classifier_getter.get_classifier", "torch...
[((1678, 1701), 'numpy.array', 'np.array', (["data2['text']"], {}), "(data2['text'])\n", (1686, 1701), True, 'import numpy as np\n'), ((1726, 1753), 'numpy.array', 'np.array', (["data2['text_len']"], {}), "(data2['text_len'])\n", (1734, 1753), True, 'import numpy as np\n'), ((1775, 1799), 'numpy.array', 'np.array', (["...
import os from glob import glob import h5py import numpy as np import pandas as pd import re import xarray as xr from pathlib import Path from tqdm import tqdm from brainio_base.stimuli import StimulusSet from brainio_base.assemblies import NeuronRecordingAssembly from brainio_collection.packaging import package_st...
[ "brainio_base.stimuli.StimulusSet", "brainio_base.assemblies.NeuronRecordingAssembly", "numpy.linspace", "pandas.DataFrame", "brainio_collection.packaging.package_data_assembly", "numpy.load", "numpy.arange", "brainio_collection.packaging.package_stimulus_set" ]
[((643, 688), 'numpy.load', 'np.load', (["(stimuli_directory + 'stimgroups.npy')"], {}), "(stimuli_directory + 'stimgroups.npy')\n", (650, 688), True, 'import numpy as np\n'), ((728, 775), 'numpy.load', 'np.load', (["(stimuli_directory + 'stimsequence.npy')"], {}), "(stimuli_directory + 'stimsequence.npy')\n", (735, 77...
import torch import argparse import random import pandas as pd import numpy as np from gensim.models.word2vec import Word2Vec from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, recall_score, roc_auc_score, precision_score from trainer import Trainer from ut...
[ "trainer.Trainer", "sklearn.metrics.accuracy_score", "numpy.zeros", "utils.util.blocks_to_index", "pandas.DataFrame", "utils.util.config_parser", "sklearn.model_selection.KFold", "utils.util.save_result" ]
[((513, 537), 'utils.util.blocks_to_index', 'blocks_to_index', (['df', 'w2v'], {}), '(df, w2v)\n', (528, 537), False, 'from utils.util import config_parser, blocks_to_index, save_result\n'), ((554, 600), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['sid', 'code', 'label']"}), "(columns=['sid', 'code', 'label'...
""" Metropolis Hastings example with simple model Inspired by <NAME>'s blog post https://twiecki.io/blog/2015/11/10/mcmc-sampling/ """ import numpy as np import scipy.stats as stats np.random.seed(0) N_mu_30_sd_1_data = stats.norm.rvs(loc=30, scale=1, size=1000).flatten() def mh_sampler(data, samples=4, mu_init=...
[ "numpy.random.normal", "numpy.random.rand", "scipy.stats.norm", "scipy.stats.norm.rvs", "numpy.exp", "numpy.array", "numpy.random.seed" ]
[((185, 202), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (199, 202), True, 'import numpy as np\n'), ((669, 683), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (677, 683), True, 'import numpy as np\n'), ((1684, 1703), 'numpy.array', 'np.array', (['posterior'], {}), '(posterior)\n', (1692, 17...
#!/usr/bin/env python3 import os import re import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import numpy as np import pandas as pd import seaborn as sns from itertools import cycle from scipy.cluster.hierarchy import dendrogram, linkage # Adjust matplotlib backend for snakemake/cluster try: ...
[ "numpy.clip", "pandas.read_csv", "numpy.array_split", "numpy.array", "numpy.argsort", "numpy.arange", "graphviz.render", "matplotlib.pyplot.close", "matplotlib.gridspec.GridSpec", "pandas.DataFrame", "itertools.cycle", "matplotlib.use", "seaborn.clustermap", "numpy.floor", "seaborn.heatm...
[((322, 334), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (332, 334), True, 'import matplotlib.pyplot as plt\n'), ((996, 1014), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['cmap'], {}), '(cmap)\n', (1008, 1014), True, 'import matplotlib.pyplot as plt\n'), ((1399, 1412), 'itertools.cycle', 'cycle', (...
import tensorflow as tf from tensorflow.keras.layers import Input, Dense from keras import backend as K import numpy as np class BFNN: def __init__(self, nodes, layers, weights, threshold, rate): """ Constructor for a BFNN (binary feedforward neural network). Parameters: 'nodes...
[ "tensorflow.keras.layers.Input", "numpy.asarray", "tensorflow.keras.layers.Dense", "tensorflow.keras.activations.relu", "tensorflow.keras.Model", "keras.backend.function" ]
[((1365, 1396), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(layer_widths[0],)'}), '(shape=(layer_widths[0],))\n', (1370, 1396), False, 'from tensorflow.keras.layers import Input, Dense\n'), ((1797, 1853), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'input_layer', 'outputs': 'output_layer'...
import torch from .torchpoints import ball_query_partial_dense import numpy as np import numba from typing import List @numba.jit(nopython=True) def _grow_proximity_core(neighbours, min_cluster_size): num_points = int(neighbours.shape[0]) visited = np.zeros((num_points,), dtype=numba.types.bool_) clusters...
[ "torch.unique", "torch.empty_like", "torch.tensor", "numpy.zeros", "numba.jit", "torch.arange" ]
[((122, 146), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (131, 146), False, 'import numba\n'), ((259, 307), 'numpy.zeros', 'np.zeros', (['(num_points,)'], {'dtype': 'numba.types.bool_'}), '((num_points,), dtype=numba.types.bool_)\n', (267, 307), True, 'import numpy as np\n'), ((2304, 2...
# vim: set fdm=indent: ''' ___ / | ____ ___ ____ _____ ____ ____ / /| | / __ `__ \/ __ `/_ / / __ \/ __ \ / ___ |/ / / / / / /_/ / / /_/ /_/ / / / / /_/ |_/_/ /_/ /_/\__,_/ /___/\____/_/ /_/ ...
[ "numpy.clip", "pandas.read_csv", "gzip.open", "streamlit.header", "logging.error", "numpy.arange", "plotly.express.box", "streamlit.form", "textwrap.dedent", "streamlit.cache", "streamlit.stop", "numpy.round", "streamlit.sidebar.button", "streamlit.write", "gc.collect", "awswrangler.s3...
[((2848, 2900), 'collections.OrderedDict', 'OrderedDict', ([], {'Daily': '"""D"""', 'Weekly': '"""W-MON"""', 'Monthly': '"""MS"""'}), "(Daily='D', Weekly='W-MON', Monthly='MS')\n", (2859, 2900), False, 'from collections import OrderedDict, deque, namedtuple\n'), ((2916, 2963), 'collections.OrderedDict', 'OrderedDict', ...
import os import numpy as np import scipy.io import torch from einops import repeat from torch.utils.data import DataLoader, Dataset from .base import Builder class NSZongyiBuilder(Builder): name = 'ns_zongyi' def __init__(self, data_path: str, train_size: int, test_size: int, ssr: int, n_...
[ "numpy.arange", "os.path.expandvars", "einops.repeat", "torch.from_numpy", "torch.cat", "torch.utils.data.DataLoader", "torch.linspace" ]
[((575, 597), 'torch.from_numpy', 'torch.from_numpy', (['data'], {}), '(data)\n', (591, 597), False, 'import torch\n'), ((1472, 1548), 'torch.utils.data.DataLoader', 'DataLoader', (['self.train_dataset'], {'shuffle': '(True)', 'drop_last': '(False)'}), '(self.train_dataset, shuffle=True, drop_last=False, **self.kwargs)...
from math import sqrt import math from math import atan2, degrees from skimage import data from skimage.feature import blob_dog, blob_log, blob_doh from skimage.color import rgb2gray from skimage import io import matplotlib.pyplot as plt from scipy import stats from scipy import spatial import numpy as np from scipy ...
[ "skimage.feature.blob_log", "scipy.stats.gaussian_kde", "matplotlib.pyplot.Circle", "scipy.spatial.cKDTree", "skimage.io.show", "math.sqrt", "skimage.io.imread", "matplotlib.pyplot.figure", "numpy.vstack", "matplotlib.pyplot.tight_layout", "skimage.io.imshow", "math.atan2", "matplotlib.pyplo...
[((792, 810), 'skimage.io.imread', 'io.imread', (['im_path'], {}), '(im_path)\n', (801, 810), False, 'from skimage import io\n'), ((1242, 1263), 'skimage.io.imshow', 'io.imshow', (['image_gray'], {}), '(image_gray)\n', (1251, 1263), False, 'from skimage import io\n'), ((1264, 1273), 'skimage.io.show', 'io.show', ([], {...
import numpy as np import progressbar from terminaltables import AsciiTable from scratch_ml.utils import bar_widget, batch_iterator class NeuralNetwork(): """Neural Networ base model.""" def __init__(self, optimizer, loss, validation_data=None): self.optimizer = optimizer self.layers = [] ...
[ "scratch_ml.utils.batch_iterator", "numpy.mean", "terminaltables.AsciiTable", "progressbar.ProgressBar" ]
[((437, 480), 'progressbar.ProgressBar', 'progressbar.ProgressBar', ([], {'widgets': 'bar_widget'}), '(widgets=bar_widget)\n', (460, 480), False, 'import progressbar\n'), ((2148, 2191), 'scratch_ml.utils.batch_iterator', 'batch_iterator', (['x', 'y'], {'batch_size': 'batch_size'}), '(x, y, batch_size=batch_size)\n', (2...
import numpy as np import pytest from scipy.constants import c, h, k # # get Stull's c_1 and c_2 from fundamental constants # # c=2.99792458e+08 #m/s -- speed of light in vacuum # h=6.62606876e-34 #J s -- Planck's constant # k=1.3806503e-23 # J/K -- Boltzman's constant c1 = 2. * h * c**2. c2 = h * c / k sigma = 2...
[ "numpy.testing.assert_array_almost_equal", "numpy.log", "pytest.main", "numpy.exp", "numpy.array" ]
[((2271, 2331), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['out', 'answer'], {'decimal': '(4)'}), '(out, answer, decimal=4)\n', (2307, 2331), True, 'import numpy as np\n'), ((3028, 3093), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['brig...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def linearRegCostFunction(X, y, theta, _lambda): theta = theta.reshape(np.shape(X)[1], 1) m = np.shape(X)[0] theta_tmp = theta[1:] delta = np.dot(X, theta) - y J = np.dot(delta.T, delta) / (2 * m) + _lambda / (2 * m) * np.dot(theta...
[ "numpy.dot", "numpy.shape" ]
[((170, 181), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (178, 181), True, 'import numpy as np\n'), ((224, 240), 'numpy.dot', 'np.dot', (['X', 'theta'], {}), '(X, theta)\n', (230, 240), True, 'import numpy as np\n'), ((143, 154), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (151, 154), True, 'import numpy as ...
import numpy as np import cv2 as cv import torch from models import VideoTools import os.path from utils import initialImage class LoadedModel: def __init__(self, name, device, upscale_factor): super().__init__() self.name = os.path.splitext(os.path.basename(name))[0] self.device = device ...
[ "numpy.uint8", "torch.load", "utils.initialImage", "torch.from_numpy", "torch.cat", "torch.no_grad", "models.VideoTools.flatten_high", "torch.clamp" ]
[((415, 431), 'torch.load', 'torch.load', (['name'], {}), '(name)\n', (425, 431), False, 'import torch\n'), ((2823, 2838), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2836, 2838), False, 'import torch\n'), ((5078, 5139), 'models.VideoTools.flatten_high', 'VideoTools.flatten_high', (['previous_warped', 'self.up...
from __future__ import division import sys import unittest import numpy as np import numpy.testing import npinterval class TestInterval(unittest.TestCase): def test_single(self): """Test the interval warns if only 1 sample is included""" # Don't know how to test warnings below python 3.2 ...
[ "unittest.main", "numpy.array", "npinterval.interval", "npinterval.half_sample_mode" ]
[((2416, 2431), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2429, 2431), False, 'import unittest\n'), ((408, 439), 'numpy.array', 'np.array', (['[-5, -3, -2, -2, 100]'], {}), '([-5, -3, -2, -2, 100])\n', (416, 439), True, 'import numpy as np\n'), ((646, 677), 'numpy.array', 'np.array', (['[-5, -3, -2, -2, 100]...
import numpy as np from tf_rl.env.continuous_gridworld.env import GridWorld dense_goals = [(13.0, 8.0), (18.0, 11.0), (20.0, 15.0), (22.0, 19.0)] env = GridWorld(max_episode_len=500, num_rooms=1, action_limit_max=1.0, silent_mode=True, start_position=(8.0, 8.0), goal_position=(22.0, 22.0), goal_reward=...
[ "tf_rl.env.continuous_gridworld.env.GridWorld", "numpy.array" ]
[((153, 401), 'tf_rl.env.continuous_gridworld.env.GridWorld', 'GridWorld', ([], {'max_episode_len': '(500)', 'num_rooms': '(1)', 'action_limit_max': '(1.0)', 'silent_mode': '(True)', 'start_position': '(8.0, 8.0)', 'goal_position': '(22.0, 22.0)', 'goal_reward': '(+100.0)', 'dense_goals': 'dense_goals', 'dense_reward':...
import pandas as pd import numpy as np import emission.storage.timeseries.abstract_timeseries as esta import emission.storage.timeseries.tcquery as esttc import emission.core.wrapper.localdate as ecwl # Module for pretty-printing outputs (e.g. head) to help users # understand what is going on # However, this means th...
[ "IPython.display.display", "numpy.select", "emission.core.get_database.get_profile_db", "numpy.where", "emission.core.wrapper.localdate.LocalDate", "emission.storage.timeseries.abstract_timeseries.TimeSeries.get_aggregate_time_series", "emission.storage.timeseries.tcquery.TimeComponentQuery", "pandas....
[((786, 853), 'emission.storage.timeseries.tcquery.TimeComponentQuery', 'esttc.TimeComponentQuery', (['"""data.start_local_dt"""', 'query_ld', 'query_ld'], {}), "('data.start_local_dt', query_ld, query_ld)\n", (810, 853), True, 'import emission.storage.timeseries.tcquery as esttc\n'), ((1308, 1342), 'IPython.display.di...
import os import numpy as np import random def identify(root): if 'live' in root or '真人' in root: return True return False def findsamename(root): dolpfiles = os.listdir(os.path.join(root,'DOLP')) s0files = os.listdir(os.path.join(root,'S0')) s0flag = False if '.png_s0' in s0files[0]: ...
[ "os.listdir", "random.shuffle", "numpy.where", "os.path.join", "numpy.array", "numpy.vstack", "os.path.abspath" ]
[((1244, 1262), 'numpy.array', 'np.array', (['_s0files'], {}), '(_s0files)\n', (1252, 1262), True, 'import numpy as np\n'), ((1652, 1672), 'numpy.array', 'np.array', (['_dolpfiles'], {}), '(_dolpfiles)\n', (1660, 1672), True, 'import numpy as np\n'), ((3700, 3720), 'random.shuffle', 'random.shuffle', (['data'], {}), '(...
# # pylint: disable=missing-docstring from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import re import sys import tarfile from six.moves import urllib import tensorflow as tf import numpy as np import joblib import json import argparse import dmm...
[ "hyopt.save_hyperparameter", "hyopt.initialize_hyperparameter", "hyopt.get_hyperparameter", "numpy.random.standard_normal", "json.JSONEncoder.default", "numpy.log", "attractor.compute_discrete_transition_mat", "numpy.array", "tensorflow.control_dependencies", "dmm_model.loss", "numpy.mean", "t...
[((3109, 3132), 'hyopt.get_hyperparameter', 'hy.get_hyperparameter', ([], {}), '()\n', (3130, 3132), True, 'import hyopt as hy\n'), ((4388, 4461), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.TRAINABLE_VARIABLES'], {'scope': '"""emission_var"""'}), "(tf.GraphKeys.TRAINABLE_VARIABLES, scope='emissio...
# -*- coding: utf-8 -*- """ Created on Fri Apr 10 19:29:16 2020 @author: Robert """ #%% import library import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import collections #%% set path workingDir = "D:\\working space\\appliedEconometric_Project\\rawData" balSheet = "Balance sheet variab...
[ "pandas.isnull", "pandas.merge", "os.path.join", "numpy.logical_or", "pandas.to_datetime" ]
[((616, 675), 'pandas.to_datetime', 'pd.to_datetime', (["balSheet_rawDf['Accper']"], {'format': '"""%Y-%m-%d"""'}), "(balSheet_rawDf['Accper'], format='%Y-%m-%d')\n", (630, 675), True, 'import pandas as pd\n'), ((1560, 1626), 'pandas.to_datetime', 'pd.to_datetime', (["incomeStatement_rawDf['Accper']"], {'format': '"""%...
import os import numpy as np import unittest from yggdrasil import units from yggdrasil.tests import assert_equal from yggdrasil.communication import AsciiTableComm from yggdrasil.communication.tests import test_AsciiFileComm as parent from yggdrasil.metaschema.properties.ScalarMetaschemaProperties import ( data2dt...
[ "yggdrasil.tests.assert_equal", "yggdrasil.communication.AsciiTableComm.AsciiTableComm", "numpy.ones", "yggdrasil.metaschema.properties.ScalarMetaschemaProperties.data2dtype", "numpy.hstack", "unittest.skipIf", "os.getcwd", "numpy.zeros", "os.remove" ]
[((709, 775), 'yggdrasil.communication.AsciiTableComm.AsciiTableComm', 'AsciiTableComm.AsciiTableComm', (['"""test"""', 'test_file'], {'direction': '"""recv"""'}), "('test', test_file, direction='recv')\n", (738, 775), False, 'from yggdrasil.communication import AsciiTableComm\n'), ((1134, 1154), 'os.remove', 'os.remov...
from pyE17.utils import imsave from matplotlib import pyplot as plt import numpy as np from numpy.fft import fft2, ifftshift, fftshift, ifft2, fft, ifft from scipy.ndimage.filters import gaussian_filter1d from .plot import imsave def taperarray(shape, edge): xx, yy = np.mgrid[0:shape[0], 0:shape[1]] xx1 = np.f...
[ "numpy.sqrt", "numpy.sin", "numpy.arange", "numpy.max", "matplotlib.pyplot.subplots", "numpy.meshgrid", "numpy.abs", "numpy.ones", "numpy.flipud", "numpy.fliplr", "scipy.ndimage.filters.gaussian_filter1d", "numpy.fft.ifftshift", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy...
[((316, 329), 'numpy.flipud', 'np.flipud', (['xx'], {}), '(xx)\n', (325, 329), True, 'import numpy as np\n'), ((340, 359), 'numpy.minimum', 'np.minimum', (['xx', 'xx1'], {}), '(xx, xx1)\n', (350, 359), True, 'import numpy as np\n'), ((370, 383), 'numpy.fliplr', 'np.fliplr', (['yy'], {}), '(yy)\n', (379, 383), True, 'im...
#!/usr/bin/env python3 import gym import ptan import argparse import time import random import numpy as np from tensorboardX import SummaryWriter import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim GAMMA = 0.99 LEARNING_RATE = 0.001 ENTROPY_BETA = 0.01 BATCH_SIZE = 8 REWARD...
[ "torch.nn.ReLU", "ptan.agent.PolicyAgent", "torch.LongTensor", "torch.nn.functional.softmax", "gym.make", "numpy.mean", "tensorboardX.SummaryWriter", "argparse.ArgumentParser", "numpy.random.seed", "numpy.abs", "numpy.square", "torch.nn.functional.log_softmax", "time.time", "torch.manual_s...
[((681, 706), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (704, 706), False, 'import argparse\n'), ((2133, 2156), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (2141, 2156), False, 'import gym\n'), ((2322, 2362), 'tensorboardX.SummaryWriter', 'SummaryWriter', (['f...
import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import cartopy.crs as ccrs from .afi_base import AFI_basePlotter from cosmic.util import load_cmap_data class AFI_meanPlotter(AFI_basePlotter): def gen_axes(self): if self.domain == 'china': gs = gridspe...
[ "matplotlib.pyplot.colorbar", "cartopy.crs.PlateCarree", "numpy.array", "cosmic.util.load_cmap_data", "numpy.ma.masked_array", "matplotlib.pyplot.subplot" ]
[((1015, 1033), 'numpy.array', 'np.array', (['fig_axes'], {}), '(fig_axes)\n', (1023, 1033), True, 'import numpy as np\n'), ((1035, 1052), 'numpy.array', 'np.array', (['cb_axes'], {}), '(cb_axes)\n', (1043, 1052), True, 'import numpy as np\n'), ((2030, 2167), 'matplotlib.pyplot.colorbar', 'plt.colorbar', (['im'], {'ax'...
import argparse import numpy as np from art.utils import random_sphere from utils.config import label2nb_dict, set_gpu from utils.data import load_data from utils.model import load_model from utils.plot import make_adv_img, make_confusion_matrix from utils.utils import get_fooling_rate, get_targeted_success_rate, set...
[ "utils.plot.make_adv_img", "art.utils.random_sphere", "argparse.ArgumentParser", "utils.config.set_gpu", "utils.utils.set_art", "utils.utils.get_targeted_success_rate", "utils.model.load_model", "utils.data.load_data", "utils.plot.make_confusion_matrix", "numpy.save", "utils.utils.get_fooling_ra...
[((335, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (358, 360), False, 'import argparse\n'), ((675, 692), 'utils.config.set_gpu', 'set_gpu', (['args.gpu'], {}), '(args.gpu)\n', (682, 692), False, 'from utils.config import label2nb_dict, set_gpu\n'), ((760, 818), 'utils.data.load_data',...
import numpy as np import csv, os import torch import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from torch.utils.data import DataLoader, TensorDataset import global_vars as Global from sklearn.manifold import TSNE from datasets.NIH_Chest import NIHChestBinaryTrainSplit import seaborn as sns impor...
[ "_pickle.dump", "numpy.arange", "os.path.exists", "argparse.ArgumentParser", "seaborn.color_palette", "_pickle.load", "sklearn.manifold.TSNE", "easydict.EasyDict", "numpy.concatenate", "numpy.ones", "matplotlib.use", "numpy.nonzero", "models.get_ref_model_path", "os.makedirs", "torch.loa...
[((65, 86), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (79, 86), False, 'import matplotlib\n'), ((1764, 1793), 'numpy.concatenate', 'np.concatenate', (['Out_X'], {'axis': '(0)'}), '(Out_X, axis=0)\n', (1778, 1793), True, 'import numpy as np\n'), ((1806, 1835), 'numpy.concatenate', 'np.concate...
from __future__ import print_function, division import pandas as pd import numpy as np from isochrones.query import Query from .data import TGASPATH TGAS = None class TGASQuery(Query): """Special subclass for a query based on TGAS DR1. `row` is a row of the Gaia DR1 table. """ def __init__(self,...
[ "numpy.where", "pandas.read_hdf", "isochrones.query.Query.__init__" ]
[((368, 467), 'isochrones.query.Query.__init__', 'Query.__init__', (['self', 'row.ra', 'row.dec', 'row.pmra', 'row.pmdec'], {'epoch': 'row.ref_epoch', 'radius': 'radius'}), '(self, row.ra, row.dec, row.pmra, row.pmdec, epoch=row.\n ref_epoch, radius=radius)\n', (382, 467), False, 'from isochrones.query import Query\...
import numpy as np import json from django.views.decorators.http import require_http_methods from django.shortcuts import render def solve_linear_equation(arr1, arr2, arr3): try: arr1 = np.loads(arr1.encode()) arr2 = np.loads(arr2.encode()) arr3 = np.loads(arr3.encode()) except Excepti...
[ "django.shortcuts.render", "numpy.linalg.solve", "django.views.decorators.http.require_http_methods", "numpy.array", "numpy.dot" ]
[((927, 956), 'django.views.decorators.http.require_http_methods', 'require_http_methods', (["['GET']"], {}), "(['GET'])\n", (947, 956), False, 'from django.views.decorators.http import require_http_methods\n'), ((1057, 1094), 'django.views.decorators.http.require_http_methods', 'require_http_methods', (["['POST', 'GET...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2019/8/1 @Author : AnNing 功能: 1、计算G0、Gt、DNI 2、补全缺失的整点时次数据的Itol、Ib、Id 优化 1、修改为矩阵运算 2、优化assignE 3、DEBUG函数assignTime,原来的函数直接在hour加8可能超过24 """ import os import h5py import numpy as np from dateutil.relativedelta import relativedelta from lib.lib_constant impo...
[ "numpy.radians", "dateutil.relativedelta.relativedelta", "numpy.isfinite", "numpy.nanmin", "os.remove", "numpy.where", "os.path.isdir", "numpy.nanmax", "lib.lib_database.add_result_data", "lib.lib_database.exist_result_data", "lib.lib_read_ssi.FY4ASSI.get_latitude_4km", "os.path.isfile", "os...
[((1790, 1812), 'dateutil.relativedelta.relativedelta', 'relativedelta', ([], {'hours': '(8)'}), '(hours=8)\n', (1803, 1812), False, 'from dateutil.relativedelta import relativedelta\n'), ((2206, 2224), 'numpy.loadtxt', 'np.loadtxt', (['e_file'], {}), '(e_file)\n', (2216, 2224), True, 'import numpy as np\n'), ((2280, 2...
import numpy as np from torch.utils.data import Dataset from pathlib import Path from pytorch_lightning.callbacks import Callback from ..models.base import SegmentationModel from ..image_process.convert import cv_to_pil, to_4dim, tensor_to_cv, normalize255 class GenerateSegmentationImageCallback(Callback): def _...
[ "numpy.random.randint", "pathlib.Path" ]
[((1554, 1584), 'numpy.random.randint', 'np.random.randint', (['(0)', 'data_len'], {}), '(0, data_len)\n', (1571, 1584), True, 'import numpy as np\n'), ((710, 732), 'pathlib.Path', 'Path', (['self._output_dir'], {}), '(self._output_dir)\n', (714, 732), False, 'from pathlib import Path\n'), ((755, 777), 'pathlib.Path', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 22 11:24:01 2021 @author: ja17375 """ import pygmt import numpy as np import pandas as pd import xarray as xr import netCDF4 as nc def plot_forte_gmt(): tx2008 = np.loadtxt('/Users/ja17375/SWSTomo/ForteModels/Flow_Models/TX2008/forteV2_1deg_15...
[ "pandas.read_csv", "numpy.flipud", "netCDF4.Dataset", "numpy.array", "numpy.zeros", "numpy.linspace", "pygmt.Figure", "numpy.ravel", "numpy.meshgrid", "numpy.loadtxt" ]
[((239, 339), 'numpy.loadtxt', 'np.loadtxt', (['"""/Users/ja17375/SWSTomo/ForteModels/Flow_Models/TX2008/forteV2_1deg_150km.txt"""'], {}), "(\n '/Users/ja17375/SWSTomo/ForteModels/Flow_Models/TX2008/forteV2_1deg_150km.txt'\n )\n", (249, 339), True, 'import numpy as np\n'), ((1045, 1059), 'pygmt.Figure', 'pygmt.Fi...
import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.colors import LogNorm import numpy as np data = np.zeros((100, 100)) adder = np.abs(np.random.randn(40, 40)) center = adder / np.max(adder) data[20:60, 20:60] = center plt.imshow(data, cmap=cm.seismic) plt.colorbar() plt.show()
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.colorbar", "numpy.max", "numpy.zeros", "numpy.random.randn", "matplotlib.pyplot.show" ]
[((125, 145), 'numpy.zeros', 'np.zeros', (['(100, 100)'], {}), '((100, 100))\n', (133, 145), True, 'import numpy as np\n'), ((246, 279), 'matplotlib.pyplot.imshow', 'plt.imshow', (['data'], {'cmap': 'cm.seismic'}), '(data, cmap=cm.seismic)\n', (256, 279), True, 'import matplotlib.pyplot as plt\n'), ((280, 294), 'matplo...
from torch.utils.data import Dataset from PIL import Image import os import torch import numpy as np # from scipy.io import loadmat from torchvision import transforms class PennAction(Dataset): ''' Generated samples will be saved in a Dict. Keys: image : image arry label: keypoints x and y rot...
[ "matplotlib.pyplot.imshow", "PIL.Image.open", "os.listdir", "torch.as_tensor", "torch.stack", "os.path.join", "numpy.asarray", "matplotlib.pyplot.figure", "numpy.random.randint", "os.path.abspath", "numpy.load", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show" ]
[((3546, 3574), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (3556, 3574), True, 'import matplotlib.pyplot as plt\n'), ((3913, 3923), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3921, 3923), True, 'import matplotlib.pyplot as plt\n'), ((1824, 1842), 'torc...
# -*- coding: utf-8 -*- import time import warnings from itertools import cycle, islice from sklearn.cluster import MiniBatchKMeans from sklearn.mixture import GaussianMixture from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing import StandardScaler from sklearn.neighbors impor...
[ "torchmm.hmm.HiddenMarkovModel", "sklearn.cluster.SpectralClustering", "numpy.random.rand", "sklearn.neighbors.kneighbors_graph", "sklearn.datasets.make_circles", "sklearn.cluster.MeanShift", "sklearn.cluster.DBSCAN", "sklearn.cluster.AgglomerativeClustering", "sklearn.datasets.make_blobs", "numpy...
[((750, 770), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (764, 770), True, 'import numpy as np\n'), ((772, 795), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (789, 795), False, 'import torch\n'), ((736, 747), 'time.time', 'time.time', ([], {}), '()\n', (745, 747), False,...
import numpy as np import gym from gym.spaces import Box import pdb class AtariPreprocessing(gym.Wrapper): r"""Atari 2600 preprocessings. This class follows the guidelines in Machado et al. (2018), "Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents...
[ "lz4.block.compress", "collections.deque", "numpy.repeat", "numpy.asarray", "gym.spaces.Box", "numpy.stack", "numpy.empty", "lz4.block.decompress", "numpy.maximum", "cv2.resize" ]
[((4521, 4623), 'cv2.resize', 'cv2.resize', (['self.obs_buffer[0]', '(self.screen_size, self.screen_size)'], {'interpolation': 'cv2.INTER_AREA'}), '(self.obs_buffer[0], (self.screen_size, self.screen_size),\n interpolation=cv2.INTER_AREA)\n', (4531, 4623), False, 'import cv2\n'), ((4634, 4665), 'numpy.asarray', 'np....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 22 09:34:05 2020 @author: didi """ import collections import numpy as np import tensorflow as tf import gym import random import copy import os import sys from peal.utils.epsilon_decay import linearly_decaying_epsilon from peal.replay_buffers.rep...
[ "tensorflow.losses.Huber", "tensorflow.GradientTape", "tensorflow.keras.layers.Dense", "copy.deepcopy", "tensorflow.cast", "gym.make", "numpy.mean", "tensorflow.keras.optimizers.schedules.InverseTimeDecay", "numpy.max", "tensorflow.math.reduce_mean", "tensorflow.clip_by_value", "tensorflow.los...
[((458, 571), 'collections.namedtuple', 'collections.namedtuple', (['"""cross_entropy_network"""', "['q_values', 'target_policy_probs', 'behavior_policy_probs']"], {}), "('cross_entropy_network', ['q_values',\n 'target_policy_probs', 'behavior_policy_probs'])\n", (480, 571), False, 'import collections\n'), ((928, 98...
import numpy as np import matplotlib.pylab as plt import sys def run(): visualizeTarget = sys.argv[1] print(visualizeTarget) if(visualizeTarget=='step'): x=np.arange(-5.0,5.0,0.1) y=step(x) plt.plot(x,y) plt.ylim(-0.1,1.1) plt.show() elif(visualizeTarget=='s...
[ "matplotlib.pylab.ylim", "numpy.ndim", "numpy.exp", "numpy.array", "numpy.dot", "numpy.sum", "matplotlib.pylab.show", "matplotlib.pylab.plot", "numpy.maximum", "numpy.arange" ]
[((1188, 1213), 'numpy.array', 'np.array', (['[2, 3, 1, 4, 2]'], {}), '([2, 3, 1, 4, 2])\n', (1196, 1213), True, 'import numpy as np\n'), ((1735, 1753), 'numpy.array', 'np.array', (['[x1, x2]'], {}), '([x1, x2])\n', (1743, 1753), True, 'import numpy as np\n'), ((1759, 1779), 'numpy.array', 'np.array', (['[0.5, 0.5]'], ...
# -*- coding: utf-8 -*- """ Author: <NAME> Version: 2019-10-03 """ import numpy as np from scipy.linalg import expm #from pykalman import KalmanFilter as KF if (__name__ == '__main__'): import config else: import myModules.config as config class EKF: def __init__(self, point_reactor, tstep): s...
[ "numpy.diag", "numpy.array", "scipy.linalg.expm", "numpy.zeros", "numpy.dot" ]
[((539, 578), 'numpy.zeros', 'np.zeros', (['self.point_reactor.state_dims'], {}), '(self.point_reactor.state_dims)\n', (547, 578), True, 'import numpy as np\n'), ((2951, 2996), 'numpy.zeros', 'np.zeros', (['([self.point_reactor.state_dims] * 2)'], {}), '([self.point_reactor.state_dims] * 2)\n', (2959, 2996), True, 'imp...
# -*- coding: utf-8 -*- """ This file contains a class which handles the `teili` / `brian2` side of the high-level network compiler to the ORCA processor. The ORCA processor is described [here](https://www.frontiersin.org/articles/10.3389/fnins.2018.00213/full). A documentation on `teili` can be found [here](https://t...
[ "os.path.exists", "collections.OrderedDict", "numpy.mean", "pickle.dump", "os.makedirs", "pickle.load", "os.path.join", "numpy.std", "os.path.expanduser" ]
[((4598, 4623), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (4621, 4623), False, 'import collections\n'), ((10282, 10315), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filename)\n', (10294, 10315), False, 'import os\n'), ((10428, 10461), 'os.path.join', 'os.p...