code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from typing import List, Optional, Tuple, Type
import numpy as np
import torch as T
from gym import Env
from pearll.agents import BaseAgent
from pearll.buffers import BaseBuffer, ReplayBuffer
from pearll.callbacks.base_callback import BaseCallback
from pearll.common.enumerations import FrequencyType
from pearll.commo... | [
"pearll.settings.BufferSettings",
"torch.nn.BCELoss",
"pearll.settings.MiscellaneousSettings",
"pearll.settings.OptimizerSettings",
"pearll.common.type_aliases.Trajectories",
"numpy.zeros",
"numpy.mean",
"pearll.settings.ExplorerSettings",
"pearll.settings.LoggerSettings",
"torch.no_grad",
"pear... | [((2684, 2703), 'pearll.settings.OptimizerSettings', 'OptimizerSettings', ([], {}), '()\n', (2701, 2703), False, 'from pearll.settings import BufferSettings, ExplorerSettings, LoggerSettings, MiscellaneousSettings, OptimizerSettings, Settings\n'), ((2818, 2837), 'pearll.settings.OptimizerSettings', 'OptimizerSettings',... |
from numba import jit, guvectorize, float64, int32, float64, b1
#@guvectorize([(float64[:], float64[:], float64[:], float64[:],float64[:], b1[:])], '(),(),(m),(m),(k),()', nopython = True, cache = True, target='parallel')
@jit(nopython=True)#
def point_in_polygon(xArr,yArr, xpts, ypts, bbox, ans):
"""Calculate if... | [
"numpy.stack",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.invert",
"matplotlib.pyplot.gca",
"numpy.append",
"numpy.sin",
"numba.jit",
"numpy.linspace",
"numpy.cos",
"numpy.random.rand"
] | [((225, 243), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (228, 243), False, 'from numba import jit, guvectorize, float64, int32, float64, b1\n'), ((1504, 1530), 'numpy.random.rand', 'np.random.rand', (['num_points'], {}), '(num_points)\n', (1518, 1530), True, 'import numpy as np\n'), ((1867,... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import logging
import threading
import time
import numpy as np
import random
class PrototypeServer(threading.Thread):
def __init__(self):
super(PrototypeServer, self).__init__()
# setup client specific logger
self._logger = logging.getLogg... | [
"random.randint",
"numpy.random.exponential",
"logging.getLogger",
"time.sleep",
"time.time",
"time.localtime"
] | [((305, 368), 'logging.getLogger', 'logging.getLogger', (["('AppAware.Server.' + self.__class__.__name__)"], {}), "('AppAware.Server.' + self.__class__.__name__)\n", (322, 368), False, 'import logging\n'), ((745, 756), 'time.time', 'time.time', ([], {}), '()\n', (754, 756), False, 'import time\n'), ((1049, 1062), 'time... |
""" Unit tests for analysis functions. """
from datetime import datetime
from unittest import TestCase
from unittest.mock import Mock, create_autospec
import numpy as np
import pytz
from acnportal import acnsim
from acnportal.algorithms import BaseAlgorithm
class TestAnalysis(TestCase):
def setUp(self):
... | [
"acnportal.acnsim.EVSE",
"unittest.mock.create_autospec",
"acnportal.acnsim.Event",
"acnportal.acnsim.datetimes_array",
"numpy.datetime64",
"unittest.mock.Mock",
"pytz.timezone",
"acnportal.acnsim.Simulator",
"acnportal.acnsim.ChargingNetwork",
"numpy.testing.assert_equal"
] | [((415, 439), 'acnportal.acnsim.ChargingNetwork', 'acnsim.ChargingNetwork', ([], {}), '()\n', (437, 439), False, 'from acnportal import acnsim\n'), ((456, 490), 'acnportal.acnsim.EVSE', 'acnsim.EVSE', (['"""PS-001"""'], {'max_rate': '(32)'}), "('PS-001', max_rate=32)\n", (467, 490), False, 'from acnportal import acnsim... |
from DNN import Dnn
import numpy as np
import csv
import random
from keras.optimizers import sgd,adagrad,rmsprop,adadelta,adam
import matplotlib.pyplot as plt
batch_size=64
input_dim=784
output_dim=10
learning_rate=0.001
train_size=0.8
num_epoch=100
f=open("./train.csv",'r',encoding='utf-8',newline=''... | [
"keras.optimizers.adam",
"keras.optimizers.rmsprop",
"csv.reader",
"matplotlib.pyplot.show",
"numpy.eye",
"random.shuffle",
"matplotlib.pyplot.legend",
"keras.optimizers.sgd",
"keras.optimizers.adagrad",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((330, 358), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (340, 358), False, 'import csv\n'), ((419, 443), 'random.shuffle', 'random.shuffle', (['raw_data'], {}), '(raw_data)\n', (433, 443), False, 'import random\n'), ((454, 472), 'numpy.array', 'np.array', (['raw_data'], {}),... |
# Built-in libraries
import copy
import datetime
from typing import Dict, List
# Third-party libraries
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader
from sklearn.metrics import f1_score
from tqdm import tqdm
# Local files
from utils import save
from config import LABEL_DIC... | [
"tqdm.tqdm",
"sklearn.metrics.f1_score",
"numpy.array",
"torch.set_grad_enabled",
"datetime.datetime.now",
"numpy.concatenate",
"utils.save"
] | [((1925, 1962), 'numpy.array', 'np.array', (['[0, 0, 0]'], {'dtype': 'np.float64'}), '([0, 0, 0], dtype=np.float64)\n', (1933, 1962), True, 'import numpy as np\n'), ((1993, 2030), 'numpy.array', 'np.array', (['[0, 0, 0]'], {'dtype': 'np.float64'}), '([0, 0, 0], dtype=np.float64)\n', (2001, 2030), True, 'import numpy as... |
"""
Display one 3-D volume layer using the add_volume API
"""
import numpy as np
import napari
translate = (10,) * 3
with napari.gui_qt():
data = np.random.randint(0,255, (10,10,10), dtype='uint8')
viewer = napari.Viewer()
viewer.add_image(data, name='raw', opacity=.5)
viewer.add_image(data, translate... | [
"napari.Viewer",
"napari.gui_qt",
"numpy.random.randint"
] | [((124, 139), 'napari.gui_qt', 'napari.gui_qt', ([], {}), '()\n', (137, 139), False, 'import napari\n'), ((152, 206), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(10, 10, 10)'], {'dtype': '"""uint8"""'}), "(0, 255, (10, 10, 10), dtype='uint8')\n", (169, 206), True, 'import numpy as np\n'), ((217, 23... |
import torch
from PIL import Image
import torch.utils.data as data
import quaternion
import os
import numpy as np
import cv2
import glob
from torchvision import transforms
import os.path as osp
SCENES_PATH="/home/t/data/7Scenes/"
class ScenesDataset(data.Dataset):
def __init__(self, data_dir =SCENES_PATH, train=... | [
"torch.utils.data.DataLoader",
"cv2.waitKey",
"quaternion.from_rotation_matrix",
"cv2.imread",
"numpy.loadtxt",
"quaternion.as_float_array",
"glob.glob",
"cv2.destroyAllWindows",
"os.path.join",
"os.listdir",
"torch.tensor"
] | [((2341, 2408), 'torch.utils.data.DataLoader', 'data.DataLoader', (['dataset'], {'batch_size': '(1)', 'num_workers': '(8)', 'shuffle': '(True)'}), '(dataset, batch_size=1, num_workers=8, shuffle=True)\n', (2356, 2408), True, 'import torch.utils.data as data\n'), ((2669, 2692), 'cv2.destroyAllWindows', 'cv2.destroyAllWi... |
import pytest
import numpy as np
from astropy.modeling import models
from ..filters import Window1D, Optimal1D, filter_for_deadtime
from stingray.events import EventList
class TestFilters(object):
@classmethod
def setup_class(self):
self.x = np.linspace(0, 10, 100)
self.amplitude_0 = 5.
... | [
"numpy.abs",
"stingray.events.EventList",
"pytest.raises",
"numpy.array",
"numpy.linspace",
"astropy.modeling.models.Lorentz1D",
"numpy.all",
"astropy.modeling.models.Const1D"
] | [((1368, 1425), 'numpy.array', 'np.array', (['[1, 1.05, 1.07, 1.08, 1.1, 2, 2.2, 3, 3.1, 3.2]'], {}), '([1, 1.05, 1.07, 1.08, 1.1, 2, 2.2, 3, 3.1, 3.2])\n', (1376, 1425), True, 'import numpy as np\n'), ((1516, 1545), 'numpy.array', 'np.array', (['[1, 2, 2.2, 3, 3.2]'], {}), '([1, 2, 2.2, 3, 3.2])\n', (1524, 1545), True... |
import numpy as np
from ga.solutions import DoubleArraySolution, BitArraySolution, Solution
class Crossing:
def cross(self, momma: Solution, poppa: Solution):
pass
class GaussCrossing(Crossing):
def cross(self, momma: DoubleArraySolution, poppa: DoubleArraySolution):
minimum = np.minimum(... | [
"numpy.random.uniform",
"numpy.minimum",
"numpy.maximum",
"numpy.logical_and",
"numpy.logical_xor",
"numpy.array"
] | [((309, 341), 'numpy.minimum', 'np.minimum', (['momma.arr', 'poppa.arr'], {}), '(momma.arr, poppa.arr)\n', (319, 341), True, 'import numpy as np\n'), ((360, 392), 'numpy.maximum', 'np.maximum', (['momma.arr', 'poppa.arr'], {}), '(momma.arr, poppa.arr)\n', (370, 392), True, 'import numpy as np\n'), ((1234, 1254), 'numpy... |
import os
import numpy as np
import tensorflow as tf
ALL_VARS = None
def clip(gradient, min_clip_value=-1e+0, max_clip_value=1e+0):
"""
Examples:
>>> loss = ...
>>> optimizer = tf.train.AdamOptimizer()
>>> gvs = optimizer.compute_gradients(loss)
>>> gvs = [(clip(grad), var) for grad, var in gvs]
>>> t... | [
"os.makedirs",
"tensorflow.train.Saver",
"tensorflow.clip_by_value",
"tensorflow.get_collection",
"tensorflow.Session",
"tensorflow.ConfigProto",
"numpy.mean",
"tensorflow.GPUOptions"
] | [((556, 614), 'tensorflow.clip_by_value', 'tf.clip_by_value', (['gradient', 'min_clip_value', 'max_clip_value'], {}), '(gradient, min_clip_value, max_clip_value)\n', (572, 614), True, 'import tensorflow as tf\n'), ((1182, 1243), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.GLOBAL_VARIABLES'], {'sco... |
"""
Inference for GP regression.
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import scipy.optimize as spop
import warnings
from collections import namedtuple
from itertools import izip
from ...utils import linalg as la
__all__ ... | [
"numpy.trace",
"numpy.outer",
"numpy.ones_like",
"warnings.simplefilter",
"numpy.log",
"numpy.sum",
"numpy.abs",
"numpy.zeros",
"warnings.catch_warnings",
"collections.namedtuple",
"numpy.inner",
"numpy.dot",
"numpy.diag",
"numpy.sqrt"
] | [((459, 506), 'collections.namedtuple', 'namedtuple', (['"""Statistics"""', '"""L, a, w, lZ, dlZ, C"""'], {}), "('Statistics', 'L, a, w, lZ, dlZ, C')\n", (469, 506), False, 'from collections import namedtuple\n'), ((1005, 1020), 'numpy.ones_like', 'np.ones_like', (['a'], {}), '(a)\n', (1017, 1020), True, 'import numpy ... |
# Implementar dicho métodos para obtener la segmentación de una imagen
# Implementar dicho métodos para obtener la segmentación de una imagen
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from PIL import Image, ImageOps
def imageToArray(filename: str, rgb: bool = Fals... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.sum",
"matplotlib.pyplot.imshow",
"numpy.power",
"numpy.zeros",
"PIL.ImageOps.grayscale",
"PIL.Image.open",
"numpy.histogram",
"numpy.array",
"numpy.arange"
] | [((494, 514), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(4)', '(1)'], {}), '(2, 4, 1)\n', (505, 514), True, 'import matplotlib.pyplot as plt\n'), ((515, 543), 'matplotlib.pyplot.title', 'plt.title', (['"""Imagen Original"""'], {}), "('Imagen Original')\n", (524, 543), True, 'import matplotlib.pyplot as plt\... |
# -*- coding:utf-8 -*-
"""
-------------------------------------------------
File Name: lstm_classification
Description: lstm 文本分类
Author: Miller
date: 2017/9/12 0012
-------------------------------------------------
"""
__author__ = 'Miller'
import numpy as np
from keras.layers import... | [
"keras.preprocessing.sequence.pad_sequences",
"keras.layers.LSTM",
"numpy.asarray",
"keras.layers.Dropout",
"keras.preprocessing.text.Tokenizer",
"keras.layers.Dense",
"keras.models.Sequential",
"classification.datasets.datasets.load"
] | [((722, 737), 'classification.datasets.datasets.load', 'datasets.load', ([], {}), '()\n', (735, 737), False, 'from classification.datasets import datasets\n'), ((839, 850), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (848, 850), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1048... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 16 18:54:12 2017
@author: shenda
class order: ['A', 'N', 'O', '~']
"""
from CDL import CDL
import dill
import numpy as np
class Encase(object):
def __init__(self, clf_list):
self.clf_list = clf_list
self.n_clf = len(self.clf... | [
"numpy.array"
] | [((886, 910), 'numpy.array', 'np.array', (['self.prob_list'], {}), '(self.prob_list)\n', (894, 910), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
__author__ = '<NAME>'
__contact__ = '<EMAIL>'
__copyright__ = '(c) <NAME> 2017'
__license__ = 'MIT'
__date__ = 'Thu Feb 2 14:02:12 2017'
__status__ = "initial release"
__url__ = "___"
"""
Name... | [
"random.shuffle",
"numpy.mean",
"sys.stdout.flush",
"plotly.graph_objs.Margin",
"nltk.word_tokenize",
"json.loads",
"django.http.HttpResponse",
"nltk.corpus.pros_cons.words",
"plotly.offline.plot",
"oauth2.Consumer",
"oauth2.Client",
"django.shortcuts.render",
"plotly.graph_objs.Figure",
"... | [((1522, 1548), 'django_rq.get_connection', 'django_rq.get_connection', ([], {}), '()\n', (1546, 1548), False, 'import django_rq\n'), ((4615, 4665), 'nltk.data.path.append', 'nltk.data.path.append', (['"""./static/twitter/nltk_dir"""'], {}), "('./static/twitter/nltk_dir')\n", (4636, 4665), False, 'import nltk\n'), ((47... |
# -*- coding: utf-8 -*-
from udacidrone.messaging import MsgID
from enum import Enum
from udacidrone.connection import MavlinkConnection
import numpy as np
from plane_drone import Udaciplane
from plane_control import LongitudinalAutoPilot
from plane_control import LateralAutoPilot
from plane_control import euler2RM
im... | [
"plane_control.LateralAutoPilot",
"numpy.abs",
"plane_control.LongitudinalAutoPilot",
"numpy.arcsin",
"time.sleep",
"numpy.array",
"udacidrone.connection.MavlinkConnection",
"numpy.linalg.norm",
"plane_control.euler2RM"
] | [((14502, 14568), 'udacidrone.connection.MavlinkConnection', 'MavlinkConnection', (['"""tcp:127.0.0.1:5760"""'], {'threaded': '(False)', 'PX4': '(False)'}), "('tcp:127.0.0.1:5760', threaded=False, PX4=False)\n", (14519, 14568), False, 'from udacidrone.connection import MavlinkConnection\n'), ((14713, 14726), 'time.slee... |
import numpy as np
from sklearn.ensemble import VotingClassifier
from sklearn.linear_model import ElasticNet
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.preprocessing import FunctionTransformer, MinMaxScaler
from sklearn.svm import LinearSVR
... | [
"sklearn.preprocessing.FunctionTransformer",
"sklearn.linear_model.ElasticNet",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.MinMaxScaler",
"numpy.recfromcsv",
"tpot.operators.preprocessors.ZeroCount",
"sklearn.svm.LinearSVR"
] | [((453, 540), 'numpy.recfromcsv', 'np.recfromcsv', (['"""PATH/TO/DATA/FILE"""'], {'delimiter': '"""COLUMN_SEPARATOR"""', 'dtype': 'np.float64'}), "('PATH/TO/DATA/FILE', delimiter='COLUMN_SEPARATOR', dtype=np.\n float64)\n", (466, 540), True, 'import numpy as np\n'), ((738, 801), 'sklearn.model_selection.train_test_s... |
#gen_func
from __future__ import division
from __future__ import absolute_import
import numpy as np
from libensemble.message_numbers import STOP_TAG, PERSIS_STOP
from libensemble.gen_funcs.support import sendrecv_mgr_worker_msg
def persistent_updater_after_likelihood(H, persis_info, gen_specs, libE_info):
"""
... | [
"numpy.zeros",
"libensemble.gen_funcs.support.sendrecv_mgr_worker_msg",
"numpy.random.randn"
] | [((686, 750), 'numpy.zeros', 'np.zeros', (['(subbatch_size * num_subbatches)'], {'dtype': "gen_specs['out']"}), "(subbatch_size * num_subbatches, dtype=gen_specs['out'])\n", (694, 750), True, 'import numpy as np\n'), ((1262, 1294), 'libensemble.gen_funcs.support.sendrecv_mgr_worker_msg', 'sendrecv_mgr_worker_msg', (['c... |
'''
This code runs pre-trained MGN.
If you use this code please cite:
"Multi-Garment Net: Learning to Dress 3D People from Images", ICCV 2019
Code author: Bharat
'''
import tensorflow as tf
import numpy as np
import pickle as pkl # Python 3 change
from network.base_network import PoseShapeOffsetModel
... | [
"psbody.mesh.Mesh",
"tensorflow.train.Checkpoint",
"numpy.transpose",
"tensorflow.transpose",
"tensorflow.stack",
"tensorflow.ConfigProto",
"tensorflow.cast",
"tensorflow.train.latest_checkpoint",
"numpy.where",
"pickle.load",
"tensorflow.Variable",
"tensorflow.enable_eager_execution",
"tens... | [((645, 669), 'tensorflow.stack', 'tf.stack', (['disps'], {'axis': '(-1)'}), '(disps, axis=-1)\n', (653, 669), True, 'import tensorflow as tf\n'), ((779, 816), 'tensorflow.transpose', 'tf.transpose', (['temp'], {'perm': '[0, 1, 3, 2]'}), '(temp, perm=[0, 1, 3, 2])\n', (791, 816), True, 'import tensorflow as tf\n'), ((1... |
'''
Copyright 2022 Airbus SAS
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, sof... | [
"pandas.DataFrame",
"sos_trades_core.tools.post_processing.charts.chart_filter.ChartFilter",
"numpy.linalg.norm",
"numpy.arange",
"sos_trades_core.tools.post_processing.charts.two_axes_instanciated_chart.TwoAxesInstanciatedChart"
] | [((1555, 1576), 'numpy.arange', 'np.arange', (['(2020)', '(2101)'], {}), '(2020, 2101)\n', (1564, 1576), True, 'import numpy as np\n'), ((2340, 2480), 'numpy.linalg.norm', 'np.linalg.norm', (["(inputs['energy_investment_macro']['energy_investment'].values - inputs[\n 'energy_investment']['energy_investment'].values)... |
from __future__ import division, print_function, absolute_import
from . import util
import numpy as np
class PatternFilterer(object):
#The idea is that 'patterns' gets divided into the patterns that pass and
# the patterns that get filtered
def __call__(self, patterns):
raise NotImplementedError(... | [
"numpy.max",
"numpy.sum"
] | [((2859, 2882), 'numpy.sum', 'np.sum', (['per_position_ic'], {}), '(per_position_ic)\n', (2865, 2882), True, 'import numpy as np\n'), ((3161, 3180), 'numpy.max', 'np.max', (['windowed_ic'], {}), '(windowed_ic)\n', (3167, 3180), True, 'import numpy as np\n')] |
from pyoptsolver import OptProblem, OptSolver, OptConfig
import numpy as np
class TestFunction2(OptProblem):
"""The same problem but different style"""
def __init__(self):
OptProblem.__init__(self, 2, 2, 4)
self.set_lb([1., 0.])
self.set_ub([1e20, 1e20])
self.set_xlb([-1e20, -1... | [
"pyoptsolver.OptSolver",
"numpy.array",
"pyoptsolver.OptProblem.__init__",
"pyoptsolver.OptConfig"
] | [((1808, 1846), 'pyoptsolver.OptConfig', 'OptConfig', ([], {'backend': '"""knitro"""'}), "(backend='knitro', **options)\n", (1817, 1846), False, 'from pyoptsolver import OptProblem, OptSolver, OptConfig\n'), ((1897, 1920), 'pyoptsolver.OptSolver', 'OptSolver', (['prob', 'config'], {}), '(prob, config)\n', (1906, 1920),... |
import argparse
import os
import sys
from collections import defaultdict
import gym
import matplotlib.pyplot as plt
import numpy as np
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import active_reward_learning
from active_reward_learning.util.helpers import get_dict_default
from... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.figaspect",
"argparse.ArgumentParser",
"os.walk",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.mean",
"active_reward_learning.util.helpers.get_dict_default",
"tensorboard.backend.event_processing.event_accumulator.EventAccumulator",
"m... | [((1356, 1391), 'collections.defaultdict', 'defaultdict', (['(lambda : 0.6)', 'AF_ALPHA'], {}), '(lambda : 0.6, AF_ALPHA)\n', (1367, 1391), False, 'from collections import defaultdict\n'), ((1514, 1548), 'collections.defaultdict', 'defaultdict', (['(lambda : 1)', 'AF_ZORDER'], {}), '(lambda : 1, AF_ZORDER)\n', (1525, 1... |
from typing import Any, Iterable as IterableType, Dict, List, Tuple, Union
from .base import BaseStorageBackend
from FPSim2.FPSim2lib import py_popcount
from ..chem import (
get_mol_suplier,
get_fp_length,
rdmol_to_efp,
FP_FUNC_DEFAULTS,
)
import tables as tb
import numpy as np
import rdkit
import math
... | [
"os.remove",
"math.ceil",
"tables.ObjectAtom",
"os.rename",
"tables.UInt64Col",
"tables.Int64Col",
"tables.Filters",
"numpy.array",
"tables.open_file"
] | [((503, 523), 'tables.Int64Col', 'tb.Int64Col', ([], {'pos': 'pos'}), '(pos=pos)\n', (514, 523), True, 'import tables as tb\n'), ((673, 697), 'tables.Int64Col', 'tb.Int64Col', ([], {'pos': '(pos + 1)'}), '(pos=pos + 1)\n', (684, 697), True, 'import tables as tb\n'), ((1854, 1894), 'tables.Filters', 'tb.Filters', ([], {... |
# encoding: utf-8
##################################################
# This script shows uses the pandas library to create statistically describe data sets
# It also shows basic plotting features
# Find extra documentation about data frame here:
# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataF... | [
"seaborn.set_style",
"seaborn.kdeplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"seaborn.despine",
"numpy.isnan",
"seaborn.regplot",
"seaborn.distplot"
] | [((979, 1046), 'pandas.read_csv', 'pd.read_csv', (['"""../data/world/pop_total_v2.csv"""'], {'skiprows': '(4)', 'header': '(0)'}), "('../data/world/pop_total_v2.csv', skiprows=4, header=0)\n", (990, 1046), True, 'import pandas as pd\n'), ((1522, 1544), 'seaborn.distplot', 'sns.distplot', (['pop_2010'], {}), '(pop_2010)... |
import argparse
import subprocess
import os
import shutil
import glob
import pprint
import math
import time
import pandas as pd
import numpy as np
import hyperopt
from rl_baselines.registry import registered_rl
from environments.registry import registered_env
from state_representation.registry import registered_srl
f... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"hyperopt.hp.choice",
"numpy.argmin",
"numpy.isnan",
"numpy.argsort",
"numpy.mean",
"pprint.pprint",
"environments.registry.registered_env.keys",
"glob.glob",
"shutil.rmtree",
"os.path.exists",
"numpy.random.RandomState",
"hyperopt.Trials",
"... | [((10049, 10140), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Hyperparameter search for implemented RL models"""'}), "(description=\n 'Hyperparameter search for implemented RL models')\n", (10072, 10140), False, 'import argparse\n'), ((12344, 12355), 'time.time', 'time.time', ([], ... |
import pandas as pd
import numpy as np
df = pd.Series(range(3), index=['a', 'b', 'c'])
print(f'================df:\n{df}')
# 5.2.1 && 5.2.2
# 5.2.1 重建索引, Series
# - 如果某个索引值之前并不存在,则会引入缺失值:
# - 如果某个索引值删除了,则对应的value会删除:
df2 = df.reindex(index=['a', 'c', 'd', 'e'])
print("=============df2:\n{}".format(df2))
# 顺序数据的重建... | [
"pandas.DataFrame",
"numpy.arange",
"pandas.Series",
"numpy.reshape"
] | [((336, 397), 'pandas.Series', 'pd.Series', ([], {'data': "['blue', 'purple', 'yellow']", 'index': '[0, 2, 4]'}), "(data=['blue', 'purple', 'yellow'], index=[0, 2, 4])\n", (345, 397), True, 'import pandas as pd\n'), ((572, 584), 'numpy.arange', 'np.arange', (['(9)'], {}), '(9)\n', (581, 584), True, 'import numpy as np\... |
"""
Hello poppet
"""
import csv
import matplotlib.pyplot as plt
import numpy as np
import os
Na = 8
N_helpers = 8
RunNr = 3
plot_protagonist = True
plot_helpers = True
big_folder_name = "anchors_" + str(Na) + "_helpers_" + str(N_helpers) + "_run_" + str(RunNr)
# input_file = os.path.join("C:\\Users\\<NAME>\\Docum... | [
"matplotlib.pyplot.show",
"numpy.ndarray",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"os.listdir"
] | [((393, 478), 'os.path.join', 'os.path.join', (['"""C:\\\\Users\\\\<NAME>\\\\Documents\\\\GitHub\\\\uwb-simulator\\\\publication"""'], {}), "('C:\\\\Users\\\\<NAME>\\\\Documents\\\\GitHub\\\\uwb-simulator\\\\publication'\n )\n", (405, 478), False, 'import os\n'), ((1658, 1670), 'numpy.array', 'np.array', (['[]'], {}... |
import numpy as np
import pytest
import torch
from probflow.distributions import Normal
tod = torch.distributions
def is_close(a, b, tol=1e-3):
return np.abs(a - b) < tol
def test_Normal():
"""Tests Normal distribution"""
# Create the distribution
dist = Normal()
# Check default params
a... | [
"numpy.abs",
"numpy.power",
"probflow.distributions.Normal",
"pytest.raises",
"numpy.sqrt"
] | [((278, 286), 'probflow.distributions.Normal', 'Normal', ([], {}), '()\n', (284, 286), False, 'from probflow.distributions import Normal\n'), ((1208, 1230), 'probflow.distributions.Normal', 'Normal', ([], {'loc': '(3)', 'scale': '(2)'}), '(loc=3, scale=2)\n', (1214, 1230), False, 'from probflow.distributions import Nor... |
## Have Adam double check the conversion from bolometric to apparent magnitude
## ellc.lc is in arbitrary flux units... am I using this correctly?
import math
import scipy.special as ss
import scipy.stats
from scipy.interpolate import interp1d
import multiprocessing
import logging
import numpy as np
import os
import ... | [
"numpy.random.seed",
"numpy.sum",
"numpy.arctan2",
"pandas.read_csv",
"numpy.shape",
"numpy.argsort",
"scipy.special.logit",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"multiprocessing.Queue",
"numpy.random.normal",
"numpy.interp",
"ellc.ldy.LimbGravityDarkeningCoeffs",
"numpy.arctanh",
... | [((4958, 4972), 'numpy.log10', 'np.log10', (['Teff'], {}), '(Teff)\n', (4966, 4972), True, 'import numpy as np\n'), ((8274, 8319), 'ellc.ldy.LimbGravityDarkeningCoeffs', 'ellc.ldy.LimbGravityDarkeningCoeffs', (['filtellc'], {}), '(filtellc)\n', (8309, 8319), False, 'import ellc\n'), ((8836, 9193), 'ellc.lc', 'ellc.lc',... |
from nltk.stem.porter import PorterStemmer
from nltk.stem import WordNetLemmatizer
from multiprocessing.dummy import Pool as ThreadPool
import os
import time
import pandas as pd
import nltk
import numpy as np
import re
import spacy
from sklearn.feature_extraction.text import CountVectorizer
import progressbar as bar... | [
"sklearn.feature_extraction.text.CountVectorizer",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.ensemble.VotingClassifier",
"sklearn.metrics.f1_score",
"sklearn.metrics.precision_recall_fscore_support",
"pandas.DataFrame",
"extractUnique.unique",
"spacy.load",
"tristream... | [((624, 675), 'pandas.read_csv', 'pd.read_csv', (['"""CSV/Restaurants_Test_Data_phaseB.csv"""'], {}), "('CSV/Restaurants_Test_Data_phaseB.csv')\n", (635, 675), True, 'import pandas as pd\n'), ((685, 728), 'pandas.read_csv', 'pd.read_csv', (['"""CSV/Restaurants_Train_v2.csv"""'], {}), "('CSV/Restaurants_Train_v2.csv')\n... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 5 17:42:09 2019
@author: WENDY
"""
import os
import numpy as np
import scipy.sparse as sp
from src.graphviz.func import postprune_init
# 获得所有文件夹目录
def Getdirnext(dirname_list, f=0):
dirnext = []
for name in dirname_list:
for i in range(5):
... | [
"os.remove",
"numpy.sum",
"scipy.sparse.csr_matrix.mean",
"scipy.sparse.csr_matrix.sum",
"scipy.sparse.vstack",
"numpy.power",
"scipy.sparse.load_npz",
"os.path.exists",
"numpy.where",
"numpy.tile",
"src.graphviz.func.postprune_init",
"numpy.sqrt",
"os.listdir",
"scipy.sparse.csr_matrix.po... | [((966, 996), 'scipy.sparse.csr_matrix.mean', 'sp.csr_matrix.mean', (['ma'], {'axis': '(0)'}), '(ma, axis=0)\n', (984, 996), True, 'import scipy.sparse as sp\n'), ((1107, 1127), 'numpy.power', 'np.power', (['ma_mean', '(2)'], {}), '(ma_mean, 2)\n', (1115, 1127), True, 'import numpy as np\n'), ((1151, 1177), 'numpy.sum'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2018 <NAME>
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 req... | [
"numpy.stack",
"matplotlib.pyplot.subplot",
"numpy.load",
"scipy.ndimage.filters.gaussian_filter",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.axes",
"math.radians",
"time.strftime",
"matplotlib.widgets.Button",
"PIL.Image.open",
"matplotlib.pyplot.draw",
"numpy.g... | [((846, 871), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (869, 871), False, 'import argparse\n'), ((1528, 1547), 'numpy.load', 'np.load', (['"""nlst.npy"""'], {}), "('nlst.npy')\n", (1535, 1547), True, 'import numpy as np\n'), ((1556, 1575), 'numpy.load', 'np.load', (['args.input'], {}), '(... |
#!/usr/bin/env python
# coding: utf-8
# DO NOT EDIT
# Autogenerated from the notebook gee_score_test_simulation.ipynb.
# Edit the notebook and then sync the output with this file.
#
# flake8: noqa
# DO NOT EDIT
# # GEE score tests
#
# This notebook uses simulation to demonstrate robust GEE score tests.
# These tests ... | [
"pandas.DataFrame",
"matplotlib.pyplot.boxplot",
"scipy.stats.distributions.norm.cdf",
"numpy.asarray",
"numpy.ones",
"statsmodels.api.cov_struct.Independence",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.random.normal",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"scipy.stats.distributio... | [((2358, 2387), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(n, p)'}), '(size=(n, p))\n', (2374, 2387), True, 'import numpy as np\n'), ((5231, 5302), 'pandas.DataFrame', 'pd.DataFrame', (['rslt'], {'index': "['H0', 'H1']", 'columns': "['Mean', 'Prop(p<0.1)']"}), "(rslt, index=['H0', 'H1'], columns=['Mean'... |
"""
## Conditional Deep Feature Consistent VAE model
--------------------------------------------------
## Author: <NAME>.
## Email: <EMAIL>
## Version: 1.0.0
--------------------------------------------------
## License: MIT
## Copyright: Copyright <NAME> & <NAME> 2020, ICSG3D
-----------------------------------------... | [
"keras.models.load_model",
"keras.layers.UpSampling3D",
"numpy.empty",
"keras.models.Model",
"numpy.mean",
"keras.backend.shape",
"numpy.tile",
"numpy.random.normal",
"numpy.random.randint",
"keras.layers.Input",
"keras.layers.Reshape",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"ke... | [((1149, 1170), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1163, 1170), False, 'import matplotlib\n'), ((1569, 1604), 'keras.backend.random_normal', 'K.random_normal', ([], {'shape': '(batch, dim)'}), '(shape=(batch, dim))\n', (1584, 1604), True, 'from keras import backend as K\n'), ((1448, ... |
"""
Quantify regulation cost.
First run simulations to obtain historical records.
Then analyze the historical records to get cost coefficients by regression.
"""
import logging
import datetime
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from mpc_coordinator import predict_agc, C... | [
"numpy.polyfit",
"logging.Formatter",
"matplotlib.pyplot.figure",
"numpy.mean",
"mpc_coordinator.predict_agc",
"numpy.polyval",
"mpc_coordinator.EnergyStorage",
"numpy.loadtxt",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.show",
"datetime.datetime.today",
"matplotlib.pyplot.ylim",
"matplo... | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['"""cement"""'], {}), "('cement')\n", (387, 397), False, 'import logging\n'), ((433, 456), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (454, 456), False, 'import logging\n'), ((501, 572), 'logging.Formatter', 'logging.Formatter', (['"""%(... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 16:49:59 2015
@author: yuki
"""
import matplotlib.pyplot as plt
import numpy as np
Deff1=np.load('D.npy')
Deff2=np.load('Deff.npy')
spars=1
if spars==1:
x = range(242,-1,-1)
y = range(243)
x, y = np.meshgrid(x, y)
fig=plt.figure(f... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.load",
"numpy.meshgrid",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.suptitle",
"numpy.diag_indices",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"matplotlib.pyplot... | [((142, 158), 'numpy.load', 'np.load', (['"""D.npy"""'], {}), "('D.npy')\n", (149, 158), True, 'import numpy as np\n'), ((165, 184), 'numpy.load', 'np.load', (['"""Deff.npy"""'], {}), "('Deff.npy')\n", (172, 184), True, 'import numpy as np\n'), ((277, 294), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'], {}), '(x, y)\n',... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00_data.ipynb (unless otherwise specified).
__all__ = ['DATA_PATH', 'acquire_data', 'rmtree', 'load_custom_data', 'load_data', 'pad_trajectories',
'normalize_trajectory', 'get_custom_dls', 'get_discriminative_dls', 'get_turning_point_dls', 'get_1vall_dls',
... | [
"pandas.DataFrame",
"zipfile.ZipFile",
"numpy.ceil",
"andi.andi_datasets",
"numpy.random.randn",
"csv.reader",
"numpy.zeros",
"urllib.request.urlopen",
"numpy.ones",
"numpy.cumsum",
"pathlib.Path",
"numpy.random.randint",
"numpy.arange",
"numpy.array",
"pandas.read_pickle",
"pandas.con... | [((696, 711), 'pathlib.Path', 'Path', (['"""../data"""'], {}), "('../data')\n", (700, 711), False, 'from pathlib import Path\n'), ((2414, 2436), 'urllib.request.urlopen', 'u_request.urlopen', (['url'], {}), '(url)\n', (2431, 2436), True, 'import urllib.request as u_request\n'), ((3487, 3507), 'pandas.read_pickle', 'pd.... |
import numpy as np
from collections import Counter
import string
import math
def process_data(args):
source_fname = '../data/raw/europarl-v7.es-en.en'
target_fname = '../data/raw/europarl-v7.es-en.es'
source_sentences = read_sentences_from_file(source_fname)
target_sentences = read_sentences_from_file... | [
"collections.Counter",
"numpy.array",
"math.ceil"
] | [((3147, 3189), 'numpy.array', 'np.array', (['[word for word, _ in vocabulary]'], {}), '([word for word, _ in vocabulary])\n', (3155, 3189), True, 'import numpy as np\n'), ((3825, 3849), 'math.ceil', 'math.ceil', (['((x + 1) / 5.0)'], {}), '((x + 1) / 5.0)\n', (3834, 3849), False, 'import math\n'), ((3082, 3100), 'coll... |
# -*- coding: utf-8 -*-
##
## @file voc_format_detection_dataset.py
## @brief Pascal VOC Format Detection Dataset Class
## @author Keitetsu
## @date 2020/05/22
## @copyright Copyright (c) 2020 Keitetsu
## @par License
## This software is released under the MIT License.
#... | [
"pandas.DataFrame",
"xml.etree.ElementTree.parse",
"numpy.stack",
"numpy.count_nonzero",
"os.path.join",
"numpy.empty",
"numpy.logical_not",
"cv2.imread",
"numpy.array",
"glob.glob",
"pandas.set_option"
] | [((3916, 4095), 'pandas.DataFrame', 'pd.DataFrame', (["{'class': self.classes, '# files': file_count, '# non-d files':\n non_difficult_file_count, '# objects': obj_count, '# non-d objects':\n non_difficult_obj_count}"], {}), "({'class': self.classes, '# files': file_count, '# non-d files':\n non_difficult_file... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 22 14:27:32 2017
@author: virati
Quick file to load in Data Frame
"""
import scipy
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn.linear_model import ElasticNet, ElasticNetCV
import pdb
def Phase_List(exprs='all',n... | [
"numpy.load",
"numpy.ceil",
"numpy.logical_and",
"scipy.io.loadmat",
"sklearn.linear_model.ElasticNet",
"numpy.hstack",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linspace"
] | [((1406, 1430), 'numpy.linspace', 'np.linspace', (['(0)', '(211)', '(512)'], {}), '(0, 211, 512)\n', (1417, 1430), True, 'import numpy as np\n'), ((3180, 3249), 'sklearn.linear_model.ElasticNet', 'ElasticNet', ([], {'alpha': 'EN_alpha', 'tol': '(0.001)', 'normalize': '(True)', 'positive': '(False)'}), '(alpha=EN_alpha,... |
#!/usr/bin/env python
# *****************************************************************************
# * cloudFPGA
# * Copyright 2016 -- 2022 IBM Corporation
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance... | [
"sys.path.append",
"video.create_capture",
"cv2.resize",
"multiprocessing.pool.ThreadPool",
"numpy.amin",
"cv2.medianBlur",
"cv2.cvtColor",
"multiprocessing.Manager",
"cv2.waitKey",
"common.clock",
"_trieres_warp_transform_numpi.warp_transform",
"common.StatValue",
"common.draw_str",
"nump... | [((1693, 1726), 'sys.path.append', 'sys.path.append', (['video_common_lib'], {}), '(video_common_lib)\n', (1708, 1726), False, 'import sys\n'), ((1909, 1934), 'multiprocessing.Manager', 'multiprocessing.Manager', ([], {}), '()\n', (1932, 1934), False, 'import multiprocessing\n'), ((2128, 2156), 'sys.path.append', 'sys.... |
#!/usr/bin/env python
# Copyright 2017 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"ffn.inference.inference_flags.request_from_flags",
"ffn.utils.bounding_box.BoundingBox",
"ffn.utils.bounding_box.OrderlyOverlappingCalculator",
"ffn.inference.inference.Runner",
"os.path.join",
"ffn.utils.bounding_box_pb2.BoundingBox",
"time.time",
"tensorflow.compat.v1.disable_eager_execution",
"a... | [((1324, 1362), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (1360, 1362), True, 'import tensorflow as tf\n'), ((1385, 1498), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""bounding_box"""', 'None', '"""BoundingBox proto in text format defining the ... |
import numpy as np
import h0rton.h0_inference.mcmc_utils as mcmc_utils
import unittest
class TestMCMCUtils(unittest.TestCase):
"""A suite of tests for the h0rton.h0_inference.mcmc_utils package
"""
@classmethod
def setUpClass(cls):
cls.init_dict = dict(
externa... | [
"unittest.main",
"h0rton.h0_inference.mcmc_utils.reorder_to_param_class",
"numpy.random.randn",
"numpy.testing.assert_array_equal",
"h0rton.h0_inference.mcmc_utils.split_component_param",
"h0rton.h0_inference.mcmc_utils.dict_to_array",
"numpy.all",
"h0rton.h0_inference.mcmc_utils.get_special_kwargs",
... | [((8100, 8115), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8113, 8115), False, 'import unittest\n'), ((1244, 1305), 'h0rton.h0_inference.mcmc_utils.get_lens_kwargs', 'mcmc_utils.get_lens_kwargs', (['self.init_dict'], {'null_spread': '(False)'}), '(self.init_dict, null_spread=False)\n', (1270, 1305), True, 'im... |
# coding: utf-8
# # Monetary Economics: Chapter 3
# From "Monetary Economics: An Integrated Approach to Credit, Money, Income, Production and Wealth, 2nd ed" by <NAME> and <NAME>, 2012.
# ## The Simplest Model with Government Money, Model SIM
# Assumptions
# * No private money, only Government money (no private ba... | [
"pysolve.model.Model",
"matplotlib.pyplot.axhline",
"pysolve.utils.generate_html_table",
"matplotlib.pyplot.legend",
"pysolve.utils.is_close",
"matplotlib.pyplot.text",
"pysolve.utils.round_solution",
"matplotlib.pyplot.figure",
"numpy.round",
"IPython.display.HTML"
] | [((3572, 3579), 'pysolve.model.Model', 'Model', ([], {}), '()\n', (3577, 3579), False, 'from pysolve.model import Model\n'), ((8519, 8566), 'pysolve.utils.round_solution', 'round_solution', (['model.solutions[-2]'], {'decimals': '(1)'}), '(model.solutions[-2], decimals=1)\n', (8533, 8566), False, 'from pysolve.utils im... |
"""
Methods and classes for writing data to disk.
- Methods:
- create_zarr_dataset: Creates and returns a Zarr hierarchy/dataset.
- create_zarr_obj_array: Creates and returns a Zarr object array.
- create_zarr_count_assay: Creates and returns a Zarr array with name 'counts'.
- subset_assay_zarr: Select... | [
"pandas.DataFrame",
"os.mkdir",
"tqdm.tqdm",
"h5py.File",
"zarr.open",
"h5py.special_dtype",
"os.path.isdir",
"dask.array.from_zarr",
"numpy.dtype",
"os.path.exists",
"numpy.ones",
"numpy.hstack",
"numpy.where",
"numpy.array",
"os.path.join",
"pandas.concat",
"numcodecs.Blosc"
] | [((2034, 2088), 'numcodecs.Blosc', 'Blosc', ([], {'cname': '"""lz4"""', 'clevel': '(5)', 'shuffle': 'Blosc.BITSHUFFLE'}), "(cname='lz4', clevel=5, shuffle=Blosc.BITSHUFFLE)\n", (2039, 2088), False, 'from numcodecs import Blosc\n'), ((2773, 2787), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (2781, 2787), True... |
import torch.nn as nn
import torch
import numpy as np
class GlobalLayerNorm(nn.Module):
'''
normalize over both the channel and the time dimensions
gLN(F) = (F-E[F])/(Var[F]+eps)**0.5 element-wise y+beta
E[F] = 1/(NT)*sum_NT(F)[add elements in F along N and T dimensions]
Var[F] = 1/(NT)*sum... | [
"torch.mean",
"torch.ones",
"torch.sqrt",
"torch.cumsum",
"numpy.arange",
"torch.rand",
"torch.zeros",
"torch.from_numpy"
] | [((3451, 3470), 'torch.rand', 'torch.rand', (['(2)', '(3)', '(3)'], {}), '(2, 3, 3)\n', (3461, 3470), False, 'import torch\n'), ((1367, 1402), 'torch.mean', 'torch.mean', (['x', '(1, 2)'], {'keepdim': '(True)'}), '(x, (1, 2), keepdim=True)\n', (1377, 1402), False, 'import torch\n'), ((1414, 1463), 'torch.mean', 'torch.... |
import numpy as np
print(np.arange(1,50,3))
| [
"numpy.arange"
] | [((26, 45), 'numpy.arange', 'np.arange', (['(1)', '(50)', '(3)'], {}), '(1, 50, 3)\n', (35, 45), True, 'import numpy as np\n')] |
# coding=utf-8
import numpy as np
class RidgeRegression:
def __init__(self, lambd):
# param stores w
self.param = np.array([])
self.lambd = lambd
def fit(self, X, y):
# least square
X_T_X = np.dot(X.T, X)
self.param = np.array(np.dot(np.dot(np.matrix(X_T_X + n... | [
"numpy.dot",
"numpy.array",
"numpy.eye"
] | [((136, 148), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (144, 148), True, 'import numpy as np\n'), ((242, 256), 'numpy.dot', 'np.dot', (['X.T', 'X'], {}), '(X.T, X)\n', (248, 256), True, 'import numpy as np\n'), ((414, 435), 'numpy.dot', 'np.dot', (['X', 'self.param'], {}), '(X, self.param)\n', (420, 435), Tru... |
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
class Dataset_from_matrix(Dataset):
"""Face Landmarks dataset."""
def __init__(self, data_matrix):
"""
Args: create a torch dataset from a tensor data_matrix with size n * p
[treatment, features, outcome]
... | [
"torch.is_tensor",
"numpy.reshape",
"torch.utils.data.DataLoader"
] | [((1459, 1518), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': 'shuffle'}), '(dataset, batch_size=batch_size, shuffle=shuffle)\n', (1469, 1518), False, 'from torch.utils.data import Dataset, DataLoader\n'), ((1639, 1698), 'torch.utils.data.DataLoader', 'DataLoader', (... |
# alternative 3-hour intervals at the end of script
import os
import pandas as pd ; import numpy as np
import datetime as dt
###########################################################################################################
### LOADING DATA & format manipulations
#############################################... | [
"numpy.average",
"numpy.log",
"pandas.read_csv",
"numpy.power",
"pandas.merge",
"numpy.zeros",
"pandas.to_datetime",
"numpy.array",
"os.chdir"
] | [((384, 445), 'os.chdir', 'os.chdir', (['"""/home/hubert/Downloads/Data Cleaned/proxys/proxys"""'], {}), "('/home/hubert/Downloads/Data Cleaned/proxys/proxys')\n", (392, 445), False, 'import os\n'), ((456, 491), 'pandas.read_csv', 'pd.read_csv', (['"""XRP_medmean"""'], {'sep': '""","""'}), "('XRP_medmean', sep=',')\n",... |
import numpy as np
import scipy.integrate as spi
import matplotlib.pyplot as plt
#total no. agents
n = 50
#fraction of cooperators initial
fc0 = 0.7
#amount of resource available initial
R0 = 100
# Maximum amount of resource
Rmax = 200
# Social parameters
mu = np.linspace(2,4,num=20) # degree of cheating
ec = 0.483/... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.solve_ivp",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((264, 289), 'numpy.linspace', 'np.linspace', (['(2)', '(4)'], {'num': '(20)'}), '(2, 4, num=20)\n', (275, 289), True, 'import numpy as np\n'), ((1338, 1368), 'numpy.linspace', 'np.linspace', (['(0)', '(1000)'], {'num': '(1000)'}), '(0, 1000, num=1000)\n', (1349, 1368), True, 'import numpy as np\n'), ((1707, 1723), 'm... |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import Int16
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
import os
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_vari... | [
"rospy.Subscriber",
"numpy.argmax",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"tensorflow.InteractiveSession",
"tensorflow.truncated_normal",
"cv2.cvtColor",
"os.path.dirname",
"tensorflow.placeholder",
"rospy.init_node",
"numpy.reshape",
"cv... | [((237, 275), 'tensorflow.truncated_normal', 'tf.truncated_normal', (['shape'], {'stddev': '(0.1)'}), '(shape, stddev=0.1)\n', (256, 275), True, 'import tensorflow as tf\n'), ((285, 305), 'tensorflow.Variable', 'tf.Variable', (['initial'], {}), '(initial)\n', (296, 305), True, 'import tensorflow as tf\n'), ((345, 374),... |
import numpy as np
n_loops = {
'A': 2, 'B': 3, 'C': 1, 'D': 2, 'E': 1, 'F': 1, 'G': 1, 'H': 1, 'I': 1, 'J': 1, 'K': 1, 'L': 1, 'M': 1, 'N': 1,
'O': 2, 'P': 2, 'Q': 2, 'R': 2, 'S': 1, 'T': 1, 'U': 1, 'V': 1, 'W': 1, 'X': 1, 'Y': 1, 'Z': 1
}
topology = [15, 4, 4]
simple_templates = [
[0.4*x + 0.5 for y in ... | [
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((320, 349), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(30)'], {}), '(0, 2 * np.pi, 30)\n', (331, 349), True, 'import numpy as np\n'), ((807, 835), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(8)'], {}), '(0, 2 * np.pi, 8)\n', (818, 835), True, 'import numpy as np\n'), ((358, 367), 'numpy... |
import sys
sys.path.append('../')
import unittest
import pydgm
import numpy as np
class TestSOURCES(unittest.TestCase):
def setUp(self):
# Set the variables for the test
pydgm.control.spatial_dimension = 1
pydgm.control.fine_mesh_x = [1]
pydgm.control.coarse_mesh_x = [0.0, 1.0]
... | [
"sys.path.append",
"unittest.main",
"pydgm.sources.compute_source",
"pydgm.control.finalize_control",
"pydgm.dgmsolver.initialize_dgmsolver",
"pydgm.solver.initialize_solver",
"pydgm.solver.finalize_solver",
"pydgm.state.sigphi.flatten",
"pydgm.dgmsolver.slice_xs_moments",
"pydgm.dgmsolver.compute... | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((5193, 5208), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5206, 5208), False, 'import unittest\n'), ((1116, 1148), 'pydgm.solver.initialize_solver', 'pydgm.solver.initialize_solver', ([], {}),... |
import json
import json
import logging
import math
import os
from collections import Counter
from itertools import product, chain
import jinja2
import networkx as nx
import numpy as np
import pandas as pd
from bokeh.colors import RGB
from bokeh.io import reset_output
from bokeh.models import ColumnDataSource, ColorBar... | [
"pysrc.papers.plot.plotter.Plotter",
"pysrc.app.predefined.query_to_folder",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"pysrc.papers.analysis.graph.to_weighted_graph",
"json.dumps",
"bokeh.plotting.output_file",
"pysrc.papers.analysis.text.tokens_embeddings",
"pysrc.papers.analysis.node2v... | [((1647, 1674), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1664, 1674), False, 'import logging\n'), ((1779, 1828), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.pubtrends/search_results"""'], {}), "('~/.pubtrends/search_results')\n", (1797, 1828), False, 'import os\n'), ((1804... |
"""
Python 3.6
append_coord_bounds.py
Calculate & append lat, lon, & time bounds variables to CESM timeseries output files.
Usage
------
python append_coord_bounds.py file.nc
<NAME>
3 April 2020
"""
from __future__ import print_function
import sys
import numpy as np
import logging
from netCDF4 import Dataset
from os... | [
"netCDF4.Dataset",
"os.remove",
"logging.FileHandler",
"numpy.asarray",
"logging.StreamHandler",
"numpy.zeros",
"logging.Formatter",
"os.path.isfile",
"os.path.join",
"os.listdir",
"logging.getLogger"
] | [((1018, 1043), 'numpy.zeros', 'np.zeros', (['(num_coords, 2)'], {}), '((num_coords, 2))\n', (1026, 1043), True, 'import numpy as np\n'), ((1875, 1898), 'netCDF4.Dataset', 'Dataset', (['filename', '"""r+"""'], {}), "(filename, 'r+')\n", (1882, 1898), False, 'from netCDF4 import Dataset\n'), ((4394, 4414), 'numpy.asarra... |
import ga
import numpy
"""
The y=target is to maximize this equation ASAP:
y = w1x1+w2x2+w3x3*w4x4+w5x5
where (x1,x2,x3,x4,x5,x6)=(-4,-12,-3,2,8)
What are the best values for the 6 weights w1 to w6?
We are going to use the genetic algorithm for the
best possible values after a number of g... | [
"numpy.random.uniform",
"ga.crossover",
"numpy.sum",
"ga.cal_pop_fitness",
"ga.mutation",
"numpy.max",
"ga.select_mating_pool"
] | [((563, 618), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(-4.0)', 'high': '(4.0)', 'size': 'pop_size'}), '(low=-4.0, high=4.0, size=pop_size)\n', (583, 618), False, 'import numpy\n'), ((1746, 1797), 'ga.cal_pop_fitness', 'ga.cal_pop_fitness', (['equation_inputs', 'new_population'], {}), '(equation_in... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Utility functions for generating plots for use within templates
"""
import datetime
import plotly
import plotly.graph_objs as go
import plotly.figure_factory as ff
import numpy as np
import pandas as pd
COLORS = ['rgba(93, 164, 214, 0.65)',
... | [
"plotly.graph_objs.Layout",
"plotly.offline.plot",
"datetime.datetime.utcfromtimestamp",
"numpy.histogram",
"pandas.Categorical",
"plotly.figure_factory.create_distplot",
"plotly.graph_objs.Figure"
] | [((531, 568), 'datetime.datetime.utcfromtimestamp', 'datetime.datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (565, 568), False, 'import datetime\n'), ((1111, 1142), 'numpy.histogram', 'np.histogram', (['data'], {'bins': '"""auto"""'}), "(data, bins='auto')\n", (1123, 1142), True, 'import numpy as np\n'), ((1180, 1... |
from contextlib import contextmanager
from dataclasses import dataclass, astuple
from typing import Any, Dict, Generator, List, Optional, Tuple
import numpy as np
import torch
from numpy import int32, float32
from numpy.random import RandomState
from .fnv1a import fnv1a
from .network import Network
from .typing impo... | [
"numpy.sum",
"numpy.ones",
"numpy.random.RandomState",
"numpy.mean",
"numpy.exp",
"numpy.logaddexp.reduce",
"torch.no_grad",
"dataclasses.astuple"
] | [((11638, 11665), 'numpy.logaddexp.reduce', 'np.logaddexp.reduce', (['log_pi'], {}), '(log_pi)\n', (11657, 11665), True, 'import numpy as np\n'), ((11675, 11697), 'numpy.exp', 'np.exp', (['(log_pi - log_z)'], {}), '(log_pi - log_z)\n', (11681, 11697), True, 'import numpy as np\n'), ((3466, 3494), 'numpy.sum', 'np.sum',... |
import os
import sys
import glob
import logging
import datetime
import parse
import shutil
import copy
import numpy as np
import pandas as pd
import warnings
import pickle
from scipy.interpolate import interp1d
logger = logging.getLogger('ceciestunepipe.util.syncutil')
def square_to_edges(x: np.array) -> np.array:
... | [
"numpy.ptp",
"logging.getLogger",
"numpy.argsort",
"numpy.min",
"numpy.diff",
"numpy.where",
"numpy.arange",
"numpy.squeeze",
"scipy.interpolate.interp1d",
"numpy.concatenate"
] | [((222, 271), 'logging.getLogger', 'logging.getLogger', (['"""ceciestunepipe.util.syncutil"""'], {}), "('ceciestunepipe.util.syncutil')\n", (239, 271), False, 'import logging\n'), ((342, 355), 'numpy.squeeze', 'np.squeeze', (['x'], {}), '(x)\n', (352, 355), True, 'import numpy as np\n'), ((375, 385), 'numpy.diff', 'np.... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"syntaxnet.dictionary_pb2.TokenEmbedding",
"syntaxnet.ops.gen_parser_ops.gold_parse_reader",
"tensorflow.python_io.TFRecordWriter",
"tensorflow.python.platform.tf_logging.info",
"syntaxnet.sparse_pb2.SparseFeatures",
"tensorflow.less",
"tensorflow.TensorShape",
"tensorflow.constant",
"tensorflow.pyt... | [((1228, 1250), 'tensorflow.test.get_temp_dir', 'tf.test.get_temp_dir', ([], {}), '()\n', (1248, 1250), True, 'import tensorflow as tf\n'), ((9028, 9045), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (9043, 9045), False, 'from tensorflow.python.platform import googletest\n'), ((477... |
import tensorflow as tf
import numpy as np
from .env import Environment
from .registry import register_env, get_reward_augmentation
@register_env
class CoinRun(Environment):
def __init__(self, hparams):
# only support 1 environment currently
super().__init__(hparams)
try:
from coinrun import setu... | [
"numpy.asarray",
"numpy.expand_dims",
"coinrun.make",
"numpy.squeeze",
"coinrun.setup_utils.setup_and_load"
] | [((1248, 1266), 'numpy.asarray', 'np.asarray', (['action'], {}), '(action)\n', (1258, 1266), True, 'import numpy as np\n'), ((1486, 1504), 'numpy.squeeze', 'np.squeeze', (['reward'], {}), '(reward)\n', (1496, 1504), True, 'import numpy as np\n'), ((1516, 1532), 'numpy.squeeze', 'np.squeeze', (['done'], {}), '(done)\n',... |
import copy
import ipdb
import math
import os
import torch
import numpy as np
import time
from torch.nn import functional as F
from torch.autograd import Variable
from tqdm import tqdm, trange
from model import Transformer, FastTransformer, INF, TINY, softmax
from data import NormalField, NormalTranslationDataset, Tr... | [
"utils.computeBLEUMSCOCO",
"utils.print_bleu",
"tqdm.tqdm",
"utils.jaccard_converged",
"math.sqrt",
"numpy.argmax",
"torch.autograd.Variable",
"utils.remove_repeats",
"utils.equality_converged",
"time.time",
"utils.computeBLEU",
"utils.remove_repeats_tensor",
"numpy.mean",
"torch.max",
"... | [((6127, 6165), 'tqdm.tqdm', 'tqdm', ([], {'total': '(200)', 'desc': '"""start decoding"""'}), "(total=200, desc='start decoding')\n", (6131, 6165), False, 'from tqdm import tqdm, trange\n'), ((6927, 6938), 'time.time', 'time.time', ([], {}), '()\n', (6936, 6938), False, 'import time\n'), ((14016, 14087), 'utils.comput... |
"""
Copyright (R) @huawei.com, all rights reserved
-*- coding:utf-8 -*-
"""
import sys
import os
path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path, ".."))
sys.path.append(os.path.join(path, "../../../../common/"))
sys.path.append(os.path.join(path, "../../../../common/acllite"))
impor... | [
"os.listdir",
"os.path.abspath",
"acllite_model.AclLiteModel",
"os.path.basename",
"cv2.imwrite",
"os.path.realpath",
"numpy.ascontiguousarray",
"cv2.imread",
"os.path.splitext",
"acllite_imageproc.AclLiteImageProc",
"cv2.merge",
"os.path.join",
"acllite_resource.AclLiteResource",
"cv2.res... | [((693, 745), 'os.path.join', 'os.path.join', (['SRC_PATH', '"""../model/deeplabv3_plus.om"""'], {}), "(SRC_PATH, '../model/deeplabv3_plus.om')\n", (705, 745), False, 'import os\n'), ((120, 145), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (135, 145), False, 'import os\n'), ((163, 187), 'o... |
import os
import time
import numpy as np
import torch.distributed as dist
import helper_torch
import networkarch_torch as net
from mpi4py import MPI
import torch.multiprocessing as processing
from Dependency.Aggregation import *
from GlobalParameters import *
from matplotlib import cm
import matplotlib.pyplot as plt
... | [
"numpy.arange",
"torch.multiprocessing.Pipe",
"random.randint",
"matplotlib.pyplot.cla",
"numpy.linspace",
"matplotlib.pyplot.pause",
"copy.deepcopy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"matplotlib.cm.jet",
"time.perf_counter",
"time.sleep",
"matplotlib.pyplot.ion",
"mat... | [((5875, 5890), 'random.randint', 'r.randint', (['(1)', '(2)'], {}), '(1, 2)\n', (5884, 5890), True, 'import random as r\n'), ((6167, 6182), 'random.randint', 'r.randint', (['(1)', '(2)'], {}), '(1, 2)\n', (6176, 6182), True, 'import random as r\n'), ((6456, 6489), 'helper_torch.set_defaults', 'helper_torch.set_default... |
import tensorflow as tf
import numpy as np
import scipy as sc
import xarray as xr
import ecubevis as ecv
from . import POSTUPSAMPLING_METHODS
from .utils import crop_array, resize_array, checkarray_ndim
def create_pair_hr_lr(
array,
array_lr,
upsampling,
scale,
patch_size,
static_vars=None... | [
"numpy.moveaxis",
"scipy.stats.mode",
"numpy.asarray",
"numpy.asanyarray",
"numpy.zeros",
"numpy.arange",
"numpy.rollaxis",
"numpy.squeeze",
"numpy.concatenate"
] | [((10472, 10503), 'numpy.asarray', 'np.asarray', (['hr_array', '"""float32"""'], {}), "(hr_array, 'float32')\n", (10482, 10503), True, 'import numpy as np\n'), ((10519, 10550), 'numpy.asarray', 'np.asarray', (['lr_array', '"""float32"""'], {}), "(lr_array, 'float32')\n", (10529, 10550), True, 'import numpy as np\n'), (... |
import pytest
from numpy import array
from numpy import all
from numpy import isnan
from directional_clustering.plotters import mesh_to_vertices_xyz
from directional_clustering.plotters import trimesh_face_connect
from directional_clustering.plotters import lines_to_start_end_xyz
from directional_clustering.plotters ... | [
"directional_clustering.plotters.coord_start_end_none",
"directional_clustering.plotters.trimesh_face_connect",
"directional_clustering.plotters.face_centroids",
"numpy.isnan",
"directional_clustering.plotters.vectors_dict_to_array",
"pytest.raises",
"directional_clustering.plotters.mesh_to_vertices_xyz... | [((742, 776), 'directional_clustering.plotters.mesh_to_vertices_xyz', 'mesh_to_vertices_xyz', (['trimesh_attr'], {}), '(trimesh_attr)\n', (762, 776), False, 'from directional_clustering.plotters import mesh_to_vertices_xyz\n'), ((879, 932), 'numpy.all', 'all', (['[[x == check_x], [y == check_y], [z == check_z]]'], {}),... |
# implemenation of the compute methods for category
import numpy as np
import random
import time
import os.path
from os import path
import matplotlib.pyplot as plt
import scipy.interpolate
from nodeeditor.say import *
import nodeeditor.store as store
import nodeeditor.pfwrap as pfwrap
print ("reloaded: "+ __file__... | [
"random.random",
"numpy.array"
] | [((1211, 1227), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1219, 1227), True, 'import numpy as np\n'), ((1560, 1576), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1568, 1576), True, 'import numpy as np\n'), ((933, 948), 'random.random', 'random.random', ([], {}), '()\n', (946, 948), Fals... |
import tqdm
import torch
import numpy as np
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.nn.utils import clip_grad_norm_
from .delayed import DelayedKeyboardInterrupt
from .utils import state_dict_to_cpu, TermsHistory
def fit_one_epoch(model, objective, feed, optim, grad_clip=0., callback=None)... | [
"numpy.mean",
"numpy.isnan"
] | [((2388, 2408), 'numpy.isnan', 'np.isnan', (['losses[-1]'], {}), '(losses[-1])\n', (2396, 2408), True, 'import numpy as np\n'), ((5486, 5505), 'numpy.mean', 'np.mean', (['epoch_loss'], {}), '(epoch_loss)\n', (5493, 5505), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 23 11:12:25 2020
@author: <NAME>
"""
from kymatio.torch import Scattering2D
import imageio
import numpy as np
import glob
import os
import torch
import tqdm
os.environ["IMAGEIO_FFMPEG_EXE"] = "/usr/bin/ffmpeg"
global NBINS
NBINS = 20
def readvi... | [
"numpy.abs",
"kymatio.torch.Scattering2D",
"numpy.asarray",
"numpy.float32",
"numpy.zeros",
"numpy.expand_dims",
"numpy.histogram",
"numpy.arange",
"imageio.get_reader",
"glob.glob",
"numpy.concatenate"
] | [((1062, 1100), 'imageio.get_reader', 'imageio.get_reader', (['filename', '"""ffmpeg"""'], {}), "(filename, 'ffmpeg')\n", (1080, 1100), False, 'import imageio\n'), ((2354, 2412), 'numpy.zeros', 'np.zeros', (['(imgs.shape[0], imgs.shape[1], nchannels, NBINS)'], {}), '((imgs.shape[0], imgs.shape[1], nchannels, NBINS))\n'... |
import argparse
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import PIL.Image as Image
from matplotlib import pyplot as plt
from skimage.feature import peak_local_max
from skimage.morphology import watershed
from scipy import ndimage
from skimage.measure impor... | [
"matplotlib.pyplot.title",
"skimage.feature.peak_local_max",
"matplotlib.pyplot.clf",
"numpy.ones",
"numpy.around",
"cv2.ellipse",
"cv2.erode",
"skimage.measure.regionprops",
"pandas.DataFrame",
"cv2.contourArea",
"cv2.dilate",
"cv2.fitEllipse",
"cv2.convertScaleAbs",
"cv2.drawContours",
... | [((516, 540), 'cv2.imread', 'cv2.imread', (['ImageName', '(0)'], {}), '(ImageName, 0)\n', (526, 540), False, 'import cv2\n'), ((552, 581), 'numpy.array', 'np.array', (['img'], {'dtype': 'np.uint8'}), '(img, dtype=np.uint8)\n', (560, 581), True, 'import numpy as np\n'), ((594, 642), 'cv2.convertScaleAbs', 'cv2.convertSc... |
import collections
import numpy as np
from nengo_loihi.block import Config
MAX_COMPARTMENT_CFGS = 32
MAX_VTH_CFGS = 8
MAX_SYNAPSE_CFGS = 8
class Board:
"""An entire Loihi Board, with multiple Chips"""
def __init__(self, board_id=1):
self.board_id = board_id
self.chips = []
self.ch... | [
"collections.OrderedDict",
"numpy.dtype",
"numpy.arange",
"numpy.array"
] | [((7909, 8090), 'numpy.dtype', 'np.dtype', (["[('t', np.int32), ('axon_type', np.int32), ('chip_id', np.int32), (\n 'core_id', np.int32), ('axon_id', np.int32), ('atom', np.int32), (\n 'atom_bits_extra', np.int32)]"], {}), "([('t', np.int32), ('axon_type', np.int32), ('chip_id', np.int32),\n ('core_id', np.int... |
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distribute... | [
"mathutils.Quaternion",
"numpy.ones",
"numpy.sin",
"numpy.linalg.norm",
"gpu.shader.from_builtin",
"bgl.glEnable",
"bmesh.update_edit_mesh",
"bpy.context.window_manager.popup_menu",
"math.cos",
"numpy.cross",
"math.sin",
"numpy.hstack",
"bmesh.from_edit_mesh",
"numpy.cos",
"numpy.vstack"... | [((7080, 7097), 'mathutils.Vector', 'Vector', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (7086, 7097), False, 'from mathutils import Vector, Quaternion\n'), ((7873, 7890), 'mathutils.Vector', 'Vector', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (7879, 7890), False, 'from mathutils import Vector, Quaternion\n'), ((8722, 8739), 'm... |
import numpy as np
import pandas as pd
class RidgeRegression:
def __init__(self, num_feature):
"""num_feature shows the number of features, weights are corresponding weight to each feature"""
self.num_feature = num_feature
self.weights = np.random.randn(num_feature, 1)
self.bias = ... | [
"pandas.DataFrame",
"numpy.random.randn",
"pandas.read_csv",
"pandas.get_dummies",
"numpy.arange",
"numpy.array",
"pandas.concat",
"numpy.random.shuffle",
"numpy.log1p"
] | [((4264, 4285), 'numpy.arange', 'np.arange', (['(1461)', '(2920)'], {}), '(1461, 2920)\n', (4273, 4285), True, 'import numpy as np\n'), ((4291, 4337), 'pandas.DataFrame', 'pd.DataFrame', (["{'Id': ids, 'SalePrice': result}"], {}), "({'Id': ids, 'SalePrice': result})\n", (4303, 4337), True, 'import pandas as pd\n'), ((1... |
import numpy as np
import pytest
from src.fast_scboot.c.sample_index_helper import count_clusts, make_index_matrix
# def test_make_index_matrix():
# strat_array = np.asarray([0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])
# clust_array = np.asarray([0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 6])
# clust_val = np.asarray([0, 1, 1,... | [
"numpy.asarray",
"numpy.arange",
"numpy.isclose"
] | [((1684, 1702), 'numpy.asarray', 'np.asarray', (['[2, 2]'], {}), '([2, 2])\n', (1694, 1702), True, 'import numpy as np\n'), ((1965, 1983), 'numpy.asarray', 'np.asarray', (['[2, 3]'], {}), '([2, 3])\n', (1975, 1983), True, 'import numpy as np\n'), ((2246, 2267), 'numpy.asarray', 'np.asarray', (['[2, 2, 1]'], {}), '([2, ... |
"""
Machine Learning and Statistic Project 2020
server.py
Student: <NAME>
Student ID: G00376332
------------------------------------------------------------------------
This server.py is the part of MLS Project.
Program is designed to work with folowing model files:
- neuron.h5
- neuron.json
- poly.sav
"""
fr... | [
"flask.Flask",
"tensorflow.keras.backend.set_session",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.array",
"tensorflow.Graph",
"joblib.load",
"numpy.round",
"logging.getLogger",
"tensorflow.keras.models.model_from_json"
] | [((1449, 1478), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': '(10)'}), '(degree=10)\n', (1467, 1478), False, 'from sklearn.preprocessing import PolynomialFeatures\n'), ((1508, 1529), 'joblib.load', 'joblib.load', (['filename'], {}), '(filename)\n', (1519, 1529), False, 'import jobli... |
"""
=====================================
Custom tick formatter for time series
=====================================
When plotting time series, e.g., financial time series, one often wants
to leave out days on which there is no data, i.e. weekends. The example
below shows how to use an 'index formatter' to achieve t... | [
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.cbook.get_sample_data",
"matplotlib.ticker.FuncFormatter",
"numpy.arange",
"matplotlib.pyplot.subplots"
] | [((1041, 1078), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(2)', 'figsize': '(8, 4)'}), '(ncols=2, figsize=(8, 4))\n', (1053, 1078), True, 'import matplotlib.pyplot as plt\n'), ((1225, 1237), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (1234, 1237), True, 'import numpy as np\n'), ((1565, 1575)... |
import sys,os
sys.path.append(os.getcwd())
from src.QDT import QdtClassifier
from src.utility_factors import valueFunction1, weightingFunction, logitFunc, CPT_logit
from src.attraction_factors import dummy_attraction, ambiguity_aversion,QDT_attraction
import numpy as np
class QdtPredicter():
"""One qdt classifier ... | [
"os.getcwd",
"numpy.array"
] | [((30, 41), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (39, 41), False, 'import sys, os\n'), ((1258, 1271), 'numpy.array', 'np.array', (['ret'], {}), '(ret)\n', (1266, 1271), True, 'import numpy as np\n')] |
import os
import pandas as pd
import numpy as np
import random
from leo_segmentation.utils import meta_classes_selector, print_to_string_io, \
train_logger, val_logger, numpy_to_tensor, load_config
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils, datasets
from PIL import I... | [
"pandas.DataFrame",
"leo_segmentation.utils.meta_classes_selector",
"leo_segmentation.utils.print_to_string_io",
"random.shuffle",
"os.path.dirname",
"numpy.transpose",
"os.path.exists",
"PIL.Image.open",
"collections.defaultdict",
"numpy.array",
"leo_segmentation.utils.load_config",
"leo_segm... | [((372, 385), 'leo_segmentation.utils.load_config', 'load_config', ([], {}), '()\n', (383, 385), False, 'from leo_segmentation.utils import meta_classes_selector, print_to_string_io, train_logger, val_logger, numpy_to_tensor, load_config\n'), ((521, 552), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""train"""'], {}... |
"""
Linear model for evaluating model biases, differences, and other thresholds
using explainable AI for historical data
Author : <NAME>
Date : 18 May 2021
Version : 1 - adds extra class (#8), but tries the MMean
"""
### Import packages
import matplotlib.pyplot as plt
import numpy as np
import sys
from ... | [
"numpy.load",
"numpy.meshgrid",
"mpl_toolkits.basemap.shiftgrid",
"mpl_toolkits.basemap.addcyclic",
"numpy.genfromtxt",
"numpy.append",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.subplots_adjust",
"sys.exit",
"matplotlib.pyplot.tight_layout",
"mpl_... | [((618, 645), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (624, 645), True, 'import matplotlib.pyplot as plt\n'), ((645, 718), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Avant Garde']})\n", (651, 7... |
import os
import sys
import signal
import pickle
import subprocess
import hashlib
import numpy as np
import matplotlib.pyplot as plt
import argparse
import logging
logging.basicConfig(format="%(message)s", level=os.getenv("LOG_LEVEL", logging.INFO))
from .. import load_ifo
from ..gwinc import gwinc
from ..gwinc_matl... | [
"pickle.dump",
"inspiral_range.int73",
"argparse.ArgumentParser",
"matplotlib.pyplot.subplot2grid",
"pickle.load",
"os.chdir",
"inspiral_range.waveform.CBCWaveform",
"logging.warning",
"os.path.dirname",
"os.path.exists",
"numpy.log10",
"matplotlib.pyplot.show",
"os.path.basename",
"subpro... | [((615, 639), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (633, 639), False, 'import os\n'), ((647, 666), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (660, 666), False, 'import os\n'), ((790, 801), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (799, 801), False, 'import os\n'... |
import io
import numpy as np
import torch
import matplotlib.pyplot as plt
from PIL import Image
from dp.exact_dp import drop_dtw
from models.losses import compute_all_costs
color_code = ['blue', 'orange', 'green', 'red', 'purple', 'brown', 'pink', 'grey', 'olive', 'cyan', 'lime']
shape_code = ["o", "s", "P", "*", "h"... | [
"io.BytesIO",
"numpy.zeros_like",
"torch.zeros_like",
"models.losses.compute_all_costs",
"matplotlib.pyplot.close",
"numpy.ones",
"PIL.Image.open",
"numpy.sort",
"dp.exact_dp.drop_dtw",
"numpy.arange",
"numpy.array",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.grid",
"matplotlib.py... | [((2938, 2950), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (2948, 2950), False, 'import io\n'), ((2955, 2985), 'matplotlib.pyplot.savefig', 'plt.savefig', (['buf'], {'format': '"""png"""'}), "(buf, format='png')\n", (2966, 2985), True, 'import matplotlib.pyplot as plt\n'), ((2990, 3001), 'matplotlib.pyplot.close', '... |
"""This runs unit tests for functions that can be found in GeneticSearch.py."""
import pytest
import numpy as np
from see import Segmentors
from see import GeneticSearch
from see import base_classes
def test_twoPointCopy():
"""Unit test for twoPointCopy function. Checks test individuals to see
if copy took pl... | [
"see.GeneticSearch.twoPointCopy",
"see.GeneticSearch.makeToolbox",
"see.Segmentors.parameters",
"numpy.zeros",
"see.GeneticSearch.mutate",
"see.GeneticSearch.Evolver",
"see.GeneticSearch.skimageCrossRandom",
"see.base_classes.pipedata"
] | [((624, 666), 'see.GeneticSearch.twoPointCopy', 'GeneticSearch.twoPointCopy', (['np1', 'np2', '(True)'], {}), '(np1, np2, True)\n', (650, 666), False, 'from see import GeneticSearch\n'), ((1393, 1435), 'see.GeneticSearch.skimageCrossRandom', 'GeneticSearch.skimageCrossRandom', (['np1', 'np2'], {}), '(np1, np2)\n', (142... |
import os
import numpy as np
import matplotlib.pyplot as plt
import xml.etree.ElementTree as ET
import pandas as pd
import argparse
from tqdm import trange, tqdm
def make_image_file(coord_groups, output_path: str, line_width, dpi):
plt.gca().set_aspect('equal', adjustable='box')
plt.gca().invert_yaxis()
p... | [
"pandas.DataFrame",
"matplotlib.pyplot.NullLocator",
"os.mkdir",
"xml.etree.ElementTree.parse",
"numpy.stack",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.path.basename",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.subplots_adjust",
"... | [((348, 421), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'top': '(1)', 'bottom': '(0)', 'right': '(1)', 'left': '(0)', 'hspace': '(0)', 'wspace': '(0)'}), '(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0)\n', (367, 421), True, 'import matplotlib.pyplot as plt\n'), ((824, 835), 'matplotlib.p... |
"""
Source: https://github.com/arnaudvl/differentiable-neural-computer
"""
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Concatenate, Dense, LSTM
from typing import Union
class DNC(tf.keras.Model):
def __init__(
self,
output_dim: int,
memory_shape: tuple = ... | [
"tensorflow.reduce_sum",
"tensorflow.keras.layers.Dense",
"tensorflow.reshape",
"tensorflow.nn.l2_normalize",
"tensorflow.matmul",
"tensorflow.dynamic_partition",
"tensorflow.reduce_prod",
"tensorflow.nn.softmax",
"tensorflow.keras.layers.Concatenate",
"numpy.identity",
"tensorflow.stack",
"te... | [((1638, 1698), 'tensorflow.random.truncated_normal', 'tf.random.truncated_normal', (['[1, self.output_dim]'], {'stddev': '(0.1)'}), '([1, self.output_dim], stddev=0.1)\n', (1664, 1698), True, 'import tensorflow as tf\n'), ((1755, 1818), 'tensorflow.random.truncated_normal', 'tf.random.truncated_normal', (['[1, self.in... |
import numpy as np
import matplotlib.pyplot as plt
from recipes.logging import LoggingMixin
from scrawl.imagine import _sanitize_data
from scrawl.utils import percentile
def get_bins(data, bins, range=None):
# superset of the automated binning from astropy / numpy
if isinstance(bins, str) and bins in ('block... | [
"scrawl.imagine._sanitize_data",
"numpy.full",
"scipy.stats.mode",
"numpy.histogram_bin_edges",
"numpy.percentile",
"astropy.stats.calculate_bin_edges",
"numpy.histogram",
"numpy.diff",
"numpy.array",
"scrawl.utils.percentile",
"matplotlib.transforms.blended_transform_factory",
"matplotlib.pyp... | [((415, 453), 'astropy.stats.calculate_bin_edges', 'calculate_bin_edges', (['data', 'bins', 'range'], {}), '(data, bins, range)\n', (434, 453), False, 'from astropy.stats import calculate_bin_edges\n'), ((479, 520), 'numpy.histogram_bin_edges', 'np.histogram_bin_edges', (['data', 'bins', 'range'], {}), '(data, bins, ra... |
import numpy as np
class SudokuIO:
def __init__(self, puzzle_file, board_size = 9):
self.puzzle_file = puzzle_file
self.board_size = board_size
self.puzzles = self.read_sudoku(puzzle_file)
def write_dimacs(self, puzzle=None):
if puzzle is None:
puzzle = self.puzzles[... | [
"numpy.zeros"
] | [((817, 867), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.board_size, self.board_size)'}), '(shape=(self.board_size, self.board_size))\n', (825, 867), True, 'import numpy as np\n')] |
"""Simple example operations that are used to demonstrate some image processing in Xi-CAM.
"""
import numpy as np
from xicam.plugins.operationplugin import (limits, describe_input, describe_output,
operation, opts, output_names, visible)
# Define an operation that inverts t... | [
"xicam.plugins.operationplugin.describe_input",
"xicam.plugins.operationplugin.describe_output",
"numpy.subtract",
"xicam.plugins.operationplugin.limits",
"xicam.plugins.operationplugin.opts",
"numpy.iinfo",
"xicam.plugins.operationplugin.output_names",
"numpy.finfo",
"numpy.random.rand",
"xicam.p... | [((417, 445), 'xicam.plugins.operationplugin.output_names', 'output_names', (['"""output_image"""'], {}), "('output_image')\n", (429, 445), False, 'from xicam.plugins.operationplugin import limits, describe_input, describe_output, operation, opts, output_names, visible\n'), ((498, 544), 'xicam.plugins.operationplugin.d... |
#!/usr/bin/env python
"""
plot.py
"""
import sys
import os
# Numeric
import numpy as np
# Gaussian filtering for KDE
from scipy.ndimage import gaussian_filter
# DataFrames
import pandas as pd
# Plotting
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib
# Scalebars
try:
from matplotlib_s... | [
"matplotlib.pyplot.tight_layout",
"numpy.abs",
"numpy.logical_and",
"numpy.argmax",
"matplotlib.pyplot.close",
"scipy.ndimage.gaussian_filter",
"numpy.asarray",
"numpy.zeros",
"numpy.histogram2d",
"pandas.isnull",
"numpy.percentile",
"numpy.cumsum",
"numpy.arange",
"numpy.array",
"seabor... | [((907, 925), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (923, 925), True, 'import matplotlib.pyplot as plt\n'), ((930, 959), 'matplotlib.pyplot.savefig', 'plt.savefig', (['out_png'], {'dpi': 'dpi'}), '(out_png, dpi=dpi)\n', (941, 959), True, 'import matplotlib.pyplot as plt\n'), ((964, 975... |
import numpy as np
import matplotlib.pyplot as plt
# - - - - most frequently changed output parameters - - -
# 0:a , 1:b , 2:beta , 3:k , 4:m , 5:l , 6:N , 7:p_0 , 8:q , 9:Adv_strategy
# 10:rateRandomness , 11:deltaWS , 12:gammaWS , 13:maxTermRound, 14:sZipf, 15:Type , 16:X , 17:Y
xcol = 3
xlabel = "k"
# xlim = [.0, 3... | [
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"numpy.savez",
... | [((600, 612), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (610, 612), True, 'import matplotlib.pyplot as plt\n'), ((877, 896), 'matplotlib.pyplot.ylim', 'plt.ylim', (['[0, 1.05]'], {}), '([0, 1.05])\n', (885, 896), True, 'import matplotlib.pyplot as plt\n'), ((901, 919), 'matplotlib.pyplot.xscale', 'plt... |
__doc__ = \
"""
======================================================================
Multi-modal shale CT imaging analysis (:mod:`mango.application.shale`)
======================================================================
.. currentmodule:: mango.application.shale
Analysis of shale dry, dry-after, Iodine-stain... | [
"matplotlib.pyplot.title",
"mango.mpi.getLoggers",
"scipy.sum",
"scipy.ones",
"scipy.logical_and",
"scipy.log",
"numpy.min",
"numpy.max",
"scipy.array",
"matplotlib.pyplot.cm.get_cmap"
] | [((868, 892), 'mango.mpi.getLoggers', 'mpi.getLoggers', (['__name__'], {}), '(__name__)\n', (882, 892), True, 'import mango.mpi as mpi\n'), ((4434, 4469), 'scipy.array', 'sp.array', (['ternList'], {'dtype': '"""float64"""'}), "(ternList, dtype='float64')\n", (4442, 4469), True, 'import scipy as sp\n'), ((4702, 4737), '... |
import os
import sys
sys.path.append("..")
import argparse
from pathlib import Path
# Import teaching utils
import pandas as pd
import numpy as np
from utils.neuralnetwork import NeuralNetwork
# Import sklearn metrics
from sklearn import metrics
from sklearn.datasets import fetch_openml
from sklearn.model_selection i... | [
"sys.path.append",
"os.mkdir",
"sklearn.preprocessing.LabelBinarizer",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"os.path.isdir",
"utils.neuralnetwork.NeuralNetwork",
"os.path.isfile",
"pathlib.Path",
"numpy.array",
"sklearn.datasets.fetch_openml... | [((21, 42), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (36, 42), False, 'import sys\n'), ((437, 477), 'os.path.join', 'os.path.join', (['data_path', '"""mnist_img.csv"""'], {}), "(data_path, 'mnist_img.csv')\n", (449, 477), False, 'import os\n'), ((495, 537), 'os.path.join', 'os.path.join', (... |
from gpflow.actions import Action, Loop
from gpflow.training import NatGradOptimizer, AdamOptimizer, ScipyOptimizer
from gpflow import settings
from gpflow.transforms import Transform
from ..logging import logging
import tensorflow as tf
import os
import numpy as np
class PrintAction(Action):
def __init__(self, mo... | [
"tensorflow.reduce_sum",
"tensorflow.get_collection",
"tensorflow.identity",
"tensorflow.variables_initializer",
"tensorflow.reshape",
"numpy.einsum",
"gpflow.settings.logger",
"tensorflow.matmul",
"tensorflow.assign",
"tensorflow.train.latest_checkpoint",
"tensorflow.Variable",
"numpy.exp",
... | [((3182, 3224), 'tensorflow.train.latest_checkpoint', 'tf.train.latest_checkpoint', (['checkpoint_dir'], {}), '(checkpoint_dir)\n', (3208, 3224), True, 'import tensorflow as tf\n'), ((3238, 3255), 'gpflow.settings.logger', 'settings.logger', ([], {}), '()\n', (3253, 3255), False, 'from gpflow import settings\n'), ((338... |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: LmdbDataset.py
@Time: 2020/8/20 16:55
@Overview:
"""
import os
import random
import lmdb
import numpy as np
from kaldi_io import read_mat
from torch.utils.data import Dataset
from tqdm import tqdm
import Proce... | [
"numpy.frombuffer",
"random.shuffle",
"os.path.exists",
"numpy.array",
"lmdb.open",
"numpy.concatenate"
] | [((567, 603), 'numpy.frombuffer', 'np.frombuffer', (['buf'], {'dtype': 'np.float32'}), '(buf, dtype=np.float32)\n', (580, 603), True, 'import numpy as np\n'), ((1842, 1863), 'numpy.array', 'np.array', (['trials_pair'], {}), '(trials_pair)\n', (1850, 1863), True, 'import numpy as np\n'), ((7330, 7409), 'lmdb.open', 'lmd... |
""" Components can be added to Material objects to change the optical properties of the
volume include: absorption, scattering and luminescence (absorption and reemission).
"""
from dataclasses import replace
import numpy as np
from pvtrace.material.distribution import Distribution
from pvtrace.material.utils import is... | [
"numpy.random.uniform",
"pvtrace.material.distribution.Distribution.from_functions",
"pvtrace.material.utils.gaussian",
"pvtrace.material.distribution.Distribution",
"dataclasses.replace",
"logging.getLogger"
] | [((363, 390), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (380, 390), False, 'import logging\n'), ((3938, 3989), 'dataclasses.replace', 'replace', (['ray'], {'direction': 'direction', 'source': 'self.name'}), '(ray, direction=direction, source=self.name)\n', (3945, 3989), False, 'from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import configparser
import numpy as np
from tkinter import filedialog
import tkinter
class Saver_Opener:
def __init__(self):
# Test run parameters
if len(sys.argv) > 1:
self.test_flag = sys.argv[1]
else:
... | [
"numpy.meshgrid",
"os.getcwd",
"os.path.dirname",
"numpy.savetxt",
"numpy.transpose",
"numpy.genfromtxt",
"numpy.array",
"numpy.arange",
"numpy.array_split",
"configparser.ConfigParser",
"os.path.join",
"tkinter.Tk"
] | [((775, 820), 'os.path.join', 'os.path.join', (['self.path_to_main', '"""config.ini"""'], {}), "(self.path_to_main, 'config.ini')\n", (787, 820), False, 'import os\n'), ((837, 864), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (862, 864), False, 'import configparser\n'), ((9576, 9588), 't... |
from matplotlib import pyplot as plt
import numpy as np
import math
def find_days_to_final_goal(start_value, end_value, iteration_amount):
"""
Returns the total amount of days it will take to reach the goal calculated from the start_value, end_value, and
iteration_amount.
:param start_value: The starti... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.linspace",
"math.log",
"matplotlib.pyplot.savefig"
] | [((1448, 1486), 'numpy.linspace', 'np.linspace', (['(0)', 'total_days', 'total_days'], {}), '(0, total_days, total_days)\n', (1459, 1486), True, 'import numpy as np\n'), ((1859, 1907), 'matplotlib.pyplot.plot', 'plt.plot', (['goal_graph', 'ygoal_graph'], {'color': '"""black"""'}), "(goal_graph, ygoal_graph, color='blac... |
# To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataScience.changeDirOnImportExport setting
# ms-python.python added
import os
try:
os.chdir(os.path.join(os.getcwd(), 'Ch... | [
"pandas.DataFrame",
"sklearn.datasets.load_iris",
"matplotlib.pyplot.plot",
"math.pow",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.model_selection.train_test_split",
"os.getcwd",
"collections.Counter",
"time.clock",
"random.random",
"sklearn.neighbor... | [((2392, 2403), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (2401, 2403), False, 'from sklearn.datasets import load_iris\n'), ((2409, 2460), 'pandas.DataFrame', 'pd.DataFrame', (['iris.data'], {'columns': 'iris.feature_names'}), '(iris.data, columns=iris.feature_names)\n', (2421, 2460), True, 'import p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.