code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
with open("input", "r") as f:
lines = f.readlines()
rules = {}
for i, line in enumerate(lines):
if line == "\n":
break
name, rest = line.strip().split(":")
range1, range2 = rest.split(" or ")
min1, max1 = range1.split("-")
min2, max2 = range2.split("-")
rules[na... | [
"numpy.array"
] | [((1066, 1087), 'numpy.array', 'np.array', (['valid_ticks'], {}), '(valid_ticks)\n', (1074, 1087), True, 'import numpy as np\n')] |
import random
import numpy as np
from collections import deque
class SumTree(object):
write = 0
def __init_(self,capacity):
self.capacity = capacity
self.tree = np.zeros(2*capacity -1 )
self.data = np.zeros(capacity, dtype=object)
def _propatate(self,idx, change):
pare... | [
"numpy.array",
"numpy.zeros",
"collections.deque",
"random.uniform"
] | [((191, 217), 'numpy.zeros', 'np.zeros', (['(2 * capacity - 1)'], {}), '(2 * capacity - 1)\n', (199, 217), True, 'import numpy as np\n'), ((236, 268), 'numpy.zeros', 'np.zeros', (['capacity'], {'dtype': 'object'}), '(capacity, dtype=object)\n', (244, 268), True, 'import numpy as np\n'), ((3047, 3078), 'numpy.array', 'n... |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from drforest.datasets import make_simulation1
from drforest.ensemble import DimensionReductionForestRegressor
from drforest.ensemble import permutation_importance
plt.rc('... | [
"matplotlib.pyplot.subplots_adjust",
"numpy.arange",
"drforest.datasets.make_simulation1",
"drforest.ensemble.DimensionReductionForestRegressor",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.sign",
"numpy.meshgrid",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rc"
] | [((312, 342), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (318, 342), True, 'import matplotlib.pyplot as plt\n'), ((398, 490), 'drforest.datasets.make_simulation1', 'make_simulation1', ([], {'n_samples': 'n_samples', 'noise': '(1)', 'n_features': 'n_featu... |
from collections import OrderedDict
import numpy as np
from multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal import AntGoalEnv
from multiworld.envs.env_util import get_stat_in_paths, create_stats_ordered_dict, get_asset_full_path
class AntGoalDisabledJointsEnv(AntGoalEnv):
def __init__(self, act... | [
"numpy.clip",
"multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal.AntGoalEnv.__init__",
"numpy.square",
"numpy.linalg.norm"
] | [((577, 685), 'multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal.AntGoalEnv.__init__', 'AntGoalEnv.__init__', (['self'], {'action_scale': 'action_scale', 'frame_skip': 'frame_skip', 'goal_position': 'goal_position'}), '(self, action_scale=action_scale, frame_skip=frame_skip,\n goal_position=goal_po... |
import numpy as np
import torch
import time
import gym
from a2c_ppo_acktr import utils
from a2c_ppo_acktr.envs import make_vec_envs
from common.common import *
import pyrobotdesign as rd
def evaluate(args, actor_critic, ob_rms, env_name, seed, num_processes, device):
eval_envs = make_vec_envs(env_name, seed + nu... | [
"numpy.mean",
"numpy.sqrt",
"time.sleep",
"a2c_ppo_acktr.utils.get_vec_normalize",
"numpy.zeros",
"pyrobotdesign.GLFWViewer",
"torch.tensor",
"numpy.linalg.norm",
"torch.no_grad",
"a2c_ppo_acktr.envs.make_vec_envs",
"time.time",
"torch.zeros"
] | [((287, 377), 'a2c_ppo_acktr.envs.make_vec_envs', 'make_vec_envs', (['env_name', '(seed + num_processes)', 'num_processes', 'None', 'None', 'device', '(True)'], {}), '(env_name, seed + num_processes, num_processes, None, None,\n device, True)\n', (300, 377), False, 'from a2c_ppo_acktr.envs import make_vec_envs\n'), ... |
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import sys
import tensorflow as tf
import matplotlib
from PIL import Image
import matplotlib.patches as patches
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
import argparse... | [
"tensorflow.Graph",
"PIL.Image.open",
"tensorflow.compat.v1.GraphDef",
"argparse.ArgumentParser",
"tensorflow.import_graph_def",
"numpy.expand_dims",
"pandas.DataFrame",
"tensorflow.compat.v2.io.gfile.GFile",
"object_detection.utils.label_map_util.load_labelmap",
"object_detection.utils.label_map_... | [((430, 455), 'glob.glob', 'glob.glob', (['"""images/*.jpg"""'], {}), "('images/*.jpg')\n", (439, 455), False, 'import glob\n'), ((527, 589), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['image', 'result', 'score', 'position']"}), "(columns=['image', 'result', 'score', 'position'])\n", (539, 589), True, 'impo... |
import numpy as np
import torch
import torchvision
from torchvision import transforms
from torch.utils.data import DataLoader, random_split
import cv2
import matplotlib.pyplot as plt
from torchvision.datasets import CIFAR10
from PIL import Image
def to_RGB(image:Image)->Image:
if image.mode == 'RGB':return image
... | [
"matplotlib.pyplot.imshow",
"cv2.open",
"cv2.merge",
"torchvision.transforms.ToPILImage",
"numpy.float32",
"PIL.Image.new",
"torchvision.transforms.Grayscale",
"matplotlib.pyplot.close",
"numpy.array",
"torchvision.datasets.CIFAR10",
"numpy.zeros",
"cv2.split",
"torch.utils.data.DataLoader",... | [((3113, 3148), 'torchvision.transforms.ToPILImage', 'torchvision.transforms.ToPILImage', ([], {}), '()\n', (3146, 3148), False, 'import torchvision\n'), ((3165, 3186), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (3184, 3186), False, 'from torchvision import transforms\n'), ((3260, 3294)... |
#Project: GBS Tool
# Author: Dr. <NAME>, <EMAIL>, denamics GmbH
# Date: January 16, 2018
# License: MIT License (see LICENSE file of this package for more information)
# Contains the main flow of the optimization as it is to be called from the GBSController.
import os
import time
import numpy as np
import pandas as ... | [
"numpy.log10",
"numpy.isfinite",
"Model.Operational.generateRuns.generateRuns",
"numpy.asarray",
"Analyzer.PerformanceAnalyzers.getFuelUse.getFuelUse",
"Analyzer.DataRetrievers.getDataSubsets.getDataSubsets",
"numpy.linspace",
"Optimizer.OptimizationBoundaryCalculators.getOptimizationBoundaries.getOpt... | [((3051, 3118), 'os.path.join', 'os.path.join', (['self.thisPath', '"""../../GBSProjects/"""', 'self.projectName'], {}), "(self.thisPath, '../../GBSProjects/', self.projectName)\n", (3063, 3118), False, 'import os\n'), ((3434, 3504), 'os.path.join', 'os.path.join', (['self.rootProjectPath', '"""InputData/Setup/"""', 'c... |
'''
Source codes for Python Machine Learning By Example 3rd Edition (Packt Publishing)
Chapter 10 Discovering Underlying Topics in the Newsgroups Dataset with Clustering and Topic Modeling
Author: Yuxi (Hayden) Liu (<EMAIL>)
'''
from sklearn import datasets
from sklearn.cluster import KMeans
import numpy as np
from... | [
"sklearn.datasets.load_iris",
"sklearn.cluster.KMeans",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.linalg.norm",
"matplotlib.pyplot.show"
] | [((361, 381), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (379, 381), False, 'from sklearn import datasets\n'), ((856, 882), 'matplotlib.pyplot.plot', 'plt.plot', (['k_list', 'sse_list'], {}), '(k_list, sse_list)\n', (864, 882), True, 'from matplotlib import pyplot as plt\n'), ((883, 893), 'ma... |
import numpy as np
import numba as nb
from scipy.stats import rankdata
from functools import partial
import os
import sys
from sklearn.base import BaseEstimator, TransformerMixin
from julia import Julia
jl = Julia(compiled_modules=False)
class ECRelieff(BaseEstimator, TransformerMixin):
"""sklearn compatible ... | [
"numpy.abs",
"numpy.float",
"numpy.unique",
"numpy.amin",
"numpy.repeat",
"numpy.argpartition",
"numpy.where",
"numpy.log",
"julia.Julia",
"numpy.sum",
"numpy.zeros",
"numpy.int",
"numpy.empty",
"numpy.vstack",
"os.path.abspath",
"numpy.amax",
"numpy.arange"
] | [((211, 240), 'julia.Julia', 'Julia', ([], {'compiled_modules': '(False)'}), '(compiled_modules=False)\n', (216, 240), False, 'from julia import Julia\n'), ((1211, 1236), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1226, 1236), False, 'import os\n'), ((3497, 3540), 'numpy.unique', 'np.uni... |
# 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... | [
"argparse.ArgumentParser",
"mindspore.context.set_context",
"mindspore.train.serialization.load_checkpoint",
"numpy.zeros",
"src.resnet.resnet152",
"mindspore.train.serialization.export"
] | [((1031, 1087), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""resnet152 export """'}), "(description='resnet152 export ')\n", (1054, 1087), False, 'import argparse\n'), ((1866, 1944), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_tar... |
#######################################################
#Reference: https://github.com/experiencor/keras-yolo3#
#######################################################
import numpy as np
import os
import cv2
from scipy.special import expit
class BoundBox:
def __init__(self, xmin, ymin, xmax, ymax, c = None, class... | [
"numpy.argmax",
"scipy.special.expit",
"numpy.exp",
"numpy.zeros",
"numpy.argsort",
"numpy.expand_dims",
"numpy.finfo",
"numpy.maximum",
"numpy.full",
"cv2.resize",
"numpy.amax"
] | [((950, 958), 'scipy.special.expit', 'expit', (['x'], {}), '(x)\n', (955, 958), False, 'from scipy.special import expit\n'), ((1040, 1049), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (1046, 1049), True, 'import numpy as np\n'), ((1243, 1268), 'cv2.resize', 'cv2.resize', (['img', '(nw, nh)'], {}), '(img, (nw, nh))\n',... |
import numpy as np
import cv2
img = cv2.imread('images/plane_noisy.png', cv2.IMREAD_GRAYSCALE)
img_out = img.copy()
height = img.shape[0]
width = img.shape[1]
for i in np.arange(3, height-3):
for j in np.arange(3, width-3):
neighbors = []
for k in np.arange(-3, 4):
for l ... | [
"cv2.imwrite",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.waitKey",
"numpy.arange",
"cv2.imread"
] | [((40, 98), 'cv2.imread', 'cv2.imread', (['"""images/plane_noisy.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('images/plane_noisy.png', cv2.IMREAD_GRAYSCALE)\n", (50, 98), False, 'import cv2\n'), ((180, 204), 'numpy.arange', 'np.arange', (['(3)', '(height - 3)'], {}), '(3, height - 3)\n', (189, 204), True, 'import numpy as... |
# coding: utf-8
# Copyright (c) Materials Virtual Lab
# Distributed under the terms of the BSD License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import itertools
import subprocess
import io
import re
import numpy as np
import pandas as pd
from monty.io import zopen
from... | [
"veidt.potential.lammps.calcs.SpectralNeighborAnalysis",
"numpy.unique",
"veidt.potential.soap.SOAPotential",
"veidt.potential.nnp.NNPotential",
"monty.os.path.which",
"re.compile",
"monty.io.zopen",
"itertools.combinations_with_replacement",
"numpy.exp",
"numpy.array",
"veidt.potential.processi... | [((1991, 2094), 'veidt.potential.lammps.calcs.SpectralNeighborAnalysis', 'SpectralNeighborAnalysis', (['rcutfac', 'twojmax', 'element_profile', 'rfac0', 'rmin0', 'diagonalstyle', 'quadratic'], {}), '(rcutfac, twojmax, element_profile, rfac0, rmin0,\n diagonalstyle, quadratic)\n', (2015, 2094), False, 'from veidt.pot... |
import batoid
import numpy as np
from test_helpers import timer, do_pickle
@timer
def test_sag():
import random
random.seed(57)
for i in range(100):
plane = batoid.Plane()
for j in range(10):
x = random.gauss(0.0, 1.0)
y = random.gauss(0.0, 1.0)
result =... | [
"numpy.random.normal",
"batoid.Ray",
"batoid.Plane",
"test_helpers.do_pickle",
"numpy.testing.assert_allclose",
"batoid.RayVector",
"random.seed",
"random.gauss"
] | [((122, 137), 'random.seed', 'random.seed', (['(57)'], {}), '(57)\n', (133, 137), False, 'import random\n'), ((904, 920), 'random.seed', 'random.seed', (['(577)'], {}), '(577)\n', (915, 920), False, 'import random\n'), ((1529, 1546), 'random.seed', 'random.seed', (['(5772)'], {}), '(5772)\n', (1540, 1546), False, 'impo... |
import numpy as np
import pandas as pd
import dask.dataframe as dd
import dask.array as da
import matplotlib.pyplot as plt
import seaborn as sns
from dask.diagnostics import ProgressBar
ProgressBar().register()
dists = np.load('saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy')
ranks = np.load('saved_tensors/... | [
"dask.array.stack",
"dask.array.from_array",
"matplotlib.pyplot.savefig",
"seaborn.scatterplot",
"dask.diagnostics.ProgressBar",
"numpy.load",
"matplotlib.pyplot.subplots",
"numpy.arange",
"dask.dataframe.from_array"
] | [((220, 288), 'numpy.load', 'np.load', (['"""saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy"""'], {}), "('saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy')\n", (227, 288), True, 'import numpy as np\n'), ((297, 365), 'numpy.load', 'np.load', (['"""saved_tensors/java-huge-bpe-2000/test_proj_rank_cach... |
import cv2
import numpy as np
from pathfinding.domain.coord import Coord
from vision.domain.iCameraCalibration import ICameraCalibration, table_width_mm, table_height_mm, obstacle_height_mm, \
robot_height_mm
from vision.domain.iPlayAreaFinder import IPlayAreaFinder
from vision.domain.image import Image
from visio... | [
"numpy.multiply",
"vision.infrastructure.cvImageDisplay.CvImageDisplay",
"cv2.undistort",
"pathfinding.domain.coord.Coord",
"cv2.getOptimalNewCameraMatrix",
"numpy.array",
"numpy.linalg.inv"
] | [((665, 681), 'vision.infrastructure.cvImageDisplay.CvImageDisplay', 'CvImageDisplay', ([], {}), '()\n', (679, 681), False, 'from vision.infrastructure.cvImageDisplay import CvImageDisplay\n'), ((870, 983), 'cv2.getOptimalNewCameraMatrix', 'cv2.getOptimalNewCameraMatrix', (['self._camera_matrix', 'self._distortion_coef... |
#!/usr/bin/env python
import sys, os
import argparse
import numpy as np
#import atomsinmolecule as mol
import topology as topo
import math
import pandas as pd
class topologyDiff(object):
def __init__(self, molecule1, molecule2, covRadFactor=1.3):
errors = {}
requirements_for_comparison(molecule1, ... | [
"argparse.FileType",
"topology.topology",
"argparse.ArgumentParser",
"json.dumps",
"xyz2molecule.parse_XYZ",
"numpy.subtract",
"numpy.array",
"numpy.sign",
"sys.exit",
"pandas.DataFrame"
] | [((11784, 11809), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (11807, 11809), False, 'import argparse\n'), ((13567, 13595), 'xyz2molecule.parse_XYZ', 'xyz.parse_XYZ', (['path_to_file1'], {}), '(path_to_file1)\n', (13580, 13595), True, 'import xyz2molecule as xyz\n'), ((13612, 13640), 'xyz2mo... |
import numpy as np
import cv2 as cv
def visualizador(complexo_img):
magnitude = np.log(np.abs(complexo_img) + 10**-10)
magnitude = magnitude / np.max(magnitude)
fase = (np.angle(complexo_img) + np.pi) / (np.pi * 2)
return magnitude, fase
def dft_np(img, vis=False, shift=False):
complexo = np.f... | [
"numpy.sqrt",
"numpy.log",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.getBuildInformation",
"numpy.tanh",
"numpy.fft.fft2",
"numpy.max",
"numpy.real",
"numpy.exp",
"numpy.min",
"cv2.waitKey",
"numpy.abs",
"cv2.cvtColor",
"cv2.createTrackbar",
"cv2.namedWindow",
"numpy.fft.ifft2",
... | [((316, 332), 'numpy.fft.fft2', 'np.fft.fft2', (['img'], {}), '(img)\n', (327, 332), True, 'import numpy as np\n'), ((650, 672), 'numpy.fft.ifft2', 'np.fft.ifft2', (['complexo'], {}), '(complexo)\n', (662, 672), True, 'import numpy as np\n'), ((683, 700), 'numpy.real', 'np.real', (['img_comp'], {}), '(img_comp)\n', (69... |
"""
Created on Mon Apr 23 16:35:00 2018
@author: jercas
"""
import numpy as np
def stepBased_decay(epoch):
# Initialize the base initial learning rate α, drop factor and epochs to drop every set of epochs.
initialAlpha = 0.01
# Drop learning rate by a factor of 0.25 every 5 epochs.
factor = 0.5
#factor = 0.5
dr... | [
"numpy.floor"
] | [((416, 449), 'numpy.floor', 'np.floor', (['((1 + epoch) / dropEvery)'], {}), '((1 + epoch) / dropEvery)\n', (424, 449), True, 'import numpy as np\n')] |
"""개미집단 최적화
"""
import matplotlib.pyplot as plt
import numpy as np
area = np.ones([20, 20]) # 지역 생성
start = (1, 1) # 개미 출발지점
goal = (19, 14) # 도착해야 하는 지점
path_count = 40 # 경로를 만들 개미 수
path_max_len = 20 * 20 # 최대 경로 길이
pheromone = 1.0 # 페로몬 가산치
volatility = 0.3 # 스탭 당 페로몬 휘발율
def get_neighbors(x, y):
"""x... | [
"matplotlib.pyplot.imshow",
"numpy.ones",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.sum",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show"
] | [((75, 92), 'numpy.ones', 'np.ones', (['[20, 20]'], {}), '([20, 20])\n', (82, 92), True, 'import numpy as np\n'), ((1752, 1782), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""b"""'], {'alpha': '(0.3)'}), "(x, y, 'b', alpha=0.3)\n", (1760, 1782), True, 'import matplotlib.pyplot as plt\n'), ((1787, 1820), 'matplo... |
import pytest
import numpy as np
import multiprocess as mp
from ecogdata.parallel.jobrunner import JobRunner, ParallelWorker
from ecogdata.parallel.mproc import parallel_context
from . import with_start_methods
@with_start_methods
def test_process_types():
jr = JobRunner(np.var)
# create 3 workers and check t... | [
"numpy.random.randint",
"pytest.raises",
"numpy.isnan",
"ecogdata.parallel.jobrunner.JobRunner",
"numpy.arange"
] | [((268, 285), 'ecogdata.parallel.jobrunner.JobRunner', 'JobRunner', (['np.var'], {}), '(np.var)\n', (277, 285), False, 'from ecogdata.parallel.jobrunner import JobRunner, ParallelWorker\n'), ((955, 985), 'ecogdata.parallel.jobrunner.JobRunner', 'JobRunner', (['np.sum'], {'n_workers': '(4)'}), '(np.sum, n_workers=4)\n',... |
#!/usr/bin/python
import os
import matplotlib.pyplot as plt
import numpy as np
from post_process import load
# from scipy.stats import iqr
class InformationCapacity(object):
def __init__(self, foreign_directory="./", self_directory="./", estimator='fd', limiting='foreign'):
self.num_steps = 1
... | [
"os.path.exists",
"numpy.histogram",
"numpy.mean",
"matplotlib.pyplot.hist",
"numpy.trapz",
"numpy.log2",
"post_process.load",
"numpy.loadtxt",
"matplotlib.pyplot.legend"
] | [((9159, 9186), 'numpy.loadtxt', 'np.loadtxt', (['"""L_self/output"""'], {}), "('L_self/output')\n", (9169, 9186), True, 'import numpy as np\n'), ((9217, 9260), 'numpy.loadtxt', 'np.loadtxt', (['"""3_step_end_step/L_self/output"""'], {}), "('3_step_end_step/L_self/output')\n", (9227, 9260), True, 'import numpy as np\n'... |
from __future__ import print_function
import matplotlib as plt
import numpy as np
from skimage.io import imread
from skimage import exposure, color
from skimage.transform import resize
import keras
from keras import backend as K
from keras.datasets import cifar10
from keras.models import Sequential
from keras.layers i... | [
"keras.layers.Conv2D",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"keras.preprocessing.image.ImageDataGenerator",
"skimage.exposure.equalize_adapthist",
"numpy.array",
"keras.layers.Dense",
"keras.optimizers.Adadelta",
"matplotlib.pyplot.imshow",
"keras.backend.image_data_format",
"ma... | [((472, 493), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (486, 493), False, 'import matplotlib\n'), ((1701, 1722), 'skimage.io.imread', 'imread', (['"""img/cat.jpg"""'], {}), "('img/cat.jpg')\n", (1707, 1722), False, 'from skimage.io import imread\n'), ((1723, 1738), 'matplotlib.pyplot.imshow... |
import numpy
def scale_array(arr, scale):
if (scale != int(scale)) or (scale < 1):
raise RuntimeError("scale={!r} must be a positive integer".format(scale))
elif scale == 1:
return arr
if len(arr.shape) == 2:
result = numpy.zeros(
(arr.shape[0] * scale, arr.shape[1] * sc... | [
"numpy.array",
"numpy.zeros"
] | [((255, 329), 'numpy.zeros', 'numpy.zeros', (['(arr.shape[0] * scale, arr.shape[1] * scale)'], {'dtype': 'arr.dtype'}), '((arr.shape[0] * scale, arr.shape[1] * scale), dtype=arr.dtype)\n', (266, 329), False, 'import numpy\n'), ((3926, 4189), 'numpy.array', 'numpy.array', (['((0, 0, 0, 0, 0), (0, 0, 0, 0, 0), (0, 0, 0, ... |
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request
import os,shutil
import numpy as np
import json
import collections
import time
# import tensorflow as tf
import argparse
import sys
import face_model
from flask_cors import *
import cv2
from annoy import AnnoyIndex
import datetime
import random... | [
"json.JSONEncoder.default",
"flask.Flask",
"numpy.array",
"flaskext.mysql.MySQL",
"os.walk",
"argparse.ArgumentParser",
"json.dumps",
"flask.request.form.get",
"numpy.frombuffer",
"random.randint",
"annoy.AnnoyIndex",
"collections.OrderedDict",
"flask.request.get_json",
"cv2.cvtColor",
"... | [((470, 477), 'flaskext.mysql.MySQL', 'MySQL', ([], {}), '()\n', (475, 477), False, 'from flaskext.mysql import MySQL\n'), ((484, 499), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (489, 499), False, 'from flask import Flask, render_template, request\n'), ((18039, 18065), 'face_model.FaceModel', 'face_mo... |
import numpy as np
import os
import math
import dtdata as dt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from keras.models import Model
from keras.layers import Dense, Activation, Dropout, Input
from keras.models import load_model
import matplotlib.pyplot as plt... | [
"keras.models.load_model",
"numpy.reshape",
"dtdata.centerAroundEntry",
"sklearn.model_selection.train_test_split",
"math.floor",
"matplotlib.pyplot.legend",
"os.path.join",
"sklearn.preprocessing.StandardScaler",
"os.path.isfile",
"keras.layers.Input",
"numpy.array",
"dtdata.loadData",
"num... | [((827, 843), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (841, 843), False, 'from sklearn.preprocessing import StandardScaler\n'), ((1228, 1256), 'keras.models.load_model', 'load_model', (['autoencoder_path'], {}), '(autoencoder_path)\n', (1238, 1256), False, 'from keras.models import l... |
import os
import json
import numpy as np
import scipy.sparse as sp
from src.model.linear_svm import LinearSVM
from src.model.random_forest import RandomForest
from src.metric.uar import get_UAR, get_post_probability, get_late_fusion_UAR
from src.utils.io import load_proc_baseline_feature, save_UAR_results
from src.uti... | [
"src.metric.uar.get_UAR",
"numpy.hstack",
"src.utils.io.load_proc_baseline_feature",
"src.model.random_forest.RandomForest",
"src.utils.preprocess.upsample",
"numpy.array",
"numpy.vstack",
"numpy.ravel",
"src.utils.io.save_cv_results",
"scipy.sparse.csr_matrix",
"src.model.linear_svm.LinearSVM",... | [((2882, 2930), 'src.utils.io.load_proc_baseline_feature', 'load_proc_baseline_feature', (['"""MFCC"""'], {'verbose': '(True)'}), "('MFCC', verbose=True)\n", (2908, 2930), False, 'from src.utils.io import load_proc_baseline_feature, save_UAR_results\n'), ((4209, 4247), 'src.utils.preprocess.upsample', 'upsample', (['X_... |
import logging
from pathlib import Path
from typing import List, Optional
import jax
import numpy as np
import wandb
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightning.loggers.base import DummyLogger
from tqdm import tqdm
from fourierflow.callbacks import Callback
from .jax_callback_hook impor... | [
"logging.getLogger",
"wandb.Table",
"numpy.isscalar",
"pathlib.Path",
"tqdm.tqdm",
"jax.jit",
"pytorch_lightning.loggers.base.DummyLogger"
] | [((357, 384), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (374, 384), False, 'import logging\n'), ((1643, 1664), 'jax.jit', 'jax.jit', (['routine.step'], {}), '(routine.step)\n', (1650, 1664), False, 'import jax\n'), ((1040, 1063), 'pathlib.Path', 'Path', (['weights_save_path'], {}), '... |
#!/usr/bin/env python3
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
from conban_spanet.dataset_driver import DatasetDriver
from .utils import test_oracle
from bite_selection_package.config import spanet_config as config
N... | [
"numpy.random.choice",
"numpy.sum",
"numpy.ones",
"conban_spanet.dataset_driver.DatasetDriver"
] | [((504, 523), 'numpy.ones', 'np.ones', (['(N, d + 1)'], {}), '((N, d + 1))\n', (511, 523), True, 'import numpy as np\n'), ((545, 561), 'conban_spanet.dataset_driver.DatasetDriver', 'DatasetDriver', (['N'], {}), '(N)\n', (558, 561), False, 'from conban_spanet.dataset_driver import DatasetDriver\n'), ((1776, 1811), 'nump... |
import numpy as np
import pandas as pd
import os
def read_data():
# set path to raw data
raw_data_path = os.path.join(os.path.pardir,'data','raw')
train_file_path = os.path.join(raw_data_path,'train.csv')
test_file_path = os.path.join(raw_data_path,'test.csv')
# read data with default parameters
... | [
"pandas.read_csv",
"pandas.qcut",
"numpy.where",
"os.path.join",
"pandas.notnull",
"pandas.concat"
] | [((114, 157), 'os.path.join', 'os.path.join', (['os.path.pardir', '"""data"""', '"""raw"""'], {}), "(os.path.pardir, 'data', 'raw')\n", (126, 157), False, 'import os\n'), ((178, 218), 'os.path.join', 'os.path.join', (['raw_data_path', '"""train.csv"""'], {}), "(raw_data_path, 'train.csv')\n", (190, 218), False, 'import... |
from functools import wraps
from typing import List, Callable
import numpy as np
LETTER_SIGNATURE = "fruits_letter"
LETTER_NAME = "fruits_name"
BOUND_LETTER_TYPE = Callable[[np.ndarray, int], np.ndarray]
FREE_LETTER_TYPE = Callable[[int], BOUND_LETTER_TYPE]
class ExtendedLetter:
"""Class for an extended letter... | [
"numpy.abs",
"functools.wraps"
] | [((7192, 7207), 'numpy.abs', 'np.abs', (['X[i, :]'], {}), '(X[i, :])\n', (7198, 7207), True, 'import numpy as np\n'), ((4922, 4936), 'functools.wraps', 'wraps', (['args[0]'], {}), '(args[0])\n', (4927, 4936), False, 'from functools import wraps\n'), ((5436, 5447), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n',... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import matplotlib.pyplot as plt
import numpy as np
import PIL
import tensorflow as tf
from keras import backend as K
from keras.layers import Input, Lambda, Conv2D
from keras.models import load_model, Model
from keras.callbacks import TensorBoard, ModelCheck... | [
"os.listdir",
"pandas.read_csv",
"numpy.array",
"pandas.DataFrame",
"pandas.concat"
] | [((823, 868), 'pandas.read_csv', 'pd.read_csv', (['"""../Data/LOC_train_solution.csv"""'], {}), "('../Data/LOC_train_solution.csv')\n", (834, 868), True, 'import pandas as pd\n'), ((976, 1013), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Id', 'names']"}), "(columns=['Id', 'names'])\n", (988, 1013), True, 'i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Authors: <NAME>, <NAME>, <NAME>, <NAME>
Date created: 12/8/2016 (original)
Date last modified: 05/25/2018
"""
__version__ = "1.3"
from time import sleep,time
from logging import debug,info,warn,error
import logging
from thread import start_new_thread
import traceback
im... | [
"logging.basicConfig",
"traceback.format_exc",
"platform.node",
"logging.debug",
"socket.socket",
"numpy.random.rand",
"cavro_centris_syringe_pump_LL.driver.valve_get",
"msgpack.packb",
"time.sleep",
"cavro_centris_syringe_pump_LL.driver.discover",
"msgpack.unpackb",
"platform.system",
"os.g... | [((2291, 2306), 'platform.node', 'platform.node', ([], {}), '()\n', (2304, 2306), False, 'import platform\n'), ((455, 466), 'os.getpid', 'os.getpid', ([], {}), '()\n', (464, 466), False, 'import psutil, os\n'), ((727, 744), 'platform.system', 'platform.system', ([], {}), '()\n', (742, 744), False, 'import platform\n'),... |
import mock
import numpy as np
import pytest
import pypylon.pylon
import pypylon.genicam
import piescope.data
import piescope.lm.volume
from piescope.lm.detector import Basler
from piescope.lm.objective import StageController
pytest.importorskip('pypylon', reason="The pypylon library is not available.")
def test_... | [
"piescope.lm.objective.StageController",
"mock.patch",
"numpy.allclose",
"mock.patch.object",
"numpy.stack",
"piescope.lm.detector.Basler",
"pytest.importorskip"
] | [((230, 308), 'pytest.importorskip', 'pytest.importorskip', (['"""pypylon"""'], {'reason': '"""The pypylon library is not available."""'}), "('pypylon', reason='The pypylon library is not available.')\n", (249, 308), False, 'import pytest\n'), ((730, 775), 'mock.patch.object', 'mock.patch.object', (['StageController', ... |
import numpy as np
from os import chdir
#wd="/Users/moudiki/Documents/Python_Packages/teller"
#
#chdir(wd)
import teller as tr
import pandas as pd
from sklearn import datasets
import numpy as np
from sklearn import datasets
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ... | [
"sklearn.ensemble.RandomForestRegressor",
"sklearn.model_selection.train_test_split",
"numpy.delete",
"sklearn.datasets.load_boston",
"teller.Explainer"
] | [((362, 384), 'sklearn.datasets.load_boston', 'datasets.load_boston', ([], {}), '()\n', (382, 384), False, 'from sklearn import datasets\n'), ((389, 418), 'numpy.delete', 'np.delete', (['boston.data', '(11)', '(1)'], {}), '(boston.data, 11, 1)\n', (398, 418), True, 'import numpy as np\n'), ((587, 642), 'sklearn.model_s... |
##############################################################################
#
# <NAME>
# <EMAIL>
#
# References:
# SuperDataScience,
# Official Documentation
#
#
##############################################################################
# Importing the libraries
import numpy as np
impo... | [
"numpy.unique",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"sklearn.naive_bayes.GaussianNB",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"sklearn.metrics.classification_report",
"matplotlib.colors.ListedColormap",
"matplotlib.pyplot.title",
... | [((2492, 2518), 'pandas.read_csv', 'pd.read_csv', (['"""Circles.csv"""'], {}), "('Circles.csv')\n", (2503, 2518), True, 'import pandas as pd\n'), ((2776, 2796), 'matplotlib.pyplot.title', 'plt.title', (['"""Dataset"""'], {}), "('Dataset')\n", (2785, 2796), True, 'import matplotlib.pyplot as plt\n'), ((2797, 2813), 'mat... |
#!/usr/bin/python3
import numpy as np
import PIL.Image
#infile = 'CHX_Eiger1M_blemish2-mask.npy'
infile = 'CHX_Eiger1M_flatfield.npy'
outfile = infile[:-4] + '.png'
pixmask = np.load(infile)
#pixmask = pixmask < 1
#img = np.where( pixmask<1, 255, 0)
#img = np.where( pixmask<1, 0, 255)
img = np.where( pixmask<0.1, ... | [
"numpy.where",
"numpy.uint8",
"numpy.load"
] | [((179, 194), 'numpy.load', 'np.load', (['infile'], {}), '(infile)\n', (186, 194), True, 'import numpy as np\n'), ((297, 328), 'numpy.where', 'np.where', (['(pixmask < 0.1)', '(0)', '(255)'], {}), '(pixmask < 0.1, 0, 255)\n', (305, 328), True, 'import numpy as np\n'), ((356, 369), 'numpy.uint8', 'np.uint8', (['img'], {... |
#-*-coding:utf-8-*-
# date:2020-03-02
# Author: X.li
# function: inference & eval CenterNet only support resnet backbone
import os
import glob
import cv2
import numpy as np
import time
import shutil
import torch
import json
import matplotlib.pyplot as plt
from data_iterator import LoadImagesAndLabels
from models.decod... | [
"cv2.rectangle",
"matplotlib.pyplot.grid",
"pycocotools.cocoeval.COCOeval",
"matplotlib.pyplot.ylabel",
"torch.from_numpy",
"cv2.imshow",
"torch.cuda.synchronize",
"numpy.array",
"torch.cuda.is_available",
"numpy.arange",
"os.path.exists",
"os.listdir",
"pycocotools.coco.getImgIds",
"numpy... | [((1023, 1049), 'numpy.arange', 'np.arange', (['(0.0)', '(1.01)', '(0.01)'], {}), '(0.0, 1.01, 0.01)\n', (1032, 1049), True, 'import numpy as np\n'), ((1054, 1074), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""recall"""'], {}), "('recall')\n", (1064, 1074), True, 'import matplotlib.pyplot as plt\n'), ((1079, 1102), ... |
import naturalize.crossover.core as c
import naturalize.crossover.strategies as st
from naturalize.solutionClass import Individual
import numpy as np
import pytest
# from naturalize.crossover.strategies import crossGene, basicCrossover
from naturalize.solutionClass import Individual
import numpy as np
np.random.s... | [
"naturalize.crossover.core.getCrossover",
"numpy.empty",
"numpy.random.seed",
"naturalize.solutionClass.Individual",
"numpy.all",
"naturalize.crossover.strategies.crossGeneSingleCut"
] | [((309, 327), 'numpy.random.seed', 'np.random.seed', (['(25)'], {}), '(25)\n', (323, 327), True, 'import numpy as np\n'), ((374, 385), 'numpy.empty', 'np.empty', (['(5)'], {}), '(5)\n', (382, 385), True, 'import numpy as np\n'), ((394, 405), 'numpy.empty', 'np.empty', (['(5)'], {}), '(5)\n', (402, 405), True, 'import n... |
import numpy as np
def one_of_k_encoding(x, allowable_set):
if x not in allowable_set:
raise Exception("input {0} not in allowable set{1}:".format(
x, allowable_set))
return list(map(lambda s: x == s, allowable_set))
def one_of_k_encoding_unk(x, allowable_set):
"""Maps inputs not in t... | [
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((524, 542), 'numpy.array', 'np.array', (['len_list'], {}), '(len_list)\n', (532, 542), True, 'import numpy as np\n'), ((559, 575), 'numpy.sum', 'np.sum', (['len_list'], {}), '(len_list)\n', (565, 575), True, 'import numpy as np\n'), ((776, 796), 'numpy.array', 'np.array', (['len_matrix'], {}), '(len_matrix)\n', (784,... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
from IMLearn.learners.classifiers import GaussianNaiveBayes, LDA, Perceptron
import numpy as np
# Ex 1
# x = np.array([1, 5, 2, 3, 8, -4, -2, 5, 1, 10, -10, 4, 5, 2, 7, 1, 1, 3, 2, -1, -3, 1, -4, 1, 2, 1,
# -4, -4, 1, 3, 2, 6, -6... | [
"numpy.array",
"IMLearn.learners.classifiers.GaussianNaiveBayes"
] | [((588, 622), 'numpy.array', 'np.array', (['[0, 0, 1, 1, 1, 1, 2, 2]'], {}), '([0, 0, 1, 1, 1, 1, 2, 2])\n', (596, 622), True, 'import numpy as np\n'), ((634, 668), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7])\n', (642, 668), True, 'import numpy as np\n'), ((680, 700), 'IML... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 17:04:02 2019
@author: jessi
Example of use:--input-file ./prueba1/teclado_ISSA_63_2019-04-25T08_33_54.975Z_sp.wav --xCoor 0.6052 --yCoor -0.5411 --zCoor 0.5828
"""
import os
import argparse
import numpy as np
from scipy.io import wavfile
from hmmlearn... | [
"hmmlearn.hmm.GaussianHMM",
"argparse.ArgumentParser",
"sklearn.externals.joblib.load",
"python_speech_features.mfcc",
"numpy.array",
"scipy.io.wavfile.read",
"numpy.linalg.norm",
"numpy.seterr"
] | [((489, 553), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Trains the HMM classifier"""'}), "(description='Trains the HMM classifier')\n", (512, 553), False, 'import argparse\n'), ((2076, 2131), 'sklearn.externals.joblib.load', 'joblib.load', (['"""./classifier/2019-Sonidos-Marcela-v1.... |
from .plotter import Plotter
from matplotlib import pyplot as plt
import pandas as pd
import logging
import numpy as np
import seaborn as sns
class LinePlotter(Plotter):
def plot_group(self, data, x, y, label, ax, xpid=None, read_every=1, smooth_window=10, align_x=1, alpha=0.4, linewidth=3):
color = next... | [
"seaborn.lineplot",
"numpy.argsort",
"logging.critical",
"pandas.DataFrame",
"numpy.take_along_axis",
"pandas.concat",
"matplotlib.pyplot.subplots"
] | [((1980, 1998), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (1992, 1998), True, 'import pandas as pd\n'), ((1091, 1110), 'pandas.concat', 'pd.concat', (['all_data'], {}), '(all_data)\n', (1100, 1110), True, 'import pandas as pd\n'), ((1356, 1460), 'seaborn.lineplot', 'sns.lineplot', ([], {'data': 'd... |
import matplotlib.pyplot as plt
import numpy as np
class utilsClass:
def pdfFunction():
sample = np.random.normal(size=1000)
plt.hist(sample, bins=20)
plt.show()
sample_mean = np.mean(sample)
sample_std = np.std(sample)
print(sample_mean)
print(sample_std)... | [
"numpy.random.normal",
"numpy.mean",
"matplotlib.pyplot.hist",
"numpy.power",
"numpy.linspace",
"numpy.std",
"matplotlib.pyplot.show"
] | [((111, 138), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(1000)'}), '(size=1000)\n', (127, 138), True, 'import numpy as np\n'), ((148, 173), 'matplotlib.pyplot.hist', 'plt.hist', (['sample'], {'bins': '(20)'}), '(sample, bins=20)\n', (156, 173), True, 'import matplotlib.pyplot as plt\n'), ((182, 192), 'm... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 19 16:52:59 2018
@author: <NAME>
"""
def ann_module(input_data,output_data,reckon,num_hidden,coef,nr_epochs,val_samples,test_samples,directory,columnst,col,row,flag_train):
import numpy as np
import math
import matplotlib
matplotlib.use('agg')
im... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"math.floor",
"numpy.array",
"numpy.linalg.norm",
"numpy.nanmin",
"math.exp",
"numpy.arange",
"numpy.mean",
"numpy.reshape",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.empty",
"os.mkdir",
"numpy.concate... | [((292, 313), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (306, 313), False, 'import matplotlib\n'), ((404, 423), 'os.mkdir', 'os.mkdir', (['directory'], {}), '(directory)\n', (412, 423), False, 'import os\n'), ((478, 512), 'numpy.zeros', 'np.zeros', (['(1, input_data.shape[1])'], {}), '((1, i... |
"""Tests for wrapper submodule."""
import numpy as np
from pspca import PSPCA
def test_interface():
"""Test scikit-learn interface."""
points = np.array(
[
[np.sqrt(0.5), np.sqrt(0.5), 0],
[-np.sqrt(0.5), np.sqrt(0.5), 0],
]
)
dim = 3
reducer = PSPCA(dim)
... | [
"numpy.sqrt",
"numpy.eye",
"pspca.PSPCA"
] | [((309, 319), 'pspca.PSPCA', 'PSPCA', (['dim'], {}), '(dim)\n', (314, 319), False, 'from pspca import PSPCA\n'), ((387, 396), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (393, 396), True, 'import numpy as np\n'), ((188, 200), 'numpy.sqrt', 'np.sqrt', (['(0.5)'], {}), '(0.5)\n', (195, 200), True, 'import numpy as np\... |
import numpy as np
lst = [[1, 3, 4], [2, 8, 9]]
a = np.size(lst)
a_ = np.array(lst).size
b = np.shape(lst)
b_ = np.array(lst).shape
c = np.ndim(lst)
c_ = np.array(lst).ndim
d = np.dtype(lst)
d_ = np.array(lst).dtype
# show_store()
| [
"numpy.shape",
"numpy.size",
"numpy.ndim",
"numpy.array",
"numpy.dtype"
] | [((53, 65), 'numpy.size', 'np.size', (['lst'], {}), '(lst)\n', (60, 65), True, 'import numpy as np\n'), ((94, 107), 'numpy.shape', 'np.shape', (['lst'], {}), '(lst)\n', (102, 107), True, 'import numpy as np\n'), ((137, 149), 'numpy.ndim', 'np.ndim', (['lst'], {}), '(lst)\n', (144, 149), True, 'import numpy as np\n'), (... |
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2019 <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... | [
"numpy.random.normal",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"pandas.DataFrame",
"pyflux.VAR"
] | [((1774, 1809), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'columns'}), '(data, columns=columns)\n', (1786, 1809), True, 'import pandas as pd\n'), ((1822, 1858), 'pyflux.VAR', 'pf.VAR', ([], {'data': 'data', 'lags': 'training_lag'}), '(data=data, lags=training_lag)\n', (1828, 1858), True, 'import pyflux... |
from unittest import TestCase
import numpy as np
import toolkit.metrics as metrics
class TestMotion(TestCase):
def test_true_positives(self):
y_true = np.array([[1, 1, 1, 1],
[1, 0, 1, 1],
[0, 0, 0, 1]])
y_pred = np.array([[0, 1, 1, 1],
... | [
"numpy.array",
"toolkit.metrics.multilabel_tp_fp_tn_fn_scores"
] | [((167, 219), 'numpy.array', 'np.array', (['[[1, 1, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1]]'], {}), '([[1, 1, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1]])\n', (175, 219), True, 'import numpy as np\n'), ((291, 343), 'numpy.array', 'np.array', (['[[0, 1, 1, 1], [0, 1, 1, 1], [0, 1, 0, 1]]'], {}), '([[0, 1, 1, 1], [0, 1, 1, 1], [0, 1, ... |
#!/usr/bin/env python
"""
A service like daemon for calculating components of the gradient
"""
# pylint: disable=invalid-name, unused-import, multiple-imports
import platform
import numpy as np
import uuid
import sys, time, os, atexit, json
from SparseSC.cli.daemon import Daemon
from yaml import load, dump
import tempf... | [
"os.path.exists",
"json.loads",
"os.listdir",
"os.join",
"yaml.dump",
"json.dumps",
"os.path.join",
"yaml.load",
"numpy.ix_",
"uuid.uuid4",
"numpy.zeros",
"os.mkfifo",
"sys.stdout.flush",
"atexit.register",
"os.remove"
] | [((1455, 1473), 'numpy.zeros', 'np.zeros', (['(N0, N1)'], {}), '((N0, N1))\n', (1463, 1473), True, 'import numpy as np\n'), ((9152, 9174), 'os.mkfifo', 'os.mkfifo', (['RETURN_FIFO'], {}), '(RETURN_FIFO)\n', (9161, 9174), False, 'import sys, time, os, atexit, json\n'), ((9260, 9284), 'atexit.register', 'atexit.register'... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import pytest
import numpy as np
import nilearn
from mne import Covariance
from mne.simulation import add_noise
from mne_nirs.experimental_design import make_first_level_design_matrix
from mne_nirs.statistics import run_GLM
from mne_nirs.simulation import simul... | [
"mne_nirs.simulation.simulate_nirs_raw",
"pytest.mark.filterwarnings",
"numpy.ones",
"mne.simulation.add_noise",
"mne_nirs.statistics.run_GLM",
"mne_nirs.experimental_design.make_first_level_design_matrix"
] | [((416, 492), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:.*nilearn.glm module is experimental.*:"""'], {}), "('ignore:.*nilearn.glm module is experimental.*:')\n", (442, 492), False, 'import pytest\n'), ((523, 567), 'mne_nirs.simulation.simulate_nirs_raw', 'simulate_nirs_raw', ([], {'sig_d... |
import pytesseract
import cv2
from pytesseract import Output
import numpy as np
import os
from tqdm import tqdm
CHAR_MAP = {
'"': (0, 255, 0),
'#': (0, 255, 0),
'%': (0, 255, 0),
'&': (0, 255, 0),
',': (0, 255, 0),
'.': (0, 255, 0),
'0': (0, 0, 255),
'1': (0, 0, 255),
'2': (0, 0, 255),
'3': (0, 0, 255),
'4'... | [
"pytesseract.image_to_boxes",
"cv2.rectangle",
"os.path.join",
"numpy.zeros",
"cv2.imread"
] | [((1076, 1097), 'cv2.imread', 'cv2.imread', (['input_dir'], {}), '(input_dir)\n', (1086, 1097), False, 'import cv2\n'), ((1167, 1205), 'numpy.zeros', 'np.zeros', (['(height, width, 3)', 'np.uint8'], {}), '((height, width, 3), np.uint8)\n', (1175, 1205), True, 'import numpy as np\n'), ((1222, 1278), 'pytesseract.image_t... |
# Escrever um script em python que le
# uma tabela do excel
# e gera o código em assembly
# para gerar a imagem no LCD
import pandas as pd
import numpy as np
WIDTH = 320
HEIGHT = 240
SIZE = 16
START = 16_384
sheet = pd.read_excel("SW_LCD.xlsx")
ones = sheet == 1
pixels = np.where(ones)
memory = {}
for y, x in ... | [
"numpy.where",
"numpy.floor",
"pandas.read_excel"
] | [((223, 251), 'pandas.read_excel', 'pd.read_excel', (['"""SW_LCD.xlsx"""'], {}), "('SW_LCD.xlsx')\n", (236, 251), True, 'import pandas as pd\n'), ((279, 293), 'numpy.where', 'np.where', (['ones'], {}), '(ones)\n', (287, 293), True, 'import numpy as np\n'), ((354, 372), 'numpy.floor', 'np.floor', (['(x / SIZE)'], {}), '... |
import os
from glob import glob
import numpy as np
import dlib
import cv2
from PIL import Image
def remove_undetected(directory ,detector ='hog'):
'''
Removes the undetected images in data
Args:
-----------------------------------------
directory: path to the data folder
detector: type o... | [
"PIL.Image.open",
"dlib.get_frontal_face_detector",
"numpy.zeros",
"dlib.cnn_face_detection_model_v1",
"cv2.resize",
"glob.glob",
"os.remove"
] | [((560, 583), 'glob.glob', 'glob', (['f"""{directory}*/*"""'], {}), "(f'{directory}*/*')\n", (564, 583), False, 'from glob import glob\n'), ((2901, 2960), 'numpy.zeros', 'np.zeros', (['(total_imgs, img_size, img_size, 3)'], {'dtype': 'np.int'}), '((total_imgs, img_size, img_size, 3), dtype=np.int)\n', (2909, 2960), Tru... |
import numpy as np
from copy import copy
from complex_performance_metrics.models.plugin import MulticlassPluginClassifier
from complex_performance_metrics.utils import nae
"""
This module implements the COCO algorithm for:
minimizing the (multiclass) Q-mean loss subject to (multiclass) Normalized Absolute Error ... | [
"numpy.eye",
"numpy.sqrt",
"complex_performance_metrics.models.plugin.MulticlassPluginClassifier",
"numpy.zeros",
"numpy.min",
"copy.copy",
"complex_performance_metrics.utils.nae"
] | [((1155, 1177), 'numpy.zeros', 'np.zeros', (['(num_class,)'], {}), '((num_class,))\n', (1163, 1177), True, 'import numpy as np\n'), ((1277, 1305), 'numpy.eye', 'np.eye', (['num_class', 'num_class'], {}), '(num_class, num_class)\n', (1283, 1305), True, 'import numpy as np\n'), ((1465, 1523), 'complex_performance_metrics... |
import numpy as np
class MSE:
def __call__(self, y_pred, y):
return 0.5 * np.mean((y_pred - y)**2)
def derivative(self, y_pred, y):
return y_pred - y
class CrossEntropy:
def __call__(self, y_pred, y):
return -np.sum(y * np.log(y_pred))
def derivative(self, y_pred, y):
... | [
"numpy.mean",
"numpy.log",
"numpy.ones"
] | [((539, 570), 'numpy.ones', 'np.ones', (['(n_samples, n_targets)'], {}), '((n_samples, n_targets))\n', (546, 570), True, 'import numpy as np\n'), ((88, 114), 'numpy.mean', 'np.mean', (['((y_pred - y) ** 2)'], {}), '((y_pred - y) ** 2)\n', (95, 114), True, 'import numpy as np\n'), ((261, 275), 'numpy.log', 'np.log', (['... |
import sys
import argparse
import numpy as np
from .. import zemax, trains, sdb, _utility, agf
from otk.rt2 import rt2_scalar_qt as rt2
def view_zmx():
parser = argparse.ArgumentParser(
description='Load and view a Zemax lens. Glass catalogs are obtained the directory zemax_glass_catalog_dir'
... | [
"otk.rt2.rt2_scalar_qt.Assembly.make",
"numpy.eye",
"otk.rt2.rt2_scalar_qt.view_assembly",
"otk.rt2.rt2_scalar_qt.application",
"argparse.ArgumentParser",
"otk.rt2.rt2_scalar_qt.make_elements",
"sys.exit"
] | [((167, 347), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Load and view a Zemax lens. Glass catalogs are obtained the directory zemax_glass_catalog_dirdefined in the otk configuration file."""'}), "(description=\n 'Load and view a Zemax lens. Glass catalogs are obtained the directo... |
# Imports
from maze_generator import breadth_first_generation
from PIL import Image
import numpy
def main():
"""
Generates a few new mazes
:return: None
"""
for i in range(5):
breadth_first_generation(name=f'image{i}.jpg')
def astar_algorithm(name):
"""
Algorithm that is based o... | [
"PIL.Image.open",
"numpy.asarray",
"maze_generator.breadth_first_generation"
] | [((414, 430), 'PIL.Image.open', 'Image.open', (['name'], {}), '(name)\n', (424, 430), False, 'from PIL import Image\n'), ((449, 469), 'numpy.asarray', 'numpy.asarray', (['image'], {}), '(image)\n', (462, 469), False, 'import numpy\n'), ((207, 253), 'maze_generator.breadth_first_generation', 'breadth_first_generation', ... |
import numpy as np
from methods_project_old import MaximumIterationError
from robot_arm import RobotArm
def test_point_outside_outer_circle(lengths, n, plot_initial=True, plot_minimizer=True, animate=False):
print('---- Test with destination outside configuration space ----')
analytical_tests('ooc', lengths, n... | [
"numpy.random.random",
"numpy.delete",
"numpy.argmax",
"robot_arm.RobotArm",
"numpy.sum",
"numpy.zeros",
"numpy.array",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"numpy.save"
] | [((535, 553), 'numpy.argmax', 'np.argmax', (['lengths'], {}), '(lengths)\n', (544, 553), True, 'import numpy as np\n'), ((2543, 2554), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2551, 2554), True, 'import numpy as np\n'), ((2598, 2616), 'numpy.argmax', 'np.argmax', (['lengths'], {}), '(lengths)\n', (2607, 2616),... |
"""Implements a simple two layer mlp network."""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class MlpNet(nn.Module):
"""Implements a simple fully connected mlp network."""
def __init__(self, sa_dim, n_agents, hidden_size,
agent_id=0, agent_shuffle='none'... | [
"numpy.arange",
"torch.nn.functional.relu",
"torch.nn.Linear",
"torch.cat",
"numpy.random.permutation"
] | [((377, 418), 'torch.nn.Linear', 'nn.Linear', (['(sa_dim * n_agents)', 'hidden_size'], {}), '(sa_dim * n_agents, hidden_size)\n', (386, 418), True, 'import torch.nn as nn\n'), ((438, 473), 'torch.nn.Linear', 'nn.Linear', (['hidden_size', 'hidden_size'], {}), '(hidden_size, hidden_size)\n', (447, 473), True, 'import tor... |
# Importing tensorflow
import tensorflow as tf
# importing the data
from tensorflow.examples.tutorials.mnist import input_data
# Importing some more libraries
import matplotlib.pyplot as plt
from numpy import loadtxt
import numpy as np
from pylab import rcParams
from sklearn import preprocessing
import cv2
i... | [
"matplotlib.pyplot.ylabel",
"math.sqrt",
"numpy.divide",
"matplotlib.pyplot.imshow",
"numpy.mean",
"os.listdir",
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.placeholder",
"numpy.asarray",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.yticks",
"t... | [((1925, 1945), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (1935, 1945), False, 'import os\n'), ((2342, 2361), 'numpy.asarray', 'np.asarray', (['X_train'], {}), '(X_train)\n', (2352, 2361), True, 'import numpy as np\n'), ((3257, 3313), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[... |
# PyVot Python Variational Optimal Transportation
# Author: <NAME> <<EMAIL>>
# Date: April 28th 2020
# Licence: MIT
"""
===============================================================
Area Preserving Map through Optimal Transportation
===============================================================
This demo sh... | [
"vot_numpy.VOTAP",
"matplotlib.pyplot.savefig",
"numpy.random.multivariate_normal",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"matplotlib.pyplot.tight_layout",
"utils.scatter_otsamples",
"os.path.abspath",
"time.time",
"utils.plot_otmap",
"matplotlib.pyplot.... | [((826, 843), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (840, 843), True, 'import numpy as np\n'), ((1151, 1206), 'vot_numpy.VOTAP', 'VOTAP', (['data'], {'sampling': '"""square"""', 'ratio': '(200)', 'verbose': '(True)'}), "(data, sampling='square', ratio=200, verbose=True)\n", (1156, 1206), False,... |
"""
"""
from cddm.map import k_select
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
#diffusion constant
from examples.paper.one_component.conf import D, DATA_PATH
import os.path as path
SHOW_FITS = True
colors = ["C{}".format(i) for i in range(10)]
def _g1(x,f,a):
"""g... | [
"scipy.optimize.curve_fit",
"numpy.diag",
"cddm.map.k_select",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.isnan",
"matplotlib.pyplot.show"
] | [((1613, 1625), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1623, 1625), True, 'import matplotlib.pyplot as plt\n'), ((2656, 2666), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2664, 2666), True, 'import matplotlib.pyplot as plt\n'), ((1024, 1065), 'cddm.map.k_select', 'k_select', (['y'], {... |
import numpy as np
import scipy as sc
import matplotlib.pyplot as plt
import pandas as pd
from functions.sub_surrender_profiles import get_risk_drivers, get_age_coeff, get_duration_coeff, get_duration_elapsed_coeff, get_duration_remain_coeff, \
get_prem_freq_coeff, get_prem_annual_c... | [
"numpy.random.rand",
"functions.sub_surrender_profiles.get_time_coeff",
"numpy.log",
"functions.sub_surrender_profiles.get_prem_annual_coeff",
"functions.sub_surrender_profiles.get_age_coeff",
"functions.sub_surrender_profiles.get_risk_drivers",
"numpy.exp",
"numpy.linspace",
"numpy.random.gamma",
... | [((1729, 1746), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1743, 1746), True, 'import numpy as np\n'), ((1758, 1813), 'numpy.random.gamma', 'np.random.gamma', ([], {'shape': '(5.5)', 'scale': '(6.8)', 'size': 'N_contracts'}), '(shape=5.5, scale=6.8, size=N_contracts)\n', (1773, 1813), True, 'import... |
import tensorflow as tf
import numpy as np
class TFPositionalEncoding2D(tf.keras.layers.Layer):
def __init__(self, channels:int, return_format:str="pos", dtype=tf.float32):
"""
Args:
channels int: The last dimension of the tensor you want to apply pos emb to.
Keyword Args:
... | [
"tensorflow.tile",
"numpy.ceil",
"tensorflow.shape",
"numpy.float32",
"tensorflow.range",
"tensorflow.einsum",
"tensorflow.concat",
"tensorflow.sin",
"tensorflow.cos",
"numpy.arange"
] | [((1436, 1460), 'tensorflow.range', 'tf.range', (['x'], {'dtype': 'dtype'}), '(x, dtype=dtype)\n', (1444, 1460), True, 'import tensorflow as tf\n'), ((1477, 1501), 'tensorflow.range', 'tf.range', (['y'], {'dtype': 'dtype'}), '(y, dtype=dtype)\n', (1485, 1501), True, 'import tensorflow as tf\n'), ((1531, 1573), 'tensorf... |
import numpy as np
import argparse
from MultinomialNBClassifier import multinomial_nb_classifier
from NBClassifier import nb_classifier
from LogisticRegressionClassifer import lr_classifer
from SGDClassifier import sgd_classifier
from Parser import get_vocabulary, bag_of_words, bernoulli
def main():
parser = argp... | [
"Parser.bag_of_words",
"NBClassifier.nb_classifier",
"Parser.bernoulli",
"argparse.ArgumentParser",
"MultinomialNBClassifier.multinomial_nb_classifier",
"numpy.warnings.filterwarnings",
"Parser.get_vocabulary",
"LogisticRegressionClassifer.lr_classifer",
"SGDClassifier.sgd_classifier"
] | [((316, 368), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Instructions:"""'}), "(description='Instructions:')\n", (339, 368), False, 'import argparse\n'), ((1311, 1347), 'Parser.get_vocabulary', 'get_vocabulary', (['args.train_data_path'], {}), '(args.train_data_path)\n', (1325, 1347)... |
# -*- coding: utf-8 -*-
################################################
###### Copyright (c) 2016, <NAME>
###
import numpy as np
import itertools
import time
from .categoryaction import CatObject
class MultQ(object):
def __init__(self,x):
"""Initializes an element of the multiplicative quantale.
... | [
"numpy.unique",
"numpy.sum",
"numpy.array_equal",
"numpy.empty",
"numpy.all"
] | [((11851, 11905), 'numpy.empty', 'np.empty', (['(card_source, card_source)'], {'dtype': 'self.qtype'}), '((card_source, card_source), dtype=self.qtype)\n', (11859, 11905), True, 'import numpy as np\n'), ((12884, 12938), 'numpy.empty', 'np.empty', (['(card_target, card_source)'], {'dtype': 'self.qtype'}), '((card_target... |
import numpy as np
def euclidean_dist(x, y):
"""
Returns matrix of pairwise, squared Euclidean distances
"""
norms_1 = (x ** 2).sum(axis=1)
norms_2 = (y ** 2).sum(axis=1)
y = np.transpose(y)
prod = np.dot(x, y)
prod = 2*prod
norms_1 = norms_1.reshape(-1,1)
sum = norms_1 + norms_... | [
"numpy.exp",
"numpy.abs",
"numpy.dot",
"numpy.transpose"
] | [((200, 215), 'numpy.transpose', 'np.transpose', (['y'], {}), '(y)\n', (212, 215), True, 'import numpy as np\n'), ((227, 239), 'numpy.dot', 'np.dot', (['x', 'y'], {}), '(x, y)\n', (233, 239), True, 'import numpy as np\n'), ((358, 369), 'numpy.abs', 'np.abs', (['sum'], {}), '(sum)\n', (364, 369), True, 'import numpy as ... |
#!/usr/bin/python3
import numpy
MOD = 2 ** 16
class RandomGenerator:
def __init__(self, seed):
self.seed = seed
def next(self):
self.seed = (self.seed * 25173 + 13849) % (2 ** 16)
return self.seed
def get_random_vector(generator, size):
return numpy.array([[generator.next()] f... | [
"numpy.dot",
"numpy.zeros",
"numpy.hstack"
] | [((821, 851), 'numpy.zeros', 'numpy.zeros', (['(n, n)'], {'dtype': 'int'}), '((n, n), dtype=int)\n', (832, 851), False, 'import numpy\n'), ((557, 587), 'numpy.dot', 'numpy.dot', (['matrix', 'rand_vector'], {}), '(matrix, rand_vector)\n', (566, 587), False, 'import numpy\n'), ((605, 646), 'numpy.hstack', 'numpy.hstack',... |
import json
import numpy as np
def to_ndarray(obj, dtype=np.float64):
"""
Greedily and recursively convert the given object to a dtype ndarray.
"""
if isinstance(obj, dict):
for k in obj:
obj[k] = to_ndarray(obj[k])
return obj
elif isinstance(obj, list):
try:
... | [
"json.JSONEncoder.default",
"json.dumps",
"numpy.array",
"copy.deepcopy",
"json.load"
] | [((3452, 3471), 'copy.deepcopy', 'copy.deepcopy', (['data'], {}), '(data)\n', (3465, 3471), False, 'import copy\n'), ((678, 711), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'o'], {}), '(self, o)\n', (702, 711), False, 'import json\n'), ((1468, 1509), 'json.dumps', 'json.dumps', (['o'], {'cls': 'H... |
import torch
from Utils import *
import torchvision
import math
import numpy as np
import faiss
from Utils import LogText
import clustering
from scipy.optimize import linear_sum_assignment
import imgaug.augmenters as iaa
import imgaug.augmentables.kps
class SuperPoint():
def __init__(self, number_of_clusters, co... | [
"torch.nn.ReLU",
"clustering.preprocess_features",
"numpy.argsort",
"numpy.array",
"faiss.index_cpu_to_gpu",
"scipy.optimize.linear_sum_assignment",
"torch.unsqueeze",
"numpy.sort",
"torchvision.ops.nms",
"faiss.StandardGpuResources",
"clustering.Kmeans",
"torch.nn.PixelShuffle",
"torch.norm... | [((1744, 1767), 'torch.nn.Softmax', 'torch.nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (1760, 1767), False, 'import torch\n'), ((1795, 1819), 'torch.nn.PixelShuffle', 'torch.nn.PixelShuffle', (['(8)'], {}), '(8)\n', (1816, 1819), False, 'import torch\n'), ((1915, 2020), 'Utils.LogText', 'LogText', (['f"""Extraction... |
#!/usr/bin/env python
# 3rd party modules
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error
import numpy as np
# config
n = 10**6
feature_dim = 3
# create data
x = np.random.rand(n * feature_dim).reshape(n, feature_dim)
y_true = np.random.rand(n)
# x[:, 1] = x[:, 0]
pr... | [
"sklearn.metrics.mean_absolute_error",
"sklearn.linear_model.LinearRegression",
"numpy.random.rand"
] | [((280, 297), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)\n', (294, 297), True, 'import numpy as np\n'), ((433, 451), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (449, 451), False, 'from sklearn.linear_model import LinearRegression\n'), ((215, 246), 'numpy.random.rand', '... |
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
import torch
import torch.nn as nn
import time
import sys, os
import numpy as np
import cv2
import scipy
import matplotlib.pyplot as plt
f... | [
"scipy.io.savemat",
"torch.from_numpy",
"numpy.linalg.norm",
"numpy.divide",
"os.remove",
"matplotlib.pyplot.imshow",
"os.path.exists",
"utils.nms.nms",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.matmul",
"matplotlib.pyplot.Rectangle",
"numpy.ones",
"matplotlib.pyplot.g... | [((6030, 6077), 'os.path.join', 'os.path.join', (['output_dir', '"""results_posecnn.mat"""'], {}), "(output_dir, 'results_posecnn.mat')\n", (6042, 6077), False, 'import sys, os\n'), ((6085, 6109), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (6099, 6109), False, 'import sys, os\n'), ((1392, 1... |
import unittest
import numpy as np
import tensorflow as tf
from lib import tf_utils
class TensorDotTest(unittest.TestCase):
def test_adj_tensor_dot(self):
# adj: [[1, 0], [0, 1]]
# SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4])
adj_indices = [[0, 0], [1, 1]]
... | [
"tensorflow.SparseTensor",
"lib.tf_utils.adj_tensor_dot",
"tensorflow.Session",
"numpy.array",
"tensorflow.constant",
"numpy.array_equal",
"unittest.main"
] | [((949, 964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (962, 964), False, 'import unittest\n'), ((339, 373), 'numpy.array', 'np.array', (['[1, 1]'], {'dtype': 'np.float32'}), '([1, 1], dtype=np.float32)\n', (347, 373), True, 'import numpy as np\n'), ((415, 466), 'tensorflow.SparseTensor', 'tf.SparseTensor', ... |
from __future__ import print_function
import argparse
import torch
import torch.utils.data
from torch import nn, optim
from torch.autograd import Variable
from torchvision import datasets, transforms
from torchvision.utils import save_image
from torch.nn import functional as F
import numpy as np
import collections
from... | [
"torch.manual_seed",
"torch.cuda.FloatTensor",
"vae_conv_model_mnist.VAE",
"pytorch_summary.Summary",
"argparse.ArgumentParser",
"torch.load",
"torch.cuda.is_available",
"numpy.full",
"torch.cuda.manual_seed",
"torch.autograd.Variable",
"torch.FloatTensor",
"numpy.set_printoptions"
] | [((418, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (441, 478), False, 'import argparse\n'), ((1034, 1062), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1051, 1062), False... |
r"""
*****
Array
*****
.. autofunction:: is_all_equal
.. autofunction:: is_all_finite
.. autofunction:: is_crescent
"""
from numpy import asarray, isfinite, mgrid, prod, rollaxis
from numpy import sum as _sum
from numpy import unique as _unique
try:
from numba import boolean, char, float64, int32, int64, jit
... | [
"numpy.prod",
"numpy.unique",
"numba.boolean",
"dask.array.unique",
"numpy.asarray",
"numpy.rollaxis"
] | [((601, 613), 'numpy.asarray', 'asarray', (['arr'], {}), '(arr)\n', (608, 613), False, 'from numpy import asarray, isfinite, mgrid, prod, rollaxis\n'), ((854, 866), 'numpy.asarray', 'asarray', (['arr'], {}), '(arr)\n', (861, 866), False, 'from numpy import asarray, isfinite, mgrid, prod, rollaxis\n'), ((2378, 2408), 'n... |
'''
Configure:
python setup.py build
StructuredModels
<NAME>
2013
'''
from distutils.core import setup
# from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
# ext_modules = [
# Extension("pyKinectTools_algs_Dijkstras", ["pyKinectTools/... | [
"numpy.get_include"
] | [((872, 888), 'numpy.get_include', 'np.get_include', ([], {}), '()\n', (886, 888), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 15 16:02:16 2018
@author: ning
"""
import os
working_dir = ''
import pandas as pd
pd.options.mode.chained_assignment = None
import statsmodels.formula.api as sm
import numpy as np
from sklearn.preprocessing import StandardScaler
result_dir = '../results/'
# Exp 1
exper... | [
"os.path.join",
"statsmodels.formula.api.Logit",
"numpy.random.seed",
"numpy.concatenate",
"numpy.vstack",
"pandas.DataFrame"
] | [((764, 785), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (778, 785), True, 'import numpy as np\n'), ((3952, 3973), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (3964, 3973), True, 'import pandas as pd\n'), ((5428, 5449), 'numpy.random.seed', 'np.random.seed', (['(123... |
# -*- coding: utf-8 -*-
"""
@author: LeeZChuan
"""
import pandas as pd
import numpy as np
import requests
import os
from pandas.core.frame import DataFrame
import json
import datetime
import time
pd.set_option('display.max_columns',1000)
pd.set_option('display.width', 1000)
pd.set_option('display.max_colwidth',100... | [
"numpy.mean",
"os.path.exists",
"os.listdir",
"pandas.read_csv",
"pandas.to_datetime",
"numpy.min",
"pandas.value_counts",
"pandas.set_option",
"numpy.max",
"numpy.array",
"os.getcwd",
"pandas.read_excel",
"os.mkdir",
"numpy.std",
"pandas.DataFrame",
"pandas.core.frame.DataFrame",
"n... | [((201, 243), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(1000)'], {}), "('display.max_columns', 1000)\n", (214, 243), True, 'import pandas as pd\n'), ((243, 279), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(1000)'], {}), "('display.width', 1000)\n", (256, 279), True, 'im... |
import unittest
from unittest_data_provider import data_provider
import sys
import numpy as np
from board import *
from tests.test_utils.generate_board import generate_board_and_add_position, generate_empty_board, generate_full_board, generate_board_and_add_positions
from tests.test_utils.print_board import print_boa... | [
"tests.test_utils.generate_board.generate_full_board",
"tests.test_utils.generate_board.generate_board_and_add_positions",
"tests.test_utils.generate_board.generate_board_and_add_position",
"tests.test_utils.print_board.print_board_if_verbosity_is_set",
"numpy.array",
"tests.test_utils.generate_board.gene... | [((1388, 1419), 'unittest_data_provider.data_provider', 'data_provider', (['positions_values'], {}), '(positions_values)\n', (1401, 1419), False, 'from unittest_data_provider import data_provider\n'), ((2410, 2446), 'unittest_data_provider.data_provider', 'data_provider', (['good_positions_values'], {}), '(good_positio... |
import numpy as np
import keras
model = keras.Sequential(layers=[keras.layers.Dense(
units=1,
input_shape=[1],
)])
model.compile(
optimizer='sgd',
loss='mean_squared_error',
)
Xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
Ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float... | [
"keras.layers.Dense",
"numpy.array"
] | [((205, 259), 'numpy.array', 'np.array', (['[-1.0, 0.0, 1.0, 2.0, 3.0, 4.0]'], {'dtype': 'float'}), '([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)\n', (213, 259), True, 'import numpy as np\n'), ((266, 321), 'numpy.array', 'np.array', (['[-3.0, -1.0, 1.0, 3.0, 5.0, 7.0]'], {'dtype': 'float'}), '([-3.0, -1.0, 1.0, 3.0, ... |
# plot 2d 2rd-order regression
import matplotlib.pyplot as plt
import numpy as np
I = np.arange(4.40990640657, 58.51715740979401, 0.1) # (min, max, step)
I_coef_list = [
[-0.13927776461608068, 0.002038919337462459, 2.3484253283211487], # doubles
[-0.09850865867608666, 0.001429693439506745, 1.673346834786426],... | [
"numpy.power",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((88, 136), 'numpy.arange', 'np.arange', (['(4.40990640657)', '(58.51715740979401)', '(0.1)'], {}), '(4.40990640657, 58.51715740979401, 0.1)\n', (97, 136), True, 'import numpy as np\n'), ((540, 594), 'numpy.arange', 'np.arange', (['(0.3978092294245647)', '(7.325677230721877)', '(0.01)'], {}), '(0.3978092294245647, 7.3... |
from numpy import random # only used to simulate data loss
from decoder import Decoder # necessary for the functionality
from encoder import Encoder # necessary for the functionality
from utils import NUMBER_OF_ENCODED_BITS # only used for statistic
# showcase steering elements:
STOP_ENCODER_ON_DECODING = True #... | [
"numpy.random.random",
"encoder.Encoder",
"decoder.Decoder"
] | [((781, 793), 'encoder.Encoder', 'Encoder', (['(500)'], {}), '(500)\n', (788, 793), False, 'from encoder import Encoder\n'), ((883, 892), 'decoder.Decoder', 'Decoder', ([], {}), '()\n', (890, 892), False, 'from decoder import Decoder\n'), ((1754, 1769), 'numpy.random.random', 'random.random', ([], {}), '()\n', (1767, 1... |
# https:github.com/timestocome
# take xor neat-python example and convert it to predict tomorrow's stock
# market change using last 5 days data
# uses Python NEAT library
# https://github.com/CodeReclaimers/neat-python
from __future__ import print_function
import os
import neat
import visualize
import pan... | [
"pandas.read_csv",
"neat.Config",
"visualize.draw_net",
"neat.StatisticsReporter",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.asarray",
"neat.nn.FeedForwardNetwork.create",
"neat.StdOutReporter",
"visualize.plot_stats",
"os.path.dirname",
"matplotlib.pyplot.title",
"matplotlib.pyplot.l... | [((750, 788), 'pandas.read_csv', 'pd.read_csv', (['"""LeveledLogStockData.csv"""'], {}), "('LeveledLogStockData.csv')\n", (761, 788), True, 'import pandas as pd\n'), ((1179, 1192), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1189, 1192), True, 'import numpy as np\n'), ((1197, 1210), 'numpy.asarray', 'np.asarr... |
import torch
import numpy as np
from elf.io import open_file
from elf.wrapper import RoiWrapper
from ..util import ensure_tensor_with_channels
class RawDataset(torch.utils.data.Dataset):
"""
"""
max_sampling_attempts = 500
@staticmethod
def compute_len(path, key, patch_shape, with_channels):
... | [
"numpy.random.randint",
"elf.io.open_file",
"elf.wrapper.RoiWrapper"
] | [((330, 355), 'elf.io.open_file', 'open_file', (['path'], {'mode': '"""r"""'}), "(path, mode='r')\n", (339, 355), False, 'from elf.io import open_file\n'), ((944, 973), 'elf.io.open_file', 'open_file', (['raw_path'], {'mode': '"""r"""'}), "(raw_path, mode='r')\n", (953, 973), False, 'from elf.io import open_file\n'), (... |
from . import Regression
from ..tests import random_plane,scattered_plane
import numpy as N
def test_coordinates():
"""Tests coordinate length"""
plane,coefficients = random_plane()
fit = Regression(plane)
assert N.column_stack(plane).shape[0] == fit.C.shape[0]
def test_regression():
"""Make sure ... | [
"numpy.column_stack"
] | [((230, 251), 'numpy.column_stack', 'N.column_stack', (['plane'], {}), '(plane)\n', (244, 251), True, 'import numpy as N\n')] |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"numpy.prod",
"numpy.int32",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.drawMarker",
"cv2.resizeWindow",
"cv2.multiply",
"cv2.line",
"cv2.contourArea",
"cv2.setWindowTitle",
"cv2.arrowedLine",
"cv2.waitKey",
"numpy.round",
"cv2.drawContours",
"numpy.ones",
"cv2.setTra... | [((2029, 2044), 'numpy.array', 'np.array', (['scale'], {}), '(scale)\n', (2037, 2044), True, 'import numpy as np\n'), ((5028, 5065), 'cv2.resize', 'cv2.resize', (['image', '(size[1], size[0])'], {}), '(image, (size[1], size[0]))\n', (5038, 5065), False, 'import cv2\n'), ((5165, 5270), 'cv2.fastNlMeansDenoisingColored',... |
import pandas as pd
import numpy as np
class PayoffMatrix():
def __init__(self, sim):
self.sim = sim
self.matrix = np.zeros(shape=(len(self.sim.subclones), len(self.sim.subclones)))
self.populate_matrix(self.sim.t)
def populate_matrix(self, t):
treatments = self.sim.treatments... | [
"pandas.DataFrame",
"numpy.dot"
] | [((813, 864), 'pandas.DataFrame', 'pd.DataFrame', (['self.matrix'], {'index': 'labs', 'columns': 'labs'}), '(self.matrix, index=labs, columns=labs)\n', (825, 864), True, 'import pandas as pd\n'), ((450, 497), 'numpy.dot', 'np.dot', (['self.sim.subclones[j].alpha', 'treatments'], {}), '(self.sim.subclones[j].alpha, trea... |
import pandas as pd
import numpy as np
import itertools
from matplotlib import cm
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import confusion_matrix, make_scorer, roc_auc_score, average_precision_score, classifi... | [
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"numpy.array",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.imshow",
"sklearn.linear_model.SGDClassifier",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.yticks... | [((5901, 5959), 'sklearn.linear_model.SGDClassifier', 'SGDClassifier', ([], {'loss': '"""log"""', 'penalty': '"""elasticnet"""', 'n_jobs': '(-1)'}), "(loss='log', penalty='elasticnet', n_jobs=-1)\n", (5914, 5959), False, 'from sklearn.linear_model import LogisticRegression, SGDClassifier\n'), ((5976, 6034), 'sklearn.mo... |
#!/usr/bin/env python3
import os
import re
import cv2
import keras
import numpy as np
import pandas as pd
DATA_PATH = 'cage/images/'
LEFT_PATH = 'data/left.h5'
RIGHT_PATH = 'data/right.h5'
NUM_PATH = 'data/numbers.csv'
DataSet = (np.ndarray, np.ndarray, np.ndarray)
def extract() -> (list, list):
l_data, r_data... | [
"os.path.exists",
"keras.layers.Conv2D",
"keras.models.load_model",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"pandas.DataFrame",
"re.match",
"numpy.array",
"keras.layers.Dropout",
"keras.layers.Dense",
"keras.models.clone_model",
"cv2.imread",
"os.walk",
"numpy.random.shuffle"
... | [((389, 422), 'os.walk', 'os.walk', (['DATA_PATH'], {'topdown': '(False)'}), '(DATA_PATH, topdown=False)\n', (396, 422), False, 'import os\n'), ((1154, 1179), 'numpy.random.shuffle', 'np.random.shuffle', (['l_full'], {}), '(l_full)\n', (1171, 1179), True, 'import numpy as np\n'), ((1184, 1209), 'numpy.random.shuffle', ... |
import numpy as np
import termcolor
import cnc_structs
def string_array_to_char_array(m):
c = np.array([x.decode('ascii')[0] if len(x) > 0 else ' ' for x in m.flat]).reshape(m.shape)
return '\n'.join(map(''.join, c))
def staticmap_array(map: cnc_structs.CNCMapDataStruct) -> np.ndarray:
tile_names = np.... | [
"numpy.array",
"numpy.zeros",
"termcolor.colored"
] | [((317, 376), 'numpy.zeros', 'np.zeros', (['(map.MapCellHeight * map.MapCellWidth)'], {'dtype': '"""S32"""'}), "(map.MapCellHeight * map.MapCellWidth, dtype='S32')\n", (325, 376), True, 'import numpy as np\n'), ((628, 701), 'numpy.zeros', 'np.zeros', (['(static_map.MapCellHeight, static_map.MapCellWidth)'], {'dtype': '... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... | [
"copy.deepcopy",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.array",
"matplotlib.pyplot.errorbar",
"numpy.ravel",
"ufit.plotting.DataPlotter",
"matplotlib.pyplot.subplots",
"ufit.pycompat.iteritems"
] | [((983, 1002), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (996, 1002), False, 'import copy\n'), ((4222, 4244), 'ufit.plotting.DataPlotter', 'DataPlotter', ([], {'axes': 'axes'}), '(axes=axes)\n', (4233, 4244), False, 'from ufit.plotting import DataPlotter\n'), ((4790, 4812), 'ufit.plotting.DataPlotte... |
'''
training for Navier Stokes with Reynolds number 500, 0.5 second time period
'''
import csv
import random
from timeit import default_timer
import deepxde as dde
from deepxde.optimizers.config import set_LBFGS_options
import numpy as np
from baselines.data import NSdata
import tensorflow as tf
Re = 500
def forcin... | [
"deepxde.PointSetBC",
"deepxde.geometry.Rectangle",
"deepxde.data.TimePDE",
"deepxde.Model",
"deepxde.geometry.GeometryXTime",
"deepxde.grad.jacobian",
"tensorflow.math.cos",
"csv.writer",
"timeit.default_timer",
"deepxde.grad.hessian",
"deepxde.metrics.l2_relative_error",
"baselines.data.NSda... | [((604, 637), 'deepxde.grad.jacobian', 'dde.grad.jacobian', (['u', 'x'], {'i': '(0)', 'j': '(0)'}), '(u, x, i=0, j=0)\n', (621, 637), True, 'import deepxde as dde\n'), ((653, 698), 'deepxde.grad.hessian', 'dde.grad.hessian', (['u', 'x'], {'component': '(0)', 'i': '(0)', 'j': '(0)'}), '(u, x, component=0, i=0, j=0)\n', ... |
import partitura
import pandas as pd
import numpy as np
import os
def save_csv_for_parangonada(outdir, part, ppart, align, zalign=None, feature = None):
part = partitura.utils.music.ensure_notearray(part)
ppart = partitura.utils.music.ensure_notearray(ppart)
# ___ create np array for features
ff... | [
"pandas.DataFrame",
"numpy.array",
"partitura.utils.music.ensure_notearray"
] | [((167, 211), 'partitura.utils.music.ensure_notearray', 'partitura.utils.music.ensure_notearray', (['part'], {}), '(part)\n', (205, 211), False, 'import partitura\n'), ((224, 269), 'partitura.utils.music.ensure_notearray', 'partitura.utils.music.ensure_notearray', (['ppart'], {}), '(ppart)\n', (262, 269), False, 'impor... |
"""Incorporate ETH Zurich's BIWI (EWAP) dataset into simple gridworld."""
import os
from pathlib import Path
from matplotlib.image import imread
import matplotlib.pyplot as plt
import numpy as np
from .simple_gw import SimpleGridworld
# Grid constants
OBSTACLE = 2
GOAL = 6
PERSON = 9
ROBOT = 15
class EwapDataset:
... | [
"numpy.copy",
"numpy.eye",
"numpy.abs",
"pathlib.Path",
"numpy.where",
"numpy.max",
"numpy.array",
"numpy.pad",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.pause",
"numpy.loadtxt",
"os.path.abspath",
"numpy.round"
] | [((897, 942), 'numpy.loadtxt', 'np.loadtxt', (["(self.sequence_path / 'obsmat.txt')"], {}), "(self.sequence_path / 'obsmat.txt')\n", (907, 942), True, 'import numpy as np\n'), ((1024, 1068), 'numpy.loadtxt', 'np.loadtxt', (["(self.sequence_path / 'shift.txt')"], {}), "(self.sequence_path / 'shift.txt')\n", (1034, 1068)... |
import random
import h5py
import numpy as np
import torch
import torch.utils.data as udata
import glob
import os
from PIL import Image
import torchvision.transforms as transforms
# import torch.nn.functional as F
def normalize():
return transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
def norm(data, max_v... | [
"random.shuffle",
"os.path.join",
"h5py.File",
"numpy.array",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"numpy.transpose",
"torchvision.transforms.Compose"
] | [((243, 297), 'torchvision.transforms.Normalize', 'transforms.Normalize', (['(0.5, 0.5, 0.5)', '(0.5, 0.5, 0.5)'], {}), '((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n', (263, 297), True, 'import torchvision.transforms as transforms\n'), ((1589, 1621), 'h5py.File', 'h5py.File', (['self.keys[index]', '"""r"""'], {}), "(self.keys[... |
import copy
import numpy as np
from math import sqrt, pi, e
from bisection import bisection
class LegendrePolynomial:
def __init__(self, n):
self.degree = n
self.coef = [1]
while n and len(self.coef) < n + 1:
self.coef.append(0)
def get(self, x):
res = 0
fo... | [
"numpy.zeros",
"numpy.linalg.inv",
"bisection.bisection",
"copy.deepcopy"
] | [((1949, 1965), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1957, 1965), True, 'import numpy as np\n'), ((1974, 1990), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {}), '((n, 1))\n', (1982, 1990), True, 'import numpy as np\n'), ((2112, 2128), 'numpy.linalg.inv', 'np.linalg.inv', (['A'], {}), '(A)\n', (2125, ... |
# -*- coding: utf-8 -*-
"""
This is a script for satellite image classification
Last updated on Aug 6 2019
@author: <NAME>
@Email: <EMAIL>
@functions
1. generate samples from satellite images
2. grid search SVM/random forest parameters
3. object-based post-classification refinement
superpixel-based regularization for... | [
"sklearn.model_selection.GridSearchCV",
"numpy.array",
"copy.deepcopy",
"numpy.flip",
"numpy.repeat",
"numpy.reshape",
"numpy.where",
"numpy.memmap",
"matplotlib.pyplot.close",
"numpy.concatenate",
"numpy.random.permutation",
"matplotlib.pyplot.savefig",
"numpy.ones",
"sklearn.ensemble.Ran... | [((7045, 7064), 'copy.deepcopy', 'copy.deepcopy', (['cmap'], {}), '(cmap)\n', (7058, 7064), False, 'import copy\n'), ((7397, 7417), 'numpy.zeros', 'np.zeros', (['(ncl, ncl)'], {}), '((ncl, ncl))\n', (7405, 7417), True, 'import numpy as np\n'), ((7600, 7628), 'numpy.zeros', 'np.zeros', (['(ncl + 2, ncl + 1)'], {}), '((n... |
"""ImpulseDict class for manipulating impulse responses."""
import numpy as np
from .result_dict import ResultDict
from ..utilities.ordered_set import OrderedSet
from ..utilities.bijection import Bijection
from .steady_state_dict import SteadyStateDict
class ImpulseDict(ResultDict):
def __init__(self, data, int... | [
"numpy.zeros"
] | [((3996, 4012), 'numpy.zeros', 'np.zeros', (['self.T'], {}), '(self.T)\n', (4004, 4012), True, 'import numpy as np\n'), ((4222, 4238), 'numpy.zeros', 'np.zeros', (['self.T'], {}), '(self.T)\n', (4230, 4238), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.