repo_name stringlengths 6 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
yanlynnnnn/slow-momentum-fast-reversion | [
"dbed2f21b97ec6a8064430ecf3dee07b372c7a1e"
] | [
"src/classical_strategies.py"
] | [
"import numpy as np\nimport pandas as pd\n\nfrom typing import List, Tuple\n\nVOL_LOOKBACK = 60 # for ex-ante volatility\nVOL_TARGET = 0.15 # 15% volatility target\n\n\ndef calc_returns(srs: pd.Series, day_offset: int = 1) -> pd.Series:\n \"\"\"for each element of a pandas time-series srs,\n calculates the ... | [
[
"numpy.log",
"numpy.sqrt",
"pandas.Series",
"numpy.sign",
"numpy.exp"
]
] |
jcai117/causaldag | [
"94933db7086d21dad1f9d0ea64d538b0365c8add"
] | [
"causaldag/structure_learning/difference/_utils.py"
] | [
"import numpy as np\nfrom sklearn.utils.random import sample_without_replacement\nimport random\nimport networkx as nx\n\n\ndef bootstrap_generator(n_bootstrap_iterations, sample_fraction, X, random_state=None):\n \"\"\"Generates bootstrap samples from dataset.\"\"\"\n if random_state is not None:\n np... | [
[
"numpy.floor",
"numpy.zeros",
"sklearn.utils.random.sample_without_replacement",
"numpy.random.seed"
]
] |
csermac/PX4-Avoidance | [
"25dba31bca53c6c6663acd435d4f3c2d33f3528c"
] | [
"global_planner/scripts/test_cmd_vel_topic_stamped.py"
] | [
"#!/usr/bin/env python3\n\n\nfrom mavros_msgs.msg import ParamValue, State\n# from mavros_msgs.msg import Thrust\nfrom mavros_msgs.srv import SetMode\nfrom gazebo_msgs.srv import GetModelState\nimport rospy\nfrom geometry_msgs.msg import TwistStamped\nfrom px4_modules.mavros_test_common import MavrosTestCommon\nfro... | [
[
"numpy.arange",
"numpy.cos",
"numpy.sin"
]
] |
RDWimmers/pastas | [
"999a7b6475ff5dfc023ab4a10512443196ec187b"
] | [
"tests/test_stats.py"
] | [
"import numpy as np\nimport pandas as pd\n\nimport pastas as ps\n\n\ndef acf_func(**kwargs):\n index = pd.to_datetime(np.arange(0, 100, 1), unit=\"D\", origin=\"2000\")\n data = np.sin(np.linspace(0, 10 * np.pi, 100))\n r = pd.Series(data=data, index=index)\n acf_true = np.cos(np.linspace(0.0, np.pi, 11... | [
[
"numpy.arange",
"pandas.read_csv",
"pandas.Series",
"numpy.linspace"
]
] |
varunagrawal/VisualQA | [
"d394f6fb18ca676c041c8e3fe802c72294431f6e"
] | [
"utils/text.py"
] | [
"\"\"\"\nUtils to help in text processing\n\nAuthor: Vaurn Agrawal (varunagrawal)\n\"\"\"\n\nimport re\nfrom tqdm import tqdm\nimport numpy as np\nimport nltk\n\n\ndef tokenize(sentence):\n sentence = sentence.lower()\n return [i for i in re.split(r\"([-.\\\"',:? !\\$#@~()*&\\^%;\\[\\]/\\\\\\+<>\\n=])\", sent... | [
[
"numpy.zeros"
]
] |
HibiKier/nonebot_plugin_statistical | [
"4fb35c707f487f0cd2fd42cee3b29f95ce8f5221"
] | [
"nonebot_plugin_statistical/statistical_handle.py"
] | [
"from nonebot import on_command\r\nfrom nonebot.adapters.cqhttp import Bot, GroupMessageEvent, MessageEvent, MessageSegment\r\nfrom nonebot.typing import T_State\r\nfrom .config import statistics_group_file, statistics_user_file, reload_data, get_plugin2cmd, \\\r\n del_cmd, add_cmd, query_cmd, update_cmd_priorit... | [
[
"matplotlib.pyplot.title",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.barh",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.tick_params"
]
] |
JamesTurntz/google-research | [
"8042f113c824a2430182ef084b3f79d6d21c6580"
] | [
"albert/run_classifier.py"
] | [
"# coding=utf-8\n# Copyright 2019 The Google Research Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless requ... | [
[
"tensorflow.contrib.tpu.TPUEstimator",
"tensorflow.contrib.cluster_resolver.TPUClusterResolver",
"tensorflow.gfile.ListDirectory",
"tensorflow.flags.DEFINE_string",
"tensorflow.gfile.Exists",
"tensorflow.gfile.GFile",
"tensorflow.gfile.Copy",
"tensorflow.gfile.MakeDirs",
"tenso... |
beloslavamalakova/Image-Classification-of-Rockets | [
"dd21af9e4ae53a166c20b9ec57315310e5a6619f"
] | [
"dataprocessing.py"
] | [
"import pandas as pd\n\ntest = pd.read_json(\"../data/test\")\ntrain = pd.read_json(\"../data/train\")"
] | [
[
"pandas.read_json"
]
] |
genterist/BKT-Jupyter | [
"c5180c2846e7c0259a955731853dd55bae4edeee"
] | [
"bkt_implementation.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"BKT-Implementation.ipynb\n\nAutomatically generated by Colaboratory.\n\nOriginal file is located at\n https://colab.research.google.com/drive/1Z5KLj7QsqNuX5mVc6UJgXqpV_8rX1Gvp\n\n\n\n## **DEPARTMENT OF COMPUTER SCIENCE... | [
[
"pandas.read_csv"
]
] |
mmcenta/stanford_cs330 | [
"a3778e3acad6f0a3ecd7223b06601d72c47ef09f"
] | [
"hw2/run_maml.py"
] | [
"\"\"\"\nUsage Instructions:\n\t5-way, 1-shot omniglot:\n\t\tpython main.py --meta_train_iterations=15000 --meta_batch_size=25 --k_shot=1 --inner_update_lr=0.4 --num_inner_updates=1 --logdir=logs/omniglot5way/\n\t20-way, 1-shot omniglot:\n\t\tpython main.py --meta_train_iterations=15000 --meta_batch_size=16 --k_sho... | [
[
"tensorflow.summary.FileWriter",
"tensorflow.InteractiveSession",
"numpy.random.seed",
"numpy.sqrt",
"tensorflow.get_collection",
"tensorflow.train.latest_checkpoint",
"tensorflow.python.platform.flags.DEFINE_float",
"tensorflow.ConfigProto",
"numpy.std",
"tensorflow.global... |
kingyiusuen/clip-image-search | [
"80e36511dbe1969d3989989b220c27f08d30a530",
"80e36511dbe1969d3989989b220c27f08d30a530"
] | [
"scripts/ingest_data.py",
"clip_image_search/clip_feature_extractor.py"
] | [
"import pandas as pd\nfrom download_unsplash import DATASET_PATH, DOWNLOADED_PHOTOS_PATH\nfrom torch.utils.data import DataLoader, Dataset\nfrom tqdm import tqdm\n\nimport clip_image_search.utils as utils\nfrom clip_image_search import CLIPFeatureExtractor, Searcher\n\n\nclass UnsplashDataset(Dataset):\n def __i... | [
[
"pandas.read_csv",
"torch.utils.data.DataLoader"
],
[
"torch.no_grad",
"torch.cuda.is_available"
]
] |
tuladhay/Evo_RL_Summer18 | [
"4d4da5ae2bf1fdcfe69ebc3b6bd18924f57eb534"
] | [
"main_RL_only_mod.py"
] | [
"import argparse\nimport gym\nimport numpy as np\nfrom gym import wrappers\n\nimport torch\nfrom ddpg import DDPG\nfrom naf import NAF\nfrom normalized_actions import NormalizedActions\nfrom ounoise import OUNoise\nfrom replay_memory import ReplayMemory, Transition\nimport pickle\n\n\ndef parse_arguments():\n gl... | [
[
"torch.manual_seed",
"torch.Tensor",
"numpy.mean",
"numpy.random.seed"
]
] |
JeyKelly/strawberryfields | [
"da7cbd7a1c5cda26a9e5a1f5f708ae0c63427081"
] | [
"tests/frontend/test_space_unroll.py"
] | [
"# Copyright 2021 Xanadu Quantum Technologies Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applica... | [
[
"numpy.abs",
"numpy.identity",
"numpy.allclose",
"numpy.random.randint"
]
] |
oscarkremer/adaptive-estimator | [
"463472c879f316a8a4c2a37e53552a7bc5f659b4"
] | [
"src/api/model_parameters.py"
] | [
"import os\nimport numpy as np \nimport matplotlib.pyplot as plt \nfrom src.models import Estimator\n\nif __name__=='__main__':\n y = []\n t = np.arange(0, 0.5001, 0.001)\n u = [np.sin(t),np.cos(t), 3*np.power(t, 2)]\n for i in range(t.shape[0]):\n if t[i] < 0.3:\n y.append([3*u[0][i] ... | [
[
"numpy.power",
"numpy.arange",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.plot",
"numpy.array",
"matplotlib.pyplot.show"
]
] |
jacblo/tests-and-early-projects | [
"16ca33498fe336b089e24981e148ad81e57adb13"
] | [
"gpuTesting.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Nov 21 18:54:24 2020\n\n@author: y4\n\"\"\"\n\nfrom numba import jit, cuda \nimport numpy as np \n# to measure exec time \nfrom timeit import default_timer as timer \n \n# normal function to run on cpu \n\ndef func(a): ... | [
[
"numpy.ones"
]
] |
Samrath49/python | [
"06d2bd73d501244dd80b7fa418bed8ace267a583"
] | [
"p3-2.py"
] | [
"import numpy as np\r\n\r\ninputs = [1,2,3,2.5]\r\nweights = [0.2,0.8,-0.5,1.0]\r\nbias = 2\r\n\r\noutput = np.dot(inputs,weights)+bias\r\n# As i have inputs first to get the desired result but if we have weights as matrix form then weights will be first otherwise we have shape error bcz with weights frist we get w... | [
[
"numpy.dot"
]
] |
aobrien/stars-service | [
"ca2e25b62849c8014b4d7188f02d1ab96fa41514"
] | [
"translator/plot_testing.py"
] | [
"#!/usr/bin/python3\n#\n# Copyright (C) 2020 Ryan Linnabary\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n... | [
[
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"numpy.unique"
]
] |
NREL/TEAM-TDM | [
"13580917683e79292c8a1b7506399e87682fe459"
] | [
"src/ml_battery/naive_bayes.py"
] | [
"import sklearn\nimport sklearn.naive_bayes\nimport numpy as np\n\nclass MixedNB(sklearn.base.BaseEstimator):\n ''' Mixed Naive Bayes for discrete and continuous features. \n Uses a sklearn.naive_bayes.GaussianNB for the continuous features and\n uses a sklearn.naive_bayes.MultinomialNB for the di... | [
[
"sklearn.naive_bayes.GaussianNB",
"sklearn.utils.check_X_y",
"numpy.unique",
"sklearn.utils.check_array",
"sklearn.naive_bayes.MultinomialNB",
"numpy.argmax",
"sklearn.metrics.accuracy_score"
]
] |
carefree0910/botorch | [
"c0b252baba8f16a4ea2eb3f99c266fba47418b1f"
] | [
"botorch/optim/initializers.py"
] | [
"#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport typing # noqa F401\nimport warnings\n\nimport torch\nfrom torch import Tensor\n\nfrom ..exceptions.warnings import BadInitialCandidatesWarning\n\n\ndef initialize_q_batch(X: Tensor, Y: Tensor, n: int, eta: f... | [
[
"torch.max",
"torch.randperm",
"torch.multinomial",
"torch.exp",
"torch.any"
]
] |
jakeKonrad/torch-quiver | [
"16e01b8b61459ae41b7386b6a57ef9d20dfb6606"
] | [
"benchmarks/ogbn-mag240m/train_quiver.py"
] | [
"import os\nimport time\nimport glob\nimport argparse\nimport os.path as osp\nfrom tqdm import tqdm\n\nfrom typing import Optional, List, NamedTuple\n\nimport torch\nfrom torch import Tensor\nimport torch.nn.functional as F\nfrom torch.nn import ModuleList, Sequential, Linear, BatchNorm1d, ReLU, Dropout\nfrom torch... | [
[
"torch.nn.BatchNorm1d",
"torch.nn.Dropout",
"torch.load",
"torch.nn.functional.dropout",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.functional.cross_entropy",
"torch.utils.data.DataLoader",
"torch.from_numpy",
"torch.zeros",
"torch.nn.Linear",
"torch.no_grad",
... |
lukin0110/vaccinations | [
"0fec6e8b3635a442fbef4a1655a89e534c530b5e"
] | [
"scripts/process.py"
] | [
"\"\"\"Fetch CSV and compute daily numbers.\"\"\"\nimport json\nimport locale\nimport pandas as pd\nimport requests\nimport time\nimport typer\nimport os\nimport re\nimport sys\nimport unicodedata\nfrom os import path\nfrom datetime import date, datetime, timedelta\nfrom typing import Any, Dict, List\nfrom functool... | [
[
"pandas.concat",
"pandas.read_csv",
"pandas.Timedelta",
"pandas.date_range",
"pandas.Timestamp"
]
] |
davidbrochart/proteus | [
"b2bc7239502948e555f6e631b1930f0c5854daf5"
] | [
"proteus/mprans/NCLS.py"
] | [
"from __future__ import division\nfrom builtins import str\nfrom builtins import range\nfrom past.utils import old_div\nimport proteus\nfrom proteus.mprans.cNCLS import *\nimport numpy as np\nfrom proteus.Transport import OneLevelTransport, cfemIntegrals, SparseMat\nfrom proteus.Transport import TC_base, logEvent, ... | [
[
"numpy.abs",
"numpy.save",
"numpy.ones",
"numpy.copy",
"numpy.zeros"
]
] |
khoih-prog/TinyNeuralNetwork | [
"2deaa71d0f0db460c1ee68ae47e1e1e9856b33c3"
] | [
"tinynn/graph/modifier.py"
] | [
"import typing\nimport math\nimport numpy\nfrom copy import deepcopy\nfrom math import gcd # Python versions 3.5 and above\nfrom functools import reduce # Python version 3.x\n\nimport torch\nimport torch.nn as nn\n\nfrom tinynn.graph import masker\nfrom tinynn.util.util import get_logger\nfrom tinynn.graph.tracer... | [
[
"torch.nn.Parameter",
"torch.norm",
"torch.cat",
"torch.randperm",
"torch.equal",
"torch.cdist",
"torch.ones_like"
]
] |
mimeku/mars | [
"322c187842a0ca99cea2a5f311d10e681969bd78"
] | [
"mars/learn/utils/tests/test_checks.py"
] | [
"# Copyright 1999-2021 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by appl... | [
[
"numpy.finfo",
"numpy.testing.assert_array_equal",
"scipy.sparse.random",
"pandas.testing.assert_frame_equal",
"numpy.random.rand",
"numpy.array",
"numpy.sum",
"numpy.random.RandomState",
"numpy.random.randint"
]
] |
AjayNandoriya/stereo_vision_hw | [
"fb69aadbded4cad0fd6dd6e36be2776f418f42db"
] | [
"stereo_vision_cam/scripts/multi_cam.py"
] | [
"import os\nimport cv2\nimport numpy as np\n\nclass MultiCam(object):\n def __init__(self, cam_ids=[0]):\n \n self.cams =[]\n for cam_id in cam_ids:\n cam = cv2.VideoCapture(cam_id)\n if not cam.isOpened():\n print(\"Cannot open camera {0}\".format(cam_id... | [
[
"numpy.sum"
]
] |
tairaeli/larnd-sim | [
"a54058eb899fe149fc31bbabcac448de050b01a9"
] | [
"cli/dumpTree.py"
] | [
"#! /usr/bin/env python\n#\n# Read almost every field in the event tree.\n#\n\nfrom math import sqrt\n\nimport numpy as np\nimport fire\nimport h5py\n\nfrom ROOT import TG4Event, TFile\n\n# Print the fields in a TG4PrimaryParticle object\ndef printPrimaryParticle(depth, primaryParticle):\n print(depth,\"Class: \... | [
[
"numpy.concatenate",
"numpy.dtype"
]
] |
ccp137/GMMA | [
"5f484198e58d787a03fd949451e3824b4f4ffe5c"
] | [
"gmma/app.py"
] | [
"import os\nimport pickle\nfrom datetime import datetime\nfrom json import dumps\nfrom typing import Dict, List, NamedTuple, Union\n\nimport numpy as np\nimport pandas as pd\nfrom fastapi import FastAPI\nfrom kafka import KafkaProducer\nfrom pydantic import BaseModel\n\nfrom gmma.association import association, con... | [
[
"numpy.array",
"pandas.read_csv",
"pandas.DataFrame"
]
] |
ZhinusMarzi/Adversarial-attack | [
"d763d6e5dbd7baec83fc40407c1001db736bdc64"
] | [
"linear_svm/mnist_workaround.py"
] | [
"\"\"\"\nA workaround to download MNIST data since mldata.org appears to be unstable\nTaken from https://github.com/scikit-learn/scikit-learn/issues/8588#issuecomment-292634781\n\"\"\"\n\nfrom shutil import copyfileobj\nfrom six.moves import urllib\nfrom sklearn.datasets.base import get_data_home\nimport os\n\ndef ... | [
[
"sklearn.datasets.base.get_data_home"
]
] |
xmuyulab/DAISM-DNN | [
"2f70d6b1b6b26b77d4476c9f7ab73d5f3be8f94c"
] | [
"daism/daism.py"
] | [
"#!/usr/bin/env python\nimport os,sys\nimport pandas as pd\nimport argparse\n\ndaismdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nsys.path.insert(0,daismdir)\n\nimport daism.modules.simulation as simulation\nimport daism.modules.training as training\nimport daism.modules.prediction as predictio... | [
[
"pandas.read_csv",
"pandas.DataFrame"
]
] |
osblinnikov/pytorch-binary | [
"61842542c94766ffa21b0fa3ea86a435f802b95f"
] | [
"example/build.py"
] | [
"import os\nimport torch\nfrom torch.utils.ffi import create_extension\n\nthis_file = os.path.dirname(__file__)\n\nsources = ['src/my_lib.c']\nheaders = ['src/my_lib.h']\ndefines = []\nwith_cuda = False\n\nif torch.cuda.is_available():\n print('Including CUDA code.')\n sources += ['src/my_lib_cuda.c']\n he... | [
[
"torch.utils.ffi.create_extension",
"torch.cuda.is_available"
]
] |
rafmacalaba/fastquant | [
"b3436c8737a4ab1b5d555f7cd34fba9c406cad0a"
] | [
"python/fastquant/disclosures.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Apr 5, 2020\n\n@authors: enzoampil & jpdeleon\n\"\"\"\n# Import standard library\nimport os\nfrom inspect import signature\nfrom datetime import datetime\nimport warnings\nfrom pathlib import Path\nfrom string import digits\nimport requests\ni... | [
[
"pandas.concat",
"pandas.to_datetime",
"pandas.read_csv",
"matplotlib.style.use",
"pandas.DataFrame",
"numpy.flatnonzero",
"numpy.argmax",
"numpy.argmin",
"matplotlib.pyplot.figure"
]
] |
barabadwan/DrugCell | [
"c507e1d821fac0201e42f831a1d772e7ef42b00e"
] | [
"code/train_drugcell.py"
] | [
"import sys\nimport os\nimport numpy as np\nimport torch\nimport torch.utils.data as du\nfrom torch.autograd import Variable\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport util\nfrom util import *\nfrom drugcell_NN import *\nimport argparse\nimport numpy as np\nimport time\n\n\n# build mask: matrix... | [
[
"torch.zeros",
"torch.cat",
"torch.set_printoptions",
"torch.utils.data.TensorDataset",
"numpy.genfromtxt",
"torch.mul",
"torch.nn.MSELoss",
"torch.save"
]
] |
Henler/ReBridge_data_cloud | [
"ee0ad1bb43e8df525c2d747f23ef8e2580f72f0f"
] | [
"python_back_end/data_cleaning/type_col_extracter.py"
] | [
"import numpy as np\nimport pandas as pd\n\nfrom python_back_end.definitions import SheetTypeDefinitions\nfrom python_back_end.program_settings import PROGRAM_PARAMETERS as pp\n\n\nclass TypeColExtracter:\n\n @staticmethod\n def extract_num_cols(df_data, df_profiles):#, adjacent=False):\n \"\"\"\n\n ... | [
[
"numpy.logical_or",
"numpy.sum",
"pandas.Series",
"pandas.DataFrame"
]
] |
dtalbright/qstrader | [
"949dcaecf8b42fb433b476fd4c929cb3610ccb16"
] | [
"qstrader/data/backtest_data_handler.py"
] | [
"import numpy as np\n\n\nclass BacktestDataHandler(object):\n \"\"\"\n \"\"\"\n\n def __init__(\n self,\n universe,\n data_sources=None\n ):\n self.universe = universe\n self.data_sources = data_sources\n\n def get_asset_latest_bid_price(self, dt, asset_symbol):\n ... | [
[
"numpy.isnan"
]
] |
snydek1/ia_mri_tools | [
"525bdcc7f4c03e26d3114abf7da4932685b1e2e0"
] | [
"ia_mri_tools/utils.py"
] | [
"# Utility functions\nimport numpy as np\n\ndef select(data, mask=None):\n\n if isinstance(data, list):\n h = []\n for dsub in data:\n h.append(select(dsub, mask))\n return np.hstack(h)\n else:\n if mask is not None:\n if len(data.shape) == 3:\n ... | [
[
"numpy.hstack"
]
] |
nikkik11/handful-of-trials | [
"8b0a4acb4342f9ae9681de3ed8e970629565ecb8"
] | [
"dmbrl/modeling/models/TFGP.py"
] | [
"from __future__ import division\nfrom __future__ import print_function\nfrom __future__ import absolute_import\n\n\nimport tensorflow as tf\nimport numpy as np\nimport gpflow\n\nfrom dmbrl.misc.DotmapUtils import get_required_argument\n\n\nclass TFGP:\n def __init__(self, params):\n \"\"\"Initializes cla... | [
[
"tensorflow.cast",
"tensorflow.ConfigProto",
"numpy.copy",
"numpy.random.permutation",
"tensorflow.Session",
"tensorflow.variable_scope",
"numpy.zeros"
]
] |
folguinch/GoContinuum | [
"e2e0f11cbd6d1a0f51fd44c4ac6ee433da4954ae"
] | [
"analyze_cube.py"
] | [
"import os, argparse\n\nfrom astropy.stats import sigma_clip\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom argparse_actions import LoadFITS\nfrom continuum_iterative import group_chans, chans_to_casa, find_continuum, plot_mask\nfrom logger import get_logger\n\nlogger = get_logger(__name__, filename='... | [
[
"numpy.sqrt",
"numpy.arange",
"numpy.squeeze",
"numpy.ma.count_masked",
"matplotlib.pyplot.subplots",
"numpy.indices",
"numpy.all",
"numpy.logical_or",
"numpy.mean",
"numpy.where",
"numpy.ma.max",
"numpy.ma.masked_less_equal",
"numpy.zeros",
"numpy.sum"
]
... |
ttimbers/pycounts-tat | [
"7de5ac2de49996373d5c477ac79e26951ad4c677"
] | [
"src/pycounts_tat/plotting.py"
] | [
"import matplotlib.pyplot as plt\n\ndef plot_words(word_counts, n=10):\n \"\"\"Plot a bar chart of word counts.\"\"\"\n top_n_words = word_counts.most_common(n)\n word, count = zip(*top_n_words)\n fig = plt.bar(range(n), count)\n plt.xticks(range(n), labels=word, rotation=45)\n plt.xlabel(\"Word\"... | [
[
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylabel"
]
] |
pschindler/qutip | [
"dc399135b77a01077898e13bb7d30d60db9b6e67"
] | [
"qutip/operators.py"
] | [
"# This file is part of QuTiP: Quantum Toolbox in Python.\n#\n# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are... | [
[
"numpy.sqrt",
"numpy.conj",
"scipy.sparse.eye",
"numpy.arange",
"scipy.sparse.diags",
"numpy.ones",
"numpy.prod",
"numpy.exp",
"numpy.fix",
"numpy.array",
"numpy.sum",
"scipy.sparse.lil_matrix"
]
] |
coronado212/blockchain_ledger_system_18 | [
"6adad6bbbf59e736ca029f719dfa94867b63d2b2"
] | [
"pychain.py"
] | [
"# PyChain Ledger\n################################################################################\n# You’ll make the following updates to the provided Python file for this\n# Challenge, which already contains the basic `PyChain` ledger structure that\n# you created throughout the module:\n\n# Step 1: Create a Rec... | [
[
"pandas.DataFrame"
]
] |
Moon-sung-woo/Text_CNN | [
"e5b3433b2d28cdbd80c01f919c1d4709c12825b7"
] | [
"model.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torch.autograd import Variable\n\n\nclass CNN_Text(nn.Module):\n \n def __init__(self, args):\n super(CNN_Text, self).__init__()\n self.args = args\n \n V = args.embed_num\n D = args.embed_dim\n ... | [
[
"torch.nn.Dropout",
"torch.nn.Conv2d",
"torch.nn.Embedding",
"torch.cat"
]
] |
WesleyCh3n/few-shot-fine-grained | [
"131d4e0f0414259a79513036bd5d28b171a546c4"
] | [
"train_triplet_from_scratch.py"
] | [
"#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\nimport os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #supress tensorflow info except error\nimport sys\nimport math\nimport pathlib\nimport datetime\nimport tensorflow as tf\n\nfrom model.parse_params import parse_params\nfrom model.input_fn import dataset_pipeline_ba... | [
[
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.device",
"tensorflow.keras.callbacks.EarlyStopping"
]
] |
p-lambda/robust_tradeoff | [
"3999ed408d582a8c281949266ecd4061ae962a01"
] | [
"cifar/code/foolbox/foolbox/adversarial.py"
] | [
"\"\"\"\nProvides a class that represents an adversarial example.\n\n\"\"\"\n\nimport numpy as np\nimport numbers\n\nfrom .distances import Distance\nfrom .distances import MSE, Linf\n\n\nclass StopAttack(Exception):\n \"\"\"Exception thrown to request early stopping of an attack\n if a given (optional!) thre... | [
[
"numpy.array",
"numpy.argmax"
]
] |
taivu1998/GANime | [
"c4e98274cc8ecddda0d6273c5d2670a8d356648f"
] | [
"dataloaders/NeuralStyleTransferDataLoader.py"
] | [
"'''\nThis program implements a dataloader for Neural Style Transfer.\n\nReferences:\n https://www.tensorflow.org/tutorials/generative/style_transfer\n'''\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport tensorflow as tf\n\nimport os\nimport numpy as np\n\n\nfrom Ba... | [
[
"tensorflow.shape",
"tensorflow.cast",
"tensorflow.image.resize",
"tensorflow.image.decode_image",
"tensorflow.image.convert_image_dtype",
"tensorflow.io.read_file"
]
] |
liuying3013/vnpy | [
"e1cc1ea4af5fa6ec9a31e5b954c19cfaa0a3130e"
] | [
"vnpy/data/tdx/tdx_stock_data.py"
] | [
"# encoding: UTF-8\n\n# 从tdx下载股票数据.\n# 收盘后的数据基本正确, 但盘中实时拿数据时:\n# 1. 1Min的Bar可能不是最新的, 会缺几分钟.\n# 2. 当周期>1Min时, 最后一根Bar可能不是完整的, 强制修改后\n# - 5min修改后freq基本正确\n# - 1day在VNPY合成时不关心已经收到多少Bar, 所以影响也不大\n# - 但其它分钟周期因为不好精确到每个品种, 修改后的freq可能有错\n# https://rainx.gitbooks.io/pytdx/content/pytdx_hq.html\n# 华富资产\n\nimport s... | [
[
"pandas.concat",
"pandas.to_datetime"
]
] |
tushuguanhaoya/pyaam | [
"2a411101867631c95f25f0ac684f126eaa182c0d"
] | [
"pyaam/muct.py"
] | [
"# coding: utf-8\n\nfrom __future__ import division\n\nimport os\nimport shutil\nimport tarfile\nimport itertools\nimport cv2\nimport numpy as np\nimport git\nimport glob\n\n\n# default dataset directory\nDEFAULT_DATADIR = 'data/muct'\n\n\nclass MuctDataset(object):\n # landmark pair connections\n PAIRS = (\n... | [
[
"numpy.concatenate",
"numpy.char.array",
"numpy.loadtxt"
]
] |
malanchak/AuTuMN | [
"0cbd006d1f15da414d02eed44e48bb5c06f0802e"
] | [
"summer/model/strat_model.py"
] | [
"import copy\nimport itertools\nfrom functools import lru_cache\nfrom typing import List, Dict\n\nimport numpy as np\nimport numpy\n\nfrom summer.constants import (\n Compartment,\n Flow,\n BirthApproach,\n Stratification,\n IntegrationType,\n)\nfrom .epi_model import EpiModel\nfrom .utils import (\n... | [
[
"numpy.arange",
"numpy.log",
"numpy.array",
"numpy.kron"
]
] |
Tanveer81/transformed_detr | [
"1f31a862629d5b398844d087821885ed9da1649d"
] | [
"datasets/transforms.py"
] | [
"# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\r\n\"\"\"\r\nTransforms and data augmentation for both image + bbox.\r\n\"\"\"\r\nimport random\r\n\r\nimport PIL\r\nimport torch\r\n\r\nimport torchvision.transforms as T\r\nimport torchvision.transforms.functional as F\r\n\r\nfrom util.box_op... | [
[
"torch.all",
"torch.as_tensor",
"torch.nn.functional.pad",
"torch.tensor"
]
] |
Jamun-Fanatic-Foreva/STADS---Star-Matching | [
"0a96885a168b8de86eb4f51ba401980969023452"
] | [
"Star_Image_Generation.py"
] | [
"import numpy as np\nimport pandas as pd\nfrom matplotlib import pyplot as plt\nimport GV_Catalogue_Gen as gv_cg\n\ndef generateImageDataframe(CATALOGUE, ref_ra, ref_dec, ref_ang_dist, mag_limit = 6, ra_hrs = True):\n '''\n Generates a dataframe consisting of stars that lie within the circular boundary\n f... | [
[
"matplotlib.pyplot.legend",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.figure"
]
] |
cqzhao/xalpha | [
"824def5ae4bcf4e1d8b85355af4d842311c07130"
] | [
"xalpha/info.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nmodules of info class, including cashinfo, indexinfo and fundinfo class\n\"\"\"\n\nimport os\nimport csv\nimport datetime as dt\nimport json\nimport re\nimport logging\nfrom functools import lru_cache\n\nimport pandas as pd\nfrom bs4 import BeautifulSoup\nfrom sqlalchemy import exc... | [
[
"pandas.to_datetime",
"pandas.read_csv",
"pandas.DataFrame",
"pandas.Timestamp",
"pandas.read_sql"
]
] |
mamacker/pi_to_potter | [
"6a5688ed3d64b2722f22341ccfff2b096881058b"
] | [
"example.py"
] | [
"from __future__ import absolute_import\nimport cv2\nimport numpy as np\n\nyStart = 90;\nyEnd = 170;\nxStart = 110;\nxEnd = 230;\n\nframe_gray = cv2.imread('/home/pi/pi_to_potter/test.png')\nkernel = np.ones((5,5),np.uint8)\nframe_gray = cv2.cvtColor(frame_gray,cv2.COLOR_BGR2GRAY)\nth, frame_gray = cv2.threshold(fr... | [
[
"numpy.ones"
]
] |
laqua-stack/lifelines | [
"63d7ad4e8a22062c1b62009f9794ec6607c3fac6"
] | [
"lifelines/fitters/__init__.py"
] | [
"# -*- coding: utf-8 -*-\nimport collections\nfrom functools import partial, wraps\nimport sys\nimport warnings\nfrom datetime import datetime\nfrom textwrap import dedent\nfrom typing import *\nfrom inspect import getfullargspec\n\nimport numpy as np\nfrom numpy.linalg import inv, pinv\nimport autograd.numpy as an... | [
[
"pandas.Series",
"numpy.einsum",
"numpy.asarray",
"pandas.DataFrame",
"numpy.concatenate",
"numpy.all",
"numpy.zeros_like",
"numpy.exp",
"matplotlib.pyplot.gca",
"numpy.ones_like",
"numpy.unique",
"numpy.clip",
"scipy.integrate.trapz",
"numpy.atleast_1d",
... |
whyjz/pejzero | [
"5a4665abfd311d7d453785bf9eeb0f49eddcac47"
] | [
"pejzero/pejzero.py"
] | [
"# This file contains functions needed for running Pe-J0 comparison,\n# especially for the Greenland Ice Sheet (GrIS).\n# by Whyjay Zheng\n# Last modified: Feb 22, 2022\n\nimport numpy as np\nfrom scipy.signal import savgol_filter\nfrom scipy import interpolate\nimport warnings\nimport h5py\n\n# ============ Code f... | [
[
"numpy.sum",
"numpy.isnan",
"scipy.interpolate.interp1d",
"numpy.nanmean",
"numpy.flip",
"scipy.signal.savgol_filter",
"numpy.vstack"
]
] |
sportwxp/A-unified-Network-for-Segmentation-and-Detection | [
"3d189d623cf967097a78ac5b87bde0a355990323"
] | [
"data/voc_dataset.py"
] | [
"import os\nimport xml.etree.ElementTree as ET\n\nimport numpy as np\nfrom utils.config import opt\nimport glob\nfrom PIL import Image\n\nfrom data.util import read_image,read_mask\n\n# IMAGE_PATH = '/home/xpwang/Documents/Data/jpg_anotation'\nIMAGE_PATH = '/home/xpwang/Documents/Data/data/all_images/images'\n# IMA... | [
[
"numpy.array"
]
] |
robo-warrior/Permuted-Conv | [
"cdfb803392680f44bf888eb098acaf0632f167dc"
] | [
"pytorch-cifar-master/models/densenet_depthwise_separable.py"
] | [
"'''DenseNet in PyTorch.'''\nimport math\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\nclass Bottleneck(nn.Module):\n def __init__(self, in_planes, growth_rate):\n super(Bottleneck, self).__init__()\n self.bn1 = nn.BatchNorm2d(in_planes)\n self.conv1 = nn.Conv2... | [
[
"torch.nn.Sequential",
"torch.cat",
"torch.randn",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.nn.BatchNorm2d"
]
] |
ntardiff/PyDDM | [
"d5d7747cce212c0ebe550324bf33f8625a24e2fd"
] | [
"ddm/models/loss.py"
] | [
"# Copyright 2018 Max Shinn <maxwell.shinn@yale.edu>\n# 2018 Norman Lam <norman.lam@yale.edu>\n# \n# This file is part of PyDDM, and is available under the MIT license.\n# Please see LICENSE.txt in the root directory for more information.\n\n__all__ = ['LossFunction', 'LossSquaredError', 'LossLikelihood',... | [
[
"numpy.asarray",
"numpy.log",
"numpy.sum",
"numpy.errstate"
]
] |
KasunKG/pymatgen | [
"e306b34bfe5d0917060a85926ba97caa2f6f99f2"
] | [
"pymatgen/io/vasp/tests/test_outputs.py"
] | [
"# coding: utf-8\n# Copyright (c) Pymatgen Development Team.\n# Distributed under the terms of the MIT License.\n\n\nimport unittest\nimport os\nfrom pathlib import Path\nimport json\nimport gzip\nimport numpy as np\nimport warnings\n\nfrom shutil import copyfile, copyfileobj\nfrom monty.tempfile import ScratchDir\... | [
[
"numpy.unravel_index",
"numpy.allclose",
"numpy.abs",
"numpy.sqrt",
"numpy.isnan",
"numpy.median",
"numpy.linalg.norm",
"numpy.all",
"numpy.mean",
"numpy.prod",
"numpy.cross",
"numpy.array",
"numpy.zeros",
"numpy.sum"
]
] |
Vegetebird/MHFormer | [
"3895392247b47cd52763933de6c4b64b4d43f50d"
] | [
"demo/lib/yolov3/darknet.py"
] | [
"from __future__ import division\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport numpy as np\nimport cv2\nimport os\nimport sys\n\nfrom lib.yolov3.util import convert2cpu as cpu\nfrom lib.yolov3.util import predict_transform\n\n\nclass test_net(nn.Module):\n def __init__(self, num... | [
[
"torch.nn.Sequential",
"numpy.fromfile",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.from_numpy",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.Upsample",
"torch.nn.LeakyReLU",
"torch.nn.BatchNorm2d",
"torch.IntTensor",
"torch.nn.functiona... |
rsandler00/plotly-scientific-plots | [
"c47c6073d54f1c77632b6eac5f1811782b8c75c3"
] | [
"plotly_scientific_plots/plotly_plot_tools.py"
] | [
"import copy\nfrom itertools import compress\nimport numpy as np\nimport scipy as sp\nimport scipy.stats\n\n#plotting\nimport plotly.offline as pyo\nimport plotly.graph_objs as go\nimport plotly as py\nimport colorlover as cl\nimport plotly.figure_factory as ff\n\n# internal files\nfrom plotly_scientific_plots.plot... | [
[
"scipy.stats.ks_2samp",
"numpy.linspace",
"numpy.issubdtype",
"numpy.max",
"numpy.random.randn",
"numpy.mean",
"scipy.stats.spearmanr",
"numpy.histogram",
"numpy.hstack",
"numpy.unique",
"numpy.arange",
"numpy.atleast_1d",
"scipy.stats.mannwhitneyu",
"numpy.... |
Yuliang-Zou/EECS542-Final-Project | [
"e44431eecc4e25da45f2f4bee721e955b129c3a7"
] | [
"faster_rcnn_pytorch/train_unet.py"
] | [
"import argparse\nimport os\nimport h5py\nimport ipdb\n\nimport torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\n\nimport numpy as np\nfrom datetime import datetime\n\nfrom faster_rcnn import network\n#from faster_rcnn.faster_rcnn import FasterRCNN, RPN, UNet\nfrom UNet_model import UNet\nfrom fas... | [
[
"torch.mean",
"numpy.random.seed",
"torch.from_numpy",
"torch.nn.BCELoss",
"torch.log",
"torch.optim.SGD"
]
] |
RomanBelkov/LearningCourses | [
"585539c6dbeeb70c281acf7d48d057b054fbaf5a"
] | [
"SPBU/SP/task1/kmeans.py"
] | [
"import scipy.spatial\nfrom PIL import Image\nimport numpy as np\n\n\ndef run_cost(centroids, clusters, X):\n return sum(np.linalg.norm(X[i] - centroids[clusters[i]]) for i in xrange(len(clusters)))\n\n\ndef cluster_centroids(data, clusters, k=None):\n if k is None:\n k = np.max(clusters) + 1\n resu... | [
[
"numpy.array_equal",
"numpy.linalg.norm",
"numpy.max",
"numpy.mean",
"numpy.argmin",
"numpy.empty"
]
] |
Lynn-Vang42/demo-data | [
"70fc946d2d67d66fabfee89f00ba71247a9c8014",
"70fc946d2d67d66fabfee89f00ba71247a9c8014"
] | [
"test_subdivide_meshes.py",
"bm_vert_align.py"
] | [
"#!/usr/bin/env python3\n# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.\n\n\nimport unittest\nimport torch\n\nfrom pytorch3d.ops.subdivide_meshes import SubdivideMeshes\nfrom pytorch3d.structures.meshes import Meshes\nfrom pytorch3d.utils.ico_sphere import ico_sphere\n\n\nclass TestSubdivid... | [
[
"torch.cuda.synchronize",
"torch.tensor",
"torch.rand",
"torch.device",
"torch.allclose"
],
[
"torch.cuda.is_available"
]
] |
0xflotus/vaex | [
"10bc10417c8b5973360d93c9d6971bcbba82702e"
] | [
"tests/expression_variables_test.py"
] | [
"import vaex\nimport numpy as np\n\ndef test_expression_expand():\n\tds = vaex.from_scalars(x=1, y=2)\n\tds['r'] = ds.x * ds.y\n\tassert ds.r.expression == 'r'\n\tassert ds.r.variables() == {'x', 'y'}\n\tds['s'] = ds.r + ds.x\n\tassert ds.s.variables() == {'x', 'y'}\n\tds['t'] = ds.s + ds.y\n\tassert ds.t.variables... | [
[
"numpy.arctan"
]
] |
davidggz/SelfDrivingInKohonenCircuits | [
"7553e0f9bb23b453a476404f00607bd8f75854a9"
] | [
"src/pix2pixHD/multi_gpu.py"
] | [
"from __future__ import print_function\nimport keras\nfrom keras.models import*\nfrom keras.layers import Input, merge, Lambda\nfrom keras.layers.merge import Concatenate\nfrom keras import backend as K\n\nimport tensorflow as tf\nsession_config = tf.compat.v1.ConfigProto()\nsession_config.gpu_options.allow_growth ... | [
[
"tensorflow.compat.v1.Session",
"tensorflow.device",
"tensorflow.compat.v1.ConfigProto"
]
] |
mremilien/LaplaceMeshSmoothing | [
"a03358b085215631603e4b5aed2f3fa07c46f0ca"
] | [
"src/part5.py"
] | [
"#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n\r\n\"\"\"\r\nExplicit Smoothing\r\n\"\"\"\r\n\r\nimport os\r\nimport sys\r\nimport open3d as o3d\r\nimport trimesh\r\nfrom tools import *\r\nimport numpy as np\r\nimport argparse\r\nfrom os.path import join as opj\r\n\r\n\r\n# check whether the data folder exist... | [
[
"numpy.array"
]
] |
wking-tao/service-streamer | [
"131b1d7ee8b259cc4d5a1b36652a891b189c40b6"
] | [
"example/bert_model.py"
] | [
"# coding=utf-8\n# Created by Meteorix at 2019/7/30\nimport logging\nimport torch\nfrom typing import List\nfrom pytorch_transformers import *\nfrom service_streamer import ManagedModel\n\nlogging.basicConfig(level=logging.ERROR)\n\nSEED = 0\ntorch.manual_seed(SEED)\ntorch.cuda.manual_seed(SEED)\n\n\nclass TextInfi... | [
[
"torch.cuda.manual_seed",
"torch.manual_seed",
"torch.tensor",
"torch.no_grad",
"torch.argmax"
]
] |
xssstory/flow | [
"a928193c4969d81849dd130d171dddddb1cf45c3"
] | [
"flow/utils/registry_open.py"
] | [
"\"\"\"Utility method for registering environments with OpenAI gym.\"\"\"\nimport time\n\nimport gym\nfrom gym.envs.registration import register\n\nfrom copy import deepcopy\n\nimport flow.envs\nfrom flow.core.params import InitialConfig\nfrom flow.core.params import TrafficLightParams, PersonParams\nfrom flow.util... | [
[
"numpy.random.seed",
"numpy.clip",
"numpy.zeros_like",
"numpy.zeros",
"numpy.sum"
]
] |
dennyglee/mlflow-diabetes-example-az | [
"89da9d472adb9fae9426b24df2fd306d7dcc0d83"
] | [
"train_diabetes.py"
] | [
"#\n# train_diabetes.py\n#\n# MLflow model using ElasticNet (sklearn) and Plots ElasticNet Descent Paths\n#\n# Uses the sklearn Diabetes dataset to predict diabetes progression using ElasticNet\n# The predicted \"progression\" column is a quantitative measure of disease progression one year after baseline... | [
[
"sklearn.metrics.r2_score",
"sklearn.linear_model.ElasticNet",
"sklearn.metrics.mean_absolute_error",
"sklearn.datasets.load_diabetes",
"pandas.DataFrame",
"sklearn.metrics.mean_squared_error",
"numpy.concatenate",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.gca",
"sklearn... |
haifangong/CMSA-MTPT-4-MedicalVQA | [
"56bdb03820ccf86d164ada6f29cb09f9fa35657b"
] | [
"multi-task-pretrain/model/ResNet.py"
] | [
"import torch\r\nfrom torch import nn\r\nfrom torch.nn import init\r\nimport torch.nn.functional as F\r\n\r\nclass BasicBlock(nn.Module):\r\n expansion = 1\r\n\r\n def __init__(self, inplanes, planes, stride=1, rate=1, downsample=None):\r\n super(BasicBlock, self).__init__()\r\n self.conv1 = nn.... | [
[
"torch.nn.Sequential",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.init.kaiming_normal_"
]
] |
Ofeknielsen/incubator-superset | [
"8a58afb8f53692d772efca9f3783b393a94d85d8"
] | [
"tests/base_tests.py"
] | [
"# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); y... | [
[
"pandas.DataFrame"
]
] |
layumi/person-reid-3d | [
"18fba1ef0e54c715c323c076182a0b6da57435b4"
] | [
"utils.py"
] | [
"import torch\nfrom torch.nn import init\nimport torch.nn as nn\n\ndef channel_shuffle(x, groups):\n # type: (torch.Tensor, int) -> torch.Tensor\n batchsize, num_channels, length = x.data.size()\n channels_per_group = num_channels // groups\n\n # reshape\n x = x.view(batchsize, groups,\n ... | [
[
"torch.norm",
"torch.nn.LogSoftmax",
"torch.floor",
"torch.transpose",
"torch.zeros",
"torch.nn.init.constant_",
"torch.randint",
"torch.max",
"torch.ones",
"torch.sum",
"torch.cat",
"torch.nn.init.normal_",
"torch.rand",
"torch.arange",
"torch.device",
... |
jameschapman19/multiviewdata | [
"0f08791beffd950b31d3bc51e5c0e8b51bd47a24"
] | [
"multiviewdata/torchdatasets/xrmb.py"
] | [
"import os\n\nfrom scipy.io import loadmat\nfrom torch.utils.data import Dataset\nfrom torchvision.datasets.utils import download_url\nimport numpy as np\n\n\nclass XRMB(Dataset):\n def __init__(\n self,\n root,\n train=True,\n download=False,\n ):\n \"\"\"\n\n :param... | [
[
"scipy.io.loadmat"
]
] |
hiteshsdata/Adaptive-Optimum-Scheduling-of-campus-buses | [
"5c85e6979e33ca3fdb6be3e7b4e83488add16ca5"
] | [
"codebase/people_counter.py"
] | [
"# USAGE\n# To read and write back out to video:\n# python people_counter.py --prototxt mobilenet_ssd/MobileNetSSD_deploy.prototxt \\\n#\t--model mobilenet_ssd/MobileNetSSD_deploy.caffemodel --input videos/example_01.mp4 \\\n#\t--output output/output_01.avi\n#\n# To read from webcam and write back out to disk:\n# p... | [
[
"numpy.arange",
"numpy.array",
"numpy.mean"
]
] |
programmingphys/TrainProgs | [
"7a011184a3d936328e0f31f1aca6eb3a86cb3c10"
] | [
"test/test_No.6.py"
] | [
"import numpy as np\nimport matplotlib.pyplot as plt\nimport itertools\nimport random\nimport csv\n \ndef path_dis(data): #得到旅行路径的长度\n x=data[:,0]\n y=data[:,1]\n distance=0\n for i in range(len(x)):\n if i<len(x)-1:\n x_dis=abs(x[i+1]-x[i])\n y_dis=abs(y[i+1]-y[i])\n ... | [
[
"numpy.sqrt",
"matplotlib.pyplot.subplots",
"numpy.delete",
"numpy.zeros_like",
"numpy.array",
"numpy.zeros",
"numpy.vstack"
]
] |
chentong319/ONNF | [
"5357fc1421333391522fe694612bacd3e00da953"
] | [
"doc/gen_doc.py"
] | [
"#!/usr/bin/env python\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nfrom collections import defaultdict, OrderedDict\nimport io\nimport os\nimport sys\nimport datetime\n\nimport numpy as np # type: ignore... | [
[
"numpy.round",
"numpy.array"
]
] |
UCL/scikit-surgeryopencvcpp | [
"6c2748afa8e3ac54677a8922bf755548d9a9bbf6"
] | [
"Testing/python/test_reconstruction.py"
] | [
"# -*- coding: utf-8 -*-\n\nimport pytest\nimport numpy as np\nimport datetime\nimport six\nimport sksurgeryopencvpython as cvpy\nimport cv2\n\n\ndef test_reconstruction():\n\n # Example from 2nd silicon heart phantom dataset from Hamlyn. http://hamlyn.doc.ic.ac.uk/vision/.\n # Technically, we should undistor... | [
[
"numpy.loadtxt"
]
] |
yuancz/Learn2Clean | [
"8a83b3d0641c815b8dee4611a65a20877940fd3d"
] | [
"python-package/learn2clean/__init__.py"
] | [
"# coding: utf-8\n\n__author__ = \"\"\"Laure Berti-Equille\"\"\"\n__email__ = 'laure.berti@ird.fr'\n__version__ = '0.2.1'\n__name__ = 'Learn2Clean'\n\nimport pandas as pd\nimport numpy as np\nfrom .loading.reader import Reader\nfrom .normalization.normalizer import Normalizer\nfrom .feature_selection.feature_select... | [
[
"numpy.seterr",
"numpy.warnings.filterwarnings"
]
] |
XingLiangLondon/Image-Similarity-in-Percentage | [
"d6c056a441084e2bee6cc391438c60c64259f1c7"
] | [
"VGG16_similarity_Xing.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nx.liang@greenwich.ac.uk\n25th March, 2020\nImage Similarity using VGG16\n\"\"\"\nimport os\nimport numpy as np\nfrom keras.layers import Input\nfrom keras.models import Model\nfrom vgg16 import VGG16\nfrom keras.preprocessing import image\nfrom keras.applications.imagenet_utils imp... | [
[
"numpy.expand_dims",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.linalg.norm"
]
] |
SuHoHan95/VISOLO | [
"962d68fddf60421ae032fe4c6ccc1c35bf878c71"
] | [
"projects/VISOLO/visolo/data/dataset_mapper.py"
] | [
"import copy\nimport logging\nimport random\nimport numpy as np\nimport pycocotools.mask as mask_util\nfrom typing import Callable, List, Optional, Union\nimport torch\n\nfrom detectron2.config import configurable\nfrom detectron2.structures import (\n BitMasks,\n Boxes,\n BoxMode,\n Instances,\n Pol... | [
[
"torch.empty",
"numpy.ascontiguousarray",
"numpy.arange",
"torch.tensor",
"numpy.array"
]
] |
bhardwaj1230/LASER | [
"1b69096342f257a7767ada0237aaf5a28aac0d3f"
] | [
"source/lib/indexing.py"
] | [
"#!/usr/bin/python3\n# Copyright (c) Facebook, Inc. and its affiliates.\n# All rights reserved.\n#\n# This source code is licensed under the BSD-style license found in the\n# LICENSE file in the root directory of this source tree.\n#\n# LASER Language-Agnostic SEntence Representations\n# is a toolkit to calculate ... | [
[
"numpy.fromfile",
"numpy.linspace",
"numpy.memmap",
"numpy.dtype",
"numpy.array",
"numpy.zeros"
]
] |
miketrumpis/nwb-conversion-tools | [
"4d5c270b70eb4f1c09f98a6c04b51ccdf20336c1"
] | [
"tests/test_internals/test_interfaces.py"
] | [
"import numpy as np\nfrom jsonschema import Draft7Validator\nfrom tempfile import mkdtemp\nfrom shutil import rmtree\nfrom pathlib import Path\nfrom itertools import product\nfrom platform import python_version\nfrom sys import platform\nfrom packaging import version\n\nimport pytest\nimport spikeextractors as se\n... | [
[
"numpy.random.randint"
]
] |
chipmuenk/python_snippets | [
"20ea4ad1436cfaa7debcbc9c87cdef375cea996b"
] | [
"dsp_fpga/07_FIX/FIX_pyaudio_quantization.py"
] | [
"# -*- coding: utf-8 -*-\r\n\"\"\"\r\n=== FIX_pyaudio_quantization.py ============================================\r\n\r\nDemonstrate quantization effects with audio signals:\r\n\r\nRead an audio file frame by frame, quantize the samples and stream the data\r\nto an audio device via pyaudio.\r\n \r\n===============... | [
[
"numpy.zeros"
]
] |
lxy5513/cvToolkit | [
"51586c8016b47f5e7852032f9f3211c89d80f537"
] | [
"pose_track/openpose_track/sgcn/graph/visualize_pose_matching.py"
] | [
"'''\n Author: Guanghan Ning\n E-mail: guanghan.ning@jd.com\n November 5th, 2018\n\n Load keypoints from existing openSVAI data format\n and turn these keypoints into Graph structure for GCN\n\n Perform pose matching on these pairs.\n Output the image indicating whther they match or not.\n'''\n... | [
[
"torch.sqrt",
"torch.no_grad",
"numpy.zeros",
"torch.from_numpy"
]
] |
indymnv/credit-customer-project | [
"8b1f06d52834ac8460310faede216a62aa038404"
] | [
"churn_library.py"
] | [
"# library doc string\n\"\"\"\nThis file provide a end to end machine learning workflow with a classification model \nfor a customer churn prediction\nauthor: Indy Navarro\ndate: 26 feb 2022\n\"\"\"\n\n# import libraries\n\n\nimport joblib\n\nfrom sklearn.metrics import plot_roc_curve, classification_report\nfrom s... | [
[
"matplotlib.pyplot.gca",
"sklearn.model_selection.GridSearchCV",
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"matplotlib.pyplot.title",
"sklearn.ensemble.RandomForestClassifier",
"matplotlib.pyplot.rc",
"sklearn.model_selection.train_test_split",
"pandas.DataF... |
marivasq/gamma-ai | [
"735953e80901afea3e5cdeb2a7b27c9ab5725434"
] | [
"energylossestimate/basenet.py"
] | [
"import tensorflow as tf\nimport numpy as np\n\nclass NPZSaver(object):\n\t\n\tdef __init__(self, net):\n\t\tself._net = net\n\t\n\tdef save(self, session, f):\n\t\tnp.savez_compressed(f, **dict((v.name, session.run(v)) for v in self._net.variables))\n\t\n\tdef restore(self, session, f):\n\t\tkwds = np.load(f)\n\t\... | [
[
"tensorflow.get_collection",
"numpy.load",
"tensorflow.train.Saver",
"tensorflow.compat.v1.variable_scope"
]
] |
cidgoh/nf-ncov-voc | [
"94a3c6144cfeb55ff7a2af58719b9208714cae47",
"94a3c6144cfeb55ff7a2af58719b9208714cae47"
] | [
"bin/extract_metadata.py",
"bin/map_virusseq_GISAID.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\n\n@author: zohaib\n\nThis script extracts metadata for each VOC, VOI and VUM from the\nprovided Metadata file based on the assigned lineages. This script\nalso filters sequences based on the provided criteria.\n\n\n\"\"\"\n\nimport argparse\nimport pandas as... | [
[
"pandas.read_csv",
"pandas.to_datetime",
"pandas.date_range"
],
[
"pandas.merge",
"pandas.read_csv"
]
] |
lambchop0/stellarphot | [
"0493a003bc36d3f6b92418956c7c618f1de36085"
] | [
"stellarphot/tests/test_coordinates.py"
] | [
"import numpy as np\n\nfrom astropy.nddata import CCDData\n\nfrom ..coordinates import convert_pixel_wcs\nfrom .make_wcs import make_wcs\n\n\ndef test_coord_conversion():\n wcs = make_wcs()\n ccd = CCDData(np.ones([10, 10]), wcs=wcs, unit='adu')\n # Pixel values below should give back ra, dec values for cr... | [
[
"numpy.testing.assert_almost_equal",
"numpy.ones"
]
] |
FurkanThePythoneer/tf_fish_OD | [
"630b50fd5d80563e646b25cbd25716979f8abe97"
] | [
"madgrad.py"
] | [
"# Copyright (c) Facebook, Inc. and its affiliates.\n#\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nimport math\nfrom typing import TYPE_CHECKING, Any, Callable, Optional\n\nimport torch\nimport torch.optim\n\nif TYPE_CHECKING:\n ... | [
[
"torch.clone",
"torch.zeros_like",
"torch.tensor"
]
] |
alejio/timeseries_toolkit | [
"030ac84fcb96ec5bdc480a6b74075a737c30955a"
] | [
"timeseries_toolkit/diagnostics.py"
] | [
"import pandas as pd\nimport numpy as np\nfrom scipy.signal import periodogram\n\n\ndef omega(series: pd.Series) -> float:\n \"\"\"\n An estimator for the forecastability omaga(x_t) of a univariate time series x_t.\n\n Forecastability is defined as\n .. math::\n \\Omega(x_t) = 1 - \\frac{ - \\int... | [
[
"scipy.signal.periodogram",
"numpy.sum",
"numpy.log"
]
] |
evdcush/vision | [
"00c119c853a74848655799c9b185cedf7a01f891"
] | [
"torchvision/models/detection/ssdlite.py"
] | [
"import warnings\nfrom collections import OrderedDict\nfrom functools import partial\nfrom typing import Any, Callable, Dict, List, Optional, Union\n\nimport torch\nfrom torch import nn, Tensor\n\nfrom ..._internally_replaced_utils import load_state_dict_from_url\nfrom ...ops.misc import Conv2dNormActivation\nfrom ... | [
[
"torch.nn.Sequential",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.nn.init.normal_"
]
] |
vrushabhchauhan/MRI_COPY | [
"f386b24660adbf3486df7040d526e6c4d29dabf7"
] | [
"model.py"
] | [
"# Keras implementation of the paper:\n# 3D MRI Brain Tumor Segmentation Using Autoencoder Regularization\n# by Myronenko A. (https://arxiv.org/pdf/1810.11654.pdf)\n# Author of this code: Suyog Jadhav (https://github.com/IAmSUyogJadhav)\n\nimport tensorflow.keras.backend as K\nfrom tensorflow.keras.losses import ms... | [
[
"tensorflow.keras.layers.Lambda",
"tensorflow.keras.backend.int_shape",
"tensorflow.keras.layers.Conv3D",
"tensorflow.keras.backend.exp",
"tensorflow.keras.backend.square",
"tensorflow.keras.layers.Add",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.optimizers.adam",
"te... |
rajibchakravorty/QDataSet | [
"8eb21b8c7dad5654358021dd73b93ab90443f6d0"
] | [
"qmldataset/configurations/config_1q_X.py"
] | [
"# pylint: disable=invalid-name\n\"\"\"\nConfiguration for experiment 1q_X - 1-qubit, Control X-Axis, No Noise\n\"\"\"\nfrom numpy import array\nfrom ..utilities.constants import pauli_operators\n\ndimension = 2\nevolution_time = 1\nnum_time_steps = 1024\nomega = 12\ndynamic_operators = [0.5*pauli_operators[1]]\nst... | [
[
"numpy.array"
]
] |
ashlynrlee/scream | [
"3d58c32340058368bee0cb2b02457c4723fb18db"
] | [
"components/mpas-seaice/testing_and_setup/testcases/square/operators_strain/create_ics.py"
] | [
"from netCDF4 import Dataset\nimport numpy as np\nfrom math import sin, cos, pi, pow\n\n#-------------------------------------------------------------\n\ndef velocities_linear(x,y):\n\n Lx = 1.0\n Ly = 1.0\n\n u = x - 0.5 * Lx\n v = y - 0.5 * Ly\n\n dudx = 1.0\n dudy = 0.0\n\n dvdx = 0.0\n d... | [
[
"numpy.amax",
"numpy.amin",
"numpy.ones",
"numpy.zeros",
"numpy.empty"
]
] |
jarfa/ML_from_scratch | [
"982f2449bf4ea46c7bedd552526f1261827058ee"
] | [
"mlfromscratch/util.py"
] | [
"# Copyright 2017 Jonathan Arfa\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agr... | [
[
"numpy.log",
"numpy.clip",
"numpy.isnan",
"numpy.std",
"numpy.mean",
"numpy.exp",
"numpy.isinf",
"numpy.divide"
]
] |
chris522229197/gisst | [
"0a2782adeff9ca00285fb31dc23e245c6e50d6a2"
] | [
"sig/explainers/gat_explainer.py"
] | [
"import torch\r\nfrom sig.explainers.base_explainer import BaseExplainer\r\n\r\n\r\nclass GATExplainer(BaseExplainer):\r\n \"\"\"\r\n Graph Attention Network (GAT) explainer.\r\n \r\n Args:\r\n model (torch.nn.Module): Trained GAT model for explanation.\r\n flow (str; optional): Message pa... | [
[
"torch.mean"
]
] |
Apostolos-Delis/Bacterial-Fiber-Timeseries_Analysis | [
"726315710c0fda4bf84fcca08c8feab49d5a9044"
] | [
"src/data_class.py"
] | [
"#!/usr/bin/env python3\n# coding: utf8\n\nimport numpy as np\nimport os\n\nfrom mat_to_np import load_np_file\nfrom constants import NUMPY_DIR\n\nclass DataGenerator:\n \"\"\"\n DataGenerator is a class that is usefull for dealing with the numpy data\n for the bacterial fibers.\n\n To use: \n \n ... | [
[
"numpy.array"
]
] |
tempoCollaboration/TimeEvolvingMPO | [
"36fe2a95499732c27f3a11edb42c6ad2e8190a8e"
] | [
"time_evolving_mpo/tempo.py"
] | [
"# Copyright 2021 The TEMPO Collaboration\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or ... | [
[
"numpy.log",
"numpy.abs",
"numpy.linspace",
"numpy.min",
"numpy.power",
"numpy.vectorize",
"numpy.exp",
"numpy.outer",
"numpy.array",
"numpy.where"
]
] |
bianan/cfl | [
"e09043d213c7330d5410e27ba90c943d4323dbe8"
] | [
"word_lstm_model.py"
] | [
"# Copyright 2018 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed... | [
[
"tensorflow.get_variable",
"tensorflow.device",
"tensorflow.concat",
"tensorflow.nn.static_rnn",
"tensorflow.gfile.GFile",
"tensorflow.reduce_sum",
"tensorflow.cast",
"tensorflow.contrib.rnn.LSTMBlockCell",
"tensorflow.app.flags.DEFINE_string",
"tensorflow.train.AdamOptimiz... |
alisadeghian/PGMGAN | [
"488e866664e23b4b48bdd3d9277e49a840c3e993"
] | [
"clusterers/toy_guide_clusterer.py"
] | [
"# Used for CIFAR10 experiments\nimport copy\n\nimport torch\nimport torch.nn as nn\nimport numpy as np\n\nfrom sklearn.cluster import KMeans\nfrom sklearn.metrics.cluster import normalized_mutual_info_score\n\n\nclass iNet(nn.Module):\n def __init__(self, k=None):\n super().__init__()\n print('Usi... | [
[
"torch.nn.Softmax",
"torch.nn.CrossEntropyLoss",
"sklearn.cluster.KMeans",
"torch.cat",
"torch.utils.data.DataLoader",
"torch.from_numpy",
"torch.tensor",
"torch.nn.Linear",
"torch.arange",
"torch.nn.ReLU"
]
] |
emleach/cddm | [
"5b3949d80295b998fd3cd8b6d20964de1d01530c"
] | [
"examples/paper/plot_average.py"
] | [
"\"\"\"Plots Fig 5 of the paper. Firs create data calling:\n\n$ python cross_correlate.py \n$ python auto_correlate_fast.py\n\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom cddm.multitau import log_merge, multilevel, merge_multilevel, log_average\nimport os.path as p\n\nfrom examples.paper.co... | [
[
"matplotlib.pyplot.legend",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.