code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import pandas as pd
import numpy as np
import datetime
import time
import math
from pypfopt import risk_models
from pypfopt import expected_returns
from pypfopt import black_litterman
from pypfopt.efficient_frontier import EfficientFrontier
from pypfopt.black_litterman import BlackLittermanModel
from statsmodels.tsa.ar... | [
"pypfopt.risk_models.sample_cov",
"pandas.DataFrame",
"pypfopt.black_litterman.market_implied_risk_aversion",
"pypfopt.black_litterman.BlackLittermanModel",
"statsmodels.tsa.arima_model.ARIMA",
"pandas.read_csv",
"numpy.std",
"pypfopt.efficient_frontier.EfficientFrontier",
"pypfopt.black_litterman.m... | [((15524, 15549), 'pandas.read_csv', 'pd.read_csv', (['"""filter.csv"""'], {}), "('filter.csv')\n", (15535, 15549), True, 'import pandas as pd\n'), ((15559, 15605), 'pandas.read_csv', 'pd.read_csv', (['"""bloomberg.csv"""'], {'low_memory': '(False)'}), "('bloomberg.csv', low_memory=False)\n", (15570, 15605), True, 'imp... |
"""
Copyright (c) 2022 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 writin... | [
"tqdm.tqdm",
"os.path.basename",
"openvino.tools.accuracy_checker.argparser.build_arguments_parser",
"openvino.tools.accuracy_checker.evaluators.ModelEvaluator.from_configs",
"numpy.std",
"os.path.exists",
"time.time",
"nncf.experimental.onnx.engine.ONNXEngine",
"numpy.mean",
"numpy.array",
"nnc... | [((2209, 2267), 'nncf.common.utils.logger.logger.info', 'nncf_logger.info', (['"""Post-Training Quantization Parameters:"""'], {}), "('Post-Training Quantization Parameters:')\n", (2225, 2267), True, 'from nncf.common.utils.logger import logger as nncf_logger\n'), ((2272, 2332), 'nncf.common.utils.logger.logger.info', ... |
# python 3.9 (>=3.7)
# encoding=UTF-8
# author: xyb
#---------------------------------------------------------------
# 功能:进行趋势离散分析
#
import sys
import os
import json
import numpy as np
import pandas as pd
from statsmodels.tsa.stattools import adfuller as ADF
from util import *
def peakvalley(ts_analyze): # 数据的波峰波谷
... | [
"json.dump",
"numpy.size",
"statsmodels.tsa.stattools.adfuller",
"numpy.quantile",
"numpy.std",
"numpy.mean",
"os._exit",
"pandas.to_numeric"
] | [((360, 374), 'numpy.size', 'np.size', (['diff1'], {}), '(diff1)\n', (367, 374), True, 'import numpy as np\n'), ((2967, 2992), 'pandas.to_numeric', 'pd.to_numeric', (['df_analyze'], {}), '(df_analyze)\n', (2980, 2992), True, 'import pandas as pd\n'), ((3802, 3817), 'statsmodels.tsa.stattools.adfuller', 'ADF', (['ts_ana... |
import sys
import threading
import numpy as np
from Orange.data import Table
from Orange.widgets import widget
from AnyQt.QtCore import pyqtSlot
from orangewidget.utils.signals import Input, Output
from streaming.widgets.fixation_detector import FixationDetector
class FixationsWidget(widget.OWWidget):
"""
Ca... | [
"streaming.widgets.fixation_detector.FixationDetector",
"AnyQt.QtWidgets.QApplication",
"AnyQt.QtCore.pyqtSlot",
"threading.Lock",
"numpy.array",
"orangewidget.utils.signals.Input",
"orangewidget.utils.signals.Output",
"sys.exit"
] | [((2127, 2142), 'AnyQt.QtCore.pyqtSlot', 'pyqtSlot', (['Table'], {}), '(Table)\n', (2135, 2142), False, 'from AnyQt.QtCore import pyqtSlot\n'), ((2318, 2340), 'AnyQt.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2330, 2340), False, 'from AnyQt.QtWidgets import QApplication\n'), ((2445, 2... |
#!/usr/bin/env python3
import argparse
import datetime
import decimal
import os
import re
import sys
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal
# import pandas as pd
PING_TIME_REGEX = re.compile(r'^\[(\d+\.\d+)].*time=(\d+\.?\d*) ms$')
PING_STATS_REGEX = re.compile(r'^(\d)+ packets trans... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.path.basename",
"matplotlib.pyplot.legend",
"os.path.exists",
"datetime.datetime",
"datetime.datetime.strptime",
"datetime.datetime.fromtimestamp",
"numpy.convolve",
"os.path.expanduser",
"re.compile"
] | [((216, 273), 're.compile', 're.compile', (['"""^\\\\[(\\\\d+\\\\.\\\\d+)].*time=(\\\\d+\\\\.?\\\\d*) ms$"""'], {}), "('^\\\\[(\\\\d+\\\\.\\\\d+)].*time=(\\\\d+\\\\.?\\\\d*) ms$')\n", (226, 273), False, 'import re\n'), ((287, 346), 're.compile', 're.compile', (['"""^(\\\\d)+ packets transmitted, (\\\\d)+ received,"""']... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# <div style='background-image: url("../../share/images... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.ioff",
"numpy.zeros",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.gcf"
] | [((4009, 4032), 'matplotlib.use', 'matplotlib.use', (['"""nbagg"""'], {}), "('nbagg')\n", (4023, 4032), False, 'import matplotlib\n'), ((5721, 5733), 'numpy.zeros', 'np.zeros', (['nt'], {}), '(nt)\n', (5729, 5733), True, 'import numpy as np\n'), ((5882, 5894), 'numpy.zeros', 'np.zeros', (['nt'], {}), '(nt)\n', (5890, 5... |
import pandas as pd
import numpy as np
from river_dl.postproc_utils import fmt_preds_obs
from river_dl.loss_functions import rmse, nse, kge
def filter_negative_preds(y_true, y_pred):
"""
filters out negative predictions and prints a warning if there are >5% of predictions as negative
:param y_true: [arra... | [
"pandas.DataFrame",
"numpy.nanpercentile",
"river_dl.postproc_utils.fmt_preds_obs",
"numpy.log",
"river_dl.loss_functions.nse",
"numpy.where",
"river_dl.loss_functions.kge",
"pandas.Series",
"river_dl.loss_functions.rmse",
"pandas.concat"
] | [((813, 849), 'numpy.where', 'np.where', (['(y_pred < 0)', 'np.nan', 'y_true'], {}), '(y_pred < 0, np.nan, y_true)\n', (821, 849), True, 'import numpy as np\n'), ((863, 899), 'numpy.where', 'np.where', (['(y_pred < 0)', 'np.nan', 'y_pred'], {}), '(y_pred < 0, np.nan, y_pred)\n', (871, 899), True, 'import numpy as np\n'... |
import os
import numpy as np
import datetime
import matplotlib.patches as patches
import matplotlib.pyplot as plt
from skimage.transform import resize
from skimage import measure
from skimage.measure import regionprops
from skimage.io import imread
from skimage.filters import threshold_otsu
from skimage import measure... | [
"matplotlib.pyplot.show",
"skimage.filters.threshold_otsu",
"numpy.invert",
"matplotlib.patches.Rectangle",
"os.path.realpath",
"os.walk",
"matplotlib.pyplot.subplots",
"datetime.datetime.now",
"skimage.measure.label",
"skimage.transform.resize",
"sklearn.externals.joblib.load",
"os.path.join"... | [((511, 558), 'os.path.join', 'os.path.join', (['current_dir', '"""models/svc/svc.pkl"""'], {}), "(current_dir, 'models/svc/svc.pkl')\n", (523, 558), False, 'import os\n'), ((571, 623), 'os.path.join', 'os.path.join', (['current_dir', '"""license_plate/detected/"""'], {}), "(current_dir, 'license_plate/detected/')\n", ... |
import sys
import numpy as np
b: np.bool_
u8: np.uint64
i8: np.int64
f8: np.float64
c8: np.complex64
c16: np.complex128
m: np.timedelta64
U: np.str_
S: np.bytes_
reveal_type(c8.real) # E: {float32}
reveal_type(c8.imag) # E: {float32}
reveal_type(c8.real.real) # E: {float32}
reveal_type(c8.real.imag) # E: {float3... | [
"numpy.double",
"numpy.ubyte",
"numpy.short",
"numpy.longfloat",
"numpy.longcomplex",
"numpy.bytes0",
"numpy.int_",
"numpy.clongdouble",
"numpy.object0",
"numpy.float_",
"numpy.clongfloat",
"numpy.cdouble",
"numpy.csingle",
"numpy.void0",
"numpy.longdouble",
"numpy.int0",
"numpy.unic... | [((789, 807), 'numpy.unicode_', 'np.unicode_', (['"""foo"""'], {}), "('foo')\n", (800, 807), True, 'import numpy as np\n'), ((838, 852), 'numpy.str0', 'np.str0', (['"""foo"""'], {}), "('foo')\n", (845, 852), True, 'import numpy as np\n'), ((894, 907), 'numpy.unicode_', 'np.unicode_', ([], {}), '()\n', (905, 907), True,... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
# https://github.com/scikit-hep/awkward-1.0/issues/459#issuecomment-694941328
#
# So the rules would be,
# * if arrays have differe... | [
"awkward._v2.operations.describe.parameters",
"awkward._v2.highlevel.Array",
"awkward._v2.operations.structure.with_parameter",
"awkward._v2.operations.describe.type",
"awkward._v2.operations.structure.concatenate",
"numpy.array",
"awkward._v2.contents.UnionArray",
"numpy.arange",
"awkward._v2.opera... | [((641, 690), 'awkward._v2.highlevel.Array', 'ak._v2.highlevel.Array', (['[0.0, 1.1, 2.2, 3.3, 4.4]'], {}), '([0.0, 1.1, 2.2, 3.3, 4.4])\n', (663, 690), True, 'import awkward as ak\n'), ((709, 787), 'awkward._v2.operations.structure.with_parameter', 'ak._v2.operations.structure.with_parameter', (['plain_plain', '"""__a... |
from copy import deepcopy
from scipy import linalg as spla
import numpy as np
import pycufsm.analysis
import pycufsm.cfsm
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.cm import jet
import pycufsm.hel... | [
"matplotlib.pyplot.title",
"numpy.arctan2",
"numpy.abs",
"pycufsm.helpers.gammait2",
"IPython.core.display.HTML",
"matplotlib.patches.Polygon",
"numpy.sin",
"matplotlib.pyplot.gca",
"numpy.round",
"pycufsm.helpers.shapef",
"numpy.transpose",
"plotly.express.line_3d",
"numpy.append",
"numpy... | [((1976, 2029), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'constrained_layout': '(True)', 'figsize': '(6, 6)'}), '(constrained_layout=True, figsize=(6, 6))\n', (1988, 2029), True, 'import matplotlib.pyplot as plt\n'), ((2035, 2087), 'matplotlib.pyplot.plot', 'plt.plot', (['node[:, 1]', 'node[:, 2]', '"""bo"""... |
#!/usr/bin/env python
# Copyright (c) 2019-2021 <NAME>.
#
# Distributed under the MIT License.
# See LICENSE for more info.
import numpy as np
from . import utils
from qtpy.QtCore import QDirIterator
from qtpy.QtCore import QFileInfo
from qtpy.QtCore import QMutex
from qtpy.QtCore import QMutexLocker
from .elem... | [
"qtpy.QtCore.QDirIterator",
"qtpy.QtCore.QMutexLocker",
"qtpy.QtCore.QFileInfo",
"qtpy.QtCore.QMutex",
"numpy.vstack"
] | [((1132, 1140), 'qtpy.QtCore.QMutex', 'QMutex', ([], {}), '()\n', (1138, 1140), False, 'from qtpy.QtCore import QMutex\n'), ((1990, 2037), 'qtpy.QtCore.QDirIterator', 'QDirIterator', (['path', 'QDirIterator.Subdirectories'], {}), '(path, QDirIterator.Subdirectories)\n', (2002, 2037), False, 'from qtpy.QtCore import QDi... |
# Contributors: <NAME> (<EMAIL>) and <NAME> (<EMAIL>)
import OpenGL.GL as GL
import OpenGL.GLU as GLU
import OpenGL.GLUT as GLUT
import sys
import numpy as np
from pydart2.gui.opengl.scene import OpenGLScene
from pydart2.gui.glut.window import *
class StaticGLUTWindow(GLUTWindow):
def close(self):
GLUT.g... | [
"OpenGL.GLUT.glutKeyboardFunc",
"OpenGL.GLUT.glutDisplayFunc",
"OpenGL.GLUT.glutMainLoopEvent",
"OpenGL.GLUT.glutInitWindowPosition",
"OpenGL.GLUT.glutMouseFunc",
"numpy.frombuffer",
"OpenGL.GLUT.glutPostRedisplay",
"OpenGL.GL.glReadPixels",
"OpenGL.GLUT.glutInitDisplayMode",
"OpenGL.GLUT.glutResh... | [((314, 349), 'OpenGL.GLUT.glutDestroyWindow', 'GLUT.glutDestroyWindow', (['self.window'], {}), '(self.window)\n', (336, 349), True, 'import OpenGL.GLUT as GLUT\n'), ((358, 382), 'OpenGL.GLUT.glutMainLoopEvent', 'GLUT.glutMainLoopEvent', ([], {}), '()\n', (380, 382), True, 'import OpenGL.GLUT as GLUT\n'), ((452, 474), ... |
"""
A Converter converts between:
examples (each one a dict with keys like "filename" and "label")
arrays (numpy arrays input to or output from a network)
Dataset augmentation can be accomplished with a Converter that returns a
different array each time to_array is called with the same example
"""
import os
im... | [
"numpy.flip",
"os.path.join",
"numpy.argmax",
"numpy.zeros",
"numpy.expand_dims",
"numpy.mean",
"random.getrandbits",
"imutil.decode_jpg",
"os.path.expanduser"
] | [((1647, 1686), 'os.path.expanduser', 'os.path.expanduser', (["example['filename']"], {}), "(example['filename'])\n", (1665, 1686), False, 'import os\n'), ((1862, 1932), 'imutil.decode_jpg', 'imutil.decode_jpg', (['filename'], {'resize_to': 'self.img_shape', 'crop_to_box': 'box'}), '(filename, resize_to=self.img_shape,... |
import numpy as np
def precompute_BM(img, kHW, NHW, nHW, tauMatch):
"""
:search for similar patches
:param img: input image
:param kHW: length of side of patch
:param NHW: how many patches are stacked
:param nHW: length of side of search area
:param tauMatch: threshold determine whether tw... | [
"numpy.pad",
"cv2.circle",
"numpy.sum",
"utils.add_gaussian_noise",
"numpy.maximum",
"numpy.roll",
"cv2.cvtColor",
"utils.symetrize",
"cv2.imwrite",
"numpy.ones",
"cv2.imread",
"numpy.where",
"numpy.arange",
"cv2.rectangle",
"numpy.eye",
"numpy.concatenate"
] | [((1915, 2004), 'numpy.concatenate', 'np.concatenate', (['(near_pi[:, :, :, np.newaxis], near_pj[:, :, :, np.newaxis])'], {'axis': '(-1)'}), '((near_pi[:, :, :, np.newaxis], near_pj[:, :, :, np.newaxis]),\n axis=-1)\n', (1929, 2004), True, 'import numpy as np\n'), ((2019, 2058), 'numpy.where', 'np.where', (['(sum_ta... |
import numpy as np
from hfo import MOVE_TO, DRIBBLE_TO, KICK_TO, NOOP, DRIBBLE, PASS, MOVE, \
GO_TO_BALL
from plastic_agent.hfo_env.actions.base import BaseActions
from plastic_agent.hfo_env.game_interface import GameInterface
from plastic_agent.hfo_env.features.plastic import PlasticFeatures
from plastic_agent.ut... | [
"plastic_agent.utils.get_opposite_vector",
"numpy.linalg.norm",
"numpy.array",
"plastic_agent.utils.get_angle"
] | [((1239, 1317), 'numpy.array', 'np.array', (['[self.features.opponents[0].x_pos, self.features.opponents[0].y_pos]'], {}), '([self.features.opponents[0].x_pos, self.features.opponents[0].y_pos])\n', (1247, 1317), True, 'import numpy as np\n'), ((3660, 3697), 'plastic_agent.utils.get_opposite_vector', 'get_opposite_vect... |
"""Test cases for the plot module."""
from typing import Any, Callable
from unittest import mock
import numpy as np
from kernreg.config import TEST_RESOURCES
from kernreg.smooth import Result
from kernreg.utils import get_example_data
import kernreg.visualize as plot_module
@mock.patch(f"{__name__}.plot_module.plt"... | [
"kernreg.utils.get_example_data",
"numpy.asarray",
"kernreg.smooth.Result",
"numpy.genfromtxt",
"unittest.mock.patch",
"kernreg.visualize.plot"
] | [((280, 321), 'unittest.mock.patch', 'mock.patch', (['f"""{__name__}.plot_module.plt"""'], {}), "(f'{__name__}.plot_module.plt')\n", (290, 321), False, 'from unittest import mock\n'), ((456, 474), 'kernreg.utils.get_example_data', 'get_example_data', ([], {}), '()\n', (472, 474), False, 'from kernreg.utils import get_e... |
# Copyright (c) 2017 The Khronos Group 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 ... | [
"nnef_tools.io.tensorflow.tflite_fb.TensorStart",
"nnef_tools.io.tensorflow.tflite_fb.QuantizationParametersStart",
"flatbuffers.Builder",
"nnef_tools.io.tensorflow.tflite_fb.BufferStart",
"nnef_tools.io.tensorflow.tflite_fb.TensorAddBuffer",
"nnef_tools.io.tensorflow.tflite_fb.OperatorAddOutputs",
"nne... | [((17523, 17553), 're.compile', 're.compile', (['"""(.)([A-Z][a-z]+)"""'], {}), "('(.)([A-Z][a-z]+)')\n", (17533, 17553), False, 'import re\n'), ((17564, 17595), 're.compile', 're.compile', (['"""([a-z0-9])([A-Z])"""'], {}), "('([a-z0-9])([A-Z])')\n", (17574, 17595), False, 'import re\n'), ((20234, 20264), 'nnef_tools.... |
import numpy as np
import itertools
def draw(n, k, draws):
sample = np.random.choice(
a=range(n), replace=False,
size=draws
).tolist()
return [k if i in sample else float('NAN')
for i in range(n)
]
def generate_string_data(z, a, k, draws=1):
data = np.array([
... | [
"numpy.sin",
"itertools.chain",
"numpy.cos"
] | [((678, 699), 'itertools.chain', 'itertools.chain', (['*tmp'], {}), '(*tmp)\n', (693, 699), False, 'import itertools\n'), ((332, 341), 'numpy.sin', 'np.sin', (['z'], {}), '(z)\n', (338, 341), True, 'import numpy as np\n'), ((355, 364), 'numpy.cos', 'np.cos', (['z'], {}), '(z)\n', (361, 364), True, 'import numpy as np\n... |
"""Executable examples for using the pcap APIs.
This module has a rudimentary command line interface. For usage, run::
$ python -m ouster.sdk.examples.pcap -h
"""
import os
import argparse
from contextlib import closing
import numpy as np
from ouster import client, pcap
from .colormaps import normalize
def pc... | [
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"matplotlib.pyplot.axes",
"open3d.geometry.PointCloud",
"ouster.client.Scans",
"matplotlib.pyplot.figure",
"numpy.tile",
"os.path.join",
"numpy.dsplit",
"os.path.exists",
"open3d.io.write_point_cloud",
"laspy.create",
"ouster.client.XYZLu... | [((1485, 1539), 'open3d.geometry.TriangleMesh.create_coordinate_frame', 'o3d.geometry.TriangleMesh.create_coordinate_frame', (['(1.0)'], {}), '(1.0)\n', (1534, 1539), True, 'import open3d as o3d\n'), ((1651, 1681), 'open3d.visualization.Visualizer', 'o3d.visualization.Visualizer', ([], {}), '()\n', (1679, 1681), True, ... |
# -*- coding: utf-8 -*-
"""
Produces fake instrument data for testing.
"""
from __future__ import print_function
from __future__ import absolute_import
import os
import pandas as pds
import xarray as xr
import numpy as np
import pysat
platform = 'pysat'
name = 'testing2D_xarray'
pandas_format = False
def init(self... | [
"pysat.datetime",
"pysat.Meta",
"numpy.ones",
"numpy.mod",
"xarray.Dataset",
"pysat.Series",
"numpy.arange",
"pandas.DateOffset",
"os.path.split"
] | [((4053, 4065), 'pysat.Meta', 'pysat.Meta', ([], {}), '()\n', (4063, 4065), False, 'import pysat\n'), ((4405, 4417), 'pysat.Meta', 'pysat.Meta', ([], {}), '()\n', (4415, 4417), False, 'import pysat\n'), ((4598, 4610), 'pysat.Meta', 'pysat.Meta', ([], {}), '()\n', (4608, 4610), False, 'import pysat\n'), ((4901, 4913), '... |
"""
Data augmentation algorithms.
Each algorithm works on the HandwrittenData class. They have to be applied like
this:
>>> from hwrt.handwritten_data import HandwrittenData
>>> data_json = '[[{"time": 123, "x": 45, "y": 67}]]'
>>> a = HandwrittenData(raw_data_id=2953, raw_data_json=data_json)
>>> multiplication_queu... | [
"math.radians",
"copy.deepcopy",
"numpy.linspace"
] | [((2680, 2724), 'numpy.linspace', 'numpy.linspace', (['self.min', 'self.max', 'self.num'], {}), '(self.min, self.max, self.num)\n', (2694, 2724), False, 'import numpy\n'), ((3661, 3678), 'copy.deepcopy', 'deepcopy', (['hwr_obj'], {}), '(hwr_obj)\n', (3669, 3678), False, 'from copy import deepcopy\n'), ((3246, 3268), 'm... |
from copy import copy
import numpy as np
import scipy.sparse
import pandas as pd
from latbin.lattice import *
from latbin.matching import MatchingIndexer
class KernelWeightedMatchingInterpolator(object):
def __init__(self, x, y, x_scale, weighting_kernel=None, match_tolerance=6.0):
if weighting_kern... | [
"latbin.matching.MatchingIndexer",
"numpy.zeros",
"numpy.exp"
] | [((514, 574), 'latbin.matching.MatchingIndexer', 'MatchingIndexer', (['(x / self.x_scale)'], {'tolerance': 'match_tolerance'}), '(x / self.x_scale, tolerance=match_tolerance)\n', (529, 574), False, 'from latbin.matching import MatchingIndexer\n'), ((1191, 1215), 'numpy.zeros', 'np.zeros', (['y_interp.shape'], {}), '(y_... |
from panda3d.egg import *
from panda3d.core import *
from obj2egg import ObjMaterial
from copy import deepcopy
import numpy as np
import cv2
import copy
from direct.gui.OnscreenImage import OnscreenImage
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils import... | [
"numpy.maximum",
"numpy.abs",
"numpy.arctan2",
"numpy.ones",
"numpy.linalg.norm",
"numpy.arange",
"os.path.abspath",
"sklearn.cluster.KMeans",
"cv2.resize",
"cv2.Subdiv2D",
"numpy.stack",
"numpy.roll",
"numpy.tensordot",
"numpy.cross",
"numpy.dot",
"numpy.expand_dims",
"numpy.array",... | [((1265, 1304), 'cv2.resize', 'cv2.resize', (['self.depth', '(width, height)'], {}), '(self.depth, (width, height))\n', (1275, 1304), False, 'import cv2\n'), ((1329, 1408), 'cv2.resize', 'cv2.resize', (['self.segmentation', '(width, height)'], {'interpolation': 'cv2.INTER_NEAREST'}), '(self.segmentation, (width, height... |
# This script contains the Brianmodel class
# Calling makeneuron_ca() on a Brianmodel object will create a biophysical neuron
# Multiple other functions allow for plotting, animating, ...
from __future__ import division
#folder with parameters, equations and morphology
import os, sys
mod_path = os.path.abspath(os.... | [
"numpy.abs",
"numpy.amin",
"brian2.run",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.arange",
"brian2.SpatialNeuron",
"os.path.join",
"sys.path.append",
"brian2.start_scope",
"numpy.multiply",
"matplotlib.colors.Normalize",
"numpy.random.rand",
"matplotlib.cm.S... | [((345, 370), 'sys.path.append', 'sys.path.append', (['mod_path'], {}), '(mod_path)\n', (360, 370), False, 'import os, sys\n'), ((964, 981), 'brian2.start_scope', 'br2.start_scope', ([], {}), '()\n', (979, 981), True, 'import brian2 as br2\n'), ((317, 344), 'os.path.join', 'os.path.join', (['""".."""', '"""Model"""'], ... |
import logging
import os
import pickle
import sys
import textwrap
from pathlib import Path
import numpy as np
import pandas as pd
from datarobot_drum.drum.artifact_predictors.keras_predictor import KerasPredictor
from datarobot_drum.drum.artifact_predictors.pmml_predictor import PMMLPredictor
from datarobot_drum.drum... | [
"os.listdir",
"textwrap.dedent",
"pickle.dump",
"datarobot_drum.drum.artifact_predictors.sklearn_predictor.SKLearnPredictor",
"os.path.basename",
"os.path.isdir",
"datarobot_drum.drum.artifact_predictors.torch_predictor.PyTorchPredictor",
"os.path.dirname",
"numpy.testing.assert_almost_equal",
"da... | [((1068, 1137), 'logging.getLogger', 'logging.getLogger', (["(LOGGER_NAME_PREFIX + '.' + self.__class__.__name__)"], {}), "(LOGGER_NAME_PREFIX + '.' + self.__class__.__name__)\n", (1085, 1137), False, 'import logging\n'), ((4940, 4967), 'os.listdir', 'os.listdir', (['self._model_dir'], {}), '(self._model_dir)\n', (4950... |
import numpy as np
from numpy import fft
from scipy.optimize import curve_fit
from scipy.interpolate import CubicSpline
from scipy.ndimage.filters import gaussian_filter1d
from scale import np_scale
from plotter_utils_consts import n_pts_smooth, default_fourier_n_harm
def gauss(x, a, x0, sigma):
return a * np.ex... | [
"numpy.absolute",
"scipy.ndimage.filters.gaussian_filter1d",
"numpy.polyfit",
"scipy.interpolate.CubicSpline",
"numpy.angle",
"numpy.iinfo",
"numpy.arange",
"numpy.exp",
"scale.np_scale",
"numpy.interp",
"numpy.nanmean",
"numpy.std",
"numpy.fft.fft",
"numpy.fft.fftfreq",
"numpy.linspace"... | [((2622, 2649), 'scipy.ndimage.filters.gaussian_filter1d', 'gaussian_filter1d', (['y', 'sigma'], {}), '(y, sigma)\n', (2639, 2649), False, 'from scipy.ndimage.filters import gaussian_filter1d\n'), ((2659, 2689), 'scipy.interpolate.CubicSpline', 'CubicSpline', (['x', 'gauss_filter_y'], {}), '(x, gauss_filter_y)\n', (267... |
import copy
import numpy
from . import splinefitstable
from .glam import glam, bspline
def pad_knots(knots, order=2):
"""
Pad knots out for full support at the boundaries
"""
pre = knots[0] - (knots[1]-knots[0])*numpy.arange(order, 0, -1)
post = knots[-1] + (knots[-1]-knots[-2])*numpy.arange(1, order+1)
return n... | [
"numpy.sum",
"copy.copy",
"numpy.zeros",
"numpy.isfinite",
"numpy.ones",
"numpy.append",
"numpy.cumsum",
"numpy.diff",
"numpy.arange",
"numpy.exp",
"numpy.array",
"numpy.meshgrid_nd",
"numpy.concatenate"
] | [((319, 356), 'numpy.concatenate', 'numpy.concatenate', (['(pre, knots, post)'], {}), '((pre, knots, post))\n', (336, 356), False, 'import numpy\n'), ((1176, 1191), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (1185, 1191), False, 'import copy\n'), ((1471, 1526), 'numpy.meshgrid_nd', 'numpy.meshgrid_nd', (['*s... |
"""Tests for the `illustris_python.snapshot` submodule.
Running Tests
-------------
To run all tests, this script can be executed as:
`$ python tests/snapshot_test.py [-v] [--nocapture]`
from the root directory.
Alternatively, `nosetests` can be run and it will find the tests:
`$ nosetests [-v] [--nocapture]`... | [
"nose.tools.assert_equal",
"numpy.min",
"numpy.max",
"numpy.isclose",
"nose.tools.assert_raises"
] | [((1036, 1057), 'nose.tools.assert_equal', 'assert_equal', (['pn', 'num'], {}), '(pn, num)\n', (1048, 1057), False, 'from nose.tools import assert_equal, assert_raises, assert_true\n'), ((1330, 1386), 'nose.tools.assert_raises', 'assert_raises', (['Exception', 'ill.snapshot.partTypeNum', 'name'], {}), '(Exception, ill.... |
import json
import pickle
import event_model
import numpy
import pytest
def test_documents():
dn = event_model.DocumentNames
for k in ('stop', 'start', 'descriptor',
'event', 'bulk_events', 'datum',
'resource', 'bulk_datum', 'event_page', 'datum_page'):
assert dn(k) == get... | [
"numpy.ones",
"event_model.Filler",
"event_model.rechunk_datum_pages",
"pytest.mark.parametrize",
"event_model.DocumentRouter",
"event_model.unpack_event_page",
"event_model.pack_datum_page",
"event_model.schemas.keys",
"event_model.sanitize_doc",
"pytest.raises",
"event_model.SingleRunDocumentR... | [((30102, 30171), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""retry_intervals"""', '[(1,), [1], (), [], None]'], {}), "('retry_intervals', [(1,), [1], (), [], None])\n", (30125, 30171), False, 'import pytest\n'), ((591, 617), 'event_model.schemas.keys', 'event_model.schemas.keys', ([], {}), '()\n', (615... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import argparse
import sys
import json
from astropy.time import Time
predefined_bands = ["g", "r", "i", "z", "y", "J", "H", "K"]
def _parse_command_line_args():
'''
Parses and returns the command line arguments.
'''
pars... | [
"json.load",
"argparse.ArgumentParser",
"astropy.time.Time",
"numpy.empty",
"numpy.savetxt",
"numpy.append",
"numpy.array"
] | [((325, 414), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse Open Astronomy Catalog (OAC) JSON files"""'}), "(description=\n 'Parse Open Astronomy Catalog (OAC) JSON files')\n", (348, 414), False, 'import argparse\n'), ((3563, 3585), 'astropy.time.Time', 'Time', (['t0'], {'forma... |
import numpy as np
import random
import uuid
class MazeGen:
def __init__(self, width=50):
# width is the side length of the square maze.
# num is the number of explorable cells
self.width = width
self.map = np.ones((width, width))
self.directions = ((0, 1), (0, -1), (1, 0),... | [
"cv2.imwrite",
"uuid.uuid1",
"numpy.ones",
"sys.exit"
] | [((245, 268), 'numpy.ones', 'np.ones', (['(width, width)'], {}), '((width, width))\n', (252, 268), True, 'import numpy as np\n'), ((2236, 2246), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2244, 2246), False, 'import sys\n'), ((2556, 2594), 'cv2.imwrite', 'cv2.imwrite', (['maze_name', '(maze.map * 255)'], {}), '(maze_na... |
import numpy as np
def sigmoid(x):
"""Computes the element wise logistic sigmoid of x.
Inputs:
x: Either a row vector or a column vector.
"""
return 1.0 / (1.0 + np.exp(-x))
def load_train(filePath):
"""Loads training data."""
with open(filePath, 'rb') as f:
train_set = np.loa... | [
"numpy.load",
"numpy.exp"
] | [((314, 324), 'numpy.load', 'np.load', (['f'], {}), '(f)\n', (321, 324), True, 'import numpy as np\n'), ((581, 591), 'numpy.load', 'np.load', (['f'], {}), '(f)\n', (588, 591), True, 'import numpy as np\n'), ((845, 855), 'numpy.load', 'np.load', (['f'], {}), '(f)\n', (852, 855), True, 'import numpy as np\n'), ((188, 198... |
import numpy as np
def SMAPE(y_true, y_pred):
y_true = np.array(y_true)
y_pred = np.array(y_pred)
score = np.abs(y_pred - y_true) / ((np.abs(y_true) + np.abs(y_pred)) / 2)
score = np.where(np.isnan(score), 0, score)
return score
def MAPE(y_true, y_pred):
y_true = np.array(y_true)
y_pred = ... | [
"numpy.abs",
"numpy.isnan",
"numpy.mean",
"numpy.array",
"numpy.log1p"
] | [((60, 76), 'numpy.array', 'np.array', (['y_true'], {}), '(y_true)\n', (68, 76), True, 'import numpy as np\n'), ((90, 106), 'numpy.array', 'np.array', (['y_pred'], {}), '(y_pred)\n', (98, 106), True, 'import numpy as np\n'), ((290, 306), 'numpy.array', 'np.array', (['y_true'], {}), '(y_true)\n', (298, 306), True, 'impo... |
# pylint: disable=W0201
from statsmodels.compat.python import iteritems, string_types, range
import numpy as np
from statsmodels.tools.decorators import cache_readonly
import pandas as pd
from . import var_model as _model
from . import util
from . import plotting
FULL_SAMPLE = 0
ROLLING = 1
EXPANDING = 2
def _get... | [
"pandas.DataFrame",
"pandas.ols",
"numpy.empty",
"matplotlib.pyplot.draw_if_interactive",
"statsmodels.compat.python.range",
"matplotlib.pyplot.subplots",
"numpy.isfinite",
"pandas.WidePanel.fromDict",
"pandas.util.testing.makeTimeDataFrame",
"statsmodels.compat.python.iteritems"
] | [((9290, 9308), 'statsmodels.compat.python.range', 'range', (['(1)', '(1 + lags)'], {}), '(1, 1 + lags)\n', (9295, 9308), False, 'from statsmodels.compat.python import iteritems, string_types, range\n'), ((9480, 9515), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'columns'}), '(data, columns=columns)\n', ... |
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import time
from collections import OrderedDict
from options.train_options import TrainOptions
from data.data_loader import CreateDataLoader
from ... | [
"torch.mean",
"os.mkdir",
"os.path.isdir",
"data.base_dataset.get_params",
"numpy.savetxt",
"data.data_loader.CreateDataLoader",
"time.time",
"PIL.Image.open",
"data.base_dataset.get_transform",
"torch.cuda.is_available",
"numpy.loadtxt",
"video_utils.save_tensor",
"util.visualizer.Visualize... | [((650, 705), 'os.path.join', 'os.path.join', (['opt.checkpoints_dir', 'opt.name', '"""iter.txt"""'], {}), "(opt.checkpoints_dir, opt.name, 'iter.txt')\n", (662, 705), False, 'import os\n'), ((2030, 2051), 'data.data_loader.CreateDataLoader', 'CreateDataLoader', (['opt'], {}), '(opt)\n', (2046, 2051), False, 'from data... |
import numpy as np
def gauss(img_size, mx, my, sx, sy, amp=0.01):
x = np.arange(img_size)[None].astype(np.float)
y = x.T
g = amp * np.exp(-((y - my) ** 2) / sy).dot(np.exp(-((x - mx) ** 2) / sx))
return g
| [
"numpy.arange",
"numpy.exp"
] | [((179, 206), 'numpy.exp', 'np.exp', (['(-(x - mx) ** 2 / sx)'], {}), '(-(x - mx) ** 2 / sx)\n', (185, 206), True, 'import numpy as np\n'), ((76, 95), 'numpy.arange', 'np.arange', (['img_size'], {}), '(img_size)\n', (85, 95), True, 'import numpy as np\n'), ((145, 172), 'numpy.exp', 'np.exp', (['(-(y - my) ** 2 / sy)'],... |
import numpy as np
import argparse
import osgeo.gdal as gdal
from scipy.spatial import voronoi_plot_2d, Voronoi
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from scipy.spatial import ConvexHull, convex_hull_plot_2d
from numpy import genfromtxt
import pandas as pd
import gdal
import os
import xarray as xr... | [
"numpy.load",
"numpy.abs",
"numpy.argmax",
"numpy.empty",
"numpy.ones",
"scipy.spatial.Voronoi",
"numpy.isnan",
"numpy.random.randint",
"numpy.arange",
"numpy.linalg.norm",
"os.path.join",
"numpy.meshgrid",
"scipy.linalg.get_blas_funcs",
"numpy.copy",
"clhs.clhs",
"numpy.max",
"numpy... | [((2096, 2118), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'int'}), '(N, dtype=int)\n', (2104, 2118), True, 'import numpy as np\n'), ((2140, 2211), 'maxvolpy.maxvol.maxvol', 'maxvol', (['A'], {'tol': '(1)', 'max_iters': 'start_maxvol_iters', 'top_k_index': 'top_k_index'}), '(A, tol=1, max_iters=start_maxvol_iters, to... |
# coding: utf-8
# Distributed under the terms of the MIT License.
from .model import AppModel
from ababe.stru.element import Specie
from ababe.stru.scaffold import GeneralCell
from ababe.stru.sogen import OccupyGenerator
from ababe.io.io import GeneralIO
from ababe.stru.restriction import MinDistanceRestriction
import... | [
"os.makedirs",
"os.getcwd",
"ababe.stru.element.Specie.from_num",
"random.choices",
"os.path.exists",
"ababe.io.io.GeneralIO",
"ababe.stru.element.Specie",
"ababe.io.io.GeneralIO.from_file",
"numpy.where",
"ababe.stru.restriction.MinDistanceRestriction",
"os.path.join",
"ababe.stru.sogen.Occup... | [((595, 622), 'ababe.io.io.GeneralIO.from_file', 'GeneralIO.from_file', (['infile'], {}), '(infile)\n', (614, 622), False, 'from ababe.io.io import GeneralIO\n'), ((1163, 1187), 'ababe.stru.element.Specie.from_num', 'Specie.from_num', (['tgt_ele'], {}), '(tgt_ele)\n', (1178, 1187), False, 'from ababe.stru.element impor... |
import numpy as np
def get_box_weights(centroid, n_pix, shape, cols=None):
""" Return the weights of a box aperture given the centroid and the width of
the box in pixels. All pixels will have the same weights except at the ends
of the box aperture.
:param cols: Column indices of good columns Used if ... | [
"numpy.nansum",
"numpy.zeros",
"numpy.isfinite",
"numpy.where",
"numpy.arange",
"numpy.sqrt"
] | [((1731, 1759), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'float'}), '(shape, dtype=float)\n', (1739, 1759), True, 'import numpy as np\n'), ((3518, 3555), 'numpy.nansum', 'np.nansum', (['(box_weights * data)'], {'axis': '(0)'}), '(box_weights * data, axis=0)\n', (3527, 3555), True, 'import numpy as np\n'), ((356... |
#! /usr/bin env python
"""
Code to generate WFSS dispersed seed images. Starting with a set of imaging seed images,
potentially with padding, given a JWST WFSS GRISMCONF configuration file
"""
import os
from astropy.io import fits
import numpy as np
from .observations.observations \
import observation as Gsim_observ... | [
"astropy.io.fits.ImageHDU",
"os.unlink",
"numpy.median",
"astropy.io.fits.PrimaryHDU",
"os.path.isfile",
"astropy.io.fits.open",
"glob.glob",
"grismconf.Config",
"astropy.io.fits.HDUList",
"os.path.join",
"multiprocessing.cpu_count"
] | [((10030, 10051), 'glob.glob', 'glob.glob', (['"""V4*.fits"""'], {}), "('V4*.fits')\n", (10039, 10051), False, 'import glob\n'), ((2063, 2140), 'os.path.join', 'os.path.join', (['config_path', "('%s_%s_%s.conf' % (instrument, cross_filter, mode))"], {}), "(config_path, '%s_%s_%s.conf' % (instrument, cross_filter, mode)... |
import pyspark as ps
import pandas as pd
import numpy as np
from pyspark.sql import SparkSession
from pyspark.ml.evaluation import RegressionEvaluator
from sklearn.metrics import mean_squared_error
spark = SparkSession.builder.getOrCreate()
data = pd.read_csv('../data/filtered_ratings.csv')
data = data.iloc[:1000000,:... | [
"pyspark.sql.SparkSession.builder.getOrCreate",
"pandas.read_csv",
"numpy.array",
"pyspark.ml.recommendation.ALS",
"sklearn.metrics.mean_squared_error",
"numpy.sqrt"
] | [((206, 240), 'pyspark.sql.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (238, 240), False, 'from pyspark.sql import SparkSession\n'), ((249, 292), 'pandas.read_csv', 'pd.read_csv', (['"""../data/filtered_ratings.csv"""'], {}), "('../data/filtered_ratings.csv')\n", (260, 292),... |
import ctypes
from multiprocessing import Pool, Array, Value
import numpy as np
def emb2Arr(emb):
"""Converts embedding to a shared array."""
return Array(ctypes.c_double, emb.ravel())
def arr2Arr(arr, is_int=False):
"""Converts np.ndarray to a shared array."""
if is_int:
return Array(ctypes... | [
"numpy.frombuffer",
"multiprocessing.Value",
"multiprocessing.Array",
"multiprocessing.Pool"
] | [((356, 395), 'multiprocessing.Array', 'Array', (['ctypes.c_double', 'arr'], {'lock': '(False)'}), '(ctypes.c_double, arr, lock=False)\n', (361, 395), False, 'from multiprocessing import Pool, Array, Value\n'), ((472, 501), 'multiprocessing.Value', 'Value', (['"""i"""', 'value'], {'lock': '(False)'}), "('i', value, loc... |
import argparse
import os
import torch
import numpy as np
import gym
from dreamerv2.utils.wrapper import GymAtar, OneHotAction
# from dreamerv2.training.config import MinAtarConfig
from dreamerv2.training.config import Config
from dreamerv2.training.trainer import Trainer
from dreamerv2.training.evaluator import Evalua... | [
"dreamerv2.training.trainer.Trainer",
"numpy.random.seed",
"os.makedirs",
"argparse.ArgumentParser",
"torch.manual_seed",
"dreamerv2.utils.wrapper.GymAtar",
"torch.cuda.manual_seed",
"torch.save",
"dreamerv2.training.config.Config",
"dreamerv2.training.evaluator.Evaluator",
"numpy.mean",
"torc... | [((517, 551), 'os.path.join', 'os.path.join', (['result_dir', '"""models"""'], {}), "(result_dir, 'models')\n", (529, 551), False, 'import os\n'), ((585, 622), 'os.makedirs', 'os.makedirs', (['model_dir'], {'exist_ok': '(True)'}), '(model_dir, exist_ok=True)\n', (596, 622), False, 'import os\n'), ((628, 653), 'numpy.ra... |
# 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... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.cross_validate",
"sklearn.tree.DecisionTreeClassifier",
"absl.logging.info",
"numpy.mean",
"absl.flags.DEFINE_boolean",
"sklearn.neural_network.MLPClassifier",
"sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis",
"absl.flags.... | [((1808, 1964), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""transform_inputs"""', '(True)', '"""If enabled, will scale the numeric features and convert categorical features to one-hot encoding."""'], {}), "('transform_inputs', True,\n 'If enabled, will scale the numeric features and convert categorica... |
'''Helmert inversion and transformation functions'''
import numpy as _np
import pandas as _pd
from .gn_const import WGS84, OMEGA_E
def gen_helm_aux(pt1,pt2):
'''aux function for helmert values inversion.'''
pt1 = pt1.astype(float)
pt2 = pt2.astype(float)
n_points=pt1.shape[0]
unity_blk = _np.tile... | [
"numpy.dstack",
"numpy.arctan2",
"numpy.linalg.lstsq",
"numpy.eye",
"numpy.abs",
"numpy.empty",
"numpy.empty_like",
"numpy.zeros",
"numpy.cross",
"numpy.rad2deg",
"numpy.sin",
"numpy.cos",
"numpy.sign",
"numpy.arctan",
"numpy.concatenate"
] | [((364, 391), 'numpy.zeros', '_np.zeros', (['(n_points, 3, 3)'], {}), '((n_points, 3, 3))\n', (373, 391), True, 'import numpy as _np\n'), ((944, 980), 'numpy.linalg.lstsq', '_np.linalg.lstsq', (['A', 'rhs'], {'rcond': 'None'}), '(A, rhs, rcond=None)\n', (960, 980), True, 'import numpy as _np\n'), ((1240, 1270), 'numpy.... |
from unittest import TestCase
import numpy as np
from muDIC import Fields
class TestDIC_Post(TestCase):
def test__true_strain_(self):
# Tolerance
toll = 1e-7
# Generate random numbers in [-0.99,4.]
rand_nrs = 5. * (np.random.random_sample(1000)) - 0.99
# Format as [nEl,i,... | [
"numpy.abs",
"muDIC.Fields._green_strain_",
"muDIC.Fields._engineering_strain_",
"numpy.random.random_sample",
"numpy.log",
"numpy.einsum",
"numpy.ones",
"muDIC.Fields._true_strain_",
"numpy.sin",
"numpy.array",
"numpy.reshape",
"numpy.cos",
"numpy.dot",
"numpy.eye"
] | [((348, 383), 'numpy.reshape', 'np.reshape', (['rand_nrs', '(5, 2, 2, -1)'], {}), '(rand_nrs, (5, 2, 2, -1))\n', (358, 383), True, 'import numpy as np\n'), ((438, 470), 'muDIC.Fields._true_strain_', 'Fields._true_strain_', (['eng_strain'], {}), '(eng_strain)\n', (458, 470), False, 'from muDIC import Fields\n'), ((931, ... |
"""
(c) RIKEN 2015. All rights reserved.
Author: <NAME>
This software is released under the new BSD License; see LICENSE.
"""
"""
NOTE on unit cell constraints determination:
XDS doesn't handle "real" rhombohedral space group (right?).
So, No need to support R3 or R32. They are handled as H3 or H32, maybe.
"""
i... | [
"numpy.cross"
] | [((1184, 1201), 'numpy.cross', 'numpy.cross', (['b', 'c'], {}), '(b, c)\n', (1195, 1201), False, 'import numpy\n'), ((1212, 1229), 'numpy.cross', 'numpy.cross', (['b', 'c'], {}), '(b, c)\n', (1223, 1229), False, 'import numpy\n'), ((1243, 1260), 'numpy.cross', 'numpy.cross', (['c', 'a'], {}), '(c, a)\n', (1254, 1260), ... |
import numpy as np
import tensorflow as tf
from numpy.linalg import norm
from tqdm.auto import tqdm
import math
def mse(v, v_pred):
return tf.reduce_mean(tf.square(v - v_pred))
def error_pod(U, V):
n_s = U.shape[1]
err_pod = 0.0
print("Computing POD error")
VV = V.dot(V.T)
for j in tqdm(rang... | [
"numpy.std",
"numpy.mean",
"numpy.linalg.norm",
"tensorflow.square",
"tensorflow.norm"
] | [((160, 181), 'tensorflow.square', 'tf.square', (['(v - v_pred)'], {}), '(v - v_pred)\n', (169, 181), True, 'import tensorflow as tf\n'), ((476, 492), 'numpy.linalg.norm', 'norm', (['(U - U_pred)'], {}), '(U - U_pred)\n', (480, 492), False, 'from numpy.linalg import norm\n'), ((495, 502), 'numpy.linalg.norm', 'norm', (... |
import numpy as np
def entropy_maximum(signal):
"""**Maximum Entropy (MaxEn)**
Provides an upper bound for the entropy of a random variable, so that the empirical entropy
(obtained for instance with :func:`entropy_shannon`) will lie in between 0 and max. entropy.
It can be useful to normalize the em... | [
"numpy.unique"
] | [((1013, 1030), 'numpy.unique', 'np.unique', (['signal'], {}), '(signal)\n', (1022, 1030), True, 'import numpy as np\n')] |
import os
import time
import json
import argparse
import torch
import torchvision
import random
import numpy as np
from data import FaceDataset
from tqdm import tqdm
from torch import nn
from torch import optim
from collections import OrderedDict
from torch.autograd import Variable
from torch.utils.data import Da... | [
"torch.nn.Dropout",
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"torchvision.models.resnet.resnet18",
"data.FaceDataset",
"numpy.around",
"torch.nn.Softmax",
"torch.arange",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"cv2.imwrite",
"torch.load",
"nump... | [((553, 570), 'random.seed', 'random.seed', (['(2019)'], {}), '(2019)\n', (564, 570), False, 'import random\n'), ((571, 591), 'numpy.random.seed', 'np.random.seed', (['(2019)'], {}), '(2019)\n', (585, 591), True, 'import numpy as np\n'), ((592, 615), 'torch.manual_seed', 'torch.manual_seed', (['(2019)'], {}), '(2019)\n... |
import numba
import numpy as np
import random
import concurrent.futures
from numba import njit, jit, prange
from numba.typed import List
try:
from numba.experimental import jitclass
except ModuleNotFoundError:
from numba import jitclass
from collections import OrderedDict
from itertools import repeat
from ... | [
"numpy.full",
"numpy.flip",
"numba.jit",
"itertools.repeat"
] | [((5221, 5251), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (5224, 5251), False, 'from numba import njit, jit, prange\n'), ((8119, 8149), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (8122, 8149), False, '... |
import unittest
import numpy as np
import torch
from pytorch_adapt.datasets import CombinedSourceAndTargetDataset
from pytorch_adapt.utils.common_functions import join_lists
class TestCombinedSourceAndTarget(unittest.TestCase):
def test_combined(self):
np.random.seed(3429)
for target_dataset_siz... | [
"pytorch_adapt.datasets.CombinedSourceAndTargetDataset",
"numpy.random.seed",
"pytorch_adapt.utils.common_functions.join_lists",
"numpy.isclose",
"torch.arange",
"numpy.bincount"
] | [((269, 289), 'numpy.random.seed', 'np.random.seed', (['(3429)'], {}), '(3429)\n', (283, 289), True, 'import numpy as np\n'), ((390, 420), 'torch.arange', 'torch.arange', (['src_dataset_size'], {}), '(src_dataset_size)\n', (402, 420), False, 'import torch\n'), ((505, 538), 'torch.arange', 'torch.arange', (['target_data... |
# Python modules
# 3rd party modules
import wx
import numpy as np
# Our modules
import vespa.analysis.tab_base as tab_base
import vespa.analysis.prefs as prefs_module
import vespa.analysis.constants as constants
import vespa.analysis.util_menu as util_menu
import vespa.analysis.auto_gui.fidsum_wbnaa as fidsum_wbnaa
i... | [
"wx.BoxSizer",
"vespa.analysis.tab_base.Tab.process",
"vespa.analysis.tab_base.Tab.plot",
"vespa.analysis.auto_gui.fidsum_wbnaa.PanelPrepWbnaaUI.__init__",
"numpy.abs",
"vespa.common.wx_gravy.common_dialogs.save_as",
"vespa.analysis.tab_base.Tab.process_and_plot",
"vespa.common.wx_gravy.common_dialogs... | [((1783, 1856), 'vespa.analysis.auto_gui.fidsum_wbnaa.PanelPrepWbnaaUI.__init__', 'fidsum_wbnaa.PanelPrepWbnaaUI.__init__', (['self', 'tab_dataset.NotebookDataset'], {}), '(self, tab_dataset.NotebookDataset)\n', (1821, 1856), True, 'import vespa.analysis.auto_gui.fidsum_wbnaa as fidsum_wbnaa\n'), ((1874, 1949), 'vespa.... |
import pandas as pd
import numpy as np
np.random.seed(42)
import random
random.seed(42)
import pickle
import gzip
import glob
import os
import json
from tqdm import tqdm
from pathlib import Path
import shutil
from urllib.parse import urlparse
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
fr... | [
"tqdm.tqdm",
"json.load",
"numpy.random.seed",
"gzip.open",
"pickle.dump",
"os.path.basename",
"concurrent.futures.ProcessPoolExecutor",
"pathlib.Path",
"random.seed",
"glob.glob",
"shutil.rmtree"
] | [((39, 57), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (53, 57), True, 'import numpy as np\n'), ((72, 87), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (83, 87), False, 'import random\n'), ((1601, 1614), 'tqdm.tqdm', 'tqdm', (['classes'], {}), '(classes)\n', (1605, 1614), False, 'from t... |
import numpy as np
import numpy.ma as ma
from math import inf
def get_indexes(v, val):
"""
Returns the indexes of the v array which have the value 'val':
Cases:
if v = column of a matrix:
returns the rows which have the value 'val'
if v = row of a matrix:
returns the... | [
"numpy.max",
"numpy.ma.masked_not_equal",
"numpy.array",
"numpy.min"
] | [((390, 417), 'numpy.ma.masked_not_equal', 'ma.masked_not_equal', (['v', 'val'], {}), '(v, val)\n', (409, 417), True, 'import numpy.ma as ma\n'), ((833, 854), 'numpy.array', 'np.array', (['normal_form'], {}), '(normal_form)\n', (841, 854), True, 'import numpy as np\n'), ((1221, 1232), 'numpy.max', 'np.max', (['col'], {... |
import logging
import numpy as np
from tqdm import tqdm
SIZE = 4096
VECTOR_COUNT = 10000
REPETITIONS = 10
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
A = np.random.random((SIZE, SIZE))
vectors = [np.random.random(SIZE) for i in range(VECTOR_COUNT)]
def vector_multiplication(v... | [
"numpy.dot",
"numpy.random.random",
"logging.basicConfig"
] | [((140, 180), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (159, 180), False, 'import logging\n'), ((189, 219), 'numpy.random.random', 'np.random.random', (['(SIZE, SIZE)'], {}), '((SIZE, SIZE))\n', (205, 219), True, 'import numpy as np\n'), ((235, 257), 'nu... |
from datetime import datetime
import numpy as np
import csv
from utils import total_gini
import tensorflow.compat.v1 as tf
import json
from pgd_attack import LinfPGDAttack
import utils_init
with open('config.json') as config_file:
config = json.load(config_file)
def print_metrics(sess, model, nat_dict, val_dict... | [
"json.load",
"csv.writer",
"pgd_attack.LinfPGDAttack",
"numpy.std",
"tensorflow.compat.v1.Summary.Value",
"tensorflow.compat.v1.Session",
"numpy.mean",
"datetime.datetime.now",
"tensorflow.compat.v1.global_variables_initializer"
] | [((246, 268), 'json.load', 'json.load', (['config_file'], {}), '(config_file)\n', (255, 268), False, 'import json\n'), ((5740, 5756), 'csv.writer', 'csv.writer', (['file'], {}), '(file)\n', (5750, 5756), False, 'import csv\n'), ((3597, 3609), 'tensorflow.compat.v1.Session', 'tf.Session', ([], {}), '()\n', (3607, 3609),... |
import re
import string
import numpy as np
import pandas as pd
import seaborn as sns
import nltk
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from nltk.tokenize import TweetTokenizer
from gensim.corpora.dictionary import Dictionary
from tensorflow.keras... | [
"numpy.sum",
"nltk.stem.PorterStemmer",
"pandas.read_csv",
"sklearn.metrics.accuracy_score",
"seaborn.light_palette",
"sklearn.metrics.classification_report",
"numpy.mean",
"gensim.corpora.dictionary.Dictionary",
"nltk.download",
"numpy.std",
"tensorflow.keras.preprocessing.sequence.pad_sequence... | [((520, 546), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (533, 546), False, 'import nltk\n'), ((547, 569), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (560, 569), False, 'import nltk\n'), ((606, 627), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), ... |
import cv2
import math
import numpy as np
"""
A particle-based object tracker originally implemented by <NAME> of
Allstate and edited by djp42 and aroyc of Stanford.
The main idea is to use particle filtering with importance sampling to predict
where tracked boxes will be, allowing association between frames and the ... | [
"numpy.random.uniform",
"math.exp",
"numpy.sum",
"math.ceil",
"numpy.zeros",
"numpy.mean",
"numpy.random.multivariate_normal",
"numpy.linalg.norm",
"numpy.diag"
] | [((1632, 1672), 'numpy.diag', 'np.diag', (['([self.cov] * self.num_particles)'], {}), '([self.cov] * self.num_particles)\n', (1639, 1672), True, 'import numpy as np\n'), ((1696, 1740), 'numpy.diag', 'np.diag', (['([self.cov / 2] * self.num_particles)'], {}), '([self.cov / 2] * self.num_particles)\n', (1703, 1740), True... |
""" Main excited-state executable script
Note:
The simulations are intended to be used by calling the package
directly via :code:`python -m adpeps ...`, as described in
:ref:`notes/start`
"""
from jax import grad, jit, vmap, value_and_grad
from jax import random
from jax.scipy.optimize i... | [
"matplotlib.pyplot.title",
"yaml.dump",
"jax.numpy.savez",
"jax.numpy.linalg.eig",
"yaml.safe_load",
"adpeps.ipeps.ipeps.iPEPS",
"adpeps.ipeps.make_momentum_path.make_momentum_path",
"matplotlib.pyplot.xticks",
"jax.numpy.load",
"adpeps.utils.io.get_exci_file",
"matplotlib.pyplot.show",
"jax.n... | [((1023, 1041), 'adpeps.utils.printing.print', 'print', (['config_file'], {}), '(config_file)\n', (1028, 1041), False, 'from adpeps.utils.printing import print\n'), ((1148, 1173), 'adpeps.ipeps.config.from_dict', 'sim_config.from_dict', (['cfg'], {}), '(cfg)\n', (1168, 1173), True, 'import adpeps.ipeps.config as sim_co... |
"""Line plot script
"""
# author: <NAME>
# github: themlphdstudent
# Licence: BSD 3-Clause
#import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
X = np.linspace(0, 20, 1000)
y = np.cos(X)
plt.plot(X,y, color='b', linestyle='--')
plt.xlabel('X')
plt.ylabel('cos(X)')
plt.savefig('..... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.cos",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((187, 211), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(1000)'], {}), '(0, 20, 1000)\n', (198, 211), True, 'import numpy as np\n'), ((216, 225), 'numpy.cos', 'np.cos', (['X'], {}), '(X)\n', (222, 225), True, 'import numpy as np\n'), ((227, 268), 'matplotlib.pyplot.plot', 'plt.plot', (['X', 'y'], {'color': '""... |
# ========================================================================
#
# Imports
#
# ========================================================================
import os
import sys
import argparse
import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
import mprl.uti... | [
"argparse.ArgumentParser",
"os.path.dirname",
"numpy.finfo",
"os.path.join",
"mprl.utilities.save_tb_plots"
] | [((566, 625), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot agents TB files"""'}), "(description='Plot agents TB files')\n", (589, 625), False, 'import argparse\n'), ((1838, 1907), 'mprl.utilities.save_tb_plots', 'utilities.save_tb_plots', (['"""compare_training.pdf"""'], {'legends... |
'''
Dataset and DataLoader adapted from
https://www.kaggle.com/pinocookie/pytorch-dataset-and-dataloader
'''
import pickle
import torch
import torchvision
import torchvision.transforms as transforms
from PIL import Image
from sklearn.model_selection import train_test_split
from torch.utils.data import Dataset
from to... | [
"numpy.random.seed",
"numpy.floor",
"torchvision.datasets.CIFAR10",
"numpy.mean",
"numpy.arange",
"torch.utils.data.TensorDataset",
"pickle.load",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"numpy.std",
"numpy.transpose",
"torch.zeros",
"numpy.random.shuffle",
"torc... | [((1915, 1963), 'torch.utils.data.TensorDataset', 'torch.utils.data.TensorDataset', (['x_train', 'y_train'], {}), '(x_train, y_train)\n', (1945, 1963), False, 'import torch\n'), ((1979, 2027), 'torch.utils.data.TensorDataset', 'torch.utils.data.TensorDataset', (['x_valid', 'y_valid'], {}), '(x_valid, y_valid)\n', (2009... |
"""Relative Concentration Index."""
__author__ = "<NAME> <<EMAIL>>, <NAME> <<EMAIL>> and <NAME> <<EMAIL>>"
import numpy as np
from .._base import SingleGroupIndex, SpatialExplicitIndex
def _relative_concentration(data, group_pop_var, total_pop_var):
"""Calculate Relative Concentration index.
Parameters
... | [
"numpy.cumsum",
"numpy.array"
] | [((1092, 1121), 'numpy.array', 'np.array', (['data[group_pop_var]'], {}), '(data[group_pop_var])\n', (1100, 1121), True, 'import numpy as np\n'), ((1130, 1159), 'numpy.array', 'np.array', (['data[total_pop_var]'], {}), '(data[total_pop_var])\n', (1138, 1159), True, 'import numpy as np\n'), ((1331, 1350), 'numpy.array',... |
"""
Contingency table functions (:mod:`scipy.stats.contingency`)
============================================================
Functions for creating and analyzing contingency tables.
.. currentmodule:: scipy.stats.contingency
.. autosummary::
:toctree: generated/
chi2_contingency
crosstab
expected_freq
... | [
"numpy.apply_over_axes",
"math.sqrt",
"numpy.asarray",
"numpy.any",
"numpy.nonzero",
"numpy.sign",
"functools.reduce",
"numpy.issubdtype"
] | [((3034, 3072), 'numpy.asarray', 'np.asarray', (['observed'], {'dtype': 'np.float64'}), '(observed, dtype=np.float64)\n', (3044, 3072), True, 'import numpy as np\n'), ((8320, 8340), 'numpy.asarray', 'np.asarray', (['observed'], {}), '(observed)\n', (8330, 8340), True, 'import numpy as np\n'), ((8348, 8368), 'numpy.any'... |
import importlib
import logging
import os
def set_log_level(debug):
os.environ['HPOLIB_DEBUG'] = 'true' if debug else 'false'
import hpolib.container.client_abstract_benchmark as client
importlib.reload(client)
def test_debug_env_variable_1():
set_log_level(False)
from hpolib.container.client_ab... | [
"hpolib.container.benchmarks.ml.xgboost_benchmark.XGBoostBenchmark",
"json.dumps",
"hpolib.util.openml_data_manager.get_openmlcc18_taskids",
"importlib.reload",
"numpy.array"
] | [((200, 224), 'importlib.reload', 'importlib.reload', (['client'], {}), '(client)\n', (216, 224), False, 'import importlib\n'), ((890, 1003), 'hpolib.container.benchmarks.ml.xgboost_benchmark.XGBoostBenchmark', 'Benchmark', ([], {'task_id': 'task_id', 'container_name': '"""xgboost_benchmark"""', 'container_source': '""... |
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import Normalize, Colormap
from matplotlib.colorbar import ColorbarBase
import matplotlib
del matplotlib.font_manager.weight_dict['roman']
matplotlib.font_manager._rebuild()... | [
"matplotlib.pyplot.show",
"numpy.ceil",
"matplotlib.colors.Normalize",
"matplotlib.cm.get_cmap",
"matplotlib.font_manager._rebuild",
"numpy.empty",
"matplotlib.pyplot.tick_params",
"mpl_toolkits.mplot3d.Axes3D.get_proj",
"matplotlib.cm.jet",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.wher... | [((286, 320), 'matplotlib.font_manager._rebuild', 'matplotlib.font_manager._rebuild', ([], {}), '()\n', (318, 320), False, 'import matplotlib\n'), ((878, 913), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(4, 2)', 'dpi': '(200)'}), '(figsize=(4, 2), dpi=200)\n', (888, 913), True, 'from matplotlib import ... |
import numpy as np
from BC_patchbvae import BCPatchBVAE
from goalrepresent.datasets.image.imagedataset import LENIADataset
from goalrepresent.helper.randomhelper import set_seed
if __name__ == '__main__':
set_seed(0)
# load reference dataset
dataset_config = LENIADataset.default_config()
dataset_con... | [
"BC_patchbvae.BCPatchBVAE",
"numpy.zeros",
"numpy.percentile",
"goalrepresent.helper.randomhelper.set_seed",
"goalrepresent.datasets.image.imagedataset.LENIADataset",
"numpy.savez",
"goalrepresent.datasets.image.imagedataset.LENIADataset.default_config"
] | [((212, 223), 'goalrepresent.helper.randomhelper.set_seed', 'set_seed', (['(0)'], {}), '(0)\n', (220, 223), False, 'from goalrepresent.helper.randomhelper import set_seed\n'), ((275, 304), 'goalrepresent.datasets.image.imagedataset.LENIADataset.default_config', 'LENIADataset.default_config', ([], {}), '()\n', (302, 304... |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import os
import time
import numpy as np
import pandas as pd
from collections import defaultdict
from utils import read_vocab,write_vocab,build_vocab,Tokenizer,padding_idx,timeSince
from env... | [
"pandas.DataFrame",
"agent.Seq2SeqAgent.n_inputs",
"numpy.average",
"agent.Seq2SeqAgent",
"torch.manual_seed",
"torch.cuda.manual_seed",
"os.path.exists",
"time.time",
"collections.defaultdict",
"utils.Tokenizer",
"utils.build_vocab",
"agent.Seq2SeqAgent.n_outputs",
"numpy.array",
"utils.r... | [((1297, 1359), 'agent.Seq2SeqAgent', 'Seq2SeqAgent', (['train_env', '""""""', 'encoder', 'decoder', 'max_episode_len'], {}), "(train_env, '', encoder, decoder, max_episode_len)\n", (1309, 1359), False, 'from agent import Seq2SeqAgent\n'), ((1637, 1654), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)... |
# Copyright 2019 DeepMind Technologies Limited. 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 ... | [
"jax.numpy.array",
"absl.testing.absltest.main",
"numpy.testing.assert_array_equal",
"jax.numpy.zeros_like",
"numpy.iinfo",
"jax.grad",
"chex.all_variants"
] | [((894, 923), 'jax.numpy.array', 'jnp.array', (['i'], {'dtype': 'jnp.int32'}), '(i, dtype=jnp.int32)\n', (903, 923), True, 'import jax.numpy as jnp\n'), ((950, 981), 'jax.numpy.array', 'jnp.array', (['i'], {'dtype': 'jnp.float32'}), '(i, dtype=jnp.float32)\n', (959, 981), True, 'import jax.numpy as jnp\n'), ((1023, 104... |
import os
import h5py
import tensorflow as tf
import numpy as np
from math import exp
from tqdm import tqdm
from nltk.translate.bleu_score import corpus_bleu, SmoothingFunction
from summary_handler import SummaryHandler
from read_data import *
from data import GenModelVocab, translate, save_vocab, restore_vocab,\
t... | [
"h5py.File",
"model.BiRNNClf",
"os.makedirs",
"tensorflow.global_variables_initializer",
"data.save_vocab",
"numpy.asarray",
"os.environ.items",
"tensorflow.Session",
"os.path.exists",
"data.GloVEVocab",
"sys.setdefaultencoding",
"data.restore_vocab",
"os.path.join",
"time.localtime"
] | [((507, 538), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (529, 538), False, 'import sys\n'), ((1147, 1224), 'data.GloVEVocab', 'GloVEVocab', (['vocab_freq', 'config.embedding_file'], {'threshold': 'config.min_occurence'}), '(vocab_freq, config.embedding_file, threshold=con... |
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
import skimage.io
import argparse
import numpy as np
import time
import os
import cv2
import math
# from memory_profiler import profile
import nets
import dataloader
from dataloader import transforms
from utils import... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"dataloader.transforms.Normalize",
"torch.cuda.device_count",
"utils.utils.load_pretrained_net",
"nets.AANet",
"cv2.imshow",
"os.path.join",
"torch.no_grad",
"torch.nn.functional.pad",
"cv2.imwrite",
"os.path.dirname",
"os.path.exists",
"util... | [((497, 522), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (520, 522), False, 'import argparse\n'), ((3514, 3573), 'os.path.join', 'os.path.join', (['args.output_dir', "(model_dir + '-' + model_name)"], {}), "(args.output_dir, model_dir + '-' + model_name)\n", (3526, 3573), False, 'import os\... |
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency, wasserstein_distance, ks_2samp, distributions
import matplotlib.pyplot as plt
def compute_distribution_cat(a1: np.array, a2: np.array, sample_weights1=None, sample_weights2=None,
max_n_cat: int = None):
i... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.show",
"numpy.ones_like",
"numpy.abs",
"numpy.unique",
"numpy.searchsorted",
"numpy.all",
"numpy.argsort",
"numpy.cumsum",
"scipy.stats.wasserstein_distance",
"scipy.stats.chi2_contingency",
"numpy.exp",
"numpy.round",
"scipy.sta... | [((1623, 1646), 'numpy.sum', 'np.sum', (['sample_weights1'], {}), '(sample_weights1)\n', (1629, 1646), True, 'import numpy as np\n'), ((1667, 1690), 'numpy.sum', 'np.sum', (['sample_weights2'], {}), '(sample_weights2)\n', (1673, 1690), True, 'import numpy as np\n'), ((3742, 3777), 'scipy.stats.chi2_contingency', 'chi2_... |
import numpy as np
import healpy as hp
import fitsio
import matplotlib.pyplot as plt
from sortcl import enumerate_cls
import camb
nbins = 10
lmax = 1024
l = np.arange(lmax+1)
################################################################################
fits = fitsio.FITS('map.fits')
zbins = []
for i in rang... | [
"numpy.trapz",
"camb.sources.GaussianSourceWindow",
"matplotlib.pyplot.show",
"fitsio.FITS",
"camb.sources.SplinedSourceWindow",
"camb.get_background",
"sortcl.enumerate_cls",
"camb.set_params",
"camb.get_results",
"numpy.arange",
"numpy.linspace",
"healpy.anafast",
"matplotlib.pyplot.subplo... | [((163, 182), 'numpy.arange', 'np.arange', (['(lmax + 1)'], {}), '(lmax + 1)\n', (172, 182), True, 'import numpy as np\n'), ((271, 294), 'fitsio.FITS', 'fitsio.FITS', (['"""map.fits"""'], {}), "('map.fits')\n", (282, 294), False, 'import fitsio\n'), ((591, 654), 'healpy.anafast', 'hp.anafast', (['delta'], {'lmax': 'lma... |
import numpy as np
import requests
from .utils import id_to_url, get_path_indexes, get_ideal_coords
def test_id_to_url_does_transform():
assert id_to_url(
'A0000001') == 'https://iiif.wellcomecollection.org/image/A0000001.jpg/full/960,/0/default.jpg'
def test_id_to_url_returns_valid_url():
url = id_... | [
"numpy.isclose",
"numpy.random.randint",
"numpy.random.random",
"numpy.array",
"requests.get"
] | [((354, 371), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (366, 371), False, 'import requests\n'), ((464, 748), 'numpy.array', 'np.array', (['[[1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, \n 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9],\n [1, 2, ... |
#!/usr/bin/env nemesis
#
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c)... | [
"math.exp",
"numpy.zeros_like",
"numpy.meshgrid",
"numpy.zeros",
"numpy.ones",
"spatialdata.geocoords.CSCart.CSCart",
"numpy.arange",
"numpy.random.rand",
"spatialdata.spatialdb.SimpleGridAscii.createWriter"
] | [((1287, 1353), 'numpy.arange', 'numpy.arange', (['XLIM[0]', '(XLIM[1] + 0.1 * DX)', 'DX'], {'dtype': 'numpy.float64'}), '(XLIM[0], XLIM[1] + 0.1 * DX, DX, dtype=numpy.float64)\n', (1299, 1353), False, 'import numpy\n'), ((1358, 1424), 'numpy.arange', 'numpy.arange', (['YLIM[0]', '(YLIM[1] + 0.1 * DX)', 'DX'], {'dtype'... |
# coding=utf-8
# Copyright 2019 The Authors of RL Reliability Metrics.
#
# 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 b... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.boxplot",
"rl_reliability_metrics.analysis.plot_utils.flipped_errorbar",
"absl.logging.info",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.fill_between",
"matplot... | [((3519, 3628), 'rl_reliability_metrics.analysis.stats_utils.multiple_comparisons_correction', 'stats_utils.multiple_comparisons_correction', (['self.n_algo', 'self.pthresh', 'self.multiple_comparisons_method'], {}), '(self.n_algo, self.pthresh, self\n .multiple_comparisons_method)\n', (3562, 3628), False, 'from rl_... |
import os
import warnings
import astropy.units as u
import numpy as np
from astropy.time import Time
from sora.config import input_tests
from sora.config.decorators import deprecated_alias
from .utils import calc_fresnel
warnings.simplefilter('always', UserWarning)
class LightCurve:
"""Defines a Light Curve.
... | [
"numpy.absolute",
"sora.config.decorators.deprecated_alias",
"numpy.sum",
"numpy.invert",
"numpy.ones",
"numpy.argsort",
"numpy.arange",
"matplotlib.pyplot.gca",
"os.path.join",
"warnings.simplefilter",
"sora.config.input_tests.check_kwargs",
"os.path.dirname",
"astropy.units.au.to",
"astr... | [((224, 268), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""', 'UserWarning'], {}), "('always', UserWarning)\n", (245, 268), False, 'import warnings\n'), ((3130, 3206), 'sora.config.decorators.deprecated_alias', 'deprecated_alias', ([], {'lambda_0': '"""central_bandpass"""', 'delta_lambda': '"""delta... |
"""Tests the evaluation of the potential for single and array-valued
arguments for SHO, bump and KP potentials.
"""
import pytest
from basis.potential import Potential
import numpy as np
def test_getattr():
"""Tests the attribute re-routing to Potential.params.
"""
pot = Potential("potentials/kp.cfg")
... | [
"pytest.raises",
"basis.potential.Potential",
"numpy.linspace",
"numpy.sqrt"
] | [((285, 315), 'basis.potential.Potential', 'Potential', (['"""potentials/kp.cfg"""'], {}), "('potentials/kp.cfg')\n", (294, 315), False, 'from basis.potential import Potential\n'), ((363, 395), 'basis.potential.Potential', 'Potential', (['"""potentials/bump.cfg"""'], {}), "('potentials/bump.cfg')\n", (372, 395), False,... |
import os
import sys
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from SocialMediaIE.active_learning.helpers import (get_joined_metrics,
plot_metrics)
from SocialMediaIE.active_learning.query_strategies ... | [
"seaborn.set_style",
"numpy.random.seed",
"warnings.simplefilter",
"argparse.ArgumentParser",
"os.makedirs",
"SocialMediaIE.training.active_learning_trainer.ActiveLearningTrainer",
"os.path.exists",
"pandas.read_json",
"SocialMediaIE.data.load_lexicon.load_sentiment_lexicon",
"os.path.join",
"se... | [((914, 937), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (929, 937), True, 'import seaborn as sns\n'), ((938, 960), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (951, 960), True, 'import seaborn as sns\n'), ((961, 981), 'numpy.random.seed', 'np.random.se... |
'''
Random Forest Analysis
This is a regressor random forest that aims to predict the charges (insurance) based on the variables in the dataset
'''
from exploratory_analysis import data
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from numpy import mean
from numpy import std ... | [
"numpy.absolute",
"matplotlib.pyplot.show",
"matplotlib.pyplot.boxplot",
"sklearn.model_selection.cross_val_score",
"numpy.std",
"sklearn.ensemble.RandomForestRegressor",
"numpy.mean",
"numpy.arange",
"sklearn.model_selection.RepeatedKFold"
] | [((2128, 2178), 'matplotlib.pyplot.boxplot', 'plt.boxplot', (['results'], {'labels': 'names', 'showmeans': '(True)'}), '(results, labels=names, showmeans=True)\n', (2139, 2178), True, 'import matplotlib.pyplot as plt\n'), ((2185, 2195), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2193, 2195), True, 'import... |
"""
This is an FSLeyes plugin script that integrates AxonDeepSeg tools into FSLeyes.
Author : <NAME>
"""
import wx
import wx.lib.agw.hyperlink as hl
import fsleyes.controls.controlpanel as ctrlpanel
import fsleyes.actions.loadoverlay as ovLoad
import numpy as np
import nibabel as nib
from PIL import Image, ImageDra... | [
"AxonDeepSeg.ads_utils.imread",
"AxonDeepSeg.morphometrics.compute_morphometrics.get_axon_morphometrics",
"pathlib.Path",
"numpy.rot90",
"skimage.measure.label",
"skimage.measure.regionprops",
"pandas.DataFrame",
"fsleyes.controls.controlpanel.ControlPanel.__init__",
"scipy.ndimage.distance_transfor... | [((1880, 1941), 'wx.Frame', 'wx.Frame', (['self.ads_control'], {'title': '"""Settings"""', 'size': '(600, 300)'}), "(self.ads_control, title='Settings', size=(600, 300))\n", (1888, 1941), False, 'import wx\n'), ((1966, 1990), 'wx.BoxSizer', 'wx.BoxSizer', (['wx.VERTICAL'], {}), '(wx.VERTICAL)\n', (1977, 1990), False, '... |
"""Running basic code:
Importing packages, setting working directory,
printing out date"""
import os as os
os.chdir('C:/Users/falco/Desktop/directory/Missing_links_in_viral_host_communities/')
import datetime as dt
str(dt.datetime.now())
from sklearn.metrics import confusion_matrix
import seaborn as sns
#from pandas_... | [
"sklearn.preprocessing.StandardScaler",
"matplotlib.style.use",
"HPnex.functions.construct_bipartite_host_virus_network",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.classification_report",
"HPnex.functions.construct_unipartite_taxa_level_virus_virus_network",
"matplotlib.pyplot.tight_layout",
... | [((109, 204), 'os.chdir', 'os.chdir', (['"""C:/Users/falco/Desktop/directory/Missing_links_in_viral_host_communities/"""'], {}), "(\n 'C:/Users/falco/Desktop/directory/Missing_links_in_viral_host_communities/'\n )\n", (117, 204), True, 'import os as os\n'), ((2546, 2574), 'matplotlib.style.use', 'style.use', (['"... |
import numpy as np
from objects import (StaticObject, Road, PedestrianCross)
def scenario(l_staticObject, l_cross, l_road):
"""
Coordinates of objects in a scenario. Include:
l_staticObject: list of static objects
l_cross: list of pedestrian crosses
l_road: list of road layouts
... | [
"numpy.array"
] | [((1368, 1422), 'numpy.array', 'np.array', (['[[-40, -20], [-2, -20], [-2, -5], [-40, -5]]'], {}), '([[-40, -20], [-2, -20], [-2, -5], [-40, -5]])\n', (1376, 1422), True, 'import numpy as np\n'), ((1533, 1583), 'numpy.array', 'np.array', (['[[5, -20], [60, -20], [60, -5], [5, -5]]'], {}), '([[5, -20], [60, -20], [60, -... |
import neural_renderer as nr
import numpy as np
from skimage.io import imread
import torch
from torch.autograd import Variable
from src.util.common import resize_img
from src.util.torch_utils import orthographic_proj_withz_idrot
from src.util.render_utils import (
draw_skeleton,
draw_text,
)
COLORS = {
#... | [
"numpy.load",
"numpy.sum",
"ipdb.set_trace",
"numpy.ones",
"numpy.clip",
"numpy.linalg.norm",
"numpy.pad",
"numpy.copy",
"torch.FloatTensor",
"numpy.max",
"src.util.common.resize_img",
"skimage.io.imread",
"numpy.stack",
"numpy.dstack",
"torch.autograd.Variable",
"src.util.render_utils... | [((9718, 9754), 'src.util.render_utils.draw_skeleton', 'draw_skeleton', (['input_img', 'pred_joint'], {}), '(input_img, pred_joint)\n', (9731, 9754), False, 'from src.util.render_utils import draw_skeleton, draw_text\n'), ((11901, 11922), 'numpy.max', 'np.max', (['img.shape[:2]'], {}), '(img.shape[:2])\n', (11907, 1192... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"paddle.fluid.layers.dynamic_lstm",
"paddle.fluid.data",
"numpy.maximum",
"numpy.exp",
"numpy.tile",
"numpy.random.normal",
"unittest.main",
"numpy.zeros_like",
"numpy.copy",
"paddle.fluid.layers.fill_constant",
"numpy.reshape",
"paddle.fluid.layers.lstm",
"paddle.fluid.framework.Program",
... | [((1047, 1057), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (1054, 1057), True, 'import numpy as np\n'), ((1344, 1360), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (1354, 1360), True, 'import numpy as np\n'), ((15700, 15715), 'unittest.main', 'unittest.main', ([], {}), '()\n', (15713, 15715), Fals... |
import collections
import json
import numpy as np
from data_reader import next_batch
from helpers import FileLogger
from wavenet import *
LEARNING_RATE = 1e-5
WAVENET_PARAMS = 'wavenet_params.json'
MOMENTUM = 0.9
SEQUENCE_LENGTH = 32
def main():
with open(WAVENET_PARAMS, 'r') as f:
wavenet_params = jso... | [
"json.load",
"data_reader.next_batch",
"numpy.mean",
"helpers.FileLogger",
"collections.deque"
] | [((1046, 1112), 'helpers.FileLogger', 'FileLogger', (['"""log.tsv"""', "['step', 'training_loss', 'benchmark_loss']"], {}), "('log.tsv', ['step', 'training_loss', 'benchmark_loss'])\n", (1056, 1112), False, 'from helpers import FileLogger\n'), ((1121, 1149), 'collections.deque', 'collections.deque', ([], {'maxlen': '(1... |
from __future__ import print_function
import glob
import json
import os
import sys
import uuid
import cv2
import numpy as np
import pytesseract
import tensorflow as tf
from flask import Flask, request, redirect, render_template, Response ,jsonify
from tensorflow.python.platform import gfile
from sqlalchemy import crea... | [
"tensorflow.python.platform.gfile.FastGFile",
"os.remove",
"json.dumps",
"tensorflow.ConfigProto",
"flask.jsonify",
"numpy.linalg.norm",
"glob.glob",
"os.path.join",
"flask.request.get_json",
"flask.redirect",
"lib.text_connector.detectors.TextDetector",
"flask.render_template",
"tensorflow.... | [((725, 740), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (730, 740), False, 'from flask import Flask, request, redirect, render_template, Response, jsonify\n'), ((750, 787), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///example.db"""'], {}), "('sqlite:///example.db')\n", (763, 787), Fals... |
from jbdl.rbdl.utils import ModelWrapper
import os
import numpy as np
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
print(CURRENT_PATH)
mdlw = ModelWrapper()
mdlw.load(os.path.join(CURRENT_PATH, 'whole_max_v0.json'))
mdlw.nf = 3
mdlw.contact_force_lb = np.array([-1000.0, -1000.0, 0.0]).reshape(-1, 1)
m... | [
"numpy.array",
"os.path.realpath",
"os.path.join",
"jbdl.rbdl.utils.ModelWrapper"
] | [((158, 172), 'jbdl.rbdl.utils.ModelWrapper', 'ModelWrapper', ([], {}), '()\n', (170, 172), False, 'from jbdl.rbdl.utils import ModelWrapper\n'), ((103, 129), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (119, 129), False, 'import os\n'), ((183, 230), 'os.path.join', 'os.path.join', (['CU... |
from itertools import combinations
from math import sqrt, log
import numpy as np
from random import uniform
from statsmodels.stats.power import GofChisquarePower
from typing import List
from beta_bernouilli_bandit import BetaBernouilliBandit
from thompson_sampling import ThompsonSamplingPolicy
from gen_prefer... | [
"beta_bernouilli_bandit.BetaBernouilliBandit",
"statsmodels.stats.power.GofChisquarePower",
"numpy.argmax",
"random.uniform",
"numpy.zeros",
"numpy.amax",
"numpy.array",
"math.log",
"gen_preference_matrix.PreferenceMatrix"
] | [((8156, 8187), 'gen_preference_matrix.PreferenceMatrix', 'PreferenceMatrix', ([], {'num_actions': '(4)'}), '(num_actions=4)\n', (8172, 8187), False, 'from gen_preference_matrix import PreferenceMatrix\n'), ((578, 611), 'numpy.zeros', 'np.zeros', (['preference_matrix.shape'], {}), '(preference_matrix.shape)\n', (586, 6... |
import numpy as np
import pytest
import torch
from PIL import Image
from torchvision.transforms import transforms
from continuum.datasets import InMemoryDataset
from continuum.scenarios import TransformationIncremental
NB_CLASSES = 6
@pytest.fixture
def numpy_data():
nb_data = 100 # not too small to have all c... | [
"continuum.datasets.InMemoryDataset",
"continuum.scenarios.TransformationIncremental",
"torchvision.transforms.transforms.RandomAffine",
"torchvision.transforms.transforms.ToTensor",
"pytest.raises",
"numpy.random.randint",
"torchvision.transforms.transforms.Normalize",
"torchvision.transforms.transfo... | [((2556, 2616), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shared_label_space"""', '[False, True]'], {}), "('shared_label_space', [False, True])\n", (2579, 2616), False, 'import pytest\n'), ((560, 583), 'numpy.concatenate', 'np.concatenate', (['x_train'], {}), '(x_train)\n', (574, 583), True, 'import n... |
import copy
from typing import Any, Dict, List, Optional, Union
import numpy as np
from scipy import special
import great_expectations.exceptions as ge_exceptions
from great_expectations import DataContext
from great_expectations.rule_based_profiler.domain_builder.domain import Domain
from great_expectations.rule_bas... | [
"copy.deepcopy",
"great_expectations.rule_based_profiler.parameter_builder.parameter_container.build_parameter_container",
"great_expectations.rule_based_profiler.util.get_parameter_value_and_validate_return_type",
"numpy.std",
"great_expectations.util.is_numeric",
"scipy.special.erfinv",
"numpy.finfo",... | [((915, 927), 'numpy.sqrt', 'np.sqrt', (['(2.0)'], {}), '(2.0)\n', (922, 927), True, 'import numpy as np\n'), ((871, 886), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (879, 886), True, 'import numpy as np\n'), ((9316, 9503), 'great_expectations.rule_based_profiler.util.get_parameter_value_and_validate_retu... |
#!/usr/bin/env python
# -*- encoding: utf-8
from __future__ import print_function, division, unicode_literals
import argparse
import glob
import json
from itertools import cycle
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font', **{'family': 'serif', 'serif': ['Ubuntu']})
rc('f... | [
"matplotlib.rc",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.array",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots",
"numpy.random.shuffle"
] | [((260, 314), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'serif', 'serif': ['Ubuntu']})\n", (262, 314), False, 'from matplotlib import rc\n'), ((315, 359), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'monospace': ['Ubuntu Mono']})\n", (317, 359), False, 'from matplotlib import rc\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Showcases colour models plotting examples.
"""
from numpy import array
from pprint import pprint
import colour
from colour.plotting import * # noqa
from colour.utilities.verbose import message_box
message_box('Colour Models Plots')
message_box('Plotting "RGB" colo... | [
"colour.utilities.verbose.message_box",
"colour.RGB_COLOURSPACES.keys",
"numpy.array"
] | [((252, 286), 'colour.utilities.verbose.message_box', 'message_box', (['"""Colour Models Plots"""'], {}), "('Colour Models Plots')\n", (263, 286), False, 'from colour.utilities.verbose import message_box\n'), ((288, 366), 'colour.utilities.verbose.message_box', 'message_box', (['"""Plotting "RGB" colourspaces in "CIE 1... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"numpy.random.uniform",
"pandas.Timestamp",
"flaky.flaky",
"tempfile.TemporaryDirectory",
"gluonts.support.pandas.forecast_start",
"numpy.allclose",
"pydantic.PositiveInt",
"gluonts.evaluation.Evaluator",
"pathlib.Path",
"numpy.random.randint",
"pytest.mark.parametrize",
"gluonts.dataset.artif... | [((1533, 1548), 'pydantic.PositiveInt', 'PositiveInt', (['(30)'], {}), '(30)\n', (1544, 1548), False, 'from pydantic import PositiveInt\n'), ((1565, 1581), 'pydantic.PositiveInt', 'PositiveInt', (['(210)'], {}), '(210)\n', (1576, 1581), False, 'from pydantic import PositiveInt\n'), ((1688, 1775), 'pytest.mark.parametri... |
import utils
import imageutils
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
import kerasmodel
# load in Chessboard Calibration images
directory = "camera_cal/"
project_test_images = utils.Load_images_for_directory(directory)
def get_image_corners(img, nx, ny):
""" Gets the image corner... | [
"numpy.absolute",
"cv2.GaussianBlur",
"numpy.arctan2",
"numpy.sum",
"cv2.bitwise_and",
"numpy.argmax",
"cv2.getPerspectiveTransform",
"imageutils.convert_to_hsl",
"numpy.polyfit",
"numpy.abs",
"numpy.ones",
"cv2.fillPoly",
"numpy.mean",
"cv2.rectangle",
"numpy.convolve",
"imageutils.co... | [((210, 252), 'utils.Load_images_for_directory', 'utils.Load_images_for_directory', (['directory'], {}), '(directory)\n', (241, 252), False, 'import utils\n'), ((403, 434), 'imageutils.convert_to_gray', 'imageutils.convert_to_gray', (['img'], {}), '(img)\n', (429, 434), False, 'import imageutils\n'), ((483, 530), 'cv2.... |
import numpy as np
from distributions.mixture.basemixture import *
from distributions.exponential import Exponential
from scipy.stats import expon
class CensrdExpMix(BaseMix):
def __init__(self, s, t, x, xs=None, xt=None, ws=None, wt=None, wx=None):
self.s = s
self.t = t
self.x = x
... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.log",
"numpy.random.exponential",
"numpy.ones",
"numpy.array",
"numpy.exp",
"scipy.stats.expon.cdf",
"numpy.random.choice",
"distributions.exponential.Exponential.fit_censored_data",
"numpy.concatenate",
"distributions.lomax.Lomax.s... | [((6039, 6075), 'distributions.lomax.Lomax.samples_', 'Lomax.samples_', (['k1', 'lmb1'], {'size': 't_len'}), '(k1, lmb1, size=t_len)\n', (6053, 6075), False, 'from distributions.lomax import Lomax\n'), ((6092, 6128), 'distributions.lomax.Lomax.samples_', 'Lomax.samples_', (['k2', 'lmb2'], {'size': 's_len'}), '(k2, lmb2... |
import numpy as np
import scipy.io.wavfile
import scipy.signal
import fastburg as burg
import soundfile as sf
import argparse
def ar_filter_offline(
samples,
pos,
dur,
n=4000, # AR order
ns=4000, # number of samples to adapat on
):
"""`Freezes` signal using AR model and IIR filtering.
P... | [
"soundfile.read",
"argparse.ArgumentParser",
"numpy.zeros",
"numpy.mean",
"numpy.arange",
"soundfile.write",
"fastburg._arburg2",
"numpy.concatenate"
] | [((879, 902), 'numpy.zeros', 'np.zeros', (['dur', 'np.float'], {}), '(dur, np.float)\n', (887, 902), True, 'import numpy as np\n'), ((2189, 2216), 'numpy.zeros', 'np.zeros', (['(nd * nl)', 'np.float'], {}), '(nd * nl, np.float)\n', (2197, 2216), True, 'import numpy as np\n'), ((3468, 3509), 'numpy.concatenate', 'np.con... |
import flash
import numpy as np
import pandas as pd
import torch
from autofe.feature_engineering.groupby import get_category_columns, get_numerical_columns
from autofe.get_feature import generate_cross_feature, get_cross_columns, get_groupby_total_data
from flash.tabular import TabularClassificationData, TabularClassif... | [
"flash.tabular.TabularClassifier.from_data",
"numpy.argmax",
"pandas.read_csv",
"pandas.get_dummies",
"sklearn.metrics.accuracy_score",
"autofe.feature_engineering.groupby.get_category_columns",
"autofe.feature_engineering.groupby.get_numerical_columns",
"autofe.get_feature.get_groupby_total_data",
... | [((527, 563), 'pandas.read_csv', 'pd.read_csv', (["(root_path + 'train.csv')"], {}), "(root_path + 'train.csv')\n", (538, 563), True, 'import pandas as pd\n'), ((612, 647), 'pandas.read_csv', 'pd.read_csv', (["(root_path + 'test.csv')"], {}), "(root_path + 'test.csv')\n", (623, 647), True, 'import pandas as pd\n'), ((7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.