code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python '''rapper for the SGP4 propagator ''' #Python standard import from copy import copy #Third party import import numpy as np from astropy.time import Time import scipy.optimize import pyorb import sgp4 from sgp4.api import Satrec, SGP4_ERRORS import sgp4.earth_gravity #Local import from .base ...
[ "numpy.radians", "sgp4.api.Satrec", "numpy.degrees", "sgp4.api.Satrec.twoline2rv", "astropy.time.Time", "pyorb.true_to_mean", "numpy.zeros", "copy.copy", "numpy.empty", "numpy.isnan", "pyorb.cart_to_kep", "numpy.linalg.norm", "pyorb.mean_to_true", "pyorb.kep_to_cart", "numpy.squeeze", ...
[((821, 854), 'copy.copy', 'copy', (['Propagator.DEFAULT_SETTINGS'], {}), '(Propagator.DEFAULT_SETTINGS)\n', (825, 854), False, 'from copy import copy\n'), ((1759, 1800), 'sgp4.api.Satrec.twoline2rv', 'Satrec.twoline2rv', (['line1', 'line2', 'grav_ind'], {}), '(line1, line2, grav_ind)\n', (1776, 1800), False, 'from sgp...
import numpy as np import pandas as pd import glob from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img from keras.callbacks import Callback import cv2 import PIL from operator import itemgetter import keras.backend as K import tensorflow as tf import os import errno import ran...
[ "numpy.arctan2", "pandas.read_csv", "random.shuffle", "keras.preprocessing.image.img_to_array", "gc.collect", "cv2.ellipse", "numpy.mean", "glob.glob", "multiprocessing.cpu_count", "numpy.copy", "cv2.imwrite", "multiprocessing.sharedctypes.RawArray", "keras.preprocessing.image.load_img", "...
[((1354, 1453), 'cv2.ellipse', 'cv2.ellipse', (['img', 'center', 'axes', '(-angle)', 'startAngle', 'endAngle', 'color', 'thickness', 'lineType', 'shift'], {}), '(img, center, axes, -angle, startAngle, endAngle, color,\n thickness, lineType, shift)\n', (1365, 1453), False, 'import cv2\n'), ((7396, 7432), 'numpy.zeros...
#!/usr/bin/python import os import numpy as np import pickle import matplotlib.pyplot as plt def R_Precision(remainders, candidates): count = 0 for (nodeID, value) in candidates: if nodeID in remainders: count += 1 return float(count) / float(len(remainders)) def nDCG(remainders, candidates): dcg = 0.0 ma...
[ "os.getcwd", "numpy.log2", "os.listdir" ]
[((1951, 1977), 'os.listdir', 'os.listdir', (['evaluation_dir'], {}), '(evaluation_dir)\n', (1961, 1977), False, 'import os\n'), ((411, 421), 'numpy.log2', 'np.log2', (['i'], {}), '(i)\n', (418, 421), True, 'import numpy as np\n'), ((516, 526), 'numpy.log2', 'np.log2', (['i'], {}), '(i)\n', (523, 526), True, 'import nu...
# Define Recommender class to predict strains from user input. # Imports import basilica from joblib import load import numpy as np import os class Suggester(): """ Generate five strain suggestions from user input. """ def __init__(self): self.scaler = load('assets/scaler.pkl') self.p...
[ "numpy.stack", "joblib.load", "os.getenv", "basilica.Connection" ]
[((280, 305), 'joblib.load', 'load', (['"""assets/scaler.pkl"""'], {}), "('assets/scaler.pkl')\n", (284, 305), False, 'from joblib import load\n'), ((325, 349), 'joblib.load', 'load', (['"""assets/pcaer.pkl"""'], {}), "('assets/pcaer.pkl')\n", (329, 349), False, 'from joblib import load\n'), ((376, 400), 'joblib.load',...
#!/usr/bin/env python3 import sys import shlex import os import subprocess import numpy as np args = sys.argv del args[0] new_args = ["xcrun"] is_just_c_not_cpp = True for arg in sys.argv: if arg.endswith(".cpp") or arg.endswith(".cxx") or arg.endswith(".cc"): is_just_c_not_cpp = False for arg in sys.a...
[ "shlex.join", "numpy.get_include", "os.system" ]
[((1236, 1256), 'shlex.join', 'shlex.join', (['new_args'], {}), '(new_args)\n', (1246, 1256), False, 'import shlex\n'), ((1266, 1284), 'os.system', 'os.system', (['command'], {}), '(command)\n', (1275, 1284), False, 'import os\n'), ((529, 545), 'numpy.get_include', 'np.get_include', ([], {}), '()\n', (543, 545), True, ...
import numpy as np from copy import deepcopy from utils import * from relabel import * import cv2 import torch from copy import deepcopy from torch import nn, optim from models import SSResNet # from models import basic_cnn device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") print(device) ########...
[ "numpy.concatenate", "numpy.random.get_state", "torch.nn.CrossEntropyLoss", "numpy.zeros", "torch.cat", "numpy.random.set_state", "torch.save", "cv2.imread", "torch.cuda.is_available", "torch.max", "models.SSResNet.ResNet", "torch.cuda.empty_cache", "torch.no_grad", "numpy.random.shuffle",...
[((14474, 14495), 'numpy.random.get_state', 'np.random.get_state', ([], {}), '()\n', (14493, 14495), True, 'import numpy as np\n'), ((14496, 14529), 'numpy.random.shuffle', 'np.random.shuffle', (['LOO_train_data'], {}), '(LOO_train_data)\n', (14513, 14529), True, 'import numpy as np\n'), ((14530, 14556), 'numpy.random....
import os import numpy as np from gym import spaces import vrep from envs.GoalDrivenEnv import GoalDrivenEnv from envs.VrepEnv import check_for_errors, catch_errors dir_path = os.getcwd() cube_lower = np.array([0.15, (-0.35), 0.025]) cube_upper = np.array([0.45, (-0.65), 0.5]) max_displacement = 0.03 # 3cm clas...
[ "vrep.simxSetObjectPosition", "envs.VrepEnv.check_for_errors", "vrep.simxGetObjectPosition", "vrep.simxGetObjectHandle", "os.getcwd", "vrep.simxGetObjectOrientation", "numpy.append", "vrep.simxSetObjectOrientation", "numpy.array", "numpy.linalg.norm", "numpy.all" ]
[((179, 190), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (188, 190), False, 'import os\n'), ((205, 235), 'numpy.array', 'np.array', (['[0.15, -0.35, 0.025]'], {}), '([0.15, -0.35, 0.025])\n', (213, 235), True, 'import numpy as np\n'), ((251, 279), 'numpy.array', 'np.array', (['[0.45, -0.65, 0.5]'], {}), '([0.45, -0.65...
# -*- coding: utf-8 -*- """Plot FWHM for the provided intensity file. Author: <NAME>, BNL Date: 2016-08-24 """ import os import matplotlib.pyplot as plt import numpy as np PICS_DIR = 'pics' def get_width(dat_file, y_idx='middle', plot=True, variate_steps=0, show=False, suffix='', axis='y'): list_2d, x, y = pre...
[ "os.mkdir", "matplotlib.pyplot.clf", "matplotlib.pyplot.figure", "matplotlib.pyplot.axvline", "numpy.copy", "matplotlib.pyplot.close", "matplotlib.pyplot.cla", "numpy.loadtxt", "numpy.linspace", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyp...
[((3495, 3542), 'numpy.linspace', 'np.linspace', (['x_range[0]', 'x_range[1]', 'x_range[2]'], {}), '(x_range[0], x_range[1], x_range[2])\n', (3506, 3542), True, 'import numpy as np\n'), ((3551, 3598), 'numpy.linspace', 'np.linspace', (['y_range[0]', 'y_range[1]', 'y_range[2]'], {}), '(y_range[0], y_range[1], y_range[2]...
import numpy as np from utils.logging import get_stats import logging class EpsGreedy: def __init__(self, args): self.epsilon_start = args.epsilon_start self.epsilon_finish = args.epsilon_finish self.epsilon_time_length = args.epsilon_time_length self.num_actions = args.num_acti...
[ "numpy.random.random", "numpy.random.randint", "logging.getLogger", "utils.logging.get_stats" ]
[((345, 356), 'utils.logging.get_stats', 'get_stats', ([], {}), '()\n', (354, 356), False, 'from utils.logging import get_stats\n'), ((379, 409), 'logging.getLogger', 'logging.getLogger', (['"""EpsGreedy"""'], {}), "('EpsGreedy')\n", (396, 409), False, 'import logging\n'), ((859, 877), 'numpy.random.random', 'np.random...
import numpy as np from . import confusion class AggregatedConfusion(confusion.Confusion): """ Class to aggregate multiple confusions. Attributes: instances (dict): Dictionary containing the aggregated confusions. """ def __init__(self): self.instances = {} @property de...
[ "numpy.mean" ]
[((1051, 1072), 'numpy.mean', 'np.mean', (['per_instance'], {}), '(per_instance)\n', (1058, 1072), True, 'import numpy as np\n'), ((1259, 1280), 'numpy.mean', 'np.mean', (['per_instance'], {}), '(per_instance)\n', (1266, 1280), True, 'import numpy as np\n')]
import numpy as np import pickle from homework4.problem_4 import sample_train_dt from homework4.problem_4 import plot_dt_mLeaf if __name__ == "__main__": X = np.genfromtxt('data/X_train.txt', delimiter=None) Y = np.genfromtxt('data/Y_train.txt', delimiter=None)[:, np.newaxis] raw_data = np.concatenate((X, ...
[ "pickle.dump", "numpy.genfromtxt", "homework4.problem_4.sample_train_dt", "numpy.concatenate", "homework4.problem_4.plot_dt_mLeaf" ]
[((163, 212), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/X_train.txt"""'], {'delimiter': 'None'}), "('data/X_train.txt', delimiter=None)\n", (176, 212), True, 'import numpy as np\n'), ((301, 331), 'numpy.concatenate', 'np.concatenate', (['(X, Y)'], {'axis': '(1)'}), '((X, Y), axis=1)\n', (315, 331), True, 'import ...
## Pandas的axis参数怎么理解? """ * axis=0或者"index": - 如果是单行操作,就指的是某一行 - 如果是聚合操作,指的是跨行cross rows * axis=1或者"columns": - 如果是单列操作,就指的是某一列 - 如果是聚合操作,指的是跨列cross columns ***按哪个axis,就是这个axis要动起来(类似被for遍历),其它的axis保持不动*** """ import pandas as pd import numpy as np df = pd.DataFrame( np.arange(12).reshape(3,4), c...
[ "numpy.arange" ]
[((287, 300), 'numpy.arange', 'np.arange', (['(12)'], {}), '(12)\n', (296, 300), True, 'import numpy as np\n')]
from core.models import TemporalData import numpy as np import os class WaveForm: def __init__(self, x: list[float] = [], y: list[float] = []): self.x = x self.y = y def set(self, x: list[float], y: list[float]) -> None: self.x = x self.y = y def push(self...
[ "numpy.array", "numpy.ones" ]
[((851, 867), 'numpy.array', 'np.array', (['self.x'], {}), '(self.x)\n', (859, 867), True, 'import numpy as np\n'), ((1275, 1285), 'numpy.ones', 'np.ones', (['w'], {}), '(w)\n', (1282, 1285), True, 'import numpy as np\n')]
import numpy as np import unittest from Bio.Seq import Seq from scipy.sparse import csr_matrix from strkernel.gappy_kernel import gappypair_kernel as gk from unittest import TestCase class Test_Gappy_Kernel(TestCase): def test_gappy_kernel(self): sequences = [Seq("ACGTCGATGC"), Seq("GTCGATAGC"), Seq("GTC...
[ "Bio.Seq.Seq", "numpy.zeros", "scipy.sparse.csr_matrix", "numpy.array", "numpy.array_equal", "strkernel.gappy_kernel.gappypair_kernel" ]
[((357, 419), 'strkernel.gappy_kernel.gappypair_kernel', 'gk', (['sequences'], {'k': '(1)', 't': '(0)', 'g': '(1)', 'gapDifferent': '(False)', 'sparse': '(False)'}), '(sequences, k=1, t=0, g=1, gapDifferent=False, sparse=False)\n', (359, 419), True, 'from strkernel.gappy_kernel import gappypair_kernel as gk\n'), ((440,...
import glob from functools import partial import numpy as np from fire import Fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from dataset import ParsingDataset, UdPOS, WikiAnnNER from model import DependencyParser, Tagger from util import default_collate de...
[ "functools.partial", "tqdm.tqdm", "fire.Fire", "torch.utils.data.DataLoader", "transformers.AutoTokenizer.from_pretrained", "numpy.array", "glob.glob" ]
[((1769, 1804), 'glob.glob', 'glob.glob', (['filepath'], {'recursive': '(True)'}), '(filepath, recursive=True)\n', (1778, 1804), False, 'import glob\n'), ((2335, 2373), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['encoder'], {}), '(encoder)\n', (2364, 2373), False, 'from transformer...
import math import numpy as np import h5py import matplotlib.pyplot as plt import tensorflow as tf # print(tf.__version__) from tensorflow.python.framework import ops from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict y_hat = tf.constant(36, name="y_hat") y = tf.constant(39, name="y") ...
[ "tensorflow.contrib.layers.xavier_initializer", "numpy.random.seed", "tensorflow.nn.sigmoid_cross_entropy_with_logits", "tensorflow.train.AdamOptimizer", "tensorflow.multiply", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.python.framework.ops.reset_default_graph", "tf_utils.convert_to_one...
[((260, 289), 'tensorflow.constant', 'tf.constant', (['(36)'], {'name': '"""y_hat"""'}), "(36, name='y_hat')\n", (271, 289), True, 'import tensorflow as tf\n'), ((294, 319), 'tensorflow.constant', 'tf.constant', (['(39)'], {'name': '"""y"""'}), "(39, name='y')\n", (305, 319), True, 'import tensorflow as tf\n'), ((328, ...
#! /usr/bin/env python import sys import argparse import cv2 import numpy from time import sleep import os import csv class LaserTracker(object): def __init__(self, cam_width=640, cam_height=480, hue_min=20, hue_max=160, sat_min=100, sat_max=255, val_min=200, val_max=256, display...
[ "csv.reader", "argparse.ArgumentParser", "cv2.bitwise_and", "cv2.imshow", "cv2.cvtColor", "cv2.namedWindow", "cv2.split", "cv2.moveWindow", "cv2.circle", "cv2.bitwise_not", "cv2.minEnclosingCircle", "cv2.waitKey", "subprocess.call", "cv2.resizeWindow", "cv2.merge", "sys.exit", "cv2.t...
[((13524, 13584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run the Laser Tracker"""'}), "(description='Run the Laser Tracker')\n", (13547, 13584), False, 'import argparse\n'), ((1922, 1984), 'numpy.zeros', 'numpy.zeros', (['(self.cam_height, self.cam_width, 3)', 'numpy.uint8'], {})...
# Compatibility Python 2/3 from __future__ import division, print_function, absolute_import from builtins import range # ---------------------------------------------------------------------------------------------------------------------- import numpy as np from dotmap import DotMap import matplotlib.pyplot as plt im...
[ "numpy.sum", "matplotlib.pyplot.gca", "numpy.empty", "logging.warning", "logging.info", "dotmap.DotMap", "matplotlib.pyplot.figure", "numpy.array", "numpy.arange", "multiprocessing.Pool", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "opto.data.save", "logging.getLogger" ]
[((435, 462), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (452, 462), False, 'import logging\n'), ((609, 617), 'dotmap.DotMap', 'DotMap', ([], {}), '()\n', (615, 617), False, 'from dotmap import DotMap\n'), ((1071, 1097), 'numpy.array', 'np.array', (['self.repetitions'], {}), '(self.re...
#!/usr/bin/env python3 #! -*- coding: utf-8 -*- import cv2 import numpy as np def green_extraction(img): BGR_min = np.array([0, 0, 0]) BGR_max = np.array([60, 255, 128]) img_mask = cv2.inRange(img, BGR_min, BGR_max) green_img = cv2.bitwise_and(img, img, mask = img_mask) return green_img d...
[ "cv2.bitwise_and", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread", "numpy.array", "cv2.imshow", "cv2.inRange" ]
[((126, 145), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (134, 145), True, 'import numpy as np\n'), ((160, 184), 'numpy.array', 'np.array', (['[60, 255, 128]'], {}), '([60, 255, 128])\n', (168, 184), True, 'import numpy as np\n'), ((201, 235), 'cv2.inRange', 'cv2.inRange', (['img', 'BGR_min', 'BGR...
#!/usr/bin/env python3 # coding=UTF-8 # # BSD 2-Clause License # # Copyright (c) 2019, <NAME> # 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 ...
[ "argparse.ArgumentParser", "csv.writer", "Row.Row", "numpy.zeros", "math.floor", "tkinter.filedialog.askopenfilename", "os.path.splitext", "os.exit", "os.path.split", "os.path.join", "tkinter.Tk" ]
[((1962, 1989), 'os.path.join', 'os.path.join', (['path', 'newName'], {}), '(path, newName)\n', (1974, 1989), False, 'import os\n'), ((2839, 2857), 'numpy.zeros', 'np.zeros', (['(count,)'], {}), '((count,))\n', (2847, 2857), True, 'import numpy as np\n'), ((2875, 2893), 'numpy.zeros', 'np.zeros', (['(count,)'], {}), '(...
""" An example to show how to combine an airfoil_generator and XFOIL. """ from airfoil_generators.naca4series import NACA4 from xfoil.xfoil import oper_visc_cl import os import matplotlib.pyplot as plt import numpy as np # Operating point Re = 1000000 Cl = .4 drags = np.zeros((5, 3)) # m is camber in percent, p is...
[ "matplotlib.pyplot.pcolor", "os.remove", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.yticks", "numpy.zeros", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.xticks", "airfoil_generators.naca4series.NACA4", "xfoil.xfoil.oper_visc_cl", "matplotlib.pyplot.ylabel", "mat...
[((272, 288), 'numpy.zeros', 'np.zeros', (['(5, 3)'], {}), '((5, 3))\n', (280, 288), True, 'import numpy as np\n'), ((1423, 1462), 'matplotlib.pyplot.pcolor', 'plt.pcolor', (['drags'], {'cmap': 'plt.cm.coolwarm'}), '(drags, cmap=plt.cm.coolwarm)\n', (1433, 1462), True, 'import matplotlib.pyplot as plt\n'), ((1558, 1599...
import numpy as np a=np.logspace(1.0,2.0,num=10)#默认底数是10 b=np.logspace(0,9,10,base=2)#将对数的底数设置为2 print(a) print(b)
[ "numpy.logspace" ]
[((21, 50), 'numpy.logspace', 'np.logspace', (['(1.0)', '(2.0)'], {'num': '(10)'}), '(1.0, 2.0, num=10)\n', (32, 50), True, 'import numpy as np\n'), ((59, 88), 'numpy.logspace', 'np.logspace', (['(0)', '(9)', '(10)'], {'base': '(2)'}), '(0, 9, 10, base=2)\n', (70, 88), True, 'import numpy as np\n')]
import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchvision.models.resnet import resnet18 from torchvision.models.vgg import vgg19 import utils.platform_manager as platform_manager from models.backbones.resnet import ResNet_Backbone from models.base_net import ...
[ "numpy.stack", "torch.ones", "random.randint", "torch.nn.functional.grid_sample", "torch.cat", "models.decoders.epcdepth_rsu.RSUDecoder", "random.random", "models.backbones.resnet.ResNet_Backbone", "torch.randperm", "torch.nn.functional.interpolate", "torch.matmul", "torch.from_numpy" ]
[((1384, 1479), 'models.decoders.epcdepth_rsu.RSUDecoder', 'RSUDecoder', ([], {'num_output_channels': '(1)', 'use_encoder_disp': '(True)', 'encoder_layer_channels': 'num_ch_enc'}), '(num_output_channels=1, use_encoder_disp=True,\n encoder_layer_channels=num_ch_enc)\n', (1394, 1479), False, 'from models.decoders.epcd...
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import cv2 import math from scipy import ndimage """ Contains all the classes necessary for students to easily build a TensorFlow model """ class MNIST(tf.keras.models.Sequential): """ Sequential model to classify digits from the MNIST d...
[ "numpy.sum", "numpy.invert", "numpy.argmax", "tensorflow.keras.layers.Dense", "cv2.warpAffine", "numpy.lib.pad", "numpy.round", "tensorflow.keras.layers.Flatten", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "tensorflow.nn.softmax", "matplotlib.pyplot.imshow", "cv2.resize", "matp...
[((489, 552), 'tensorflow.keras.losses.SparseCategoricalCrossentropy', 'tf.keras.losses.SparseCategoricalCrossentropy', ([], {'from_logits': '(True)'}), '(from_logits=True)\n', (534, 552), True, 'import tensorflow as tf\n'), ((799, 834), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ...
''' Projection onto the l1-Simplex Project a given vector onto the l1-Simplex with minimal shift measured by the l2-norm. Example: proj_vec = proj_l1_simplex(vec, l1_simplex_boundary) REFERENCE ---------- <NAME>, Efficient Projections onto the l1-Ball for Learning in High Dimensions. ''' import numpy as...
[ "numpy.sort", "numpy.where", "numpy.maximum" ]
[((1038, 1064), 'numpy.maximum', 'np.maximum', (['(vec - theta)', '(0)'], {}), '(vec - theta, 0)\n', (1048, 1064), True, 'import numpy as np\n'), ((761, 773), 'numpy.sort', 'np.sort', (['vec'], {}), '(vec)\n', (768, 773), True, 'import numpy as np\n'), ((923, 948), 'numpy.where', 'np.where', (['(vec_shifted > 0)'], {})...
from __future__ import print_function import lime import sklearn import numpy as np import sklearn import sklearn.ensemble import sklearn.metrics from sklearn import model_selection, naive_bayes, svm import numpy as np import random from keras.models import Sequential, Model from keras.layers import Dense,GlobalMaxPool...
[ "pandas.read_csv", "keras.callbacks.ModelCheckpoint", "keras.preprocessing.sequence.pad_sequences", "keras.layers.Dropout", "keras.layers.CuDNNLSTM", "keras.utils.np_utils.to_categorical", "keras.preprocessing.text.Tokenizer", "numpy.array", "keras.layers.Embedding", "nltk.corpus.stopwords.words",...
[((1537, 1563), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (1552, 1563), False, 'from nltk.corpus import stopwords\n'), ((1714, 1792), 'pandas.read_csv', 'pd.read_csv', (['"""../input/big-dataset-btp/train_total.csv"""'], {'error_bad_lines': '(False)'}), "('../input/big-...
# -*- coding: utf-8 -*- #MIT License #Copyright (c) 2017 <NAME> #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, mod...
[ "numpy.random.seed", "random.shuffle", "keras.backend.set_image_dim_ordering", "gc.collect", "tensorflow.ConfigProto", "keras.regularizers.l1_l2", "keras.optimizers.SGD", "os.path.dirname", "keras.layers.Flatten", "tensorflow.set_random_seed", "keras.layers.MaxPooling1D", "random.seed", "ten...
[((6000, 6030), 'keras.backend.set_image_dim_ordering', 'k.set_image_dim_ordering', (['"""tf"""'], {}), "('tf')\n", (6024, 6030), True, 'from keras import backend as k\n'), ((6295, 6330), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['args.randomSeed'], {}), '(args.randomSeed)\n', (6313, 6330), True, 'import te...
import unittest, numpy as np from cdmft.operators.hubbard import Site, Plaquette, PlaquetteMomentum, PlaquetteMomentumNambu, TriangleMomentum, TriangleSpinOrbitCoupling class TestHubbard(unittest.TestCase): def test_HubbardSite(self): h = Site(3, ["up", "dn"]) h_int = h.get_h_int() def test...
[ "cdmft.operators.hubbard.TriangleMomentum", "cdmft.operators.hubbard.PlaquetteMomentumNambu", "cdmft.operators.hubbard.Plaquette", "cdmft.operators.hubbard.TriangleSpinOrbitCoupling", "cdmft.operators.hubbard.PlaquetteMomentum", "numpy.array", "numpy.sqrt", "cdmft.operators.hubbard.Site" ]
[((255, 276), 'cdmft.operators.hubbard.Site', 'Site', (['(3)', "['up', 'dn']"], {}), "(3, ['up', 'dn'])\n", (259, 276), False, 'from cdmft.operators.hubbard import Site, Plaquette, PlaquetteMomentum, PlaquetteMomentumNambu, TriangleMomentum, TriangleSpinOrbitCoupling\n'), ((357, 383), 'cdmft.operators.hubbard.Plaquette...
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: train.py import matplotlib matplotlib.use('Agg') import os import argparse import cv2 import shutil import itertools import tqdm import math import numpy as np import json import tensorflow as tf import zipfile import pickle import six from glob import glob from te...
[ "argparse.ArgumentParser", "numpy.argmax", "numpy.arange", "numpy.exp", "tensorpack.utils.utils.get_tqdm_kwargs", "tensorpack.tfutils.optimizer.AccumGradOptimizer", "os.path.join", "tensorflow.get_variable", "pandas.DataFrame", "tensorflow.nn.softmax", "numpy.zeros_like", "tensorflow.add_n", ...
[((81, 102), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (95, 102), False, 'import matplotlib\n'), ((1675, 1691), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (1688, 1691), True, 'import numpy as np\n'), ((1734, 1758), 'numpy.where', 'np.where', (['cond', 'x', 'zeros'], {}), '(co...
import numpy as np import time import field_ops as fo Engine = fo.Engine2 Expression = fo.Expression print('\n\n--- Testing Basic Evaluations ---\n') n = 10 engine = Engine() B = engine.empty([3,3], [n,n,n], name='B') B[:] = 1.0 C = engine.empty([3,3], [n,n,n], name='C') C[:] = 2.0 D = engine.zeros([3,3], [n,n,n]) D[...
[ "field_ops.tan", "numpy.sum", "numpy.abs", "numpy.arctan2", "field_ops.sum", "numpy.allclose", "field_ops.cos", "numpy.zeros", "numpy.arcsin", "time.time", "numpy.sin", "numpy.tan", "numpy.cos", "field_ops.sin", "field_ops.arctan2", "field_ops.arcsin" ]
[((335, 346), 'time.time', 'time.time', ([], {}), '()\n', (344, 346), False, 'import time\n'), ((538, 549), 'time.time', 'time.time', ([], {}), '()\n', (547, 549), False, 'import time\n'), ((742, 753), 'time.time', 'time.time', ([], {}), '()\n', (751, 753), False, 'import time\n'), ((1036, 1047), 'time.time', 'time.tim...
from gym import Env from gym.spaces import Box import numpy as np import robosuite as suite from railrl.core.serializeable import Serializable class RobosuiteStateWrapperEnv(Serializable, Env): def __init__(self, wrapped_env_id, observation_keys=('robot-state', 'object-state'), **wrapped_env_kwargs): Seri...
[ "gym.spaces.Box", "numpy.ones", "robosuite.make" ]
[((384, 432), 'robosuite.make', 'suite.make', (['wrapped_env_id'], {}), '(wrapped_env_id, **wrapped_env_kwargs)\n', (394, 432), True, 'import robosuite as suite\n'), ((495, 588), 'gym.spaces.Box', 'Box', (['self._wrapped_env.action_spec[0]', 'self._wrapped_env.action_spec[1]'], {'dtype': 'np.float32'}), '(self._wrapped...
# encode=utf-8 """ 一维数组 """ import numpy as np ndarry = np.array([[35, 20, 66], [23, 67, 89], [13, 244, 67]], np.int32) print(ndarry.shape, ndarry.size) print(ndarry.dtype) print(ndarry[1:2, 1:2]) import pandas as pd stocks = pd.Series([20.1, 100.0, 66.5], index=['tx', 'tobao', 'apple']) stocks2 = pd.Series([23...
[ "numpy.array", "pandas.Series" ]
[((58, 121), 'numpy.array', 'np.array', (['[[35, 20, 66], [23, 67, 89], [13, 244, 67]]', 'np.int32'], {}), '([[35, 20, 66], [23, 67, 89], [13, 244, 67]], np.int32)\n', (66, 121), True, 'import numpy as np\n'), ((233, 295), 'pandas.Series', 'pd.Series', (['[20.1, 100.0, 66.5]'], {'index': "['tx', 'tobao', 'apple']"}), "...
import pytest import numpy as np from sigpyproc.io import bits class Testlibcpp(object): def test_unpackbits(self): input_arr = np.array([0, 2, 7, 23], dtype=np.uint8) expected_bit1 = np.array( [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, ...
[ "numpy.testing.assert_array_equal", "numpy.empty", "sigpyproc.io.bits.unpack", "numpy.array", "numpy.arange", "pytest.mark.parametrize" ]
[((824, 867), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nbits"""', '[1, 2, 4]'], {}), "('nbits', [1, 2, 4])\n", (847, 867), False, 'import pytest\n'), ((1079, 1122), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nbits"""', '[1, 2, 4]'], {}), "('nbits', [1, 2, 4])\n", (1102, 1122), False,...
import numpy as np from absl import flags import os import matplotlib.pyplot as plt import cv2 FLAGS = flags.FLAGS # Flag names are globally defined! So in general, we need to be # careful to pick names that are unlikely to be used by other libraries. # If there is a conflict, we'll get an error at import time. flags...
[ "os.mkdir", "matplotlib.pyplot.show", "numpy.sum", "os.path.isdir", "numpy.empty", "matplotlib.pyplot.imshow", "numpy.ptp", "cv2.imwrite", "absl.flags.DEFINE_string", "cv2.imread", "numpy.min", "numpy.mean", "numpy.array", "numpy.nonzero", "numpy.arange", "numpy.where", "os.listdir",...
[((315, 368), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset"""', 'None', '"""dataset name."""'], {}), "('dataset', None, 'dataset name.')\n", (334, 368), False, 'from absl import flags\n'), ((796, 812), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (806, 812), False, 'import os\n'), ((830, ...
import re import numpy as np from src.easy_vasp.helper_funcs import * class WtIn: def __init__(self, file_path): self.file_path = file_path self.nk1 = None self.slab_segments = None self.slab_nkpts = None self._parse() def _parse(self): with open(self.file_path,...
[ "numpy.array", "re.match" ]
[((1826, 1843), 'numpy.array', 'np.array', (['dat_mat'], {}), '(dat_mat)\n', (1834, 1843), True, 'import numpy as np\n'), ((495, 520), 're.match', 're.match', (['nk1_regex', 'line'], {}), '(nk1_regex, line)\n', (503, 520), False, 'import re\n'), ((559, 594), 're.match', 're.match', (['slab_segments_regex', 'line'], {})...
import pandas as pd import numpy as np from glob import glob import os import processor._senti_process as senti_process #change it to the address where the file is located in your computer #os.chdir('C:\\Users\\wenca\\Desktop\\GitRepo\\Twitter-Analysis-With-Earning-Event\\') class TwitterDict: """This is the dic...
[ "pandas.read_csv", "numpy.append", "processor._senti_process.SentiProcess", "glob.glob" ]
[((431, 468), 'pandas.read_csv', 'pd.read_csv', (['"""dictionary\\\\MyDict.csv"""'], {}), "('dictionary\\\\MyDict.csv')\n", (442, 468), True, 'import pandas as pd\n'), ((1520, 1555), 'glob.glob', 'glob', (['f"""{keyword_path}*{key_word}*"""'], {}), "(f'{keyword_path}*{key_word}*')\n", (1524, 1555), False, 'from glob im...
import numpy as np import os from imageio import imread from imageio import imwrite from sklearn.decomposition import PCA # import pandas as pd # reads the first image from each folder and create a 2D array with each column per image # return: 2D arrays with images data def read_images(): fac...
[ "imageio.imread", "os.walk", "numpy.ones", "numpy.linalg.eig", "numpy.mean", "sklearn.decomposition.PCA", "numpy.reshape", "numpy.cov", "os.path.join", "numpy.delete" ]
[((324, 355), 'numpy.ones', 'np.ones', (['(108000, 1)'], {'dtype': 'int'}), '((108000, 1), dtype=int)\n', (331, 355), True, 'import numpy as np\n'), ((386, 420), 'os.walk', 'os.walk', (['"""faces94\\\\"""'], {'topdown': '(True)'}), "('faces94\\\\', topdown=True)\n", (393, 420), False, 'import os\n'), ((653, 674), 'nump...
############################################################# # Este modelo es una simple red neuronal con una capa oculta # que tiene el mismo número de neuronas que de datos de entrada, # es decir, 784 neuronas. Estas neuronas utilizan una función de # activación rectificador. Una funciónd de activación softma...
[ "pandas.DataFrame", "numpy.random.seed", "keras.datasets.mnist.load_data", "keras.utils.np_utils.to_categorical", "keras.layers.Dense", "keras.models.Sequential" ]
[((783, 806), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed)\n', (800, 806), False, 'import numpy\n'), ((895, 912), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (910, 912), False, 'from keras.datasets import mnist\n'), ((1282, 1314), 'keras.utils.np_utils.to_categorical', 'n...
import rospy from styx_msgs.msg import TrafficLight import tensorflow as tf from os.path import join import numpy as np import cv2, time import os class TLClassifier(object): def __init__(self): # Loading TF Model model_path = join(os.getcwd(),'../../final_mobilenet_frozen_sim/frozen_inference_grap...
[ "cv2.GaussianBlur", "cv2.HoughCircles", "os.getcwd", "cv2.cvtColor", "tensorflow.Session", "numpy.expand_dims", "cv2.addWeighted", "rospy.loginfo", "numpy.array", "tensorflow.gfile.GFile", "tensorflow.Graph", "numpy.squeeze", "tensorflow.import_graph_def", "tensorflow.GraphDef", "cv2.inR...
[((430, 440), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (438, 440), True, 'import tensorflow as tf\n'), ((744, 785), 'rospy.loginfo', 'rospy.loginfo', (['"""[CSChen] loaded model.pb"""'], {}), "('[CSChen] loaded model.pb')\n", (757, 785), False, 'import rospy\n'), ((1368, 1401), 'tensorflow.Session', 'tf.Sessio...
import numpy as np from wolf_agent import WoLFAgent from matrix_game_local_only import MatrixGame_local from matrix_game_mec_only import MatrixGame_mec from matrix_game import MatrixGame from queue_relay import QueueRelay import matplotlib.pyplot as plt from gpd import GPD ## TLIU from dataToExcel import DTE ...
[ "matplotlib.pyplot.show", "dataToExcel.DTE", "matplotlib.pyplot.plot", "gpd.GPD", "queue_relay.QueueRelay", "matplotlib.pyplot.legend", "matrix_game.MatrixGame", "numpy.zeros", "matrix_game_local_only.MatrixGame_local", "wolf_agent.WoLFAgent", "numpy.array", "numpy.arange", "matrix_game_mec_...
[((12736, 12778), 'numpy.array', 'np.array', (['[10, 15, 20, 25, 30, 35, 40, 45]'], {}), '([10, 15, 20, 25, 30, 35, 40, 45])\n', (12744, 12778), True, 'import numpy as np\n'), ((13517, 13594), 'matplotlib.pyplot.plot', 'plt.plot', (['usernumber', 'cost_of_all', '"""^-"""'], {'linewidth': '(0.4)', 'label': '"""all selec...
# Released under The MIT License (MIT) # http://opensource.org/licenses/MIT # Copyright (c) 2013-2016 SCoT Development Team """Principal component analysis (PCA) implementation.""" import numpy as np from .datatools import cat_trials def pca_svd(x): """Calculate PCA using SVD. Parameters ----------...
[ "numpy.std", "numpy.asarray", "numpy.argsort", "numpy.cumsum", "numpy.linalg.svd", "numpy.mean", "numpy.dot", "numpy.diag", "numpy.concatenate" ]
[((613, 650), 'numpy.linalg.svd', 'np.linalg.svd', (['x'], {'full_matrices': '(False)'}), '(x, full_matrices=False)\n', (626, 650), True, 'import numpy as np\n'), ((2454, 2467), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (2464, 2467), True, 'import numpy as np\n'), ((2690, 2715), 'numpy.std', 'np.std', (['x']...
#!/usr/bin/env python3 """ Compute the statistics of the dataset (train and CV set) and save it in a file named stats.npz. For speed and accuracy on large dataset, the algorithm follows https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm """ import os import argparse import numpy...
[ "numpy.zeros_like", "argparse.ArgumentParser", "numpy.zeros", "numpy.reshape", "os.path.join", "numpy.sqrt" ]
[((4015, 4076), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""generate lattice paths"""'}), "(description='generate lattice paths')\n", (4038, 4076), False, 'import argparse\n'), ((4741, 4781), 'os.path.join', 'os.path.join', (['args.dest_dir', '"""stats.npz"""'], {}), "(args.dest_dir, ...
import sys import hypothesis.extra.numpy as hnp import hypothesis.strategies as st import numpy as np import pytest from hypothesis import assume, given import mygrad as mg from mygrad.nnet.activations import glu from tests.wrappers.uber import backprop_test_factory, fwdprop_test_factory @pytest.mark.parametrize("a...
[ "numpy.log", "hypothesis.strategies.sampled_from", "pytest.raises", "numpy.exp", "mygrad.nnet.activations.glu", "pytest.mark.parametrize", "hypothesis.strategies.integers", "hypothesis.extra.numpy.array_shapes" ]
[((294, 339), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""axis"""', '(None, 1.0j)'], {}), "('axis', (None, 1.0j))\n", (317, 339), False, 'import pytest\n'), ((380, 404), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (393, 404), False, 'import pytest\n'), ((414, 431), 'mygrad.nn...
from numpy.testing import assert_almost_equal import pyart import summarystats.coveragearea def test_rain_coverage(): test_radar = pyart.io.read('../tests/data/corcsapr2cmacppiM1.c1.20181012.001503.nc') test_rain = summarystats.coveragearea.rain_coverage(test_radar) assert_almost_equal(test_rain, 11.2928...
[ "numpy.testing.assert_almost_equal", "pyart.io.read" ]
[((136, 207), 'pyart.io.read', 'pyart.io.read', (['"""../tests/data/corcsapr2cmacppiM1.c1.20181012.001503.nc"""'], {}), "('../tests/data/corcsapr2cmacppiM1.c1.20181012.001503.nc')\n", (149, 207), False, 'import pyart\n'), ((282, 333), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', (['test_rain', '(11.29287...
import graphviz import matplotlib.pyplot as plt import numpy import pandas from sklearn import metrics from sklearn.model_selection import train_test_split from sklearn import tree # Set some options for printing all the columns pandas.set_option('display.max_columns', None) pandas.set_option('display.ex...
[ "matplotlib.pyplot.title", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.tree.DecisionTreeClassifier", "matplotlib.pyplot.figure", "numpy.arange", "pandas.set_option", "numpy.unique", "numpy.append", "graphviz.Source", "pandas.concat", "matplotlib.pyplot.show", "skl...
[((241, 287), 'pandas.set_option', 'pandas.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (258, 287), False, 'import pandas\n'), ((291, 344), 'pandas.set_option', 'pandas.set_option', (['"""display.expand_frame_repr"""', '(False)'], {}), "('display.expand_frame_repr', False...
# -*- coding:utf-8 -*- # &Author AnFany # CART分类树:可处理连续、离散的变量,支持多分类 # 测试数据和训练数据的字段顺序必须一样,因为本程序在设定规则按的是字段的编号,而不是名字 # 引入数据 import DT_Classify_Data as dtda import copy import pandas as pd import numpy as np # 定义函数 class DT: def __init__(self, train_dtdata=dtda.dt_data, pre_dtdata=dtda.test_data, tr...
[ "matplotlib.pyplot.xlim", "copy.deepcopy", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((14243, 14263), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""树的初始深度"""'], {}), "('树的初始深度')\n", (14253, 14263), True, 'import matplotlib.pyplot as plt\n'), ((14269, 14284), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(1)', '(14)'], {}), '(1, 14)\n', (14277, 14284), True, 'import matplotlib.pyplot as plt\n'), ((14292, ...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # 设置画布 fig = plt.figure() # 设置3D坐标轴 ax = Axes3D(fig) # 创建数据集 X = np.arange(-4, 4, 0.25) Y = np.arange(-4, 4, 0.25) X, Y = np.meshgrid(X, Y) R = X + Y Z = np.sin(R) # 绘制3D图 # rstride/cstride:表示步伐大小,其越小超平面过渡越细致 ax.plot_surface(X,...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "mpl_toolkits.mplot3d.Axes3D", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange" ]
[((105, 117), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (115, 117), True, 'import matplotlib.pyplot as plt\n'), ((133, 144), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}), '(fig)\n', (139, 144), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((157, 179), 'numpy.arange', 'np.arange', (['...
import contextlib import json import pathlib from bluesky.callbacks.zmq import RemoteDispatcher from bluesky.callbacks import CallbackBase import numpy as np import toolz import WrightTools as wt class GenWT5(CallbackBase): def __init__(self): self.start_doc = None self.stop_doc = None se...
[ "WrightTools.kit.TimeStamp", "json.dump", "WrightTools.artists.quick2D", "WrightTools.Data", "numpy.unravel_index", "toolz.partition", "bluesky.callbacks.zmq.RemoteDispatcher", "pathlib.Path", "numpy.array", "contextlib.redirect_stdout", "numpy.linspace", "WrightTools.artists.quick1D" ]
[((11908, 11942), 'bluesky.callbacks.zmq.RemoteDispatcher', 'RemoteDispatcher', (['"""zmq-proxy:5568"""'], {}), "('zmq-proxy:5568')\n", (11924, 11942), False, 'from bluesky.callbacks.zmq import RemoteDispatcher\n'), ((624, 664), 'WrightTools.kit.TimeStamp', 'wt.kit.TimeStamp', (["self.start_doc['time']"], {}), "(self.s...
import torch import torch.fft import torchvision.transforms as transforms import numpy as np from scipy import interpolate from scipy import fftpack from scipy import integrate from scipy import signal from PIL import Image def flip(x): return x.flip([2,3]) def flip_torch(x): x_ = torch.flip(torch.roll(x, (...
[ "torch.fft.ifftn", "numpy.abs", "torch.roll", "numpy.imag", "numpy.exp", "torch.nn.functional.pad", "numpy.zeros_like", "numpy.meshgrid", "torch.nn.functional.avg_pool2d", "torchvision.transforms.ToPILImage", "numpy.linspace", "numpy.real", "torch.zeros", "torch.linspace", "numpy.roll", ...
[((391, 462), 'torch.roll', 'torch.roll', (['x_', '(-(x_.shape[2] // 2), -(x_.shape[3] // 2))'], {'dims': '(2, 3)'}), '(x_, (-(x_.shape[2] // 2), -(x_.shape[3] // 2)), dims=(2, 3))\n', (401, 462), False, 'import torch\n'), ((559, 622), 'numpy.roll', 'np.roll', (['x_', '(-(x_.shape[0] // 2), -(x_.shape[1] // 2))', '(0, ...
# Copyright (c) SenseTime. All Rights Reserved. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from pysot.core.config import cfg ...
[ "torch.argmax", "torch.arange", "pysot.models.head.get_mask_head", "pysot.models.loss.weight_feat_loss", "pysot.show.draw_rect", "pysot.models.backbone.get_backbone", "torch.exp", "torch.nn.functional.log_softmax", "numpy.hanning", "pysot.models.head.get_rpn_head", "pysot.models.loss.select_cros...
[((881, 935), 'pysot.models.backbone.get_backbone', 'get_backbone', (['cfg.BACKBONE.TYPE'], {}), '(cfg.BACKBONE.TYPE, **cfg.BACKBONE.KWARGS)\n', (893, 935), False, 'from pysot.models.backbone import get_backbone\n'), ((1665, 1709), 'pysot.models.head.get_rpn_head', 'get_rpn_head', (['cfg.RPN.TYPE'], {}), '(cfg.RPN.TYPE...
import numpy as np import logging, sys, json from keras.models import load_model from DataPreparation import Data_Preparation from sklearn.externals import joblib vectors_file='pickle_embeddings_SSWE_Basic_Keras_w_CNTK.tsv' trainedModelFile="evaluation_SSWE_GBM" trainedModel = None mem_after_init = None la...
[ "DataPreparation.Data_Preparation", "keras.models.load_model", "sklearn.externals.joblib.load", "numpy.argmax" ]
[((523, 553), 'DataPreparation.Data_Preparation', 'Data_Preparation', (['vectors_file'], {}), '(vectors_file)\n', (539, 553), False, 'from DataPreparation import Data_Preparation\n'), ((1255, 1285), 'numpy.argmax', 'np.argmax', (['predictions'], {'axis': '(1)'}), '(predictions, axis=1)\n', (1264, 1285), True, 'import n...
#!/bin/bash # -*- coding: UTF-8 -*- import sys import numpy as np import PyQt5 # 基本控件都在这里面 from PyQt5.QtWidgets import (QApplication, QMainWindow, QDesktopWidget, QStyleFactory, QWidget, QSizePolicy, QPushButton, QGridLayout) from PyQt5.QtGui import QPalette, QColor from PyQt5.QtCore imp...
[ "matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.setSizePolicy", "PyQt5.QtCore.QTimer", "PyQt5.QtWidgets.QDesktopWidget", "PyQt5.QtWidgets.QGridLayout", "matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.updateGeometry", "matplotlib.figure.Figure", "numpy.sin", "matplotlib.backends.backend_qt5...
[((4678, 4700), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4690, 4700), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QDesktopWidget, QStyleFactory, QWidget, QSizePolicy, QPushButton, QGridLayout\n'), ((768, 808), 'matplotlib.figure.Figure', 'Figure', ([], {'fi...
import numpy as np from neural_network import Network from matplotlib import pyplot as plt m = 100 X = np.linspace(0, 1, m).reshape((m, 1)) y = np.array([np.exp(-np.sin(4 * np.pi * xx ** 3)) for xx in X]).reshape((m, 1)) N = 1 n = 1 nn = Network([n, 8, N], [None, 'sigmoid', 'identity'], [True, True, False], ...
[ "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "numpy.random.randint", "numpy.sin", "numpy.linspace", "neural_network.Network" ]
[((240, 364), 'neural_network.Network', 'Network', (['[n, 8, N]', "[None, 'sigmoid', 'identity']", '[True, True, False]'], {'layer_weight_means_and_stds': '[(0, 0.1), (0, 0.1)]'}), "([n, 8, N], [None, 'sigmoid', 'identity'], [True, True, False],\n layer_weight_means_and_stds=[(0, 0.1), (0, 0.1)])\n", (247, 364), Fal...
from unittest import TestCase import numpy as np from uncertainty_wizard import ProblemType from uncertainty_wizard.quantifiers import QuantifierRegistry, VariationRatio class TestVariationRatio(TestCase): # ================= # Test Class Methods # ================= def test_string_representation(...
[ "uncertainty_wizard.quantifiers.VariationRatio.is_confidence", "uncertainty_wizard.quantifiers.QuantifierRegistry.find", "uncertainty_wizard.quantifiers.VariationRatio.calculate", "uncertainty_wizard.quantifiers.VariationRatio.takes_samples", "numpy.array", "uncertainty_wizard.quantifiers.VariationRatio",...
[((1142, 1230), 'numpy.array', 'np.array', (['[[[0.1, 0.8, 0.08, 0.02], [0.2, 0.7, 0.08, 0.02], [0.5, 0.4, 0.08, 0.02]]]'], {}), '([[[0.1, 0.8, 0.08, 0.02], [0.2, 0.7, 0.08, 0.02], [0.5, 0.4, 0.08,\n 0.02]]])\n', (1150, 1230), True, 'import numpy as np\n'), ((1275, 1315), 'uncertainty_wizard.quantifiers.VariationRat...
''' Implementation of n-step SARS Algorithm to find optimal policy for the FrozenLake environment ''' import multiprocessing as mp from itertools import chain, product import gym import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import mean_squared_error from tqdm import tqdm import dill def t...
[ "numpy.sum", "numpy.argmax", "matplotlib.pyplot.figure", "numpy.random.randint", "multiprocessing.cpu_count", "matplotlib.colors.Normalize", "matplotlib.patches.Rectangle", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "numpy.max", "itertools.product", "matplotlib.pyplot.xticks", "...
[((709, 741), 'numpy.chararray', 'np.chararray', (['dims'], {'unicode': '(True)'}), '(dims, unicode=True)\n', (721, 741), True, 'import numpy as np\n'), ((1161, 1173), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1171, 1173), True, 'import matplotlib.pyplot as plt\n'), ((1263, 1277), 'numpy.zeros', 'np....
import numpy as np import scipy import matplotlib.pyplot as plt from sklearn.datasets import load_digits """ CNN with 2 CNN layer and one Fully connected layer """ df = load_digits() filter1 = np.random.random(9) filter1 = filter1.reshape(9,1) bias1 = np.random.random(1)[0] filter2 = np.random.random(9) fil...
[ "sklearn.datasets.load_digits", "numpy.zeros_like", "numpy.random.random", "numpy.array", "numpy.where", "numpy.exp" ]
[((179, 192), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (190, 192), False, 'from sklearn.datasets import load_digits\n'), ((204, 223), 'numpy.random.random', 'np.random.random', (['(9)'], {}), '(9)\n', (220, 223), True, 'import numpy as np\n'), ((297, 316), 'numpy.random.random', 'np.random.rando...
import numpy as np import numpy.random as npr import numpy.testing as nptest import unittest as ut from gray import ( right_shift, binary2gray, gray2binary, ) class TestRightShift(ut.TestCase): def test_basic_1d(self): x = np.ones(4) y = right_shift(x) t = np.array([0, 1, 1, 1]) ...
[ "gray.right_shift", "numpy.random.seed", "numpy.testing.assert_array_equal", "numpy.zeros", "numpy.ones", "gray.binary2gray", "numpy.array", "numpy.testing.assert_equal", "numpy.random.rand", "numpy.random.geometric", "gray.gray2binary" ]
[((252, 262), 'numpy.ones', 'np.ones', (['(4)'], {}), '(4)\n', (259, 262), True, 'import numpy as np\n'), ((271, 285), 'gray.right_shift', 'right_shift', (['x'], {}), '(x)\n', (282, 285), False, 'from gray import right_shift, binary2gray, gray2binary\n'), ((294, 316), 'numpy.array', 'np.array', (['[0, 1, 1, 1]'], {}), ...
import numpy as np import torch import torch.nn as nn import torchvision from torchvision import models from torch.autograd import Variable import math import pdb import torch.utils.model_zoo as model_zoo def calc_coeff(iter_num, high=1.0, low=0.0, alpha=10.0, max_iter=10000.0): return np.float(2.0 * (high - low) ...
[ "torch.nn.Dropout", "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.init.xavier_normal_", "torch.nn.init.zeros_", "torch.nn.init.normal_", "numpy.exp", "torch.nn.Linear", "torch.nn.init.kaiming_uniform_", "torch.nn.Sigmoid" ]
[((536, 570), 'torch.nn.init.kaiming_uniform_', 'nn.init.kaiming_uniform_', (['m.weight'], {}), '(m.weight)\n', (560, 570), True, 'import torch.nn as nn\n'), ((579, 601), 'torch.nn.init.zeros_', 'nn.init.zeros_', (['m.bias'], {}), '(m.bias)\n', (593, 601), True, 'import torch.nn as nn\n'), ((1681, 1811), 'torch.nn.Sequ...
import csv import math from collections import defaultdict, Counter import numpy as np from sklearn.preprocessing import OneHotEncoder from params import * from summarizer import process_file, Summarizer, file2text from translator import translate # turns .tsv file into list of lists def tsv2mat(fname): with op...
[ "csv.reader", "summarizer.process_file", "translator.translate", "sklearn.preprocessing.OneHotEncoder", "summarizer.file2text", "collections.defaultdict", "summarizer.Summarizer", "numpy.array", "numpy.logical_or", "collections.Counter", "math.log" ]
[((350, 379), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '"""\t"""'}), "(f, delimiter='\\t')\n", (360, 379), False, 'import csv\n'), ((1117, 1133), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (1128, 1133), False, 'from collections import defaultdict, Counter\n'), ((1594, 1605), 'numpy.arr...
"""utils.py """ import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import ( roc_curve, auc, f1_score, confusion_matrix, recall_score, precision_score ) from sklearn.model_selection import train_test_split from sklearn.datasets import load_digits import h5py def load_h5df(...
[ "sklearn.datasets.load_digits", "h5py.File", "matplotlib.pyplot.show", "sklearn.metrics.roc_curve", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.imshow", "sklearn.metrics.recall_score", "matplotlib.pyplot.axis", "sklearn.metrics.auc", "matplotlib.pyplot.figure", "sklearn.metric...
[((839, 866), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (849, 866), True, 'import matplotlib.pyplot as plt\n'), ((1090, 1108), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (1106, 1108), True, 'import matplotlib.pyplot as plt\n'), ((1113, 11...
import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestRegressor from hypoforest import random_forest_error n_samples = 200 rng = np.random.RandomState(123) X = rng.uniform(0, 20, n_samples).reshape(-1, 1) y = (2 * X + np.sqrt(10) * rng.randn(n_samples, 1)).ravel() forest = R...
[ "hypoforest.random_forest_error", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.random.RandomState", "sklearn.ensemble.RandomForestRegressor", "numpy.sqrt" ]
[((171, 197), 'numpy.random.RandomState', 'np.random.RandomState', (['(123)'], {}), '(123)\n', (192, 197), True, 'import numpy as np\n'), ((433, 569), 'hypoforest.random_forest_error', 'random_forest_error', (['forest', 'X', 'y'], {'X_test': 'X', 'n_fixed_points': '(50)', 'n_mc_samples': '(500)', 'use_built_trees': '(F...
import numpy as np class wnr(object): def __init__ (self,filename,ver): self.filename = filename self.ver = ver def writer(self): DataOut = np.column_stack(self.ver) np.savetxt(self.filename,DataOut) return ...
[ "numpy.savetxt", "numpy.loadtxt", "numpy.column_stack" ]
[((214, 239), 'numpy.column_stack', 'np.column_stack', (['self.ver'], {}), '(self.ver)\n', (229, 239), True, 'import numpy as np\n'), ((261, 295), 'numpy.savetxt', 'np.savetxt', (['self.filename', 'DataOut'], {}), '(self.filename, DataOut)\n', (271, 295), True, 'import numpy as np\n'), ((456, 507), 'numpy.loadtxt', 'np...
import numpy as np from perform.constants import REAL_TYPE from perform.rom.rom_method.projection_method.projection_method import ProjectionMethod class GalerkinProjection(ProjectionMethod): """Intrusive Galerkin projection. Galerkin projection is intrusive w/ numerical time integration, and targets the con...
[ "numpy.array", "numpy.zeros" ]
[((3798, 3837), 'numpy.zeros', 'np.zeros', (['lhs.shape[0]'], {'dtype': 'REAL_TYPE'}), '(lhs.shape[0], dtype=REAL_TYPE)\n', (3806, 3837), True, 'import numpy as np\n'), ((3616, 3665), 'numpy.array', 'np.array', (['(res_jacob @ scaled_decoder_jacob_concat)'], {}), '(res_jacob @ scaled_decoder_jacob_concat)\n', (3624, 36...
import numpy as np import scipy.misc import scipy.io import os # parameters in_dataset = '/media/data_cifs/pytorch_projects/datasets/BSDS500' out_datset = '/media/data_cifs/pytorch_projects/datasets/BSDS500_crops' img_size = [321, 481] crop_size = 320 for train_val in ['test_nocrop']: # ['train','test','test_nocrop']...
[ "numpy.asarray", "os.path.join", "os.listdir" ]
[((393, 492), 'os.path.join', 'os.path.join', (['in_dataset', '"""data"""', '"""images"""', "('test' if train_val is 'test_nocrop' else train_val)"], {}), "(in_dataset, 'data', 'images', 'test' if train_val is\n 'test_nocrop' else train_val)\n", (405, 492), False, 'import os\n'), ((502, 606), 'os.path.join', 'os.pat...
""" ASPIRE Image Class ================== This tutorial demonstrates some methods of the ASPIRE ``Image`` class """ import os import numpy as np from aspire.image import Image from aspire.operators import CTFFilter DATA_DIR = "data" img_data = np.load(os.path.join(DATA_DIR, "monuments.npy")) img_data.shape, img_da...
[ "aspire.image.Image", "numpy.array", "os.path.join", "aspire.operators.CTFFilter" ]
[((504, 537), 'aspire.image.Image', 'Image', (['img_data'], {'dtype': 'np.float64'}), '(img_data, dtype=np.float64)\n', (509, 537), False, 'from aspire.image import Image\n'), ((726, 745), 'numpy.array', 'np.array', (['[100, 30]'], {}), '([100, 30])\n', (734, 745), True, 'import numpy as np\n'), ((1141, 1209), 'aspire....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from lightgbm import LGBMClassifier from sklearn.model_selection import cross_val_score from skopt.space import Real, Integer from skopt.utils import use_named_args from skopt import gp_minimize import numpy as np from sklearn.datasets import make_multilabel_classificati...
[ "numpy.load", "lightgbm.LGBMClassifier", "skopt.gp_minimize", "warnings.filterwarnings", "skopt.utils.use_named_args", "skopt.space.Integer", "skopt.space.Real", "sklearn.metrics.make_scorer", "sklearn.multiclass.OneVsRestClassifier" ]
[((340, 373), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (363, 373), False, 'import warnings\n'), ((512, 550), 'numpy.load', 'np.load', (['"""../ProtsDataset/Train_y.npy"""'], {}), "('../ProtsDataset/Train_y.npy')\n", (519, 550), True, 'import numpy as np\n'), ((559, 5...
from pdb import set_trace as T from matplotlib import pyplot as plt import numpy as np import scipy.stats as stats import skvideo.io import sys, os import torch from torch import nn from visualize import visualize, visGANGAN from gan import SimpleGAN, DCGAN import data, utils class GANTrainer: def __init__(self,...
[ "numpy.save", "matplotlib.pyplot.show", "utils.count_parameters", "data.MNIST", "torch.randn", "matplotlib.pyplot.ion", "visualize.visGANGAN", "torch.Tensor", "torch.cuda.is_available", "numpy.linspace", "gan.SimpleGAN", "visualize.visualize", "utils.GANLoss", "data.GANLoader" ]
[((3587, 3619), 'data.GANLoader', 'data.GANLoader', (['(35)', '(100)', 'loaddir'], {}), '(35, 100, loaddir)\n', (3601, 3619), False, 'import data, utils\n'), ((3878, 3903), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3901, 3903), False, 'import torch\n'), ((687, 712), 'utils.GANLoss', 'util...
""" Trajectory transformations. """ import numpy as np class GAE: """ Generalized Advantage Estimator. See [Schulman et al., 2016](https://arxiv.org/abs/1506.02438) """ def __init__(self, policy, gamma=0.99, lambda_=0.95, normalize=None, epsilon=1e-8): self.policy = policy self.gamma =...
[ "numpy.zeros_like", "numpy.asarray", "numpy.take", "numpy.reshape", "numpy.squeeze" ]
[((1522, 1561), 'numpy.zeros_like', 'np.zeros_like', (['values'], {'dtype': 'np.float32'}), '(values, dtype=np.float32)\n', (1535, 1561), True, 'import numpy as np\n'), ((1488, 1510), 'numpy.squeeze', 'np.squeeze', (['values', '(-1)'], {}), '(values, -1)\n', (1498, 1510), True, 'import numpy as np\n'), ((1915, 1941), '...
#!/usr/bin/env python # coding: utf-8 # In[ ]: import numpy as np import pandas as pd import multiprocessing as mp import matplotlib as mpl import matplotlib.pyplot as plt import sys import os from scipy.integrate import odeint from scipy.sparse import csr_matrix, lil_matrix, dok_matrix, vstack, issparse from...
[ "os.mkdir", "numpy.random.seed", "numpy.ones", "numpy.random.randint", "numpy.arange", "numpy.round", "scipy.integrate.odeint", "numpy.random.poisson", "numpy.random.choice", "numpy.rollaxis", "numpy.random.shuffle", "numpy.random.binomial", "scipy.stats.multinomial.rvs", "scipy.sparse.csr...
[((1002, 1018), 'numpy.arange', 'np.arange', (['(T + 1)'], {}), '(T + 1)\n', (1011, 1018), True, 'import numpy as np\n'), ((12707, 12737), 'os.path.isdir', 'os.path.isdir', (['"""./sim_results"""'], {}), "('./sim_results')\n", (12720, 12737), False, 'import os\n'), ((12909, 12937), 'multiprocessing.Pool', 'mp.Pool', ([...
import numpy as np from plotly.subplots import make_subplots from utils.plot.general import add_model_comparison, confidence_ellipse, GRIDCOLOR def create_fig(meta, models, year: str, xrange=None, **kwargs): fig_CAV = make_subplots( 1, 2, horizontal_spacing=0.02, column_widths=[0.4...
[ "plotly.subplots.make_subplots", "utils.plot.general.confidence_ellipse", "utils.plot.general.add_model_comparison", "numpy.arange" ]
[((224, 398), 'plotly.subplots.make_subplots', 'make_subplots', (['(1)', '(2)'], {'horizontal_spacing': '(0.02)', 'column_widths': '[0.4, 0.6]', 'subplot_titles': "('<b>a.</b> Costs vs abatement<br> ', f'<b>b.</b> CAV per model ({year})<br> ')"}), "(1, 2, horizontal_spacing=0.02, column_widths=[0.4, 0.6],\n subplot_...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import itertools import pandas as pd import warnings from Bio.PDB.StructureBuilder import StructureBuilder from Bio.PDB import PDBIO from Bio.PDB import PDBParser from .layerClass import layerClass from .residueClass import residueClass from .chai...
[ "pandas.DataFrame", "Bio.PDB.StructureBuilder.StructureBuilder", "seaborn.set_style", "pandas.MultiIndex.from_tuples", "matplotlib.pyplot.show", "numpy.sum", "Bio.PDB.PDBIO", "numpy.arange", "Bio.PDB.PDBParser", "matplotlib.pyplot.subplots_adjust", "itertools.cycle", "warnings.warn", "matplo...
[((2727, 2745), 'Bio.PDB.StructureBuilder.StructureBuilder', 'StructureBuilder', ([], {}), '()\n', (2743, 2745), False, 'from Bio.PDB.StructureBuilder import StructureBuilder\n'), ((3104, 3111), 'Bio.PDB.PDBIO', 'PDBIO', ([], {}), '()\n', (3109, 3111), False, 'from Bio.PDB import PDBIO\n'), ((3418, 3429), 'Bio.PDB.PDBP...
import pytest import numpy as np import pandas as pd from floodlight.core.code import Code # Sample data for easy creation of core objects # XY @pytest.fixture() def example_xy_data_pos_int() -> np.ndarray: positions = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) return positions @pytest.fixture() def example_xy...
[ "numpy.array", "pytest.fixture", "pandas.DataFrame", "floodlight.core.code.Code" ]
[((148, 164), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (162, 164), False, 'import pytest\n'), ((289, 305), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (303, 305), False, 'import pytest\n'), ((451, 467), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (465, 467), False, 'import pytest\n'), (...
from typing import Dict, List, Optional import numpy as np from numpy import ndarray from emmental.metrics.pearson_correlation import pearson_correlation_scorer from emmental.metrics.spearman_correlation import spearman_correlation_scorer def pearson_spearman_scorer( golds: ndarray, probs: ndarray, pred...
[ "emmental.metrics.spearman_correlation.spearman_correlation_scorer", "numpy.mean", "emmental.metrics.pearson_correlation.pearson_correlation_scorer" ]
[((899, 952), 'emmental.metrics.pearson_correlation.pearson_correlation_scorer', 'pearson_correlation_scorer', (['golds', 'probs', 'preds', 'uids'], {}), '(golds, probs, preds, uids)\n', (925, 952), False, 'from emmental.metrics.pearson_correlation import pearson_correlation_scorer\n'), ((980, 1034), 'emmental.metrics....
"""Quantized activation functions.""" import copy from abc import ABC, abstractmethod from typing import Optional import numpy from .quantized_array import QuantizedArray class QuantizedActivation(ABC): """Base class for quantized activation function.""" q_out: Optional[QuantizedArray] def __init__(se...
[ "numpy.maximum", "numpy.rint", "copy.copy", "numpy.exp" ]
[((1863, 1884), 'copy.copy', 'copy.copy', (['self.q_out'], {}), '(self.q_out)\n', (1872, 1884), False, 'import copy\n'), ((2534, 2559), 'numpy.exp', 'numpy.exp', (['(-quant_sigmoid)'], {}), '(-quant_sigmoid)\n', (2543, 2559), False, 'import numpy\n'), ((2835, 2854), 'numpy.maximum', 'numpy.maximum', (['(0)', 'x'], {}),...
import caffe import numpy as np import cv2 from time import time import os from os.path import dirname first_it = True A = None def compute_map_features(ref_map_images): ref_map_images_features=[] alexnet_proto_path=os.path.join(dirname(__file__),"alexnet/deploy.prototxt") alexnet_weights=os.path.joi...
[ "cv2.equalizeHist", "numpy.random.seed", "numpy.copy", "numpy.random.randn", "cv2.cvtColor", "numpy.argmax", "os.path.dirname", "numpy.asarray", "caffe.io.Transformer", "numpy.amax", "numpy.linalg.norm", "numpy.reshape", "numpy.matmul", "numpy.dot", "caffe.Net", "cv2.resize" ]
[((389, 446), 'caffe.Net', 'caffe.Net', (['alexnet_proto_path', '(1)'], {'weights': 'alexnet_weights'}), '(alexnet_proto_path, 1, weights=alexnet_weights)\n', (398, 446), False, 'import caffe\n'), ((469, 517), 'caffe.io.Transformer', 'caffe.io.Transformer', (["{'data': (1, 3, 227, 227)}"], {}), "({'data': (1, 3, 227, 2...
# Simulates a homogeneous Poisson point process on a circle. # This code positions the points uniformly around a circle, which can be # achieved by either using polar coordinates or normal random variables. # Author: <NAME>, 2020. # Website: hpaulkeeler.com # Repository: github.com/hpaulkeeler/posts # For more details,...
[ "numpy.random.uniform", "matplotlib.pyplot.scatter", "matplotlib.pyplot.close", "matplotlib.pyplot.axis", "numpy.sin", "numpy.linalg.norm", "numpy.random.poisson", "numpy.random.normal", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((582, 598), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (591, 598), True, 'import matplotlib.pyplot as plt\n'), ((881, 921), 'numpy.random.poisson', 'np.random.poisson', (['(lambda0 * lengthTotal)'], {}), '(lambda0 * lengthTotal)\n', (898, 921), True, 'import numpy as np\n'), ((1288, 133...
import matplotlib.pyplot as plt import os import seaborn as sns from bld.project_paths import project_paths_join as ppj import numpy as np import pandas as pd # Modelling algorithms. from sklearn import tree from sklearn import linear_model from sklearn.metrics import mean_squared_error from sklearn.model_selection im...
[ "sklearn.model_selection.GridSearchCV", "bld.project_paths.project_paths_join", "sklearn.tree.DecisionTreeRegressor", "sklearn.model_selection.train_test_split", "sklearn.model_selection.cross_val_score", "src.model_code.module.RMSE", "sklearn.linear_model.LinearRegression", "sklearn.linear_model.Lass...
[((834, 887), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(7)'}), '(X, y, test_size=0.2, random_state=7)\n', (850, 887), False, 'from sklearn.model_selection import train_test_split, GridSearchCV, cross_validate, cross_val_score\n'), ((934, 965), ...
#!/usr/local/bin/env python # -*- coding: utf-8 -*- """ Description ----------- A set of tools to simplify the application constant salt-concentration molecular dynamics simulations. Authors ------- <NAME> """ import numpy as np from saltswap.swapper import Swapper import simtk.openmm as openmm import simtk.unit a...
[ "scipy.optimize.minimize", "numpy.sum", "simtk.openmm.CompoundIntegrator", "simtk.openmm.Context", "saltswap.integrators.GHMCIntegrator", "saltswap.swapper.Swapper", "numpy.floor", "numpy.zeros", "simtk.openmm.MonteCarloBarostat", "openmmtools.integrators.LangevinIntegrator", "saltswap.sams_adap...
[((891, 1241), 'numpy.array', 'np.array', (['[0.0, -318.05881688, -634.82257946, -950.86394367, -1266.40212151, -\n 1581.46300874, -1896.27363003, -2210.82650563, -2525.13639012, -\n 2839.31919345, -3153.29282184, -3467.08768458, -3780.72288485, -\n 4094.30848518, -4407.73750209, -4721.06504457, -5034.27217415...
#!/usr/bin/env python # -*- coding: UTF-8 -*- import time from keras.models import Sequential, Model from keras.layers import Dense, Input, Conv2D, MaxPooling2D, Flatten, Lambda from keras.regularizers import l2 from keras.optimizers import Adam from sklearn.utils import shuffle from keras import backend as K import o...
[ "matplotlib.pyplot.title", "keras.regularizers.l2", "numpy.argmax", "keras.models.Model", "numpy.argmin", "keras.backend.abs", "numpy.random.randint", "numpy.arange", "numpy.random.normal", "keras.layers.Input", "os.path.join", "numpy.zeros_like", "keras.layers.Flatten", "numpy.random.choi...
[((521, 562), 'numpy.random.normal', 'rng.normal', ([], {'loc': '(0)', 'scale': '(0.01)', 'size': 'shape'}), '(loc=0, scale=0.01, size=shape)\n', (531, 562), True, 'import numpy.random as rng\n'), ((574, 603), 'keras.backend.variable', 'K.variable', (['values'], {'name': 'name'}), '(values, name=name)\n', (584, 603), T...
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[ "numpy.sum", "rcc_dp.frequency_estimation.ss.probability_normalize", "scipy.special.comb", "rcc_dp.frequency_estimation.ss.probability_project_simplex", "numpy.exp" ]
[((1492, 1507), 'numpy.exp', 'np.exp', (['epsilon'], {}), '(epsilon)\n', (1498, 1507), True, 'import numpy as np\n'), ((2238, 2274), 'rcc_dp.frequency_estimation.ss.probability_normalize', 'ss.probability_normalize', (['p_estimate'], {}), '(p_estimate)\n', (2262, 2274), False, 'from rcc_dp.frequency_estimation import s...
import numpy as np import cv2 from plasma.training.data import Dataset, augmentations as augs from albumentations import HorizontalFlip, OneOf, RandomBrightnessContrast, RandomGamma, ShiftScaleRotate, Compose, CoarseDropout, RandomCrop aug = Compose([ augs.MinEdgeCrop(size=320, always_apply=True), Horizontal...
[ "albumentations.HorizontalFlip", "numpy.load", "albumentations.CoarseDropout", "cv2.cvtColor", "albumentations.RandomBrightnessContrast", "albumentations.RandomGamma", "albumentations.ShiftScaleRotate", "albumentations.RandomCrop", "plasma.training.data.augmentations.MinEdgeCrop" ]
[((259, 304), 'plasma.training.data.augmentations.MinEdgeCrop', 'augs.MinEdgeCrop', ([], {'size': '(320)', 'always_apply': '(True)'}), '(size=320, always_apply=True)\n', (275, 304), True, 'from plasma.training.data import Dataset, augmentations as augs\n'), ((310, 326), 'albumentations.HorizontalFlip', 'HorizontalFlip'...
import numpy as np from tensorflow import math as tfmath from tensorflow.keras.metrics import Metric from tensorflow.python.keras import backend as K from tensorflow.python.keras.utils import metrics_utils from tensorflow.python.keras.utils.generic_utils import to_list from tensorflow.python.ops import init_ops from te...
[ "tensorflow.python.ops.math_ops.multiply_no_nan", "tensorflow.python.keras.utils.metrics_utils.parse_init_thresholds", "tensorflow.math.add", "numpy.zeros", "tensorflow.python.keras.utils.generic_utils.to_list", "tensorflow.python.keras.utils.metrics_utils.update_confusion_matrix_variables", "tensorflow...
[((823, 912), 'tensorflow.python.keras.utils.metrics_utils.parse_init_thresholds', 'metrics_utils.parse_init_thresholds', (['thresholds'], {'default_threshold': 'default_threshold'}), '(thresholds, default_threshold=\n default_threshold)\n', (858, 912), False, 'from tensorflow.python.keras.utils import metrics_utils...
import torch import numpy as np import cv2 def torchPSNR(tar_img, prd_img): imdff = torch.clamp(prd_img,0,1) - torch.clamp(tar_img,0,1) rmse = (imdff**2).mean().sqrt() ps = 20*torch.log10(1/rmse) return ps def save_img(filepath, img): cv2.imwrite(filepath,cv2.cvtColor(img, cv2.COLOR_RGB2BGR)) def...
[ "cv2.cvtColor", "numpy.float32", "torch.clamp", "numpy.mean", "torch.log10", "numpy.log10" ]
[((89, 115), 'torch.clamp', 'torch.clamp', (['prd_img', '(0)', '(1)'], {}), '(prd_img, 0, 1)\n', (100, 115), False, 'import torch\n'), ((116, 142), 'torch.clamp', 'torch.clamp', (['tar_img', '(0)', '(1)'], {}), '(tar_img, 0, 1)\n', (127, 142), False, 'import torch\n'), ((189, 210), 'torch.log10', 'torch.log10', (['(1 /...
import cv2 import numpy as np img = cv2.imread(input("Img path:"))[0:912, 0:2012] gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray, 50, 150, apertureSize=3) cv2.imshow("zzz", edges) cv2.waitKey(0) lines = cv2.HoughLines(edges, 1, np.pi/180, 200) for rho, theta in lines[0]: a = np.cos(theta) ...
[ "cv2.line", "cv2.Canny", "cv2.cvtColor", "cv2.waitKey", "numpy.sin", "cv2.HoughLines", "numpy.cos", "cv2.imshow" ]
[((90, 127), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (102, 127), False, 'import cv2\n'), ((136, 176), 'cv2.Canny', 'cv2.Canny', (['gray', '(50)', '(150)'], {'apertureSize': '(3)'}), '(gray, 50, 150, apertureSize=3)\n', (145, 176), False, 'import cv2\n'), ((177...
from scipy.spatial import Delaunay import matplotlib.pyplot as plt import numpy as np import itertools from adapt.refine import refine_scalar_field, smallest_length, average_length#, reach_average_length NUM_X = 250 NUM_Y = 250 NUM_COARSE_X = 5 NUM_COARSE_Y = 5 NOISE_LEVEL = 0.1 ITERATION = 6 MAX_POINTS = 4e+4 #...
[ "adapt.refine.average_length", "adapt.refine.refine_scalar_field", "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.apply_along_axis", "numpy.append", "numpy.random.random", "numpy.exp", "numpy.linspace", "itertools.product", "matplotlib.pyplot.subplots", "adapt.refine.smallest_length", "s...
[((682, 706), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'NUM_X'], {}), '(0, 1, NUM_X)\n', (693, 706), True, 'import numpy as np\n'), ((712, 738), 'numpy.linspace', 'np.linspace', (['(0.1)', '(1)', 'NUM_Y'], {}), '(0.1, 1, NUM_Y)\n', (723, 738), True, 'import numpy as np\n'), ((748, 767), 'numpy.meshgrid', 'np.me...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 21 10:15:36 2020 Copyright 2020 by <NAME>. """ # %% Imports. # Standard library imports: import matplotlib.pyplot as plt import numpy as np from sklearn import datasets # Learnpy imports: from learnpy.misc import csv_to_array from learnpy.supervis...
[ "matplotlib.pyplot.plot", "learnpy.misc.csv_to_array", "sklearn.datasets.make_classification", "learnpy.supervised.percep", "matplotlib.pyplot.figure", "numpy.min", "numpy.max" ]
[((410, 456), 'learnpy.misc.csv_to_array', 'csv_to_array', (['"""../../datasets/2d_training.csv"""'], {}), "('../../datasets/2d_training.csv')\n", (422, 456), False, 'from learnpy.misc import csv_to_array\n'), ((472, 517), 'learnpy.misc.csv_to_array', 'csv_to_array', (['"""../../datasets/2d_testing.csv"""'], {}), "('.....
import matplotlib.pyplot as plt from cycler import cycler from itertools import product # import seaborn as sns import pandas as pd import numpy as np import vg import pdb import os import dill as pickle from scipy import constants, ndimage ## from electropy.charge import Charge from electropy.volume import * def map...
[ "os.remove", "seaborn.heatmap", "matplotlib.pyplot.show", "numpy.abs", "pandas.read_csv", "numpy.zeros", "os.path.exists", "scipy.ndimage.convolve", "dill.load", "numpy.array", "matplotlib.pyplot.rc", "seaborn.color_palette", "numpy.squeeze", "matplotlib.pyplot.ylabel", "dill.dump", "n...
[((4082, 4108), 'os.path.exists', 'os.path.exists', (['kernelPath'], {}), '(kernelPath)\n', (4096, 4108), False, 'import os\n'), ((356, 479), 'pandas.read_csv', 'pd.read_csv', (['arrayFilePath'], {'sep': '"""; """', 'skiprows': '(10)', 'header': 'None', 'engine': '"""python"""', 'names': "['FE', 'electrode', 'position'...
# Copyright (c) 2020 Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the f...
[ "onnx.helper.make_node", "numpy.ceil", "onnx.helper.make_model", "onnx.helper.make_tensor_value_info", "finn.core.modelwrapper.ModelWrapper", "numpy.sort", "numpy.random.randint", "finn.util.basic.calculate_signed_dot_prod_range", "onnx.helper.make_graph", "finn.util.basic.gen_finn_dt_tensor" ]
[((3396, 3458), 'onnx.helper.make_graph', 'helper.make_graph', ([], {'nodes': '[]', 'name': '"""mlp"""', 'inputs': '[]', 'outputs': '[]'}), "(nodes=[], name='mlp', inputs=[], outputs=[])\n", (3413, 3458), False, 'from onnx import TensorProto, helper\n'), ((3472, 3518), 'onnx.helper.make_model', 'helper.make_model', (['...
# -*- coding: utf-8 -*- # Exercise 1.17 # Author: <NAME> from numpy.lib.scimath import sqrt a = 2 b = 1 c = 2 q = b*b - 4*a*c q_sr = sqrt(q) x1 = (-b + q_sr)/(2.*a) x2 = (-b - q_sr)/(2.*a) print(x1, x2) """ Trial run (correct result is -0.25 +- 0.968j) python3 find errors-roots.py (-0.25+0.9682458365518543j) (-0.25...
[ "numpy.lib.scimath.sqrt" ]
[((136, 143), 'numpy.lib.scimath.sqrt', 'sqrt', (['q'], {}), '(q)\n', (140, 143), False, 'from numpy.lib.scimath import sqrt\n')]
# pylint: disable=redefined-outer-name """ Test the 2-component elastic interpolation """ import numpy as np import numpy.testing as npt import verde as vd from verde.base import n_1d_arrays import pytest from ..elastic2d import Elastic2D @pytest.fixture def data2d(): "Make 2 component vector data" synth = v...
[ "numpy.ones_like", "verde.base.n_1d_arrays", "pytest.raises", "verde.grid_coordinates", "verde.datasets.CheckerBoard", "verde.get_region" ]
[((319, 345), 'verde.datasets.CheckerBoard', 'vd.datasets.CheckerBoard', ([], {}), '()\n', (343, 345), True, 'import verde as vd\n'), ((364, 413), 'verde.grid_coordinates', 'vd.grid_coordinates', (['synth.region'], {'shape': '(15, 20)'}), '(synth.region, shape=(15, 20))\n', (383, 413), True, 'import verde as vd\n'), ((...
# pylint: disable=missing-function-docstring, missing-module-docstring/ from numpy.random import randint a = randint(10, size = 5)
[ "numpy.random.randint" ]
[((110, 129), 'numpy.random.randint', 'randint', (['(10)'], {'size': '(5)'}), '(10, size=5)\n', (117, 129), False, 'from numpy.random import randint\n')]
""" Defines: - read_op2_geom(op2_filename=None, combine=True, subcases=None, exclude_results=None, include_results=None, validate=True, xref=True, build_dataframe=False, skip_undefined_matrices=True, mode='msc', log=None, debug=True, debug_file=None, ...
[ "pyNastran.op2.tables.geom.dit.DIT.__init__", "pickle.dump", "pyNastran.op2.tables.geom.geom2.GEOM2.__init__", "pyNastran.op2.tables.geom.edom.EDOM.__init__", "pyNastran.bdf.bdf.BDF.__init__", "pyNastran.op2.tables.geom.geom4.GEOM4.__init__", "numpy.frombuffer", "pyNastran.bdf.bdf.BDF.export_hdf5_file...
[((5087, 5107), 'pyNastran.op2.tables.geom.geom1.GEOM1.__init__', 'GEOM1.__init__', (['self'], {}), '(self)\n', (5101, 5107), False, 'from pyNastran.op2.tables.geom.geom1 import GEOM1\n'), ((5116, 5136), 'pyNastran.op2.tables.geom.geom2.GEOM2.__init__', 'GEOM2.__init__', (['self'], {}), '(self)\n', (5130, 5136), False,...
# Copyright (c) Microsoft Corporation and contributors. # Licensed under the MIT License. import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal from sklearn.exceptions import NotFittedError from graspy.cluster.kclust import KMeansCluster def test_inputs(): # Generate random da...
[ "numpy.random.seed", "numpy.argmax", "pytest.raises", "numpy.max", "numpy.repeat", "numpy.random.normal", "numpy.vstack", "graspy.cluster.kclust.KMeansCluster" ]
[((331, 368), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {'size': '(100, 3)'}), '(0, 1, size=(100, 3))\n', (347, 368), True, 'import numpy as np\n'), ((821, 858), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {'size': '(100, 3)'}), '(0, 1, size=(100, 3))\n', (837, 858), True, 'import nump...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import unittest import numpy as np from pymatgen import Lattice, Structure from pymatgen.transformations.site_transformations import \ InsertSitesTransformation, TranslateSitesTransformation, \ Repla...
[ "unittest.main", "unittest.skipIf", "pymatgen.transformations.site_transformations.RemoveSitesTransformation.from_dict", "pymatgen.transformations.site_transformations.TranslateSitesTransformation.from_dict", "numpy.allclose", "pymatgen.Lattice", "pymatgen.Structure", "pymatgen.transformations.site_tr...
[((545, 565), 'monty.os.path.which', 'which', (['"""multienum.x"""'], {}), "('multienum.x')\n", (550, 565), False, 'from monty.os.path import which\n'), ((570, 588), 'monty.os.path.which', 'which', (['"""makestr.x"""'], {}), "('makestr.x')\n", (575, 588), False, 'from monty.os.path import which\n'), ((8498, 8559), 'uni...
r'''Reader for HDF5 files''' import os import h5py import numpy as np from astropy.coordinates import Angle from blimpy.io.base_reader import Reader, logger, GIGA class H5Reader(Reader): """ This class handles .h5 files. """ def __init__(self, filename, f_start=None, f_stop=None, t_start=None, t_stop=N...
[ "h5py.File", "os.stat", "os.path.getsize", "blimpy.io.base_reader.logger.debug", "os.path.isfile", "numpy.array", "h5py.is_hdf5", "astropy.coordinates.Angle" ]
[((5195, 5242), 'numpy.array', 'np.array', (['[blob_time_start, 0, blob_freq_start]'], {}), '([blob_time_start, 0, blob_freq_start])\n', (5203, 5242), True, 'import numpy as np\n'), ((770, 794), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (784, 794), False, 'import os\n'), ((799, 821), 'h5py...
# Copyright (c) 2018 by contributors. 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 applicable...
[ "ctypes.c_bool", "ctypes.byref", "ctypes.memmove", "numpy.zeros", "ctypes.c_float", "ctypes.c_uint", "ctypes.c_uint64", "ctypes.POINTER" ]
[((10923, 10940), 'ctypes.c_uint64', 'ctypes.c_uint64', ([], {}), '()\n', (10938, 10940), False, 'import ctypes\n'), ((11298, 11338), 'numpy.zeros', 'np.zeros', (['length.value'], {'dtype': 'np.float32'}), '(length.value, dtype=np.float32)\n', (11306, 11338), True, 'import numpy as np\n'), ((11351, 11420), 'ctypes.memm...
# -*- coding: utf-8 -*- """ Cylindrical & Spherical Colour Models ===================================== Defines various cylindrical and spherical colour models: - :func:`colour.RGB_to_HSV` - :func:`colour.HSV_to_RGB` - :func:`colour.RGB_to_HSL` - :func:`colour.HSL_to_RGB` These colour models trade off percep...
[ "colour.utilities.tstack", "colour.utilities.from_range_1", "numpy.amin", "numpy.ptp", "colour.utilities.to_domain_1", "numpy.floor", "numpy.asarray", "numpy.isnan", "numpy.amax", "numpy.where", "colour.utilities.as_float_array", "colour.utilities.tsplit" ]
[((3115, 3131), 'colour.utilities.to_domain_1', 'to_domain_1', (['RGB'], {}), '(RGB)\n', (3126, 3131), False, 'from colour.utilities import as_float_array, from_range_1, to_domain_1, tsplit, tstack\n'), ((3147, 3163), 'numpy.amax', 'np.amax', (['RGB', '(-1)'], {}), '(RGB, -1)\n', (3154, 3163), True, 'import numpy as np...
#! /usr/bin/env python3 # coding;utf-8 import numpy import cupy from cupy import cuda shape_array = 0 def _as_batch_mat(x): global shape_array shape_array = x.shape return x.reshape(-1, shape_array[-2], shape_array[-1]) def _mat_ptrs(a): if len(a) == 1: return cupy.full((1,), a.data.ptr, dt...
[ "cupy.cuda.cublas.sgetrfBatched", "cupy.random.rand", "cupy.cuda.cublas.cgetrfBatched", "cupy.cuda.cublas.cgetriBatched", "cupy.empty", "cupy.cuda.cublas.sgetriBatched", "cupy.empty_like", "cupy.eye", "numpy.argmin", "cupy.cuda.cublas.dgetriBatched", "cupy.cuda.cublas.dgetrfBatched", "cupy.cud...
[((561, 582), 'numpy.argmin', 'numpy.argmin', (['strides'], {}), '(strides)\n', (573, 582), False, 'import numpy\n'), ((996, 1042), 'cupy.empty', 'cupy.empty', (['(n, n_matrices)'], {'dtype': 'numpy.int32'}), '((n, n_matrices), dtype=numpy.int32)\n', (1006, 1042), False, 'import cupy\n'), ((1070, 1088), 'cupy.empty_lik...
from video_prediction.control.policy.cem_controllers.cem_base_controller import CEMBaseController import imp import numpy as np from video_prediction.pred_util import get_context, rollout_predictions from ..visualizer.construct_html import save_gifs, save_html, save_img, fill_template, img_entry_html from ..visualizer....
[ "json.load", "numpy.sum", "video_prediction.control.policy.cem_controllers.cem_base_controller.CEMBaseController.__init__", "video_prediction.pred_util.get_context", "models.VAE", "torch.load", "video_prediction.pred_util.rollout_predictions", "imp.load_source", "numpy.max", "utils.from_numpy_to_v...
[((913, 970), 'video_prediction.control.policy.cem_controllers.cem_base_controller.CEMBaseController.__init__', 'CEMBaseController.__init__', (['self', 'ag_params', 'policyparams'], {}), '(self, ag_params, policyparams)\n', (939, 970), False, 'from video_prediction.control.policy.cem_controllers.cem_base_controller imp...
# # Copyright (c) 2021, NVIDIA CORPORATION. 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 appl...
[ "pytorch_quantization.calib.MaxCalibrator", "torch.ones", "numpy.random.seed", "torch.manual_seed", "pytorch_quantization.calib.HistogramCalibrator", "pytest.raises", "tests.utils.compare", "torch.arange", "torch.max", "torch.rand", "tests.fixtures.models.QuantLeNet", "pytorch_quantization.cal...
[((945, 966), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (959, 966), True, 'import numpy as np\n'), ((967, 991), 'torch.manual_seed', 'torch.manual_seed', (['(12345)'], {}), '(12345)\n', (984, 991), False, 'import torch\n'), ((1126, 1161), 'pytorch_quantization.calib.MaxCalibrator', 'calib.M...