code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""read-data.py: Module is used to fetch the images from the SDO data store"""
__author__ = "<NAME>."
__copyright__ = "Copyright 2021, Shibaji"
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
import os
import datetime as dt
import arg... | [
"argparse.ArgumentParser",
"os.path.exists",
"os.system",
"numpy.argmin",
"datetime.datetime",
"lxml.html.fromstring",
"requests.get"
] | [((3225, 3250), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3248, 3250), False, 'import argparse\n'), ((1621, 1638), 'requests.get', 'requests.get', (['uri'], {}), '(uri)\n', (1633, 1638), False, 'import requests\n'), ((1654, 1683), 'lxml.html.fromstring', 'html.fromstring', (['page.content... |
"""
Tests module grey
More tests needed
# Author: <NAME>
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
__version__ = "$Revision$"
import importlib
import numpy
import scipy
import unittest
import numpy.testing as np_test
import pyto
from pyto.segmentation.grey import ... | [
"unittest.TextTestRunner",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.ma.array",
"importlib.reload",
"pyto.segmentation.test.common.make_grey",
"numpy.array",
"pyto.segmentation.grey.Grey.labelByBins",
"numpy.testing.assert_equal",
"unittest.TestLoader",
"pyto.segmentation.test.c... | [((592, 616), 'importlib.reload', 'importlib.reload', (['common'], {}), '(common)\n', (608, 616), False, 'import importlib\n'), ((687, 707), 'pyto.segmentation.test.common.make_shapes', 'common.make_shapes', ([], {}), '()\n', (705, 707), False, 'from pyto.segmentation.test import common\n'), ((728, 746), 'pyto.segmenta... |
"""
Author: <NAME>.
This code is written for the 3D-Human-Action-Recognition Project, started March 14 2014.
"""
import numpy as np
from SOM import SOM
from SNN import SNN
class somagent_phase_I:
def __init__(self, learning, l_x, l_y, input_size, sigma, softmax_exponent, max_epoch, dyn_as_input):
... | [
"numpy.size",
"SNN.SNN",
"numpy.zeros",
"SOM.SOM",
"numpy.concatenate"
] | [((341, 500), 'SOM.SOM', 'SOM', ([], {'learning': 'learning', 'outputsize_x': 'l_x', 'outputsize_y': 'l_y', 'inputsize': 'input_size', 'sigma': 'sigma', 'softmax_exponent': 'softmax_exponent', 'max_epoch': 'max_epoch'}), '(learning=learning, outputsize_x=l_x, outputsize_y=l_y, inputsize=\n input_size, sigma=sigma, s... |
import cv2, os
import numpy as np
from PIL import Image
recognizer1 = cv2.face.createLBPHFaceRecognizer(1,1,7,7)
recognizer2=cv2.face.createEigenFaceRecognizer(15)
path='dataset'
def img_id(path):
# Get all file path
imagePaths = [os.path.join(path,f) for f in os.listdir(path)]
# Initialize empty fac... | [
"cv2.waitKey",
"cv2.imshow",
"PIL.Image.open",
"cv2.face.createLBPHFaceRecognizer",
"numpy.array",
"cv2.face.createEigenFaceRecognizer",
"cv2.destroyAllWindows",
"os.path.join",
"os.listdir",
"os.path.split"
] | [((70, 115), 'cv2.face.createLBPHFaceRecognizer', 'cv2.face.createLBPHFaceRecognizer', (['(1)', '(1)', '(7)', '(7)'], {}), '(1, 1, 7, 7)\n', (103, 115), False, 'import cv2, os\n'), ((125, 163), 'cv2.face.createEigenFaceRecognizer', 'cv2.face.createEigenFaceRecognizer', (['(15)'], {}), '(15)\n', (159, 163), False, 'impo... |
from collections import Counter
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from vk_text_likeness.logs import log_method_begin, log_method_end
class PredictActionModel:
def __init__(self, action_data):
self.action_data = action_data
self.like_model ... | [
"sklearn.ensemble.RandomForestClassifier",
"pandas.DataFrame",
"vk_text_likeness.logs.log_method_end",
"vk_text_likeness.logs.log_method_begin",
"numpy.array",
"collections.Counter"
] | [((322, 355), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_jobs': '(-1)'}), '(n_jobs=-1)\n', (344, 355), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((384, 417), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_jobs': '(-1)'}), '(n_jobs=... |
import numpy as np
import warnings
from collections import namedtuple
from numdifftools import Gradient, Hessian, Jacobian
from scipy.optimize import minimize
from scipy.linalg import sqrtm
from .sobol import multivariate_normal
from .misc import make_positive
__all__ = ['Laplace']
LaplaceResult = namedtuple("Laplac... | [
"numdifftools.Gradient",
"collections.namedtuple",
"numpy.atleast_1d",
"numdifftools.Jacobian",
"numdifftools.Hessian"
] | [((302, 377), 'collections.namedtuple', 'namedtuple', (['"""LaplaceResult"""', '"""x_max, f_max, samples, cov, beta, opt_result"""'], {}), "('LaplaceResult', 'x_max, f_max, samples, cov, beta, opt_result')\n", (312, 377), False, 'from collections import namedtuple\n'), ((5845, 5863), 'numpy.atleast_1d', 'np.atleast_1d'... |
from phone_sensor import PhoneSensor
from matplotlib import pyplot as plt
import numpy as np # type: ignore
# Hosts a webserver in a background thread.
# And display a QR code link to the app
with PhoneSensor(qrcode=True) as phone:
# wait for button press to snap a photo
bgr, time = phone.grab(button=True)
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.flip",
"matplotlib.pyplot.show",
"phone_sensor.PhoneSensor",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.bar"
] | [((198, 222), 'phone_sensor.PhoneSensor', 'PhoneSensor', ([], {'qrcode': '(True)'}), '(qrcode=True)\n', (209, 222), False, 'from phone_sensor import PhoneSensor\n'), ((394, 414), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (405, 414), True, 'from matplotlib import pyplot as p... |
import numpy as np
import os
import tempfile
import argparse
parser = argparse.ArgumentParser(description='Run model parallelism on MNIST.')
parser.add_argument('--splits', type=int, default=1)
parser.add_argument('--batch_size', type=int, default=64)
parser.add_argument('--img_size', type=int, default=400)
args ... | [
"os.remove",
"argparse.ArgumentParser",
"runai.mp.init",
"keras.models.Model",
"os.path.isfile",
"keras.layers.Input",
"tensorflow.get_default_graph",
"tensorflow.one_hot",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"keras.backend.clear_session",
"keras.layers.Dropout",
"keras.back... | [((74, 144), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run model parallelism on MNIST."""'}), "(description='Run model parallelism on MNIST.')\n", (97, 144), False, 'import argparse\n'), ((3001, 3018), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (3016, 301... |
from flask import Flask
from flask import request
from flask import jsonify
import numpy as np
import pandas as pd
import scorecardpy as sc
import joblib
import os
import logging
import logging.handlers
import time
# 忽略弹出的warnings
import warnings
warnings.filterwarnings('ignore')
from scorecardpy.woebin import woepoin... | [
"unicodedata.numeric",
"logging.Formatter",
"flask.jsonify",
"os.path.isfile",
"flask.request.get_json",
"scorecardpy.scorecard_ply",
"os.path.abspath",
"scorecardpy.woebin.woepoints_ply1",
"logging.handlers.TimedRotatingFileHandler",
"pandas.concat",
"logging.StreamHandler",
"flask.request.ge... | [((248, 281), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (271, 281), False, 'import warnings\n'), ((346, 365), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (363, 365), False, 'import logging\n'), ((378, 424), 'logging.Formatter', 'logging.Formatter', (['... |
import numpy as np
from pathlib import Path
from kenning.core.dataset import Dataset
from kenning.core.measurements import Measurements
class RandomizedClassificationDataset(Dataset):
"""
Creates a sample randomized classification dataset.
It is a mock dataset with randomized inputs and outputs.
It... | [
"numpy.random.rand",
"numpy.random.randint",
"numpy.random.seed",
"kenning.core.measurements.Measurements"
] | [((2864, 2878), 'kenning.core.measurements.Measurements', 'Measurements', ([], {}), '()\n', (2876, 2878), False, 'from kenning.core.measurements import Measurements\n'), ((2469, 2491), 'numpy.random.seed', 'np.random.seed', (['sample'], {}), '(sample)\n', (2483, 2491), True, 'import numpy as np\n'), ((2699, 2721), 'num... |
#import csv
import cv2
import time
import random
import imutils
import numpy as np
from PIL import ImageGrab
import pydirectinput as pdi
from PIL import Image, ImageOps
say = 0
global soltara
soltara = 63
global sagtara
sagtara = 64
def tara():
global sagtara
sagtara = 64
global solta... | [
"cv2.line",
"cv2.Canny",
"PIL.ImageGrab.grab",
"cv2.cvtColor",
"cv2.medianBlur",
"cv2.dilate",
"cv2.waitKey",
"cv2.imshow",
"numpy.ones",
"random.choice",
"numpy.array",
"cv2.HoughLinesP",
"pydirectinput.press",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((2941, 2964), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2962, 2964), False, 'import cv2\n'), ((429, 497), 'cv2.HoughLinesP', 'cv2.HoughLinesP', (['img', '(1)', '(np.pi / 180)', '(100)', 'minLineLength', 'maxLineGap'], {}), '(img, 1, np.pi / 180, 100, minLineLength, maxLineGap)\n', (444, 497... |
__author__ = 'Chad'
import numpy as np
data = [1, 2, 3, 4, 5]
arr = np.array(data)
arr2d = np.arange(40).reshape(5, 8)
arr3d = np.arange(30).reshape(2, 3, 5)
print(arr2d)
print(arr2d[2])
print(arr2d[2, 3])
print(arr2d[2, 3:])
print(arr2d[0::, 3])
bool_index = np.array([False, False, True, False, True])
print(arr2... | [
"numpy.array",
"numpy.arange"
] | [((70, 84), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (78, 84), True, 'import numpy as np\n'), ((266, 309), 'numpy.array', 'np.array', (['[False, False, True, False, True]'], {}), '([False, False, True, False, True])\n', (274, 309), True, 'import numpy as np\n'), ((94, 107), 'numpy.arange', 'np.arange', ([... |
try:
import numpy as np
has_numpy = True
except ImportError:
import math
has_numpy = False
try:
import scipy.constants
has_scipy = True
except ImportError:
has_scipy = False
import operator as op
from .similar import sim, nsim, gsim, lsim
def equation_extend(core):
def product(*args):
if len(args) == 1 and h... | [
"numpy.prod"
] | [((340, 356), 'numpy.prod', 'np.prod', (['args[0]'], {}), '(args[0])\n', (347, 356), True, 'import numpy as np\n')] |
import numpy as np
import pybullet as p
import time
from datetime import datetime
import logging
from lgp.logic.parser import PDDLParser
from lgp.core.planner import HumoroLGP
from lgp.geometry.geometry import get_angle, get_point_on_circle
from lgp.geometry.workspace import Circle
import matplotlib
matplotlib.rcParams... | [
"pybullet.getQuaternionFromEuler",
"numpy.random.uniform",
"os.makedirs",
"lgp.geometry.geometry.get_point_on_circle",
"os.path.realpath",
"lgp.core.planner.HumoroLGP",
"numpy.zeros",
"datetime.datetime.now",
"time.time",
"time.sleep",
"lgp.logic.parser.PDDLParser.parse_problem",
"examples.pre... | [((536, 581), 'os.path.join', 'os.path.join', (['_path_file', '"""../../data/videos"""'], {}), "(_path_file, '../../data/videos')\n", (548, 581), False, 'import os\n'), ((496, 522), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (512, 522), False, 'import os\n'), ((598, 641), 'os.path.join'... |
# Copyright (c) 2010, <NAME>, 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 condition... | [
"geometry_msgs.msg.Pose",
"numpy.array"
] | [((3912, 3918), 'geometry_msgs.msg.Pose', 'Pose', ([], {}), '()\n', (3916, 3918), False, 'from geometry_msgs.msg import Pose, Point, Quaternion\n'), ((4710, 4876), 'numpy.array', 'numpy.array', (['[[f.M[0, 0], f.M[0, 1], f.M[0, 2], f.p[0]], [f.M[1, 0], f.M[1, 1], f.M[1, 2\n ], f.p[1]], [f.M[2, 0], f.M[2, 1], f.M[2, ... |
import os
import cv2 as cv
import numpy as np
class SuspiciousImage:
def __init__(self,
path=None, hist_eq=True,
algorithm='orb', nfeatures=5000,
dsize=256, gap=32, h=200, w=400):
self.path = path
self.hist_eq = hist_eq
self.algorithm = a... | [
"numpy.full",
"cv2.equalizeHist",
"os.path.basename",
"cv2.cvtColor",
"os.path.getsize",
"cv2.BFMatcher",
"cv2.AKAZE_create",
"cv2.VideoCapture",
"cv2.imread",
"cv2.xfeatures2d.SURF_create",
"numpy.where",
"cv2.ORB_create",
"numpy.array",
"cv2.xfeatures2d.SIFT_create",
"cv2.flip"
] | [((2099, 2117), 'cv2.flip', 'cv.flip', (['imgarr', '(1)'], {}), '(imgarr, 1)\n', (2106, 2117), True, 'import cv2 as cv\n'), ((2138, 2178), 'cv2.cvtColor', 'cv.cvtColor', (['self.mat', 'cv.COLOR_BGR2GRAY'], {}), '(self.mat, cv.COLOR_BGR2GRAY)\n', (2149, 2178), True, 'import cv2 as cv\n'), ((2889, 2929), 'numpy.full', 'n... |
'''
Created on Nov 8, 2018
@author: Zwieback
'''
import numpy as np
import copy, os, datetime, string
import itertools
import collections
from paths import pathcalibration
from model import (setup_slump, slump_parameters, integration_parameters, T_initial,
integrate_slump)
from slump... | [
"copy.deepcopy",
"model.setup_slump",
"os.makedirs",
"os.path.exists",
"numpy.argmin",
"datetime.datetime",
"numpy.nanmean",
"joblib.Parallel",
"collections.OrderedDict",
"slump.SlumpResults.fromFile",
"os.path.join",
"joblib.delayed",
"model.integrate_slump"
] | [((780, 817), 'datetime.datetime', 'datetime.datetime', (['(2018)', '(6)', '(1)', '(12)', '(10)'], {}), '(2018, 6, 1, 12, 10)\n', (797, 817), False, 'import copy, os, datetime, string\n'), ((843, 881), 'datetime.datetime', 'datetime.datetime', (['(2018)', '(8)', '(28)', '(12)', '(10)'], {}), '(2018, 8, 28, 12, 10)\n', ... |
# approaches the n-armed bandit problem from a different angle,
# doing away with estimated action-values in favour of preferences based on
# a single reference reward (the average of _all_ received rewards)
# takes no direct parameters (though this may change)
# instead, modify the "n_armed_bandits" dict in "settings... | [
"matplotlib.pyplot.show",
"numpy.argmax",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.ticker.FormatStrFormatter",
"numpy.random.normal"
] | [((770, 815), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(numBandits, numArms)'], {}), '(0, 1, (numBandits, numArms))\n', (786, 815), True, 'import numpy as np\n'), ((828, 854), 'numpy.argmax', 'np.argmax', (['bandits'], {'axis': '(1)'}), '(bandits, axis=1)\n', (837, 854), True, 'import numpy as np\n')... |
import os
import csv
import re
import shutil
import cv2
import numpy as np
def alter_format():
gt_path_name = "D:/Data/DATA/ICDAR2013/icdar13-Training-GT"
gt_list = os.listdir(gt_path_name)
for file in gt_list:
file_path = gt_path_name + "/" + file
strs = ""
with open(file_path, 'r... | [
"os.remove",
"numpy.uint8",
"re.split",
"numpy.copy",
"os.rename",
"re.match",
"cv2.imread",
"numpy.array",
"numpy.int32",
"shutil.copyfile",
"re.sub",
"os.listdir"
] | [((175, 199), 'os.listdir', 'os.listdir', (['gt_path_name'], {}), '(gt_path_name)\n', (185, 199), False, 'import os\n'), ((1195, 1220), 'os.listdir', 'os.listdir', (['img_path_name'], {}), '(img_path_name)\n', (1205, 1220), False, 'import os\n'), ((1235, 1259), 'os.listdir', 'os.listdir', (['gt_path_name'], {}), '(gt_p... |
import math
import numpy as np
import torch
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(sel... | [
"numpy.random.seed",
"torch.manual_seed",
"numpy.asarray",
"random.seed",
"math.cos",
"torch.no_grad"
] | [((1096, 1113), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1107, 1113), False, 'import random\n'), ((1118, 1138), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1132, 1138), True, 'import numpy as np\n'), ((1143, 1166), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# np.random.seed(1)
# tf.compat.v1.set_random_seed(1)
LR_A = 0.0005 # learning rate for actor
LR_C = 0.001 # learning rate for critic
GAMMA = 0.9 # reward discount
REPLACEMENT = [
dict(name='soft', tau=0.01),
dict(name='hard', rep_i... | [
"tensorflow.losses.mean_squared_error",
"tensorflow.train.Saver",
"tensorflow.get_collection",
"tensorflow.global_variables_initializer",
"tensorflow.constant_initializer",
"tensorflow.layers.dense",
"tensorflow.Session",
"numpy.zeros",
"tensorflow.variable_scope",
"numpy.hstack",
"tensorflow.re... | [((603, 675), 'numpy.zeros', 'np.zeros', (['(MEMORY_CAPACITY, s_dim * 4 + a_dim * 2 + 1)'], {'dtype': 'np.float32'}), '((MEMORY_CAPACITY, s_dim * 4 + a_dim * 2 + 1), dtype=np.float32)\n', (611, 675), True, 'import numpy as np\n'), ((721, 733), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (731, 733), True, 'imp... |
# -*- coding: utf-8 -*-
"""CNN.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1z-MzR5uN73-ek3jLjZoHPSUS5X1lgPsI
"""
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import C... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.optimizers.SGD",
"numpy.expand_dims",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.models.Sequential",
"tensorflow.kera... | [((539, 556), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (554, 556), False, 'from tensorflow.keras.datasets import mnist\n'), ((709, 721), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (719, 721), False, 'from tensorflow.keras.models import Sequential\n'), ... |
import numpy.testing as npt
import pytest
from pyHalo.Rendering.MassFunctions.power_law import GeneralPowerLaw
from pyHalo.Rendering.MassFunctions.mass_function_utilities import integrate_power_law_quad, integrate_power_law_analytic
import numpy as np
class TestGeneralPowerLaw(object):
def setup(self):
s... | [
"numpy.sum",
"numpy.testing.assert_almost_equal",
"pyHalo.Rendering.MassFunctions.mass_function_utilities.integrate_power_law_analytic",
"pyHalo.Rendering.MassFunctions.mass_function_utilities.integrate_power_law_quad",
"pytest.main",
"pyHalo.Rendering.MassFunctions.power_law.GeneralPowerLaw"
] | [((1791, 1804), 'pytest.main', 'pytest.main', ([], {}), '()\n', (1802, 1804), False, 'import pytest\n'), ((451, 616), 'pyHalo.Rendering.MassFunctions.power_law.GeneralPowerLaw', 'GeneralPowerLaw', (['self.log_mlow', 'self.log_mhigh', 'self.plaw_index'], {'draw_poisson': '(False)', 'normalization': 'self.norm', 'log_mc'... |
import os
import sys
import pandas as pd
import numpy as np
import lightfm
import scipy.sparse as sps
import scipy.sparse.linalg as splinalg
threads = 10
for i in range(1, 14):
print("running batch %d" % i)
batch = pd.read_csv("batches/batch_%d_train.dat" % i)
test_users = pd.read_csv("batches/batch_%d_te... | [
"pandas.read_csv",
"lightfm.LightFM",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.repeat"
] | [((225, 270), 'pandas.read_csv', 'pd.read_csv', (["('batches/batch_%d_train.dat' % i)"], {}), "('batches/batch_%d_train.dat' % i)\n", (236, 270), True, 'import pandas as pd\n'), ((288, 332), 'pandas.read_csv', 'pd.read_csv', (["('batches/batch_%d_test.dat' % i)"], {}), "('batches/batch_%d_test.dat' % i)\n", (299, 332),... |
import cPickle as pickle
import os
"""
This module contains the methods for get and parsing data from mnist datase
originally the mnist dataset has different dimensions that we used in the system
because we have needed to adapt it
This code is based in a Martin Thoma tutorial
https://martin-thoma.com/classify-mnist-w... | [
"gzip.open",
"matplotlib.pylab.imshow",
"struct.unpack",
"numpy.zeros",
"image_processing.generate_pattern",
"os.path.isfile",
"image_processing.apply_threshold",
"matplotlib.pylab.show"
] | [((744, 782), 'os.path.isfile', 'os.path.isfile', (["('%s.pickle' % database)"], {}), "('%s.pickle' % database)\n", (758, 782), False, 'import os\n'), ((2754, 2789), 'matplotlib.pylab.imshow', 'plt.imshow', (['image'], {'cmap': 'plt.cm.gray'}), '(image, cmap=plt.cm.gray)\n', (2764, 2789), True, 'import matplotlib.pylab... |
import numpy as np
import boto3
from moto import mock_s3
import pytest
import os
from .S3_image_functions import S3Images
from PIL import Image
from PIL import ImageChops
@pytest.fixture(scope="function")
def aws_credentials():
"""Mocked AWS Credentials for moto."""
os.environ["AWS_ACCESS_KEY_ID"] = "testing"
... | [
"PIL.Image.new",
"boto3.client",
"pytest.fixture",
"numpy.array",
"moto.mock_s3"
] | [((173, 205), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (187, 205), False, 'import pytest\n'), ((472, 504), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (486, 504), False, 'import pytest\n'), ((697, 726), 'PIL.Image.n... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import numpy as np
import time
from pycocotools.cocoeval import COCOeval
from collections import defaultdict
from detectron2 import _C
class COCOeval_opt(COCOeval):
"""
This is a slightly modified version of the original COCO ... | [
"copy.deepcopy",
"detectron2._C.COCOevalEvaluateImages",
"numpy.zeros",
"time.time",
"numpy.mean",
"numpy.array",
"numpy.where",
"detectron2._C.COCOevalAccumulate",
"numpy.round",
"numpy.unique"
] | [((877, 888), 'time.time', 'time.time', ([], {}), '()\n', (886, 888), False, 'import time\n'), ((4189, 4298), 'detectron2._C.COCOevalEvaluateImages', '_C.COCOevalEvaluateImages', (['p.areaRng', 'maxDet', 'p.iouThrs', 'ious', 'ground_truth_instances', 'detected_instances'], {}), '(p.areaRng, maxDet, p.iouThrs, ious,\n ... |
"""Unit tests for machine_learning_utils.py."""
import copy
import unittest
import numpy
import pandas
from gewittergefahr.gg_utils import nwp_model_utils
from generalexam.ge_utils import front_utils
from generalexam.machine_learning import machine_learning_utils as ml_utils
TOLERANCE = 1e-6
TOLERANCE_FOR_CLASS_WEIGH... | [
"gewittergefahr.gg_utils.nwp_model_utils.get_grid_dimensions",
"generalexam.machine_learning.machine_learning_utils.front_table_to_images",
"generalexam.machine_learning.machine_learning_utils.stack_time_steps",
"numpy.allclose",
"numpy.isclose",
"numpy.mean",
"generalexam.machine_learning.machine_learn... | [((438, 517), 'gewittergefahr.gg_utils.nwp_model_utils.get_grid_dimensions', 'nwp_model_utils.get_grid_dimensions', ([], {'model_name': 'nwp_model_utils.NARR_MODEL_NAME'}), '(model_name=nwp_model_utils.NARR_MODEL_NAME)\n', (473, 517), False, 'from gewittergefahr.gg_utils import nwp_model_utils\n'), ((545, 634), 'numpy.... |
# @Time : 2020/11/16
# @Author : <NAME>
# @Email : <EMAIL>
"""
textbox.data.dataset.dataset
##################################
"""
import numpy as np
import os
from logging import getLogger
from textbox.utils.enum_type import SpecialTokens
class Dataset(object):
def __init__(self, config):
self.conf... | [
"numpy.cumsum",
"os.path.isfile",
"logging.getLogger"
] | [((402, 413), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (411, 413), False, 'from logging import getLogger\n'), ((1985, 2009), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (1999, 2009), False, 'import os\n'), ((6171, 6185), 'numpy.cumsum', 'np.cumsum', (['cnt'], {}), '(cnt)\n', (6180... |
"""
The goal here is to see if there is any relationship between the
average salinity of a specified volume and a filtered version of
the forcing by rivers or QSin.
Designed to run over three years, so that we capture the effect
of the increasing salinity from 2017 to 2019.
"""
import os; import sys
sys.path.append(... | [
"os.path.abspath",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"datetime.datetime",
"matplotlib.pyplot.rcdefaults",
"matplotlib.pyplot.figure",
"datetime.timedelta",
"Lfun.Lstart",
"matplotlib.pyplot.rc",
"flux_fun.get_fluxes",
"pandas.read_pickle",
"numpy... | [((545, 570), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (568, 570), False, 'import argparse\n'), ((904, 940), 'Lfun.Lstart', 'Lfun.Lstart', (['args.gridname', 'args.tag'], {}), '(args.gridname, args.tag)\n', (915, 940), False, 'import Lfun\n'), ((1298, 1314), 'matplotlib.pyplot.close', 'pl... |
import numpy as np
import tensorflow as tf
class PolytopeCompressor(object):
def __init__(self, size, shape, c_dim=128, ks=128):
self.Ks = ks
self.size = size
self.shape = shape
self.dim = c_dim
self.code_dtype = np.uint8 if self.Ks <= 2 ** 7 else (np.uint16 if self.Ks <= 2... | [
"numpy.abs",
"numpy.linalg.norm",
"numpy.eye",
"numpy.all"
] | [((693, 720), 'numpy.linalg.norm', 'np.linalg.norm', (['vec'], {'axis': '(1)'}), '(vec, axis=1)\n', (707, 720), True, 'import numpy as np\n'), ((889, 911), 'numpy.all', 'np.all', (['(sign_flip >= 0)'], {}), '(sign_flip >= 0)\n', (895, 911), True, 'import numpy as np\n'), ((747, 758), 'numpy.abs', 'np.abs', (['vec'], {}... |
import numpy as np
y=np.array([1,0,1,1,1,0,0,1,0,1])
y_predict=np.array([1,1,1,0,1,0,0,1,0,0])
# −(ylog(p)+(1−y)log(1−p))
ellipsis = 1e-15
def log_loss(y,y_predict):
ellipsis=1e-15
y_predict = np.array([max(i, ellipsis) for i in y_predict])
y_predict = np.array([min(i, 1 - ellipsis) for i in y_predict])
... | [
"numpy.array",
"numpy.log"
] | [((21, 61), 'numpy.array', 'np.array', (['[1, 0, 1, 1, 1, 0, 0, 1, 0, 1]'], {}), '([1, 0, 1, 1, 1, 0, 0, 1, 0, 1])\n', (29, 61), True, 'import numpy as np\n'), ((63, 103), 'numpy.array', 'np.array', (['[1, 1, 1, 0, 1, 0, 0, 1, 0, 0]'], {}), '([1, 1, 1, 0, 1, 0, 0, 1, 0, 0])\n', (71, 103), True, 'import numpy as np\n'),... |
"""
This script builds the NER/POS tagged data we trained on for TriviaQA. It should be
run with `port` indicating were a CoreNLP server can be found, we used
`stanford-corenlp-full-2018-10-05`. If the server has multiple threads, the `n_processes`
flag can be used to send multiple queries at a time to speed up tagging... | [
"json.load",
"debias.utils.process_par.process_par",
"argparse.ArgumentParser",
"regex.compile",
"requests.Session",
"debias.preprocessing.corenlp_client.CoreNLPClient",
"triviaqa_cp.triviaqa_cp_evaluation.normalize_answer",
"numpy.array"
] | [((2379, 2405), 'regex.compile', 'regex.compile', (['split_regex'], {}), '(split_regex)\n', (2392, 2405), False, 'import regex\n'), ((5673, 5733), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Builds annotated TriviaQA-CP data"""'], {}), "('Builds annotated TriviaQA-CP data')\n", (5696, 5733), False, 'imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 16:25:09 2017
@author: dbasaran
"""
import numpy as np
from keras.layers import Dense, Reshape, BatchNormalization, Bidirectional, GRU
from keras.layers import Conv2D, LSTM, Input, TimeDistributed, Lambda, ZeroPadding3D
from keras import backend ... | [
"keras.regularizers.l2",
"sklearn.preprocessing.LabelBinarizer",
"numpy.argmax",
"pandas.read_csv",
"numpy.floor",
"numpy.ones",
"keras.layers.ZeroPadding3D",
"numpy.mean",
"numpy.arange",
"keras.layers.Input",
"keras.layers.Reshape",
"keras.regularizers.l1_l2",
"extract_HF0.main",
"mir_ev... | [((977, 988), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (986, 988), False, 'import os\n'), ((3091, 3132), 'h5py.File', 'h5py.File', (['quantized_annotation_path', '"""r"""'], {}), "(quantized_annotation_path, 'r')\n", (3100, 3132), False, 'import h5py\n'), ((3147, 3178), 'numpy.array', 'np.array', (["labels_file['lab... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
def softmaxcrossentropy(x, target, weight=None, reduction='mean'): # type:... | [
"onnx.helper.make_node",
"numpy.sum",
"numpy.log",
"numpy.random.seed",
"numpy.zeros",
"numpy.max",
"numpy.mean",
"numpy.take",
"numpy.exp",
"numpy.random.randint",
"numpy.array",
"numpy.random.rand"
] | [((340, 372), 'numpy.max', 'np.max', (['x'], {'axis': '(1)', 'keepdims': '(True)'}), '(x, axis=1, keepdims=True)\n', (346, 372), True, 'import numpy as np\n'), ((385, 402), 'numpy.exp', 'np.exp', (['(x - max_x)'], {}), '(x - max_x)\n', (391, 402), True, 'import numpy as np\n'), ((466, 475), 'numpy.log', 'np.log', (['p'... |
import numpy as np
import math
__all__ = ["Atom", "Molecule"]
a0 = 5.2917720859E-11 # Bohr radius
eV = 0.000123984 # cm-1 to eV; eV = hc 10^2 / e
Eh = 27.2114 # Hartree energy
u = 1.66053892E-27 # atomic mass unit
me = 9.10938291E-31 # electron mass
atom_numbers = {'H': 1.0, 'C': 6.0, 'N'... | [
"numpy.asarray",
"math.sin",
"numpy.array",
"math.cos",
"numpy.dot",
"numpy.sqrt"
] | [((9496, 9512), 'numpy.asarray', 'np.asarray', (['axis'], {}), '(axis)\n', (9506, 9512), True, 'import numpy as np\n'), ((9567, 9588), 'math.cos', 'math.cos', (['(theta / 2.0)'], {}), '(theta / 2.0)\n', (9575, 9588), False, 'import math\n'), ((9736, 9907), 'numpy.array', 'np.array', (['[[aa + bb - cc - dd, 2 * (bc + ad... |
import argparse
import numpy as np
from Tester.tester import Tester
from Trainer.Models.model_gnet_light import ModelGNetLight
from Trainer.Models.model_gnet_deep import ModelGNetDeep
from Trainer.Models.model_gnet_deep_v2 import ModelGNetDeepV2
from Trainer.Models.model_gnet_deep_deep import ModelGNetDeepDeep
parser... | [
"Tester.tester.Tester",
"numpy.random.randint",
"argparse.ArgumentParser"
] | [((323, 382), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""cnn-number-detection"""'}), "(description='cnn-number-detection')\n", (346, 382), False, 'import argparse\n'), ((1132, 1166), 'Tester.tester.Tester', 'Tester', (['model_obj', 'args.model_path'], {}), '(model_obj, args.model_pat... |
from __future__ import absolute_import, division, print_function, unicode_literals
from ase import Atoms
import matid.geometry
import numpy as np
class System(Atoms):
def __init__(
self,
symbols=None,
positions=None,
numbers=None,
tags=None,
... | [
"numpy.array"
] | [((3268, 3298), 'numpy.array', 'np.array', (['self.wyckoff_letters'], {}), '(self.wyckoff_letters)\n', (3276, 3298), True, 'import numpy as np\n'), ((3594, 3619), 'numpy.array', 'np.array', (['wyckoff_letters'], {}), '(wyckoff_letters)\n', (3602, 3619), True, 'import numpy as np\n'), ((4033, 4064), 'numpy.array', 'np.a... |
import csv
import os
import h5py
import numpy as np
from CNNectome.utils import config_loader
shift = {"A": 1498, "B": 1940, "C": 10954}
def compare(filepath1, filepath2, targetfile, cleft_id_shift, contained_ids):
"""
:param filepath1: csv-file that has the corrected cleft associations
:param filepath2: ... | [
"h5py.File",
"csv.reader",
"csv.writer",
"os.path.join",
"CNNectome.utils.config_loader.get_config",
"numpy.unique"
] | [((572, 589), 'csv.reader', 'csv.reader', (['file1'], {}), '(file1)\n', (582, 589), False, 'import csv\n'), ((604, 621), 'csv.reader', 'csv.reader', (['file2'], {}), '(file2)\n', (614, 621), False, 'import csv\n'), ((635, 653), 'csv.writer', 'csv.writer', (['target'], {}), '(target)\n', (645, 653), False, 'import csv\n... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import os.path
import gc
from skimage import io, color
import tensorflow as tf
from tensorflow.keras.layers import MaxPool1D, GlobalMaxPooling1D
from sklearn import svm
from sklearn.datasets._samples_generator import make_blobs
from tensor... | [
"sklearn.neighbors.KNeighborsRegressor",
"sklearn.preprocessing.StandardScaler",
"sklearn.tree.DecisionTreeRegressor",
"numpy.ravel",
"pandas.read_csv",
"sklearn.model_selection.cross_val_score",
"sklearn.linear_model.ElasticNet",
"sklearn.ensemble.GradientBoostingRegressor",
"sklearn.model_selectio... | [((751, 786), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(200)'], {}), "('display.width', 200)\n", (764, 786), True, 'import pandas as pd\n'), ((1346, 1405), 'pandas.read_csv', 'pd.read_csv', (['CONFIGURATION_FILE_PATH'], {'header': '(0)', 'index_col': '(0)'}), '(CONFIGURATION_FILE_PATH, header=0, ... |
import numpy as np
from compas_slicer.slicers import BaseSlicer
import logging
import progressbar
from compas_slicer.parameters import get_param
from compas_slicer.pre_processing import assign_interpolation_distance_to_mesh_vertices
from compas_slicer.slicers.slice_utilities import ScalarFieldContours
from compas_slice... | [
"compas_slicer.parameters.get_param",
"compas_slicer.slicers.BaseSlicer.__init__",
"numpy.arange",
"compas_slicer.geometry.VerticalLayersManager",
"compas_slicer.pre_processing.assign_interpolation_distance_to_mesh_vertices",
"compas_slicer.slicers.slice_utilities.ScalarFieldContours",
"logging.getLogge... | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['"""logger"""'], {}), "('logger')\n", (387, 397), False, 'import logging\n'), ((1152, 1183), 'compas_slicer.slicers.BaseSlicer.__init__', 'BaseSlicer.__init__', (['self', 'mesh'], {}), '(self, mesh)\n', (1171, 1183), False, 'from compas_slicer.slicers import Bas... |
import unittest
from pkg_resources import resource_filename
from collections import Counter
import numpy as np
from scipy import ndimage
from scipy.spatial import cKDTree as KDTree
from astropy.table import Table
from desimeter import detectspots
class TestDetectSpots(unittest.TestCase):
@classmethod
def se... | [
"unittest.main",
"numpy.random.seed",
"desimeter.detectspots.gaussian_convolve",
"desimeter.detectspots.detectspots",
"scipy.ndimage.shift",
"numpy.zeros",
"pkg_resources.resource_filename",
"numpy.max",
"numpy.array",
"numpy.random.normal",
"astropy.table.Table.read"
] | [((1875, 1890), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1888, 1890), False, 'import unittest\n'), ((431, 489), 'pkg_resources.resource_filename', 'resource_filename', (['"""desimeter"""', '"""test/data/test-spots.csv"""'], {}), "('desimeter', 'test/data/test-spots.csv')\n", (448, 489), False, 'from pkg_res... |
import numpy as np
import copy
import os
import json
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.patches import Circle, FancyArrowPatch
from matplotlib.text import Text
def start(iter_num, horizon, parallel, iter):
dataPath... | [
"numpy.matrix",
"json.load",
"os.getcwd",
"matplotlib.pyplot.close",
"matplotlib.patches.FancyArrowPatch",
"matplotlib.animation.FuncAnimation",
"matplotlib.patches.Circle",
"matplotlib.pyplot.figure",
"matplotlib.use",
"os.path.join"
] | [((71, 94), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (85, 94), False, 'import matplotlib\n'), ((800, 828), 'numpy.matrix', 'np.matrix', (["record['gridmap']"], {}), "(record['gridmap'])\n", (809, 828), True, 'import numpy as np\n'), ((864, 876), 'matplotlib.pyplot.figure', 'plt.figure',... |
from __future__ import division
import cPickle
import numpy as np
import math
import random
import os as os
from scipy import misc
from skimage import color
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
#import matplotlib.pyplot as plot1
#def graph_plot(x, y, xlab, ylab):
#plot... | [
"numpy.ravel",
"tensorflow.reshape",
"numpy.ones",
"cPickle.load",
"numpy.shape",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"tensorflow.InteractiveSession",
"tensorflow.truncated_normal",
"skimage.color.rgb2gray",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"... | [((1026, 1038), 'numpy.matrix', 'np.matrix', (['x'], {}), '(x)\n', (1035, 1038), True, 'import numpy as np\n'), ((1053, 1068), 'numpy.matrix', 'np.matrix', (['temp'], {}), '(temp)\n', (1062, 1068), True, 'import numpy as np\n'), ((1638, 1650), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (1646, 1650), True, 'im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import scipy.stats as st
from scipy.sparse.linalg import eigs
from scipy.spatial.distance import cdist
import sklearn as sk
from sklearn.decomposition import PCA
from sklearn.svm import LinearSVC
from sklearn.linear_model import LogisticRegress... | [
"scipy.stats.zscore",
"sklearn.linear_model.LinearRegression",
"sklearn.linear_model.LogisticRegression",
"sklearn.decomposition.PCA",
"numpy.sign",
"sklearn.svm.LinearSVC",
"numpy.dot"
] | [((3450, 3466), 'numpy.dot', 'np.dot', (['CX.T', 'CZ'], {}), '(CX.T, CZ)\n', (3456, 3466), True, 'import numpy as np\n'), ((4542, 4555), 'numpy.dot', 'np.dot', (['X', 'CX'], {}), '(X, CX)\n', (4548, 4555), True, 'import numpy as np\n'), ((4619, 4631), 'numpy.dot', 'np.dot', (['X', 'V'], {}), '(X, V)\n', (4625, 4631), T... |
import numpy as np
from scipy.ndimage import interpolation
from ocear.preprocess.utils import clip_borders
MAX_SKEW = 3
SKEW_STEPS = 32
def _skew_angle(image):
"""
Estimate skew angle where the horizontal variance in pixel intensity is
highest; the higher the variance, the "straighter up" the letters sh... | [
"numpy.amin",
"ocear.preprocess.utils.clip_borders",
"scipy.ndimage.interpolation.rotate",
"numpy.amax",
"numpy.linspace"
] | [((380, 428), 'numpy.linspace', 'np.linspace', (['(-MAX_SKEW)', 'MAX_SKEW', '(SKEW_STEPS + 1)'], {}), '(-MAX_SKEW, MAX_SKEW, SKEW_STEPS + 1)\n', (391, 428), True, 'import numpy as np\n'), ((906, 953), 'scipy.ndimage.interpolation.rotate', 'interpolation.rotate', (['img', 'angle'], {'reshape': '(False)'}), '(img, angle,... |
import numpy as np
import torch
from sklearn.metrics import confusion_matrix, roc_auc_score
from argus.metrics.metric import Metric
class MultiAUC(Metric):
name = 'multi_auc'
better = 'max'
def __init__(self, num_classes=11):
self.num_classes = num_classes
def reset(self):
self.y_pr... | [
"numpy.mean",
"torch.no_grad",
"numpy.concatenate",
"sklearn.metrics.roc_auc_score"
] | [((612, 639), 'numpy.concatenate', 'np.concatenate', (['self.y_pred'], {}), '(self.y_pred)\n', (626, 639), True, 'import numpy as np\n'), ((662, 689), 'numpy.concatenate', 'np.concatenate', (['self.y_true'], {}), '(self.y_true)\n', (676, 689), True, 'import numpy as np\n'), ((843, 856), 'numpy.mean', 'np.mean', (['aucs... |
import csv
import cv2
import numpy as np
import matplotlib.pyplot as plt
import time
def read_file(filename):
"""
reads the file using csv library and returns rows in the file
"""
lines = []
with open(filename) as csvfile:
data_rows = csv.reader(csvfile)
for row in data_rows:
... | [
"cv2.GaussianBlur",
"csv.reader",
"keras.layers.Cropping2D",
"sklearn.model_selection.train_test_split",
"cv2.warpAffine",
"numpy.arange",
"cv2.cvtColor",
"keras.layers.Flatten",
"cv2.LUT",
"cv2.resize",
"numpy.ceil",
"keras.layers.Dropout",
"cv2.flip",
"numpy.random.uniform",
"numpy.flo... | [((4725, 4738), 'sklearn.utils.shuffle', 'shuffle', (['rows'], {}), '(rows)\n', (4732, 4738), False, 'from sklearn.utils import shuffle\n'), ((7881, 7893), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (7891, 7893), False, 'from keras.models import Sequential\n'), ((8785, 8796), 'time.time', 'time.time', (... |
import numpy as np
from abc import ABC
from scipy.optimize._differentialevolution import DifferentialEvolutionSolver
from scipy.sparse import csc_matrix, csr_matrix
from bayesian_decision_tree.base import BaseTree
from bayesian_decision_tree.hyperplane_optimization import HyperplaneOptimizationFunction, ScipyOptimizer... | [
"numpy.abs",
"bayesian_decision_tree.base.BaseTree.__init__",
"numpy.zeros",
"scipy.sparse.csc_matrix",
"bayesian_decision_tree.hyperplane_optimization.HyperplaneOptimizationFunction",
"numpy.where",
"numpy.dot",
"bayesian_decision_tree.hyperplane_optimization.ScipyOptimizer",
"numpy.unique"
] | [((760, 876), 'bayesian_decision_tree.base.BaseTree.__init__', 'BaseTree.__init__', (['self', 'partition_prior', 'prior', 'delta', 'prune', 'child_type', 'is_regression', 'split_precision', 'level'], {}), '(self, partition_prior, prior, delta, prune, child_type,\n is_regression, split_precision, level)\n', (777, 876... |
"""Creates random numbers"""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
class MyRandomTransformer(CustomTransformer):
_is_reproducible = False
def __init__(self, seed=12345, **kwargs):
super().__init__(**kwargs)
self.seed = seed
de... | [
"numpy.random.rand",
"numpy.random.seed"
] | [((456, 481), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (470, 481), True, 'import numpy as np\n'), ((497, 521), 'numpy.random.rand', 'np.random.rand', (['*X.shape'], {}), '(*X.shape)\n', (511, 521), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 24 11:47:57 2012
@author: eendebakpt
"""
# %% Load necessary packages """
from __future__ import print_function
import os
import numpy as np
import matplotlib.pyplot as plt
oadir = '/home/eendebakpt/misc/oa/oacode/'
import oapackage
def tickfontsize(fontsize=14, ax=N... | [
"matplotlib.pyplot.title",
"oapackage.niceplot",
"oapackage.oahelper.tilefigs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.figure",
"tempfile.mkdtemp",
"oapackage.readarrayf... | [((1619, 1649), 'oapackage.readarrayfile', 'oapackage.readarrayfile', (['afile'], {}), '(afile)\n', (1642, 1649), False, 'import oapackage\n'), ((2024, 2038), 'matplotlib.pyplot.figure', 'plt.figure', (['(10)'], {}), '(10)\n', (2034, 2038), True, 'import matplotlib.pyplot as plt\n'), ((2039, 2048), 'matplotlib.pyplot.c... |
#
# OpenPilot parsers
# from https://github.com/littlemountainman/modeld/tree/master/tools/lib
#
import numpy as np
MAX_DISTANCE = 140.
LANE_OFFSET = 1.8
MAX_REL_V = 10.
LEAD_X_SCALE = 10
LEAD_Y_SCALE = 10
def sigmoid(x):
return 1. / (1. + np.exp(-x))
def softplus(x):
# fix numerical stability
#return np.log... | [
"numpy.sum",
"numpy.maximum",
"numpy.copy",
"numpy.argmax",
"numpy.abs",
"numpy.max",
"numpy.exp",
"numpy.column_stack"
] | [((413, 423), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (420, 423), True, 'import numpy as np\n'), ((469, 504), 'numpy.max', 'np.max', (['x'], {'axis': 'axis', 'keepdims': '(True)'}), '(x, axis=axis, keepdims=True)\n', (475, 504), True, 'import numpy as np\n'), ((612, 647), 'numpy.sum', 'np.sum', (['x'], {'axis': ... |
import taichi as ti
import taichi_three as t3
from taichi_three.mciso import MCISO, Voxelizer
import numpy as np
ti.init(arch=ti.opengl)
vol = np.load('assets/smoke.npy')
mciso = MCISO(vol.shape[0], use_sparse=False)
scene = t3.Scene()
mesh = t3.DynamicMesh(n_faces=mciso.N_res, n_pos=mciso.N_res, n_nrm=mciso.N_re... | [
"numpy.load",
"taichi.GUI",
"taichi_three.Camera",
"taichi.init",
"taichi_three.Model",
"taichi_three.AmbientLight",
"taichi_three.DynamicMesh",
"taichi_three.mciso.MCISO",
"taichi_three.Light",
"taichi_three.Scene"
] | [((114, 137), 'taichi.init', 'ti.init', ([], {'arch': 'ti.opengl'}), '(arch=ti.opengl)\n', (121, 137), True, 'import taichi as ti\n'), ((146, 173), 'numpy.load', 'np.load', (['"""assets/smoke.npy"""'], {}), "('assets/smoke.npy')\n", (153, 173), True, 'import numpy as np\n'), ((183, 220), 'taichi_three.mciso.MCISO', 'MC... |
import cv2
import os
import numpy as np
import argparse
import collections
import torch
import itertools
from tqdm import tqdm
from preprocessing import transform
from reconstruction import NMFCRenderer
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in... | [
"numpy.abs",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.isdir",
"os.walk",
"reconstruction.NMFCRenderer",
"numpy.float",
"os.path.exists",
"preprocessing.transform.matrix2angle",
"torch.cuda.device_count",
"itertools.combinations",
"numpy.mean",
"torch.cuda.is_available",
"os.... | [((454, 472), 'os.path.isdir', 'os.path.isdir', (['dir'], {}), '(dir)\n', (467, 472), False, 'import os\n'), ((2117, 2147), 'itertools.combinations', 'itertools.combinations', (['lst', '(2)'], {}), '(lst, 2)\n', (2139, 2147), False, 'import itertools\n'), ((2170, 2185), 'numpy.float', 'np.float', (['"""inf"""'], {}), "... |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as fnn
from model.cvae_feed_info import CVAEFeedInfo
from model.model_utils import get_bi_rnn_encode, dynamic_rnn
class CVAEStaticInfo:
def __init__(self, model_config, vocab_class):
self.vocab = vocab_class.vocab
se... | [
"torch.nn.Dropout",
"torch.nn.GRU",
"numpy.maximum",
"torch.nn.Tanh",
"torch.nn.Embedding",
"torch.nn.functional.dropout",
"torch.cat",
"model.model_utils.dynamic_rnn",
"torch.FloatTensor",
"model.model_utils.get_bi_rnn_encode",
"torch.nn.Linear",
"torch.device",
"torch.unbind"
] | [((1331, 1367), 'torch.device', 'torch.device', (["model_config['device']"], {}), "(model_config['device'])\n", (1343, 1367), False, 'import torch\n'), ((1880, 1938), 'torch.nn.Embedding', 'nn.Embedding', (['self.topic_vocab_size', 'self.topic_embed_size'], {}), '(self.topic_vocab_size, self.topic_embed_size)\n', (1892... |
from typing import List, Tuple
import numpy as np
import torch
import torchvision
from torch import nn
from .. import coordinates
from .. import process
from ..carla_utils.manager import TickState
from .spatial_softargmax import SpatialSoftargmax
class TaillessResnet34(nn.Module):
"""
Resnet from torchvisio... | [
"torch.nn.ReLU",
"torch.nn.ConvTranspose2d",
"torchvision.transforms.Normalize",
"numpy.zeros",
"torch.cat",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.hub.load",
"torch.no_grad",
"torch.tensor",
"torchvision.transforms.ToTensor"
] | [((479, 547), 'torch.hub.load', 'torch.hub.load', (['"""pytorch/vision:v0.6.0"""', '"""resnet34"""'], {'pretrained': '(True)'}), "('pytorch/vision:v0.6.0', 'resnet34', pretrained=True)\n", (493, 547), False, 'import torch\n'), ((3246, 3283), 'torch.cat', 'torch.cat', (['(resnet_out, speed)'], {'dim': '(1)'}), '((resnet... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.context.set_context",
"mindspore.train.callback.CheckpointConfig",
"mindspore.nn.SoftmaxCrossEntropyWithLogits",
"tests.ut.python.utils.mock_net.Net",
"mindarmour.privacy.sup_privacy.SuppressMasker",
"mindspore.train.callback.ModelCheckpoint",
"mindspore.train.callback.LossMonitor",
"mindsp... | [((1843, 1914), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.PYNATIVE_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.PYNATIVE_MODE, device_target='Ascend')\n", (1862, 1914), False, 'from mindspore import context\n'), ((1933, 1941), 'tests.ut.python.utils.mock_net.Net', 'LeNet... |
'''
PackHacks Rock Paper Scissors
A computer-vision based version of rock-paper-scissors
'''
# Gesture recognition tutorial: https://gogul09.github.io/software/hand-gesture-recognition-p1
import cv2
import numpy as np
from keras.models import load_model
bg = None
def run_avg(image, weight):
glob... | [
"keras.models.load_model",
"cv2.GaussianBlur",
"cv2.approxPolyDP",
"cv2.cvtColor",
"cv2.accumulateWeighted",
"cv2.threshold",
"cv2.waitKey",
"cv2.imshow",
"cv2.imwrite",
"numpy.argmax",
"cv2.arcLength",
"cv2.VideoCapture",
"cv2.drawContours",
"cv2.convexHull",
"cv2.rectangle",
"cv2.fli... | [((410, 451), 'cv2.accumulateWeighted', 'cv2.accumulateWeighted', (['image', 'bg', 'weight'], {}), '(image, bg, weight)\n', (432, 451), False, 'import cv2\n'), ((651, 691), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['thresholded', '(5, 5)', '(0)'], {}), '(thresholded, (5, 5), 0)\n', (667, 691), False, 'import cv2\n'), (... |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
mean = 0
variance = 1
sigma = np.sqrt(variance) # this is the standard deviation
x = np.linspace(-3,3,100)
plt.plot(x, mlab.normpdf(x,mean,sigma))
plt.show() | [
"matplotlib.mlab.normpdf",
"matplotlib.pyplot.show",
"numpy.linspace",
"numpy.sqrt"
] | [((113, 130), 'numpy.sqrt', 'np.sqrt', (['variance'], {}), '(variance)\n', (120, 130), True, 'import numpy as np\n'), ((168, 191), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(100)'], {}), '(-3, 3, 100)\n', (179, 191), True, 'import numpy as np\n'), ((231, 241), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '(... |
import numpy as np
import matplotlib
# Make sure that we are using QT5
matplotlib.use('Qt5Agg')
from time_me import *
vals = [i for i in range(1000) if i % 7 != 0]
coach = TimeLimitCoach(0.5)
queries = np.random.randint(0, 1000, 1000)
@coach.trial()
def _(cls):
o = cls(vals)
ret = 0
for q in queries:
... | [
"matplotlib.use",
"numpy.random.randint"
] | [((73, 97), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (87, 97), False, 'import matplotlib\n'), ((206, 238), 'numpy.random.randint', 'np.random.randint', (['(0)', '(1000)', '(1000)'], {}), '(0, 1000, 1000)\n', (223, 238), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Test MLP class for regression
@author: avaldes
"""
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
from mlp import MLP
def f1(x):
return 1 / (1 + x**2)
def f2(x):
return np.sin(x)
""" Best results for adagrad in first functi... | [
"mlp.MLP",
"matplotlib.pyplot.show",
"numpy.sin",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((1000, 1018), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(7)'], {}), '(2, 7)\n', (1012, 1018), True, 'import matplotlib.pyplot as plt\n'), ((2036, 2046), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2044, 2046), True, 'import matplotlib.pyplot as plt\n'), ((265, 274), 'numpy.sin', 'np.sin', (... |
#!/usr/bin/env python
import numpy as np
import rospy
import tf2_geometry_msgs
import tf2_ros
from dynamic_reconfigure.server import Server
from geometry_msgs.msg import PoseStamped, Twist, Vector3
from nav_msgs.msg import Path
from risk_aware_planner.cfg import ControllerConfig
from shapely.geometry import LineStri... | [
"geometry_msgs.msg.Vector3",
"rospy.logerr",
"numpy.abs",
"rospy.Subscriber",
"numpy.arctan2",
"tf2_geometry_msgs.do_transform_pose",
"rospy.Time",
"numpy.linalg.norm",
"rospy.Duration",
"shapely.geometry.Point",
"rospy.Time.now",
"tf2_ros.TransformListener",
"numpy.cumsum",
"rospy.init_no... | [((508, 557), 'numpy.array', 'np.array', (['[point_msg.x, point_msg.y, point_msg.z]'], {}), '([point_msg.x, point_msg.y, point_msg.z])\n', (516, 557), True, 'import numpy as np\n'), ((1496, 1520), 'nav_msgs.msg.Path', 'Path', ([], {'header': 'path.header'}), '(header=path.header)\n', (1500, 1520), False, 'from nav_msgs... |
"""
Arquivo usado para mudar uma quantidade N de arquivos
de uma pasta para outra e renomear os arquivos se precisar
"""
import cv2
import os
import numpy as np
from PIL import Image
import pathlib
def change_imagens(current_folder, destination_folder, name="crosswalk", qtd=0, dim=(128, 64)):
"""
Arquivo usa... | [
"cv2.imwrite",
"PIL.Image.open",
"pathlib.Path",
"numpy.array",
"os.path.split",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((451, 485), 'os.path.join', 'os.path.join', (['current_folder', 'file'], {}), '(current_folder, file)\n', (463, 485), False, 'import os\n'), ((498, 524), 'os.listdir', 'os.listdir', (['current_folder'], {}), '(current_folder)\n', (508, 524), False, 'import os\n'), ((930, 973), 'PIL.Image.open', 'Image.open', (["(curr... |
# %% importing the libraries
import numpy as np
# %% Defining the sudoku grid
grid = [
[0,0,0,0,3,0,0,0,9],
[0,0,0,0,0,5,0,6,0],
[0,0,0,0,0,7,5,0,8],
[0,0,6,0,0,0,0,0,0],
[3,2,0,0,0,0,6,0,0],
[0,0,0,0,8,0,0,5,4],
[0,3,0,0,5,0,0,0,0],
[8,1,0,9,4,3,0,0,0],
[9,0,0,0,0,8,0,0,0]
]
# C... | [
"numpy.matrix",
"numpy.isin"
] | [((383, 398), 'numpy.matrix', 'np.matrix', (['grid'], {}), '(grid)\n', (392, 398), True, 'import numpy as np\n'), ((571, 602), 'numpy.isin', 'np.isin', (['num', 'sudoku_grid[x, :]'], {}), '(num, sudoku_grid[x, :])\n', (578, 602), True, 'import numpy as np\n'), ((775, 806), 'numpy.isin', 'np.isin', (['num', 'sudoku_grid... |
#!/usr/bin/env python3
'''
Grow and visualize standard resting state ROIs from literature.
1. Read ROIs of standard regions involved in resting state networks from literature.
(the data is provided as a csv file with list of regions with seed MNI coordinates)
2. Grow labels of 1cm radius (approx) in the surface so... | [
"surfer.Brain",
"nilearn.plotting.plot_connectome",
"jumeg.jumeg_utils.get_jumeg_path",
"nilearn.plotting.show",
"numpy.zeros",
"jumeg.connectivity.make_annot_from_csv",
"numpy.array",
"mne.datasets.sample.data_path"
] | [((872, 890), 'mne.datasets.sample.data_path', 'sample.data_path', ([], {}), '()\n', (888, 890), False, 'from mne.datasets import sample\n'), ((1129, 1253), 'jumeg.connectivity.make_annot_from_csv', 'make_annot_from_csv', (['subject', 'subjects_dir', 'csv_fname'], {'parc_fname': 'parc_fname', 'make_annot': '(False)', '... |
"""Some utilities/wrappers for Qiskit"""
from ast import literal_eval
import pickle
import operator
from os import path
import numpy as np
from numpy import pi
from qiskit.compiler import transpile
from qiskit.transpiler import CouplingMap
from qiskit.tools.monitor import job_monitor
from qiskit.providers.aer.noise ... | [
"qiskit.IBMQ.load_account",
"numpy.conj",
"qiskit.QuantumCircuit",
"qiskit.IBMQ.get_provider",
"os.path.exists",
"qiskit.compiler.transpile",
"qiskit.providers.aer.noise.NoiseModel.from_backend",
"qiskit.tools.monitor.job_monitor",
"pickle.load",
"qiskit.execute",
"operator.itemgetter",
"qiski... | [((7166, 7195), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['N'], {'name': '"""QFT"""'}), "(N, name='QFT')\n", (7180, 7195), False, 'from qiskit import execute, Aer, IBMQ, QuantumCircuit\n'), ((1146, 1173), 'os.path.exists', 'path.exists', (['noise_filename'], {}), '(noise_filename)\n', (1157, 1173), False, 'from os i... |
import os
os.sys.path.extend([os.pardir, os.curdir])
import numpy as np
from common.function import cross_entropy, sigmoid, softmax
from common.gradient import numerical_grad
class TwoLayer(object):
'''
>>> n = TwoLayer(2, 10, 3)
>>> output = n.predict(np.array([[1, 2]]))
>>> abs(np.sum(output) - 1.... | [
"numpy.sum",
"os.sys.path.extend",
"common.function.cross_entropy",
"numpy.random.randn",
"numpy.zeros",
"common.function.sigmoid",
"numpy.dot",
"common.function.softmax",
"common.gradient.numerical_grad",
"doctest.testmod"
] | [((10, 52), 'os.sys.path.extend', 'os.sys.path.extend', (['[os.pardir, os.curdir]'], {}), '([os.pardir, os.curdir])\n', (28, 52), False, 'import os\n'), ((2366, 2383), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (2381, 2383), False, 'import doctest\n'), ((697, 718), 'numpy.zeros', 'np.zeros', (['hidden_size... |
# lower_bound = (40,70,70)
# upper_bound = (180,255,255)
import matplotlib.pyplot as plt
import numpy as np
import cv2
from matplotlib.colors import hsv_to_rgb, rgb_to_hsv
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib import colors
import argparse
from mpl_toolkits.mplot3d import Ax... | [
"numpy.full",
"argparse.ArgumentParser",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.nonzero",
"cv2.imread",
"numpy.shape",
"cv2.drawContours",
"cv2.imshow",
"cv2.inRange",
"cv2.findContours"
] | [((391, 416), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (414, 416), False, 'import argparse\n'), ((527, 547), 'cv2.imread', 'cv2.imread', (['dataPath'], {}), '(dataPath)\n', (537, 547), False, 'import cv2\n'), ((1708, 1750), 'cv2.cvtColor', 'cv2.cvtColor', (['patch_RGB', 'cv2.COLOR_RGB2HSV... |
# -*- coding: utf-8 -*-
"""Extracts raw values around a point.
There's some complexity in what should happen when the requested time is different from
the actual times available in the desired band: do we generate a pseudo-point or re-center
around a nearby one? For now we'll do the latter, and possibly throw away all... | [
"functools.partial",
"numpy.zeros"
] | [((2880, 2932), 'functools.partial', 'functools.partial', (['self._extract_per_band'], {'time': 'time'}), '(self._extract_per_band, time=time)\n', (2897, 2932), False, 'import functools\n'), ((1246, 1309), 'numpy.zeros', 'np.zeros', ([], {'shape': '((num_pad,) + array.shape[1:])', 'dtype': 'array.dtype'}), '(shape=(num... |
import copy
import datetime
import logging
import os
import time
from functools import partial
from pathlib import Path
from typing import Any, Dict, Optional, Union
import numpy as np
from memory_profiler import memory_usage
from monty.json import MSONable
from monty.serialization import loadfn
from pymatgen.core.str... | [
"amset.interpolation.wavefunction.WavefunctionOverlapCalculator.from_file",
"amset.log.initialize_amset_logger",
"monty.serialization.loadfn",
"pathlib.Path",
"amset.io.write_settings",
"amset.util.validate_settings",
"pymatgen.util.string.unicodeify",
"amset.core.transport.solve_boltzman_transport_eq... | [((1437, 1464), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1454, 1464), False, 'import logging\n'), ((15232, 15255), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (15253, 15255), False, 'import datetime\n'), ((16063, 16086), 'amset.log.log_banner', 'log_banner',... |
import pathlib
import matplotlib.pyplot as plt
import numpy as np
from quantile_dotplot import ntile_dotplot
import matplotlib
if __name__ == "__main__":
here = pathlib.Path(__file__).resolve().parent
fig, ax = plt.subplots(figsize=(10, 7))
data = np.random.lognormal(mean=np.log(11.4), sigma=0.2, size=... | [
"pathlib.Path",
"matplotlib.pyplot.subplots",
"numpy.log",
"quantile_dotplot.ntile_dotplot"
] | [((224, 253), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 7)'}), '(figsize=(10, 7))\n', (236, 253), True, 'import matplotlib.pyplot as plt\n'), ((341, 404), 'quantile_dotplot.ntile_dotplot', 'ntile_dotplot', (['data'], {'dots': '(20)', 'edgecolor': '"""k"""', 'linewidth': '(2)', 'ax': 'ax'}), "... |
import os
import re
import sys
from operator import itemgetter
from os import path
import numpy as np
def process_latencies_file(file_path):
pattern = re.compile(r'\[latency: (-?\d+) ms\]')
with open(file_path, 'r') as f:
return [int(re.search(pattern, line).group(1)) for line in f.readlines()]
def... | [
"os.path.isdir",
"re.match",
"numpy.percentile",
"os.path.isfile",
"re.search",
"operator.itemgetter",
"os.path.join",
"os.listdir",
"sys.exit",
"re.compile"
] | [((158, 198), 're.compile', 're.compile', (['"""\\\\[latency: (-?\\\\d+) ms\\\\]"""'], {}), "('\\\\[latency: (-?\\\\d+) ms\\\\]')\n", (168, 198), False, 'import re\n'), ((390, 423), 'os.path.join', 'path.join', (['result_path', '"""out.txt"""'], {}), "(result_path, 'out.txt')\n", (399, 423), False, 'from os import path... |
import numpy as np
import pandas as pd
# import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
color_dict = {'Aeolian Sandstone': '#ffffe0',
'Anhydrite': '#ff80ff',
'Argillaceous Limestone': '#1e90ff',
'Arkose': '#eedd82',... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"matplotlib.pyplot.FuncFormatter",
"numpy.std",
"numpy.expand_dims",
"pandas.Categorical",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.subplots"
] | [((2303, 2326), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (2322, 2326), False, 'from mpl_toolkits.axes_grid1 import make_axes_locatable\n'), ((2988, 3035), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(5)', 'figsize': '(8, 12)'}), '(nr... |
from ENVS.Envs import PendulumEnv
from PPO_TD_Lambda.model import MLPContiControlModel, MLPEvaluateModel
from PPO_TD_Lambda.algo_2 import PPOTDLambda
from PPO_TD_Lambda.algo import PPOTDLamda as PPO1
from TOOLS.Logger import LoggerPrinter
import numpy as np
"""
本测试完成了对PPO_TD_Lambda算法在倒立摆上的运行效果,
game_index=1: 在a... | [
"PPO_TD_Lambda.model.MLPContiControlModel",
"PPO_TD_Lambda.algo.PPOTDLamda",
"PPO_TD_Lambda.model.MLPEvaluateModel",
"numpy.array",
"PPO_TD_Lambda.algo_2.PPOTDLambda",
"ENVS.Envs.PendulumEnv",
"TOOLS.Logger.LoggerPrinter"
] | [((529, 544), 'TOOLS.Logger.LoggerPrinter', 'LoggerPrinter', ([], {}), '()\n', (542, 544), False, 'from TOOLS.Logger import LoggerPrinter\n'), ((1319, 1409), 'PPO_TD_Lambda.model.MLPEvaluateModel', 'MLPEvaluateModel', (['env.obs_dim'], {'hidden_size': '(100,)', 'hd_activation': '"""ReLU"""', 'logger': 'logger'}), "(env... |
from scipy.integrate import solve_ivp
from scipy.optimize import root_scalar
import numpy as np
def qho(x, psi, E):
hbar = m = k = 1.0
return np.asarray([psi[1], 2.0 * m * (k * x ** 2 / 2 - E) * psi[0] / hbar ** 2])
def single_shooting_method(tise, x, psi, dpsi, E):
objective_func = lambda _ : solve_ivp(... | [
"numpy.asarray",
"scipy.optimize.root_scalar"
] | [((443, 468), 'numpy.asarray', 'np.asarray', (['[-10.0, 10.0]'], {}), '([-10.0, 10.0])\n', (453, 468), True, 'import numpy as np\n'), ((475, 497), 'numpy.asarray', 'np.asarray', (['[0.0, 0.0]'], {}), '([0.0, 0.0])\n', (485, 497), True, 'import numpy as np\n'), ((152, 225), 'numpy.asarray', 'np.asarray', (['[psi[1], 2.0... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Generate the sample vectors for the test.
"""
__author__ = "<NAME> <<EMAIL>>"
__date__ = "24/02/2021"
import os
import shutil
import numpy as np
if __name__ == '__main__':
width = 128
height = 128
base_dir = os.path.join(os.path.dirname(os.path.abspath(__... | [
"os.path.abspath",
"os.makedirs",
"numpy.zeros",
"shutil.rmtree",
"os.path.join"
] | [((302, 327), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (317, 327), False, 'import os\n'), ((746, 824), 'os.path.join', 'os.path.join', (['base_dir', 'f"""{label}_{\'s\' if signed else \'u\'}{bits_per_sample}be"""'], {}), '(base_dir, f"{label}_{\'s\' if signed else \'u\'}{bits_per_sample... |
from __future__ import print_function, division
import numpy as np
import math
from scipy import stats
from scipy.special import gammaln, multigammaln
from dists import CollapsibleDistribution, FrozenDistribution
LOG2PI = math.log(2*math.pi)
LOG2 = math.log(2)
LOGPI = math.log(math.pi)
class uncert_NormalFixedCo... | [
"numpy.zeros",
"numpy.linalg.inv",
"numpy.linalg.slogdet",
"numpy.dot",
"math.log"
] | [((227, 248), 'math.log', 'math.log', (['(2 * math.pi)'], {}), '(2 * math.pi)\n', (235, 248), False, 'import math\n'), ((254, 265), 'math.log', 'math.log', (['(2)'], {}), '(2)\n', (262, 265), False, 'import math\n'), ((274, 291), 'math.log', 'math.log', (['math.pi'], {}), '(math.pi)\n', (282, 291), False, 'import math\... |
# -*- coding: utf-8 -*-
# @Author: tom-hydrogen
# @Date: 2018-03-07 10:51:02
# @Last Modified by: tom-hydrogen
# @Last Modified time: 2018-03-09 16:51:22
""" gp.py
Bayesian optimisation of loss functions.
"""
import numpy as np
from scipy.optimize import minimize
from copy import deepcopy
from sklearn.gaussian_proc... | [
"GPy.kern.Matern52",
"copy.deepcopy",
"scipy.optimize.minimize",
"GPy.models.GPRegression",
"GPy.models.SparseGPRegression",
"numpy.var",
"numpy.argsort",
"sklearn.gaussian_process.kernels.Matern",
"numpy.mean",
"numpy.array",
"sklearn.gaussian_process.GaussianProcessRegressor"
] | [((3210, 3221), 'copy.deepcopy', 'deepcopy', (['X'], {}), '(X)\n', (3218, 3221), False, 'from copy import deepcopy\n'), ((3234, 3245), 'copy.deepcopy', 'deepcopy', (['y'], {}), '(y)\n', (3242, 3245), False, 'from copy import deepcopy\n'), ((7661, 7674), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (7669, 7674),... |
import numpy as np
import matplotlib.pyplot as plt
incomes = np.random.normal(27000, 15000, 10000)
def Mean():
return np.mean(incomes)
def Visualize():
plt.hist(incomes,50)
plt.show()
Mean()
Visualize() #displays graphical window popup
| [
"matplotlib.pyplot.hist",
"numpy.mean",
"matplotlib.pyplot.show",
"numpy.random.normal"
] | [((62, 99), 'numpy.random.normal', 'np.random.normal', (['(27000)', '(15000)', '(10000)'], {}), '(27000, 15000, 10000)\n', (78, 99), True, 'import numpy as np\n'), ((123, 139), 'numpy.mean', 'np.mean', (['incomes'], {}), '(incomes)\n', (130, 139), True, 'import numpy as np\n'), ((162, 183), 'matplotlib.pyplot.hist', 'p... |
from pathlib import Path
import math
import numpy as np
from PIL import Image
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, WeightedRandomSampler
IMAGE_SIZE = 224
BANNERHEIGHT = 12
ROTATION_ANGLE = 10
NORM = ([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
l = IMAGE_SIZE / 2
ra... | [
"torchvision.transforms.RandomHorizontalFlip",
"torch.utils.data.DataLoader",
"math.radians",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.Normalize",
"math.sin",
"PIL.Image.open",
"numpy.clip",
"torchvision.transforms.ToTensor",
"pathlib.Path",
"torchvision.transforms.Pad",
... | [((324, 352), 'math.radians', 'math.radians', (['ROTATION_ANGLE'], {}), '(ROTATION_ANGLE)\n', (336, 352), False, 'import math\n'), ((357, 370), 'math.cos', 'math.cos', (['rad'], {}), '(rad)\n', (365, 370), False, 'import math\n'), ((375, 388), 'math.sin', 'math.sin', (['rad'], {}), '(rad)\n', (383, 388), False, 'import... |
import numpy as np
import math
from abc import abstractmethod
from jmetal.core.solution import FloatSolution
import Levenshtein as levenshtein
import sys
class Behavior:
def evaluate_novelty(self, individual: FloatSolution, population: [FloatSolution], neighborhood_size: int = 2):
distances = self.calcula... | [
"numpy.array",
"numpy.linalg.norm",
"Levenshtein.distance",
"numpy.average"
] | [((720, 745), 'numpy.average', 'np.average', (['distances[:k]'], {}), '(distances[:k])\n', (730, 745), True, 'import numpy as np\n'), ((1018, 1047), 'numpy.array', 'np.array', (['[ind_ss2, ind_sasa]'], {}), '([ind_ss2, ind_sasa])\n', (1026, 1047), True, 'import numpy as np\n'), ((1905, 1935), 'numpy.array', 'np.array',... |
"""
Plot script of various spectra.
"""
import matplotlib.pyplot as plt
import numpy as np
import os.path
from math import pi
import argparse
import h5py
def plot_spectra_in_file(filename):
"""
Plot spectra in file.
Parameters
----------
filename : str
"""
print('Read data from file: ... | [
"numpy.sum",
"argparse.ArgumentParser",
"numpy.abs",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.linalg.norm",
"matplotlib.pyplot.tight_layout",
"numpy.copy",
"numpy.log10",
"matplotlib.pyplot.subplots",
"h5py.File",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cm... | [((343, 367), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (352, 367), False, 'import h5py\n'), ((8545, 8596), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot spectra"""'}), "(description='Plot spectra')\n", (8568, 8596), False, 'import argparse\n'), ... |
""" 2d array of channels x time series for windowed time series"""
import numpy
import warnings
from pySPACE.resources.data_types import base
class TimeSeries(base.BaseData):
""" Time Series object
Represents a finite length time series consisting (potentially) of
several channels. Objects of this t... | [
"numpy.ndarray.__setstate__",
"pySPACE.resources.data_types.base.BaseData.__new__",
"numpy.array",
"warnings.warn",
"numpy.atleast_2d"
] | [((3052, 3069), 'numpy.array', 'numpy.array', (['data'], {}), '(data)\n', (3063, 3069), False, 'import numpy\n'), ((3220, 3249), 'numpy.atleast_2d', 'numpy.atleast_2d', (['input_array'], {}), '(input_array)\n', (3236, 3249), False, 'import numpy\n'), ((3327, 3370), 'pySPACE.resources.data_types.base.BaseData.__new__', ... |
"""
Suppose you have a bar with n seats in a row. Unfriendly people arrive
and seat themselves randomly. Since they are unfriendly, they will not
sit next to anyone who is already seated.
What is the expected occupancy fraction when no one else can be seated?
"""
import numpy as np
from fractions import Fraction
EMP... | [
"numpy.zeros",
"numpy.arange",
"numpy.random.choice",
"numpy.random.permutation",
"fractions.Fraction"
] | [((1527, 1547), 'numpy.arange', 'np.arange', (['num_seats'], {}), '(num_seats)\n', (1536, 1547), True, 'import numpy as np\n'), ((1599, 1632), 'numpy.zeros', 'np.zeros', (['num_seats'], {'dtype': 'np.int'}), '(num_seats, dtype=np.int)\n', (1607, 1632), True, 'import numpy as np\n'), ((2917, 2949), 'numpy.random.permuta... |
import ROOT
def _get_outfile(outfile):
if isinstance(outfile, ROOT.TFile):
outfile.cd()
return outfile, False
else:
fout = ROOT.TFile.Open(outfile, 'RECREATE')
return fout, True
def _printout(verbose, msg):
if verbose:
print(msg)
_dtypemap = {'int8': 'B',
... | [
"pyarrow.parquet.read_schema",
"numpy.zeros",
"ROOT.std.string",
"os.path.splitext",
"ROOT.TFile.Open",
"pyarrow.parquet.read_table",
"ROOT.TTree",
"ROOT.std.vector"
] | [((3667, 3692), 'pyarrow.parquet.read_schema', 'pq.read_schema', (['lfiles[0]'], {}), '(lfiles[0])\n', (3681, 3692), True, 'import pyarrow.parquet as pq\n'), ((4209, 4245), 'ROOT.TTree', 'ROOT.TTree', (['treename', '"""Parquet tree"""'], {}), "(treename, 'Parquet tree')\n", (4219, 4245), False, 'import ROOT\n'), ((157,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PRA second-order code -- algorithms only
Modified on Tuesday June 15, 2021
@authors: <NAME> and <NAME>
"""
import numpy as np
import scipy
import scipy.linalg
from scipy.sparse import csr_matrix
class Cone():
"""
Product of second order cones
"""
def... | [
"numpy.sum",
"numpy.eye",
"numpy.random.randn",
"numpy.tensordot",
"scipy.linalg.block_diag",
"numpy.linalg.qr",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.where",
"scipy.sparse.csr_matrix",
"numpy.min",
"numpy.arange",
"numpy.kron",
"numpy.dot",
"numpy.linalg.solve",
"numpy.nd... | [((2720, 2738), 'numpy.linalg.qr', 'np.linalg.qr', (['AA.T'], {}), '(AA.T)\n', (2732, 2738), True, 'import numpy as np\n'), ((2767, 2784), 'numpy.linalg.qr', 'np.linalg.qr', (['A.T'], {}), '(A.T)\n', (2779, 2784), True, 'import numpy as np\n'), ((4431, 4445), 'numpy.sum', 'np.sum', (['Pzplus'], {}), '(Pzplus)\n', (4437... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import random
import time
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items)-1-i):
if items[j] > items[j+1]:
items[j], items[j+1] = items[j+1], items[j]
def selection_sort(items):
... | [
"numpy.log",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"time.time",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xlabel"
] | [((1333, 1359), 'numpy.array', 'np.array', (['[10, 20, 30, 40]'], {}), '([10, 20, 30, 40])\n', (1341, 1359), True, 'import numpy as np\n'), ((1585, 1599), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'x'], {}), '(x, x)\n', (1593, 1599), True, 'import matplotlib.pyplot as plt\n'), ((1633, 1652), 'matplotlib.pyplot.plot'... |
import pytest
import numpy as np
import wagedyn as wd
from scipy.misc import derivative
# content of test_sample.py
def test_utility():
p = wd.Parameters()
p.tax_lambda = 0.9
p.tax_tau = 1.1
pref = wd.Preferences(p)
input_w = np.linspace(0.01, 10, 1000)
input_u = pref... | [
"scipy.misc.derivative",
"numpy.power",
"numpy.allclose",
"wagedyn.Parameters",
"wagedyn.Preferences",
"numpy.linspace"
] | [((150, 165), 'wagedyn.Parameters', 'wd.Parameters', ([], {}), '()\n', (163, 165), True, 'import wagedyn as wd\n'), ((233, 250), 'wagedyn.Preferences', 'wd.Preferences', (['p'], {}), '(p)\n', (247, 250), True, 'import wagedyn as wd\n'), ((270, 297), 'numpy.linspace', 'np.linspace', (['(0.01)', '(10)', '(1000)'], {}), '... |
import os
import re
import pandas
import string
import numpy as np
import gensim.models.keyedvectors as word2vec
from mlxtend.preprocessing import one_hot
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition impo... | [
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.save",
"numpy.concatenate",
"numpy.asarray",
"numpy.zeros",
"gensim.models.keyedvectors.KeyedVectors.load_word2vec_format",
"sklearn.decomposition.PCA",
"nltk.corpus.stopwords.words",
"re.sub",
"os.listdir",
"nltk.tokenize.word_tokenize"
... | [((341, 367), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (356, 367), False, 'from nltk.corpus import stopwords\n'), ((556, 597), 're.sub', 're.sub', (['"""[^A-Za-z0-9(),!?\\\\\'\\\\`]"""', '""" """', 's'], {}), '("[^A-Za-z0-9(),!?\\\\\'\\\\`]", \' \', s)\n', (562, 597), ... |
# coding: utf-8
# In[1]:
from numba import jit
import numpy as np
import pandas as pd
from datetime import datetime as dt
import os
import seaborn as sns
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import lightgbm as lgb
import xgboost as xgb
import time
import datetime
from tqdm import tqdm_notebook... | [
"pickle.dump",
"pandas.read_csv",
"sklearn.preprocessing.MinMaxScaler",
"numpy.iinfo",
"keras.models.Model",
"numpy.shape",
"gc.collect",
"matplotlib.pyplot.style.use",
"numpy.mean",
"keras.layers.Input",
"keras.layers.Reshape",
"numpy.unique",
"tqdm.tqdm_notebook",
"numpy.finfo",
"panda... | [((193, 216), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (206, 216), True, 'import matplotlib.pyplot as plt\n'), ((617, 650), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (640, 650), False, 'import warnings\n'), ((8937, 8984),... |
# *******************************************************************************
# Copyright (C) 2021 INAF
#
# This software is distributed under the terms of the BSD-3-Clause license
#
# Authors:
# <NAME> <<EMAIL>>
# *******************************************************************************
import os
import sys... | [
"os.mkdir",
"os.remove",
"RTAscience.lib.RTACtoolsSimulation.RTACtoolsSimulation",
"argparse.ArgumentParser",
"os.path.isdir",
"RTAscience.lib.RTAUtils.get_mergermap",
"RTAscience.cfg.Config.Config",
"time.time",
"os.path.isfile",
"numpy.array",
"astropy.io.fits.open",
"multiprocessing.Pool",
... | [((863, 883), 'RTAscience.cfg.Config.Config', 'Config', (['args.cfgfile'], {}), '(args.cfgfile)\n', (869, 883), False, 'from RTAscience.cfg.Config import Config\n'), ((4038, 4044), 'time.time', 'time', ([], {}), '()\n', (4042, 4044), False, 'from time import time\n'), ((4386, 4407), 'RTAscience.lib.RTACtoolsSimulation.... |
import numpy as np
import matplotlib.pyplot as plt
import gym
from gym import spaces
class GridworldCoexistenceGym(gym.Env):
def __init__(self, headless=True, gridworld_size=11, max_steps=20000, kill_reward=0, step_reward=1, window_size=5):
self.action_space = spaces.Discrete(4)
self.observation_... | [
"numpy.dstack",
"numpy.zeros",
"gym.spaces.Discrete",
"matplotlib.pyplot.matshow",
"matplotlib.pyplot.draw",
"numpy.array",
"gym.spaces.Box",
"numpy.random.choice",
"matplotlib.pyplot.pause"
] | [((276, 294), 'gym.spaces.Discrete', 'spaces.Discrete', (['(4)'], {}), '(4)\n', (291, 294), False, 'from gym import spaces\n'), ((328, 427), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-10000000)', 'high': '(100000000)', 'dtype': 'np.float', 'shape': '(window_size, window_size, 2)'}), '(low=-10000000, high=100000000... |
import allel
import numpy as np
import pandas as pd
import time
import sys
def process_vit(vit_file):
vit_matrix = []
with open(vit_file) as file:
for x in file:
x_split = x.replace('\n', '').split('\t')
vit_matrix.append(np.array(x_split[1:-1]))
ancestry_matrix = np.stack(v... | [
"numpy.stack",
"numpy.save",
"pandas.read_csv",
"numpy.empty",
"allel.read_vcf",
"numpy.place",
"time.time",
"numpy.append",
"numpy.where",
"numpy.array",
"numpy.repeat",
"numpy.arange",
"numpy.float64",
"sys.exit",
"numpy.nanmean"
] | [((438, 481), 'pandas.read_csv', 'pd.read_csv', (['fbk_file'], {'sep': '""" """', 'header': 'None'}), "(fbk_file, sep=' ', header=None)\n", (449, 481), True, 'import pandas as pd\n'), ((955, 998), 'pandas.read_csv', 'pd.read_csv', (['tsv_file'], {'sep': '"""\t"""', 'skiprows': '(1)'}), "(tsv_file, sep='\\t', skiprows=1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 24 08:23:38 2020
@author: fabian
"""
from pathlib import Path
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui
import matplotlib.pyplot as plt
def load_data(path):
mask = np.zeros((32,32))
mask[0:16, 0:16] = ... | [
"pyqtgraph.Qt.QtGui.QMainWindow",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"numpy.zeros",
"pyqtgraph.ImageView",
"pathlib.Path",
"numpy.array",
"numpy.linspace",
"pyqtgraph.Qt.QtGui.QApplication"
] | [((1107, 1165), 'pathlib.Path', 'Path', (['"""../../Data_Collection/3kOhm_FB/square_sensor/Slip/"""'], {}), "('../../Data_Collection/3kOhm_FB/square_sensor/Slip/')\n", (1111, 1165), False, 'from pathlib import Path\n'), ((1250, 1272), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (126... |
import unittest
import os
import numpy as np
from skimage.io import imread, imsave
from skimage import img_as_float64
from shutil import rmtree
from sigback.processing import measure
class MeasureTest(unittest.TestCase):
test_data_path = './sigback/processing/tests/data'
def setUp(self):
test_dir = ... | [
"unittest.main",
"os.mkdir",
"sigback.processing.measure.minmax",
"skimage.io.imsave",
"os.path.exists",
"numpy.random.rand",
"shutil.rmtree",
"os.path.join"
] | [((1662, 1677), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1675, 1677), False, 'import unittest\n'), ((320, 364), 'os.path.join', 'os.path.join', (['self.test_data_path', '"""img_dir"""'], {}), "(self.test_data_path, 'img_dir')\n", (332, 364), False, 'import os\n'), ((390, 440), 'os.path.join', 'os.path.join'... |
"""
Interactive image plots.
"""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Slider, Button, RadioButtons
def intimage(img, **kwargs):
"""Interactive imshow with widgets.
"""
fig, ax = plt.subplots()
plt.subplots_adjust(left=0, bottom=0.20)
im = ax.imshow(img,... | [
"matplotlib.widgets.RadioButtons",
"matplotlib.pyplot.axes",
"matplotlib.widgets.Slider",
"numpy.nanmin",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots",
"numpy.nanmax"
] | [((237, 251), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (249, 251), True, 'import matplotlib.pyplot as plt\n'), ((256, 295), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'left': '(0)', 'bottom': '(0.2)'}), '(left=0, bottom=0.2)\n', (275, 295), True, 'import matplotlib.pyplot a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:56:17 2020
@author: shah
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 13:23:58 2020
@author: shah
"""
from util import m_normal, learning_rate, get_lambda
from classes import ret
import random as random
import ... | [
"math.exp",
"util.get_lambda",
"util.learning_rate",
"numpy.linalg.norm",
"numpy.dot"
] | [((398, 413), 'util.learning_rate', 'learning_rate', ([], {}), '()\n', (411, 413), False, 'from util import m_normal, learning_rate, get_lambda\n'), ((424, 436), 'util.get_lambda', 'get_lambda', ([], {}), '()\n', (434, 436), False, 'from util import m_normal, learning_rate, get_lambda\n'), ((1662, 1676), 'numpy.dot', '... |
from __future__ import division
import argparse
from PIL import Image
import numpy as np
import gym
from keras.models import Model
from keras.layers import Flatten, Conv2D, Input, Dense
from keras.optimizers import Adam
from keras.regularizers import l2
import keras.backend as K
from rl.agents.dqn import DQfDAgent
from... | [
"rl.callbacks.TrainEpisodeLogger",
"keras.regularizers.l2",
"numpy.random.seed",
"gym.make",
"argparse.ArgumentParser",
"rl.memory.PartitionedMemory",
"rl.util.load_demo_data_from_file",
"rl.policy.EpsGreedyQPolicy",
"keras.layers.Flatten",
"keras.optimizers.Adam",
"keras.models.Model",
"rl.ca... | [((1679, 1704), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1702, 1704), False, 'import argparse\n'), ((2003, 2026), 'gym.make', 'gym.make', (['args.env_name'], {}), '(args.env_name)\n', (2011, 2026), False, 'import gym\n'), ((2027, 2046), 'numpy.random.seed', 'np.random.seed', (['(231)'], ... |
"""
Train a Noisy Logistic Regression Classifier from Training Data
"""
import argparse
import pickle
import numpy as np
from sklearn.linear_model import LogisticRegression
class NoisyLR(LogisticRegression):
def set_noise_ratio(self, noise_ratio=None):
self.noise_ratio = noise_ratio
def predict_proba... | [
"pickle.dump",
"numpy.random.binomial",
"argparse.ArgumentParser",
"numpy.random.beta",
"sklearn.linear_model.LogisticRegression",
"pickle.load"
] | [((946, 971), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (969, 971), False, 'import argparse\n'), ((1627, 1641), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1638, 1641), False, 'import pickle\n'), ((2090, 2116), 'pickle.dump', 'pickle.dump', (['classifier', 'f'], {}), '(classifier,... |
import numpy as np
from ndsimulator.potentials.potential import Potential
class Flat2d(Potential):
ndim = 2
def compute(self, x=None):
if x is None:
x = self.atoms.positions
return 0, np.zeros(x.shape)
def projection(self, X, Y):
return np.zeros(X.shape)
class Flat1... | [
"numpy.zeros"
] | [((289, 306), 'numpy.zeros', 'np.zeros', (['X.shape'], {}), '(X.shape)\n', (297, 306), True, 'import numpy as np\n'), ((454, 465), 'numpy.zeros', 'np.zeros', (['X'], {}), '(X)\n', (462, 465), True, 'import numpy as np\n'), ((223, 240), 'numpy.zeros', 'np.zeros', (['x.shape'], {}), '(x.shape)\n', (231, 240), True, 'impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.