code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import os
import cv2
import copy
import numpy as np
import torch
import matplotlib.pyplot as plt
from tqdm import tqdm
from config import system_configs
import math
import external.nms as nms
def _rescale_points(dets, ratios, borders, sizes):
xs, ys = dets[:, :, 0], dets[:, :, 1]
xs += borders[0, 2]
ys ... | [
"numpy.clip",
"cv2.imwrite",
"matplotlib.pyplot.savefig",
"math.ceil",
"cv2.resize",
"math.floor",
"matplotlib.pyplot.Axes",
"torch.from_numpy",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"torch.cuda.is_available",
"copy.deepcopy",
"torch.no_grad... | [((390, 425), 'numpy.clip', 'np.clip', (['xs', '(0)', 'sizes[0, 1]'], {'out': 'xs'}), '(xs, 0, sizes[0, 1], out=xs)\n', (397, 425), True, 'import numpy as np\n'), ((430, 465), 'numpy.clip', 'np.clip', (['ys', '(0)', 'sizes[0, 0]'], {'out': 'ys'}), '(ys, 0, sizes[0, 0], out=ys)\n', (437, 465), True, 'import numpy as np\... |
import numpy as np
from scipy.signal import iirnotch, firwin, filtfilt, lfilter, freqz
from matplotlib import pyplot as plt
import nibabel as nb
import subprocess
import math
def add_afni_prefix(tpattern):
if tpattern:
if ".txt" in tpattern:
tpattern = "@{0}".format(tpattern)
return tpatte... | [
"subprocess.check_output",
"numpy.mean",
"matplotlib.pyplot.savefig",
"nibabel.load",
"scipy.signal.firwin",
"scipy.signal.iirnotch",
"numpy.floor",
"numpy.diff",
"numpy.loadtxt",
"scipy.signal.lfilter",
"numpy.savetxt",
"scipy.signal.freqz",
"matplotlib.pyplot.subplots",
"numpy.divide"
] | [((590, 608), 'nibabel.load', 'nb.load', (['func_file'], {}), '(func_file)\n', (597, 608), True, 'import nibabel as nb\n'), ((3832, 3857), 'numpy.loadtxt', 'np.loadtxt', (['motion_params'], {}), '(motion_params)\n', (3842, 3857), True, 'import numpy as np\n'), ((5890, 5918), 'scipy.signal.freqz', 'freqz', (['b_filt', '... |
# Carl is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
import numpy as np
import theano.tensor as T
import theano.sandbox.linalg as linalg
from sklearn.utils import check_random_state
from . import TheanoDistribution
from .... | [
"theano.tensor.exp",
"sklearn.utils.check_random_state",
"numpy.sqrt",
"theano.sandbox.linalg.matrix_inverse",
"theano.sandbox.linalg.det",
"theano.tensor.abs_",
"theano.tensor.erfinv",
"theano.sandbox.linalg.cholesky",
"theano.tensor.log",
"theano.tensor.dot"
] | [((2187, 2214), 'theano.sandbox.linalg.cholesky', 'linalg.cholesky', (['self.sigma'], {}), '(self.sigma)\n', (2202, 2214), True, 'import theano.sandbox.linalg as linalg\n'), ((2235, 2257), 'theano.sandbox.linalg.det', 'linalg.det', (['self.sigma'], {}), '(self.sigma)\n', (2245, 2257), True, 'import theano.sandbox.linal... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import ctypes
import numpy
import warnings
from nidaqmx._lib import (
lib_importer, wrapped_ndpointer, ctypes_byte_str, c_bool32)
from nidaqmx.err... | [
"nidaqmx.errors.check_for_error",
"nidaqmx.utils.flatten_channel_string",
"ctypes.byref",
"ctypes.POINTER",
"nidaqmx.errors.is_string_buffer_too_small",
"nidaqmx.system._watchdog_modules.expiration_state.ExpirationState",
"numpy.float64",
"nidaqmx._lib.wrapped_ndpointer",
"nidaqmx.constants.Edge",
... | [((2444, 2471), 'nidaqmx._lib.lib_importer.task_handle', 'lib_importer.task_handle', (['(0)'], {}), '(0)\n', (2468, 2471), False, 'from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str, c_bool32\n'), ((2964, 2991), 'nidaqmx.errors.check_for_error', 'check_for_error', (['error_code'], {}), '(error_co... |
import numpy as np
import scipy.sparse as ssp
import torch
from beta_rec.models.torch_engine import ModelEngine
from beta_rec.utils.common_util import timeit
def top_k(values, k, exclude=[]):
"""Return the indices of the k items with the highest value in the list of values.
Exclude the ids from the list "ex... | [
"torch.tensor",
"numpy.zeros",
"numpy.ones"
] | [((3752, 3772), 'torch.tensor', 'torch.tensor', (['scores'], {}), '(scores)\n', (3764, 3772), False, 'import torch\n'), ((716, 726), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (723, 726), True, 'import numpy as np\n'), ((734, 745), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (742, 745), True, 'import numpy as ... |
import numpy as np
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from sklearn.model_selection import train_test_split
from torch import nn
from torch.nn import functional as F
from transformers import BertTokenizer, BertConfig, BertModel
class BertTex... | [
"torch.nn.Dropout",
"torch.as_tensor",
"numpy.ones",
"sklearn.model_selection.train_test_split",
"pytorch_lightning.callbacks.early_stopping.EarlyStopping",
"transformers.BertTokenizer.from_pretrained",
"transformers.BertModel.from_pretrained",
"numpy.argsort",
"numpy.array",
"torch.nn.functional.... | [((4739, 4789), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X'], {'test_size': '(0.2)', 'random_state': '(1)'}), '(X, test_size=0.2, random_state=1)\n', (4755, 4789), False, 'from sklearn.model_selection import train_test_split\n'), ((4812, 4871), 'sklearn.model_selection.train_test_split', 'trai... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 26 18:17:56 2021
@author: rringuet
Convert data in CTIPe output files to wrapped versions
"""
#import numpy as np
from numpy import transpose, zeros, array, append
from time import perf_counter
from netCDF4 import Dataset
from astropy.constants import R_earth
... | [
"netCDF4.Dataset",
"time.perf_counter",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.transpose"
] | [((5938, 5952), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (5950, 5952), False, 'from time import perf_counter\n'), ((6240, 6265), 'netCDF4.Dataset', 'Dataset', (['filename_density'], {}), '(filename_density)\n', (6247, 6265), False, 'from netCDF4 import Dataset\n'), ((6286, 6310), 'netCDF4.Dataset', 'Datas... |
import os
import numpy as np
SPEECH_DATA_PATH = './../Data_Clean'
DUMP_DATA_PATH = './../Data_Clean/Filtered_Dev'
train_y = np.load(os.path.join(SPEECH_DATA_PATH, 'train_transcripts.npy'),
encoding='bytes')
dev_y = np.load(os.path.join(SPEECH_DATA_PATH, 'dev_transcripts.npy'),
encod... | [
"numpy.array_equal",
"numpy.delete",
"os.path.join"
] | [((597, 623), 'numpy.delete', 'np.delete', (['dev_y', 'dup_list'], {}), '(dev_y, dup_list)\n', (606, 623), True, 'import numpy as np\n'), ((636, 662), 'numpy.delete', 'np.delete', (['dev_x', 'dup_list'], {}), '(dev_x, dup_list)\n', (645, 662), True, 'import numpy as np\n'), ((135, 190), 'os.path.join', 'os.path.join', ... |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"numpy.random.choice",
"numpy.random.random",
"hypothesis.strategies.integers",
"caffe2.python.core.CreateOperator"
] | [((1118, 1197), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Conditional"""', "['condition', 'data_t', 'data_f']", '"""output"""'], {}), "('Conditional', ['condition', 'data_t', 'data_f'], 'output')\n", (1137, 1197), False, 'from caffe2.python import core\n'), ((1386, 1434), 'numpy.random.choice', ... |
# HDF5DatasetGenerator.py
import h5py
import numpy as np
from tensorflow.keras.utils import to_categorical
class HDF5DatasetGenerator:
'''
Use to generate a dataset for use withing keras framework
form a HDF5 file.
'''
def __init__(self, dbPath, batchSize, preprocessors = None,
aug = None... | [
"numpy.array",
"tensorflow.keras.utils.to_categorical",
"numpy.arange",
"h5py.File"
] | [((848, 865), 'h5py.File', 'h5py.File', (['dbPath'], {}), '(dbPath)\n', (857, 865), False, 'import h5py\n'), ((1233, 1277), 'numpy.arange', 'np.arange', (['(0)', 'self.numImages', 'self.batchSize'], {}), '(0, self.numImages, self.batchSize)\n', (1242, 1277), True, 'import numpy as np\n'), ((1610, 1646), 'tensorflow.ker... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 10 09:59:15 2020
@author: <NAME>
"""
import os
import pandas as pd
import numpy as np
out = open("./res.txt", 'w+')
#%% 读取生成式 @表示为空
generator = {}
start = None #开始符号
ter_set = set() #终结符集合
non_set = set() #非终结符集合
all_set = set()
#grammar2
f = open('./tiny.txt')
for ... | [
"pandas.DataFrame",
"numpy.isnan"
] | [((4096, 4142), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'ter_list', 'index': 'non_list'}), '(columns=ter_list, index=non_list)\n', (4108, 4142), True, 'import pandas as pd\n'), ((5743, 5788), 'numpy.isnan', 'np.isnan', (['ll1_table.loc[stack[-1], tokens[0]]'], {}), '(ll1_table.loc[stack[-1], tokens[0]])\n'... |
# Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"numpy.prod",
"tensorflow.compat.v1.ones_like",
"horovod.tensorflow.rank",
"horovod.tensorflow.broadcast_global_variables",
"numpy.array",
"tensorflow.compat.v1.losses.mean_squared_error",
"tensorflow.compat.v1.device",
"tensorflow.compat.v1.nn.l2_loss",
"horovod.tensorflow.local_rank",
"tensorflo... | [((917, 963), 'functools.partial', 'functools.partial', (['tfkl.Conv2D'], {'padding': '"""same"""'}), "(tfkl.Conv2D, padding='same')\n", (934, 963), False, 'import functools\n'), ((2057, 2133), 'collections.namedtuple', 'collections.namedtuple', (['"""TrainInput"""', '"""observation legals_mask policy value"""'], {}), ... |
#!/usr/bin/env python
"""
Test module for level set transport
"""
from __future__ import print_function
from builtins import range
from builtins import object
from proteus.iproteus import *
import os
import numpy as np
import tables
class TestRotation2D(object):
@classmethod
def setup_class(cls):
pass... | [
"os.path.exists",
"os.path.join",
"tables.open_file",
"numpy.array",
"os.path.abspath",
"os.remove"
] | [((2853, 2906), 'tables.open_file', 'tables.open_file', (["(ls_rotation_2d_so.name + '.h5')", '"""r"""'], {}), "(ls_rotation_2d_so.name + '.h5', 'r')\n", (2869, 2906), False, 'import tables\n'), ((484, 509), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (499, 509), False, 'import os\n'), ((5... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import logging
import numpy as np
from matrixprofile impo... | [
"logging.getLogger",
"matrixprofile.core.clean_nan_inf",
"matrixprofile.core.apply_exclusion_zone",
"numpy.sqrt",
"numpy.argsort",
"matrixprofile.core.distance_profile",
"numpy.sort",
"numpy.empty",
"matrixprofile.core.fft_convolve",
"matrixprofile.core.get_profile_length",
"matrixprofile.core.t... | [((338, 365), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (355, 365), False, 'import logging\n'), ((2657, 2699), 'numpy.full', 'np.full', (['(num_dim, profile_length)', 'np.inf'], {}), '((num_dim, profile_length), np.inf)\n', (2664, 2699), True, 'import numpy as np\n'), ((2720, 2757), ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 13:05:28 2018:
在版本3的基础上,根据pandas的join方法来求交集
根据从量表中筛选的样本,来获得符合要求的原始数据的路径
数据结构neuroimageDataPath//subject00001//files
也可以是任何的数据结构,只要给定subjName在哪里就行
总之,最后把file复制到其他地方(可以给每个subject限定某个符合条件file,比如以'.nii'结尾的file)
input:
# reference_file:需要复制的被试名字所在text文件(大表中的uid)
... | [
"pandas.read_csv",
"multiprocessing.cpu_count",
"pandas.read_excel",
"sys.exit",
"sys.path.append",
"os.walk",
"pandas.unique",
"os.path.exists",
"shutil.move",
"pandas.DataFrame",
"time.localtime",
"os.path.dirname",
"shutil.copy",
"numpy.shape",
"time.time",
"pandas.Series",
"numpy... | [((1610, 1720), 'sys.path.append', 'sys.path.append', (['"""D:\\\\My_Codes\\\\LC_Machine_Learning\\\\lc_rsfmri_tools\\\\lc_rsfmri_tools_python\\\\Utils"""'], {}), "(\n 'D:\\\\My_Codes\\\\LC_Machine_Learning\\\\lc_rsfmri_tools\\\\lc_rsfmri_tools_python\\\\Utils'\n )\n", (1625, 1720), False, 'import sys\n'), ((4899... |
from __future__ import print_function
import torch
import torch.optim as optim
from data.data_loader import CreateDataLoader
import tqdm
import cv2
import yaml
from schedulers import WarmRestart, LinearDecay
import numpy as np
from models.networks import get_nets
from models.losses import get_loss
from models.models i... | [
"logging.basicConfig",
"numpy.mean",
"cv2.setNumThreads",
"models.networks.get_nets",
"tensorboardX.SummaryWriter",
"logging.debug",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"tqdm.tqdm",
"yaml.load",
"models.losses.get_loss",
"schedulers.LinearDecay",
"schedulers.WarmRestart",
"data.dat... | [((391, 451), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""res.log"""', 'level': 'logging.DEBUG'}), "(filename='res.log', level=logging.DEBUG)\n", (410, 451), False, 'import logging\n'), ((460, 485), 'tensorboardX.SummaryWriter', 'SummaryWriter', (['"""res_runs"""'], {}), "('res_runs')\n", (473, ... |
'''
Author: <NAME>
Created Date: 2021-06-20
Last Modified: 2021-06-29
content:
'''
import os
import os.path as osp
from collections import OrderedDict
from functools import reduce
import mmcv
import numpy as np
from mmcv.utils import print_log
from prettytable import PrettyTable
from torch.utils.data import Dataset
... | [
"prettytable.PrettyTable",
"os.path.isabs",
"numpy.unique",
"mmcv.utils.print_log",
"mmseg.core.my_eval_metrics",
"os.path.join",
"mmcv.is_list_of",
"numpy.round",
"os.remove"
] | [((6447, 6596), 'mmseg.core.my_eval_metrics', 'my_eval_metrics', (['results', 'gt_seg_maps', 'num_classes', 'self.ignore_index', 'metric'], {'label_map': 'self.label_map', 'reduce_zero_label': 'self.reduce_zero_label'}), '(results, gt_seg_maps, num_classes, self.ignore_index,\n metric, label_map=self.label_map, redu... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016-2018 <NAME>, SMBYC
# Email: xcorredorl at ideam.gov.co
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | [
"numpy.nanpercentile",
"dask.array.map_blocks",
"numpy.argsort",
"numpy.array",
"numpy.nanmean",
"numpy.nanmin",
"numpy.stack",
"numpy.nanmax",
"numpy.nanstd",
"numpy.full",
"dask.array.empty",
"numpy.nanprod",
"numpy.isnan",
"numpy.ma.cov",
"numpy.median",
"numpy.nanmedian",
"numpy.... | [((652, 699), 'dask.array.empty', 'da.empty', (['Image.wrapper_shape'], {'chunks': 'chunksize'}), '(Image.wrapper_shape, chunks=chunksize)\n', (660, 699), True, 'import dask.array as da\n'), ((7581, 7683), 'dask.array.map_blocks', 'da.map_blocks', (['calc', 'wrapper_array'], {'chunks': 'wrapper_array.chunks', 'chunksiz... |
# ------------------------------------------------------------------------------
# Program: The LDAR Simulator (LDAR-Sim)
# File: methods.deployment.GHGSat1
# Purpose: GHGSat1 company specific deployment classes and methods
#
# Copyright (C) 2018-2021 Intelligent Methane Monitoring and Management System... | [
"random.choice",
"utils.generic_functions.geo_idx",
"numpy.float16"
] | [((1445, 1468), 'numpy.float16', 'np.float16', (["site['lat']"], {}), "(site['lat'])\n", (1455, 1468), True, 'import numpy as np\n'), ((1484, 1507), 'numpy.float16', 'np.float16', (["site['lon']"], {}), "(site['lon'])\n", (1494, 1507), True, 'import numpy as np\n'), ((1522, 1571), 'utils.generic_functions.geo_idx', 'ge... |
import pytest
from hyperloop.Python import magnetic_drag
import numpy as np
from openmdao.api import Group, Problem
def create_problem(magdrag):
root = Group()
prob = Problem(root)
prob.root.add('comp', magdrag)
return prob
class TestVac(object):
def test_case1_vs_breakpoint(self):
magd... | [
"hyperloop.Python.magnetic_drag.MagDrag",
"numpy.isclose",
"openmdao.api.Problem",
"openmdao.api.Group"
] | [((158, 165), 'openmdao.api.Group', 'Group', ([], {}), '()\n', (163, 165), False, 'from openmdao.api import Group, Problem\n'), ((177, 190), 'openmdao.api.Problem', 'Problem', (['root'], {}), '(root)\n', (184, 190), False, 'from openmdao.api import Group, Problem\n'), ((326, 349), 'hyperloop.Python.magnetic_drag.MagDra... |
import itertools
import logging
import os.path as osp
import tempfile
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from .builder import DATASETS
from .coco import CocoDataset
# DATASETS.register_module(name='LVISDataset', module=LVISDataset)
# LVISDataset = LVISV05Datas... | [
"itertools.chain",
"tempfile.TemporaryDirectory",
"lvis.LVIS",
"lvis.LVISEval",
"numpy.mean",
"mmcv.utils.print_log",
"os.path.join",
"numpy.array",
"numpy.zeros",
"lvis.LVISResults",
"terminaltables.AsciiTable",
"numpy.arange"
] | [((20183, 20197), 'lvis.LVIS', 'LVIS', (['ann_file'], {}), '(ann_file)\n', (20187, 20197), False, 'from lvis import LVIS\n'), ((24173, 24199), 'numpy.arange', 'np.arange', (['(0.5)', '(0.96)', '(0.05)'], {}), '(0.5, 0.96, 0.05)\n', (24182, 24199), True, 'import numpy as np\n'), ((23239, 23276), 'numpy.array', 'np.array... |
# Copyright 2018 The Cirq Developers
#
# 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 agreed to in ... | [
"numpy.sqrt",
"cirq.testing.random_unitary",
"numpy.diag",
"numpy.kron",
"numpy.array",
"cmath.exp",
"numpy.zeros",
"numpy.empty",
"pytest.raises",
"cirq.linalg.matrix_commutes",
"cirq.testing.random_density_matrix",
"cirq.slice_for_qubits_equal_to"
] | [((13289, 13315), 'numpy.array', 'np.array', (['[[0, 1], [1, 0]]'], {}), '([[0, 1], [1, 0]])\n', (13297, 13315), True, 'import numpy as np\n'), ((13324, 13357), 'numpy.array', 'np.array', (['[[0, -1.0j], [1.0j, 0]]'], {}), '([[0, -1.0j], [1.0j, 0]])\n', (13332, 13357), True, 'import numpy as np\n'), ((13362, 13389), 'n... |
#-*- coding:utf-8 -*-
import torch
from torchvision import transforms
import cv2
from PIL import Image, ImageOps
import numpy as np
import pickle
from torchvision.datasets import VisionDataset
from torchvision.datasets.folder import default_loader,make_dataset,IMG_EXTENSIONS
from pycocotools.coco import COCO
import os
... | [
"torchvision.transforms.ToPILImage",
"torch.LongTensor",
"torchvision.transforms.ColorJitter",
"numpy.array",
"pycocotools.coco.COCO",
"torchvision.transforms.ToTensor",
"torchvision.datasets.folder.make_dataset",
"pickle.load",
"PIL.ImageOps.solarize",
"torchvision.transforms.Normalize",
"torch... | [((6391, 6433), 'torchvision.transforms.ColorJitter', 'transforms.ColorJitter', (['(0.4)', '(0.4)', '(0.2)', '(0.1)'], {}), '(0.4, 0.4, 0.2, 0.1)\n', (6413, 6433), False, 'from torchvision import transforms\n'), ((6450, 6525), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.4... |
from __future__ import absolute_import, print_function, division
import numpy as np
from numba import vectorize
from numba import ocl, float64
from numba import unittest_support as unittest
from numba import config
from numba.ocl.testing import OCLTestCase
sig = [float64(float64, float64)]
target='ocl'
class TestO... | [
"numba.unittest_support.main",
"numba.vectorize",
"numba.float64",
"numba.ocl.to_device",
"numpy.arange"
] | [((265, 290), 'numba.float64', 'float64', (['float64', 'float64'], {}), '(float64, float64)\n', (272, 290), False, 'from numba import ocl, float64\n'), ((802, 817), 'numba.unittest_support.main', 'unittest.main', ([], {}), '()\n', (815, 817), True, 'from numba import unittest_support as unittest\n'), ((406, 435), 'numb... |
"""
Copyright 2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed... | [
"numpy.tan",
"datetime.datetime.strptime",
"numpy.size",
"pandas.DataFrame",
"datetime.timedelta",
"pandas.concat",
"pandas.date_range"
] | [((1174, 1230), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_start', '"""%Y-%m-%dT%H:%M"""'], {}), "(date_start, '%Y-%m-%dT%H:%M')\n", (1200, 1230), False, 'import datetime\n'), ((1340, 1394), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_end', '"""%Y-%m-%dT%H:%M"""'], {}), ... |
#!/usr/bin/env python3
import sys
import numpy as np
from badgyal.policy_index import policy_index
columns = 'abcdefgh'
rows = '12345678'
promotions = 'rbq' # N is encoded as normal move
col_index = {columns[i] : i for i in range(len(columns))}
row_index = {rows[i] : i for i in range(len(rows))}
def index_to_positio... | [
"numpy.sum",
"badgyal.policy_index.policy_index.index"
] | [((3307, 3328), 'badgyal.policy_index.policy_index.index', 'policy_index.index', (['m'], {}), '(m)\n', (3325, 3328), False, 'from badgyal.policy_index import policy_index\n'), ((3439, 3456), 'numpy.sum', 'np.sum', (['az_to_lc0'], {}), '(az_to_lc0)\n', (3445, 3456), True, 'import numpy as np\n')] |
# MIT License
#
# Copyright (C) IBM Corporation 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | [
"logging.getLogger",
"art.utils.load_mnist",
"art.classifiers.KerasClassifier",
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"numpy.unique",
"keras.models.Sequential",
"keras.layers.Dense",
"art.utils.master_seed",
"keras.layers.Dropout",
"unittest.main",
"nump... | [((1522, 1553), 'logging.getLogger', 'logging.getLogger', (['"""testLogger"""'], {}), "('testLogger')\n", (1539, 1553), False, 'import logging\n'), ((7169, 7184), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7182, 7184), False, 'import unittest\n'), ((1823, 1835), 'art.utils.load_mnist', 'load_mnist', ([], {}),... |
# はじめてのNumPy
# 参考 http://qiita.com/wellflat/items/284ecc4116208d155e01
# 2016/1/16
import numpy as np
a = np.array([[1,2,3], [4,5,6], [7,8,9], [10,11,12]])
print(a)
print(a.flags)
# C_CONTIGUOUS : True ## データがメモリ上に連続しているか(C配列型)
# F_CONTIGUOUS : False ## 同上(Fortran配列型)
# OWNDATA : True ## 自分のデータかどうか、ビュー... | [
"numpy.array"
] | [((108, 165), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])\n', (116, 165), True, 'import numpy as np\n')] |
import numpy as np
km2 = np.array([44410., 5712., 37123., 0., 25757.])
anos2 = np.array([2003, 1991, 1990, 2019, 2006])
idade = 2019 - anos2
km_media = km2 / idade
| [
"numpy.array"
] | [((26, 76), 'numpy.array', 'np.array', (['[44410.0, 5712.0, 37123.0, 0.0, 25757.0]'], {}), '([44410.0, 5712.0, 37123.0, 0.0, 25757.0])\n', (34, 76), True, 'import numpy as np\n'), ((80, 120), 'numpy.array', 'np.array', (['[2003, 1991, 1990, 2019, 2006]'], {}), '([2003, 1991, 1990, 2019, 2006])\n', (88, 120), True, 'imp... |
import numpy as np
from scipy.signal import hilbert
from PyEMD.compact import filt6, pade6
# Visualisation is an optional module. To minimise installation, `matplotlib` is not added
# by default. Please install extras with `pip install -r requirement-extra.txt`.
try:
import pylab as plt
except ImportError:
pa... | [
"PyEMD.compact.filt6",
"PyEMD.compact.pade6",
"pylab.tight_layout",
"numpy.diff",
"numpy.angle",
"numpy.array",
"numpy.cos",
"numpy.sin",
"pylab.subplots",
"scipy.signal.hilbert",
"PyEMD.EMD",
"numpy.arange",
"pylab.show"
] | [((5626, 5647), 'numpy.arange', 'np.arange', (['(0)', '(3)', '(0.01)'], {}), '(0, 3, 0.01)\n', (5635, 5647), True, 'import numpy as np\n'), ((5715, 5720), 'PyEMD.EMD', 'EMD', ([], {}), '()\n', (5718, 5720), False, 'from PyEMD import EMD\n'), ((1818, 1912), 'pylab.subplots', 'plt.subplots', (['num_rows', '(1)'], {'figsi... |
import random
import numpy as np
import threading
import multiprocessing
def TestSquare(square, color):
for y in range(len(square)):
for x in range(len(square[y])):
if square[y][x] != color:
return False
return True
def TestRug(num, dimensions, squareSize, col... | [
"multiprocessing.Manager",
"numpy.zeros",
"random.randint",
"multiprocessing.Pool"
] | [((383, 423), 'numpy.zeros', 'np.zeros', (['(dimensions[0], dimensions[1])'], {}), '((dimensions[0], dimensions[1]))\n', (391, 423), True, 'import numpy as np\n'), ((1886, 1930), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'maxProcesses'}), '(processes=maxProcesses)\n', (1906, 1930), False, 'impo... |
import numpy as np
from sparc.videoprocessing.processing import Processing
from sparc.videoprocessing.lkopticalflow import LKOpticalFlow
from opencmiss.zinc.scenecoordinatesystem import SCENECOORDINATESYSTEM_LOCAL, \
SCENECOORDINATESYSTEM_WINDOW_PIXEL_TOP_LEFT
from opencmiss.zinc.field import FieldFindMeshLocati... | [
"json.loads",
"sparc.videoprocessing.processing.Processing",
"numpy.asarray",
"sparc.videoprocessing.lkopticalflow.LKOpticalFlow"
] | [((636, 648), 'sparc.videoprocessing.processing.Processing', 'Processing', ([], {}), '()\n', (646, 648), False, 'from sparc.videoprocessing.processing import Processing\n'), ((680, 720), 'sparc.videoprocessing.lkopticalflow.LKOpticalFlow', 'LKOpticalFlow', ([], {'win': '(20, 20)', 'max_level': '(2)'}), '(win=(20, 20), ... |
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import torch
import pytest
import torch.nn.functional as F
from op_tester import op_tester
# `import test_util` requires adding to sys.path
import sys
from pathlib import Path
sys.path.append(Path(__file__).resolve().parent.paren... | [
"numpy.random.rand",
"pathlib.Path",
"op_tester.op_tester.setPatterns",
"op_tester.op_tester.run",
"torch.tensor",
"pytest.mark.parametrize",
"popart.reservedGradientPrefix",
"pytest.raises",
"torch.isnan"
] | [((2531, 2579), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""in_infos"""', 'input_infos'], {}), "('in_infos', input_infos)\n", (2554, 2579), False, 'import pytest\n'), ((1155, 1241), 'op_tester.op_tester.setPatterns', 'op_tester.setPatterns', (["['PreUniRepl', 'MulArgGradOp']"], {'enableRuntimeAsserts': ... |
# -*- coding: utf-8 -*-
#
# Copyright 2019-2020 Data61, CSIRO
#
# 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 ... | [
"random.sample",
"collections.namedtuple",
"networkx.MultiDiGraph",
"stellargraph.core.schema.EdgeType",
"numpy.asarray",
"networkx.MultiGraph",
"numpy.zeros",
"numpy.empty",
"networkx.to_scipy_sparse_matrix",
"numpy.vstack",
"collections.defaultdict"
] | [((1144, 1197), 'collections.namedtuple', 'namedtuple', (['"""NeighbourWithWeight"""', "['node', 'weight']"], {}), "('NeighbourWithWeight', ['node', 'weight'])\n", (1154, 1197), False, 'from collections import defaultdict, namedtuple\n'), ((4335, 4354), 'numpy.zeros', 'np.zeros', (['data_size'], {}), '(data_size)\n', (... |
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense, GlobalAveragePooling2D
from keras import backend as k
from keras.callbacks import ModelCheckpoint, LearningRat... | [
"cv2.imread",
"keras.layers.Flatten",
"keras.callbacks.ModelCheckpoint",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"keras.optimizers.SGD",
"keras.applications.vgg16.preprocess_input",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"numpy.expand_dims",
"keras.layers.... | [((688, 790), 'keras.applications.VGG16', 'applications.VGG16', ([], {'weights': '"""imagenet"""', 'include_top': '(False)', 'input_shape': '(img_width, img_height, 3)'}), "(weights='imagenet', include_top=False, input_shape=(\n img_width, img_height, 3))\n", (706, 790), False, 'from keras import applications\n'), (... |
"""Model and evaluate."""
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import LeaveOneGroupOut, permutation_test_score
from sklearn.svm import SVC, SVR, LinearSVC, LinearSVR
def fit_model(model, X, y, runs, scoring, n_permutatio... | [
"sklearn.model_selection.permutation_test_score",
"numpy.mean",
"sklearn.model_selection.LeaveOneGroupOut",
"sklearn.svm.LinearSVR",
"sklearn.svm.LinearSVC",
"sklearn.preprocessing.StandardScaler",
"sklearn.pipeline.Pipeline",
"sklearn.svm.SVR",
"sklearn.svm.SVC"
] | [((412, 430), 'sklearn.model_selection.LeaveOneGroupOut', 'LeaveOneGroupOut', ([], {}), '()\n', (428, 430), False, 'from sklearn.model_selection import LeaveOneGroupOut, permutation_test_score\n'), ((509, 631), 'sklearn.model_selection.permutation_test_score', 'permutation_test_score', (['model', 'X', 'y'], {'groups': ... |
from synapse.nn.layers import Layer
from synapse.core.tensor import Tensor
from synapse.core.differentiable import Differentiable
import numpy as np
from typing import Callable
def tanhBackward(grad: Tensor, t1: Tensor) -> Tensor:
data = grad.data * (1 - np.tanh(t1.data) ** 2)
return Tensor(data)
@Differe... | [
"numpy.where",
"numpy.tanh",
"synapse.core.differentiable.Differentiable",
"numpy.exp",
"numpy.sum",
"synapse.core.tensor.Tensor",
"numpy.maximum"
] | [((313, 341), 'synapse.core.differentiable.Differentiable', 'Differentiable', (['tanhBackward'], {}), '(tanhBackward)\n', (327, 341), False, 'from synapse.core.differentiable import Differentiable\n'), ((611, 639), 'synapse.core.differentiable.Differentiable', 'Differentiable', (['reluBackward'], {}), '(reluBackward)\n... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler, PolynomialF... | [
"seaborn.set",
"sklearn.preprocessing.PolynomialFeatures",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.xticks",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.plot",
"pandas.get_dummies",
"sklearn.preprocessing.StandardScaler",
"sklearn.metrics.mean_squared_error",
... | [((93, 102), 'seaborn.set', 'sns.set', ([], {}), '()\n', (100, 102), True, 'import seaborn as sns\n'), ((1065, 1083), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (1081, 1083), False, 'from sklearn.linear_model import LinearRegression, Lasso, LassoCV, Ridge, RidgeCV\n'), ((1713, 1731),... |
import plotly.graph_objects as go
from pcutils.kitti_util import compute_box_3d
from PIL import Image
import numpy as np
ptc_layout_config={
'title': {
'text': 'test vis LiDAR',
'font': {
'size': 20,
'color': 'rgb(150,150,150)',
},
'xanchor': 'left',
... | [
"PIL.Image.fromarray",
"pcutils.kitti_util.compute_box_3d",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Scatter",
"plotly.graph_objects.Scatter3d",
"numpy.vstack"
] | [((2323, 2334), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (2332, 2334), True, 'import plotly.graph_objects as go\n'), ((5634, 5662), 'pcutils.kitti_util.compute_box_3d', 'compute_box_3d', (['obj', 'calib.P'], {}), '(obj, calib.P)\n', (5648, 5662), False, 'from pcutils.kitti_util import compute_box_3... |
# -*- coding: utf-8 -*-
"""
This module is a work in progress, as such concepts are subject to change.
MAIN IDEA:
`MultiTaskSamples` serves as a structure to contain and manipulate a set of
samples with potentially many different types of labels and features.
"""
import logging
import utool as ut
import ubelt ... | [
"logging.getLogger",
"utool.list_alignment",
"sklearn.metrics.classification_report",
"utool.index_complement",
"sklearn.metrics.roc_auc_score",
"sklearn.model_selection.StratifiedKFold",
"utool.take",
"numpy.array",
"sklearn.metrics.log_loss",
"utool.qtensure",
"sklearn.calibration.CalibratedCl... | [((597, 617), 'utool.inject2', 'ut.inject2', (['__name__'], {}), '(__name__)\n', (607, 617), True, 'import utool as ut\n'), ((627, 652), 'logging.getLogger', 'logging.getLogger', (['"""wbia"""'], {}), "('wbia')\n", (644, 652), False, 'import logging\n'), ((768, 812), 'utool.ParamInfo', 'ut.ParamInfo', (['"""type"""', '... |
# -*- coding: utf-8 -*-
"""
Clip burn depth and environmental variables
(tree cover, tree species, elevation, slope, topsoil carbon content)
to fire perimeters and assign class overwinter/other to each perimeter
based on the id
Requirements:
- list of overwinteirng fire ids (output of algorithm.R)
- and parent... | [
"pandas.read_csv",
"numpy.where",
"rasterio.open",
"numpy.count_nonzero",
"numpy.nanmean",
"numpy.isnan",
"fiona.open",
"rasterio.mask.mask"
] | [((1354, 1373), 'pandas.read_csv', 'pd.read_csv', (['nndist'], {}), '(nndist)\n', (1365, 1373), True, 'import pandas as pd\n'), ((2325, 2350), 'rasterio.open', 'rasterio.open', (['depth_path'], {}), '(depth_path)\n', (2338, 2350), False, 'import rasterio\n'), ((2364, 2386), 'rasterio.open', 'rasterio.open', (['tc_path'... |
import os
import numpy
import numpy as np
import torch
from dg_util.python_utils import misc_util
from torch import nn
numpy.set_printoptions(precision=4)
torch.set_printoptions(precision=4, sci_mode=False)
def batch_norm_layer(channels):
return nn.BatchNorm2d(channels)
def nonlinearity():
return nn.ReLU(... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.set_printoptions",
"dg_util.python_utils.misc_util.get_time_str",
"numpy.array",
"os.path.dirname",
"numpy.set_printoptions"
] | [((121, 156), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'precision': '(4)'}), '(precision=4)\n', (143, 156), False, 'import numpy\n'), ((157, 208), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'precision': '(4)', 'sci_mode': '(False)'}), '(precision=4, sci_mode=False)\n', (179, 208), False,... |
import os
import subprocess
import numpy as np
import matplotlib.pyplot as pyplot
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from matplotlib.backends.backend_pdf import PdfPages
from mpl_toolkits.axes_grid1 import make_axes_locatable
from simtk import unit
import openmmtools
from cg_openmm.utili... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"openmmtools.multistate.MultiStateReporter",
"numpy.array",
"os.remove",
"os.path.exists",
"numpy.mean",
"numpy.histogram",
"simtk.openmm.app.pdbfile.PDBFile.writeFile",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"time.perf_... | [((906, 992), 'simtk.unit.MOLAR_GAS_CONSTANT_R.in_units_of', 'unit.MOLAR_GAS_CONSTANT_R.in_units_of', (['(unit.kilojoule / (unit.kelvin * unit.mole))'], {}), '(unit.kilojoule / (unit.kelvin * unit.\n mole))\n', (943, 992), False, 'from simtk import unit\n'), ((2514, 2551), 'os.path.join', 'os.path.join', (['output_d... |
import cv2
import numpy as np
import math
import serial
import time
ser = serial.Serial('/dev/ttyACM0', baudrate = 9600, timeout = 1)
cap = cv2.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)
path_lower = np.array([0,80,0])
path_upper = np.array([179,255,255])
font = cv2.FONT_HERSHEY_COMPLEX
kernel =... | [
"cv2.rectangle",
"time.sleep",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.erode",
"cv2.minAreaRect",
"cv2.waitKey",
"cv2.drawContours",
"numpy.ones",
"cv2.boxPoints",
"numpy.int0",
"cv2.putText",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.GaussianBlur",
"cv2.inRange",
... | [((81, 136), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""'], {'baudrate': '(9600)', 'timeout': '(1)'}), "('/dev/ttyACM0', baudrate=9600, timeout=1)\n", (94, 136), False, 'import serial\n'), ((150, 169), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (166, 169), False, 'import cv2\n'), ((219,... |
import os
import re
import ast
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext as _build_ext
package_name = "omicexperiment"
# version parsing from __init__ pulled from scikit-bio
# https://github.com/biocore/scikit-bio/blob/master/setup.py
# which is itself based off F... | [
"pypandoc.convert",
"re.compile",
"setuptools.find_packages",
"os.path.join",
"ast.literal_eval",
"os.path.dirname",
"numpy.get_include",
"setuptools.command.build_ext.build_ext.finalize_options"
] | [((406, 444), 're.compile', 're.compile', (['"""__version__\\\\s+=\\\\s+(.*)"""'], {}), "('__version__\\\\s+=\\\\s+(.*)')\n", (416, 444), False, 'import re\n'), ((1057, 1082), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1072, 1082), False, 'import os\n'), ((1244, 1307), 'pypandoc.convert'... |
# coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import division
from builtins import zip
from builtins import next
from builtins import range
from ....pipeline import engine as pe
from ....interfaces import utility as ni... | [
"builtins.next",
"nibabel.load",
"numpy.hstack",
"nibabel.funcs.concat_images",
"math.cos",
"numpy.array",
"numpy.loadtxt",
"numpy.linalg.norm",
"numpy.where",
"numpy.concatenate",
"numpy.abs",
"numpy.eye",
"os.path.splitext",
"numpy.squeeze",
"builtins.zip",
"numpy.savetxt",
"nibabe... | [((9396, 9411), 'nibabel.load', 'nb.load', (['in_dwi'], {}), '(in_dwi)\n', (9403, 9411), True, 'import nibabel as nb\n'), ((9452, 9471), 'numpy.loadtxt', 'np.loadtxt', (['in_bval'], {}), '(in_bval)\n', (9462, 9471), True, 'import numpy as np\n'), ((10159, 10175), 'nibabel.load', 'nb.load', (['in_file'], {}), '(in_file)... |
#!/usr/bin/env python3
from nucleus.dataset import DataSet
from nucleus.constants import NETS
import argparse
import cv2
import os
import numpy as np
def get_args():
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument("--net")
parser.add_argument("--data_root")
parser.add... | [
"numpy.clip",
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"nucleus.dataset.DataSet",
"numpy.array"
] | [((183, 233), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'fromfile_prefix_chars': '"""@"""'}), "(fromfile_prefix_chars='@')\n", (206, 233), False, 'import argparse\n'), ((1103, 1150), 'nucleus.dataset.DataSet', 'DataSet', (['(input_height, input_width)', 'data_root'], {}), '((input_height, input_width)... |
import torch
import torch.nn as nn
import torch.nn.functional as f
import numpy as np
from layers import GraphAttentionLayer
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1. / np.sqrt(fan_in)
return (-lim, lim)
class GAT(nn.Module):
def __init__(self, nfeat, nhid, nclass, dropou... | [
"torch.tanh",
"numpy.sqrt",
"torch.nn.functional.dropout",
"torch.flatten",
"torch.norm",
"torch.nn.Linear",
"layers.GraphAttentionLayer",
"torch.cat"
] | [((207, 222), 'numpy.sqrt', 'np.sqrt', (['fan_in'], {}), '(fan_in)\n', (214, 222), True, 'import numpy as np\n'), ((742, 832), 'layers.GraphAttentionLayer', 'GraphAttentionLayer', (['(nhid * nheads)', 'nclass'], {'dropout': 'dropout', 'alpha': 'alpha', 'concat': '(False)'}), '(nhid * nheads, nclass, dropout=dropout, al... |
import torch
import numpy as np
from core import predict
def sigmoid_threshold(tensor, threshold=0.5):
"""Applies the sigmoid function to the tensor and thresholds the values
out_tensor = sigmoid(tensor) > threshold
Arguments:
tensor (torch.Tensor): the tensor to threshold.
threshold (sc... | [
"numpy.median",
"core.predict",
"torch.sigmoid",
"torch.tensor",
"numpy.linspace",
"numpy.zeros"
] | [((705, 726), 'torch.sigmoid', 'torch.sigmoid', (['tensor'], {}), '(tensor)\n', (718, 726), False, 'import torch\n'), ((2131, 2190), 'core.predict', 'predict', (['model', 'dataloader'], {'device': 'device', 'ret_targets': '(True)'}), '(model, dataloader, device=device, ret_targets=True)\n', (2138, 2190), False, 'from c... |
# coding=utf-8
from __future__ import absolute_import, print_function
import os
import json
import torch
from time import time
import numpy as np
import pandas as pd
from sklearn import metrics
from glob import glob
from DataSet.dataset import get_iwildcam_loader, data_prefetcher
from Utils.train_utils import cross_en... | [
"torch.optim.lr_scheduler.MultiStepLR",
"pandas.read_csv",
"Utils.train_utils.get_optimizer",
"torch.cuda.is_available",
"Models.model_factory.create_model",
"numpy.mean",
"os.path.exists",
"Utils.train_utils.mixup_data",
"numpy.random.random",
"os.mkdir",
"glob.glob",
"DataSet.dataset.get_iwi... | [((474, 507), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (497, 507), False, 'import warnings\n'), ((1395, 1433), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (1417, 1433), False, 'from sklearn import metr... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"geojson.dumps",
"cv2.__version__.split",
"geojson.FeatureCollection",
"numpy.unique",
"argparse.ArgumentParser",
"utils.Raster",
"geojson.Polygon",
"cv2.approxPolyDP",
"cv2.findContours",
"codecs.open",
"numpy.zeros_like"
] | [((2355, 2410), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""input parameters"""'}), "(description='input parameters')\n", (2378, 2410), False, 'import argparse\n'), ((1035, 1052), 'utils.Raster', 'Raster', (['mask_path'], {}), '(mask_path)\n', (1041, 1052), False, 'from utils import R... |
#!/usr/bin/env python3
import numpy as np
import cv2
# import tensorflow as tf
import sys
sys.path.append("/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/")
# from infer_detector_nano import Infer
# from bag_detection.msg import FlipPos, PathPos
def get_rectangles(mask, threshold_area):
"""
... | [
"cv2.erode",
"cv2.contourArea",
"cv2.morphologyEx",
"numpy.array",
"cv2.cvtColor",
"cv2.findContours",
"sys.path.append",
"cv2.dilate",
"cv2.Canny",
"cv2.getStructuringElement",
"cv2.boundingRect"
] | [((92, 178), 'sys.path.append', 'sys.path.append', (['"""/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/"""'], {}), "(\n '/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/')\n", (107, 178), False, 'import sys\n'), ((595, 661), 'cv2.findContours', 'cv2.findContours', (['mask', 'cv2.RETR_EX... |
import os
import imageio
import numpy as np
import torch
from scipy.spatial.distance import pdist
from src.parser.visualize import parser
from src.utils.bvh_export import save_generated_motion
from src.utils.get_model_and_data import get_model_and_data
from src.visualize.anim import plot_3d_motion
class VisualizeLa... | [
"src.visualize.anim.plot_3d_motion",
"torch.as_tensor",
"src.parser.visualize.parser",
"torch.ones",
"numpy.hstack",
"torch.load",
"os.path.join",
"imageio.get_reader",
"torch.cat",
"src.utils.bvh_export.save_generated_motion",
"numpy.random.randint",
"numpy.zeros",
"torch.no_grad",
"torch... | [((5632, 5663), 'imageio.get_writer', 'imageio.get_writer', (['output_path'], {}), '(output_path)\n', (5650, 5663), False, 'import imageio\n'), ((6186, 6194), 'src.parser.visualize.parser', 'parser', ([], {}), '()\n', (6192, 6194), False, 'from src.parser.visualize import parser\n'), ((6537, 6567), 'src.utils.get_model... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import argparse
import numpy as np
import torch
from torch.autograd import Variable
from torchvision.utils import mak... | [
"src.loader.DataSampler",
"src.loader.load_images",
"argparse.ArgumentParser",
"torch.load",
"os.path.isfile",
"numpy.linspace",
"src.logger.create_logger",
"torchvision.utils.make_grid",
"torch.FloatTensor",
"torch.cat"
] | [((499, 557), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Attributes swapping"""'}), "(description='Attributes swapping')\n", (522, 557), False, 'import argparse\n'), ((1632, 1665), 'os.path.isfile', 'os.path.isfile', (['params.model_path'], {}), '(params.model_path)\n', (1646, 1665),... |
"""
https://docs.opencv.org/master/d8/d19/tutorial_stitcher.html
Stitching sample (advanced)
===========================
Show how to use Stitcher API from python.
"""
# Python 2/3 compatibility
from __future__ import print_function
import argparse
from collections import OrderedDict
from imutils import paths
import... | [
"numpy.sqrt",
"cv2.normalize",
"cv2.detail.leaveBiggestComponent",
"cv2.samples.findFile",
"numpy.log",
"cv2.detail.BestOf2NearestMatcher_create",
"cv2.PyRotationWarper",
"cv2.imshow",
"cv2.detail.Blender_createDefault",
"cv2.detail.matchesGraphAsString",
"cv2.detail.Timelapser_createDefault",
... | [((372, 385), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (383, 385), False, 'from collections import OrderedDict\n'), ((763, 776), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (774, 776), False, 'from collections import OrderedDict\n'), ((1031, 1044), 'collections.OrderedDict', 'OrderedD... |
import cv2
import numpy as np
from sklearn.cluster import KMeans
def give_shape(n, arena, w_pos, r):
ret, frame = cap.read()
cv2.imwrite("new_a.jpg", frame)
# frame = cv2.imread("new_a.jpg")
frame = frame[int(r[1]):int(r[1] + r[3]), int(r[0]):int(r[0] + r[2])]
shape = frame.shape
... | [
"sklearn.cluster.KMeans",
"cv2.imwrite",
"numpy.ones",
"cv2.inRange",
"cv2.erode",
"cv2.contourArea",
"cv2.moments",
"cv2.findContours",
"numpy.load",
"cv2.boundingRect"
] | [((142, 173), 'cv2.imwrite', 'cv2.imwrite', (['"""new_a.jpg"""', 'frame'], {}), "('new_a.jpg', frame)\n", (153, 173), False, 'import cv2\n'), ((713, 734), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(12)'}), '(n_clusters=12)\n', (719, 734), False, 'from sklearn.cluster import KMeans\n'), ((960, 984), 'nump... |
import os
import math
import glob
import random
import importlib
from pathlib import Path
from collections import defaultdict
import torch
import torch.nn as nn
import numpy as np
from tqdm import tqdm
from tensorboardX import SummaryWriter
from optimizers import get_optimizer
from schedulers import get_scheduler
fro... | [
"torch.nn.utils.clip_grad_norm_",
"schedulers.get_scheduler",
"torch.cuda.is_available",
"os.remove",
"tensorboardX.SummaryWriter",
"torch.cuda.device",
"pathlib.Path",
"tqdm.tqdm.write",
"numpy.random.seed",
"glob.glob",
"importlib.import_module",
"torch.save",
"utility.helper.count_paramet... | [((703, 729), 'tensorboardX.SummaryWriter', 'SummaryWriter', (['args.expdir'], {}), '(args.expdir)\n', (716, 729), False, 'from tensorboardX import SummaryWriter\n'), ((3408, 3504), 'optimizers.get_optimizer', 'get_optimizer', (['model_params', "self.config['runner']['total_steps']", "self.config['optimizer']"], {}), "... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.ones",
"mindspore.context.set_context",
"numpy.array",
"mindspore.common.tensor.Tensor",
"mindspore.ops.composite.GradOperation",
"numpy.concatenate",
"numpy.all",
"mindspore.ops.operations.LSTM"
] | [((1095, 1135), 'mindspore.context.set_context', 'context.set_context', ([], {'device_target': '"""GPU"""'}), "(device_target='GPU')\n", (1114, 1135), True, 'import mindspore.context as context\n'), ((6168, 6424), 'numpy.array', 'np.array', (['[[[-0.021429, 0.1176], [0.31144, 0.6309]], [[-0.0005019, -0.045812], [\n ... |
import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from math import ceil
from constants import ENV_NAMES
import seaborn # sets some style parameters automatically
COLORS = [(57, 106, 177), (218, 124, 48)]
def switch_to_outer_plot(fig):
ax0 = fig.add_subplot(111, frame_on=False)
a... | [
"numpy.mean",
"numpy.sqrt",
"numpy.array",
"numpy.sum",
"numpy.isnan",
"csv.reader",
"numpy.std",
"numpy.shape",
"numpy.zeros_like",
"matplotlib.pyplot.subplots"
] | [((424, 446), 'numpy.zeros_like', 'np.zeros_like', (['data_in'], {}), '(data_in)\n', (437, 446), True, 'import numpy as np\n'), ((936, 952), 'numpy.shape', 'np.shape', (['data_y'], {}), '(data_y)\n', (944, 952), True, 'import numpy as np\n'), ((1177, 1200), 'numpy.mean', 'np.mean', (['data_y'], {'axis': '(0)'}), '(data... |
#!/usr/bin/python
import urllib2
import sys
import cv2.cv as cv
import numpy
if __name__ == "__main__":
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
paste = cv.CreateMat(960, 1280, cv.CV_8UC3)
topleft = numpy.asarray(cv.GetSubRect(paste, (0, 0, 640, 480)))
topright = numpy.asarray(c... | [
"cv2.cv.CaptureFromCAM",
"cv2.cv.GetSubRect",
"cv2.cv.NamedWindow",
"numpy.asarray",
"cv2.cv.CreateMat",
"cv2.cv.DestroyAllWindows",
"cv2.cv.ShowImage",
"cv2.cv.WaitKey",
"cv2.cv.QueryFrame"
] | [((109, 136), 'cv2.cv.NamedWindow', 'cv.NamedWindow', (['"""camera"""', '(1)'], {}), "('camera', 1)\n", (123, 136), True, 'import cv2.cv as cv\n'), ((152, 172), 'cv2.cv.CaptureFromCAM', 'cv.CaptureFromCAM', (['(0)'], {}), '(0)\n', (169, 172), True, 'import cv2.cv as cv\n'), ((186, 221), 'cv2.cv.CreateMat', 'cv.CreateMa... |
import time, math, copy
import numpy as np
import pandas as pd
import machineLearning
import pickle
INFINITY = float("inf")
class GameAI(object):
def __init__(self, game):
super().__init__()
self.game = game
self.move = (-1,-1)
self.timeLimit = 3 # 3 seconds is the time limit for search
self.debug = Fals... | [
"pandas.Series",
"pickle.load",
"machineLearning.predict",
"numpy.asarray",
"numpy.append",
"numpy.array",
"copy.deepcopy",
"time.time"
] | [((405, 433), 'pickle.load', 'pickle.load', (['self.fileObject'], {}), '(self.fileObject)\n', (416, 433), False, 'import pickle\n'), ((1813, 1824), 'time.time', 'time.time', ([], {}), '()\n', (1822, 1824), False, 'import time, math, copy\n'), ((4286, 4297), 'time.time', 'time.time', ([], {}), '()\n', (4295, 4297), Fals... |
import numpy as np
import tensorflow as tf
class NeuralBandit:
def __init__(self, nPicos, ABSval, CREval, initExploration, epsilon_0, batch_size=1):
nActivePicosVal = np.arange(0, (nPicos+1))
self.controlSpace = np.array(np.meshgrid(nActivePicosVal, ABSval, CREval)).T.reshape(-1, 3)
self.... | [
"tensorflow.random_normal",
"numpy.random.rand",
"tensorflow.nn.relu",
"tensorflow.pow",
"numpy.where",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"numpy.sum",
"numpy.zeros",
"numpy.random.randint",
"tensorflow.matmul",
"numpy.expand_dims",
"... | [((182, 206), 'numpy.arange', 'np.arange', (['(0)', '(nPicos + 1)'], {}), '(0, nPicos + 1)\n', (191, 206), True, 'import numpy as np\n'), ((825, 849), 'numpy.zeros', 'np.zeros', (['self.nControls'], {}), '(self.nControls)\n', (833, 849), True, 'import numpy as np\n'), ((880, 904), 'numpy.zeros', 'np.zeros', (['self.nCo... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import torch
import torch.nn as nn
import torch.nn.functional as F
from crlapi.core import CLModel
from crlapi.sl.clmodel... | [
"numpy.prod",
"torch.stack",
"torch.nn.functional.cross_entropy",
"copy.deepcopy",
"torch.no_grad"
] | [((963, 980), 'torch.stack', 'torch.stack', (['outs'], {}), '(outs)\n', (974, 980), False, 'import torch\n'), ((2910, 2930), 'copy.deepcopy', 'copy.deepcopy', (['model'], {}), '(model)\n', (2923, 2930), False, 'import copy\n'), ((1661, 1676), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1674, 1676), False, 'imp... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019-2020 Intel Corporation
#
# 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 b... | [
"tensorflow.compat.v1.ConfigProto",
"tensorflow.Graph",
"ngraph_bridge.enable",
"tensorflow.random.uniform",
"ngraph_bridge.disable",
"tensorflow.compat.v1.GraphDef",
"argparse.ArgumentParser",
"tensorflow.io.gfile.GFile",
"numpy.argmax",
"numpy.array",
"tensorflow.import_graph_def",
"time.tim... | [((1166, 1211), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Parse arguments"""'}), "(description='Parse arguments')\n", (1180, 1211), False, 'from argparse import ArgumentParser\n'), ((2156, 2182), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {}), '()\n', (2180, 2182), ... |
# The MIT License (MIT)
#
# Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the... | [
"numpy.mean",
"numpy.ceil",
"os.listdir",
"numpy.minimum",
"numpy.amin",
"os.path.join",
"numpy.square",
"h5py.File",
"mpi4py.MPI.COMM_WORLD.Dup",
"numpy.maximum",
"numpy.amax"
] | [((3399, 3419), 'mpi4py.MPI.COMM_WORLD.Dup', 'MPI.COMM_WORLD.Dup', ([], {}), '()\n', (3417, 3419), False, 'from mpi4py import MPI\n'), ((3484, 3523), 'os.path.join', 'os.path.join', (['data_path_prefix', '"""train"""'], {}), "(data_path_prefix, 'train')\n", (3496, 3523), False, 'import os\n'), ((2500, 2524), 'numpy.min... |
"""
Transform video
===============
In this example, we use ``torchio.Resample((2, 2, 1))`` to divide the spatial
size of the clip (height and width) by two and
``RandomAffine(degrees=(0, 0, 20))`` to rotate a maximum of 20 degrees around
the time axis.
"""
import numpy as np
import matplotlib.pyplot as plt
import ma... | [
"torch.manual_seed",
"PIL.Image.open",
"torchio.RandomAffine",
"torchio.ScalarImage",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.plot",
"numpy.stack",
"torchio.Resample",
"matplotlib.pyplot.subplots"
] | [((1520, 1530), 'matplotlib.pyplot.plot', 'plt.plot', ([], {}), '()\n', (1528, 1530), True, 'import matplotlib.pyplot as plt\n'), ((1539, 1581), 'torchio.ScalarImage', 'tio.ScalarImage', ([], {'tensor': 'array', 'delay': 'delay'}), '(tensor=array, delay=delay)\n', (1554, 1581), True, 'import torchio as tio\n'), ((1721,... |
#!/usr/bin/env python
# coding: utf-8
from typing import Tuple
import numpy as np
import PathReducer.calculate_rmsd as rmsd
import pandas as pd
import math
import glob
import os
import sys
import ntpath
import MDAnalysis as mda
import PathReducer.plotting_functions as plotting_functions
from periodictabl... | [
"sympy.Symbol",
"numpy.sqrt",
"pandas.read_csv",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.mean",
"PathReducer.calculate_rmsd.kabsch_rotate",
"os.path.exists",
"numpy.reshape",
"numpy.asarray",
"pandas.set_option",
"numpy.real",
"numpy.dot",
"sympy.solve",
"os.path.isdir",... | [((431, 449), 'ntpath.split', 'ntpath.split', (['path'], {}), '(path)\n', (443, 449), False, 'import ntpath\n'), ((1818, 1847), 'MDAnalysis.Universe', 'mda.Universe', (['*args'], {}), '(*args, **kwargs)\n', (1830, 1847), True, 'import MDAnalysis as mda\n'), ((2041, 2075), 'numpy.ndarray', 'np.ndarray', (['(n_frames, n_... |
#System Dependencies
import base64
#Dash dependencies
import dash
import dash_table
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
import pandas as pd
import numpy as np
im... | [
"utils.detect_image",
"pandas.DataFrame",
"cv2.imencode",
"yolov3.Create_Yolov3",
"dash.dependencies.Output",
"dash_core_components.Location",
"base64.b64decode",
"base64.b64encode",
"dash.dependencies.Input",
"plotly.graph_objs.Pie",
"cv2.imdecode",
"dash_html_components.Img",
"azure.storag... | [((568, 645), 'yolov3.Create_Yolov3', 'Create_Yolov3', ([], {'input_size': '(416)', 'CLASSES': '"""./model_data/license_plate_names.txt"""'}), "(input_size=416, CLASSES='./model_data/license_plate_names.txt')\n", (581, 645), False, 'from yolov3 import Create_Yolov3\n'), ((873, 927), 'dash.dependencies.Output', 'Output'... |
import backbone.support.configurations_variables as confv
import backbone.support.data_loading as dl
import backbone.support.data_analysis as da
import backbone.support.data_cleaning as dc
import backbone.support.configuration_classes as confc
import backbone.support.saving_loading as sl
import backbone.support.plots_a... | [
"backbone.support.data_cleaning.check_and_adjust_df_for_minimum_audio_length_after_cleaning",
"backbone.support.models.get_cremad_female_model",
"tensorflow.lite.TFLiteConverter.from_saved_model",
"numpy.unique",
"backbone.support.configuration_classes.RandFeatParams",
"os.path.join",
"numpy.argmax",
... | [((3645, 3720), 'backbone.support.configuration_classes.DataFrame', 'confc.DataFrame', ([], {'database': 'confv.database_cremad', 'gender': 'confv.gender_female'}), '(database=confv.database_cremad, gender=confv.gender_female)\n', (3660, 3720), True, 'import backbone.support.configuration_classes as confc\n'), ((3739, ... |
"""Forward and back projector for PET data reconstruction"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
#------------------------------------------------------------------------------
import numpy as np
import sys
import os
import logging
import petprj
from niftypet.nipet.img import mmrimg
from nif... | [
"logging.getLogger",
"niftypet.nipet.mmraux.remgaps",
"petprj.bprj",
"niftypet.nipet.img.mmrimg.convert2dev",
"niftypet.nipet.img.mmrimg.convert2e7",
"niftypet.nipet.mmraux.putgaps",
"numpy.array",
"numpy.zeros",
"petprj.fprj"
] | [((555, 585), 'numpy.array', 'np.array', (['[-1]'], {'dtype': 'np.int32'}), '([-1], dtype=np.int32)\n', (563, 585), True, 'import numpy as np\n'), ((1675, 1702), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1692, 1702), False, 'import logging\n'), ((3590, 3643), 'petprj.fprj', 'petprj.... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import gradcheck
import random
import numpy as np
import math
import scipy.io as sio
import matplotlib.pyplot as plt
from sphere_cuda import SPHERE_CUDA
random.seed(1)
np.random.seed(1)
torch.manual_seed(1)
if torch.cuda.is_availa... | [
"torch.manual_seed",
"torch.cuda.device_count",
"random.seed",
"torch.from_numpy",
"torch.cuda.is_available",
"sphere_cuda.SPHERE_CUDA",
"numpy.random.seed",
"torch.cuda.manual_seed",
"numpy.load",
"torch.autograd.gradcheck",
"torch.randn",
"torch.device"
] | [((241, 255), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (252, 255), False, 'import random\n'), ((256, 273), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (270, 273), True, 'import numpy as np\n'), ((274, 294), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (291, 294), Fal... |
import numpy as np
u = np.array([3,2,1])
v = np.array([1,2,3])
z = u + v
z = u - v
z = u * v
z = u / v
x = np.arange(0,9)
print(x)
print(x.shape)
print(x.itemsize)
y = x.reshape((3,3))
print(y)
print(y.shape)
print(y.itemsize)
x = np.array([1,1,1])
soma = sum(x)
print(soma)
# Usando inner para produto intern... | [
"numpy.matlib.randn",
"numpy.cross",
"numpy.matlib.rand",
"numpy.matlib.identity",
"numpy.inner",
"numpy.array",
"numpy.arange",
"numpy.matlib.zeros"
] | [((26, 45), 'numpy.array', 'np.array', (['[3, 2, 1]'], {}), '([3, 2, 1])\n', (34, 45), True, 'import numpy as np\n'), ((48, 67), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (56, 67), True, 'import numpy as np\n'), ((113, 128), 'numpy.arange', 'np.arange', (['(0)', '(9)'], {}), '(0, 9)\n', (122, 128... |
#!/usr/bin/env python
# This will (hopefully) be the code to extract symmetry operations
# from Hall symbols
import numpy as np
lattice_symbols = {
'P': [[0, 0, 0]],
'A': [[0, 0, 0], [0, 1./2, 1./2]],
'B': [[0, 0, 0], [1./2, 0, 1./2]],
'C': [[0, 0, 0], [1./2, 1./2, 0]],
'I': [[0, 0, 0], [1./2, 1.... | [
"optparse.OptionParser",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.rint"
] | [((10889, 10900), 'numpy.array', 'np.array', (['r'], {}), '(r)\n', (10897, 10900), True, 'import numpy as np\n'), ((12263, 12277), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (12275, 12277), False, 'from optparse import OptionParser\n'), ((2939, 2972), 'numpy.array', 'np.array', (["rotation_matrices['1x'... |
"""Module for interacting with the Comet Observations Database (COBS)."""
from io import StringIO
import re
from pathlib import Path
from appdirs import user_cache_dir
from astropy.time import Time
import mechanize
import numpy as np
import pandas as pd
from . import PACKAGEDIR, log
# Where to store COBS data?
CACH... | [
"pandas.read_feather",
"pandas.to_timedelta",
"appdirs.user_cache_dir",
"re.compile",
"pandas.merge",
"astropy.time.Time",
"mechanize.Browser",
"pandas.concat",
"pandas.to_datetime",
"numpy.atleast_1d"
] | [((332, 360), 'appdirs.user_cache_dir', 'user_cache_dir', (['"""cometcurve"""'], {}), "('cometcurve')\n", (346, 360), False, 'from appdirs import user_cache_dir\n'), ((1681, 1701), 'numpy.atleast_1d', 'np.atleast_1d', (['years'], {}), '(years)\n', (1694, 1701), True, 'import numpy as np\n'), ((1866, 1881), 'pandas.conc... |
import numpy as np
import h5py
import argparse
np.random.seed(2019)
parser = argparse.ArgumentParser(description="Generate the diff data")
parser.add_argument("--valid", action="store_true")
parser.add_argument("--use_random", action="store_true")
# specify the interval
parser.add_argument("--bound", default=1, ty... | [
"argparse.ArgumentParser",
"h5py.File",
"numpy.array",
"numpy.random.randint",
"numpy.random.seed",
"numpy.arange"
] | [((51, 71), 'numpy.random.seed', 'np.random.seed', (['(2019)'], {}), '(2019)\n', (65, 71), True, 'import numpy as np\n'), ((81, 142), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate the diff data"""'}), "(description='Generate the diff data')\n", (104, 142), False, 'import argpar... |
from scipy.sparse import *
import numpy as np
import pickle
import random
from sklearn.decomposition import PCA
from matplotlib import pyplot as plt
from tqdm import tqdm
from sklearn import svm
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_curve, auc
from operator import itemgette... | [
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"numpy.array",
"keras.layers.Dense",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.random.seed",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"sklearn.model_selection.train_test_split",
"keras.models.Sequential",
"matplotlib.py... | [((4519, 4597), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': 'test_size_percent', 'random_state': 'random_state'}), '(X, Y, test_size=test_size_percent, random_state=random_state)\n', (4535, 4597), False, 'from sklearn.model_selection import train_test_split\n'), ((5288, 53... |
import numpy as np
class Renderer:
def __init__(self, height, width, config):
self.height = height
self.width = width
self.content = None
self.zbuffer = None
self.m = None
self.f = 1.0
self.resize(height, width)
self.colors = config.colors
s... | [
"numpy.identity",
"numpy.array",
"numpy.matmul"
] | [((534, 548), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (545, 548), True, 'import numpy as np\n'), ((876, 905), 'numpy.matmul', 'np.matmul', (['self.pos', 'self.rot'], {}), '(self.pos, self.rot)\n', (885, 905), True, 'import numpy as np\n'), ((6596, 6610), 'numpy.identity', 'np.identity', (['(3)'], {}), ... |
"""
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"numpy.clip",
"tensorflow.equal",
"tensorflow.shape",
"tensorflow.reduce_sum",
"tensorflow.numpy_function",
"cv2.filter2D",
"numpy.array",
"tensorflow.image.random_saturation",
"image_retrieval.common.preproces_image",
"numpy.mean",
"argparse.ArgumentParser",
"tensorflow.image.random_crop",
... | [((858, 889), 'cv2.filter2D', 'cv2.filter2D', (['image', '(-1)', 'kernel'], {}), '(image, -1, kernel)\n', (870, 889), False, 'import cv2\n'), ((1393, 1455), 'tensorflow.random.uniform', 'tf.random.uniform', (['()', '(min_size // 2)', 'min_size'], {'dtype': 'tf.int32'}), '((), min_size // 2, min_size, dtype=tf.int32)\n'... |
# ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | [
"ngraph.testing.RandomTensorGenerator",
"ngraph.transformers.make_transformer",
"ngraph.make_axes",
"neon.backends.gen_backend",
"ngraph.testing.executor",
"ngraph.sum",
"ngraph.batch_size",
"ngraph.sigmoid",
"ngraph.make_axis",
"ngraph.deriv",
"ngraph.placeholder",
"numpy.exp",
"ngraph.pool... | [((1095, 1131), 'ngraph.testing.RandomTensorGenerator', 'RandomTensorGenerator', (['(0)', 'np.float32'], {}), '(0, np.float32)\n', (1116, 1131), False, 'from ngraph.testing import RandomTensorGenerator, executor\n'), ((1152, 1165), 'neon.backends.gen_backend', 'gen_backend', ([], {}), '()\n', (1163, 1165), False, 'from... |
import multiprocessing
import os
import random
import numpy as np
import sacred
import torch
from capreolus.reranker.reranker import Reranker
from capreolus.collection import COLLECTIONS
from capreolus.benchmark import Benchmark
from capreolus.index import Index
from capreolus.searcher import Searcher
from capreolus.... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"capreolus.utils.loginit.get_logger",
"os.path.join",
"sacred.Experiment",
"random.seed",
"multiprocessing.cpu_count",
"capreolus.utils.frozendict.FrozenDict",
"torch.cuda.is_available",
"numpy.random.seed",
"capreolus.utils.common.get_default_r... | [((599, 619), 'capreolus.utils.loginit.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (609, 619), False, 'from capreolus.utils.loginit import get_logger\n'), ((1251, 1320), 'sacred.SETTINGS.HOST_INFO.CAPTURED_ENV.append', 'sacred.SETTINGS.HOST_INFO.CAPTURED_ENV.append', (['"""CUDA_VISIBLE_DEVICES"""'], ... |
from bert_utils.pretrain_model import load_model
from bert_utils.tokenization import Tokenizer
import numpy as np
config_path = '../chinese_L-12_H-768_A-12/bert_config.json'
checkpoint_path = '../chinese_L-12_H-768_A-12/bert_model.ckpt'
dict_path = '../chinese_L-12_H-768_A-12/vocab.txt'
model = load_model(checkpoint_... | [
"numpy.array",
"bert_utils.tokenization.Tokenizer",
"bert_utils.pretrain_model.load_model"
] | [((298, 351), 'bert_utils.pretrain_model.load_model', 'load_model', (['checkpoint_path', 'dict_path'], {'is_pool': '(False)'}), '(checkpoint_path, dict_path, is_pool=False)\n', (308, 351), False, 'from bert_utils.pretrain_model import load_model\n'), ((365, 405), 'bert_utils.tokenization.Tokenizer', 'Tokenizer', (['dic... |
"""Test mmd related functions."""
import numpy as np
import pytest
from sklearn.metrics.pairwise import euclidean_distances
from discern.mmd import mmd
def _mmd_loop(dist_xy, dist_xx, dist_yy, scales, sigma):
# pylint: disable=too-many-locals
stat = np.zeros_like(scales)
n_x = np.float(dist_xx.shape[0])
... | [
"numpy.random.rand",
"numpy.testing.assert_allclose",
"numpy.max",
"numpy.exp",
"numpy.linspace",
"discern.mmd.mmd._calculate_distances",
"numpy.random.seed",
"pytest.mark.skipif",
"discern.mmd.mmd.mmd_loss",
"sklearn.metrics.pairwise.euclidean_distances",
"numpy.fill_diagonal",
"discern.mmd.m... | [((855, 914), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n_rows"""', '[10, 25, 100, 500, 1000]'], {}), "('n_rows', [10, 25, 100, 500, 1000])\n", (878, 914), False, 'import pytest\n'), ((916, 975), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n_cols"""', '[10, 25, 100, 500, 1000]'], {}), ... |
from typing import Dict
import numpy as np
import edunet as net
from edunet.core import Operation
from edunet.core import Variable
EPSILON = 1e-6
SEED = 69696969
RANDOM_STATE = np.random.RandomState(SEED)
INPUT_DTYPE = np.float64
INPUT_DATA_SHAPE = (1, 6, 6, 3)
INPUT_LABELS_SHAPE = (1, 3, 1)
data_batch = RANDOM_S... | [
"edunet.Gradients",
"edunet.ReduceSum",
"edunet.CrossEntropy",
"edunet.AveragePool2D",
"edunet.SoftArgMax",
"edunet.Relu6",
"edunet.Relu",
"numpy.empty",
"edunet.Convolution2D",
"edunet.Input",
"edunet.Flatten",
"edunet.Dense",
"numpy.all",
"numpy.random.RandomState"
] | [((181, 208), 'numpy.random.RandomState', 'np.random.RandomState', (['SEED'], {}), '(SEED)\n', (202, 208), True, 'import numpy as np\n'), ((527, 554), 'numpy.random.RandomState', 'np.random.RandomState', (['SEED'], {}), '(SEED)\n', (548, 554), True, 'import numpy as np\n'), ((583, 623), 'edunet.Input', 'net.Input', (['... |
"""
This module will encompass the code for analyzing the molecular dynamics generated on the simulations as dcd files.
It also takes care of the CV generation for further feeding into the MLTSA pipeline.
"""
import numpy as np
import mdtraj as md
from itertools import combinations
from itertools import permutation... | [
"re.split",
"matplotlib.pyplot.title",
"mdtraj.compute_distances",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"mdtraj.compute_contacts",
"itertools.combinations",
"numpy.array",
"numpy.sum",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.close",
"mdtraj... | [((1041, 1053), 'mdtraj.load', 'md.load', (['top'], {}), '(top)\n', (1048, 1053), True, 'import mdtraj as md\n'), ((3158, 3189), 'itertools.combinations', 'combinations', (['relevant_atoms', '(2)'], {}), '(relevant_atoms, 2)\n', (3170, 3189), False, 'from itertools import combinations\n'), ((12528, 12540), 'mdtraj.load... |
import csv
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
import numpy as np
# read the data
csvfile=open("weightedX.csv", 'r')
x = list(csv.reader(csvfile))
csvfile=open("weightedY.csv", 'r')
y = list(csv.reader(csvfile))
m=len(x)
n=1
x3=[]
y2=[]
for i in range(m):
... | [
"numpy.transpose",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"math.sqrt",
"matplotlib.pyplot.ioff",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.dot",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.title",
"math.exp",
"matplotlib.pyplot.pause",
"csv.reader",
"matplotlib.pyp... | [((489, 501), 'math.sqrt', 'math.sqrt', (['v'], {}), '(v)\n', (498, 501), False, 'import math\n'), ((612, 624), 'numpy.array', 'np.array', (['x2'], {}), '(x2)\n', (620, 624), True, 'import numpy as np\n'), ((627, 639), 'numpy.array', 'np.array', (['y2'], {}), '(y2)\n', (635, 639), True, 'import numpy as np\n'), ((683, ... |
import math
import numpy as np
import matlab.engine
from pyomo.environ import *
from pyomo.dae import *
from pyomo.gdp import *
from pyomo.gdp.plugins.chull import ConvexHull_Transformation
from pyomo.gdp.plugins.bigm import BigM_Transformation
from pyomo.core import Var
from pyomo.dae.plugins.finitedifference import F... | [
"numpy.atleast_2d",
"pyomo.core.Var",
"math.sqrt",
"pyomo.gdp.plugins.chull.ConvexHull_Transformation",
"numpy.array",
"numpy.arctan",
"numpy.vstack",
"numpy.cumsum",
"numpy.matrix",
"numpy.atleast_1d"
] | [((2724, 2743), 'numpy.matrix', 'np.matrix', (['"""0.; 0."""'], {}), "('0.; 0.')\n", (2733, 2743), True, 'import numpy as np\n'), ((3561, 3615), 'numpy.cumsum', 'np.cumsum', (['([0.0] + [m.dt[ti].value for ti in m.t][:-1])'], {}), '([0.0] + [m.dt[ti].value for ti in m.t][:-1])\n', (3570, 3615), True, 'import numpy as n... |
import numpy as np
from scipy.spatial import distance
from Quaternions import Quaternions
import Animation
import AnimationStructure
def constrain(positions, constraints):
"""
Constrain animation positions given
a number of VerletParticles constrains
Parameters
----------
... | [
"pymel.core.nodetypes.AnimCurveTU",
"numpy.array",
"pymel.core.runtime.AttachBrushToCurves",
"pymel.core.connectAttr",
"VerletParticles.VerletParticles",
"pymel.core.selected",
"numpy.concatenate",
"numpy.min",
"pymel.core.setAttr",
"scipy.spatial.distance.pdist",
"pymel.core.select",
"Quatern... | [((861, 914), 'VerletParticles.VerletParticles', 'VerletParticles', (['positions'], {'gravity': '(0.0)', 'timestep': '(0.0)'}), '(positions, gravity=0.0, timestep=0.0)\n', (876, 914), False, 'from VerletParticles import VerletParticles\n'), ((2233, 2247), 'numpy.array', 'np.array', (['keys'], {}), '(keys)\n', (2241, 22... |
# coding=utf-8
# Copyright 2020 The Trax 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 or a... | [
"trax.layers.to_list",
"trax.layers.ParametricRelu",
"absl.testing.absltest.main",
"numpy.array",
"trax.layers.Relu",
"trax.layers.LeakyRelu",
"trax.layers.HardTanh",
"trax.layers.HardSigmoid"
] | [((1817, 1832), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1830, 1832), False, 'from absl.testing import absltest\n'), ((822, 831), 'trax.layers.Relu', 'tl.Relu', ([], {}), '()\n', (829, 831), True, 'import trax.layers as tl\n'), ((840, 882), 'numpy.array', 'np.array', (['[-2.0, -1.0, 0.0, 2.0, 3... |
'''
This program is free software: you can use, modify and/or redistribute it
under the terms of the simplified BSD License. You should have received a
copy of this license along this program.
Copyright 2020, <NAME> <<EMAIL>>
All rights reserved.
'''
import numpy as np
import cv2
import math
import matplotlib.pyplot ... | [
"PIL.Image.open",
"matplotlib.pyplot.savefig",
"pathlib.Path",
"utilities.classicalUtils.classicalUtilitiesPY.normalize",
"utilities.classicalUtils.classicalUtilitiesPY.gaussianSmoothing",
"numpy.array",
"utilities.cameraUtils.Camera.cameraMod",
"utilities.classicalUtils.classicalUtilitiesPY.scaling",... | [((702, 763), 'cv2.imread', 'cv2.imread', (['"""./data/foreman/frame5.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('./data/foreman/frame5.png', cv2.IMREAD_GRAYSCALE)\n", (712, 763), False, 'import cv2\n'), ((771, 832), 'cv2.imread', 'cv2.imread', (['"""./data/foreman/frame7.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('./data/... |
# This is a sample Python script.
import time
import functools
import sys
import numpy as np
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
sys.setrecursionlimit(10 ** 9)
def find_squares_opt(array):
... | [
"sys.setrecursionlimit",
"numpy.array",
"time.time"
] | [((255, 285), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 9)'], {}), '(10 ** 9)\n', (276, 285), False, 'import sys\n'), ((326, 341), 'numpy.array', 'np.array', (['array'], {}), '(array)\n', (334, 341), True, 'import numpy as np\n'), ((1003, 1014), 'time.time', 'time.time', ([], {}), '()\n', (1012, 1014)... |
import numpy as np
import torch
from torch.utils.data import Dataset
import numpy as np
from ad3 import factor_graph as fg
try:
import cPickle as pickle
except:
import pickle
from tqdm import tqdm
import time
from .random_pgm_data import RandomPGMData, worker_init_fn
len = 100000
class RandomPGMHop(Dataset):... | [
"numpy.asarray",
"numpy.argmax",
"ad3.factor_graph.PFactorGraph",
"numpy.zeros",
"numpy.random.randint",
"numpy.random.uniform",
"numpy.transpose"
] | [((726, 743), 'ad3.factor_graph.PFactorGraph', 'fg.PFactorGraph', ([], {}), '()\n', (741, 743), True, 'from ad3 import factor_graph as fg\n'), ((1385, 1436), 'numpy.random.uniform', 'np.random.uniform', (['(0.0)', '(1.0)', '(self.chain_length, 2)'], {}), '(0.0, 1.0, (self.chain_length, 2))\n', (1402, 1436), True, 'impo... |
import os
import csv
import shutil
import hashlib
import tempfile
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem, MACCSkeys
from rdkit.Chem import MolFromSmiles
from padelpy import padeldescriptor # required to calculate KlekotaRothFingerPrint
from metstab_shap.config imp... | [
"numpy.sqrt",
"hashlib.md5",
"numpy.ones",
"numpy.hstack",
"pandas.read_csv",
"os.getenv",
"rdkit.Chem.MACCSkeys.GenMACCSKeys",
"numpy.log",
"os.path.join",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect",
"os.getcwd",
"numpy.exp",
"numpy.array",
"os.path.r... | [((853, 890), 'numpy.vstack', 'np.vstack', (['[el[0] for el in datasets]'], {}), '([el[0] for el in datasets])\n', (862, 890), True, 'import numpy as np\n'), ((899, 936), 'numpy.hstack', 'np.hstack', (['[el[1] for el in datasets]'], {}), '([el[1] for el in datasets])\n', (908, 936), True, 'import numpy as np\n'), ((950... |
import torch
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm # Displays a progress bar
import sys,os
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import pickle
from sklearn.metrics import accuracy_score
from sklearn.model_selection import KFold, Stratifi... | [
"torch.utils.data.ConcatDataset",
"numpy.array",
"sys.path.append",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParser",
"sklearn.decomposition.PCA",
"numpy.where",
"dataset.EnableDataset",
"pickle.load",
"numpy.std",
"sklearn.pipeline.Pipeline",
"sklearn.metrics.accuracy_score",
"sk... | [((577, 597), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (592, 597), False, 'import sys, os\n'), ((6110, 6135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6133, 6135), False, 'import argparse\n'), ((2167, 2197), 'sklearn.preprocessing.StandardScaler', 'preprocessin... |
from numpy import arcsin, cos, exp, pi, sin
def _comp_point_coordinate(self):
"""Compute the point coordinates needed to plot the Slot.
Parameters
----------
self : SlotW14
A SlotW14 object
Returns
-------
point_dict: dict
A dict of the slot point coordinates
"""
... | [
"numpy.exp",
"numpy.sin",
"numpy.arcsin",
"numpy.cos"
] | [((434, 461), 'numpy.arcsin', 'arcsin', (['(self.W0 / (2 * Rbo))'], {}), '(self.W0 / (2 * Rbo))\n', (440, 461), False, 'from numpy import arcsin, cos, exp, pi, sin\n'), ((519, 537), 'numpy.exp', 'exp', (['(-1.0j * alpha)'], {}), '(-1.0j * alpha)\n', (522, 537), False, 'from numpy import arcsin, cos, exp, pi, sin\n'), (... |
import numpy as np
import matplotlib.pyplot as plt
from kf_v4 import f
from simulated_observation import ls_of_observations_v4, real_state_v4
plt.ion()
plt.figure()
# assume the pic is 300 in x-length, and 200 in y-height
real_state = real_state_v4
f.x = ls_of_observations_v4[0]
NUMSTEPS = 10 # number of loops to... | [
"kf_v4.f.update",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ginput",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((145, 154), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (152, 154), True, 'import matplotlib.pyplot as plt\n'), ((155, 167), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (165, 167), True, 'import matplotlib.pyplot as plt\n'), ((1182, 1202), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(5)',... |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from kern import CombinationKernel
from ...util.caching import Cache_this
import itertools
def numpy_invalid_op_as_exception(func):
"""
A decorator that allows catching numpy in... | [
"numpy.zeros",
"numpy.seterr"
] | [((455, 481), 'numpy.seterr', 'np.seterr', ([], {'invalid': '"""raise"""'}), "(invalid='raise')\n", (464, 481), True, 'import numpy as np\n'), ((529, 554), 'numpy.seterr', 'np.seterr', ([], {'invalid': '"""warn"""'}), "(invalid='warn')\n", (538, 554), True, 'import numpy as np\n'), ((2766, 2783), 'numpy.zeros', 'np.zer... |
import os
from glob import glob
import time
import json
from PIL import Image
import pandas as pd
import numpy as np
import torchvision as tv
from rsp.data import bilinear_upsample, BANDS
from tifffile import imread as tiffread
from d3m.container import DataFrame as d3m_DataFrame
from d3m.metadata import base as metad... | [
"kf_d3m_primitives.remote_sensing.image_retrieval.image_retrieval_pipeline.ImageRetrievalPipeline",
"PIL.Image.open",
"tifffile.imread",
"d3m.container.DataFrame",
"pandas.DataFrame",
"kf_d3m_primitives.remote_sensing.image_retrieval.image_retrieval.Hyperparams.defaults",
"numpy.arange",
"os.path.join... | [((1542, 1558), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (1550, 1558), True, 'import numpy as np\n'), ((2138, 2160), 'd3m.container.DataFrame', 'd3m_DataFrame', (['imgs_df'], {}), '(imgs_df)\n', (2151, 2160), True, 'from d3m.container import DataFrame as d3m_DataFrame\n'), ((5576, 5632), 'kf_d3m_primi... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 10:44:31 2019
@author: hasee
"""
from pystruct.models import EdgeFeatureGraphCRF
from pystruct.learners import FrankWolfeSSVM, OneSlackSSVM
from sklearn.metrics import precision_score, recall_score, f1_score
#from sklearn.externals import joblib
from thre... | [
"numpy.hstack",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.array",
"os.path.exists",
"numpy.mean",
"pystruct.learners.FrankWolfeSSVM",
"pandas.DataFrame",
"pystruct.models.EdgeFeatureGraphCRF",
"random.shuffle",
"pickle.load",
"gc.collect",
"numpy.std",
"time... | [((4091, 4141), 'pandas.DataFrame', 'pd.DataFrame', (['[]'], {'columns': "['oid', 'pred', 'label']"}), "([], columns=['oid', 'pred', 'label'])\n", (4103, 4141), True, 'import pandas as pd\n'), ((4160, 4179), 'numpy.hstack', 'np.hstack', (['camptest'], {}), '(camptest)\n', (4169, 4179), True, 'import numpy as np\n'), ((... |
import numpy as np
from sklearn.linear_model import LinearRegression
x = np.array([29,59,119,238,464,659]).reshape(-1,1)
y = np.array([0.004,0.009,0.027,0.027,0.051,0.165])
model = LinearRegression().fit(x, y)
r_sq = model.score(x, y)
print('coefficient of determination:', r_sq)
| [
"numpy.array",
"sklearn.linear_model.LinearRegression"
] | [((125, 177), 'numpy.array', 'np.array', (['[0.004, 0.009, 0.027, 0.027, 0.051, 0.165]'], {}), '([0.004, 0.009, 0.027, 0.027, 0.051, 0.165])\n', (133, 177), True, 'import numpy as np\n'), ((73, 111), 'numpy.array', 'np.array', (['[29, 59, 119, 238, 464, 659]'], {}), '([29, 59, 119, 238, 464, 659])\n', (81, 111), True, ... |
import csv
import os
import random
import uuid
import pickle
from multiprocessing import Pool
from collections import Counter
import numpy as np
import imgaug.augmenters as iaa
from PIL import Image
def rotate_save(img, flip, angle, label, new_label_dict, out_dir):
filename = str(uuid.uuid4()) + ".png"
new_l... | [
"os.listdir",
"pickle.dump",
"random.shuffle",
"imgaug.augmenters.Affine",
"os.path.join",
"uuid.uuid4",
"numpy.array",
"multiprocessing.Pool",
"csv.reader"
] | [((1648, 1666), 'os.listdir', 'os.listdir', (['in_dir'], {}), '(in_dir)\n', (1658, 1666), False, 'import os\n'), ((1671, 1692), 'random.shuffle', 'random.shuffle', (['files'], {}), '(files)\n', (1685, 1692), False, 'import random\n'), ((1972, 1980), 'multiprocessing.Pool', 'Pool', (['(16)'], {}), '(16)\n', (1976, 1980)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.