code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
This submodule contains base tools for numerical integration of the Hamilton-
Jacobi-Bellman equation in the Square Root Velocity Framework. The methods
accepts and returns vectorized data only.
"""
# External dependencies:
import numpy as np
class Scheme:
"""
Object containing at least two methods: 'up... | [
"numpy.minimum",
"numpy.maximum",
"numpy.abs",
"numpy.finfo",
"numpy.array",
"numpy.arange",
"numpy.sqrt"
] | [((670, 685), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (678, 685), True, 'import numpy as np\n'), ((2250, 2295), 'numpy.maximum', 'np.maximum', (['(i[:, None] - hjbdata.nbhd[[0]])', '(0)'], {}), '(i[:, None] - hjbdata.nbhd[[0]], 0)\n', (2260, 2295), True, 'import numpy as np\n'), ((2305, 2350), 'numpy.m... |
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo
from wordpress_xmlrpc.methods import media
from wordpress_xmlrpc.compat import xmlrpc_client
import requests
import numpy as np
import random
import time... | [
"numpy.random.uniform",
"wordpress_xmlrpc.WordPressPost",
"random.choice",
"wordpress_xmlrpc.Client",
"wordpress_xmlrpc.methods.posts.NewPost",
"requests.get",
"wordpress_xmlrpc.methods.media.UploadFile"
] | [((623, 692), 'wordpress_xmlrpc.Client', 'Client', (['self.conf.wp_hostxmlrpc', 'self.conf.wp_user', 'self.conf.wp_pass'], {}), '(self.conf.wp_hostxmlrpc, self.conf.wp_user, self.conf.wp_pass)\n', (629, 692), False, 'from wordpress_xmlrpc import Client, WordPressPost\n'), ((1282, 1313), 'numpy.random.uniform', 'np.rand... |
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
import numpy as np
def draw_contours(X, U, centers, cov, pnt_colors, center_color, title = None):
cluster_indices = np.argmax(U, axis=1)
cluster_groups = []
cluster_cov = []
x1 = np.linspace(-2, 10, 200)
x2 = np.linspace... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"numpy.zeros_like",
"matplotlib.pyplot.plot",
"numpy.argmax",
"numpy.empty",
"matplotlib.pyplot.scatter",
"numpy.identity",
"scipy.stats.multivariate_normal",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.linspace",
... | [((198, 218), 'numpy.argmax', 'np.argmax', (['U'], {'axis': '(1)'}), '(U, axis=1)\n', (207, 218), True, 'import numpy as np\n'), ((275, 299), 'numpy.linspace', 'np.linspace', (['(-2)', '(10)', '(200)'], {}), '(-2, 10, 200)\n', (286, 299), True, 'import numpy as np\n'), ((309, 333), 'numpy.linspace', 'np.linspace', (['(... |
"""
Display a lot of line objects. Because of the architecture of wgpu,
this is still performant.
"""
# run_example = false - because it takes too long and times out
import time # noqa
import numpy as np
from wgpu.gui.auto import WgpuCanvas, run
import pygfx as gfx
canvas = WgpuCanvas(max_fps=999)
renderer = gfx.W... | [
"pygfx.linalg.Vector3",
"numpy.zeros_like",
"pygfx.LineThinMaterial",
"pygfx.OrthographicCamera",
"time.perf_counter",
"wgpu.gui.auto.run",
"wgpu.gui.auto.WgpuCanvas",
"numpy.sin",
"pygfx.Scene",
"numpy.linspace",
"pygfx.Geometry",
"pygfx.Line",
"pygfx.WgpuRenderer",
"pygfx.LineMaterial"
] | [((280, 303), 'wgpu.gui.auto.WgpuCanvas', 'WgpuCanvas', ([], {'max_fps': '(999)'}), '(max_fps=999)\n', (290, 303), False, 'from wgpu.gui.auto import WgpuCanvas, run\n'), ((315, 354), 'pygfx.WgpuRenderer', 'gfx.WgpuRenderer', (['canvas'], {'show_fps': '(True)'}), '(canvas, show_fps=True)\n', (331, 354), True, 'import py... |
import argparse
import torch
from solver import Solver
import os
import numpy as np
import scipy.io
from torch.utils.data import DataLoader
from tqdm import tqdm
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MCD Implementation')
parser.add_argument('--batch-size', type=int, default=128, met... | [
"solver.Solver",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torch.manual_seed",
"torch.cuda.manual_seed",
"numpy.min",
"numpy.max",
"numpy.array",
"torch.cuda.is_available",
"torch.utils.data.TensorDataset",
"torch.tensor",
"torch.from_numpy"
] | [((192, 257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MCD Implementation"""'}), "(description='PyTorch MCD Implementation')\n", (215, 257), False, 'import argparse\n'), ((2100, 2128), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (2117, 21... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"ppocr.utils.character.CharacterOps",
"paddle.fluid.Executor",
"ppocr.utils.utility.initial_logger",
"program.load_config",
"paddle.fluid.io.save_inference_model",
"paddle.fluid.CUDAPlace",
"paddle.fluid.unique_name.guard",
"ppocr.data.reader_main.reader_main",
"paddle.fluid.program_guard",
"ppocr... | [((1382, 1398), 'ppocr.utils.utility.initial_logger', 'initial_logger', ([], {}), '()\n', (1396, 1398), False, 'from ppocr.utils.utility import initial_logger\n'), ((1594, 1610), 'ppocr.utils.utility.initial_logger', 'initial_logger', ([], {}), '()\n', (1608, 1610), False, 'from ppocr.utils.utility import initial_logge... |
"""
Example of hyperparameter search in MLflow using Hyperopt.
The run method will instantiate and run Hyperopt optimizer. Each parameter configuration is
evaluated in a new MLflow run invoking main entry point with selected parameters.
The runs are evaluated based on validation set loss. Test set score is calculated... | [
"hyperopt.hp.uniform",
"click.argument",
"mlflow.tracking.client.MlflowClient",
"click.option",
"click.command",
"numpy.finfo"
] | [((593, 702), 'click.command', 'click.command', ([], {'help': '"""Perform hyperparameter search with Hyperopt library.Optimize dl_train target."""'}), "(help=\n 'Perform hyperparameter search with Hyperopt library.Optimize dl_train target.'\n )\n", (606, 702), False, 'import click\n'), ((717, 820), 'click.option'... |
# -*- coding: utf-8 -*-
"""
Created on May 8, 2020
@author: <EMAIL>
"""
import pandas as pd
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import column
from hybrid_index import hybrid_index, cross_corr
import numpy as np
#load Arkansas precipiation anomalies and PDSI time series
df = pd.read... | [
"bokeh.plotting.figure",
"hybrid_index.cross_corr",
"hybrid_index.hybrid_index",
"pandas.read_csv",
"numpy.ones",
"bokeh.plotting.output_file",
"pandas.to_datetime",
"numpy.array",
"bokeh.layouts.column"
] | [((313, 349), 'pandas.read_csv', 'pd.read_csv', (['"""pcp_pdsi_arkansas.csv"""'], {}), "('pcp_pdsi_arkansas.csv')\n", (324, 349), True, 'import pandas as pd\n'), ((548, 592), 'pandas.to_datetime', 'pd.to_datetime', (["df[['year', 'month', 'day']]"], {}), "(df[['year', 'month', 'day']])\n", (562, 592), True, 'import pan... |
import numpy as np
import torch
import torch.optim as optim
from attack_model import \
transform_dataset, \
transform_dataset_census, \
transform_dataset_credit, \
attack_keras_model
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, TensorDataset, DataLoader
fro... | [
"argparse.ArgumentParser",
"attack_model.transform_dataset_credit",
"torch.nn.functional.dropout",
"torch.cat",
"numpy.mean",
"torch.utils.data.TensorDataset",
"torch.no_grad",
"pandas.set_option",
"os.path.join",
"pandas.DataFrame",
"torch.nn.MSELoss",
"torch.utils.data.dataset.random_split",... | [((835, 948), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.DEBUG'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG\n )\n", (854, 948), False, 'import logging\n'), ((3397, 3517... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | [
"os.path.join",
"absl.flags.DEFINE_string",
"hyperbolic.utils.preprocess.process_dataset",
"absl.app.run",
"numpy.array",
"tensorflow.compat.v2.gfile.Open",
"hyperbolic.utils.preprocess.save_as_pickle"
] | [((1597, 1693), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset_path"""'], {'default': '"""data/meetup/"""', 'help': '"""Path to raw dataset dir"""'}), "('dataset_path', default='data/meetup/', help=\n 'Path to raw dataset dir')\n", (1616, 1693), False, 'from absl import flags\n'), ((1702, 1808), 'a... |
import numpy as np
from scipy import stats
try:
from matplotlib import pyplot as plt
except ModuleNotFoundError:
import sys
sys.stderr.write("matplotlib was not found, plotting would raise an exception.\n")
plt = None
class NormalNormalKnownVar:
__slots__ = ["mean", "var", "known_var"]
def ... | [
"matplotlib.pyplot.xlim",
"numpy.log",
"matplotlib.pyplot.plot",
"numpy.mean",
"numpy.linspace",
"sys.stderr.write",
"numpy.var",
"numpy.sqrt"
] | [((138, 225), 'sys.stderr.write', 'sys.stderr.write', (['"""matplotlib was not found, plotting would raise an exception.\n"""'], {}), "(\n 'matplotlib was not found, plotting would raise an exception.\\n')\n", (154, 225), False, 'import sys\n'), ((512, 524), 'numpy.var', 'np.var', (['data'], {}), '(data)\n', (518, 5... |
# ==============================================================================
# Copyright 2018-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | [
"tensorflow.compat.v1.disable_eager_execution",
"numpy.finfo",
"tensorflow.nn.log_softmax",
"numpy.array"
] | [((837, 875), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (873, 875), True, 'import tensorflow as tf\n'), ((1178, 1205), 'tensorflow.nn.log_softmax', 'tf.nn.log_softmax', (['features'], {}), '(features)\n', (1195, 1205), True, 'import tensorflow as tf\n'), (... |
"""
run the below command under 'activity_recognition' folder:
PYTHONPATH=../:./ python3 models/classical/detector_feature_mean_concatenate.py >log.txt 2>&1 &
Note:
>& is the syntax to redirect a stream to another file descriptor - 0 is stdin, 1 is stdout, and 2 is stderr.
https://stackoverflo... | [
"matplotlib.pyplot.title",
"os.remove",
"numpy.trace",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.tree.DecisionTreeClassifier",
"matplotlib.pyplot.figure",
"features.video.utils.load_video",
"feature... | [((1812, 1836), 'os.path.exists', 'os.path.exists', (['out_file'], {}), '(out_file)\n', (1826, 1836), False, 'import os\n'), ((2042, 2081), 'features.video.utils.load_video', 'load_video', (['in_file', 'model.desired_size'], {}), '(in_file, model.desired_size)\n', (2052, 2081), False, 'from features.video.utils import ... |
import numpy as np
import random as rd
from random import randint
import matplotlib.pyplot as plt
import io
import base64
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
def to_base64(fig):
# Convert plot to PNG image
pngImage = io.BytesIO()
... | [
"matplotlib.pyplot.title",
"io.BytesIO",
"numpy.sum",
"random.randint",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"numpy.empty",
"matplotlib.pyplot.legend",
"numpy.asarray",
"random.random",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"numpy.array",
"numpy.mean",
"numpy.ma... | [((303, 315), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (313, 315), False, 'import io\n'), ((803, 824), 'numpy.array', 'np.array', (['weight_list'], {}), '(weight_list)\n', (811, 824), True, 'import numpy as np\n'), ((846, 866), 'numpy.array', 'np.array', (['value_list'], {}), '(value_list)\n', (854, 866), True, 'i... |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"mo.ops.power.Power.infer",
"numpy.ones",
"mo.graph.graph.Node",
"mo.utils.unittest.graph.build_graph",
"numpy.array"
] | [((2117, 2137), 'mo.graph.graph.Node', 'Node', (['graph', '"""power"""'], {}), "(graph, 'power')\n", (2121, 2137), False, 'from mo.graph.graph import Node\n'), ((2181, 2204), 'mo.ops.power.Power.infer', 'Power.infer', (['power_node'], {}), '(power_node)\n', (2192, 2204), False, 'from mo.ops.power import Power\n'), ((24... |
import numpy as np
from functools import partial
import scipy
from pyapprox.random_variable_algebra import invert_monotone_function
def value_at_risk(samples, alpha, weights=None, samples_sorted=False):
"""
Compute the value at risk of a variable Y using a set of samples.
Parameters
----------
s... | [
"numpy.random.uniform",
"functools.partial",
"numpy.sum",
"numpy.maximum",
"scipy.integrate.quad",
"numpy.isscalar",
"numpy.empty",
"numpy.empty_like",
"numpy.ones",
"numpy.argsort",
"numpy.where",
"numpy.array",
"numpy.arange",
"numpy.atleast_1d"
] | [((4958, 4972), 'numpy.isscalar', 'np.isscalar', (['x'], {}), '(x)\n', (4969, 4972), True, 'import numpy as np\n'), ((6786, 6813), 'numpy.empty', 'np.empty', (['(nvars, nsamples)'], {}), '((nvars, nsamples))\n', (6794, 6813), True, 'import numpy as np\n'), ((6822, 6855), 'numpy.random.uniform', 'np.random.uniform', (['... |
from typing import Tuple, Union, List
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.linear_model import LogisticRegression
XY = Tuple[np.ndarray, np.ndarray]
Dataset = Tuple[XY, XY]
LogRegParams = Union[XY, Tuple[np.ndarray]]
XYList = List[XY]
# The get_model_parameters f... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"numpy.zeros",
"numpy.array_split"
] | [((1424, 1457), 'numpy.zeros', 'np.zeros', (['(n_classes, n_features)'], {}), '((n_classes, n_features))\n', (1432, 1457), True, 'import numpy as np\n'), ((1737, 1822), 'sklearn.model_selection.StratifiedShuffleSplit', 'StratifiedShuffleSplit', ([], {'n_splits': 'num_partitions', 'test_size': '(0.001)', 'random_state':... |
"""
@file
@brief Helpers to validate python code.
"""
import pickle
import numpy
from scipy.spatial.distance import cdist # pylint: disable=E0611
from scipy.special import expit, erf # pylint: disable=E0611
from scipy.linalg import solve # pylint: disable=E0611
from ...tools.code_helper import make_callable
def _m... | [
"numpy.isnan",
"numpy.concatenate"
] | [((542, 578), 'numpy.concatenate', 'numpy.concatenate', (['inputs'], {'axis': 'axis'}), '(inputs, axis=axis)\n', (559, 578), False, 'import numpy\n'), ((3965, 3979), 'numpy.isnan', 'numpy.isnan', (['a'], {}), '(a)\n', (3976, 3979), False, 'import numpy\n'), ((3984, 3998), 'numpy.isnan', 'numpy.isnan', (['b'], {}), '(b)... |
import numpy as np
import os
import sys
sys.path.append("../src")
import localmodule
# Define constants.
aug_kinds = ["all", "all-but-noise", "none"]
units = localmodule.get_units()
script_name = "045_evaluate-add-convnet-full-audio.py"
script_path = os.path.join("..", "..", "..", "src", script_name)
n_trials = 10
... | [
"sys.path.append",
"os.makedirs",
"localmodule.get_units",
"numpy.linspace",
"localmodule.fold_units",
"os.path.join"
] | [((41, 66), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (56, 66), False, 'import sys\n'), ((161, 184), 'localmodule.get_units', 'localmodule.get_units', ([], {}), '()\n', (182, 184), False, 'import localmodule\n'), ((254, 304), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', ... |
import unittest
import numpy as np
from unittest.mock import patch
import a3 as my
tolerance = 0
class TestPolygon(unittest.TestCase):
# P1 is the square and P2 a pentagon
inp = np.array([[1.0, 1.0, 1.0], [1.0, 5.0, 1.0], [5.0, 5.0, 1.0], [5.0, 1.0, 1.0]])
P1 = my.Polygon(inp)
inp2 = np.array([[2.0, 1.0, 1.0], [4... | [
"unittest.main",
"a3.Polygon",
"a3.Circle",
"numpy.array",
"numpy.testing.assert_allclose"
] | [((182, 260), 'numpy.array', 'np.array', (['[[1.0, 1.0, 1.0], [1.0, 5.0, 1.0], [5.0, 5.0, 1.0], [5.0, 1.0, 1.0]]'], {}), '([[1.0, 1.0, 1.0], [1.0, 5.0, 1.0], [5.0, 5.0, 1.0], [5.0, 1.0, 1.0]])\n', (190, 260), True, 'import numpy as np\n'), ((267, 282), 'a3.Polygon', 'my.Polygon', (['inp'], {}), '(inp)\n', (277, 282), T... |
import numpy as np
import random
class ReplayMemory:
def __init__(self, memory_size=5000):
self.tree = SumTree(memory_size)
self.alpha = 0.6
def add(self, error, observation):
priority = self._get_priority(error)
self.tree.add(priority, observation)
def sample(self, quant... | [
"numpy.zeros",
"random.uniform"
] | [((963, 985), 'numpy.zeros', 'np.zeros', (['(2 * size - 1)'], {}), '(2 * size - 1)\n', (971, 985), True, 'import numpy as np\n'), ((1006, 1034), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'object'}), '(size, dtype=object)\n', (1014, 1034), True, 'import numpy as np\n'), ((449, 499), 'random.uniform', 'random.unifo... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
from .stats import gfevd, mbcs_index, nhd, mdd
from .mcmc import mcmc
from .filtering import *
from .tools import *
from .mpile import *
from .estimation import *
import emcwrap as ew
class DSGE_RAW(dict):
pass
def vix(self,... | [
"pandas.DataFrame",
"os.path.isabs",
"numpy.load",
"numpy.ceil",
"cloudpickle.dumps",
"emcee.backends.HDFBackend",
"os.path.exists",
"numpy.savez_compressed",
"numpy.arange",
"emcwrap.traceplot",
"os.path.join"
] | [((2897, 2940), 'numpy.savez_compressed', 'np.savez_compressed', (['filename'], {}), '(filename, **self.fdict)\n', (2916, 2940), True, 'import numpy as np\n'), ((3511, 3554), 'numpy.savez_compressed', 'np.savez_compressed', (['(path + suffix)'], {}), '(path + suffix, **rdict)\n', (3530, 3554), True, 'import numpy as np... |
import numpy as np
import os
class DataReaderRL:
def __init__ (self):
self.a = 0
def get_filelist (self, rootpath):
pathlist = list()
country = os.listdir(rootpath)
for i in range(len(country)):
country[i] = rootpath + str(country[i]) + '/'
datelist = l... | [
"numpy.zeros",
"os.listdir"
] | [((182, 202), 'os.listdir', 'os.listdir', (['rootpath'], {}), '(rootpath)\n', (192, 202), False, 'import os\n'), ((387, 409), 'os.listdir', 'os.listdir', (['country[i]'], {}), '(country[i])\n', (397, 409), False, 'import os\n'), ((1282, 1307), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n',... |
"""
Module implementing pixel-based classifier
"""
import numpy as np
from lightgbm import Booster
class PixelClassifier:
"""
Pixel classifier extends a receptive field of a classifier over an entire image.
The classifier's receptive field is in case of PixelClassifier a pixel (i.e, it
has dimension o... | [
"numpy.vstack"
] | [((4215, 4262), 'numpy.vstack', 'np.vstack', (['(1.0 - probabilities, probabilities)'], {}), '((1.0 - probabilities, probabilities))\n', (4224, 4262), True, 'import numpy as np\n')] |
import os
import dataset
import engine
import torch
import pandas as pd
import numpy as np
import random
import config
from tqdm import tqdm
from model import TransforomerModel
import warnings
warnings.filterwarnings('ignore')
from sklearn.model_selection import StratifiedKFold
from sklearn import metrics
from transf... | [
"numpy.random.seed",
"pandas.read_csv",
"engine.train_fn",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.f1_score",
"pandas.DataFrame",
"torch.utils.data.DataLoader",
"random.seed",
"pandas.concat",
"dataset.TransformerDataset",
"tqdm.tqdm",
"torch.manual_seed",
"engine.eval_fn",
"tra... | [((194, 227), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (217, 227), False, 'import warnings\n'), ((430, 459), 'transformers.logging.set_verbosity_error', 'logging.set_verbosity_error', ([], {}), '()\n', (457, 459), False, 'from transformers import logging\n'), ((580, ... |
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
import math
def predict_using_sklean():
df = pd.read_csv("exe_gradent_decent.csv")
r = LinearRegression()
r.fit(df[['math']],df.cs)
return r.coef_, r.intercept_
def gradient_descent(x,y):
m_curr = 0
b_curr... | [
"pandas.read_csv",
"numpy.array",
"math.isclose",
"sklearn.linear_model.LinearRegression"
] | [((139, 176), 'pandas.read_csv', 'pd.read_csv', (['"""exe_gradent_decent.csv"""'], {}), "('exe_gradent_decent.csv')\n", (150, 176), True, 'import pandas as pd\n'), ((185, 203), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (201, 203), False, 'from sklearn.linear_model import LinearRegre... |
# nasty hack to deal with issue #46
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import pytest
import numpy as np
import time
from rl_coach.memories.non_episodic.differentiable_neural_dictionary import QDND
import tensorflow as tf
NUM_ACTIONS = 3
NUM_DND_ENTRIES_... | [
"tensorflow.reduce_sum",
"rl_coach.memories.non_episodic.differentiable_neural_dictionary.QDND",
"os.path.dirname",
"pytest.fixture",
"tensorflow.Session",
"numpy.expand_dims",
"tensorflow.transpose",
"time.time",
"tensorflow.placeholder",
"tensorflow.tile",
"tensorflow.ConfigProto",
"numpy.ra... | [((424, 440), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (438, 440), False, 'import pytest\n'), ((463, 589), 'rl_coach.memories.non_episodic.differentiable_neural_dictionary.QDND', 'QDND', (['DND_SIZE', 'EMBEDDING_SIZE', 'NUM_ACTIONS', '(0.1)'], {'key_error_threshold': '(0)', 'learning_rate': '(0.0001)', 'nu... |
import argparse
import os
import tensorflow as tf
import numpy as np
import models
from libs.inputs import (
get_filename_queue,
get_input_image, get_input_cifar10,
create_batch
)
from train import train
from utils import pp
parser = argparse.ArgumentParser(description='Train and run a GAN.')
# Architectu... | [
"numpy.random.seed",
"libs.inputs.create_batch",
"argparse.ArgumentParser",
"libs.inputs.get_input_image",
"models.get_generator",
"tensorflow.set_random_seed",
"models.get_discriminator",
"train.train",
"os.path.join",
"libs.inputs.get_input_cifar10"
] | [((248, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train and run a GAN."""'}), "(description='Train and run a GAN.')\n", (271, 307), False, 'import argparse\n'), ((3404, 3429), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (3418, 3429), True, 'imp... |
import numpy as np
import cv2
import time
# from simple_pid import PID
cap = cv2.VideoCapture(0)
# cap = cv2.VideoCapture('http://192.168.55.6:8080/video')
# set res of camera
settings = {
"window_x": 320,
"window_y": 240,
"crop_window_height": 80,
"contrast_high": 255,
"contrast_low": 160,
"c... | [
"cv2.GaussianBlur",
"cv2.boundingRect",
"cv2.circle",
"cv2.minEnclosingCircle",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.threshold",
"cv2.waitKey",
"numpy.zeros",
"numpy.ones",
"cv2.imshow",
"time.time",
"cv2.VideoCapture",
"time.sleep",
"cv2.useOptimized",
"cv2.rectangle",
"cv2.dest... | [((78, 97), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (94, 97), False, 'import cv2\n'), ((445, 467), 'numpy.zeros', 'np.zeros', (['(4)'], {'dtype': 'int'}), '(4, dtype=int)\n', (453, 467), True, 'import numpy as np\n'), ((681, 694), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (691, 694), F... |
#!/opt/local/bin/python
__author__ = "<NAME>"
__date__ = "7 May 2014"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
""" This script analyzes linescans and extracts cortex thickness and density from actin/membrane linescan pairs.
The script can be run in a 'pair' mode (to analyze a single linescan pair)
or 'batch' ... | [
"pylab.close",
"numpy.abs",
"numpy.sum",
"utility_functions.save_data_array",
"scipy.optimize.leastsq",
"numpy.mean",
"pylab.figure",
"numpy.arange",
"pylab.gcf",
"scipy.exp",
"pylab.ylabel",
"scipy.stats.norm.cdf",
"utility_functions.read_file",
"numpy.linspace",
"pylab.xlabel",
"pyla... | [((23141, 23219), 'utility_functions.save_data_array', 'uf.save_data_array', (['master_data', "(parent_dir + '/master_list_v%s.dat' % version)"], {}), "(master_data, parent_dir + '/master_list_v%s.dat' % version)\n", (23159, 23219), True, 'import utility_functions as uf\n'), ((23540, 23561), 'utility_functions.read_fil... |
"""
Implement Pruners here.
"""
import numpy as np
from policies.policy import PolicyBase
from utils import (get_total_sparsity,
recompute_bn_stats,
percentile,
get_prunable_children)
import torch
import torch.optim as optim
from torch.utils.data.sampler i... | [
"utils.get_total_sparsity",
"torch.ones",
"tqdm.tqdm",
"torch.utils.data.sampler.SubsetRandomSampler",
"logging.debug",
"copy.deepcopy",
"torch.ones_like",
"torch.argsort",
"torch.nn.functional.cross_entropy",
"torch.sign",
"numpy.mean",
"torch.zeros",
"utils.percentile"
] | [((6416, 6484), 'logging.debug', 'logging.debug', (['f"""Constructed {self.__class__.__name__} with config:"""'], {}), "(f'Constructed {self.__class__.__name__} with config:')\n", (6429, 6484), False, 'import logging\n'), ((6927, 6956), 'numpy.mean', 'np.mean', (['parameter_sparsities'], {}), '(parameter_sparsities)\n'... |
import numpy as np
import cv2
cap = cv2.VideoCapture('biler/rød-bil-fra-venstre.mp4')
# take first frame of the video
for i in range(10):
ret,frame = cap.read()
# setup initial location of window
r,h,c,w = 300,90,0,125 # simply hardcoded the values
track_window = (c,r,w,h)
# set up the ROI for tracking
roi = f... | [
"numpy.int0",
"cv2.polylines",
"cv2.cvtColor",
"cv2.calcHist",
"cv2.waitKey",
"cv2.imshow",
"cv2.CamShift",
"cv2.VideoCapture",
"cv2.boxPoints",
"numpy.array",
"cv2.calcBackProject",
"cv2.normalize",
"cv2.destroyAllWindows"
] | [((37, 86), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""biler/rød-bil-fra-venstre.mp4"""'], {}), "('biler/rød-bil-fra-venstre.mp4')\n", (53, 86), False, 'import cv2\n'), ((350, 386), 'cv2.cvtColor', 'cv2.cvtColor', (['roi', 'cv2.COLOR_BGR2HSV'], {}), '(roi, cv2.COLOR_BGR2HSV)\n', (362, 386), False, 'import cv2\n'), (... |
from torch.utils.data import IterableDataset, Dataset, get_worker_info
import gc
import numpy as np
from typing import List, Optional, Dict
from core.utils import chunk_examples_with_degree, chunk_to_len_batch
import pandas as pd
import os
import torch
import subprocess
from time import time
from itertools import cycle... | [
"pandas.DataFrame",
"torch.ones",
"torch.utils.data.get_worker_info",
"core.utils.chunk_to_len_batch",
"numpy.ones_like",
"subprocess.Popen",
"os.path.basename",
"pandas.read_csv",
"math.ceil",
"os.path.dirname",
"core.utils.chunk_examples_with_degree",
"os.path.exists",
"os.system",
"torc... | [((1288, 1313), 'os.path.dirname', 'os.path.dirname', (['csv_file'], {}), '(csv_file)\n', (1303, 1313), False, 'import os\n'), ((1333, 1359), 'os.path.basename', 'os.path.basename', (['csv_file'], {}), '(csv_file)\n', (1349, 1359), False, 'import os\n'), ((3437, 3664), 'core.utils.chunk_to_len_batch', 'chunk_to_len_bat... |
#!/usr/bin/python3
# coding: UTF-8
# Copyright <NAME>.
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
import os
import sys
import math
import numpy
import random
import argparse
import multiprocessing
# ----------... | [
"math.exp",
"random.SystemRandom",
"multiprocessing.Lock",
"math.atan2",
"math.sqrt",
"random.Random",
"numpy.empty_like",
"time.time",
"argparse.ArgumentParser.parse_args",
"sys.stderr.write",
"numpy.array",
"math.log10",
"numpy.dot",
"multiprocessing.Process",
"argparse.ArgumentParser.... | [((1014, 1034), 'numpy.empty_like', 'numpy.empty_like', (['v1'], {}), '(v1)\n', (1030, 1034), False, 'import numpy\n'), ((1851, 1869), 'numpy.dot', 'numpy.dot', (['d2p', 'dp'], {}), '(d2p, dp)\n', (1860, 1869), False, 'import numpy\n'), ((1880, 1898), 'numpy.dot', 'numpy.dot', (['d2p', 'd1'], {}), '(d2p, d1)\n', (1889,... |
import bisect
from typing import List, Tuple, NewType, TypeVar
import numpy as np
import pickle
from sklearn.linear_model import LogisticRegression
# Define data types.
Data = List[Tuple[float, float]] # List of (predicted_probability, true_label).
Bins = List[float] # List of bin boundaries, excluding 0.0, but in... | [
"numpy.abs",
"numpy.argmax",
"numpy.clip",
"numpy.argsort",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.random.normal",
"numpy.unique",
"numpy.std",
"numpy.max",
"typing.TypeVar",
"numpy.square",
"numpy.percentile",
"sklearn.linear_model.LogisticRegression",
"numpy.min",
"numpy... | [((407, 419), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (414, 419), False, 'from typing import List, Tuple, NewType, TypeVar\n'), ((10205, 10220), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (10213, 10220), True, 'import numpy as np\n'), ((10234, 10250), 'numpy.array', 'np.array', (['label... |
from skorecard import datasets
from skorecard.bucketers import DecisionTreeBucketer, EqualFrequencyBucketer, EqualWidthBucketer, OptimalBucketer
import numpy as np
import pytest
@pytest.fixture()
def df():
"""Generate dataframe."""
return datasets.load_uci_credit_card(as_frame=True)
def test_specials_tree_... | [
"skorecard.bucketers.EqualFrequencyBucketer",
"skorecard.bucketers.OptimalBucketer",
"pytest.fixture",
"skorecard.datasets.load_uci_credit_card",
"pytest.raises",
"numpy.array",
"skorecard.bucketers.DecisionTreeBucketer",
"skorecard.bucketers.EqualWidthBucketer"
] | [((182, 198), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (196, 198), False, 'import pytest\n'), ((250, 294), 'skorecard.datasets.load_uci_credit_card', 'datasets.load_uci_credit_card', ([], {'as_frame': '(True)'}), '(as_frame=True)\n', (279, 294), False, 'from skorecard import datasets\n'), ((920, 1031), 'sk... |
"""Auxiliary **connector** and **selector** functions to create edges.
This module provides auxiliary **connector** and **selector** functions
for the ``dg.DeepGraph.create_edges`` and
``dg.DeepGraph.create_ft_edges`` methods.
They are described in their corresponding docstrings.
"""
from __future__ import print_fu... | [
"scipy.stats.hypergeom.sf",
"numpy.radians",
"numpy.nan_to_num",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.vstack"
] | [((1244, 1272), 'numpy.array', 'np.array', (['lat_s'], {'dtype': 'float'}), '(lat_s, dtype=float)\n', (1252, 1272), True, 'import numpy as np\n'), ((1285, 1313), 'numpy.array', 'np.array', (['lat_t'], {'dtype': 'float'}), '(lat_t, dtype=float)\n', (1293, 1313), True, 'import numpy as np\n'), ((1326, 1354), 'numpy.array... |
# Thanks <NAME> for his: https://github.com/informramiz/opencv-face-recognition-python
from IPython.display import display
from PIL import Image
import sys, os
import numpy as np
import cv2
class FaceClassifier:
faceSize = -1
face_recognizer = None
debug = False
subjects = []
def __init__(sel... | [
"cv2.resize",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread",
"numpy.array",
"cv2.CascadeClassifier",
"PIL.Image.fromarray",
"cv2.face.FisherFaceRecognizer_create",
"cv2.destroyAllWindows",
"os.listdir",
"numpy.unique"
] | [((453, 491), 'cv2.face.FisherFaceRecognizer_create', 'cv2.face.FisherFaceRecognizer_create', ([], {}), '()\n', (489, 491), False, 'import cv2\n'), ((1711, 1726), 'cv2.imread', 'cv2.imread', (['img'], {}), '(img)\n', (1721, 1726), False, 'import cv2\n'), ((1925, 1962), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLO... |
#TA 2 BASE
import pdb
import numpy as np
import gym
from gym import make
import cProfile
import re
import uuid
import os
import random
import time
from utils import rollout
import time
import pickle
#import cv2
import PIL
import torch
import json
import argparse
from collections import OrderedDict
from functools impo... | [
"uuid.uuid4",
"numpy.random.seed",
"gym.make",
"torch.multiprocessing.set_sharing_strategy",
"csv.writer",
"numpy.std",
"os.cpu_count",
"torch.multiprocessing.set_start_method",
"numpy.mean",
"random.seed",
"UCCS_TA2_helper.UCCSTA2",
"cProfile.run"
] | [((663, 672), 'UCCS_TA2_helper.UCCSTA2', 'UCCSTA2', ([], {}), '()\n', (670, 672), False, 'from UCCS_TA2_helper import UCCSTA2\n'), ((995, 1012), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (1006, 1012), False, 'import random\n'), ((1013, 1033), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED... |
import numpy as np
from mlagents.trainers.buffer import (
AgentBuffer,
AgentBufferField,
BufferKey,
ObservationKeyPrefix,
RewardSignalKeyPrefix,
)
from mlagents.trainers.trajectory import ObsUtil
def assert_array(a, b):
assert a.shape == b.shape
la = list(a.flatten())
lb = list(b.flatt... | [
"io.BytesIO",
"mlagents.trainers.buffer.AgentBuffer",
"numpy.allclose",
"mlagents.trainers.buffer.AgentBuffer._encode_key",
"mlagents.trainers.buffer.AgentBufferField",
"numpy.array",
"numpy.array_equal",
"mlagents.trainers.trajectory.ObsUtil.get_name_at"
] | [((437, 450), 'mlagents.trainers.buffer.AgentBuffer', 'AgentBuffer', ([], {}), '()\n', (448, 450), False, 'from mlagents.trainers.buffer import AgentBuffer, AgentBufferField, BufferKey, ObservationKeyPrefix, RewardSignalKeyPrefix\n'), ((3835, 3848), 'mlagents.trainers.buffer.AgentBuffer', 'AgentBuffer', ([], {}), '()\n... |
import numpy as np
#
#
#
def _siesta2blanko_denvec(orb2m, vec, orb_sc2orb_uc=None):
n,nreim = vec.shape
if orb_sc2orb_uc is None:
orb_sc2m = orb2m
else:
orb_sc2m = np.zeros_like(orb_sc2orb_uc)
for orb_sc,orb_uc in enumerate(orb_sc2orb_uc): orb_sc2m[orb_sc] = orb2m[orb_uc]
orb2ph = (-1.0)**orb_sc... | [
"numpy.zeros_like"
] | [((181, 209), 'numpy.zeros_like', 'np.zeros_like', (['orb_sc2orb_uc'], {}), '(orb_sc2orb_uc)\n', (194, 209), True, 'import numpy as np\n')] |
from .RainbowSim import RainbowSim
import numpy as np
class RbCartesianSumsEq(RainbowSim):
def __init__(self, m, n, a, b=[0, 0]):
super(RbCartesianSumsEq, self).__init__(m * n, a, Point(b[0], b[1]), False)
self.M = m # rows
self.N = n # columns
self.sums = self.sets
self.... | [
"numpy.matrix"
] | [((2681, 2698), 'numpy.matrix', 'np.matrix', (['matrix'], {}), '(matrix)\n', (2690, 2698), True, 'import numpy as np\n'), ((2279, 2296), 'numpy.matrix', 'np.matrix', (['matrix'], {}), '(matrix)\n', (2288, 2296), True, 'import numpy as np\n')] |
#!/usr/bin/env python
import sys,time
import rospy
import roslib
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
import cv2
import message_filters
from sensor_msgs.msg import Image, CameraInfo
from std_msgs.msg import Header
class CutterNode:
def __init__(self):
self.image = np.zeros... | [
"sensor_msgs.msg.Image",
"cv_bridge.CvBridge",
"rospy.Subscriber",
"std_msgs.msg.Header",
"cv2.waitKey",
"cv2.threshold",
"numpy.float32",
"numpy.zeros",
"rospy.Publisher",
"cv2.imshow",
"numpy.dtype",
"rospy.init_node",
"cv2.normalize",
"rospy.spin",
"cv2.destroyAllWindows",
"cv2.name... | [((6360, 6403), 'cv2.namedWindow', 'cv2.namedWindow', (['"""cutter_node_depth_output"""'], {}), "('cutter_node_depth_output')\n", (6375, 6403), False, 'import cv2\n'), ((6408, 6443), 'cv2.namedWindow', 'cv2.namedWindow', (['"""cutter_node_mask"""'], {}), "('cutter_node_mask')\n", (6423, 6443), False, 'import cv2\n'), (... |
from __future__ import division
from numpy.testing import assert_almost_equal
from statsmodels.emplike.originregress import ELOriginRegress
from statsmodels.datasets import cancer
from .results.el_results import OriginResults
import numpy as np
class GenRes(object):
"""
Loads data and creates class instance o... | [
"statsmodels.datasets.cancer.load",
"statsmodels.emplike.originregress.ELOriginRegress",
"numpy.testing.assert_almost_equal"
] | [((381, 394), 'statsmodels.datasets.cancer.load', 'cancer.load', ([], {}), '()\n', (392, 394), False, 'from statsmodels.datasets import cancer\n'), ((704, 767), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', (['self.res1.params', 'self.res2.test_params', '(4)'], {}), '(self.res1.params, self.res2.test_para... |
import os
import SimpleITK as sitk
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn.functional as F
from sklearn.model_selection import train_test_split
from torch import nn
from torch.nn import Module, Conv3d, ConvTranspose3d, Linear, ReLU, Seque... | [
"matplotlib.pyplot.title",
"torch.optim.lr_scheduler.StepLR",
"numpy.mean",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.close",
"numpy.max",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"os.path.realpath",
"torch.cuda.is_availab... | [((1314, 1331), 'matplotlib.pyplot.title', 'plt.title', (['"""Loss"""'], {}), "('Loss')\n", (1323, 1331), True, 'import matplotlib.pyplot as plt\n'), ((1336, 1366), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Number of Epochs"""'], {}), "('Number of Epochs')\n", (1346, 1366), True, 'import matplotlib.pyplot as plt\... |
# Copyright 2019 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... | [
"numpy.full",
"numpy.divide",
"tensorio.compare_tensor",
"numpy.zeros_like",
"numpy.multiply",
"numpy.sum",
"numpy.log",
"numpy.amax",
"akg.utils.kernel_exec.op_build_test",
"numpy.random.randint",
"numpy.arange",
"gen_random.random_gaussian",
"base.get_rtol_atol",
"numpy.mean",
"akg.uti... | [((2070, 2092), 'numpy.multiply', 'np.multiply', (['bp', 'scale'], {}), '(bp, scale)\n', (2081, 2092), True, 'import numpy as np\n'), ((4014, 4051), 'numpy.full', 'np.full', (['output_shape', 'np.nan', 'dtype2'], {}), '(output_shape, np.nan, dtype2)\n', (4021, 4051), True, 'import numpy as np\n'), ((2412, 2626), 'akg.u... |
"""
Benchmarks for argument dispatching and call overhead of ``@jit`` functions.
"""
import numpy as np
rec_dtype = np.dtype([('a', np.float64),
('b', np.int32),
('c', np.complex64),
])
samples = {
'bool': True,
'int': 100000,
'float': ... | [
"numpy.empty",
"numpy.dtype",
"numpy.zeros",
"numpy.recarray",
"numba.jit"
] | [((120, 187), 'numpy.dtype', 'np.dtype', (["[('a', np.float64), ('b', np.int32), ('c', np.complex64)]"], {}), "([('a', np.float64), ('b', np.int32), ('c', np.complex64)])\n", (128, 187), True, 'import numpy as np\n'), ((368, 396), 'numpy.zeros', 'np.zeros', (['(10)'], {'dtype': 'np.int64'}), '(10, dtype=np.int64)\n', (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 <NAME> (Nagoya University)
# based on PyTorch implementation for WaveNet vocoder by <NAME> (Nagoya University)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
from __future__ import division
from __future__ import print_function
import argpar... | [
"utils.write_hdf5",
"argparse.ArgumentParser",
"utils.find_files",
"scipy.signal.firwin",
"numpy.arange",
"scipy.interpolate.interp1d",
"numpy.pad",
"numpy.set_printoptions",
"pyworld.synthesize",
"scipy.signal.lfilter",
"os.path.exists",
"soundfile.write",
"pyworld.d4c",
"soundfile.read",... | [((825, 862), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (844, 862), True, 'import numpy as np\n'), ((1528, 1569), 'scipy.signal.firwin', 'firwin', (['(255)', 'norm_cutoff'], {'pass_zero': '(False)'}), '(255, norm_cutoff, pass_zero=False)\n', (1534, 1569), Fa... |
from __future__ import print_function
import sys, os
sys.path.append('../')
import torch.utils.data as data
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import pickle
import settings
import time
dates = [];
dates.append('2012-01-08')
dates.append('2012-01-15')
dates.append('2012-0... | [
"pickle.dump",
"numpy.random.seed",
"numpy.abs",
"pandas.read_csv",
"numpy.argmin",
"numpy.mean",
"numpy.sin",
"pickle.load",
"sys.path.append",
"os.path.exists",
"numpy.linspace",
"numpy.square",
"numpy.min",
"numpy.cos",
"numpy.concatenate",
"os.makedirs",
"torch.LongTensor",
"nu... | [((53, 75), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (68, 75), False, 'import sys, os\n'), ((10785, 10809), 'numpy.mean', 'np.mean', (['(error * mapping)'], {}), '(error * mapping)\n', (10792, 10809), True, 'import numpy as np\n'), ((4254, 4274), 'numpy.random.seed', 'np.random.seed', (['... |
"""
RANSAC for Similarity Transformation Estimation
Modified from https://github.com/hughw19/NOCS_CVPR2019
Originally Written by <NAME>
"""
import time
import numpy as np
def estimateSimilarityUmeyama(SourceHom, TargetHom):
# Copy of original paper is at: http://web.stanford.edu/class/cs273/refs/umeya... | [
"numpy.sum",
"numpy.ones",
"numpy.isnan",
"numpy.linalg.svd",
"numpy.mean",
"numpy.arange",
"numpy.random.randint",
"numpy.linalg.norm",
"numpy.tile",
"numpy.transpose",
"numpy.identity",
"numpy.linalg.det",
"numpy.var",
"numpy.stack",
"numpy.logical_and",
"numpy.zeros",
"time.time",... | [((348, 381), 'numpy.mean', 'np.mean', (['SourceHom[:3, :]'], {'axis': '(1)'}), '(SourceHom[:3, :], axis=1)\n', (355, 381), True, 'import numpy as np\n'), ((403, 436), 'numpy.mean', 'np.mean', (['TargetHom[:3, :]'], {'axis': '(1)'}), '(TargetHom[:3, :], axis=1)\n', (410, 436), True, 'import numpy as np\n'), ((938, 982)... |
pathTo20Nar = "/home/r0b3/dev/rust/20mlish6"
# load module from path for python 3.5+
# from https://stackoverflow.com/a/67692/388614
import importlib.util
spec = importlib.util.spec_from_file_location("module.Binding", pathTo20Nar+"/Binding.py")
Binding = importlib.util.module_from_spec(spec)
spec.loader.exec_module(Bi... | [
"numpy.abs",
"pybullet.setJointMotorControl2",
"pybullet.connect",
"pybullet.createCollisionShape",
"pybullet.getQuaternionFromEuler",
"pybullet.setGravity",
"math.cos",
"pybullet.getEulerFromQuaternion",
"pybullet.getJointInfo",
"math.sqrt",
"pybullet.changeDynamics",
"math.sin",
"time.slee... | [((503, 519), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (512, 519), True, 'import pybullet as p\n'), ((625, 648), 'pybullet.setGravity', 'p.setGravity', (['(0)', '(0)', '(-10)'], {}), '(0, 0, -10)\n', (637, 648), True, 'import pybullet as p\n'), ((657, 681), 'pybullet.loadURDF', 'p.loadURDF', (['""... |
import unittest
from dedupe.distance.haversine import compareLatLong
import numpy
class TestHaversine(unittest.TestCase):
def setUp(self):
self.sfo = (37.619105, -122.375236)
self.ord = (41.981649, -87.906670)
def test_haversine_equal(self):
km_dist_val = compareLatLong(self.sfo, self.... | [
"unittest.main",
"dedupe.distance.haversine.compareLatLong",
"numpy.isnan"
] | [((917, 932), 'unittest.main', 'unittest.main', ([], {}), '()\n', (930, 932), False, 'import unittest\n'), ((290, 324), 'dedupe.distance.haversine.compareLatLong', 'compareLatLong', (['self.sfo', 'self.ord'], {}), '(self.sfo, self.ord)\n', (304, 324), False, 'from dedupe.distance.haversine import compareLatLong\n'), ((... |
import itertools
import os
import more_itertools
import torch
import numpy as np
from bpe.functional import utils
from collections import namedtuple
import multiprocessing
BodyPart = namedtuple('BodyPart', [
'right_arm',
'left_arm',
'right_leg',
'left_leg',
'torso', # 6 joints + velocity
])
c... | [
"numpy.asarray",
"bpe.functional.utils.ensure_dirs",
"itertools.accumulate",
"numpy.arange",
"collections.namedtuple",
"torch.cuda.is_available",
"os.path.join",
"multiprocessing.cpu_count"
] | [((187, 274), 'collections.namedtuple', 'namedtuple', (['"""BodyPart"""', "['right_arm', 'left_arm', 'right_leg', 'left_leg', 'torso']"], {}), "('BodyPart', ['right_arm', 'left_arm', 'right_leg', 'left_leg',\n 'torso'])\n", (197, 274), False, 'from collections import namedtuple\n'), ((10897, 10944), 'os.path.join', ... |
import os
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from mmcv.parallel import DataContainer as DC
from torch.utils.data import Dataset
from .transforms import (ImageTransform, BboxTransform, MaskTransform,
SegMapTransform, Numpy2Tensor)
from .utils ... | [
"numpy.random.seed",
"os.path.isfile",
"numpy.random.randint",
"mmcv.parallel.DataContainer",
"os.path.join",
"numpy.random.choice",
"numpy.random.shuffle",
"tqdm.tqdm",
"torch.utils.data.dataloader.default_collate",
"mmcv.is_list_of",
"os.path.basename",
"numpy.hstack",
"os.listdir",
"jso... | [((4454, 4493), 'mmcv.is_list_of', 'mmcv.is_list_of', (['self.img_scales', 'tuple'], {}), '(self.img_scales, tuple)\n', (4469, 4493), False, 'import mmcv\n'), ((6677, 6699), 'numpy.random.choice', 'np.random.choice', (['pool'], {}), '(pool)\n', (6693, 6699), True, 'import numpy as np\n'), ((7056, 7080), 'mmcv.load', 'm... |
# 画图
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.transforms as trs
import math
import seaborn
data = pd.read_csv('cs-training.csv', index_col=0)
data.drop_duplicates(inplace=True)
data.boxplot(column=['NumberOfTime30-59DaysPastDueNotWorse',
'NumberOfT... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.log",
"matplotlib.transforms.Bbox",
"pandas.read_csv",
"matplotlib.pyplot.close",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.yticks",
"numpy.isfinite",
"math.log",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.subplots",
"... | [((148, 191), 'pandas.read_csv', 'pd.read_csv', (['"""cs-training.csv"""'], {'index_col': '(0)'}), "('cs-training.csv', index_col=0)\n", (159, 191), True, 'import pandas as pd\n'), ((378, 449), 'matplotlib.pyplot.title', 'plt.title', (['"""Before Cleaning"""'], {'fontproperties': '"""Times New Roman"""', 'size': '(16)'... |
import numpy as np
def baap_baap(n, index):
print("Running Graph_Gen.baap_baap")
true_hoc = np.load("true_hoc.npy")
weapons = np.load("weapons.npy")
death_e = np.load("death_e.npy")
jail = np.load("jail.npy")
graph = np.zeros([n**2, n**2], dtype=int)
not_all = []
for i in ra... | [
"numpy.load",
"numpy.zeros"
] | [((107, 130), 'numpy.load', 'np.load', (['"""true_hoc.npy"""'], {}), "('true_hoc.npy')\n", (114, 130), True, 'import numpy as np\n'), ((146, 168), 'numpy.load', 'np.load', (['"""weapons.npy"""'], {}), "('weapons.npy')\n", (153, 168), True, 'import numpy as np\n'), ((184, 206), 'numpy.load', 'np.load', (['"""death_e.npy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script uses Imgaug to display various augmentation methods
for a few labeled images of a mouse (Data in folder mouse_m7s3
from Mathis, A., et al. DeepLabCut: markerless pose estimation of user-defined body parts with deep learning.
Nat Neurosci 21, 1281–1289 (2018... | [
"imgaug.augmentables.KeypointsOnImage",
"imgaug.augmenters.JpegCompression",
"imgaug.augmenters.CoarseDropout",
"imgaug.augmenters.Invert",
"imgaug.seed",
"numpy.hstack",
"numpy.shape",
"imgaug.augmenters.MotionBlur",
"imgaug.augmenters.Fliplr",
"imgaug.augmenters.Flipud",
"numpy.isfinite",
"i... | [((1124, 1134), 'imgaug.seed', 'ia.seed', (['(1)'], {}), '(1)\n', (1131, 1134), True, 'import imgaug as ia\n'), ((976, 1025), 'os.path.join', 'os.path.join', (['imfolder', '"""CollectedData_Pranav.h5"""'], {}), "(imfolder, 'CollectedData_Pranav.h5')\n", (988, 1025), False, 'import os\n'), ((2163, 2178), 'numpy.shape', ... |
# Copyright (C) 2020 TU Dresden
# Licensed under the ISC license (see LICENSE.txt)
#
# Authors: <NAME>
import random
import numpy as np
import tqdm
from hydra.utils import instantiate
from mocasin.util import logging
from mocasin.representations import MappingRepresentation
from mocasin.mapper.random import RandomPar... | [
"tqdm.tqdm",
"numpy.random.seed",
"hydra.utils.instantiate",
"numpy.floor",
"mocasin.mapper.random.RandomPartialMapper",
"numpy.errstate",
"random.random",
"random.seed",
"numpy.exp",
"mocasin.mapper.utils.SimulationManager",
"mocasin.util.logging.getLogger"
] | [((434, 461), 'mocasin.util.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (451, 461), False, 'from mocasin.util import logging\n'), ((2767, 2791), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (2778, 2791), False, 'import random\n'), ((2800, 2827), 'numpy.random.... |
import scipy.io
import glob
import numpy as np
def get_data(path, *, debug=False):
data = {
'A': [],
'AA': [],
'Ae': [],
'AeA': [],
'EE': [],
'OO': [],
'UU': []
}
indices = np.array([1, 2, 7, 8, 9, 10, 19]) - 1
if debug:
breakpoint()
... | [
"numpy.array",
"glob.glob"
] | [((333, 348), 'glob.glob', 'glob.glob', (['path'], {}), '(path)\n', (342, 348), False, 'import glob\n'), ((243, 276), 'numpy.array', 'np.array', (['[1, 2, 7, 8, 9, 10, 19]'], {}), '([1, 2, 7, 8, 9, 10, 19])\n', (251, 276), True, 'import numpy as np\n'), ((1270, 1285), 'numpy.array', 'np.array', (['label'], {}), '(label... |
# -*- coding: utf-8 -*-
# Copyright 2019- <NAME>, MIT license
"""
Utility functions and classes for Auto and Cross Correlogram calculation.
"""
import scipy.signal
import numpy as np
import collections
from obspy import UTCDateTime
from obspy import read
def smooth(x, window_len=None, window='flat', method='zeros'):
... | [
"os.makedirs",
"os.path.basename",
"os.path.dirname",
"numpy.zeros",
"numpy.ones",
"collections.defaultdict",
"os._exit",
"obspy.UTCDateTime",
"os.path.splitext",
"glob.glob",
"obspy.read"
] | [((4378, 4415), 'glob.glob', 'glob.glob', (["(directory + '/*.' + suffix)"], {}), "(directory + '/*.' + suffix)\n", (4387, 4415), False, 'import glob\n'), ((2068, 2092), 'numpy.ones', 'np.ones', (['window_len', '"""d"""'], {}), "(window_len, 'd')\n", (2075, 2092), True, 'import numpy as np\n'), ((2995, 3036), 'collecti... |
# Copyright 2018 Owkin, inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"json.dump",
"os.path.abspath",
"json.load",
"os.path.dirname",
"sklearn.model_selection.KFold",
"numpy.array",
"os.path.join"
] | [((695, 720), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (710, 720), False, 'import os\n'), ((740, 805), 'os.path.join', 'os.path.join', (['current_directory', '"""../../titanic/assets_keys.json"""'], {}), "(current_directory, '../../titanic/assets_keys.json')\n", (752, 805), False, 'impo... |
""" Display_Widget module. """
# ISC License
#
# Copyright (c) 2020–2022, <NAME>, <NAME>. <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copi... | [
"PyQt5.QtWidgets.QComboBox",
"magneticalc.QtWidgets2.QIconLabel.QIconLabel",
"magneticalc.Debug.Debug",
"numpy.power",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QCheckBox",
"magneticalc.QtWidgets2.QGroupBox2.QGroupBox2.__init__",
"PyQt5.QtWidgets.QVBoxLayout",
"magneticalc.QtWidgets2.QHLine.QH... | [((2311, 2370), 'magneticalc.QtWidgets2.QGroupBox2.QGroupBox2.__init__', 'QGroupBox2.__init__', (['self', '"""Display"""'], {'color': 'Theme.DarkColor'}), "(self, 'Display', color=Theme.DarkColor)\n", (2330, 2370), False, 'from magneticalc.QtWidgets2.QGroupBox2 import QGroupBox2\n'), ((2379, 2411), 'magneticalc.Debug.D... |
#
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"cupy.array",
"cuml.common.array.CumlArray.full",
"cuml.common.array.CumlArray",
"pytest.mark.parametrize",
"pytest.raises",
"cudf.DataFrame.from_gpu_matrix",
"cupy.asnumpy",
"cupy.sqrt",
"pickle.dumps",
"pickle.loads",
"copy.deepcopy",
"cuml.common.array.CumlArray.empty",
"cupy.zeros",
"c... | [((1763, 1818), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_type"""', 'test_input_types'], {}), "('input_type', test_input_types)\n", (1786, 1818), False, 'import pytest\n'), ((1820, 1869), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', 'test_dtypes_all'], {}), "('dtype', t... |
import os
import argparse
import collections
import random
import time
import sys
import shutil
import numpy as np
import pandas as pd
import tqdm
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision import transforms
from retinanet import model, coco_eval, csv_eval
from ... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"time.strftime",
"shutil.rmtree",
"os.path.join",
"retinanet.dataloader.Normalizer",
"pandas.DataFrame",
"retinanet.dataloader.Augmenter",
"torch.utils.data.DataLoader",
"torch.__version__.split",
"retinanet.dataloader.Resizer",
"os... | [((604, 631), 'numpy.random.seed', 'np.random.seed', (['worker_seed'], {}), '(worker_seed)\n', (618, 631), True, 'import numpy as np\n'), ((636, 660), 'random.seed', 'random.seed', (['worker_seed'], {}), '(worker_seed)\n', (647, 660), False, 'import random\n'), ((701, 726), 'numpy.random.seed', 'np.random.seed', (['wor... |
from __future__ import division
import numpy as np
from PIL import Image
from io import BytesIO
def pil2bio(im, fmt='PNG'):
"""Convert a PIL Image to a StringIO object """
if im.mode == 'CMYK': # this causes an error
im = im.convert('RGB')
bio = BytesIO()
im.save(bio, format=fmt)
bio.seek(... | [
"numpy.pad",
"io.BytesIO",
"numpy.asarray",
"numpy.zeros",
"PIL.Image.open",
"numpy.mean",
"PIL.Image.fromarray"
] | [((268, 277), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (275, 277), False, 'from io import BytesIO\n'), ((403, 412), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (410, 412), False, 'from io import BytesIO\n'), ((465, 480), 'PIL.Image.open', 'Image.open', (['bio'], {}), '(bio)\n', (475, 480), False, 'from PIL import Imag... |
import numpy as np
import tensorflow as tf
def glorot(shape, dtype=tf.float32, scope='default'):
with tf.variable_scope(scope):
init_range = np.sqrt(6.0 / (shape[0] + shape[1]))
init = tf.random_uniform(
shape, minval=-init_range, maxval=init_range, dtype=dtype)
return tf.Varia... | [
"tensorflow.random_uniform",
"tensorflow.variable_scope",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.zeros",
"numpy.sqrt"
] | [((108, 132), 'tensorflow.variable_scope', 'tf.variable_scope', (['scope'], {}), '(scope)\n', (125, 132), True, 'import tensorflow as tf\n'), ((155, 191), 'numpy.sqrt', 'np.sqrt', (['(6.0 / (shape[0] + shape[1]))'], {}), '(6.0 / (shape[0] + shape[1]))\n', (162, 191), True, 'import numpy as np\n'), ((207, 283), 'tensorf... |
#!/usr/bin/env python
# encoding: utf-8
# Created by <NAME> on 2016-02-18 18:04:14
# Licensed under a 3-clause BSD license.
# Revision History:
# Initial Version: 2016-02-18 18:04:14 by <NAME>
# Last Modified On: 2016-02-18 18:04:14 by Brian
from __future__ import print_function
from __future__ import divisi... | [
"numpy.round",
"flask.Blueprint"
] | [((513, 555), 'flask.Blueprint', 'flask.Blueprint', (['"""jinja_filters"""', '__name__'], {}), "('jinja_filters', __name__)\n", (528, 555), False, 'import flask\n'), ((1828, 1846), 'numpy.round', 'np.round', (['value', '(4)'], {}), '(value, 4)\n', (1836, 1846), True, 'import numpy as np\n'), ((1726, 1740), 'numpy.round... |
from sklearn.metrics import confusion_matrix
import tensorflow as tf
import math
import numpy as np
def multi_focal_loss(gamma, alpha, y_true, y_pred):
epsilon = 1.e-7
#gamma=5.
alpha = tf.constant(alpha, dtype=tf.float32)
y_true = tf.cast(y_true, tf.float32)
y_pred = tf.clip_by_value(y_pred, ep... | [
"math.isnan",
"tensorflow.clip_by_value",
"tensorflow.subtract",
"numpy.seterr",
"tensorflow.reduce_mean",
"tensorflow.constant",
"tensorflow.ones_like",
"tensorflow.cast",
"tensorflow.multiply",
"tensorflow.log",
"sklearn.metrics.confusion_matrix"
] | [((201, 237), 'tensorflow.constant', 'tf.constant', (['alpha'], {'dtype': 'tf.float32'}), '(alpha, dtype=tf.float32)\n', (212, 237), True, 'import tensorflow as tf\n'), ((252, 279), 'tensorflow.cast', 'tf.cast', (['y_true', 'tf.float32'], {}), '(y_true, tf.float32)\n', (259, 279), True, 'import tensorflow as tf\n'), ((... |
"""
Connections are periods of continuous lock (and therefore carrier phase offsets)
between satellites and ground stations.
Things to manage those are stored here
"""
from __future__ import annotations # defer type annotations due to circular stuff
import collections
from functools import cached_property
from typing ... | [
"numpy.std",
"laika.lib.coordinates.ecef2geodetic",
"numpy.mean",
"numpy.arange",
"tid.util.bpfilter",
"numpy.diff",
"tid.tec.calculate_vtecs",
"tid.tec.ion_locs"
] | [((4734, 4782), 'numpy.arange', 'numpy.arange', (['self.tick_start', '(self.tick_end + 1)'], {}), '(self.tick_start, self.tick_end + 1)\n', (4746, 4782), False, 'import numpy\n'), ((6848, 6870), 'numpy.mean', 'numpy.mean', (['difference'], {}), '(difference)\n', (6858, 6870), False, 'import numpy\n'), ((6899, 6920), 'n... |
# Third-party
import numpy as np
from scipy.optimize import minimize
# Project
from ..utils import gaussian_constant
__all__ = ['fit_emission_line']
def _errfunc(p, pix, flux, flux_ivar):
if p[0] < 0 or p[2] < 0:
return np.inf
return np.sum((gaussian_constant(pix, *p) - flux)**2)
def fit_emission_l... | [
"scipy.optimize.minimize",
"numpy.argmax"
] | [((1490, 1549), 'scipy.optimize.minimize', 'minimize', (['_errfunc'], {'x0': 'p0', 'args': '(pix_grid, flux, flux_ivar)'}), '(_errfunc, x0=p0, args=(pix_grid, flux, flux_ivar))\n', (1498, 1549), False, 'from scipy.optimize import minimize\n'), ((964, 979), 'numpy.argmax', 'np.argmax', (['flux'], {}), '(flux)\n', (973, ... |
#!/usr/bin/env python
"""
Training and using a KNN for 1D data interpolation and extrapolation.
Comparison of training methods, EKF vs SGD.
"""
# Dependencies
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import kalmann
# Get some noisy training data, a fun compact function
stdev ... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.arange",
"numpy.exp",
"kalmann.KNN",
"matplotlib.pyplot.grid"
] | [((331, 354), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.2)'], {}), '(-10, 10, 0.2)\n', (340, 354), True, 'import numpy as np\n'), ((507, 556), 'kalmann.KNN', 'kalmann.KNN', ([], {'nu': '(1)', 'ny': '(1)', 'nl': '(10)', 'neuron': '"""logistic"""'}), "(nu=1, ny=1, nl=10, neuron='logistic')\n", (518, 556), False... |
# beautified version of the code found in jupyter notebook
# for more comments and experiments look at notebook.ipynb
import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.callbacks import EarlyStopping
from keras.optimizers import RM... | [
"pandas.DataFrame",
"numpy.argmax",
"keras.layers.Activation",
"keras.layers.Dropout",
"keras.callbacks.EarlyStopping",
"numpy.arange",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential",
"pandas.concat"
] | [((505, 575), 'keras.callbacks.EarlyStopping', 'EarlyStopping', ([], {'monitor': '"""val_loss"""', 'verbose': '(0)', 'patience': '(100)', 'mode': '"""min"""'}), "(monitor='val_loss', verbose=0, patience=100, mode='min')\n", (518, 575), False, 'from keras.callbacks import EarlyStopping\n'), ((651, 671), 'numpy.argmax', ... |
import os,glob,numpy
os.chdir('/Desktop/malimg_dataset') # the parent folder with sub-folders
list_fams = os.listdir(os.getcwd()) # vector of strings with family names
no_imgs = [] # No. of samples per family
for i in range(len(list_fams)):
os.chdir(list_fams[i])
len1 = len(glob.glob('*.png')) # assuming the image... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"os.getcwd",
"random.shuffle",
"sklearn.cluster.MeanShift",
"numpy.zeros",
"leargist.color_gist",
"sklearn.cluster.estimate_bandwidth",
"matplotlib.pyplot.figure",
"random.random",
"glob.g... | [((21, 56), 'os.chdir', 'os.chdir', (['"""/Desktop/malimg_dataset"""'], {}), "('/Desktop/malimg_dataset')\n", (29, 56), False, 'import os, glob, numpy\n'), ((436, 454), 'numpy.zeros', 'numpy.zeros', (['total'], {}), '(total)\n', (447, 454), False, 'import os, glob, numpy\n'), ((1434, 1451), 'random.shuffle', 'random.sh... |
import scipy.linalg
import numpy as np
from tqdm import tqdm
from scipy.stats import norm
from sepia.SepiaDistCov import SepiaDistCov
class SepiaPrediction():
"""
Base class inherited for predictions. Contains:
:var sepia.SepiaModel model: SepiaModel instance
:var numpy.ndarray xpred: x values for wh... | [
"numpy.empty",
"numpy.reciprocal",
"numpy.ones",
"numpy.shape",
"numpy.linalg.svd",
"numpy.arange",
"numpy.tile",
"numpy.linalg.eig",
"numpy.reshape",
"numpy.kron",
"sepia.SepiaDistCov.SepiaDistCov",
"tqdm.tqdm",
"copy.deepcopy",
"numpy.tensordot",
"numpy.hstack",
"numpy.squeeze",
"n... | [((27466, 27509), 'sepia.SepiaDistCov.SepiaDistCov', 'SepiaDistCov', (['xpred'], {'cat_ind': 'data.x_cat_ind'}), '(xpred, cat_ind=data.x_cat_ind)\n', (27478, 27509), False, 'from sepia.SepiaDistCov import SepiaDistCov\n'), ((27526, 27577), 'sepia.SepiaDistCov.SepiaDistCov', 'SepiaDistCov', (['data.x', 'xpred'], {'cat_i... |
import numpy as np
from random import shuffle
def svm_loss_naive(W, X, y, reg):
"""
Structured SVM loss function, naive implementation (with loops).
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
... | [
"numpy.nonzero",
"numpy.zeros",
"numpy.sum",
"numpy.reshape"
] | [((680, 697), 'numpy.zeros', 'np.zeros', (['W.shape'], {}), '(W.shape)\n', (688, 697), True, 'import numpy as np\n'), ((2299, 2316), 'numpy.zeros', 'np.zeros', (['W.shape'], {}), '(W.shape)\n', (2307, 2316), True, 'import numpy as np\n'), ((3424, 3451), 'numpy.nonzero', 'np.nonzero', (['(scores_diff < 0)'], {}), '(scor... |
import time
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import ccobra
import onehot
class RNN(nn.Module):
def __init__(self, input_size=12, hidden_size=64, output_size=9):
super(RNN, self).__init__()
self.lstm = nn.LSTM(
input_size=input_size,
... | [
"ccobra.syllogistic.Syllogism",
"numpy.std",
"torch.nn.CrossEntropyLoss",
"time.time",
"numpy.mean",
"onehot.onehot_syllogism_content",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LSTM"
] | [((275, 361), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'input_size', 'hidden_size': 'hidden_size', 'num_layers': '(2)', 'dropout': '(0.2)'}), '(input_size=input_size, hidden_size=hidden_size, num_layers=2,\n dropout=0.2)\n', (282, 361), True, 'import torch.nn as nn\n'), ((426, 451), 'torch.nn.Linear', 'nn.Lin... |
import numpy as np
import pandas as pd
import sqlalchemy as sqa
from sqlalchemy.pool import NullPool
from sqlalchemy.sql.expression import func
from sqlalchemy.schema import MetaData
from io import BytesIO
import urllib
# mysql://ekwan16:h9#Li48Z#hY$b@J8@SG-nmrdatabase-2962-master.servers.mongodirector.com/pbe0
# sta... | [
"sqlalchemy.schema.MetaData",
"io.BytesIO",
"numpy.load",
"sqlalchemy.sql.expression.func.rand",
"sqlalchemy.select",
"sqlalchemy.sql.expression.func",
"urllib.parse.quote",
"sqlalchemy.Table",
"sqlalchemy.update",
"pandas.read_sql_query",
"sqlalchemy.create_engine",
"configparser.ConfigParser... | [((1033, 1051), 'io.BytesIO', 'BytesIO', (['arr_bytes'], {}), '(arr_bytes)\n', (1040, 1051), False, 'from io import BytesIO\n'), ((1068, 1106), 'numpy.load', 'np.load', (['load_bytes'], {'allow_pickle': '(True)'}), '(load_bytes, allow_pickle=True)\n', (1075, 1106), True, 'import numpy as np\n'), ((4948, 4962), 'configp... |
# Function generate_exposure()
# The function makes use of several helper functions, which can be found below the function definition.
# Dependencies
import os
import numpy as np
from astropy.io import fits
import astropy.units as u
from datetime import datetime
# Main definition
def generate_exposure(target, tel... | [
"astropy.io.fits.PrimaryHDU",
"numpy.zeros",
"datetime.datetime.now",
"os.path.split"
] | [((1822, 1839), 'astropy.io.fits.PrimaryHDU', 'fits.PrimaryHDU', ([], {}), '()\n', (1837, 1839), False, 'from astropy.io import fits\n'), ((2178, 2241), 'numpy.zeros', 'np.zeros', (['(number_frames, detector.shape[0], detector.shape[1])'], {}), '((number_frames, detector.shape[0], detector.shape[1]))\n', (2186, 2241), ... |
# Copyright (c) 2021 VISTEC - Vidyasirimedhi Institute of Science and Technology
# Distribute under MIT License
# Authors:
# - <NAME> <suttisak.w_s19[-at-]vistec.ac.th>
# - <NAME> <pakkapon.p_s19[-at-]vistec.ac.th>
# - <NAME> <jiraphony_pro[-at-]vistec.ac.th>
# - <NAME> <supasorn.s[-at-]vistec.ac.th>
from __future... | [
"sys.stdout.write",
"os.get_terminal_size",
"json.load",
"numpy.random.seed",
"os.path.join",
"torch.utils.data.DataLoader",
"os.path.basename",
"skimage.io.imread",
"threading.Timer",
"os.path.exists",
"numpy.zeros",
"time.time",
"sys.stdout.flush",
"torch.utils.data.SubsetRandomSampler",... | [((745, 783), 'os.path.exists', 'os.path.exists', (["(dpath + '/models.json')"], {}), "(dpath + '/models.json')\n", (759, 783), False, 'import os\n'), ((856, 899), 'os.path.exists', 'os.path.exists', (["(dpath + '/poses_bounds.npy')"], {}), "(dpath + '/poses_bounds.npy')\n", (870, 899), False, 'import os\n'), ((1602, 1... |
#!/usr/bin/env python
from ast import literal_eval
from fenics import *
from itertools import combinations_with_replacement
from math import floor, ceil
import numpy as np
import matplotlib.pyplot as plt
def update_params(argv, params):
''' Update default dictionary with system arguments'''
if len(argv) > 1:
p... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.maximum",
"math.ceil",
"math.floor",
"matplotlib.pyplot.colorbar",
"itertools.combinations_with_replacement",
"numpy.linalg.eigh",
"numpy.min",
"ast.literal_eval",
"numpy.sqrt",
"numpy.concatenate",
"numpy.linalg.multi_dot"
] | [((479, 498), 'numpy.linalg.eigh', 'np.linalg.eigh', (['mat'], {}), '(mat)\n', (493, 498), True, 'import numpy as np\n'), ((719, 758), 'numpy.linalg.multi_dot', 'np.linalg.multi_dot', (['[V, diag_mat, V.T]'], {}), '([V, diag_mat, V.T])\n', (738, 758), True, 'import numpy as np\n'), ((1354, 1397), 'itertools.combination... |
#!/usr.bin/env python
#<NAME> - 1/13/14
"""This code is from the IDL Astronomy Users Library"""
import numpy as np
import dao_value
import pyfits
def rdpsf(psfname):
"""Read the FITS file created by GETPSF in the DAOPHOT sequence
Combines the Gaussian with the residuals to create an output PSF array.
... | [
"dao_value.dao_value",
"numpy.zeros",
"pyfits.getdata",
"pyfits.getheader",
"numpy.arange",
"numpy.repeat"
] | [((996, 1019), 'pyfits.getdata', 'pyfits.getdata', (['psfname'], {}), '(psfname)\n', (1010, 1019), False, 'import pyfits\n'), ((1031, 1056), 'pyfits.getheader', 'pyfits.getheader', (['psfname'], {}), '(psfname)\n', (1047, 1056), False, 'import pyfits\n'), ((1433, 1455), 'numpy.zeros', 'np.zeros', (['[npsf, npsf]'], {})... |
import numpy as np
def sigmoid(Z):
A = 1 / (1 + np.exp(-Z))
cache = Z
return A, cache
def relu(Z):
A = np.maximum(0, Z)
assert (A.shape == Z.shape)
cache = Z
return A, cache
def sigmoid_derivative(dA, cache):
Z = cache
s = 1 / (1 + np.exp(-Z))
dZ = dA * s * (1 - s)
a... | [
"numpy.array",
"numpy.maximum",
"numpy.exp"
] | [((123, 139), 'numpy.maximum', 'np.maximum', (['(0)', 'Z'], {}), '(0, Z)\n', (133, 139), True, 'import numpy as np\n'), ((421, 444), 'numpy.array', 'np.array', (['dA'], {'copy': '(True)'}), '(dA, copy=True)\n', (429, 444), True, 'import numpy as np\n'), ((54, 64), 'numpy.exp', 'np.exp', (['(-Z)'], {}), '(-Z)\n', (60, 6... |
"""
Do not change the input and output format.
If our script cannot run your code or the format is improper, your code will not be graded.
"""
import numpy as np
import dnn_misc
np.random.seed(123)
# example data
X = np.random.normal(0, 1, (5, 3))
# example modules
check_linear = dnn_misc.linear_layer(input_D = 3... | [
"numpy.random.seed",
"numpy.abs",
"dnn_misc.relu",
"numpy.array",
"numpy.random.normal",
"dnn_misc.dropout",
"dnn_misc.linear_layer"
] | [((181, 200), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (195, 200), True, 'import numpy as np\n'), ((221, 251), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(5, 3)'], {}), '(0, 1, (5, 3))\n', (237, 251), True, 'import numpy as np\n'), ((287, 331), 'dnn_misc.linear_layer', 'dnn_mi... |
"""
Some useful utils for the project
"""
import numpy
from sklearn.exceptions import NotFittedError
from gensim.sklearn_api import W2VTransformer
from tensorflow.keras.layers import Dense # pylint: disable=no-name-in-module
from tensorflow.keras.models import Sequential # pylint: disable=no-name-in-module
from tenso... | [
"tensorflow.keras.layers.Dense",
"numpy.zeros",
"sklearn.exceptions.NotFittedError",
"numpy.array",
"tensorflow.keras.models.Sequential",
"tensorflow.python.keras.optimizer_v2.gradient_descent.SGD"
] | [((1798, 1810), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1808, 1810), False, 'from tensorflow.keras.models import Sequential\n'), ((1823, 1871), 'tensorflow.keras.layers.Dense', 'Dense', (['(9)'], {'activation': '"""relu"""', 'input_dim': 'input_dim'}), "(9, activation='relu', input_dim=in... |
# -*- coding: utf-8 -*-
# occiput
# Harvard University, Martinos Center for Biomedical Imaging
# Aalto University, Department of Computer Science
from . import Scintillators
from . import Collimators
from ...DataSources.FileSources.nifti import load_nifti
# Import NiftyPy ray-tracers
from tomolab.Core.NiftyRec impor... | [
"h5py.File",
"tomolab.Core.NiftyRec.SPECT_project_parallelholes",
"scipy.signal.convolve2d",
"numpy.random.randint",
"tomolab.Core.NiftyRec.SPECT_backproject_parallelholes",
"PIL.Image.fromarray",
"scipy.optimize.fmin_l_bfgs_b"
] | [((1247, 1271), 'h5py.File', 'h5py.File', (['filename', '"""w"""'], {}), "(filename, 'w')\n", (1256, 1271), False, 'import h5py\n'), ((10714, 10885), 'tomolab.Core.NiftyRec.SPECT_project_parallelholes', 'SPECT_project_parallelholes', (['activity', 'cameras', 'attenuation', 'psf', 'self._background_activity', 'self._bac... |
# Copyright 2020 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",
"argparse.ArgumentParser",
"src.callback.ForwardBGCF",
"numpy.zeros",
"mindspore.train.serialization.load_checkpoint",
"mindspore.train.serialization.export",
"src.bgcf.BGCF"
] | [((908, 958), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""bgcf export"""'}), "(description='bgcf export')\n", (931, 958), False, 'import argparse\n'), ((2033, 2142), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': 'args.devi... |
# -*- coding: utf-8 -*-
"""\
Copyright (c) 2015-2018, MGH Computational Pathology
"""
import json
import six
from calicoml.core.algo.learners import SelectAndClassify
from calicoml.core.problem import Problem, ProblemVectorizer
from calicoml.core.serialization.model import ClassificationModel
from calicoml.core.to... | [
"pandas.DataFrame",
"calicoml.core.tools.predict_web_service.app.test_client",
"calicoml.core.problem.ProblemVectorizer",
"numpy.asarray",
"json.dumps",
"six.StringIO",
"nose.tools.assert_list_equal",
"calicoml.core.tools.predict_web_service.format_datatypes",
"calicoml.core.problem.Problem",
"nos... | [((618, 649), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(100, 2)'}), '(size=(100, 2))\n', (634, 649), True, 'import numpy as np\n'), ((658, 689), 'numpy.asarray', 'np.asarray', (['([1] * 50 + [0] * 50)'], {}), '([1] * 50 + [0] * 50)\n', (668, 689), True, 'import numpy as np\n'), ((699, 791), 'pandas.Dat... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
import tensorflow as tf
from core import plotlib
from core import imgproc
_TMPDIR = "tmp"
tf.logging.set_verbosity(tf.logging.INFO)
class PlotLibTest(tf.test.TestCase):
d... | [
"tensorflow.test.main",
"core.plotlib._py_draw_caption",
"tensorflow.logging.info",
"core.plotlib._py_draw_rectangles",
"cv2.imwrite",
"numpy.zeros",
"tensorflow.logging.set_verbosity",
"core.imgproc._py_gaussian_kernel",
"tensorflow.placeholder",
"core.plotlib._py_convert_to_heatmap",
"tensorfl... | [((233, 274), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (257, 274), True, 'import tensorflow as tf\n'), ((4551, 4565), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (4563, 4565), True, 'import tensorflow as tf\n'), ((374, 412), 'core.im... |
"""Evaluation Metrics for Genomics Datasets."""
import numpy as np
from deepchem.data import NumpyDataset
from scipy.signal import correlate2d
def get_motif_scores(encoded_sequences,
motif_names,
max_scores=None,
return_positions=False,
... | [
"numpy.full_like",
"numpy.maximum",
"numpy.log",
"numpy.empty",
"scipy.signal.correlate2d",
"numpy.sort",
"numpy.arange",
"simdna.synthetic.LoadedEncodeMotifs",
"deepchem.data.NumpyDataset",
"numpy.rollaxis",
"numpy.prod"
] | [((975, 1053), 'simdna.synthetic.LoadedEncodeMotifs', 'synthetic.LoadedEncodeMotifs', (['simdna.ENCODE_MOTIFS_PATH'], {'pseudocountProb': '(0.001)'}), '(simdna.ENCODE_MOTIFS_PATH, pseudocountProb=0.001)\n', (1003, 1053), False, 'from simdna import synthetic\n'), ((2739, 2786), 'numpy.full_like', 'np.full_like', (['enco... |
import scipy as sp
import scanpy.api as sc
import pandas as pd
import matplotlib.pyplot as plt
import glob
import numpy as np
### network derivation
# Manual
# what you need to run this:
# scanpy anndata object which has raw data stored in anndata.raw and 3d umap stored in anndata.obsm["X_umap"]
# let's call th... | [
"numpy.random.seed",
"numpy.sum",
"numpy.argmax",
"sklearn.preprocessing.scale",
"scanpy.api.tl.draw_graph",
"adjustText.adjust_text",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.mean",
"scipy.spatial.cKDTree",
"multiprocessing.cpu_count",
"scanpy.api.tl.umap",
"scanpy.api.... | [((2840, 2855), 'matplotlib.pyplot.grid', 'plt.grid', (['(False)'], {}), '(False)\n', (2848, 2855), True, 'import matplotlib.pyplot as plt\n'), ((2860, 2870), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2868, 2870), True, 'import matplotlib.pyplot as plt\n'), ((2880, 2920), 'matplotlib.pyplot.hist', 'plt.h... |
import numpy as np
import pandas as pd
chosen_list = np.loadtxt('./simulation/valid_list_random.txt')
a = chosen_list[0]
idx = a[np.where(a != -1)]
print(idx) | [
"numpy.where",
"numpy.loadtxt"
] | [((54, 102), 'numpy.loadtxt', 'np.loadtxt', (['"""./simulation/valid_list_random.txt"""'], {}), "('./simulation/valid_list_random.txt')\n", (64, 102), True, 'import numpy as np\n'), ((130, 147), 'numpy.where', 'np.where', (['(a != -1)'], {}), '(a != -1)\n', (138, 147), True, 'import numpy as np\n')] |
from flask import Flask,jsonify
from flask_cors import CORS
from flask import render_template
from flask import Flask, jsonify, request
from flask_cors import CORS
from flask_pymongo import PyMongo
import pymongo
import uuid
import json
from bson import ObjectId
import numpy as np
import pickle
DEBUG = True
applicat... | [
"flask_cors.CORS",
"flask.Flask",
"flask.jsonify",
"numpy.array",
"flask.request.get_json"
] | [((326, 341), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'from flask import Flask, jsonify, request\n'), ((404, 457), 'flask_cors.CORS', 'CORS', (['application'], {'resources': "{'/*': {'origins': '*'}}"}), "(application, resources={'/*': {'origins': '*'}})\n", (408, 457), False, 'fr... |
import os
import time
import numpy as np
import pandas
import pandas as pd
from scripts.MADDPG.maddpg import MADDPG
from scripts.MADDPG.buffer import MultiAgentReplayBuffer
# from scripts.MADDPG_original.maddpg import MADDPG
# from scripts.MADDPG_original.buffer import MultiAgentReplayBuffer
from make_env import mak... | [
"pandas.DataFrame",
"scripts.MADDPG.maddpg.MADDPG",
"os.path.join",
"numpy.mean",
"numpy.array",
"numpy.random.choice",
"scripts.MADDPG.edge_env.EdgeEnv",
"pandas.set_option",
"numpy.concatenate"
] | [((371, 417), 'pandas.set_option', 'pandas.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (388, 417), False, 'import pandas\n'), ((548, 560), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (556, 560), True, 'import numpy as np\n'), ((1369, 1516), 'scripts.MADDPG.edge_en... |
"""
Parameter uncertainties and likelihood ratio tests using Godambe information.
"""
import numpy
from dadi import Inference
from dadi.Spectrum_mod import Spectrum
def hessian_elem(func, f0, p0, ii, jj, eps, args=()):
"""
Calculate element [ii][jj] of the Hessian matrix, a matrix
of partial second deriva... | [
"numpy.outer",
"numpy.sum",
"numpy.log",
"dadi.Inference.optimal_sfs_scaling",
"numpy.isscalar",
"numpy.asarray",
"scipy.stats.distributions.chi2.cdf",
"dadi.Inference.ll",
"numpy.linalg.inv",
"numpy.array",
"numpy.exp",
"numpy.dot",
"numpy.atleast_1d",
"dadi.Spectrum_mod.Spectrum"
] | [((759, 798), 'numpy.array', 'numpy.array', (['p0'], {'copy': '(True)', 'dtype': 'float'}), '(p0, copy=True, dtype=float)\n', (770, 798), False, 'import numpy\n'), ((6533, 6552), 'numpy.linalg.inv', 'numpy.linalg.inv', (['J'], {}), '(J)\n', (6549, 6552), False, 'import numpy\n'), ((12815, 12832), 'numpy.isscalar', 'num... |
import unittest
import pytest
import numpy as np
from yaonet.tensor import BasicTensor, Tensor
class TestTensorAdd(unittest.TestCase):
def test_simple_add(self):
t1 = Tensor([1, 2, 3], requires_grad=True)
t2 = Tensor([4, 5, 6], requires_grad=True)
t3 = t1 + t2
assert t3.tolist()... | [
"yaonet.tensor.Tensor",
"numpy.array"
] | [((182, 219), 'yaonet.tensor.Tensor', 'Tensor', (['[1, 2, 3]'], {'requires_grad': '(True)'}), '([1, 2, 3], requires_grad=True)\n', (188, 219), False, 'from yaonet.tensor import BasicTensor, Tensor\n'), ((233, 270), 'yaonet.tensor.Tensor', 'Tensor', (['[4, 5, 6]'], {'requires_grad': '(True)'}), '([4, 5, 6], requires_gra... |
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License... | [
"numpy.random.seed",
"mxnet.random.seed",
"mxnet.nd.random.uniform",
"numpy.random.randint",
"random.seed",
"traceback.format_exc",
"multiprocessing.Queue",
"random.getrandbits",
"glob.glob",
"mxnet.gluon.data.RandomSampler",
"mxnet.gluon.data.SequentialSampler",
"os.path.expanduser",
"queue... | [((5986, 6018), 'os.path.expanduser', 'os.path.expanduser', (['file_pattern'], {}), '(file_pattern)\n', (6004, 6018), False, 'import os\n'), ((7806, 7828), 'random.seed', 'random.seed', (['self.seed'], {}), '(self.seed)\n', (7817, 7828), False, 'import random\n'), ((7837, 7865), 'numpy.random.seed', 'np.random.seed', (... |
import cv2
import numpy as np
from tqdm import tqdm
from utility_matching_functions import *
def get_accuracy_reject_characteristics(pdistArr, lp_text, thVal_list=None):
## Compute the Accuracy and Reject-Rates at different threshold values
# Get the index, text and matching-score of the closest license p... | [
"numpy.argmax",
"numpy.isnan",
"numpy.argmin",
"numpy.where",
"numpy.array"
] | [((355, 382), 'numpy.argmin', 'np.argmin', (['pdistArr'], {'axis': '(1)'}), '(pdistArr, axis=1)\n', (364, 382), True, 'import numpy as np\n'), ((1836, 1863), 'numpy.argmin', 'np.argmin', (['pdistArr'], {'axis': '(1)'}), '(pdistArr, axis=1)\n', (1845, 1863), True, 'import numpy as np\n'), ((4823, 4850), 'numpy.argmin', ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 29 15:46:47 2022
@author: Connor
"""
#
# Imports
#
import requests as reqs
import numpy as np
import matplotlib.pyplot as plt
import datetime
import os
from pathlib import Path
from scipy.special import erf
_BASE ="https://collegefootballrisk.com/api"
_SEASON = 1
plt.s... | [
"os.mkdir",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.gca",
"numpy.argmax",
"numpy.power",
"numpy.ones",
"numpy.argmin",
"datetime.datetime",
"matplotlib.pyplot.style.use",
"pathlib.Path",
"matplotlib.pyplot.figure",
"numpy.arange",
"requests.get",
"numpy.lin... | [((315, 335), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""bmh"""'], {}), "('bmh')\n", (328, 335), True, 'import matplotlib.pyplot as plt\n'), ((6067, 6144), 'requests.get', 'reqs.get', (["(_BASE + '/stats/leaderboard')"], {'params': "{'season': season, 'day': day}"}), "(_BASE + '/stats/leaderboard', params={'... |
# Adapted from https://github.com/SimingYan/HPNet/blob/main/src/approximation.py
import geomdl
import numpy as np
from scipy.special import comb
def fit_curve(points, degree, num_ctrls):
num_points, dim = points.shape
num_cpts = num_ctrls
# Get uk
uk = compute_params_curve(points, use_centripetal=Fa... | [
"numpy.stack",
"numpy.sum",
"numpy.linalg.lstsq",
"scipy.special.comb",
"numpy.square",
"numpy.transpose",
"numpy.zeros",
"numpy.expand_dims",
"numpy.floor",
"numpy.ones",
"numpy.random.random",
"numpy.array",
"numpy.arange",
"numpy.matmul",
"numpy.reshape",
"geomdl.BSpline.Surface",
... | [((685, 703), 'numpy.array', 'np.array', (['matrix_n'], {}), '(matrix_n)\n', (693, 703), True, 'import numpy as np\n'), ((892, 917), 'numpy.matmul', 'np.matmul', (['ps_inv', 'points'], {}), '(ps_inv, points)\n', (901, 917), True, 'import numpy as np\n'), ((11009, 11025), 'numpy.arange', 'np.arange', (['(n + 1)'], {}), ... |
"""
A set of functions and scripts to demonstrate camera calibration and
registration.
Notes:
* Parts of this module uses opencv calibration described here:
https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html
* and the Chruco board described here:
https://docs.opencv.org/4.0.0/d0/d3c/classcv_1_1aruco_1... | [
"numpy.sum",
"cv2.aruco.detectMarkers",
"cv2.aruco.calibrateCameraCharucoExtended",
"numpy.linalg.norm",
"os.path.join",
"numpy.full",
"cv2.initCameraMatrix2D",
"cv2.aruco.CharucoBoard_create",
"numpy.eye",
"os.path.exists",
"cv2.FileStorage",
"cv2.aruco.interpolateCornersCharuco",
"json.dum... | [((1875, 1897), 'numpy.zeros', 'np.zeros', ([], {'shape': '(3, 3)'}), '(shape=(3, 3))\n', (1883, 1897), True, 'import numpy as np\n'), ((1899, 1928), 'cv2.Rodrigues', 'cv2.Rodrigues', (['rotation', 'rmat'], {}), '(rotation, rmat)\n', (1912, 1928), False, 'import cv2\n'), ((2666, 2713), 'cv2.FileStorage', 'cv2.FileStora... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.