code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import pytest
import emcee
import os
from lenstronomy.Cosmo.lens_cosmo import LensCosmo
from hierarc.Sampling.mcmc_sampling import MCMCSampler
from astropy.cosmology import FlatLambdaCDM
class TestMCMCSampling(object):
def setup(self):
np.random.seed(seed=41)
self.z_L = 0.8
... | [
"astropy.cosmology.FlatLambdaCDM",
"numpy.random.seed",
"lenstronomy.Cosmo.lens_cosmo.LensCosmo",
"os.getcwd",
"emcee.backends.HDFBackend",
"hierarc.Sampling.mcmc_sampling.MCMCSampler",
"pytest.main",
"numpy.random.normal",
"os.path.join"
] | [((3310, 3323), 'pytest.main', 'pytest.main', ([], {}), '()\n', (3321, 3323), False, 'import pytest\n'), ((271, 294), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(41)'}), '(seed=41)\n', (285, 294), True, 'import numpy as np\n'), ((421, 484), 'astropy.cosmology.FlatLambdaCDM', 'FlatLambdaCDM', ([], {'H0': 'sel... |
import argparse
import joblib as jl
import numpy as np
import basty.project.experiment_processing as experiment_processing
parser = argparse.ArgumentParser(
description="Report details about active and dormant masks."
)
parser.add_argument(
"--main-cfg-path",
type=str,
required=True,
help="Path t... | [
"numpy.load",
"numpy.count_nonzero",
"argparse.ArgumentParser",
"numpy.logical_and",
"basty.project.experiment_processing.Project",
"joblib.load",
"numpy.unique"
] | [((135, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Report details about active and dormant masks."""'}), "(description=\n 'Report details about active and dormant masks.')\n", (158, 225), False, 'import argparse\n'), ((2314, 2363), 'numpy.unique', 'np.unique', (['annotations... |
#!/usr/bin/env python
from numpy.distutils.core import Extension, setup
setup(name='hw',
description='Simple example on calling F77 from Python',
author='<NAME>',
author_email='<EMAIL>',
ext_modules=[Extension(name='hw', sources=['../hw.f'])],
)
| [
"numpy.distutils.core.Extension"
] | [((225, 266), 'numpy.distutils.core.Extension', 'Extension', ([], {'name': '"""hw"""', 'sources': "['../hw.f']"}), "(name='hw', sources=['../hw.f'])\n", (234, 266), False, 'from numpy.distutils.core import Extension, setup\n')] |
import os
# os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import matplotlib
matplotlib.use('Agg')
from tqdm import tqdm
import time
import numpy as np
from utils.Config import opt
from models.faster_rcnn_vgg16 import FasterRCNNVGG16
from models.faster_rcnn_resnet import FasterRCNNResNet50
from torch.autograd import Variable... | [
"utils.array_tool.tonumpy",
"data.dataset.get_test_loader",
"data.dataset.get_train_val_loader",
"utils.array_tool.scalar",
"utils.vis_tool.save_gt_pred",
"models.faster_rcnn_vgg16.FasterRCNNVGG16",
"numpy.zeros",
"torch.autograd.Variable",
"time.time",
"utils.vis_tool.save_pred_fig",
"matplotli... | [((71, 92), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (85, 92), False, 'import matplotlib\n'), ((1220, 1237), 'models.faster_rcnn_vgg16.FasterRCNNVGG16', 'FasterRCNNVGG16', ([], {}), '()\n', (1235, 1237), False, 'from models.faster_rcnn_vgg16 import FasterRCNNVGG16\n'), ((2053, 2191), 'data.... |
# Copyright (c) 2018 Copyright holder of the paper Generative Adversarial Model Learning
# submitted to NeurIPS 2019 for review
# All rights reserved.
from rllab.misc.instrument import run_experiment_custom
from rllab.dynamic_models.cartpole_model import CartPoleModel
from rllab.torch.models.nn_discriminator import NN... | [
"rllab.torch.models.nn_discriminator.NNDiscriminator",
"argparse.ArgumentParser",
"numpy.concatenate",
"rllab.torch.utils.misc.str2bool",
"rllab.misc.instrument.run_experiment_custom",
"rllab.torch.algos.gaml_episode_based_modellearning.GAMLEpisodeBasedModelLearning",
"pathlib.Path",
"pathlib.Path.joi... | [((736, 772), 'joblib.load', 'joblib.load', (["v['expert_policy_path']"], {}), "(v['expert_policy_path'])\n", (747, 772), False, 'import joblib\n'), ((956, 978), 'joblib.load', 'joblib.load', (['file_name'], {}), '(file_name)\n', (967, 978), False, 'import joblib\n'), ((1142, 1211), 'rllab.torch.models.nn_discriminator... |
import numpy as np
from keras.models import load_model
from PIL import Image
from keras.applications import mobilenet_v2
from keras.utils.data_utils import get_file
import frederic.utils.general
import frederic.utils.image
BASE_MODEL_URL = 'https://github.com/zylamarek/frederic-models/raw/master/models/'
class Pred... | [
"keras.models.load_model",
"numpy.asarray",
"keras.utils.data_utils.get_file",
"numpy.max",
"numpy.round"
] | [((2611, 2657), 'numpy.max', 'np.max', (['(bbox[2] - bbox[0], bbox[3] - bbox[1])'], {}), '((bbox[2] - bbox[0], bbox[3] - bbox[1]))\n', (2617, 2657), True, 'import numpy as np\n'), ((1413, 1476), 'keras.models.load_model', 'load_model', (['self.bbox_model_path'], {'custom_objects': 'custom_objects'}), '(self.bbox_model_... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import copy
from time import gmtime, strftime
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from tqdm import tqdm
import numpy as np
import nni
from nni.compression.pytorch import ModelSpeedup
from nni.algo... | [
"tqdm.tqdm",
"os.remove",
"copy.deepcopy",
"nni.compression.pytorch.ModelSpeedup",
"torch.utils.data.DataLoader",
"time.gmtime",
"torch.nn.CrossEntropyLoss",
"os.path.exists",
"torch.set_num_threads",
"torch.cuda.is_available",
"numpy.array",
"torch.rand",
"torch.no_grad"
] | [((2044, 2065), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (2063, 2065), True, 'import torch.nn as nn\n'), ((2733, 2754), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (2752, 2754), True, 'import torch.nn as nn\n'), ((3492, 3513), 'torch.nn.CrossEntropyLoss', 'nn.Cross... |
# Get dependencies
import sys
import dependencies
sys.path.append('yolo')
sys.path.append('core')
import math
import glob
import os
import time
import cv2
import numpy as np
from PIL import Image
import torch
import torchvision.models as models
import torchvision.transforms as transforms
from raft import RAFT
from util... | [
"matplotlib.pyplot.title",
"numpy.maximum",
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"cv2.calcOpticalFlowFarneback",
"cv2.normalize",
"numpy.interp",
"cv2.imshow",
"os.path.join",
"torch.no_grad",
"sys.path.append",
"numpy.full",
"inference.post_process",
"numpy.zeros_like",
... | [((50, 73), 'sys.path.append', 'sys.path.append', (['"""yolo"""'], {}), "('yolo')\n", (65, 73), False, 'import sys\n'), ((74, 97), 'sys.path.append', 'sys.path.append', (['"""core"""'], {}), "('core')\n", (89, 97), False, 'import sys\n'), ((15219, 15233), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (15226, 1... |
from ipywidgets import widgets, Layout, ValueWidget, link, HBox
from ipywidgets.widgets.widget_description import DescriptionWidget
import numpy as np
from hdmf.common import DynamicTable
from .utils.dynamictable import group_and_sort, infer_categorical_columns
from .utils.pynwb import robust_unique
from typing import ... | [
"ipywidgets.widgets.HTML",
"ipywidgets.widgets.HBox",
"ipywidgets.link",
"ipywidgets.widgets.Dropdown",
"numpy.isnan",
"numpy.arange",
"ipywidgets.widgets.Layout",
"ipywidgets.widgets.IntRangeSlider",
"ipywidgets.Layout",
"numpy.unique",
"ipywidgets.widgets.FloatRangeSlider"
] | [((18058, 18147), 'ipywidgets.widgets.Dropdown', 'widgets.Dropdown', ([], {'options': 'trial_events', 'value': '"""start_time"""', 'description': '"""align to: """'}), "(options=trial_events, value='start_time', description=\n 'align to: ')\n", (18074, 18147), False, 'from ipywidgets import widgets, Layout, ValueWid... |
import numpy as np
from td import TD
import time
class Sarsa(TD):
def __init__(self, env, step_size=0.1, gamma=1, eps=0.1, pol_deriv=None):
super().__init__(env, None, step_size, gamma)
self.pol_deriv = pol_deriv if pol_deriv is not None else self.eps_gre(eps)
self.reset()
#print(f"step size={self.... | [
"numpy.random.random",
"numpy.array",
"time.time"
] | [((1159, 1170), 'time.time', 'time.time', ([], {}), '()\n', (1168, 1170), False, 'import time\n'), ((671, 689), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (687, 689), True, 'import numpy as np\n'), ((783, 836), 'numpy.array', 'np.array', (['[self.Q[s, a] for a in self.env.moves_d[s]]'], {}), '([self.Q... |
"""
"""
import unittest
import numpy as np
from corvid.types.table import Box, Token, Cell, Table, EMPTY_CAPTION
class TestCell(unittest.TestCase):
def setUp(self):
self.cell = Cell(tokens=[
Token(text='hi',
bounding_box=Box(llx=-1.0, lly=-0.5, urx=1.0, ury=1.0)),
... | [
"corvid.types.table.Table",
"corvid.types.table.Box",
"corvid.types.table.Token",
"numpy.array",
"corvid.types.table.Table.create_from_grid"
] | [((1279, 1314), 'corvid.types.table.Table', 'Table', ([], {'caption': '"""hi this is caption"""'}), "(caption='hi this is caption')\n", (1284, 1314), False, 'from corvid.types.table import Box, Token, Cell, Table, EMPTY_CAPTION\n'), ((1346, 1408), 'numpy.array', 'np.array', (['[[self.a, self.b, self.c], [self.d, self.e... |
"""
This program grabs text from an image and compares it with 'модули иртибот'.
It returns 'Match' if it identifies 'модули иртибот' and 'Not Match' when it doesnt.
"""
import pytesseract
import numpy as np
import cv2
import os, sys
parent_dir = os.path.dirname(os.path.abspath(__file__))
gparent_dir = os.path.dirname... | [
"os.path.abspath",
"os.path.dirname",
"pytesseract.image_to_data",
"time.time",
"numpy.mean",
"cv2.rectangle",
"os.path.join",
"bounding_box.ObjectType"
] | [((305, 332), 'os.path.dirname', 'os.path.dirname', (['parent_dir'], {}), '(parent_dir)\n', (320, 332), False, 'import os\n'), ((348, 376), 'os.path.dirname', 'os.path.dirname', (['gparent_dir'], {}), '(gparent_dir)\n', (363, 376), False, 'import os\n'), ((264, 289), 'os.path.abspath', 'os.path.abspath', (['__file__'],... |
import torch
import numpy as np
import argparse
from models import FlowNet2
from utils.frame_utils import read_gen
class Args():
fp16 = False
rgb_max = 255.
def get_flow(img1, img2, weights):
# initial a Net
args = Args()
net = FlowNet2(args).cuda()
# load the state_dict
d... | [
"torch.load",
"utils.frame_utils.read_gen",
"numpy.array",
"models.FlowNet2"
] | [((326, 345), 'torch.load', 'torch.load', (['weights'], {}), '(weights)\n', (336, 345), False, 'import torch\n'), ((475, 489), 'utils.frame_utils.read_gen', 'read_gen', (['img1'], {}), '(img1)\n', (483, 489), False, 'from utils.frame_utils import read_gen\n'), ((502, 516), 'utils.frame_utils.read_gen', 'read_gen', (['i... |
#!/usr/bin/env python3
import json
import numpy as np
import matplotlib.pyplot as plt
import equations
data_output = 'data/simulations/single_ligand.json'
tspan = np.array([0, 120 * 60]) # 2 hour window
units = 1e9 # 1e9 for nM, 1e6 for μM, etc
L1 = 30e-9
R = 800e-9
alpha = 0.06
m = np.array([R, L1, 0]) * units... | [
"equations.simulate_one_ligand_one_receptor_binding",
"numpy.array",
"json.dumps"
] | [((167, 190), 'numpy.array', 'np.array', (['[0, 120 * 60]'], {}), '([0, 120 * 60])\n', (175, 190), True, 'import numpy as np\n'), ((326, 352), 'numpy.array', 'np.array', (['[1e-05, 0.00022]'], {}), '([1e-05, 0.00022])\n', (334, 352), True, 'import numpy as np\n'), ((448, 518), 'equations.simulate_one_ligand_one_recepto... |
#!/usr/bin/env python
# TODO: Add type hints and doc strings
# TODO: Write Unit Tests
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import sys
import os
import argparse
import logging
import numpy as np
from typing import Dict, List, Tuple
from functools import partial
from scipy import signal
from en... | [
"functools.partial",
"numpy.radians",
"argparse.ArgumentParser",
"pyfiglet.Figlet",
"logging.StreamHandler",
"os.path.exists",
"tempfile.gettempdir",
"logging.Formatter",
"numpy.min",
"numpy.max",
"pathlib.Path",
"numpy.linspace",
"sys.exit",
"os.path.join",
"logging.getLogger",
"argpa... | [((827, 859), 'logging.getLogger', 'logging.getLogger', (['"""pattern_gen"""'], {}), "('pattern_gen')\n", (844, 859), False, 'import logging\n'), ((1184, 1207), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1205, 1207), False, 'import logging\n'), ((1246, 1319), 'logging.Formatter', 'logging.Form... |
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.special
import mafipy.function
# ----------------------------------------------------------------------------
# Black scholes european call/put
# --------------------------------------------------------------... | [
"math.log",
"math.exp",
"math.sqrt",
"numpy.isclose"
] | [((6272, 6298), 'math.exp', 'math.exp', (['(-rate * maturity)'], {}), '(-rate * maturity)\n', (6280, 6298), False, 'import math\n'), ((9071, 9093), 'math.exp', 'math.exp', (['(-rate * time)'], {}), '(-rate * time)\n', (9079, 9093), False, 'import math\n'), ((10285, 10311), 'math.exp', 'math.exp', (['(-rate * maturity)'... |
# # Chapter 4: Discrete Cosine / Wavelet Transform and Deconvolution
# Author: <NAME>
###########################################
# ## Problems
# ## 1. Template matching with Phase-Correlation in Frequency Domain
get_ipython().run_line_magic('matplotlib', 'inline')
import scipy.fftpack as fp
from skimage.io import... | [
"pywt.coeffs_to_array",
"numpy.sum",
"pywt.threshold",
"numpy.abs",
"matplotlib.pylab.imshow",
"numpy.maximum",
"numpy.allclose",
"scipy.fftpack.dct",
"numpy.ones",
"numpy.clip",
"matplotlib.pylab.axis",
"matplotlib.pylab.gca",
"cv2.warpAffine",
"numpy.sin",
"numpy.arange",
"matplotlib... | [((1542, 1553), 'scipy.fftpack.fftn', 'fp.fftn', (['im'], {}), '(im)\n', (1549, 1553), True, 'import scipy.fftpack as fp\n'), ((1561, 1591), 'scipy.fftpack.fftn', 'fp.fftn', (['im_tm'], {'shape': 'im.shape'}), '(im_tm, shape=im.shape)\n', (1568, 1591), True, 'import scipy.fftpack as fp\n'), ((1762, 1855), 'skimage.draw... |
"""
mark domains/boundaries with dolfin MeshFunctions
"""
from dolfin import *
from importlib import import_module
from .params_geo import *
import numpy
synonymes = {
"pore":{"poretop", "porecenter", "porebottom"},
"fluid":{"bulkfluid","pore"},
"sin":"membranesin",
"au":"membraneau",
"sam":"membr... | [
"numpy.tan",
"numpy.cos",
"numpy.sqrt"
] | [((976, 1003), 'numpy.sqrt', 'numpy.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (986, 1003), False, 'import numpy\n'), ((1463, 1497), 'numpy.tan', 'numpy.tan', (['(angle2 * numpy.pi / 180)'], {}), '(angle2 * numpy.pi / 180)\n', (1472, 1497), False, 'import numpy\n'), ((1504, 1538), 'numpy.cos', 'numpy.co... |
import os
import math
import codecs
import numpy as np
from PIL import Image, ImageEnhance
from config import train_parameters
def resize_img(img, target_size):
"""
强制缩放图片
:param img:
:param target_size:
:return:
"""
img = img.resize((target_size[1], target_size[2]), Image.BILINEAR)
re... | [
"numpy.random.uniform",
"PIL.ImageEnhance.Brightness",
"codecs.open",
"math.sqrt",
"PIL.ImageEnhance.Color",
"PIL.ImageEnhance.Contrast",
"PIL.Image.open",
"numpy.random.randint",
"numpy.array",
"PIL.Image.fromarray",
"numpy.random.shuffle"
] | [((872, 894), 'math.sqrt', 'math.sqrt', (['target_area'], {}), '(target_area)\n', (881, 894), False, 'import math\n'), ((962, 1003), 'numpy.random.randint', 'np.random.randint', (['(0)', '(img.size[0] - w + 1)'], {}), '(0, img.size[0] - w + 1)\n', (979, 1003), True, 'import numpy as np\n'), ((1012, 1053), 'numpy.random... |
import numpy as np
import pandas as pd
from ..abstract_base_classes.solver_abc import SolverABC
from scipy.optimize import Bounds, LinearConstraint, basinhopping, minimize
from ....models.strategy_optimal import StrategyOptimal
__all__ = ['StrategyOptimalSolver']
#DIVIDER = 10**6
DIVIDER = {
'SBER': 10**6,
... | [
"scipy.optimize.minimize",
"numpy.sum",
"scipy.optimize.LinearConstraint",
"numpy.cumsum",
"scipy.optimize.Bounds",
"numpy.min",
"numpy.array"
] | [((4572, 4627), 'numpy.array', 'np.array', (['([volume_to_liquidate / num_steps] * num_steps)'], {}), '([volume_to_liquidate / num_steps] * num_steps)\n', (4580, 4627), True, 'import numpy as np\n'), ((4645, 4695), 'scipy.optimize.Bounds', 'Bounds', (['(0)', 'volume_to_liquidate'], {'keep_feasible': '(True)'}), '(0, vo... |
"""
Provides classes that represent quasar continuum objects.
"""
import abc
import scipy.interpolate
import numpy as np
import qusp
class Continuum(object):
"""
Abstract base class for quasar continuum objects.
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
raise NotImplementedE... | [
"h5py.File",
"numpy.ones_like",
"numpy.argmax",
"qusp.wavelength.Wavelength",
"qusp.SpectralFluxDensity"
] | [((1023, 1042), 'h5py.File', 'h5py.File', (['specfits'], {}), '(specfits)\n', (1032, 1042), False, 'import h5py\n'), ((2499, 2542), 'numpy.argmax', 'np.argmax', (["(target['target'] == self.targets)"], {}), "(target['target'] == self.targets)\n", (2508, 2542), True, 'import numpy as np\n'), ((3236, 3296), 'qusp.Spectra... |
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
from voronoi.events import CircleEvent
class Colors:
SWEEP_LINE = "#636e72"
CELL_POINTS = "black"
BEACH_LINE = "#636e72"
EDGE = "#636e72"
ARC = "#b2bec3"
INCIDENT_POINT_POINTER = "#dfe6e9"
INVALID_CIRCL... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.patches.Circle",
"numpy.min",
"matplotlib.pyplot.Circle",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((644, 654), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (652, 654), True, 'import matplotlib.pyplot as plt\n'), ((704, 734), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(17, 17)'}), '(figsize=(17, 17))\n', (716, 734), True, 'import matplotlib.pyplot as plt\n'), ((872, 883), 'matplotlib... |
import sys
import numpy as np
from collections import defaultdict
def DumpHistogram(h):
f = open("hist.txt", 'w')
for addr in sorted(h.keys()):
print >>f, hex(addr), h[addr]
f.close()
def CollectSamples(infile):
histogram = defaultdict(int)
checkpointctr = 0
while True:
buf =... | [
"collections.defaultdict",
"numpy.frombuffer"
] | [((252, 268), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (263, 268), False, 'from collections import defaultdict\n'), ((397, 426), 'numpy.frombuffer', 'np.frombuffer', (['buf', 'np.uint16'], {}), '(buf, np.uint16)\n', (410, 426), True, 'import numpy as np\n')] |
# USDA_CoA_Cropland.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
"""
Functions used to import and parse USDA Census of Ag Cropland data
in NAICS format
"""
import json
import numpy as np
import pandas as pd
from flowsa.location import US_FIPS, abbrev_us_state
from flowsa.common import WITHDRAWN_KEYWORD, \
f... | [
"pandas.DataFrame",
"flowsa.flowbyfunctions.assign_fips_location_system",
"json.loads",
"flowsa.flowbyfunctions.equally_allocate_suppressed_parent_to_child_naics",
"numpy.where",
"pandas.concat"
] | [((2261, 2282), 'json.loads', 'json.loads', (['resp.text'], {}), '(resp.text)\n', (2271, 2282), False, 'import json\n'), ((2301, 2341), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "cropland_json['data']"}), "(data=cropland_json['data'])\n", (2313, 2341), True, 'import pandas as pd\n'), ((2671, 2701), 'pandas.conc... |
# This file implements the search methods for some parameters
from ascii import preprocess_ascii, image_to_ascii, post_process
import cv2 as cv
import numpy as np
import os
def draw_patch(image, x0, y0, Tw, Th, Rw, Rh, idx):
image = np.asarray(image)
image = cv.cvtColor(image, cv.COLOR_BGR2RGB)
for i in r... | [
"os.mkdir",
"cv2.cvtColor",
"ascii.preprocess_ascii",
"numpy.asarray",
"os.path.exists",
"cv2.imread",
"ascii.image_to_ascii",
"cv2.rectangle"
] | [((239, 256), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (249, 256), True, 'import numpy as np\n'), ((269, 305), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2RGB'], {}), '(image, cv.COLOR_BGR2RGB)\n', (280, 305), True, 'import cv2 as cv\n'), ((974, 1020), 'ascii.preprocess_ascii', 'preproce... |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, random_split, Subset
import json, time, pickle, csv, re, os, gc, logging, zlib, orjson, joblib
import numpy as np
from tqdm import tqdm
from sklearn.... | [
"torch.nn.Dropout",
"numpy.random.seed",
"torch.nn.Embedding",
"torch.cat",
"torch.no_grad",
"numpy.round",
"torch.ones",
"torch.utils.data.DataLoader",
"numpy.power",
"torch.load",
"os.path.exists",
"torch.nn.Embedding.from_pretrained",
"reformer_pytorch.ReformerLM",
"torch.nn.functional.... | [((5907, 6091), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': "(log_dir + 'train1116.log')", 'filemode': '"""a"""', 'format': '"""%(asctime)s %(name)s:%(levelname)s:%(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'level': 'logging.INFO'}), "(filename=log_dir + 'train1116.log', filemode='a',\n ... |
"""
Interactron Random Training Loop
The interactorn model is trained on random sequences of data.
"""
import math
from tqdm import tqdm
import numpy as np
import os
from datetime import datetime
import torch
from torch.utils.data.dataloader import DataLoader
from datasets.sequence_dataset import SequenceDataset
fr... | [
"datasets.sequence_dataset.SequenceDataset",
"datetime.datetime.now",
"numpy.mean",
"torch.cuda.is_available",
"math.cos",
"torch.utils.data.dataloader.DataLoader",
"torch.cuda.current_device",
"torch.nn.DataParallel",
"os.path.join"
] | [((992, 1033), 'os.path.join', 'os.path.join', (['self.out_dir', '"""detector.pt"""'], {}), "(self.out_dir, 'detector.pt')\n", (1004, 1033), False, 'import os\n'), ((1064, 1209), 'datasets.sequence_dataset.SequenceDataset', 'SequenceDataset', (['config.DATASET.TRAIN.IMAGE_ROOT', 'config.DATASET.TRAIN.ANNOTATION_ROOT', ... |
#!/usr/bin/env python3
from typing import List
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from info import EEG_SHAPE, participants
band_names = ['delta', 'theta', 'alpha', 'beta', 'gamma']
if __name__ == '__main__':
T, H, W, R =... | [
"numpy.load",
"numpy.ravel",
"numpy.var",
"numpy.amax",
"numpy.max",
"numpy.min",
"numpy.mean",
"numpy.exp",
"matplotlib.pyplot.subplots"
] | [((342, 382), 'numpy.load', 'np.load', (['"""data/data-processed-bands.npz"""'], {}), "('data/data-processed-bands.npz')\n", (349, 382), True, 'import numpy as np\n'), ((478, 541), 'matplotlib.pyplot.subplots', 'plt.subplots', (['R', 'C'], {'sharex': '"""all"""', 'sharey': '"""all"""', 'figsize': '(12, 4)'}), "(R, C, s... |
import numpy as np
import scipy.linalg
def register_points(P, Q, allowReflection = False):
'''
Find the best-fit rigid transformation aligning points in Q to points in P:
min_(R, t) sum_i ||P_i - (R Q_i + t)||^2
Parameters
----------
P : (N, D) array_like
Collection of N points... | [
"numpy.linalg.det",
"numpy.mean",
"numpy.linalg.eig",
"numpy.sqrt"
] | [((582, 600), 'numpy.mean', 'np.mean', (['P'], {'axis': '(0)'}), '(P, axis=0)\n', (589, 600), True, 'import numpy as np\n'), ((635, 653), 'numpy.mean', 'np.mean', (['Q'], {'axis': '(0)'}), '(Q, axis=0)\n', (642, 653), True, 'import numpy as np\n'), ((1350, 1368), 'numpy.mean', 'np.mean', (['V'], {'axis': '(0)'}), '(V, ... |
from anndata import read_h5ad
import sys
from time import time
from scipy import stats, sparse
import numpy as np
import collections
import pickle
from sklearn.preprocessing import normalize
import os
from collections import Counter
from scipy import spatial
from sklearn.model_selection import train_test_split
from skl... | [
"numpy.sum",
"numpy.argmax",
"numpy.ones",
"collections.defaultdict",
"numpy.shape",
"numpy.mean",
"sys.stdout.flush",
"numpy.linalg.norm",
"sklearn.utils.graph_shortest_path.graph_shortest_path",
"numpy.diag",
"numpy.unique",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.copy",
"sc... | [((1270, 1304), 'numpy.concatenate', 'np.concatenate', (['(seen_l, unseen_l)'], {}), '((seen_l, unseen_l))\n', (1284, 1304), True, 'import numpy as np\n'), ((1412, 1441), 'collections.defaultdict', 'collections.defaultdict', (['dict'], {}), '(dict)\n', (1435, 1441), False, 'import collections\n'), ((1453, 1473), 'numpy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import tqdm
def fitness(length):
return 1 / length
def route_length(route, distance_matrix):
n = route.size
idx = np.concatenate((route, [route[0]]))
length = np.sum(distance_matrix[idx[:n], idx[1:n+1]... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"numpy.flip",
"numpy.sum",
"matplotlib.pyplot.plot",
"tqdm.trange",
"matplotlib.pyplot.show",
"numpy.ceil",
"numpy.zeros",
"numpy.argsort",
"numpy.random.randint",
"numpy.array",
"numpy.linalg.norm",
"numpy.random.choice",
"numpy.ra... | [((229, 264), 'numpy.concatenate', 'np.concatenate', (['(route, [route[0]])'], {}), '((route, [route[0]]))\n', (243, 264), True, 'import numpy as np\n'), ((278, 324), 'numpy.sum', 'np.sum', (['distance_matrix[idx[:n], idx[1:n + 1]]'], {}), '(distance_matrix[idx[:n], idx[1:n + 1]])\n', (284, 324), True, 'import numpy as... |
#!/usr/bin/env pypy3 python3
import os
import time
import glob
import pandas as pd
import sys
import matplotlib.pyplot as plt
import seaborn as sns
from collections import OrderedDict
from decimal import Decimal
from scipy.stats import hypergeom
import math
import mechanize
from urllib.error import HTTPError
import nu... | [
"os.remove",
"argparse.ArgumentParser",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"glob.glob",
"matplotlib.pyplot.tick_params",
"sys.setrecursionlimit",
"matplotlib.pyplot.hlines",
"os.path.join",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.cm.ScalarMappable",
"collections.OrderedDict.... | [((357, 368), 'time.time', 'time.time', ([], {}), '()\n', (366, 368), False, 'import time\n'), ((374, 385), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (383, 385), False, 'import os\n'), ((421, 490), 'glob.glob', 'glob.glob', (["(wd + '/' + 'Functional-datafiles' + '/' + 'conversation/*')"], {}), "(wd + '/' + 'Function... |
import errno
import os
import pickle
import numpy
from utilities_nn.ResourceManager import ResourceManager
class WordVectorsManager(ResourceManager):
def __init__(self, corpus=None, dim=None, omit_non_english=False):
super().__init__()
self.omit_non_english = omit_non_english
self.wv_filena... | [
"pickle.dump",
"os.path.dirname",
"numpy.asarray",
"os.path.exists",
"pickle.load",
"os.strerror"
] | [((721, 754), 'os.path.exists', 'os.path.exists', (['_word_vector_file'], {}), '(_word_vector_file)\n', (735, 754), False, 'import os\n'), ((2352, 2380), 'os.path.exists', 'os.path.exists', (['_parsed_file'], {}), '(_parsed_file)\n', (2366, 2380), False, 'import os\n'), ((640, 665), 'os.path.dirname', 'os.path.dirname'... |
#!/usr/bin/env python
# <NAME>
# Plot the "region plot" of BGC candidates in a bacterial genomes (horizontal colored lines for each model).
import argparse
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
def candidate_regions(cands, safety_limit=50, xlim=0, xstep=100000, colors=None)... | [
"os.mkdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.cm.tab10",
"pandas.read_csv",
"matplotlib.pyplot.close",
"matplotlib.pyplot.style.context",
"numpy.ones",
"numpy.arange",
"matplotlib.pyplot.subplots",
"pandas.concat"
] | [((3497, 3511), 'matplotlib.pyplot.close', 'plt.close', (['fig'], {}), '(fig)\n', (3506, 3511), True, 'import matplotlib.pyplot as plt\n'), ((3622, 3647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3645, 3647), False, 'import argparse\n'), ((5066, 5082), 'pandas.concat', 'pd.concat', (['ca... |
import random
import json
import argparse
import numpy as np
import cv2
import tensorflow as tf
from colormath.color_diff import delta_e_cie1976
from colormath.color_objects import LabColor
from utils.helpers import load_module
from vehicle_attributes.trainer import create_session, resnet_v1_10_1
from vehicle_attrib... | [
"argparse.ArgumentParser",
"tensorflow.logging.set_verbosity",
"colormath.color_objects.LabColor",
"vehicle_attributes.readers.vehicle_attributes_json.BarrierAttributesJson.one_hot_annotation_to_type",
"tensorflow.estimator.Estimator",
"cv2.rectangle",
"cv2.imshow",
"cv2.cvtColor",
"vehicle_attribut... | [((416, 505), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Perform inference of vehicle attributes model"""'}), "(description=\n 'Perform inference of vehicle attributes model')\n", (439, 505), False, 'import argparse\n'), ((652, 687), 'numpy.zeros', 'np.zeros', (['(1, 1, 3)'], {'dt... |
# -*- coding: utf-8 -*-
"""
Classes in this module enhance several stationary covariance functions with the
Stochastic Differential Equation (SDE) functionality.
"""
from .rbf import RBF
from .stationary import Exponential
from .stationary import RatQuad
import numpy as np
import scipy as sp
try:
from scipy.linalg... | [
"scipy.poly1d",
"scipy.roots",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.mod",
"numpy.math.factorial",
"numpy.array",
"numpy.arange",
"numpy.real",
"numpy.dot",
"GPy.models.state_space_main.balance_ss_model",
"numpy.sqrt"
] | [((1316, 1336), 'numpy.math.factorial', 'np.math.factorial', (['N'], {}), '(N)\n', (1333, 1336), True, 'import numpy as np\n'), ((1505, 1527), 'numpy.zeros', 'np.zeros', (['(2 * N + 1,)'], {}), '((2 * N + 1,))\n', (1513, 1527), True, 'import numpy as np\n'), ((1772, 1785), 'scipy.poly1d', 'sp.poly1d', (['pp'], {}), '(p... |
"""
Script for translating the KITTI 3D bounding box annotation format into the BB3TXT data format.
A BB3TXT file is formatted like this:
filename label confidence xmin ymin xmax ymax fblx fbly fbrx fbry rblx rbly ftly
filename label confidence xmin ymin xmax ymax fblx fbly fbrx fbry rblx rbly ftly
filename label conf... | [
"argparse.ArgumentParser",
"os.path.isfile",
"mappings.utils.LabelMappingManager",
"os.path.join",
"numpy.copy",
"cv2.imwrite",
"os.path.dirname",
"os.path.exists",
"numpy.max",
"argparse.FileType",
"mappings.utils.available_categories",
"os.path.basename",
"numpy.min",
"cv2.flip",
"os.l... | [((1537, 1558), 'mappings.utils.LabelMappingManager', 'LabelMappingManager', ([], {}), '()\n', (1556, 1558), False, 'from mappings.utils import LabelMappingManager\n'), ((3286, 3487), 'numpy.asmatrix', 'np.asmatrix', (['[[l / 2, -l / 2, l / 2, -l / 2, l / 2, -l / 2, l / 2, -l / 2], [0, 0, 0, 0,\n -h, -h, -h, -h], [-... |
import pytest
import zarr
from numpy import zeros
from ome_zarr.data import create_zarr
from ome_zarr.format import FormatV01, FormatV02, FormatV03
from ome_zarr.io import parse_url
from ome_zarr.reader import Label, Labels, Multiscales, Node, Plate, Well
from ome_zarr.writer import write_image, write_plate_metadata, ... | [
"ome_zarr.format.FormatV01",
"ome_zarr.writer.write_plate_metadata",
"ome_zarr.writer.write_well_metadata",
"pytest.fixture",
"numpy.zeros",
"ome_zarr.format.FormatV02",
"zarr.group",
"ome_zarr.format.FormatV03",
"pytest.mark.parametrize",
"ome_zarr.io.parse_url",
"pytest.mark.xfail"
] | [((363, 391), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (377, 391), False, 'import pytest\n'), ((1351, 1379), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1365, 1379), False, 'import pytest\n'), ((4109, 4182), 'pytest.mark.xfail', 'pyte... |
import typing
import time
import numpy as np
import pyautogui as pg
import vboard as vb
class MouseClicker:
def __init__(self):
scr = vb.make_screenshot(bw=False)
self.screenshot_wh = scr.shape[::-1]
self.screen_wh = tuple(pg.size())
def click(self, ploc: typing.Tuple[int, int], lef... | [
"time.sleep",
"vboard.cellid_as_pixelloc",
"numpy.ravel_multi_index",
"vboard.make_screenshot",
"pyautogui.click",
"pyautogui.size",
"pyautogui.moveTo"
] | [((150, 178), 'vboard.make_screenshot', 'vb.make_screenshot', ([], {'bw': '(False)'}), '(bw=False)\n', (168, 178), True, 'import vboard as vb\n'), ((492, 519), 'pyautogui.moveTo', 'pg.moveTo', (['sloc[0]', 'sloc[1]'], {}), '(sloc[0], sloc[1])\n', (501, 519), True, 'import pyautogui as pg\n'), ((579, 602), 'pyautogui.cl... |
"""
Data readers for remote sensing devices (e.g., 3D data)
Based on https://github.com/NWTC/datatools/blob/master/remote_sensing.py
"""
import numpy as np
import pandas as pd
expected_profiler_datatypes=['wind','winds','rass']
def profiler(fname,scans=None,
data_type=None,
datetime_format=... | [
"pandas.DataFrame",
"pandas.datetime.today",
"numpy.max",
"numpy.arange",
"pandas.to_datetime",
"pandas.concat"
] | [((5468, 5489), 'pandas.concat', 'pd.concat', (['dataframes'], {}), '(dataframes)\n', (5477, 5489), True, 'import pandas as pd\n'), ((12293, 12346), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'block', 'columns': 'header', 'dtype': 'float'}), '(data=block, columns=header, dtype=float)\n', (12305, 12346), True, 'i... |
import datetime
from .functions import read_json, aggregate_surveys_no_config
import glob
import json
import logging
import math
import numpy as np
import os
import pandas as pd
import pytz
from typing import List
def convert_time_to_date(submit_time, day, time):
"""
Takes a single array of timings and a sing... | [
"pandas.DataFrame",
"pandas.Timestamp",
"math.ceil",
"pandas.merge",
"pandas.offsets.Micro",
"numpy.where",
"numpy.array",
"pandas.Series",
"datetime.timedelta",
"pandas.Timedelta",
"pandas.concat"
] | [((2432, 2456), 'pandas.Timestamp', 'pd.Timestamp', (['time_start'], {}), '(time_start)\n', (2444, 2456), True, 'import pandas as pd\n'), ((2469, 2491), 'pandas.Timestamp', 'pd.Timestamp', (['time_end'], {}), '(time_end)\n', (2481, 2491), True, 'import pandas as pd\n'), ((2586, 2608), 'math.ceil', 'math.ceil', (['(week... |
import numpy as np
def linear_y(t0, t_step, slope, y0):
"""
A function to generate y values that satisfied to linear relationship with independent value t_list, slope, and start point of y
Parameters:
-----------
t0: t0, with dependent variable as startpoint_y
t_step: step of t
slope: slop... | [
"numpy.max",
"numpy.abs",
"numpy.random.normal"
] | [((2231, 2272), 'numpy.random.normal', 'np.random.normal', (['deltat_mean', 'deltat_std'], {}), '(deltat_mean, deltat_std)\n', (2247, 2272), True, 'import numpy as np\n'), ((2286, 2327), 'numpy.random.normal', 'np.random.normal', (['deltas_mean', 'deltas_std'], {}), '(deltas_mean, deltas_std)\n', (2302, 2327), True, 'i... |
import numpy as np
from typing import Optional, Union, Sequence, List, Callable, Tuple
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage import map_coordinates
import itertools
import collections
from collections import OrderedDict
import torch
import os
from scipy import ndimage as ndi
from batc... | [
"numpy.arange",
"numpy.unique",
"numpy.pad",
"numpy.meshgrid",
"numpy.stack",
"torch.where",
"numpy.floor_divide",
"numpy.asarray",
"numpy.squeeze",
"numpy.vstack",
"numpy.random.uniform",
"numpy.subtract",
"numpy.zeros",
"numpy.unravel_index",
"numpy.expand_dims",
"numpy.any",
"nump... | [((1082, 1105), 'numpy.array', 'np.array', (['data[0].shape'], {}), '(data[0].shape)\n', (1090, 1105), True, 'import numpy as np\n'), ((1122, 1141), 'numpy.array', 'np.array', (['new_shape'], {}), '(new_shape)\n', (1130, 1141), True, 'import numpy as np\n'), ((1149, 1175), 'numpy.any', 'np.any', (['(shape != new_shape)... |
import numpy as np
# print('numpy:', np.__version__)
# print(dir(np))
# Listas de Python Normal
python_list = [1, 2, 3, 4, 5]
two_dimensional_list = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
# Criando um numpy (numeral python) array de uma python list
numpy_array_from_list_with_int = np.array(python_list)
# Criando uma num... | [
"numpy.array"
] | [((280, 301), 'numpy.array', 'np.array', (['python_list'], {}), '(python_list)\n', (288, 301), True, 'import numpy as np\n'), ((370, 404), 'numpy.array', 'np.array', (['python_list'], {'dtype': 'float'}), '(python_list, dtype=float)\n', (378, 404), True, 'import numpy as np\n'), ((474, 512), 'numpy.array', 'np.array', ... |
import numpy as np
import pandas as pd
import anomaly_detection
dat = np.random.random(24*4*30) + 10
dts = pd.date_range(start='2018-08-01', freq='15min', periods=24*4*30)
df = pd.DataFrame(dat, index=dts, columns=['y'])
outliers = np.random.randint(low=0, high=24*4*30, size=20)
df.y.iloc[outliers] = df.y.iloc[outlie... | [
"pandas.DataFrame",
"numpy.random.randint",
"pandas.date_range",
"numpy.random.random"
] | [((108, 176), 'pandas.date_range', 'pd.date_range', ([], {'start': '"""2018-08-01"""', 'freq': '"""15min"""', 'periods': '(24 * 4 * 30)'}), "(start='2018-08-01', freq='15min', periods=24 * 4 * 30)\n", (121, 176), True, 'import pandas as pd\n'), ((178, 221), 'pandas.DataFrame', 'pd.DataFrame', (['dat'], {'index': 'dts',... |
# Copyright 2019, Imperial College London
#
# CO416 - Machine Learning for Imaging
#
# This file: Functions to visualise medical imaging data.
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from ipywidgets import interact, fixed
from IPython.display import display
# Calculate parameters... | [
"matplotlib.pyplot.show",
"numpy.floor",
"SimpleITK.GetArrayFromImage",
"numpy.max",
"numpy.min",
"ipywidgets.fixed",
"matplotlib.pyplot.subplots"
] | [((629, 656), 'SimpleITK.GetArrayFromImage', 'sitk.GetArrayFromImage', (['img'], {}), '(img)\n', (651, 656), True, 'import SimpleITK as sitk\n'), ((1317, 1352), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {'figsize': '(10, 4)'}), '(1, 3, figsize=(10, 4))\n', (1329, 1352), True, 'import matplotlib.pyp... |
import numpy as np
from multiprocessing import Pool, cpu_count
import statsmodels.api as sm
from tqdm import tqdm
from itertools import product
import pandas as pd
# Load files from parent folders
import os
import sys
try:sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
except NameError: pr... | [
"numpy.random.uniform",
"numpy.nansum",
"os.path.abspath",
"numpy.random.seed",
"numpy.isnan",
"statsmodels.api.stats.ztest",
"itertools.product",
"numpy.concatenate",
"multiprocessing.cpu_count"
] | [((585, 602), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (599, 602), True, 'import numpy as np\n'), ((503, 531), 'numpy.concatenate', 'np.concatenate', (['args'], {'axis': '(1)'}), '(args, axis=1)\n', (517, 531), True, 'import numpy as np\n'), ((1256, 1294), 'itertools.product', 'product', (['n_rang... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 13 16:49:29 2020
Copyright 2020 by <NAME>.
"""
# Standard imports:
import numpy as np
def fpcond(F):
"""Enforce the pole condition for the DFS coefficients F."""
# Get the dimension:
n = len(F)
Fp = np.zeros([n, n], dtype=compl... | [
"numpy.arange",
"numpy.linalg.inv",
"numpy.zeros",
"numpy.ones"
] | [((292, 323), 'numpy.zeros', 'np.zeros', (['[n, n]'], {'dtype': 'complex'}), '([n, n], dtype=complex)\n', (300, 323), True, 'import numpy as np\n'), ((389, 404), 'numpy.ones', 'np.ones', (['[2, n]'], {}), '([2, n])\n', (396, 404), True, 'import numpy as np\n'), ((598, 613), 'numpy.ones', 'np.ones', (['[2, n]'], {}), '(... |
import os
import pickle
import numpy as np
import errno
def do_pickle(pickle_bool, pickle_name, num_args, func, *args, **kwargs):
'''
General function to handle pickling.
@func: call this guy to get the result if pickle file not available.
'''
if not pickle_bool:
rets = func(*args, **kwargs... | [
"pickle.dump",
"os.makedirs",
"os.path.isdir",
"os.path.isfile",
"pickle.load",
"numpy.array",
"numpy.vstack"
] | [((971, 1014), 'numpy.vstack', 'np.vstack', (['(train_genuine, train_impostors)'], {}), '((train_genuine, train_impostors))\n', (980, 1014), True, 'import numpy as np\n'), ((1200, 1216), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (1208, 1216), True, 'import numpy as np\n'), ((334, 361), 'os.path.isfile'... |
from time import time
import numpy as np
from models import convolutional_model
from pre_process import next_batch
from triplet_loss import deep_speaker_loss
from constants import BATCH_NUM_TRIPLETS
if __name__ == '__main__':
b = next_batch()
num_frames = b.shape[0]
model = convolutional_model(batch_inp... | [
"pre_process.next_batch",
"numpy.random.uniform",
"time.time",
"numpy.reshape",
"numpy.concatenate"
] | [((237, 249), 'pre_process.next_batch', 'next_batch', ([], {}), '()\n', (247, 249), False, 'from pre_process import next_batch\n'), ((611, 617), 'time.time', 'time', ([], {}), '()\n', (615, 617), False, 'from time import time\n'), ((649, 661), 'pre_process.next_batch', 'next_batch', ([], {}), '()\n', (659, 661), False,... |
import numpy as np
import pytest
from pyha import Hardware, Complex, Sfix, default_complex, simulate, sims_close
from pyha.common.datavalid import DataValid, NumpyToDataValid
class FFTPower(Hardware):
"""
FFTPower
--------
Multiplies complex input by its conjugate: (a + bi)(a - bi) = a**2 + b**2
... | [
"numpy.random.uniform",
"pyha.Complex",
"pyha.Sfix",
"pyha.common.datavalid.DataValid",
"pyha.simulate",
"pyha.sims_close",
"pytest.mark.parametrize",
"numpy.conjugate",
"pyha.common.datavalid.NumpyToDataValid"
] | [((1201, 1265), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_power"""', '[0.5, 0.1, 0.001, 1e-05]'], {}), "('input_power', [0.5, 0.1, 0.001, 1e-05])\n", (1224, 1265), False, 'import pytest\n'), ((1485, 1561), 'pyha.simulate', 'simulate', (['dut', 'inp'], {'pipeline_flush': '"""auto"""', 'simulation... |
# -*- coding: utf-8 -*-
"""
Created on Thu 01/10/2020
----------------------------
@author: <NAME>
PLASMON Data Analysis
class dataset & roi
The dataset and ROI class of v2 of program. Dataset is one nd2 file, ROIs are region of interest.
-----------------
v2.0: part of v2.0: 15/10/2020
"""
# GENERAL IMPORTS
imp... | [
"numpy.asarray",
"skimage.feature.match_template",
"numpy.ones",
"numpy.amax",
"numpy.fliplr",
"numpy.array_equal",
"scipy.fft.fft2",
"numpy.sqrt"
] | [((6604, 6642), 'skimage.feature.match_template', 'match_template', (['frame_big', 'frame_small'], {}), '(frame_big, frame_small)\n', (6618, 6642), False, 'from skimage.feature import match_template\n'), ((7247, 7283), 'numpy.array_equal', 'np.array_equal', (['frame_new', 'frame_old'], {}), '(frame_new, frame_old)\n', ... |
"""gauss_mod_p.py
This module implements Gaussian elimination by columns modulo a prime
number p.
"""
import numpy as np
from .arithmetic_mod_p import add_arrays_mod_c, inv_mod_p
###############################################################################
# Index searching function
def _index_pivot(l):
"""Re... | [
"numpy.size",
"numpy.transpose",
"numpy.identity",
"numpy.nonzero",
"numpy.any",
"numpy.array"
] | [((584, 597), 'numpy.nonzero', 'np.nonzero', (['l'], {}), '(l)\n', (594, 597), True, 'import numpy as np\n'), ((1562, 1575), 'numpy.size', 'np.size', (['A', '(1)'], {}), '(A, 1)\n', (1569, 1575), True, 'import numpy as np\n'), ((1717, 1731), 'numpy.identity', 'np.identity', (['N'], {}), '(N)\n', (1728, 1731), True, 'im... |
# Python Standard Libraries
import numpy as np
# grAdapt
from .base import Equidistributed
from grAdapt.utils.sampling import sample_points_bounds
from grAdapt.utils.math.spatial import pairwise_distances
class MaximalMinDistance(Equidistributed):
"""Maximal min distance sampling method
A fixed amount of po... | [
"numpy.min",
"numpy.array",
"grAdapt.utils.sampling.sample_points_bounds",
"numpy.argmax"
] | [((2098, 2134), 'grAdapt.utils.sampling.sample_points_bounds', 'sample_points_bounds', (['self.bounds', '(1)'], {}), '(self.bounds, 1)\n', (2118, 2134), False, 'from grAdapt.utils.sampling import sample_points_bounds\n'), ((2364, 2416), 'grAdapt.utils.sampling.sample_points_bounds', 'sample_points_bounds', (['self.boun... |
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import pandas as pd
import numpy as np
import datetime
def load_data(filename, training=True):
data = pd.read_csv(filename)
flight_code = data['flight_no'].to_numpy()
week = data['Week'].to_numpy()
destination = data['Arrival'].to... | [
"numpy.full",
"pandas.read_csv",
"sklearn.preprocessing.OneHotEncoder",
"datetime.date",
"sklearn.preprocessing.LabelEncoder",
"numpy.concatenate"
] | [((172, 193), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (183, 193), True, 'import pandas as pd\n'), ((622, 651), 'numpy.full', 'np.full', (['N', 'np.nan'], {'dtype': 'int'}), '(N, np.nan, dtype=int)\n', (629, 651), True, 'import numpy as np\n'), ((671, 700), 'numpy.full', 'np.full', (['N', '... |
import numpy as np
from scipy.integrate import odeint
from scipy.optimize import brentq
logistic = lambda x : 4*x*(1-x)
class ChaosGenerator () :
"""
Base class for the chaotic generator
Contains functions for generating chaotic numbers and subsequently
evolving the states of the internal generators
... | [
"numpy.ndindex",
"numpy.abs",
"numpy.log",
"numpy.copy",
"numpy.invert",
"scipy.optimize.brentq",
"numpy.random.random_sample",
"numpy.power",
"numpy.square",
"numpy.min",
"numpy.where",
"numpy.array",
"numpy.exp",
"numpy.arange",
"numpy.linspace",
"numpy.random.rand",
"numpy.max",
... | [((14043, 14053), 'numpy.exp', 'np.exp', (['(-4)'], {}), '(-4)\n', (14049, 14053), True, 'import numpy as np\n'), ((2446, 2465), 'numpy.copy', 'np.copy', (['self.cgens'], {}), '(self.cgens)\n', (2453, 2465), True, 'import numpy as np\n'), ((3903, 3913), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (3910, 3913), True,... |
from PIL import Image
import numpy as np
im = Image.open('../bbtor.jpg').convert('L')
a = np.array(im)[::2, ::2]
gx = np.array([[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1]])
gy = np.array([[-1, -2, -1],
[ 0, 0, 0],
[ 1, 2, 1]])
sobel = np.zeros(a.shape)
for ... | [
"numpy.sum",
"numpy.zeros",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"numpy.sqrt"
] | [((122, 168), 'numpy.array', 'np.array', (['[[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]'], {}), '([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]])\n', (130, 168), True, 'import numpy as np\n'), ((205, 251), 'numpy.array', 'np.array', (['[[-1, -2, -1], [0, 0, 0], [1, 2, 1]]'], {}), '([[-1, -2, -1], [0, 0, 0], [1, 2, 1]])\n', (213, 251), ... |
"""Simulate Lorentz's system ODE and discover edes.
Script accepts also optional comand line arguments:
arg0 -- number of samples/models
arg1 -- custom nickname of log that is added to the log filename, which is of
the form: log_lorenz_<custom nickname><random number>.log
"""
import time
import os
import sys ... | [
"numpy.random.seed",
"scipy.integrate.solve_ivp",
"time.perf_counter",
"ProGED.equation_discoverer.EqDisco",
"numpy.random.random",
"numpy.linspace",
"ProGED.examples.tee_so.Tee",
"numpy.concatenate"
] | [((604, 623), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (621, 623), False, 'import time\n'), ((2135, 2152), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (2149, 2152), True, 'import numpy as np\n'), ((2157, 2186), 'numpy.linspace', 'np.linspace', (['(0.48)', '(0.85)', '(1000)'], {}), ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 10:09:44 2012
@author: schelle
"""
import matplotlib.pyplot as plt
import numpy as np
def sCurve(X,a=0.0,b=1.0,c=1.0):
s = 1.0/(b + np.exp(-c * (X-a)))
return s
dem50 = 300
dem90 = 313
dem10 = 275
perc = 0.9
C = -np.log(1.0/(perc) - 1)/(dem90 - dem50)
C... | [
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.arange",
"numpy.exp"
] | [((509, 547), 'matplotlib.pyplot.plot', 'plt.plot', (['zz', 'S'], {'label': '"""fitted to 90%"""'}), "(zz, S, label='fitted to 90%')\n", (517, 547), True, 'import matplotlib.pyplot as plt\n'), ((546, 585), 'matplotlib.pyplot.plot', 'plt.plot', (['zz', 'SS'], {'label': '"""fitted to 10%"""'}), "(zz, SS, label='fitted to... |
# Copyright (c) 2018, Xilinx
# All rights reserved.
#
# 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 th... | [
"copy.deepcopy",
"FINN.core.layers.isMatrixLayer",
"FINN.core.layers.isConvLayer",
"numpy.ceil",
"numpy.asarray",
"FINN.core.layers.MatrixThresholdLayer",
"numpy.zeros",
"numpy.ones",
"FINN.core.quantize.quantize_matrix",
"FINN.core.layers.isFCLayer",
"FINN.core.layers.isLinearLayer",
"FINN.co... | [((2486, 2509), 'copy.deepcopy', 'copy.deepcopy', (['pipeline'], {}), '(pipeline)\n', (2499, 2509), False, 'import copy\n'), ((2827, 2850), 'FINN.core.layers.isMatrixLayer', 'lb.isMatrixLayer', (['layer'], {}), '(layer)\n', (2843, 2850), True, 'import FINN.core.layers as lb\n'), ((2865, 2885), 'copy.deepcopy', 'copy.de... |
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import datasets
import sys
import os
import numpy as np
import pandas as pd
from transformers import AutoModel, BertTokenizerFast, AutoModelForSequenceClassification, BertConfig, DataCollatorWithPadding
from transformers import AutoToke... | [
"wandb.log",
"numpy.random.seed",
"argparse.ArgumentParser",
"ipdb.set_trace",
"wandb.watch",
"numpy.argmax",
"torch.nn.Softmax",
"transformers.DataCollatorWithPadding",
"torch.no_grad",
"datasets.load_dataset",
"torch.utils.data.DataLoader",
"transformers.BertTokenizerFast.from_pretrained",
... | [((609, 632), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (626, 632), False, 'import torch\n'), ((640, 665), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (663, 665), False, 'import torch\n'), ((749, 769), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)... |
from enum import Enum
import operator
import itertools
import collections
import sys
import numpy as np
import re
from .alignment import AlnStats
class Operation(Enum):
AlnMatch = 0
Insertion = 1
Deletion = 2
Skip = 3
Soft = 4
Hard = 5
Padding = 6
SeqMatch = 7
SeqMismatch = 8
... | [
"numpy.searchsorted",
"sys.stderr.write",
"re.split",
"collections.namedtuple"
] | [((960, 1026), 'collections.namedtuple', 'collections.namedtuple', (['"""AlignedRegion"""', '"""start1 end1 start2 end2"""'], {}), "('AlignedRegion', 'start1 end1 start2 end2')\n", (982, 1026), False, 'import collections\n'), ((9949, 9978), 're.split', 're.split', (['"""([A-Z^]+)"""', 'md_tag'], {}), "('([A-Z^]+)', md_... |
import os
import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score
from sklearn.externals import joblib
from skimage.io import imread
from skimage.filters import threshold_otsu
letters = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
... | [
"skimage.filters.threshold_otsu",
"sklearn.model_selection.cross_val_score",
"os.path.realpath",
"numpy.array",
"sklearn.svm.SVC",
"skimage.io.imread"
] | [((1807, 1845), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""', 'probability': '(True)'}), "(kernel='linear', probability=True)\n", (1810, 1845), False, 'from sklearn.svm import SVC\n'), ((1191, 1254), 'sklearn.model_selection.cross_val_score', 'cross_val_score', (['model', 'train_data', 'train_label'], {'cv'... |
import numpy as np
import itertools
import gpuscheduler
import argparse
import os
import uuid
import hashlib
import glob
import math
from itertools import product
from torch.optim.lr_scheduler import OneCycleLR
from os.path import join
parser = argparse.ArgumentParser(description='Compute script.')
parser.add_argumen... | [
"gpuscheduler.HyakScheduler",
"argparse.ArgumentParser",
"numpy.random.RandomState",
"itertools.product",
"os.path.join"
] | [((247, 301), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute script."""'}), "(description='Compute script.')\n", (270, 301), False, 'import argparse\n'), ((1553, 1655), 'gpuscheduler.HyakScheduler', 'gpuscheduler.HyakScheduler', ([], {'verbose': 'args.verbose', 'account': '""""""... |
#!/usr/bin/env python
# encoding:utf-8
# @Time : 2019/10/4
# @Author : 茶葫芦
# @Site :
# @File : pca.py
import numpy as np
import matplotlib.pyplot as plt
class pca():
def __init__(self,initial_w,n_compents,eta =0.1,epsilon=1e-10,n_iters=1e8):
self.initial_w=initial_w
self.n_compents=n_compe... | [
"numpy.random.uniform",
"numpy.random.seed",
"numpy.empty",
"numpy.random.random",
"numpy.mean",
"numpy.linalg.norm"
] | [((1929, 1949), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (1943, 1949), True, 'import numpy as np\n'), ((1958, 1976), 'numpy.empty', 'np.empty', (['(100, 2)'], {}), '((100, 2))\n', (1966, 1976), True, 'import numpy as np\n'), ((1988, 2023), 'numpy.random.uniform', 'np.random.uniform', (['(0)'... |
"""Contains functions for tasks related to file system.
"""
import os
import shutil
import re
import datetime
import logging
import errno
import numpy as np
import mne
def open_raw(fname, preload=True, verbose='info'):
"""Reads a raw from file.
Parameters
----------
fname : str
Path to the ... | [
"os.path.expanduser",
"mne.io.read_raw",
"os.remove",
"os.makedirs",
"os.path.basename",
"os.path.dirname",
"numpy.savetxt",
"os.path.exists",
"datetime.datetime.now",
"numpy.where",
"numpy.array",
"os.path.splitext",
"numpy.loadtxt",
"shutil.move",
"os.path.join",
"os.listdir",
"log... | [((1453, 1474), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (1468, 1474), False, 'import os\n'), ((1487, 1509), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (1503, 1509), False, 'import os\n'), ((1537, 1557), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1... |
#from unittest import TestCase
from animator.plotter import ScatterAnimation
from matplotlib.animation import PillowWriter
import numpy as np
x = np.linspace(0, 10, 100)
Y = [np.sin(x - 0.1 * t) for t in range(10)]
animation = ScatterAnimation(x, Y)
writer = PillowWriter(fps=5)
animation.anim.save("test.gif", writer=wr... | [
"matplotlib.animation.PillowWriter",
"animator.plotter.ScatterAnimation",
"numpy.sin",
"numpy.linspace"
] | [((146, 169), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (157, 169), True, 'import numpy as np\n'), ((227, 249), 'animator.plotter.ScatterAnimation', 'ScatterAnimation', (['x', 'Y'], {}), '(x, Y)\n', (243, 249), False, 'from animator.plotter import ScatterAnimation\n'), ((259, 27... |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Use the numpy package to convert supported pixel data to an ndarray.
**Supported transfer syntaxes**
* 1.2.840.10008.1.2 : Implicit VR Little Endian
* 1.2.840.10008.1.2.1 : Explicit VR Little Endian
* 1.2.840.10008.1.2.1.99 : Deflated Explicit VR... | [
"numpy.ravel",
"numpy.frombuffer",
"numpy.zeros",
"pydicom.pixel_data_handlers.util.pixel_dtype",
"pydicom.pixel_data_handlers.util.get_expected_length",
"numpy.fliplr",
"numpy.reshape",
"numpy.unpackbits",
"warnings.warn"
] | [((4705, 4729), 'numpy.reshape', 'np.reshape', (['arr', '(-1, 8)'], {}), '(arr, (-1, 8))\n', (4715, 4729), True, 'import numpy as np\n'), ((4740, 4754), 'numpy.fliplr', 'np.fliplr', (['arr'], {}), '(arr)\n', (4749, 4754), True, 'import numpy as np\n'), ((5457, 5497), 'numpy.frombuffer', 'np.frombuffer', (['bytestream']... |
#!/usr/bin/env python3
'''Create light curves from UVIT data.
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/LICENS... | [
"astropy.convolution.Gaussian2DKernel",
"astropy.convolution.convolve",
"matplotlib.pyplot.title",
"numpy.isin",
"numpy.sum",
"numpy.abs",
"matplotlib.pyplot.clf",
"astropy.stats.sigma_clipped_stats",
"astropy.io.fits.ColDefs",
"astropy.io.fits.PrimaryHDU",
"matplotlib.pyplot.figure",
"numpy.m... | [((725, 746), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (739, 746), False, 'import matplotlib\n'), ((3405, 3479), 'numpy.array', 'np.array', (['[1.5, 2, 2.5, 3, 4, 5, 7, 9, 12, 15, 20, 30, 40, 50, 70, 80, 95]'], {}), '([1.5, 2, 2.5, 3, 4, 5, 7, 9, 12, 15, 20, 30, 40, 50, 70, 80, 95])\n', (34... |
import numpy as np
from typing import List, Any
import cv2
from skimage.exposure import rescale_intensity, adjust_sigmoid
from skimage.util import invert, img_as_float, img_as_ubyte
def fg_pts(mask: np.ndarray):
"""
:param mask: binary image, 2D numpy array
:return: 2 * n numpy array
Retrieves coordi... | [
"skimage.exposure.adjust_sigmoid",
"cv2.cvtColor",
"skimage.util.img_as_ubyte",
"numpy.asarray",
"skimage.util.invert",
"skimage.exposure.rescale_intensity",
"numpy.arccos",
"cv2.blur",
"numpy.min",
"numpy.max",
"numpy.linalg.norm",
"cv2.drawContours",
"numpy.dot",
"skimage.util.img_as_flo... | [((533, 548), 'numpy.asarray', 'np.asarray', (['pts'], {}), '(pts)\n', (543, 548), True, 'import numpy as np\n'), ((718, 732), 'numpy.dot', 'np.dot', (['v1', 'v2'], {}), '(v1, v2)\n', (724, 732), True, 'import numpy as np\n'), ((1552, 1604), 'cv2.drawContours', 'cv2.drawContours', (['mask', 'contour', '(-1)', '(255)', ... |
import numpy as np
from lightfm.datasets import fetch_movielens
from lightfm import LightFM
data = fetch_movielens(min_rating = 4.0)
model = LightFM(loss = 'warp')
model.fit(data['train'], epochs=30, num_threads=2)
def sample_recommendation(model, data, user_ids):
n_users, n_items = data['train'].shape
for ... | [
"numpy.argsort",
"lightfm.LightFM",
"lightfm.datasets.fetch_movielens",
"numpy.arange"
] | [((100, 131), 'lightfm.datasets.fetch_movielens', 'fetch_movielens', ([], {'min_rating': '(4.0)'}), '(min_rating=4.0)\n', (115, 131), False, 'from lightfm.datasets import fetch_movielens\n'), ((143, 163), 'lightfm.LightFM', 'LightFM', ([], {'loss': '"""warp"""'}), "(loss='warp')\n", (150, 163), False, 'from lightfm imp... |
import numpy as np
data = np.genfromtxt('jajka1.csv', delimiter=";", dtype=('|U16'))
data2 = np.array([[s.replace(',', '.') for s in line] for line in data])
suma = 0
x = 0
for i in range(1, 17):
for j in range(1, 9):
if data2[i][j] == "":
data2[i][j] = 0
suma += data2[i][j].astype(np.... | [
"numpy.array",
"numpy.genfromtxt"
] | [((27, 83), 'numpy.genfromtxt', 'np.genfromtxt', (['"""jajka1.csv"""'], {'delimiter': '""";"""', 'dtype': '"""|U16"""'}), "('jajka1.csv', delimiter=';', dtype='|U16')\n", (40, 83), True, 'import numpy as np\n'), ((842, 908), 'numpy.array', 'np.array', (["['Miasto', '<NAME>', 'Ceny', m1, s1, maxi, m2, s2, mini]"], {}), ... |
# coding=utf-8
# Copyright 2021 Google LLC
#
# 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 ... | [
"absl.testing.absltest.main",
"learned_optimization.tasks.parametric.parametric_utils.orth_init",
"numpy.abs",
"jax.jit",
"learned_optimization.tasks.parametric.parametric_utils.SampleInitializer.sample",
"learned_optimization.tasks.parametric.parametric_utils.SampleInitializer.get_dynamic",
"learned_op... | [((2289, 2304), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2302, 2304), False, 'from absl.testing import absltest\n'), ((923, 944), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['(0)'], {}), '(0)\n', (941, 944), False, 'import jax\n'), ((955, 1002), 'learned_optimization.tasks.parametric.parametr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import sys
import numpy
import pkg_resources
from shutil import rmtree
from setuptools import setup, find_packages, Command
from distutils import util
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
from P... | [
"pkg_resources.parse_requirements",
"pybind11.get_include",
"setuptools.find_packages",
"wheel.bdist_wheel.bdist_wheel.finalize_options",
"os.path.dirname",
"os.system",
"PyMieSim.Tools.utils.Print",
"numpy.get_include",
"distutils.util.get_platform",
"os.path.join",
"sys.exit"
] | [((425, 510), 'PyMieSim.Tools.utils.Print', 'Print', ([], {'msg': 'f""" Plateform: {plateform} \n Version: {Version}"""', 'title': '"""PyMieSim"""'}), '(msg=f""" Plateform: {plateform} \n Version: {Version}""", title=\'PyMieSim\'\n )\n', (430, 510), False, 'from PyMieSim.Tools.utils import Print\n'), ((535, 560), 'o... |
import tkinter as tk
import moderngl
import numpy as np
from tkinter_framebuffer import FramebufferImage
from hello_world import HelloWorld2D, PanTool
ctx = moderngl.create_standalone_context()
canvas = HelloWorld2D(ctx)
pan_tool = PanTool()
def vertices():
x = np.linspace(-1.0, 1.0, 50)
y = np.random.ran... | [
"hello_world.PanTool",
"numpy.dstack",
"numpy.zeros",
"numpy.ones",
"numpy.linspace",
"moderngl.create_standalone_context",
"numpy.random.rand",
"hello_world.HelloWorld2D",
"tkinter.Label",
"tkinter.Tk",
"tkinter_framebuffer.FramebufferImage"
] | [((160, 196), 'moderngl.create_standalone_context', 'moderngl.create_standalone_context', ([], {}), '()\n', (194, 196), False, 'import moderngl\n'), ((207, 224), 'hello_world.HelloWorld2D', 'HelloWorld2D', (['ctx'], {}), '(ctx)\n', (219, 224), False, 'from hello_world import HelloWorld2D, PanTool\n'), ((236, 245), 'hel... |
# --------------
import pandas as pd
from sklearn.model_selection import train_test_split
# Code starts here
data = pd.read_csv(path)
X = data.drop(columns=['customer.id', 'paid.back.loan'])
y = data['paid.back.loan']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
# Code ends h... | [
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.axis",
"sklearn.preprocessing.LabelEncoder",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"pydotplus.graph_from_dot_data",
"... | [((116, 133), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (127, 133), True, 'import pandas as pd\n'), ((253, 306), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.3)', 'random_state': '(0)'}), '(X, y, test_size=0.3, random_state=0)\n', (269, 306), False, ... |
import math
import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# class EncoderDecoder(nn.Module):
# """
# A standard Encoder-Decoder architecture. Base for this and many
# other models.
# """
# def __init__(self, encoder, decoder, src_embed, tgt_embed... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.cat",
"numpy.ones",
"torch.cos",
"torch.arange",
"torch.ones",
"torch.nn.Linear",
"torch.zeros",
"math.log",
"torch.matmul",
"copy.deepcopy",
"torch.zeros_like",
"math.sqrt",
"torch.nn.init.xavier_uniform_",
"torch.from_numpy",
"torch.... | [((1758, 1782), 'torch.zeros', 'torch.zeros', (['x.shape[:2]'], {}), '(x.shape[:2])\n', (1769, 1782), False, 'import torch\n'), ((7274, 7295), 'torch.zeros_like', 'torch.zeros_like', (['tgt'], {}), '(tgt)\n', (7290, 7295), False, 'import torch\n'), ((7791, 7816), 'torch.nn.functional.softmax', 'F.softmax', (['scores'],... |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "<NAME>" at 21:43, 01/02/2020 %
# ... | [
"pickle.dump",
"utils.FunctionUtil.cal_std",
"pickle.load",
"numpy.array",
"utils.class_utils.AlgoInfor",
"utils.FunctionUtil.cal_mean"
] | [((1245, 1256), 'utils.class_utils.AlgoInfor', 'AlgoInfor', ([], {}), '()\n', (1254, 1256), False, 'from utils.class_utils import AlgoInfor\n'), ((2712, 2756), 'pickle.dump', 'pkl.dump', (['algo_dict', 'f', 'pkl.HIGHEST_PROTOCOL'], {}), '(algo_dict, f, pkl.HIGHEST_PROTOCOL)\n', (2720, 2756), True, 'import pickle as pkl... |
# %% REQUIRED LIBRARIES
import os
import pandas as pd
import numpy as np
from plotly.offline import plot
import plotly.graph_objs as go
import plotly.express as px
from pyloopkit.loop_data_manager import update
from src.input_data_tools import input_table_to_dict, dict_inputs_to_dataframes
# %% REFERENCES
"""
A versio... | [
"pandas.DataFrame",
"os.path.join",
"plotly.graph_objs.Scatter",
"src.input_data_tools.dict_inputs_to_dataframes",
"numpy.ones",
"plotly.offline.plot",
"numpy.max",
"numpy.mean",
"numpy.arange",
"pyloopkit.loop_data_manager.update",
"numpy.linspace",
"src.input_data_tools.input_table_to_dict",... | [((746, 778), 'src.input_data_tools.input_table_to_dict', 'input_table_to_dict', (['scenario_df'], {}), '(scenario_df)\n', (765, 778), False, 'from src.input_data_tools import input_table_to_dict, dict_inputs_to_dataframes\n'), ((838, 862), 'pyloopkit.loop_data_manager.update', 'update', (['inputs_from_file'], {}), '(i... |
import time
import numpy as np
import tensorflow as tf
from PIL import Image
from core import utils
import cv2
import argparse
IMAGE_H, IMAGE_W = 416, 416
parser = argparse.ArgumentParser(description="gpu模式下不能设置score_thresh和iou_thresh")
parser.add_argument("--video_id", "-vi", default=0, help="传入相机的id,可以是图片,视频,网络摄像头(e... | [
"argparse.ArgumentParser",
"core.utils.cpu_nms",
"cv2.imshow",
"core.utils.draw_boxes",
"cv2.cvtColor",
"cv2.imwrite",
"time.localtime",
"core.utils.read_pb_return_tensors",
"cv2.waitKey",
"numpy.asarray",
"tensorflow.Session",
"tensorflow.Graph",
"core.utils.draw_Chinese",
"cv2.putText",
... | [((165, 237), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""gpu模式下不能设置score_thresh和iou_thresh"""'}), "(description='gpu模式下不能设置score_thresh和iou_thresh')\n", (188, 237), False, 'import argparse\n'), ((725, 767), 'core.utils.read_coco_names', 'utils.read_coco_names', (['"""./data/coco.name... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 10:03:29 2020
@author: sid
"""
from matplotlib import pyplot as plt
import numpy as np
import plotly.express as px
from scipy import ndimage, signal
import pandas as pd
plt.ion()
#Detector calibration and setup
import pyFAI, pyFAI.detectors, fabio
impor... | [
"matplotlib.pyplot.loglog",
"numpy.ones",
"numpy.argmin",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tick_params",
"plotly.express.scatter",
"pyFAI.azimuthalIntegrator.AzimuthalIntegrator",
"scipy.signal.convolve2d",
"pyFAI.calibrant.get_calibrant",
"matplotlib.pyplot.imshow",
"matplotlib.py... | [((233, 242), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (240, 242), True, 'from matplotlib import pyplot as plt\n'), ((592, 697), 'fabio.open', 'fabio.open', (['"""C:\\\\PhD work\\\\PhD_May20\\\\SAXS107cm\\\\Box_01\\\\Aerogel1_2_60s_107cm_01_unwarped.gfrm"""'], {}), "(\n 'C:\\\\PhD work\\\\PhD_May20\\\\S... |
import numpy as np
from network import Netowork
from layers import FCLayer, ActivationLayer
from activations import tanh, tanh_prime
from loss import mse, mse_prime
# training data
x_train = np.array([[[0,0]],[[0,1]],[[1,0]],[[1,1]]])
y_train = np.array([[[0]],[[1]],[[1]],[[0]]])
# network
net = Netowork()
net.add(F... | [
"network.Netowork",
"layers.FCLayer",
"layers.ActivationLayer",
"numpy.array"
] | [((193, 243), 'numpy.array', 'np.array', (['[[[0, 0]], [[0, 1]], [[1, 0]], [[1, 1]]]'], {}), '([[[0, 0]], [[0, 1]], [[1, 0]], [[1, 1]]])\n', (201, 243), True, 'import numpy as np\n'), ((247, 285), 'numpy.array', 'np.array', (['[[[0]], [[1]], [[1]], [[0]]]'], {}), '([[[0]], [[1]], [[1]], [[0]]])\n', (255, 285), True, 'i... |
import numpy as np
import warnings
import copy
from scipy.special import expit
from .stratification import Strata
def verify_positive(value):
"""Throws exception if value is not positive"""
if not value > 0:
raise ValueError("expected positive integer")
return value
def verify_predictions(predicti... | [
"copy.deepcopy",
"numpy.sum",
"numpy.log",
"numpy.isfinite",
"numpy.any",
"scipy.special.expit",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.logical_or",
"numpy.unique",
"numpy.repeat"
] | [((510, 543), 'numpy.array', 'np.array', (['predictions'], {'copy': '(False)'}), '(predictions, copy=False)\n', (518, 543), True, 'import numpy as np\n'), ((990, 1018), 'numpy.array', 'np.array', (['scores'], {'copy': '(False)'}), '(scores, copy=False)\n', (998, 1018), True, 'import numpy as np\n'), ((2049, 2085), 'num... |
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import math
import sys
import os
data_dir = sys.argv[1]
out_dir = sys.argv[2]
dataX = os.path.join(sys.argv[1], 'logisticX.csv')
dataY = os.path.join(sys.argv[1],... | [
"numpy.log",
"numpy.std",
"numpy.zeros",
"numpy.ones",
"numpy.linalg.pinv",
"numpy.mean",
"matplotlib.use",
"numpy.loadtxt",
"numpy.exp",
"numpy.column_stack",
"numpy.dot",
"os.path.join"
] | [((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), False, 'import matplotlib\n'), ((244, 286), 'os.path.join', 'os.path.join', (['sys.argv[1]', '"""logisticX.csv"""'], {}), "(sys.argv[1], 'logisticX.csv')\n", (256, 286), False, 'import os\n'), ((295, 337), 'os.path.join', 'os.pa... |
import numpy as np
from scipy.spatial.distance import cdist
# ========================================================================
# USAGE: [Coeff]=LLC_coding_appr(B,X,knn,lambda)
# Approximated Locality-constraint Linear Coding
#
# Inputs
# B -M x d codebook, M entries in a d-dim space
# X ... | [
"scipy.spatial.distance.cdist",
"numpy.trace",
"numpy.sum",
"numpy.zeros",
"numpy.ones",
"numpy.argsort",
"numpy.tile",
"numpy.eye"
] | [((707, 731), 'scipy.spatial.distance.cdist', 'cdist', (['X', 'B', '"""euclidean"""'], {}), "(X, B, 'euclidean')\n", (712, 731), False, 'from scipy.spatial.distance import cdist\n'), ((759, 787), 'numpy.zeros', 'np.zeros', (['(N, k_nn)', '"""int32"""'], {}), "((N, k_nn), 'int32')\n", (767, 787), True, 'import numpy as ... |
import numpy as np
import copy
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from betl.linear_system import DiscreteTimeLinearSystem as LinearSystem
from betl.linear_system import StateFeedbackLaw, ExcitingStateFeedbackLaw
from betl.synthesis.robust_lqr_synth import RLQRSyntheziser
from be... | [
"numpy.random.seed",
"seaborn.kdeplot",
"matplotlib.pyplot.figure",
"pickle.load",
"matplotlib.pyplot.close",
"matplotlib.rcParams.update",
"matplotlib.patches.FancyArrowPatch",
"matplotlib.pyplot.rcParams.update",
"utils.postprocessing_utils.initialize_plot",
"betl.linear_system.DiscreteTimeLinea... | [((569, 627), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.WARN'}), '(stream=sys.stdout, level=logging.WARN)\n', (588, 627), False, 'import logging\n'), ((825, 839), 'matplotlib.use', 'mpl.use', (['"""pgf"""'], {}), "('pgf')\n", (832, 839), True, 'import matplotlib as mp... |
'''
Feature Engineering and model training
'''
import pickle
import pandas as pd
import numpy as np
from sklearn.decomposition import NMF
from sklearn.impute import KNNImputer
links = pd.DataFrame(pd.read_csv('links.csv'))
movies_ = pd.DataFrame(pd.read_csv('movies.csv'))
ratings = pd.DataFrame(pd.read_csv('ratings.cs... | [
"sklearn.decomposition.NMF",
"pandas.read_csv",
"pandas.merge",
"sklearn.impute.KNNImputer",
"numpy.dot",
"pickle.dumps"
] | [((701, 771), 'pandas.merge', 'pd.merge', ([], {'left': 'links', 'right': 'ratings', 'left_index': '(True)', 'right_index': '(True)'}), '(left=links, right=ratings, left_index=True, right_index=True)\n', (709, 771), True, 'import pandas as pd\n'), ((777, 896), 'pandas.merge', 'pd.merge', ([], {'left': 'links_ratings', ... |
#SPDX-License-Identifier: MIT
import pandas as pd
import sqlalchemy as s
import numpy as np
import re
class GHTorrent(object):
"""Uses GHTorrent and other GitHub data sources and returns dataframes with interesting GitHub indicators"""
def __init__(self, dbstr):
"""
Connect to GHTorrent
... | [
"sqlalchemy.sql.text",
"numpy.timedelta64",
"pandas.to_datetime",
"pandas.Series",
"pandas.read_sql",
"sqlalchemy.create_engine",
"re.sub"
] | [((510, 532), 'sqlalchemy.create_engine', 's.create_engine', (['dbstr'], {}), '(dbstr)\n', (525, 532), True, 'import sqlalchemy as s\n'), ((3721, 3791), 'sqlalchemy.sql.text', 's.sql.text', (['"""SELECT users.id FROM users WHERE users.login = :username"""'], {}), "('SELECT users.id FROM users WHERE users.login = :usern... |
import numpy as np
import math
import fatpack
# import rainflow
import matplotlib.pyplot as plt
import pandas as pd
import h5py
# import seaborn as sns
from scipy.signal import savgol_filter
import scipy.stats as stats
def Goodman_method_correction(M_a,M_m,M_max):
M_u = 1.5*M_max
M_ar = M_a/(1-M_m/M_u)
... | [
"h5py.File",
"fatpack.find_reversals_racetrack_filtered",
"numpy.sum",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rcParams.update",
"fatpack.find_range_count",
"numpy.max",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"fatpack.find_rainflow_ranges",
"matplotlib... | [((720, 754), 'numpy.linspace', 'np.linspace', (['(0)', 'bins_max', 'bins_num'], {}), '(0, bins_max, bins_num)\n', (731, 754), True, 'import numpy as np\n'), ((801, 830), 'numpy.linspace', 'np.linspace', (['(0)', 'bins_max', '(501)'], {}), '(0, bins_max, 501)\n', (812, 830), True, 'import numpy as np\n'), ((833, 869), ... |
import numpy as np
from gridgeo.ugrid import ugrid
def _make_grid(coords):
if coords.ndim != 3:
raise ValueError(f"Expected 3 dimension array, got {coords.ndim}.")
M, N, L = coords.shape
polygons = np.concatenate(
(
coords[0:-1, 0:-1],
coords[0:-1, 1:],
... | [
"numpy.stack",
"numpy.meshgrid",
"numpy.isnan",
"gridgeo.ugrid.ugrid",
"numpy.concatenate"
] | [((221, 321), 'numpy.concatenate', 'np.concatenate', (['(coords[0:-1, 0:-1], coords[0:-1, 1:], coords[1:, 1:], coords[1:, 0:-1])'], {'axis': 'L'}), '((coords[0:-1, 0:-1], coords[0:-1, 1:], coords[1:, 1:],\n coords[1:, 0:-1]), axis=L)\n', (235, 321), True, 'import numpy as np\n'), ((6461, 6476), 'gridgeo.ugrid.ugrid'... |
import numpy as np
def get_PF_Results():
results=\
{
10:
{
0:
{
'delta' :
{
'Yyn': np.array
([
#10,0,deltaYyn
#BusTr_HV,Tr_LV,Load
1.0000001787261197, 0.9990664471050634, 0.9408623912831601,
0.9999997973033823, 0.9989329879720452, 0.9398981202882926... | [
"numpy.array"
] | [((116, 315), 'numpy.array', 'np.array', (['[1.0000001787261197, 0.9990664471050634, 0.9408623912831601, \n 0.9999997973033823, 0.9989329879720452, 0.9398981202882926, \n 1.000000023970535, 0.9990124767159095, 0.9422153531204793]'], {}), '([1.0000001787261197, 0.9990664471050634, 0.9408623912831601, \n 0.99999... |
"""Clustering-related mathematical functions.
"""
from typing import Optional
import numpy as np
import py4research.math.random as r
def kmeans(x: np.ndarray,
n_clusters: Optional[int] = 1,
max_iterations: Optional[int] = 100,
tol: Optional[float] = 1e-4) -> np.ndarray:
"""Perf... | [
"numpy.sum",
"py4research.math.random.generate_integer_random_number",
"numpy.zeros",
"numpy.argmin",
"numpy.mean",
"numpy.linalg.norm"
] | [((889, 938), 'numpy.zeros', 'np.zeros', (['(n_clusters, n_variables, n_dimensions)'], {}), '((n_clusters, n_variables, n_dimensions))\n', (897, 938), True, 'import numpy as np\n'), ((952, 971), 'numpy.zeros', 'np.zeros', (['n_samples'], {}), '(n_samples)\n', (960, 971), True, 'import numpy as np\n'), ((1077, 1123), 'p... |
import numpy
import torch
from allennlp.modules.span_extractors import SpanExtractor, SelfAttentiveSpanExtractor
from allennlp.common.params import Params
class TestSelfAttentiveSpanExtractor:
def test_locally_normalised_span_extractor_can_build_from_params(self):
params = Params(
{
... | [
"torch.LongTensor",
"allennlp.modules.span_extractors.SelfAttentiveSpanExtractor",
"numpy.zeros",
"torch.randn",
"allennlp.modules.span_extractors.SpanExtractor.from_params",
"torch.tensor",
"allennlp.common.params.Params"
] | [((289, 401), 'allennlp.common.params.Params', 'Params', (["{'type': 'self_attentive', 'input_dim': 7, 'num_width_embeddings': 5,\n 'span_width_embedding_dim': 3}"], {}), "({'type': 'self_attentive', 'input_dim': 7, 'num_width_embeddings': 5,\n 'span_width_embedding_dim': 3})\n", (295, 401), False, 'from allennlp... |
#!/usr/bin/env python3
""" MTCNN Face detection plugin """
from __future__ import absolute_import, division, print_function
import cv2
from keras.layers import Conv2D, Dense, Flatten, Input, MaxPool2D, Permute, PReLU
import numpy as np
from lib.model.session import KSession
from ._base import Detector, logger
cla... | [
"numpy.maximum",
"numpy.amin",
"numpy.empty",
"keras.layers.MaxPool2D",
"keras.layers.Input",
"numpy.multiply",
"numpy.power",
"keras.layers.Flatten",
"numpy.swapaxes",
"keras.layers.Permute",
"cv2.resize",
"numpy.repeat",
"numpy.minimum",
"numpy.fix",
"keras.layers.PReLU",
"keras.laye... | [((14833, 14864), 'numpy.where', 'np.where', (['(cls_prob >= threshold)'], {}), '(cls_prob >= threshold)\n', (14841, 14864), True, 'import numpy as np\n'), ((14920, 14962), 'numpy.fix', 'np.fix', (['((stride * boundingbox + 0) * scale)'], {}), '((stride * boundingbox + 0) * scale)\n', (14926, 14962), True, 'import nump... |
"""
fftshift on OCLArrays
as of now, only supports even dimensions (as ifftshift == fftshift then ;)
kernels adapted from
<NAME>.
cufftShift: high performance CUDA-accelerated FFT-shift library.
Proc High Performance Computing Symposium.
2014.
<EMAIL>
"""
from __future__ import print_function, unicode_literals, ... | [
"numpy.iscomplexobj",
"gputools.OCLArray.empty_like",
"numpy.prod",
"numpy.int32",
"numpy.linspace",
"gputools.OCLArray.from_array",
"numpy.all"
] | [((6082, 6104), 'gputools.OCLArray.from_array', 'OCLArray.from_array', (['d'], {}), '(d)\n', (6101, 6104), False, 'from gputools import OCLArray, OCLProgram\n'), ((6117, 6139), 'gputools.OCLArray.empty_like', 'OCLArray.empty_like', (['d'], {}), '(d)\n', (6136, 6139), False, 'from gputools import OCLArray, OCLProgram\n'... |
# File for the p4p Project
import numpy as np
__version__ = "0.0.1"
# initial values
g = -9.8
def abs_value(vector):
"""
Calculates the length of a vector
Args:
vector (np.array) Vector to get the length from the
Returns:
Length (float) Length of the Vector
"""
r... | [
"numpy.array",
"numpy.round",
"numpy.square",
"numpy.zeros"
] | [((553, 564), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (561, 564), True, 'import numpy as np\n'), ((4368, 4384), 'numpy.array', 'np.array', (['[0, g]'], {}), '([0, g])\n', (4376, 4384), True, 'import numpy as np\n'), ((6299, 6327), 'numpy.array', 'np.array', (['self.spring_matrix'], {}), '(self.spring_matrix)... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as Data
import numpy as np
import os,time
import model
import h5py
import itertools
import utility
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score
import ar... | [
"argparse.ArgumentParser",
"numpy.argmax",
"utility.encode_labels",
"model.CRNN2D_elu",
"utility.load_dataset_album_split_da",
"sklearn.metrics.f1_score",
"numpy.unique",
"model.CRNN2D_elu2",
"torch.utils.data.DataLoader",
"os.path.exists",
"utility.slice_songs_da",
"torch.cuda.device",
"tor... | [((2384, 2395), 'time.time', 'time.time', ([], {}), '()\n', (2393, 2395), False, 'import os, time\n'), ((7877, 7939), 'torch.utils.data.DataLoader', 'Data.DataLoader', ([], {'dataset': 'val_set', 'batch_size': 'bs', 'shuffle': '(False)'}), '(dataset=val_set, batch_size=bs, shuffle=False)\n', (7892, 7939), True, 'import... |
import numpy as np
import scipy.special as special
import scipy.optimize as optimization
import matplotlib.pyplot as plt
# this is a list of definitions that can be used to predict noise in KIDS
# right now it just contains the nessasary requirements for perdicting G-R noise in TiN
# I should expand it to include some... | [
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.exp",
"scipy.special.kv",
"numpy.meshgrid",
"matplotlib.pyplot.colorbar",
"numpy.reshape",
"numpy.linspace",
"numpy.asarray",
"scipy.optimize.curve_fit",
"scipy.special.digamma",
"numpy.min",
"matplotlib.pyplot.ylabel",
"numpy.vstack",
"num... | [((1777, 1810), 'numpy.reshape', 'np.reshape', (['t', '(t.shape[0], 1, 1)'], {}), '(t, (t.shape[0], 1, 1))\n', (1787, 1810), True, 'import numpy as np\n'), ((4509, 4537), 'numpy.where', 'np.where', (['(eps < 1 * 10 ** -8)'], {}), '(eps < 1 * 10 ** -8)\n', (4517, 4537), True, 'import numpy as np\n'), ((7207, 7232), 'num... |
# -*- coding: utf-8 -*-
# @Project : curve_fit
# @Time : 2019-05-27 14:51
# @Author : <NAME>
# @Email : <EMAIL>
# @File : continuous.py
import pickle
import numpy as np
from patsy import dmatrix
import statsmodels.api as sm
class Continuous:
def __init__(self, k=3):
self.model = None
se... | [
"statsmodels.api.GLM",
"pickle.dump",
"pickle.load",
"numpy.array",
"numpy.concatenate"
] | [((713, 724), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (721, 724), True, 'import numpy as np\n'), ((737, 748), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (745, 748), True, 'import numpy as np\n'), ((958, 969), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (966, 969), True, 'import numpy as np\n'), ((45... |
import time
import datetime
import os
import sys
import numpy as np
use_cntk = True
if use_cntk:
try:
base_directory = os.path.split(sys.executable)[0]
os.environ['PATH'] += ';' + base_directory
import cntk
os.environ['KERAS_BACKEND'] = 'cntk'
except ImportError:
print('... | [
"matplotlib.pyplot.title",
"keras.preprocessing.sequence.pad_sequences",
"cntk.layers.Embedding",
"matplotlib.pyplot.figure",
"numpy.arange",
"cntk.equal",
"cntk.layers.Dense",
"os.path.join",
"cntk.binary_cross_entropy",
"cntk.Evaluator",
"cntk.logging.ProgressPrinter",
"keras.layers.Flatten"... | [((777, 830), 'keras.datasets.imdb.load_data', 'keras.datasets.imdb.load_data', ([], {'num_words': 'max_features'}), '(num_words=max_features)\n', (806, 830), False, 'import keras\n'), ((945, 1011), 'keras.preprocessing.sequence.pad_sequences', 'keras.preprocessing.sequence.pad_sequences', (['x_train'], {'maxlen': 'max... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.