code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
import math
import re
from ml_pipeline_lch import isolate_categoricals, is_category
def view_dist(df, geo_columns = True, fig_size=(20,15), labels = None):
'''
Plot distributions of non-categorical columns in a g... | [
"seaborn.lmplot",
"ml_pipeline_lch.isolate_categoricals",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.cut",
"matplotlib.pyplot.subplots",
"re.sub",
"matplotlib.pyplot.title",
"matplotlib.pyplot.get_cmap",
"numpy.zeros_like",
"seaborn.pairplot",
"matplotlib.pyplot.show"
] | [((613, 724), 'ml_pipeline_lch.isolate_categoricals', 'isolate_categoricals', (['df'], {'categoricals_fcn': 'is_category', 'ret_categoricals': '(False)', 'geos_indicator': 'geo_columns'}), '(df, categoricals_fcn=is_category, ret_categoricals=\n False, geos_indicator=geo_columns)\n', (633, 724), False, 'from ml_pipel... |
from typing import Dict, List, Union
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
import dill
from pathlib import Path
from pysentimiento import create_analyzer
from lime.lime_text import LimeTextExplainer
from pysentimiento.analyzer import AnalyzerOutput
def sort_sentiment(res... | [
"lime.lime_text.LimeTextExplainer",
"pathlib.Path",
"numpy.array",
"pysentimiento.create_analyzer",
"random.random",
"matplotlib.pyplot.show"
] | [((1055, 1094), 'pysentimiento.create_analyzer', 'create_analyzer', (['"""sentiment"""'], {'lang': '"""en"""'}), "('sentiment', lang='en')\n", (1070, 1094), False, 'from pysentimiento import create_analyzer\n'), ((1292, 1329), 'lime.lime_text.LimeTextExplainer', 'LimeTextExplainer', ([], {'class_names': 'labels'}), '(c... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.keras.engine.training_utils.check_num_samples",
"tensorflow.python.keras.callbacks.BaseLogger",
"tensorflow.python.keras.backend.is_sparse",
"tensorflow.python.keras.engine.training_utils.batch_shuffle",
"tensorflow.python.keras.utils.generic_utils.make_batches",
"tensorflow.python.kera... | [((5206, 5295), 'tensorflow.python.keras.engine.training_utils.check_num_samples', 'training_utils.check_num_samples', (['ins', 'batch_size', 'steps_per_epoch', '"""steps_per_epoch"""'], {}), "(ins, batch_size, steps_per_epoch,\n 'steps_per_epoch')\n", (5238, 5295), False, 'from tensorflow.python.keras.engine import... |
from copy import deepcopy
import logging
import os
import pickle
from bids.layout import BIDSImageFile
from bids.layout.writing import build_path as bids_build_path
import nibabel as nib
import numpy as np
import pandas as pd
import pytest
from rtCommon.bidsCommon import (
BIDS_DIR_PATH_PATTERN,
BIDS_FILE_PAT... | [
"logging.getLogger",
"nibabel.load",
"pickle.dumps",
"copy.deepcopy",
"pickle.loads",
"os.remove",
"rtCommon.bidsArchive.BidsArchive",
"tests.common.isValidBidsArchive",
"numpy.where",
"bids.layout.writing.build_path",
"pandas.DataFrame",
"numpy.allclose",
"rtCommon.bidsCommon.metadataFromPr... | [((628, 655), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (645, 655), False, 'import logging\n'), ((5059, 5114), 'rtCommon.bidsCommon.metadataFromProtocolName', 'metadataFromProtocolName', (["imageMetadata['ProtocolName']"], {}), "(imageMetadata['ProtocolName'])\n", (5083, 5114), False... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def flip(imagelist, axis=1):
"""Randoml... | [
"numpy.random.normal",
"numpy.flip",
"numpy.reshape",
"numpy.random.rand",
"scipy.ndimage.filters.gaussian_filter",
"scipy.ndimage.interpolation.map_coordinates",
"numpy.random.random",
"numpy.ones",
"numpy.floor",
"numpy.array",
"numpy.random.randint",
"numpy.argwhere",
"numpy.zeros",
"nu... | [((877, 896), 'numpy.random.random', 'np.random.random', (['(1)'], {}), '(1)\n', (893, 896), True, 'import numpy as np\n'), ((1494, 1564), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma', '([1] * (image.ndim - 1) + [image.shape[-1]])'], {}), '(0, sigma, [1] * (image.ndim - 1) + [image.shape[-1]])\n', (1510,... |
from __future__ import print_function
import numpy as np
from scipy.optimize import minimize
import scipy.special
from tqdm import tqdm
from amico.util import get_verbose
# Kaden's functionals
def F_norm_Diff_K(E0,Signal,sigma_diff):
# ------- SMT functional
sig2 = sigma_diff**2.0
F_norm = np.sum( ( Si... | [
"numpy.sqrt",
"scipy.optimize.minimize",
"numpy.array",
"numpy.zeros",
"amico.util.get_verbose"
] | [((456, 472), 'numpy.array', 'np.array', (['F_norm'], {}), '(F_norm)\n', (464, 472), True, 'import numpy as np\n'), ((521, 533), 'numpy.array', 'np.array', (['E0'], {}), '(E0)\n', (529, 533), True, 'import numpy as np\n'), ((572, 599), 'numpy.sqrt', 'np.sqrt', (['(np.pi * sig2 / 2.0)'], {}), '(np.pi * sig2 / 2.0)\n', (... |
'''
Created by <NAME> 2020
# Read in WAV file into Python Class
sound1 = AudioProcessing('input.wav')
# Set the speed of the audio
sound1.set_audio_speed(0.5)
# Set the pitch of the audio
sound1.set_audio_pitch(2)
# Reverse the content of the audio
sound1.set_reverse()
# Add an echo to the audio
sound1.... | [
"numpy.hanning",
"numpy.abs",
"scipy.signal.filtfilt",
"numpy.fft.fft",
"scipy.signal.butter",
"numpy.angle",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"scipy.io.wavfile.read",
"random.randint"
] | [((4956, 4979), 'random.randint', 'random.randint', (['(50)', '(200)'], {}), '(50, 200)\n', (4970, 4979), False, 'import random\n'), ((4990, 5017), 'random.randint', 'random.randint', (['(3000)', '(10000)'], {}), '(3000, 10000)\n', (5004, 5017), False, 'import random\n'), ((5030, 5053), 'random.randint', 'random.randin... |
import csv
import re
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
import pandas as pd
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.layouts import gridplot
from bokeh.models import (BasicTicker, Circle, ColumnDataSource, DataRange1d,... | [
"bokeh.models.Circle",
"matplotlib.pyplot.savefig",
"pandas.DataFrame",
"bokeh.models.Grid",
"bokeh.layouts.gridplot",
"seaborn.set_style",
"numpy.array",
"bokeh.models.LinearAxis",
"bokeh.models.PanTool",
"seaborn.violinplot",
"bokeh.models.BasicTicker",
"bokeh.models.Plot",
"bokeh.document... | [((853, 869), 'numpy.array', 'np.array', (['scores'], {}), '(scores)\n', (861, 869), True, 'import numpy as np\n'), ((1398, 1413), 'bokeh.layouts.gridplot', 'gridplot', (['plots'], {}), '(plots)\n', (1406, 1413), False, 'from bokeh.layouts import gridplot\n'), ((1425, 1435), 'bokeh.document.Document', 'Document', ([], ... |
import time
import unittest
import numpy as np
from collections import defaultdict
from sklearn.datasets import make_classification, make_regression
from sklearn.metrics import f1_score
from sklearn.model_selection import KFold
from sklearn.svm import SVC
from ITMO_FS.ensembles.measure_based import *
from ITMO_FS.ens... | [
"numpy.mean",
"sklearn.svm.SVC",
"sklearn.datasets.make_regression",
"sklearn.metrics.f1_score",
"numpy.array",
"collections.defaultdict",
"numpy.std",
"unittest.main",
"sklearn.model_selection.KFold",
"time.time",
"sklearn.datasets.make_classification"
] | [((456, 528), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_features': '(2000)', 'n_informative': '(100)', 'n_redundant': '(500)'}), '(n_features=2000, n_informative=100, n_redundant=500)\n', (475, 528), False, 'from sklearn.datasets import make_classification, make_regression\n'), ((555, 645)... |
import torch
import os
import math
import numpy as np
from copy import deepcopy
from pycls.core.config import cfg
import pycls.utils.distributed as du
from tqdm import tqdm
class AdversarySampler:
def __init__(self, budget):
self.budget = budget
self.cuda_id = torch.cuda.current_device()
def ... | [
"torch.from_numpy",
"torch.min",
"numpy.argsort",
"numpy.arange",
"numpy.dot",
"numpy.empty",
"numpy.concatenate",
"numpy.min",
"torch.cuda.current_device",
"numpy.argmax",
"torch.transpose",
"torch.reshape",
"torch.cat",
"os.makedirs",
"torch.stack",
"tqdm.tqdm",
"os.path.join",
"... | [((5994, 6009), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6007, 6009), False, 'import torch\n'), ((11991, 12006), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (12004, 12006), False, 'import torch\n'), ((283, 310), 'torch.cuda.current_device', 'torch.cuda.current_device', ([], {}), '()\n', (308, 310), ... |
from os.path import join
import cv2
import numpy as np
from PIL import Image
from torch.utils import data
def prepare_image_PIL(im):
im = im[:,:,::-1] - np.zeros_like(im) # rgb to bgr
im -= np.array((104.00698793,116.66876762,122.67891434))
im = np.transpose(im, (2, 0, 1)) # (H x W x C) to (C x H x W)
... | [
"numpy.logical_and",
"os.path.join",
"numpy.squeeze",
"numpy.array",
"numpy.transpose",
"numpy.zeros_like"
] | [((201, 253), 'numpy.array', 'np.array', (['(104.00698793, 116.66876762, 122.67891434)'], {}), '((104.00698793, 116.66876762, 122.67891434))\n', (209, 253), True, 'import numpy as np\n'), ((261, 288), 'numpy.transpose', 'np.transpose', (['im', '(2, 0, 1)'], {}), '(im, (2, 0, 1))\n', (273, 288), True, 'import numpy as n... |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 <NAME>, <NAME>
# Licensed under the 2-clause BSD License
"""Code for plotting EoR Limits."""
import glob
import os
import copy
import yaml
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.c... | [
"matplotlib.pyplot.grid",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"numpy.argsort",
"numpy.array",
"copy.deepcopy",
"numpy.nanmin",
"eor_limits.process_mesinger_2016.get_mesinger_2016_line",
"numpy.repeat",
"argparse.ArgumentParser",
"numpy.where",
"matplo... | [((12492, 12536), 'matplotlib.cm.ScalarMappable', 'cmx.ScalarMappable', ([], {'norm': 'norm', 'cmap': 'colormap'}), '(norm=norm, cmap=colormap)\n', (12510, 12536), True, 'import matplotlib.cm as cmx\n'), ((12648, 12691), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(fig_width, fig_height)'}), '(figsize=(... |
'''
`dtApp/dtCode/unquant.py`
:Author:
<NAME>
:Organisation:
University of Liverpool
:Copyright:
BSD Licence
This single python file ``unquant.py`` is the backend code for the uncertainty page.
A single function ``unquant()`` wrangles all the data requests from the html template.
The function tak... | [
"flask.render_template",
"numpy.log10",
"plotly.subplots.make_subplots",
"json.dumps",
"flask.request.form.items",
"dtApp.app.route",
"dtLib.unquant.msd3.displacement_msd_numpy_abs_ww",
"dtLib.unquant.msd3.displacement_bounds_cartesian_MK",
"dtLib.unquant.msd3.displacement_bounds_montecarlo"
] | [((2263, 2309), 'dtApp.app.route', 'app.route', (['"""/unquant"""'], {'methods': "['GET', 'POST']"}), "('/unquant', methods=['GET', 'POST'])\n", (2272, 2309), False, 'from dtApp import app\n'), ((3252, 3355), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'rows': '(3)', 'cols': '(1)', 'subplot_titles': "('Floo... |
if __name__ == "__main__":
import cv2
import numpy as np
import face_recognition as fr
import os
from datetime import datetime
import time
import json
path = 'face_recognition/basic_api/images/known'
images = []
classNames = []
tolerance = 0.6
fpsReport = 0
... | [
"cv2.rectangle",
"cv2.imshow",
"cv2.destroyAllWindows",
"os.listdir",
"face_recognition.face_distance",
"numpy.argmin",
"cv2.waitKey",
"cv2.getTickFrequency",
"face_recognition.face_locations",
"os.path.splitext",
"cv2.putText",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"cv2.getTickCou... | [((373, 389), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (383, 389), False, 'import os\n'), ((740, 759), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (756, 759), False, 'import cv2\n'), ((3611, 3634), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3632, 3634), False... |
import cv2
import numpy as np
'''def read_file(filename):
img = cv2.imread(filename)
cv2_imshow(img)
return img'''
def color_quantization(img, k):
# Transform the image
data = np.float32(img).reshape((-1, 3))
# Determine criteria
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 20, 0.001)
# ... | [
"numpy.uint8",
"cv2.imwrite",
"cv2.bilateralFilter",
"cv2.kmeans",
"cv2.medianBlur",
"cv2.bitwise_and",
"cv2.adaptiveThreshold",
"cv2.cvtColor",
"cv2.imread",
"numpy.float32"
] | [((364, 430), 'cv2.kmeans', 'cv2.kmeans', (['data', 'k', 'None', 'criteria', '(10)', 'cv2.KMEANS_RANDOM_CENTERS'], {}), '(data, k, None, criteria, 10, cv2.KMEANS_RANDOM_CENTERS)\n', (374, 430), False, 'import cv2\n'), ((442, 458), 'numpy.uint8', 'np.uint8', (['center'], {}), '(center)\n', (450, 458), True, 'import nump... |
import copy
import itertools
from functools import lru_cache
from typing import List, Dict
import numpy as np
import numpy
from summer.constants import (
Compartment,
Flow,
BirthApproach,
Stratification,
IntegrationType,
)
from .epi_model import EpiModel
from .utils import (
convert_boolean_li... | [
"itertools.product",
"numpy.log",
"numpy.kron",
"numpy.array",
"numba.jit",
"functools.lru_cache",
"copy.copy",
"numpy.arange"
] | [((90506, 90524), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (90509, 90524), False, 'from numba import jit\n'), ((77487, 77513), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(2 ** 17)'}), '(maxsize=2 ** 17)\n', (77496, 77513), False, 'from functools import lru_cache\n'), ((12654, 12... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"paddle.fluid.layers.fill_constant",
"paddle.fluid.Program",
"paddle.fluid.dygraph.jit.dygraph_to_static_output",
"paddle.fluid.dygraph.guard",
"paddle.fluid.layers.tanh",
"paddle.fluid.dygraph.to_variable",
"numpy.random.random",
"paddle.fluid.layers.reduce_mean",
"paddle.fluid.CPUPlace",
"paddle... | [((780, 797), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (794, 797), True, 'import numpy as np\n'), ((1287, 1352), 'paddle.fluid.layers.fill_constant', 'fluid.layers.fill_constant', (['[feat_size]'], {'dtype': '"""float32"""', 'value': '(1)'}), "([feat_size], dtype='float32', value=1)\n", (1313, 135... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl
import seaborn as sns
import tensorflow as tf
import re
import json
from functools import partial
from itertools import filterfalse
from wordcloud import WordCloud
from tensorflow i... | [
"re.split",
"pandas.to_timedelta",
"tensorflow.keras.layers.Normalization",
"pandas.read_csv",
"tensorflow.keras.Sequential",
"json.dumps",
"numpy.asarray",
"tensorflow.keras.layers.Dropout",
"pandas.value_counts",
"tensorflow.saved_model.save",
"wordcloud.WordCloud",
"tensorflow.keras.layers.... | [((374, 397), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (385, 397), True, 'import pandas as pd\n'), ((632, 668), 'pandas.to_datetime', 'pd.to_datetime', (["df['date_published']"], {}), "(df['date_published'])\n", (646, 668), True, 'import pandas as pd\n'), ((748, 759), 'wordcloud.Wor... |
""" Document Localization using Recursive CNN
Maintainer : <NAME>
Email : <EMAIL> """
import imgaug.augmenters as iaa
import csv
import logging
import os
import xml.etree.ElementTree as ET
import numpy as np
from torchvision import transforms
import utils.utils as utils
# To incdude a new Dataset, inherit from Da... | [
"logging.getLogger",
"imgaug.augmenters.AverageBlur",
"utils.utils.sort_gt",
"imgaug.augmenters.AllChannelsHistogramEqualization",
"imgaug.augmenters.GaussianBlur",
"numpy.array",
"imgaug.augmenters.Resize",
"imgaug.augmenters.Snowflakes",
"imgaug.augmenters.LogContrast",
"imgaug.augmenters.Graysc... | [((457, 483), 'logging.getLogger', 'logging.getLogger', (['"""iCARL"""'], {}), "('iCARL')\n", (474, 483), False, 'import logging\n'), ((5406, 5427), 'numpy.array', 'np.array', (['self.labels'], {}), '(self.labels)\n', (5414, 5427), True, 'import numpy as np\n'), ((5451, 5483), 'numpy.reshape', 'np.reshape', (['self.lab... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 12:07:01 2020
@author: <NAME>
"""
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
import math
def get_doc(nlp, file_name, encoding_='utf-8'):
return nlp(open(file_name, 'r', encoding=encoding_).read())
def get_sentences(doc... | [
"numpy.mean",
"networkx.Graph",
"networkx.connected_components",
"numpy.sum",
"numpy.zeros",
"numpy.dot",
"nltk.cluster.util.cosine_distance"
] | [((3283, 3293), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (3291, 3293), True, 'import networkx as nx\n'), ((3646, 3680), 'networkx.connected_components', 'nx.connected_components', (['adj_graph'], {}), '(adj_graph)\n', (3669, 3680), True, 'import networkx as nx\n'), ((822, 847), 'numpy.zeros', 'np.zeros', (['(300... |
import numpy as np
import musher
def test_hpcp():
tone = 100.
frequencies = [tone, tone * 2, tone * 3, tone * 4]
magnitudes = [1., 1., 1., 1.]
harmonics = 3
band_preset = False
min_frequency = 50.0
max_frequency = 500.0
actual_hpcp = musher.hpcp(frequencies,
... | [
"musher.hpcp_from_peaks",
"musher.hpcp",
"musher.spectral_peaks",
"numpy.allclose"
] | [((270, 415), 'musher.hpcp', 'musher.hpcp', (['frequencies', 'magnitudes'], {'harmonics': 'harmonics', 'band_preset': 'band_preset', 'min_frequency': 'min_frequency', 'max_frequency': 'max_frequency'}), '(frequencies, magnitudes, harmonics=harmonics, band_preset=\n band_preset, min_frequency=min_frequency, max_frequ... |
# The code is based on original repository https://github.com/OctoberChang/klcpd_code
# !/usr/bin/env python
# encoding: utf-8
import math
import numpy as np
import random
import sklearn.metrics
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.backends... | [
"math.sqrt",
"torch.sin",
"torch.cos",
"torch.bmm",
"torch.nn.functional.softmax",
"numpy.arange",
"torch.nn.GRU",
"torch.mean",
"numpy.concatenate",
"torch.autograd.Variable",
"sklearn.metrics.pairwise.euclidean_distances",
"numpy.triu_indices_from",
"torch.transpose",
"numpy.random.randn... | [((605, 649), 'sklearn.metrics.pairwise.euclidean_distances', 'euclidean_distances', (['X[:max_n]'], {'squared': '(True)'}), '(X[:max_n], squared=True)\n', (624, 649), False, 'from sklearn.metrics.pairwise import euclidean_distances\n'), ((9219, 9251), 'numpy.random.randn', 'np.random.randn', (['seq_length', 'dim'], {}... |
"""
Image classifier based in InceptionV3 (keras implementation).
"""
from PIL import Image
from keras.preprocessing import image
import keras.applications.inception_v3 as inception_v3
import keras.backend
import tensorflow as tf
import numpy as np
import pprint
keras.backend.clear_session()
MODEL_INPUT_SIZE_DEFAULT ... | [
"keras.preprocessing.image.img_to_array",
"PIL.Image.open",
"keras.applications.inception_v3.preprocess_input",
"keras.applications.inception_v3.decode_predictions",
"numpy.expand_dims",
"keras.applications.inception_v3.InceptionV3",
"tensorflow.get_default_graph"
] | [((584, 625), 'keras.applications.inception_v3.InceptionV3', 'inception_v3.InceptionV3', ([], {'weights': 'weights'}), '(weights=weights)\n', (608, 625), True, 'import keras.applications.inception_v3 as inception_v3\n'), ((674, 696), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (694, 696), ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 6 19:33:27 2018
@author: yume
"""
import numpy as np
import matplotlib.pyplot as plt
def load_default_trajectory():
ps = np.array(([
[-0.77703479856881415, 1.4993181096841063],
[-0.70776038682731871, 1.4170221119724254],
[-0.6... | [
"numpy.array",
"matplotlib.pyplot.plot"
] | [((177, 2042), 'numpy.array', 'np.array', (['[[-0.7770347985688142, 1.4993181096841064], [-0.7077603868273187, \n 1.4170221119724253], [-0.6826069086588465, 1.4206095214452887], [-\n 0.6196133535044472, 1.396403374501471], [-0.5245297517540862, \n 1.3120215099603865], [-0.4105458100531159, 1.2300884769965503],... |
import io
import numpy as np
import pandas as pd
import cirq
def assert_json_roundtrip_works(obj, text_should_be=None, resolvers=None):
"""Tests that the given object can serialized and de-serialized
Args:
obj: The object to test round-tripping for.
text_should_be: An optional argument to as... | [
"numpy.testing.assert_equal",
"cirq.protocols.read_json",
"pandas.testing.assert_index_equal",
"pandas.testing.assert_frame_equal",
"io.StringIO",
"cirq.protocols.to_json"
] | [((585, 598), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (596, 598), False, 'import io\n'), ((603, 638), 'cirq.protocols.to_json', 'cirq.protocols.to_json', (['obj', 'buffer'], {}), '(obj, buffer)\n', (625, 638), False, 'import cirq\n'), ((810, 863), 'cirq.protocols.read_json', 'cirq.protocols.read_json', (['buffe... |
import argparse
import os
import numpy as np
import glob
from sklearn.linear_model import LogisticRegression
from sklearn.externals import joblib
#import joblib
from azureml.core import Run
from utils import load_data
# let user feed in 2 parameters, the dataset to mount or download, and the regularization rate of t... | [
"numpy.float",
"os.makedirs",
"numpy.average",
"argparse.ArgumentParser",
"os.path.join",
"azureml.core.Run.get_context",
"sklearn.linear_model.LogisticRegression",
"sklearn.externals.joblib.dump"
] | [((358, 383), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (381, 383), False, 'import argparse\n'), ((1459, 1476), 'azureml.core.Run.get_context', 'Run.get_context', ([], {}), '()\n', (1474, 1476), False, 'from azureml.core import Run\n'), ((1565, 1662), 'sklearn.linear_model.LogisticRegressi... |
import numpy as np
import random
import os
import sys
from subprocess import call
import nnabla as nn
import nnabla.logger as logger
import nnabla.functions as F
import nnabla.parametric_functions as PF
import nnabla.solver as S
import nnabla.initializer as I
from args import get_args
class LSTMWrapper(PF.LSTMCell, ... | [
"nnabla.monitor.MonitorSeries",
"nnabla.initializer.ConstantInitializer",
"numpy.array",
"os.path.exists",
"nnabla.get_parameters",
"numpy.exp",
"nnabla.functions.sum",
"nnabla.ext_utils.get_extension_context",
"nnabla.functions.dropout",
"subprocess.call",
"args.get_args",
"nnabla.parametric_... | [((1466, 1478), 'numpy.exp', 'np.exp', (['loss'], {}), '(loss)\n', (1472, 1478), True, 'import numpy as np\n'), ((3113, 3131), 'nnabla.functions.split', 'F.split', (['t'], {'axis': '(1)'}), '(t, axis=1)\n', (3120, 3131), True, 'import nnabla.functions as F\n'), ((3781, 3791), 'args.get_args', 'get_args', ([], {}), '()\... |
import os, sys, numpy
from scipy.interpolate import RectBivariateSpline, interp2d
from scipy.optimize import curve_fit
from matplotlib import cm
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib.figure import Figure
try:
from mpl_toolkits.mplot3d import Axes3D # necessario per caric... | [
"oasys.widgets.gui.widgetBox",
"numpy.sqrt",
"orangecontrib.shadow.util.shadow_objects.ShadowOpticalElement.create_ellipsoid_mirror",
"oasys.widgets.gui.createTabPage",
"oasys.widgets.congruence.checkFileName",
"numpy.log",
"oasys.widgets.congruence.checkStrictlyPositiveNumber",
"oasys.widgets.gui.tab... | [((2776, 2786), 'orangewidget.settings.Setting', 'Setting', (['(0)'], {}), '(0)\n', (2783, 2786), False, 'from orangewidget.settings import Setting\n'), ((2807, 2819), 'orangewidget.settings.Setting', 'Setting', (['(100)'], {}), '(100)\n', (2814, 2819), False, 'from orangewidget.settings import Setting\n'), ((2839, 285... |
# -*- coding: utf-8 -*-
import time,sys,os
from netCDF4 import Dataset
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def readlatlon(file_path):
arr = []
with open(file_path,'r') as f:
for Line in f:
arr.append(list(... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.contourf",
"matplotlib.pyplot.title",
"scipy.interpolate.griddata",
"netCDF4.Dataset",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"numpy.loadtxt",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((923, 938), 'netCDF4.Dataset', 'Dataset', (['fyfile'], {}), '(fyfile)\n', (930, 938), False, 'from netCDF4 import Dataset\n'), ((1216, 1231), 'numpy.array', 'np.array', (['value'], {}), '(value)\n', (1224, 1231), True, 'import numpy as np\n'), ((1329, 1377), 'numpy.arange', 'np.arange', (['xll', '(xll + ncols * cells... |
from __future__ import print_function
import collections
import math
import os
import pickle
import sys
import time
import numpy
import torch
from sklearn.utils import compute_class_weight
from torch.nn.utils import clip_grad_norm
from torch.utils.data import DataLoader
from nldrp.dnn.config import DNN_BASE_PATH
from ... | [
"sys.stdout.write",
"numpy.array",
"os.remove",
"numpy.mean",
"os.path.exists",
"nldrp.dnn.logger.experiment.Metric",
"nldrp.dnn.util.multi_gpu.get_gpu_id",
"sys.stdout.flush",
"numpy.argmax",
"numpy.sign",
"torch.save",
"pickle.dump",
"numpy.unique",
"os.makedirs",
"time.strftime",
"o... | [((2200, 2231), 'sys.stdout.write', 'sys.stdout.write', (['_progress_str'], {}), '(_progress_str)\n', (2216, 2231), False, 'import sys\n'), ((2236, 2254), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (2252, 2254), False, 'import sys\n'), ((2551, 2566), 'numpy.unique', 'numpy.unique', (['y'], {}), '(y)\n', ... |
"""Visualize the annotated SVs"""
# standard libraries
import argparse
import pathlib
import numpy as np
import pandas as pd
# own libraries
from lib import plotting
# plotting
import matplotlib.pyplot as plt
def argparser():
parser = argparse.ArgumentParser(description="Visualize annotated CNVs.")
parser.... | [
"numpy.repeat",
"pandas.read_csv",
"argparse.ArgumentParser",
"pathlib.Path",
"lib.plotting.plot_feature_dist",
"pandas.concat"
] | [((244, 308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Visualize annotated CNVs."""'}), "(description='Visualize annotated CNVs.')\n", (267, 308), False, 'import argparse\n'), ((793, 818), 'pathlib.Path', 'pathlib.Path', (['args.cnvs_1'], {}), '(args.cnvs_1)\n', (805, 818), False, ... |
"""
Trainer for semi-supervised GAN
"""
import numpy as np
import torch
from torch.autograd import Variable
from tqdm import tqdm
from torchlib.common import FloatTensor, LongTensor
from torchlib.utils.plot import get_visdom_line_plotter
class Trainer(object):
def __init__(self, trick_dict=None):
if tri... | [
"numpy.mean",
"torchlib.common.FloatTensor",
"tqdm.tqdm",
"numpy.array",
"torchlib.utils.plot.get_visdom_line_plotter",
"numpy.random.randn"
] | [((477, 508), 'torchlib.utils.plot.get_visdom_line_plotter', 'get_visdom_line_plotter', (['"""main"""'], {}), "('main')\n", (500, 508), False, 'from torchlib.utils.plot import get_visdom_line_plotter\n'), ((2773, 2790), 'tqdm.tqdm', 'tqdm', (['data_loader'], {}), '(data_loader)\n', (2777, 2790), False, 'from tqdm impor... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
import cPickle
from tensorflow.contrib import slim
#Load features and labels
features = cPickle.load(open('nn_features.p', 'rb'))
labels = cPickle.load(open('labels.p', 'rb'))
mask = np.random.choice(features.shape[0], features.shape[0... | [
"tensorflow.contrib.slim.batch_norm",
"tensorflow.initialize_all_variables",
"tensorflow.random_normal",
"tensorflow.contrib.slim.l2_regularizer",
"numpy.random.choice",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.truncated_normal_initializer",
"tensorflow.argmax",
"numpy.array_equ... | [((268, 337), 'numpy.random.choice', 'np.random.choice', (['features.shape[0]', 'features.shape[0]'], {'replace': '(False)'}), '(features.shape[0], features.shape[0], replace=False)\n', (284, 337), True, 'import numpy as np\n'), ((1255, 1300), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, num_fea... |
from collections import defaultdict
import json
from pandas.core import frame
import torch
import pandas as pd
import os
import pickle as pkl
import numpy as np
import cv2
import h5py
import tqdm
import lmdb
from functools import lru_cache
class EPIC_KITCHENS_DATASET(torch.utils.data.Dataset):
def __init__(self, ... | [
"os.path.join",
"numpy.stack",
"numpy.zeros",
"collections.defaultdict",
"lmdb.open",
"numpy.frombuffer",
"numpy.arange"
] | [((4832, 4849), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (4843, 4849), False, 'from collections import defaultdict\n'), ((6648, 6702), 'lmdb.open', 'lmdb.open', (['config.feat_file'], {'readonly': '(True)', 'lock': '(False)'}), '(config.feat_file, readonly=True, lock=False)\n', (6657, 6702)... |
import io
import os
import time
import argparse
import random
import logging
import warnings
import multiprocessing
import numpy as np
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import Block, nn
from mxnet.gluon.data.sampler import Sampler, SequentialSampler
import gluonnlp as nlp
from gluonnlp.model i... | [
"gluonnlp.data.batchify.Pad",
"numpy.array",
"numpy.arange",
"gluonnlp.data.sampler.FixedBucketSampler",
"numpy.random.seed",
"mxnet.nd.array",
"mxnet.gluon.data.DataLoader",
"os.path.expanduser",
"json.loads",
"gluonnlp.model.get_model",
"random.uniform",
"tmnt.data_loading.PairedDataLoader",... | [((10160, 10182), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (10180, 10182), False, 'import multiprocessing\n'), ((11883, 11905), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (11903, 11905), False, 'import multiprocessing\n'), ((12329, 12472), 'mxnet.gluon.data.DataLoader', '... |
import numpy as np
from skimage.transform import pyramid_gaussian
from lv import get_contour_points, area2cont, cont2area, interpolate_contour
def window_image(img, cent_point, window):
y0 = int(np.round(cent_point[0]) - window // 2)
y1 = int(np.round(cent_point[0]) + window // 2 + 1)
x0 = int(... | [
"lv.cont2area",
"lv.area2cont",
"skimage.transform.pyramid_gaussian",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.linalg.lstsq",
"numpy.gradient",
"numpy.round"
] | [((204, 227), 'numpy.round', 'np.round', (['cent_point[0]'], {}), '(cent_point[0])\n', (212, 227), True, 'import numpy as np\n'), ((320, 343), 'numpy.round', 'np.round', (['cent_point[1]'], {}), '(cent_point[1])\n', (328, 343), True, 'import numpy as np\n'), ((3407, 3426), 'lv.area2cont', 'area2cont', (['true_msk'], {}... |
# 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, softw... | [
"mt.mvae.ops.spherical_projected.exp_map_mu0",
"numpy.sqrt",
"mt.mvae.ops.spherical_projected.exp_map",
"mt.mvae.ops.poincare.pm.gyration",
"mt.mvae.ops.spherical_projected.sample_projection_mu0",
"mt.mvae.ops.spherical_projected.inverse_sample_projection_mu0",
"mt.mvae.ops.spherical_projected.gyration"... | [((934, 952), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (948, 952), True, 'import numpy as np\n'), ((1031, 1069), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'dtype': 'torch.float64'}), '(2.0, dtype=torch.float64)\n', (1043, 1069), False, 'import torch\n'), ((1604, 1617), 'mt.mvae.ops.spherical_... |
"""
Copyright (c) 2018-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 i... | [
"mo.utils.error.Error",
"io.BytesIO",
"mo.utils.utils.refer_to_faq_msg",
"struct.unpack",
"os.path.basename",
"numpy.fromstring"
] | [((7192, 7210), 'io.BytesIO', 'io.BytesIO', (['buffer'], {}), '(buffer)\n', (7202, 7210), False, 'import io\n'), ((10726, 10758), 'numpy.fromstring', 'np.fromstring', (['data'], {'dtype': 'dtype'}), '(data, dtype=dtype)\n', (10739, 10758), True, 'import numpy as np\n'), ((2156, 2177), 'struct.unpack', 'struct.unpack', ... |
# -*- coding: utf-8 -*-
"""Classes for 2d U-net training and prediction.
"""
import json
from loguru import logger
import os
import sys
import warnings
from functools import partial
from pathlib import Path
from zipfile import ZipFile
import numpy as np
#from pytorch3dunet.unet3d.losses import GeneralizedDiceLoss
impo... | [
"fastai.vision.unet_learner",
"zipfile.ZipFile",
"torch.max",
"fastai.vision.SegmentationItemList.from_folder",
"skimage.img_as_float",
"numpy.array",
"torch.squeeze",
"numpy.gradient",
"fastai.vision.pil2tensor",
"os.remove",
"matplotlib.pyplot.imshow",
"fastai.utils.mem.gpu_mem_get_free_no_c... | [((712, 726), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (719, 726), True, 'import matplotlib as mpl\n'), ((848, 903), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (871, 903), False, 'import warnings\n'),... |
# -*- coding: utf-8 -*-
"""
Routines and Class definitions for the diffusion maps algorithm.
"""
from __future__ import absolute_import
import numpy as np
import scipy.sparse as sps
import scipy.sparse.linalg as spsl
import warnings
from . import kernel
from . import utils
class DiffusionMap(object):
"""
Dif... | [
"numpy.shape",
"numpy.sqrt",
"scipy.sparse.eye",
"numpy.power",
"numpy.hstack",
"numpy.real",
"numpy.array_equal",
"numpy.vstack",
"warnings.warn",
"scipy.sparse.linalg.eigs",
"scipy.sparse.spdiags"
] | [((14676, 14721), 'numpy.vstack', 'np.vstack', (['[dmap_object.local_kernel.data, Y]'], {}), '([dmap_object.local_kernel.data, Y])\n', (14685, 14721), True, 'import numpy as np\n'), ((14800, 14858), 'numpy.hstack', 'np.hstack', (['[dmap_object.right_norm_vec, yy_right_norm_vec]'], {}), '([dmap_object.right_norm_vec, yy... |
"""
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve --show gui
in your browser.
"""
from os.path import dirname, join
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import layout, Spacer
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.models import Hov... | [
"bokeh.plotting.figure",
"bokeh.models.widgets.Button",
"bokeh.models.widgets.CheckboxGroup",
"roentgen.absorption.Response",
"roentgen.util.get_density",
"numpy.arange",
"bokeh.io.curdoc",
"astropy.units.imperial.enable",
"bokeh.models.widgets.TableColumn",
"bokeh.models.widgets.DataTable",
"bo... | [((876, 895), 'astropy.units.imperial.enable', 'u.imperial.enable', ([], {}), '()\n', (893, 895), True, 'import astropy.units as u\n'), ((1484, 1586), 'bokeh.models.HoverTool', 'HoverTool', ([], {'tooltips': "[('energy [keV]', '@{x}{0.2f}'), ('transmission', '@{y}{0.3f}')]", 'mode': '"""vline"""'}), "(tooltips=[('energ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 14:01:00 2020
@author: hvf811
"""
seed_val = 1234
import os
import tensorflow as tf
from tensorflow.keras.layers import Dense, Input, Dropout,Multiply, LSTM, Add, Concatenate, TimeDistributed
from tensorflow.keras.layers import Conv1D, Flatten, Lambda, ... | [
"numpy.prod",
"tensorflow.keras.initializers.RandomUniform",
"tensorflow.keras.backend.epsilon",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.backend.not_equal",
"tensorflow.keras.backend.shape",
"tensorflow.keras.backend.max",
"numpy.random.seed",
"tensorflow.keras.backend.cast",
"numpy.con... | [((1119, 1147), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed_val'], {}), '(seed_val)\n', (1137, 1147), True, 'import tensorflow as tf\n'), ((1149, 1173), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (1163, 1173), True, 'import numpy as np\n'), ((1175, 1196), 'random.seed', '... |
"""
Code for processing operations for numpy arrays of tif stacks
"""
#Import packages
#Dependences
import numpy as np
from numpy.fft import fft2, ifft2, fftshift
from scipy.ndimage import median_filter, gaussian_filter, shift
import itertools
import gc
def doMedianFilter(imgstack, med_fsize=3):
'''
Median F... | [
"numpy.fft.fftshift",
"numpy.fft.ifft2",
"numpy.expm1",
"numpy.fft.fft2",
"scipy.ndimage.shift",
"numpy.array",
"numpy.empty",
"gc.collect",
"scipy.ndimage.gaussian_filter",
"itertools.izip",
"scipy.ndimage.median_filter",
"numpy.maximum",
"numpy.zeros_like"
] | [((571, 612), 'numpy.empty', 'np.empty', (['imgstack.shape'], {'dtype': 'np.uint16'}), '(imgstack.shape, dtype=np.uint16)\n', (579, 612), True, 'import numpy as np\n'), ((1522, 1545), 'numpy.empty', 'np.empty', (['logimgs.shape'], {}), '(logimgs.shape)\n', (1530, 1545), True, 'import numpy as np\n'), ((1782, 1794), 'gc... |
import codecs
import numpy as np
import os
_CORE_ARGS = { "ARG0", "ARG1", "ARG2", "ARG3", "ARG4", "ARG5", "ARGA",
"A0", "A1", "A2", "A3", "A4", "A5", "AA" }
def logsumexp(arr):
maxv = np.max(arr)
lognorm = maxv + np.log(np.sum(np.exp(arr - maxv)))
arr2 = np.exp(arr - lognorm)
#print maxv, logn... | [
"numpy.exp",
"numpy.max"
] | [((204, 215), 'numpy.max', 'np.max', (['arr'], {}), '(arr)\n', (210, 215), True, 'import numpy as np\n'), ((279, 300), 'numpy.exp', 'np.exp', (['(arr - lognorm)'], {}), '(arr - lognorm)\n', (285, 300), True, 'import numpy as np\n'), ((249, 267), 'numpy.exp', 'np.exp', (['(arr - maxv)'], {}), '(arr - maxv)\n', (255, 267... |
from aitlas.datasets.crops_classification import CropsDataset
import os
import zipfile
import tarfile
import urllib
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import seaborn as sns
import h5py
from ..base import ... | [
"aitlas.datasets.crops_classification.CropsDataset.__init__",
"os.path.exists",
"numpy.multiply",
"numpy.repeat",
"pandas.read_csv",
"urllib.request.urlretrieve",
"sklearn.model_selection.train_test_split",
"os.scandir",
"pandas.concatenate",
"eolearn.core.EOPatch.load",
"h5py.File",
"os.path.... | [((1493, 1528), 'aitlas.datasets.crops_classification.CropsDataset.__init__', 'CropsDataset.__init__', (['self', 'config'], {}), '(self, config)\n', (1514, 1528), False, 'from aitlas.datasets.crops_classification import CropsDataset\n'), ((2327, 2401), 'pandas.read_csv', 'pd.read_csv', (["(self.root + os.sep + self.reg... |
#!/usr/bin/env python
# coding: utf-8
# ### - Calculate the signature strength and Transcriptional Activity Score for each compound based on its replicates for Cell painting Level-4 profiles
#
#
# #### Definitions from [clue.io](https://clue.io/connectopedia/signature_quality_metrics)
#
# - **Signature strength -*... | [
"os.path.exists",
"pickle.dump",
"pandas.merge",
"numpy.warnings.filterwarnings",
"os.path.join",
"math.sqrt",
"pandas.DataFrame.from_dict",
"seaborn.set_style",
"os.mkdir",
"warnings.simplefilter"
] | [((1304, 1329), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (1317, 1329), True, 'import seaborn as sns\n'), ((1390, 1452), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n",... |
import numpy as np
def convert_weights(d, cfg):
has_fpn = cfg.MODEL.NECK.NAME == "FPN"
use_res5_in_stage2 = cfg.MODEL.ROI_HEADS.NAME == "Res5ROIHeads"
is_retina = cfg.MODEL.NECK.TOP_BLOCK_TYPE == "P6P7"
ret = {}
def _convert_conv(src, dst):
src_w = d.pop(src + ".weight").transpose(2, 3, 1... | [
"numpy.stack",
"numpy.log2",
"numpy.reshape",
"numpy.arange"
] | [((3357, 3416), 'numpy.stack', 'np.stack', (['[idx_ymin, idx_xmin, idx_ymax, idx_xmax]'], {'axis': '(-1)'}), '([idx_ymin, idx_xmin, idx_ymax, idx_xmax], axis=-1)\n', (3365, 3416), True, 'import numpy as np\n'), ((3432, 3471), 'numpy.reshape', 'np.reshape', (['idxs', '[num_reg_classes * 4]'], {}), '(idxs, [num_reg_class... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 9 01:58:58 2019
@author: iqbalsublime
"""
#================================================================================================================
#---------------------------------------------------------------------------------------------------------... | [
"random.shuffle",
"pandas.read_csv",
"time.clock",
"matplotlib.pyplot.style.use",
"collections.Counter",
"numpy.array",
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScaler"
] | [((993, 1016), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (1006, 1016), True, 'import matplotlib.pyplot as plt\n'), ((2826, 2867), 'pandas.read_csv', 'pd.read_csv', (['"""chronic_kidney_disease.csv"""'], {}), "('chronic_kidney_disease.csv')\n", (2837, 2867), True, 'import pa... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
from cleverhans.utils_tf import model_train, model_eval, tf_model_load
from cleverhans.utils import AccuracyReport, set_log_lev... | [
"cleverhans.utils_tf.tf_model_load",
"cleverhans.utils_tf.model_eval",
"tensorflow.placeholder",
"cleverhans.utils.AccuracyReport",
"numpy.random.RandomState"
] | [((704, 720), 'cleverhans.utils.AccuracyReport', 'AccuracyReport', ([], {}), '()\n', (718, 720), False, 'from cleverhans.utils import AccuracyReport, set_log_level\n'), ((768, 829), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': "self.data_params['x_shape']"}), "(tf.float32, shape=self.data_para... |
# Modified by Microsoft Corporation.
# Licensed under the MIT license.
import json
import operator
import os
import pickle
import subprocess
import sys
import time
from collections import deque
from contextlib import contextmanager
from datetime import datetime
from importlib import reload
from pprint import pformat
... | [
"pandas.read_csv",
"torch.cuda.device_count",
"yaml.load",
"numpy.array_split",
"numpy.array",
"pydash.is_empty",
"operator.itemgetter",
"torch.multiprocessing.cpu_count",
"numpy.arange",
"ujson.load",
"regex.search",
"os.path.exists",
"pydash.is_dict",
"numpy.isscalar",
"subprocess.Pope... | [((525, 539), 'torch.multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (537, 539), True, 'import torch.multiprocessing as mp\n'), ((588, 631), 'regex.compile', 're.compile', (['"""(\\\\d{4}_\\\\d{2}_\\\\d{2}_\\\\d{6})"""'], {}), "('(\\\\d{4}_\\\\d{2}_\\\\d{2}_\\\\d{6})')\n", (598, 631), True, 'import regex ... |
# Copyright 2018 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
# This example demonstrates how to leverage Spark for parallel inferencing from a SavedModel.
#
# Normally, you can use TensorFlowOnSpark to just form a TensorFlow cluster for trai... | [
"tensorflow.saved_model.load",
"numpy.reshape",
"argparse.ArgumentParser",
"tensorflow.io.parse_single_example",
"numpy.argmax",
"tensorflow.io.gfile.makedirs",
"tensorflow.io.FixedLenFeature",
"pyspark.conf.SparkConf",
"tensorflow.reshape",
"tensorflowonspark.TFParallel.run",
"tensorflow.cast"
... | [((1076, 1126), 'tensorflow.saved_model.load', 'tf.saved_model.load', (['args.export_dir'], {'tags': '"""serve"""'}), "(args.export_dir, tags='serve')\n", (1095, 1126), True, 'import tensorflow as tf\n'), ((2005, 2038), 'tensorflow.io.gfile.makedirs', 'tf.io.gfile.makedirs', (['args.output'], {}), '(args.output)\n', (2... |
# coding: utf-8
# pylint: disable=invalid-name, no-member, too-many-arguments
""" wrapper function of distmesh for EIT """
# Copyright (c) <NAME>. All rights reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division, absolute_import, print_function
import numpy... | [
"numpy.mean",
"numpy.iscomplex",
"numpy.sqrt",
"numpy.ones",
"numpy.size",
"numpy.array",
"numpy.arange"
] | [((1358, 1372), 'numpy.array', 'np.array', (['bbox'], {}), '(bbox)\n', (1366, 1372), True, 'import numpy as np\n'), ((3520, 3535), 'numpy.arange', 'np.arange', (['n_el'], {}), '(n_el)\n', (3529, 3535), True, 'import numpy as np\n'), ((3598, 3633), 'numpy.ones', 'np.ones', (['t.shape[0]'], {'dtype': 'np.float'}), '(t.sh... |
import numpy as np
import mxnet as mx
from collections import namedtuple
def get_network_fc(network_path, network_epoch, normalize_inputs):
batch_def = namedtuple('Batch', ['data'])
sym, arg_params, aux_params = mx.model.load_checkpoint(network_path, network_epoch)
network = mx.mod.Module(symbol=sym.get_i... | [
"collections.namedtuple",
"numpy.array",
"numpy.zeros",
"mxnet.gpu",
"mxnet.nd.array",
"mxnet.model.load_checkpoint",
"numpy.transpose"
] | [((1153, 1195), 'numpy.zeros', 'np.zeros', (['[6, 224, 224, 3]'], {'dtype': 'np.uint8'}), '([6, 224, 224, 3], dtype=np.uint8)\n', (1161, 1195), True, 'import numpy as np\n'), ((157, 186), 'collections.namedtuple', 'namedtuple', (['"""Batch"""', "['data']"], {}), "('Batch', ['data'])\n", (167, 186), False, 'from collect... |
"""Basic Breakpoint API Examples."""
import numpy as np
import pandas as pd
from portformer import BreakpointAPI
def examples():
"""List of major Breakpoint API examples"""
# Read environment variable = BREAKPOINT_API_KEY
api = BreakpointAPI(api_key=None)
# Get Latest AAPL forecasts
breakpoint... | [
"numpy.random.normal",
"numpy.random.seed",
"portformer.BreakpointAPI",
"pandas.bdate_range"
] | [((244, 271), 'portformer.BreakpointAPI', 'BreakpointAPI', ([], {'api_key': 'None'}), '(api_key=None)\n', (257, 271), False, 'from portformer import BreakpointAPI\n'), ((1749, 1776), 'portformer.BreakpointAPI', 'BreakpointAPI', ([], {'api_key': 'None'}), '(api_key=None)\n', (1762, 1776), False, 'from portformer import ... |
"""
Test smd0 and eventbuilder for handling step dgrams.
See https://docs.google.com/spreadsheets/d/1VlVCwEVGahab3omAFJLaF8DJWFcz-faI9Q9aHa7QTUw/edit?usp=sharing for test setup.
"""
import os, time, glob, sys
from psana.smdreader import SmdReader
from psana.dgram import Dgram
from setup_input_files import setup_input_... | [
"psana.DataSource",
"pathlib.Path",
"psana.dgram.Dgram",
"os.close",
"psana.smdreader.SmdReader",
"os.open",
"os.path.join",
"os.environ.get",
"numpy.asarray",
"numpy.max",
"numpy.zeros",
"setup_input_files.setup_input_files",
"time.time"
] | [((481, 516), 'os.environ.get', 'os.environ.get', (['"""TEST_XTC_DIR"""', '"""."""'], {}), "('TEST_XTC_DIR', '.')\n", (495, 516), False, 'import os, time, glob, sys\n'), ((527, 566), 'os.path.join', 'os.path.join', (['test_xtc_dir', '""".tmp_smd0"""'], {}), "(test_xtc_dir, '.tmp_smd0')\n", (539, 566), False, 'import os... |
import copy
import numpy as np
import math
class Transformation:
def __init__(self, is_array = False, num_instances = 1):
# self.tx = 0.0
# self.ty = 0.0
# self.tz = 0.0
# self.rx = 0.0
# self.ry = 0.0
# self.rz = 0.0
# self.sx = 1.0
# self.sy = 1.0
... | [
"numpy.eye",
"math.radians",
"numpy.array",
"numpy.matmul",
"copy.deepcopy"
] | [((373, 382), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (379, 382), True, 'import numpy as np\n'), ((640, 712), 'numpy.array', 'np.array', (['[[1, 0, 0, tx_], [0, 1, 0, ty_], [0, 0, 1, tz_], [0, 0, 0, 1]]'], {}), '([[1, 0, 0, tx_], [0, 1, 0, ty_], [0, 0, 1, tz_], [0, 0, 0, 1]])\n', (648, 712), True, 'import numpy ... |
import logging
import unittest
import numpy as np
from astropy import units as u
from flarestack.cosmo import get_rate
from flarestack.cosmo.rates import source_maps
from flarestack.cosmo.rates.tde_rates import tde_evolutions, local_tde_rates
from flarestack.cosmo.rates.sfr_rates import sfr_evolutions, local_sfr_rates
... | [
"flarestack.cosmo.rates.sfr_rates.sfr_evolutions.keys",
"flarestack.cosmo.rates.ccsn_rates.sn_subclass_rates.items",
"flarestack.cosmo.rates.grb_rates.grb_evolutions.keys",
"flarestack.cosmo.rates.frb_rates.local_frb_rates.keys",
"flarestack.cosmo.rates.ccsn_rates.kcc_rates.keys",
"flarestack.cosmo.get_ra... | [((606, 630), 'numpy.linspace', 'np.linspace', (['(0.0)', '(8.0)', '(5)'], {}), '(0.0, 8.0, 5)\n', (617, 630), True, 'import numpy as np\n'), ((3597, 3612), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3610, 3612), False, 'import unittest\n'), ((748, 797), 'logging.info', 'logging.info', (['"""Testing get_rates... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import quad
def smooth_product(u, v, domain=(0, 1)):
approx, _ = quad(lambda x: u(x)*v(x), *domain) # Discard error
return approx
def least_squares(func, basis, inner, **kwargs):
# Take the inner product of each pair of basis
l... | [
"numpy.linalg.solve",
"numpy.exp",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((593, 618), 'numpy.linalg.solve', 'np.linalg.solve', (['lhs', 'rhs'], {}), '(lhs, rhs)\n', (608, 618), True, 'import numpy as np\n'), ((923, 940), 'numpy.linspace', 'np.linspace', (['(0)', '(1)'], {}), '(0, 1)\n', (934, 940), True, 'import numpy as np\n'), ((1005, 1019), 'matplotlib.pyplot.subplots', 'plt.subplots', ... |
import numpy as np
import matplotlib.pyplot as plt
import itertools
import threading
import imp
"""This module is for developing the machinery required to make neural nets and analyse local and global codes
This module does stuff.
"""
__version__ = '0.1'
__author__ = '<NAME>'
__date__ = 'Jan 2017'
class ThreadedR... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"numpy.log",
"imp.lock_held",
"numpy.linalg.norm",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.ndenumerate",
"matplotlib.pyplot.axhline",
"imp.acquire_lock",
"matplotlib.pyplot.Rectangle",
"matplotlib.pyplot.NullLocator",
"num... | [((4652, 4675), 'numpy.ones', 'np.ones', (['out[z].T.shape'], {}), '(out[z].T.shape)\n', (4659, 4675), True, 'import numpy as np\n'), ((5523, 5536), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (5533, 5536), True, 'import matplotlib.pyplot as plt\n'), ((6121, 6142), 'matplotlib.pyplot.ylabel', 'plt... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import linear_model
plt.style.use('fivethirtyeight')
datafile = 'datafile.txt'
data = np.loadtxt(datafile,delimiter=',',usecols=(0,1,2),unpack=True)
X = np.transpose(np.array(data[:-1]))
Y = np.transpose(np.array(data[-1:]))
pos = np... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.pcolormesh",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"matplotlib.pyplot.figu... | [((104, 136), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (117, 136), True, 'import matplotlib.pyplot as plt\n'), ((171, 238), 'numpy.loadtxt', 'np.loadtxt', (['datafile'], {'delimiter': '""","""', 'usecols': '(0, 1, 2)', 'unpack': '(True)'}), "(datafile, de... |
from dataclasses import dataclass
import hashlib
import blosc
import numpy as np
def HashedKey(*args, version=None):
""" BOSS Key creation function
Takes a list of different key string elements, joins them with the '&' char,
and prepends the MD5 hash of the key to the key.
Args (Common usage):
... | [
"numpy.frombuffer"
] | [((2670, 2705), 'numpy.frombuffer', 'np.frombuffer', (['rawdata'], {'dtype': 'dtype'}), '(rawdata, dtype=dtype)\n', (2683, 2705), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""Tools for loading, shuffling, and batching ANI datasets
The `torchani.data.load(path)` creates an iterable of raw data,
where species are strings, and coordinates are numpy ndarrays.
You can transform these iterable by using transformations.
To do transformation, just do `it.transformation_... | [
"os.listdir",
"random.shuffle",
"importlib.util.find_spec",
"math.sqrt",
"os.path.join",
"functools.wraps",
"collections.Counter",
"numpy.array",
"os.path.isfile",
"os.path.isdir",
"functools.partial",
"gc.collect",
"numpy.linalg.lstsq"
] | [((4524, 4557), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""pkbar"""'], {}), "('pkbar')\n", (4548, 4557), False, 'import importlib\n'), ((8171, 8183), 'gc.collect', 'gc.collect', ([], {}), '()\n', (8181, 8183), False, 'import gc\n'), ((9419, 9449), 'math.sqrt', 'math.sqrt', (['(std / n - mean ** 2)'],... |
import numpy as np
from torch.autograd import Variable
import torch as torch
import copy
from torch.autograd.gradcheck import zero_gradients
def deepfool(image, net, num_classes, overshoot, max_iter):
"""
:param image: Image of size HxWx3
:param net: network (input: images, output: values of activa... | [
"torch.autograd.gradcheck.zero_gradients",
"numpy.linalg.norm",
"torch.from_numpy",
"numpy.zeros",
"torch.cuda.is_available",
"copy.deepcopy",
"torch.autograd.Variable",
"numpy.float32"
] | [((799, 824), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (822, 824), True, 'import torch as torch\n'), ((1140, 1160), 'copy.deepcopy', 'copy.deepcopy', (['image'], {}), '(image)\n', (1153, 1160), False, 'import copy\n'), ((1169, 1190), 'numpy.zeros', 'np.zeros', (['input_shape'], {}), '(inp... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2018-2020 CNRS
# 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 limita... | [
"torch.nn.Sigmoid",
"numpy.int64",
"torch.nn.Sequential",
"torch.load",
"numpy.sum",
"torch.tensor",
"torch.nn.MSELoss",
"torch.nn.NLLLoss",
"torch.sparse.torch.eye",
"torch.nn.LogSoftmax",
"torch.nn.Linear"
] | [((4880, 4912), 'numpy.sum', 'np.sum', (['Y'], {'axis': '(1)', 'keepdims': '(True)'}), '(Y, axis=1, keepdims=True)\n', (4886, 4912), True, 'import numpy as np\n'), ((4967, 4994), 'numpy.int64', 'np.int64', (['(speaker_count > 0)'], {}), '(speaker_count > 0)\n', (4975, 4994), True, 'import numpy as np\n'), ((9820, 9884)... |
import os
import re
import dgl
import numpy as np
from data import *
def get_edgelists(edgelist_expression, directory):
if "," in edgelist_expression:
return edgelist_expression.split(",")
files = os.listdir(directory)
compiled_expression = re.compile(edgelist_expression)
return [filename for... | [
"os.listdir",
"dgl.heterograph",
"dgl.graph",
"re.compile",
"os.path.join",
"numpy.array"
] | [((216, 237), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (226, 237), False, 'import os\n'), ((264, 295), 're.compile', 're.compile', (['edgelist_expression'], {}), '(edgelist_expression)\n', (274, 295), False, 'import re\n'), ((1942, 1968), 'dgl.heterograph', 'dgl.heterograph', (['edgelists'], {}... |
'''
MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
Copyright (C) 2012 University of Auckland
This file is part of MAP Client. (http://launchpad.net/mapclient)
MAP Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Genera... | [
"gias2.mappluginutils.mayaviviewer.MayaviViewerObjectsContainer",
"traits.api.on_trait_change",
"PySide2.QtGui.QIntValidator",
"PySide2.QtWidgets.QTableWidgetItem",
"numpy.array",
"PySide2.QtWidgets.QDialog.__init__",
"mapclientplugins.pelvislandmarkshjcpredictionstep.ui_hjcpredictionviewerwidget.Ui_Dia... | [((13893, 13927), 'traits.api.on_trait_change', 'on_trait_change', (['"""scene.activated"""'], {}), "('scene.activated')\n", (13908, 13927), False, 'from traits.api import HasTraits, Instance, on_trait_change, Int, Dict\n'), ((1983, 2013), 'PySide2.QtWidgets.QDialog.__init__', 'QDialog.__init__', (['self', 'parent'], {... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# # 3.3 线性回归的简洁实现
import torch
from torch import nn
import numpy as np
torch.manual_seed(1)
print(torch.__version__)
torch.set_default_tensor_type('torch.FloatTensor')
# ## 3.3.1 生成数据集
num_inputs = 2
num_examples = 1000
true_w = ... | [
"numpy.random.normal",
"torch.manual_seed",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.utils.data.TensorDataset",
"torch.set_default_tensor_type",
"torch.nn.MSELoss",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.nn.init.normal_"
] | [((158, 178), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (175, 178), False, 'import torch\n'), ((205, 255), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['"""torch.FloatTensor"""'], {}), "('torch.FloatTensor')\n", (234, 255), False, 'import torch\n'), ((695, 731), 'torch.uti... |
from matplotlib.pyplot import figure
import xarray
import numpy as np
__all__ = ["precip", "ver"]
def density(iono: xarray.Dataset):
fig = figure()
axs = fig.subplots(1, 2, sharey=True)
fig.suptitle("Number Density")
ax = axs[0]
for v in ("O", "N2", "O2", "NO"):
ax.plot(iono[v], iono[v]... | [
"matplotlib.pyplot.figure",
"numpy.isnan",
"numpy.nanmax"
] | [((146, 154), 'matplotlib.pyplot.figure', 'figure', ([], {}), '()\n', (152, 154), False, 'from matplotlib.pyplot import figure\n'), ((1909, 1940), 'matplotlib.pyplot.figure', 'figure', ([], {'constrained_layout': '(True)'}), '(constrained_layout=True)\n', (1915, 1940), False, 'from matplotlib.pyplot import figure\n'), ... |
import os
import numpy as np
def getParamsFromInfo(folder):
infoFiles = ["criterion", "test_criterion", "test_loader", "train_loader", "opimizer", "test_data_set", "train_data_set", "weight"]
for idx, f in enumerate(infoFiles):
infoFiles[i] = os.path.join(folder, f+"_info.txt")
criterion = get... | [
"numpy.array",
"os.path.join"
] | [((1844, 1864), 'numpy.array', 'np.array', (['levelrange'], {}), '(levelrange)\n', (1852, 1864), True, 'import numpy as np\n'), ((260, 297), 'os.path.join', 'os.path.join', (['folder', "(f + '_info.txt')"], {}), "(folder, f + '_info.txt')\n", (272, 297), False, 'import os\n')] |
from __future__ import division
import numpy as np
from scipy.optimize import fmin_bfgs
from itertools import combinations_with_replacement
import causalinference.utils.tools as tools
from .data import Dict
class Propensity(Dict):
"""
Dictionary-like class containing propensity score data.
Propensity score rel... | [
"causalinference.utils.tools.gen_reg_entries",
"causalinference.utils.tools.add_line",
"numpy.exp",
"numpy.dot",
"numpy.zeros",
"numpy.empty",
"numpy.linalg.inv",
"causalinference.utils.tools.add_row",
"itertools.combinations_with_replacement"
] | [((3478, 3498), 'numpy.empty', 'np.empty', (['x.shape[0]'], {}), '(x.shape[0])\n', (3486, 3498), True, 'import numpy as np\n'), ((3762, 3782), 'numpy.empty', 'np.empty', (['x.shape[0]'], {}), '(x.shape[0])\n', (3770, 3782), True, 'import numpy as np\n'), ((4408, 4442), 'numpy.dot', 'np.dot', (['(phat * (1 - phat) * X.T... |
#!/usr/bin/env python
import wx
# use the numpy code instead of the raw access code for comparison
USE_NUMPY = False
# time the execution of making a bitmap?
TIMEIT = False
# how big to make the bitmaps
DIM = 100
# should we use a wx.GraphicsContext for painting?
TEST_GC = False
#---------------------------------... | [
"wx.PaintDC",
"timeit.Timer",
"wx.BitmapFromBufferRGBA",
"numpy.empty",
"wx.AlphaPixelData",
"wx.GraphicsContext.Create",
"os.path.basename",
"numarray.array",
"wx.Bitmap",
"wx.Panel.__init__"
] | [((1051, 1086), 'wx.Panel.__init__', 'wx.Panel.__init__', (['self', 'parent', '(-1)'], {}), '(self, parent, -1)\n', (1068, 1086), False, 'import wx\n'), ((2284, 2300), 'wx.PaintDC', 'wx.PaintDC', (['self'], {}), '(self)\n', (2294, 2300), False, 'import wx\n'), ((3016, 3039), 'wx.Bitmap', 'wx.Bitmap', (['DIM', 'DIM', '(... |
# <NAME> (github: @elaguerta)
# LBNL GIG
# File created: 19 February 2021
# Create NR3 Solution class, a namespace for calculations used by nr3
from . solution import Solution
from . circuit import Circuit
import numpy as np
from . nr3_lib.compute_NR3FT import compute_NR3FT
from . nr3_lib.compute_NR3JT import compute_... | [
"numpy.abs",
"numpy.sqrt",
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.sin"
] | [((1776, 1865), 'numpy.zeros', 'np.zeros', (['(2 * 3 * (nnode + nline) + 2 * tf_lines + 2 * 2 * vr_lines, 1)'], {'dtype': 'float'}), '((2 * 3 * (nnode + nline) + 2 * tf_lines + 2 * 2 * vr_lines, 1),\n dtype=float)\n', (1784, 1865), True, 'import numpy as np\n'), ((3627, 3716), 'numpy.zeros', 'np.zeros', (['(6, 2 * 3... |
from typing import List, Tuple
import numpy as np
from l5kit.data import ChunkedDataset
from l5kit.data.filter import (filter_agents_by_frames, filter_agents_by_labels, filter_tl_faces_by_frames,
filter_tl_faces_by_status)
from l5kit.data.labels import PERCEPTION_LABELS
from l5kit.data.... | [
"l5kit.rasterization.semantic_rasterizer.indices_in_bounds",
"numpy.eye",
"l5kit.data.filter.filter_agents_by_frames",
"numpy.hstack",
"l5kit.visualization.visualizer.common.EgoVisualization",
"l5kit.rasterization.box_rasterizer.get_ego_as_agent",
"l5kit.data.filter.filter_tl_faces_by_status",
"numpy.... | [((4222, 4290), 'l5kit.rasterization.semantic_rasterizer.indices_in_bounds', 'indices_in_bounds', (['ego_xy', "mapAPI.bounds_info['lanes']['bounds']", '(50)'], {}), "(ego_xy, mapAPI.bounds_info['lanes']['bounds'], 50)\n", (4239, 4290), False, 'from l5kit.rasterization.semantic_rasterizer import indices_in_bounds\n'), (... |
# Implementation of the Gaborfilter
# https://en.wikipedia.org/wiki/Gabor_filter
import numpy as np
from cv2 import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filter2D, imread, imshow, waitKey
def gabor_filter_kernel(
ksize: int, sigma: int, theta: int, lambd: int, gamma: int, psi: int
) -> np.ndarray:
"""
:param... | [
"cv2.filter2D",
"cv2.imshow",
"numpy.exp",
"numpy.zeros",
"cv2.waitKey",
"doctest.testmod",
"numpy.cos",
"cv2.cvtColor",
"numpy.sin",
"cv2.imread"
] | [((1158, 1200), 'numpy.zeros', 'np.zeros', (['(ksize, ksize)'], {'dtype': 'np.float32'}), '((ksize, ksize), dtype=np.float32)\n', (1166, 1200), True, 'import numpy as np\n'), ((1937, 1954), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (1952, 1954), False, 'import doctest\n'), ((1991, 2023), 'cv2.imread', 'im... |
"""This example simulates the start-up behavior of the squirrel cage induction motor connected to
an ideal three-phase grid. The state and action space is continuous.
Running the example will create a formatted plot that show the motor's angular velocity, the drive torque,
the applied voltage in three-phase abc-coordin... | [
"matplotlib.pyplot.grid",
"gym_electric_motor.make",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.tick_params",
"numpy.append",
"numpy.array",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.yticks",
"n... | [((1312, 1398), 'gym_electric_motor.make', 'gem.make', (['"""AbcCont-CC-SCIM-v0"""'], {'ode_solver': '"""scipy.ode"""', 'constraints': '()', 'tau': '(1e-05)'}), "('AbcCont-CC-SCIM-v0', ode_solver='scipy.ode', constraints=(), tau=\n 1e-05)\n", (1320, 1398), True, 'import gym_electric_motor as gem\n'), ((2085, 2098), ... |
"""generator.py
Created by <NAME>, <NAME>.
Copyright (c) NREL. All rights reserved.
Electromagnetic design based on conventional magnetic circuit laws
Structural design based on McDonald's thesis """
import numpy as np
import openmdao.api as om
import wisdem.drivetrainse.generator_models as gm
# -------------------... | [
"numpy.deg2rad",
"numpy.zeros",
"openmdao.api.ExecComp"
] | [((6801, 6812), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (6809, 6812), True, 'import numpy as np\n'), ((18493, 18563), 'openmdao.api.ExecComp', 'om.ExecComp', (['"""v = 0.5*E/G - 1.0"""'], {'E': "{'units': 'Pa'}", 'G': "{'units': 'Pa'}"}), "('v = 0.5*E/G - 1.0', E={'units': 'Pa'}, G={'units': 'Pa'})\n", (1850... |
from flask import Flask, current_app, request, send_file, Response
import json
import io
import base64
import numpy as np
import tensorflow as tf
from PIL import Image
import cv2
from scipy.spatial import distance
import scipy.misc
from keras.preprocessing import image
from Model.bone_variational_auto_encoder import cr... | [
"keras.preprocessing.image.img_to_array",
"Model.bone_variational_auto_encoder.create_variational_bone_auto_encoder",
"PIL.Image.open",
"flask.Flask",
"json.dumps",
"io.BytesIO",
"base64.b64decode",
"numpy.array",
"numpy.empty",
"numpy.expand_dims"
] | [((647, 713), 'Model.bone_variational_auto_encoder.create_variational_bone_auto_encoder', 'create_variational_bone_auto_encoder', ([], {'dims': 'img_dim', 'latent_dim': '(128)'}), '(dims=img_dim, latent_dim=128)\n', (683, 713), False, 'from Model.bone_variational_auto_encoder import create_variational_bone_auto_encoder... |
"""
Plot graph structures
---------------------
This functions show how to plot graph structures, such as the transition matrix.
"""
import cellrank as cr
import numpy as np
adata = cr.datasets.pancreas_preprocessed("../example.h5ad")
adata
# %%
# First, we create a forward transition matrix using the high-level ... | [
"numpy.where",
"cellrank.tl.transition_matrix",
"cellrank.datasets.pancreas_preprocessed",
"cellrank.pl.graph"
] | [((186, 238), 'cellrank.datasets.pancreas_preprocessed', 'cr.datasets.pancreas_preprocessed', (['"""../example.h5ad"""'], {}), "('../example.h5ad')\n", (219, 238), True, 'import cellrank as cr\n'), ((330, 433), 'cellrank.tl.transition_matrix', 'cr.tl.transition_matrix', (['adata'], {'show_progress_bar': '(False)', 'wei... |
#!/usr/local/bin/python
"""
vector to matrix
"""
from __future__ import print_function
from __future__ import division
import sys
import argparse
import subprocess
import shlex
import logging
import itertools
import time
import gzip
import re
import os
import math
import uuid
import socket
from datetime import datet... | [
"logging.basicConfig",
"numpy.float",
"argparse.ArgumentParser",
"gzip.open",
"time.strftime",
"os.path.realpath",
"datetime.datetime.now",
"numpy.zeros",
"numpy.array",
"os.path.isfile",
"os.path.basename",
"sys.exit",
"re.sub",
"socket.gethostname"
] | [((630, 788), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""convert 1 or 2 vectors into a matrix (TXT - matrix.gz)"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'convert 1 or 2 vectors into a matrix (TXT - matrix.gz)',\n formatter_class=argpa... |
#!/usr/bin/env python
# wujian@2020
"""
Compute directional/angle feature using steer vector (based on array geometry)
"""
import argparse
import numpy as np
from libs.data_handler import SpectrogramReader, ArchiveWriter, ScpReader
from libs.opts import StftParser
from libs.spatial import directional_feats
from lib... | [
"libs.data_handler.ScpReader",
"argparse.ArgumentParser",
"libs.data_handler.ArchiveWriter",
"libs.spatial.directional_feats",
"numpy.stack",
"libs.utils.get_logger",
"numpy.load",
"libs.data_handler.SpectrogramReader"
] | [((356, 376), 'libs.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (366, 376), False, 'from libs.utils import get_logger\n'), ((699, 745), 'libs.data_handler.SpectrogramReader', 'SpectrogramReader', (['args.wav_scp'], {}), '(args.wav_scp, **stft_kwargs)\n', (716, 745), False, 'from libs.data_handl... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
# import tensorflow.keras
from tensorflow.keras.utils import to_categorical
import numpy as np
import os
import random
import scipy.io as sio
import tqdm
STEP = 256
def data_generator(batch_size, ... | [
"numpy.mean",
"json.loads",
"numpy.fromfile",
"random.shuffle",
"numpy.hstack",
"tqdm.tqdm",
"os.path.splitext",
"scipy.io.loadmat",
"numpy.std",
"numpy.load"
] | [((586, 609), 'random.shuffle', 'random.shuffle', (['batches'], {}), '(batches)\n', (600, 609), False, 'import random\n'), ((2617, 2629), 'numpy.hstack', 'np.hstack', (['x'], {}), '(x)\n', (2626, 2629), True, 'import numpy as np\n'), ((2866, 2881), 'tqdm.tqdm', 'tqdm.tqdm', (['data'], {}), '(data)\n', (2875, 2881), Fal... |
import json
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
import sentencepiece as spm
from .import FairseqDataset
from .fairseq_dataset import TAG_DICT
from .indexed_dataset import IndexedRawTextDataset
from .collaters import Seq2SeqCollater
class TaggedDataset(IndexedRawTextDatas... | [
"sentencepiece.decode",
"numpy.array",
"sentencepiece.SentencePieceProcessor",
"json.load"
] | [((2590, 2666), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {'model_file': '"""../../../data/wmtchat2020/spm.model"""'}), "(model_file='../../../data/wmtchat2020/spm.model')\n", (2616, 2666), True, 'import sentencepiece as spm\n'), ((1680, 1704), 'numpy.array', 'np.array', (['self.src_siz... |
# Lint as: python3
"""
Main module to run the algorithms.
"""
import os
import atexit
import csv
import itertools
import multiprocessing
import socket
import random
import time
import psutil
# absl needs to be upgraded to >= 0.10.0, otherwise joblib might not work
from absl import app
from absl import flags
import nu... | [
"csv.DictWriter",
"multiprocessing.cpu_count",
"time.sleep",
"absl.flags.DEFINE_list",
"itertools.product",
"optimal_stopping.run.write_figures.write_figures",
"absl.app.run",
"telegram_notifications.send_bot_message.send_notification",
"numpy.random.seed",
"socket.gethostname",
"atexit.register... | [((1372, 1399), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1397, 1399), False, 'import multiprocessing\n'), ((1657, 1721), 'absl.flags.DEFINE_list', 'flags.DEFINE_list', (['"""nb_stocks"""', 'None', '"""List of number of Stocks"""'], {}), "('nb_stocks', None, 'List of number of Stocks'... |
#!/usr/bin/env python3
"""Categorical Feature Encoding Challengeの実験用コード。"""
import pathlib
import numpy as np
import pandas as pd
import sklearn.metrics
import pytoolkit as tk
nfold = 5
params = {
"objective": "binary",
"metric": "auc",
"learning_rate": 0.01,
"nthread": -1,
# "verbosity": -1,
... | [
"pandas.read_csv",
"pathlib.Path",
"pytoolkit.preprocessing.encode_cyclic",
"pytoolkit.data.Dataset",
"pytoolkit.validation.split",
"pytoolkit.log.get",
"pytoolkit.preprocessing.encode_ordinal",
"pytoolkit.preprocessing.FeaturesEncoder",
"pandas.DataFrame",
"pytoolkit.cli.App",
"pytoolkit.prepro... | [((541, 583), 'pathlib.Path', 'pathlib.Path', (['"""data/kaggle_cat-in-the-dat"""'], {}), "('data/kaggle_cat-in-the-dat')\n", (553, 583), False, 'import pathlib\n'), ((657, 690), 'pytoolkit.cli.App', 'tk.cli.App', ([], {'output_dir': 'models_dir'}), '(output_dir=models_dir)\n', (667, 690), True, 'import pytoolkit as tk... |
import os
import pickle
import numpy as np
import torch
from loguru import logger
from tqdm import tqdm
def make_adj_list(N, edge_index_transposed):
A = np.eye(N)
for edge in edge_index_transposed:
A[edge[0], edge[1]] = 1
adj_list = A != 0
return adj_list
def make_adj_list_wrapper(x):
r... | [
"os.path.exists",
"numpy.eye",
"pickle.dump",
"loguru.logger.debug",
"loguru.logger.info",
"tqdm.tqdm",
"pickle.load"
] | [((160, 169), 'numpy.eye', 'np.eye', (['N'], {}), '(N)\n', (166, 169), True, 'import numpy as np\n'), ((437, 478), 'tqdm.tqdm', 'tqdm', (['data', '"""adjacency list"""'], {'leave': '(False)'}), "(data, 'adjacency list', leave=False)\n", (441, 478), False, 'from tqdm import tqdm\n'), ((902, 927), 'os.path.exists', 'os.p... |
import json
import math
import os
import tempfile
from os import remove
from os.path import isfile
import numpy as np
import pandas as pd
from pandapower.auxiliary import _add_ppc_options, _add_opf_options, _add_auxiliary_elements
from pandapower.build_branch import _calc_line_parameter
from pandapower.pd2ppc import ... | [
"logging.getLogger",
"pandapower.pd2ppc._pd2ppc",
"numpy.allclose",
"json.dump",
"pandapower.results.init_results",
"math.radians",
"os.path.isfile",
"numpy.array",
"numpy.zeros",
"pandapower.build_branch._calc_line_parameter",
"tempfile.gettempdir",
"pandas.item",
"tempfile._get_candidate_n... | [((3286, 3313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3303, 3313), False, 'import logging\n'), ((2754, 3025), 'pandapower.auxiliary._add_opf_options', '_add_opf_options', (['net'], {'trafo_loading': '"""power"""', 'ac': 'ac', 'init': '"""flat"""', 'numba': '(True)', 'pp_to_pm_ca... |
from tfcgp.config import Config
from tfcgp.chromosome import Chromosome
from tfcgp.classifier import Classifier
from tfcgp.problem import Problem
import numpy as np
import tensorflow as tf
from sklearn import datasets
c = Config()
c.update("cfg/test.yaml")
data = datasets.load_iris()
p = Problem(data.data, data.targ... | [
"sklearn.datasets.load_iris",
"numpy.copy",
"tfcgp.chromosome.Chromosome",
"tfcgp.config.Config",
"numpy.any",
"tfcgp.classifier.Classifier",
"tfcgp.problem.Problem",
"numpy.all"
] | [((223, 231), 'tfcgp.config.Config', 'Config', ([], {}), '()\n', (229, 231), False, 'from tfcgp.config import Config\n'), ((266, 286), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (284, 286), False, 'from sklearn import datasets\n'), ((292, 323), 'tfcgp.problem.Problem', 'Problem', (['data.data... |
#!/usr/bin/env python
import numpy,genutil
import unittest
class GENUTIL(unittest.TestCase):
def assertArraysEqual(self,A,B):
self.assertTrue(numpy.all(numpy.equal(A,B)))
def testStatisticsNumpy(self):
a=numpy.ones((15,25),'d')
rk = [0.0, 91.66666666666667, 87.5, 83.33333333333333, 79.... | [
"numpy.equal",
"numpy.ones",
"genutil.statistics.rank",
"genutil.statistics.variance"
] | [((230, 255), 'numpy.ones', 'numpy.ones', (['(15, 25)', '"""d"""'], {}), "((15, 25), 'd')\n", (240, 255), False, 'import numpy, genutil\n'), ((707, 741), 'genutil.statistics.rank', 'genutil.statistics.rank', (['a'], {'axis': '(1)'}), '(a, axis=1)\n', (730, 741), False, 'import numpy, genutil\n'), ((166, 183), 'numpy.eq... |
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from os import path, listdir
import os
import pickle as pkl
import argparse
import re
import numpy as np
import xgboost as xgb
from scipy.special import expit
from util... | [
"os.path.exists",
"argparse.ArgumentParser",
"numpy.hstack",
"os.makedirs",
"os.path.join",
"numpy.random.seed"
] | [((332, 351), 'numpy.random.seed', 'np.random.seed', (['(998)'], {}), '(998)\n', (346, 351), True, 'import numpy as np\n'), ((983, 1016), 'numpy.hstack', 'np.hstack', (['(X_train, X_train_ext)'], {}), '((X_train, X_train_ext))\n', (992, 1016), True, 'import numpy as np\n'), ((1026, 1057), 'numpy.hstack', 'np.hstack', (... |
import numpy as np
import os.path
class IdentityMetadata():
def __init__(self, base, name, file):
# dataset base directory
self.base = base
# identity name
self.name = name
# image file name
self.file = file
def __repr__(self):
return self.image_path()
... | [
"numpy.array"
] | [((828, 846), 'numpy.array', 'np.array', (['metadata'], {}), '(metadata)\n', (836, 846), True, 'import numpy as np\n')] |
"""performs procrustes analysis on the two embeddings given, calculates distance between them, returns values as a pandas dataframe. Can also return a procrustes analysis figure for you (if clade membership is given, it will be colored by that"""
import argparse
from augur.utils import read_node_data
from augur.utils i... | [
"augur.utils.write_json",
"numpy.mean",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.where",
"pandas.merge",
"augur.utils.read_node_data",
"seaborn.catplot",
"matplotlib.collections.LineCollection",
"numpy.sum",
"matplotlib.pyplot.subplots",
"numpy.std",
... | [((618, 643), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (641, 643), False, 'import argparse\n'), ((2148, 2179), 'pandas.read_csv', 'pd.read_csv', (['args.embeddings[0]'], {}), '(args.embeddings[0])\n', (2159, 2179), True, 'import pandas as pd\n'), ((2201, 2232), 'pandas.read_csv', 'pd.read... |
import numpy as np
import tensorflow as tf
from basic_nn import Linear
def mse(y_pred, y_true):
return tf.reduce_mean((y_pred - y_true)**2)
if __name__ == "__main__":
f = np.asarray([[1, 1],[2, 1], [3, 1], [4, 1], [5, 1]], dtype=float)
t = np.asarray([[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]], dtype=float)... | [
"basic_nn.Linear",
"tensorflow.placeholder",
"tensorflow.Session",
"numpy.asarray",
"tensorflow.global_variables_initializer",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.reduce_mean"
] | [((108, 146), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['((y_pred - y_true) ** 2)'], {}), '((y_pred - y_true) ** 2)\n', (122, 146), True, 'import tensorflow as tf\n'), ((181, 246), 'numpy.asarray', 'np.asarray', (['[[1, 1], [2, 1], [3, 1], [4, 1], [5, 1]]'], {'dtype': 'float'}), '([[1, 1], [2, 1], [3, 1], [4, 1], [... |
import numpy as np
import numba as nb
import scrtbp.exceptions as exceptions
from scrtbp.taylor import expansion
from scrtbp.taylor import steppers
from scrtbp.util import root
def generate_event_observer(StepperClass, FuncAdapter, one_way_mode=True):
if one_way_mode:
# only - to + roots are detected
... | [
"scrtbp.util.root.Brackets",
"scrtbp.taylor.expansion.generate_taylor_expansion",
"scrtbp.taylor.steppers.generate_step_limter_proxy",
"scrtbp.taylor.steppers.generate_fixed_stepper",
"numba.njit",
"scrtbp.util.root.solve",
"numba.jitclass",
"numpy.empty",
"scrtbp.taylor.steppers.generate_adaptive_s... | [((553, 579), 'numba.njit', 'nb.njit', (['py_root_condition'], {}), '(py_root_condition)\n', (560, 579), True, 'import numba as nb\n'), ((829, 861), 'numba.jitclass', 'nb.jitclass', (['event_observer_spec'], {}), '(event_observer_spec)\n', (840, 861), True, 'import numba as nb\n'), ((2702, 2778), 'scrtbp.taylor.expansi... |
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015 - 2017
# Cambridge University Engineering Department Dialogue Systems Grou... | [
"numpy.multiply",
"Queue.PriorityQueue",
"numpy.log10",
"theano.tensor.sum",
"numpy.random.multinomial",
"numpy.argsort",
"theano.tensor.arange",
"numpy.zeros",
"numpy.dot",
"numpy.random.uniform",
"theano.tensor.set_subtensor",
"theano.tensor.tanh",
"numpy.concatenate",
"operator.itemgett... | [((3864, 3909), 'theano.tensor.set_subtensor', 'T.set_subtensor', (['hot_x[idx_x[:cutoff_x]]', '(1.0)'], {}), '(hot_x[idx_x[:cutoff_x]], 1.0)\n', (3879, 3909), True, 'import theano.tensor as T\n'), ((5150, 5183), 'theano.tensor.nnet.sigmoid', 'T.nnet.sigmoid', (['self.Wemb[w_t, :]'], {}), '(self.Wemb[w_t, :])\n', (5164... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import unittest
import numpy as np
from pymatgen.io.lammps.output import LammpsRun, LammpsLog, LammpsDump
_... | [
"pymatgen.io.lammps.output.LammpsLog",
"numpy.testing.assert_array_almost_equal",
"pymatgen.io.lammps.output.LammpsRun.from_dict",
"numpy.arange",
"os.path.join",
"os.path.dirname",
"pymatgen.io.lammps.output.LammpsRun",
"numpy.testing.assert_almost_equal",
"pymatgen.io.lammps.output.LammpsLog.from_... | [((388, 413), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (403, 413), False, 'import os\n'), ((4580, 4595), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4593, 4595), False, 'import unittest\n'), ((906, 978), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['at... |
# -*- coding:utf-8 -*-
# author:平手友梨奈ii
# e-mail:<EMAIL>
# datetime:1993/12/01
# filename:configs.py
# software: PyCharm
import numpy as np
import tensorflow as tf
import keras.backend as K
from keras.layers import Input, Lambda
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks impo... | [
"utils.utils.get_random_mosaic_data",
"time.sleep",
"numpy.array",
"utils.utils.get_random_data",
"tensorflow.Session",
"keras.backend.clear_session",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"numpy.random.seed",
"tensorflow.ConfigProto",
"numpy.maximum",
"keras.optimizers.Adam",... | [((12705, 12721), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (12719, 12721), True, 'import tensorflow as tf\n'), ((5218, 5255), 'numpy.array', 'np.array', (['true_boxes'], {'dtype': '"""float32"""'}), "(true_boxes, dtype='float32')\n", (5226, 5255), True, 'import numpy as np\n'), ((5274, 5310), 'nump... |
# Copyright (c) 2021 <NAME>
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import cv2
class InputPipeLine:
"""
InputPipeLine : this class starts capturing video from camera and resizes the frames
to... | [
"torch.as_tensor",
"cv2.resize",
"numpy.transpose",
"cv2.VideoCapture"
] | [((746, 765), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (762, 765), False, 'import cv2\n'), ((1933, 1991), 'cv2.resize', 'cv2.resize', (['frame', '(self.target_width, self.target_height)'], {}), '(frame, (self.target_width, self.target_height))\n', (1943, 1991), False, 'import cv2\n'), ((2017, 204... |
import numpy as np
try:
import cupy as cp
except:
cp = np
#CupyScalars = NumpyScalars
import pytissueoptics.vectors as vc
class NativeScalars:
""" An array of scalars that is compatible with operations on Vectors
There is a reason for not using numpy.array directly: we want to
add new functi... | [
"numpy.random.rand",
"numpy.equal",
"cupy.subtract",
"numpy.array",
"cupy.equal",
"cupy.negative",
"cupy.full",
"cupy.true_divide",
"numpy.multiply",
"cupy.random.rand",
"numpy.random.random",
"numpy.asarray",
"numpy.subtract",
"cupy.multiply",
"cupy.asarray",
"numpy.add",
"cupy.add"... | [((658, 673), 'numpy.array', 'np.array', (['array'], {}), '(array)\n', (666, 673), True, 'import numpy as np\n'), ((4508, 4527), 'numpy.negative', 'np.negative', (['self.v'], {}), '(self.v)\n', (4519, 4527), True, 'import numpy as np\n'), ((4764, 4789), 'numpy.equal', 'np.equal', (['self.v', 'other.v'], {}), '(self.v, ... |
import numpy as np
from matplotlib.colors import ListedColormap
import matplotlib.pyplot as plt
def plot_surface(X, y, clf, title="", xlabel="", ylabel=""):
x_min, x_max = X.min(), X.max()
xx, yy = np.meshgrid(np.linspace(x_min[0], x_max[0], num=50),
np.linspace(x_min[1], x_max[1], num=50))
if hasattr(clf,... | [
"matplotlib.colors.ListedColormap",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((514, 526), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (524, 526), True, 'import matplotlib.pyplot as plt\n'), ((875, 885), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (883, 885), True, 'import matplotlib.pyplot as plt\n'), ((214, 253), 'numpy.linspace', 'np.linspace', (['x_min[0]', 'x_ma... |
import time
import numpy as np
import tensorflow as tf
import awesome_gans.image_utils as iu
import awesome_gans.segan.segan_model as segan
from awesome_gans.datasets import MNISTDataSet
results = {'output': './gen_img/', 'checkpoint': './model/checkpoint', 'model': './model/SEGAN-model.ckpt'}
train_step = {
'g... | [
"awesome_gans.segan.segan_model.SEGAN",
"numpy.reshape",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"numpy.zeros",
"awesome_gans.datasets.MNISTDataSet",
"numpy.random.uniform",
"tensorflow.ConfigProto",
"awesome_gans.image_utils.save_images",
"time.time"
] | [((404, 415), 'time.time', 'time.time', ([], {}), '()\n', (413, 415), False, 'import time\n'), ((533, 549), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (547, 549), True, 'import tensorflow as tf\n'), ((479, 493), 'awesome_gans.datasets.MNISTDataSet', 'MNISTDataSet', ([], {}), '()\n', (491, 493), False... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.