repo_name stringlengths 6 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
the-browser/recommending-interesting-writing | [
"9ff4771d3f437d33c26d2f306e393b5a90a04878"
] | [
"demo/early-demo-attempts/first-test-demo/demo-data-collection.py"
] | [
"# import necessary libraries\nimport sys\nsys.path.append(\"..\")\nfrom models.models import InnerProduct\nimport pandas as pd\nimport torch\nimport collections\nimport numpy as np\nimport torch.nn as nn\nimport os\nimport argparse\nfrom data_processing.articles import Articles\nfrom models.models import InnerProd... | [
[
"torch.load",
"pandas.json_normalize"
]
] |
YuWangTAMU/PyFR | [
"99ff5fe1ec1ff0dcefcf6222488c990c6839aac3",
"99ff5fe1ec1ff0dcefcf6222488c990c6839aac3"
] | [
"pyfr/backends/cuda/gimmik.py",
"pyfr/partitioners/scotch.py"
] | [
"# -*- coding: utf-8 -*-\n\nfrom gimmik import generate_mm\nimport numpy as np\n\nfrom pyfr.backends.base import ComputeKernel, NotSuitableError\nfrom pyfr.backends.cuda.provider import (CUDAKernelProvider,\n get_grid_for_block)\n\n\nclass CUDAGiMMiKKernels(CUDAKernelProvider... | [
[
"numpy.count_nonzero",
"numpy.abs"
],
[
"numpy.asanyarray"
]
] |
g2giovanni/xarray-spatial | [
"cb768bd8375212486069440b2567fe789bb5dc7c"
] | [
"xrspatial/local.py"
] | [
"from collections import Counter\n\nimport numpy as np\nimport xarray as xr\n\n\nfuncs = {\n 'max': np.max,\n 'mean': np.mean,\n 'median': np.median,\n 'min': np.min,\n 'std': np.std,\n 'sum': np.sum,\n}\n\n\ndef cell_stats(raster, data_vars=None, func='sum'):\n \"\"\"\n Calculates statistic... | [
[
"numpy.array",
"numpy.isnan",
"numpy.nditer",
"numpy.reshape"
]
] |
neal-p/workflow2.0 | [
"65a71754310051ddb3fd4338ff579c499608a483"
] | [
"workflowV2/utils.py"
] | [
"#a collection of useful functions for the script\n\nimport os\nimport glob\nimport shutil\nimport multiprocessing as mp\nfrom .message import warning,log,display\nimport datetime\nfrom . import molecule\nimport numpy as np\n\n\natomic_number2symbol = {\n 1:'H',\n 6:'C',\n 7:'N',\n 8:'O',\n \n}\n\nsy... | [
[
"numpy.sqrt"
]
] |
AhmadQasim/proxylessnas-dense | [
"efaf150fc2a4eee2d8e9df664bad9eb4cf653c3e"
] | [
"search/datasets/tumor_dataset.py"
] | [
"import torch\nfrom torch.utils import data\nimport os\nimport numpy as np\n\n\nclass TumorDataset(data.Dataset):\n \"\"\"\n Tumor Simulation Dataset\n \"\"\"\n\n def __init__(self, ids, save_path, dims, output_size):\n self.ids = ids\n self.save_path = save_path\n self.dims = dims\... | [
[
"torch.Tensor",
"torch.unsqueeze"
]
] |
alexcwsmith/scanpy | [
"b69015e9e7007193c9ac461d5c6fbf845b3d6962"
] | [
"scanpy/tests/test_highly_variable_genes.py"
] | [
"import pytest\nimport pandas as pd\nimport numpy as np\nimport scanpy as sc\nfrom pathlib import Path\n\nFILE = Path(__file__).parent / Path('_scripts/seurat_hvg.csv')\nFILE_V3 = Path(__file__).parent / Path('_scripts/seurat_hvg_v3.csv.gz')\nFILE_V3_BATCH = Path(__file__).parent / Path('_scripts/seurat_hvg_v3_batc... | [
[
"numpy.testing.assert_allclose",
"pandas.Index",
"numpy.random.binomial",
"numpy.isclose",
"numpy.zeros",
"numpy.random.seed",
"numpy.testing.assert_array_equal",
"numpy.all",
"pandas.read_csv",
"numpy.isin"
]
] |
sharavsambuu/fractional-differentiation-time-series | [
"f6d0971b2a02fc5aa7341495192d5564b7d5eaea"
] | [
"frac_diff_x.py"
] | [
"import matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport os\nfrom fracdiff import fast_fracdiff\n\nif __name__ == '__main__':\n x = np.arange(0, 30, 1)\n\n for i, d in enumerate(np.arange(-1, 1.01, 0.01)):\n fracs = fast_fracdiff(x, d=d)\n a = pd.DataFrame(data=np.transp... | [
[
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.close"
]
] |
NinaEffenberger/probnum | [
"595f55f9f235fd0396d02b9a6f828aba2383dceb",
"595f55f9f235fd0396d02b9a6f828aba2383dceb"
] | [
"tests/test_diffeq/test_perturbedsolvers/test_perturbation_functions.py",
"tests/test_randvars/test_categorical.py"
] | [
"import numpy as np\nimport pytest\n\nfrom probnum.diffeq.perturbedsolvers import _perturbation_functions\n\nrandom_state = np.random.mtrand.RandomState(seed=1)\n\n\n@pytest.fixture\ndef step():\n return 0.2\n\n\n@pytest.fixture\ndef solver_order():\n return 4\n\n\n@pytest.fixture\ndef noise_scale():\n ret... | [
[
"numpy.random.mtrand.RandomState",
"numpy.testing.assert_allclose",
"numpy.sum"
],
[
"numpy.testing.assert_allclose",
"numpy.random.rand",
"numpy.testing.assert_almost_equal",
"numpy.sum",
"numpy.random.default_rng",
"numpy.diff",
"numpy.arange",
"numpy.isin"
]
] |
murawaki/dialect-latgeo | [
"24ecb8bee5e489f41afb4432bf0bf17246b5c631"
] | [
"rand_utils.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\n\ndef rand_partition_log(log_list):\n base = max(log_list)\n prob_list = [np.exp(l - base) for l in log_list]\n return rand_partition(prob_list)\n\ndef rand_partition(prob_list):\n s = sum(prob_list)\n r = np.random.uniform(0, s)\n for i in range(0, le... | [
[
"numpy.random.random",
"numpy.random.uniform",
"numpy.exp",
"numpy.isfinite"
]
] |
DavidSplit/apollo-3.0 | [
"9f82838e857e4c9146952946cbc34b9f35098deb"
] | [
"modules/tools/create_map/create_map.py"
] | [
"#!/usr/bin/env python\n\n###############################################################################\n# Copyright 2017 The Apollo Authors. All Rights Reserved.\n# Modifications Copyright (c) 2018 LG Electronics, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n... | [
[
"numpy.sin",
"numpy.cos"
]
] |
yinghai/benchmark | [
"f91d19395d8b14bf6f0bcc7fec1073d56196c4c8"
] | [
"torchbenchmark/models/attention_is_all_you_need_pytorch/translate.py"
] | [
"''' Translate input text with trained model. '''\n\nimport torch\nimport argparse\nimport dill as pickle\nfrom tqdm import tqdm\n\nimport transformer.Constants as Constants\nfrom torchbenchmark.util.torchtext_legacy.data import Dataset\nfrom transformer.Models import Transformer\nfrom transformer.Translator import... | [
[
"torch.device",
"torch.LongTensor",
"torch.load"
]
] |
FabianBG/plate_recognition | [
"b5df94997c7cdcd486ee7e9a65bcc2e5ad012ae9"
] | [
"src/ocr_plate.py"
] | [
"import keras\nimport tensorflow as tf\nimport numpy as np\nprint('TensorFlow version:', tf.__version__)\nprint('Keras version:', keras.__version__)\nfrom PIL import Image, ImageDraw, ImageFont\nfrom random import randint\n\nimport os\nimport sys\nimport itertools\nimport codecs\nimport re\nimport datetime\nimport ... | [
[
"numpy.array",
"numpy.zeros",
"numpy.ones",
"numpy.argmax",
"numpy.expand_dims"
]
] |
fthaler/dace | [
"ba2b703f142c6b6d37c7ca3f20c268bc50c6c7a8"
] | [
"tests/transformations/maptoforloop_test.py"
] | [
"# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.\n\"\"\" A test for the MapToForLoop transformation. \"\"\"\n\nimport dace\nimport numpy as np\nfrom dace.transformation.dataflow import MapExpansion, MapToForLoop\n\n\n@dace.program\ndef map2for(A: dace.float64[20, 20, 20]):\n for k in ... | [
[
"numpy.allclose",
"numpy.copy",
"numpy.random.rand"
]
] |
happytk/auto-sklearn | [
"af81afa88d4666d5c7a2dd1294622445f40034fb"
] | [
"test/test_pipeline/components/feature_preprocessing/test_feature_agglomeration.py"
] | [
"import unittest\n\nfrom sklearn.ensemble import RandomForestClassifier\nfrom autosklearn.pipeline.components.feature_preprocessing.feature_agglomeration import FeatureAgglomeration\nfrom autosklearn.pipeline.util import _test_preprocessing, PreprocessingTestCase, \\\n get_dataset\nimport sklearn.metrics\n\n\ncl... | [
[
"sklearn.ensemble.RandomForestClassifier"
]
] |
rahmadai/vits-tts | [
"54518195374e2d76159c8962e0bc5cd65217ad35"
] | [
"attentions.py"
] | [
"import copy\nimport math\nimport numpy as np\nimport torch\nfrom torch import nn\nfrom torch.nn import functional as F\n\nimport commons\nimport modules\nfrom modules import LayerNorm\n \n\nclass Encoder(nn.Module):\n def __init__(self, hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropo... | [
[
"torch.sigmoid",
"torch.nn.Dropout",
"torch.relu",
"torch.nn.ModuleList",
"torch.nn.Conv1d",
"torch.arange",
"torch.no_grad",
"torch.nn.init.xavier_uniform_",
"torch.unsqueeze",
"torch.abs",
"torch.ones_like",
"torch.nn.functional.softmax",
"torch.matmul",
"... |
jorgemauricio/procesamiento_raster | [
"81a25a60131cfa0b63a56efbb35c1a92bf08cfa2"
] | [
"algoritmos/generar_informacion_por_area.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\n#######################################\n# Script que permite la generación de\n# archivo csv a partir de valores de raster\n# Author: Jorge Mauricio\n# Email: jorge.ernesto.mauricio@gmail.com\n# Date: 2018-02-01\n# Version: 1.0\n############################... | [
[
"pandas.read_csv"
]
] |
Nativeatom/transformers | [
"8df267588e1ce30b8270eeaefbcc9011d6e06b12"
] | [
"src/transformers/models/pegasus/modeling_pegasus.py"
] | [
"# coding=utf-8\n# Copyright 2021, Google and The HuggingFace Inc. team. All rights reserved.\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/license... | [
[
"torch.nn.Linear",
"torch.cat",
"torch.isnan",
"torch.finfo",
"torch.bmm",
"numpy.cos",
"torch.nn.CrossEntropyLoss",
"numpy.sin",
"torch.nn.LayerNorm",
"torch.tensor",
"torch.zeros",
"torch.nn.functional.dropout",
"torch.clamp",
"numpy.power",
"torch.isi... |
FlyuZ/springboot-vue-pytorch | [
"4a139d430eab67203a044d83025e7ca6ec7c452c"
] | [
"Yolov5_DeepSort_Pytorch/socketapi.py"
] | [
"\nfrom track import * \nimport numpy as np\nfrom PIL import Image\nfrom io import BytesIO\nimport base64\nimport threading\nimport socket\nimport os\nimport json\nos.environ[\"KMP_DUPLICATE_LIB_OK\"]=\"TRUE\"\ninferencemodel = None\n\n\nclass premodel():\n def __init__(self):\n cfg = get_config()\n ... | [
[
"numpy.ascontiguousarray"
]
] |
importJL/Auto-PPTX-Report-Generator | [
"464a8971727669ea89b957e9a2ce31e323428d6f"
] | [
"ReportGen/charts.py"
] | [
"import seaborn as sns\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.colors as mcolors\r\nimport six\r\nimport numpy as np\r\n\r\nsns.set_style(style='white')\r\n\r\n\r\nclass Chart():\r\n def __init__(self, row_dim, col_dim, *paths, **kwargs):\r\n self.paths_count = len(paths)\r\n if sel... | [
[
"numpy.array",
"matplotlib.pyplot.twinx",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.gcf",
"matplotlib.colors.TABLEAU_COLORS.values"
]
] |
omarhatem97/Deep-Learning-Framework | [
"01c40cf75a05e630fc919bc7bb28d79cfc082ae5"
] | [
"testing/abdo.py"
] | [
"import numpy as np\n\ndef softmax_cross_entropy_loss(Z, Y=np.array([])):\n '''\n Computes the softmax activation of the inputs Z\n Estimates the cross entropy loss\n Inputs:\n Z - numpy.ndarray (n, m)\n Y - numpy.ndarray (1, m) of labels\n when y=[] loss is set to []\n\n Ret... | [
[
"numpy.max",
"numpy.array",
"numpy.log"
]
] |
iamNCJ/bert-race-pytorch-lightning | [
"93abcc5d5c80790e16114fb021870593cb60f1f2"
] | [
"train.py"
] | [
"import pytorch_lightning as pl\nimport torch\nfrom pytorch_lightning import loggers as pl_loggers\n# from pytorch_lightning.callbacks import ModelCheckpoint\n\nfrom data.RACEDataModule import RACEDataModule\nfrom model.BertForRace import BertForRace\n\n\nif __name__ == '__main__':\n tb_logger = pl_loggers.Tenso... | [
[
"torch.cuda.is_available"
]
] |
cardosolucas/incubator-marvin-trytravis | [
"1bd0b4d9fba0ab57cd351a5651a39b1dd9b35c75"
] | [
"python-daemon/tests/engine_base/serializers/test_keras_serializer.py"
] | [
"#!/usr/bin/env python\n# coding=utf-8\n\n# Copyright [2020] [Apache Software Foundation]\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/LIC... | [
[
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Input",
"tensorflow.keras.models.Model"
]
] |
jiaqi-w/machine_learning | [
"faf21f355d1d6d9de720ae77cbff3442db5cebc7",
"faf21f355d1d6d9de720ae77cbff3442db5cebc7"
] | [
"ml_algo/deep_learning/convolutional_neural_network/cnn_merge_nlp_model.py",
"ml_algo/annotation_evaluation/krippendorff_alpha/krippendorff_alpha.py"
] | [
"import config\nimport os, re\n\nfrom sklearn.preprocessing import LabelEncoder\n\nfrom keras.constraints import max_norm\nfrom keras.layers import Dense\nfrom keras.layers import Dropout\nfrom keras.layers import Flatten\nfrom keras.layers import Input\nfrom keras.models import Model\nfrom keras.layers.convolution... | [
[
"sklearn.preprocessing.LabelEncoder",
"numpy.zeros_like",
"numpy.unique"
],
[
"numpy.asarray"
]
] |
mnarayan/AFQ-Insight | [
"a4699a8e91df8396f3eb6f8d629cecfcdc67d93a"
] | [
"afqinsight/tests/test_datasets.py"
] | [
"import numpy as np\nimport os.path as op\nimport pandas as pd\nimport pytest\n\nimport afqinsight as afqi\nfrom afqinsight.datasets import load_afq_data\n\ndata_path = op.join(afqi.__path__[0], \"data\")\ntest_data_path = op.join(data_path, \"test_data\")\n\n\ndef test_load_afq_data():\n X, y, groups, feature_n... | [
[
"numpy.allclose",
"numpy.array"
]
] |
zhuchen03/federated | [
"6bbcdcb856759aa29daa9a510e7d5f34f6915010"
] | [
"utils/models/transformer_models.py"
] | [
"# Copyright 2020, Google LLC.\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 agree... | [
[
"numpy.sin",
"tensorflow.shape",
"tensorflow.keras.layers.Input",
"tensorflow.matmul",
"tensorflow.ones",
"tensorflow.reshape",
"tensorflow.keras.layers.Dense",
"tensorflow.transpose",
"tensorflow.keras.layers.LayerNormalization",
"tensorflow.keras.Model",
"tensorflow.k... |
askain/TrainKoSpacing | [
"81bf4c3f2601341ceadb27b99d04565ca6bf45b4"
] | [
"train-with-kobert-pytorch.py"
] | [
"#keras\n#tensorflow\n#torch\n#pytorch_lightning\n#transformers\n#seqeval\n#sentencepiece\n\"\"\"\nhttps://bhchoi.github.io/post/nlp/dev/bert_korean_spacing_04/\n\"\"\"\n\nimport os\nfrom typing import Callable, List, Tuple\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport pytorch_lightn... | [
[
"torch.nn.Dropout",
"torch.stack",
"torch.max",
"torch.nn.functional.cross_entropy",
"torch.tensor",
"torch.utils.data.DataLoader"
]
] |
HiLab-git/WSL4MIS | [
"9683e7c7409b95c0ac2169fe7964f6ca04c80d9a",
"9683e7c7409b95c0ac2169fe7964f6ca04c80d9a"
] | [
"code/dataloaders/dataset_s2l.py",
"code/train_weakly_supervised_pCE_Entropy_Mini_2D.py"
] | [
"import itertools\nimport os\nimport random\nimport re\nfrom collections import defaultdict\nfrom glob import glob\n\nimport h5py\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport torch\nfrom scipy import ndimage\nfrom scipy.ndimage.interpolation import zoom\nfrom torch.utils.data import DataLoader, Data... | [
[
"numpy.rot90",
"numpy.array",
"torch.unique",
"scipy.ndimage.rotate",
"numpy.zeros",
"numpy.random.permutation",
"scipy.ndimage.interpolation.zoom",
"numpy.random.randint",
"torch.utils.data.DataLoader",
"numpy.flip"
],
[
"torch.nn.modules.loss.CrossEntropyLoss",
... |
nluehr/text | [
"1fd2039412faf537473e31f25df7ebe972475018"
] | [
"tensorflow_text/python/ops/normalize_ops.py"
] | [
"# coding=utf-8\n# Copyright 2022 TF.Text 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 required by appl... | [
[
"tensorflow.python.ops.array_ops.squeeze",
"tensorflow.python.ops.ragged.ragged_conversion_ops.from_tensor",
"tensorflow.python.ops.ragged.ragged_conversion_ops.to_tensor",
"tensorflow.python.ops.ragged.ragged_tensor.convert_to_tensor_or_ragged_tensor",
"tensorflow.python.ops.array_ops.expand_... |
uncharted-distil/d3m-primitives | [
"e8d37dbe302c0f2bae4e7f7fa241a46faebc9b79"
] | [
"kf_d3m_primitives/ts_forecasting/deep_ar/deepar_dataset.py"
] | [
"from typing import List, Union\n\nimport pandas as pd\nimport numpy as np\nfrom sklearn.preprocessing import OrdinalEncoder\nfrom gluonts.dataset.common import ListDataset\nfrom gluonts.dataset.field_names import FieldName\nfrom gluonts.distribution import NegativeBinomialOutput, StudentTOutput\n\n\nclass DeepARDa... | [
[
"numpy.min",
"sklearn.preprocessing.OrdinalEncoder"
]
] |
mnwhite/HARK | [
"788270ad5a2627feff1caeeaf961588b9101d18d"
] | [
"HARKsimulation.py"
] | [
"'''\nFunctions for generating simulated data and shocks.\n'''\n\nfrom __future__ import division\nimport warnings # A library for runtime warnings\nimport numpy as np # Numerical Python\n\ndef drawMeanOneLognormal(N, sigma=1.0, seed=0):\n '''\n Generate ar... | [
[
"numpy.asarray",
"numpy.random.RandomState",
"numpy.ones",
"numpy.exp",
"numpy.arange",
"numpy.cumsum"
]
] |
mslapek/skorch | [
"7a845682be15956a132c3817f0431177a620fee5"
] | [
"skorch/classifier.py"
] | [
"\"\"\"NeuralNet subclasses for classification tasks.\"\"\"\n\nimport re\n\nimport numpy as np\nfrom sklearn.base import ClassifierMixin\nimport torch\nfrom torch.utils.data import DataLoader\n\nfrom skorch import NeuralNet\nfrom skorch.callbacks import EpochTimer\nfrom skorch.callbacks import PrintLog\nfrom skorch... | [
[
"numpy.concatenate",
"torch.sigmoid",
"torch.finfo",
"numpy.stack",
"torch.log",
"numpy.unique"
]
] |
samsontmr/fairseq | [
"1d50b6dcd961faaa74ee32e9d7a02ff76f16ab87"
] | [
"fairseq/utils.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\nfrom collections import defaultdict\nimport contextlib\nimport copy\nimport importlib.util\nimport math\nimport os\nimport sys\nfrom... | [
[
"torch.cuda.manual_seed",
"torch.arange",
"torch.is_tensor",
"torch.norm",
"torch.nn.functional.log_softmax",
"torch.manual_seed",
"torch.LongTensor",
"torch.nn.functional.softmax",
"torch.remainder",
"torch.cumsum"
]
] |
uqyge/combustionML | [
"b0052fce732f38af478b26b5b2c0d9c94310c89e"
] | [
"XGB_combustion/prepareData.py"
] | [
"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport sklearn as sk\nfrom sklearn.preprocessing import MinMaxScaler\nimport os, sys\n\n# promt input for the case\npath = input('Which case? ')\n\ntimesteps_all = os.listdir(path)\ntimesteps_all = [f for f in timesteps_all if os.path.isdir(... | [
[
"pandas.read_csv"
]
] |
minkcho/mal2d | [
"8f94b267ae4645fe97c1b839ce0190f7cf77f693"
] | [
"additional_log/s_mal2d01_2xa-ref-adagrad.py"
] | [
"#!/usr/bin/env python\n# coding: utf-8\n\n# In[1]:\n\n\n###################\n# data processing #\n###################\nimport pandas as pd\nimport fnmatch\nimport os\nimport math\nimport numpy as np\nimport sys\n\nbyte_size = 256*256\n\nif len(sys.argv) == 2:\n byte_size = int(sys.argv[1]) * int(sys.argv[1]) \n... | [
[
"numpy.concatenate",
"numpy.random.seed",
"numpy.sum",
"tensorflow.Session",
"numpy.load",
"sklearn.metrics.classification_report",
"tensorflow.ConfigProto",
"sklearn.metrics.auc",
"sklearn.metrics.roc_curve"
]
] |
helgee/icatt-2016 | [
"0fb1012b3639a6d6c53d80cd00b43b72a67b8022"
] | [
"python/icatt/lambert.py"
] | [
"import time\nimport numpy as np\nfrom math import gamma\n\nfrom numba import jit, njit\n\ndef benchmark(times):\n r0 = np.array([5000.0, 10000.0, 2100.0])\n r = np.array([-14600.0, 2500.0, 7000.0])\n tof = 3600.0\n mu = 3.986004418e5\n lambert(mu, r0, r, tof)\n\n best = np.inf\n worst = -np.in... | [
[
"numpy.array",
"numpy.dot",
"numpy.sqrt",
"numpy.abs"
]
] |
nekto-nekto/imgfind | [
"2e0c3853c564f58e514dd4b30c2fed951ec8fde0"
] | [
"tests/utils/test_color_from_str.py"
] | [
"# coding=utf-8\nimport numpy as np\nimport pytest\n\nfrom imgfind.utils.color import color_from_str\n\n\n@pytest.mark.parametrize(\n \"color,exp_result\",\n (\n (\"red\", (1, 0, 0)),\n (\"magenta\", (1, 0, 1)),\n (\"green\", (0, 0.5, 0)),\n (\"aliceblue\", (0.94, 0.97, 1)),\n ... | [
[
"numpy.testing.assert_allclose"
]
] |
qzhu2017/crystallography | [
"51a9cd1c3d826fbd21da7f9e0cb6ffcc230c2d7f"
] | [
"pyxtal/wyckoff_site.py"
] | [
"\"\"\"\nModule for handling Wyckoff sites for both atom and molecule\n\"\"\"\n\n# Standard Libraries\nimport numpy as np\nfrom scipy.spatial.transform import Rotation as R\nfrom scipy.spatial.distance import cdist\n\n# External Libraries\nfrom pymatgen.core import Molecule\n\n# PyXtal imports\nfrom pyxtal.toleranc... | [
[
"numpy.dot",
"numpy.argmin",
"numpy.min",
"numpy.exp",
"scipy.spatial.transform.Rotation.from_matrix",
"numpy.max",
"numpy.linalg.norm",
"numpy.eye",
"numpy.append",
"numpy.random.sample",
"numpy.linalg.inv",
"numpy.vstack",
"numpy.array",
"numpy.zeros",
... |
Galeos93/disaster_tweets | [
"7be3a7935c3f4d91dcf4ed218b6064f01f782436"
] | [
"disaster_tweets/model/metric.py"
] | [
"import torch\n\n\ndef accuracy(output, target):\n with torch.no_grad():\n threshold = 0.5\n pred = torch.sigmoid(output)\n pred = torch.where(pred > threshold, 1, 0)\n assert pred.shape[0] == len(target)\n correct = 0\n correct += torch.sum(pred == target).item()\n r... | [
[
"torch.sigmoid",
"torch.no_grad",
"torch.topk",
"torch.where",
"torch.sum"
]
] |
leeleavitt/procPharm | [
"b09ce82a76658cf46c7427b0c106822c8cadfdf7"
] | [
"python_packages/python_pharmer/python_pharmer/nd2reader/parser.py"
] | [
"# -*- coding: utf-8 -*-\nimport struct\n\nimport array\nimport six\nfrom pims.base_frames import Frame\nimport numpy as np\n\nfrom .common import get_version, read_chunk\nfrom .exceptions import InvalidVersionError, NoImageError\nfrom .label_map import LabelMap\nfrom .raw_metadata import RawMetadata\n\n\nclass Par... | [
[
"numpy.any",
"numpy.reshape"
]
] |
dion-w/PyBaMM | [
"aeb9bcc82bb5dc3fba4fa045c4cad9d2d41b6359"
] | [
"tests/integration/test_solvers/test_idaklu.py"
] | [
"import pybamm\nimport numpy as np\nimport sys\nimport unittest\n\n\n@unittest.skipIf(not pybamm.have_idaklu(), \"idaklu solver is not installed\")\nclass TestIDAKLUSolver(unittest.TestCase):\n def test_on_spme(self):\n model = pybamm.lithium_ion.SPMe()\n geometry = model.default_geometry\n ... | [
[
"numpy.testing.assert_array_less",
"numpy.testing.assert_allclose",
"numpy.linspace"
]
] |
XavierJingfeng/starter | [
"274566e491d5c7157f3c8deff136c56838022349"
] | [
"tests/fixtures/tf/instrumented_npo.py"
] | [
"\"\"\"This file is a copy of garage/tf/algos/npo.py\n\nThe only difference is the use of InstrumentedBatchPolopt to notify the test of\nthe different stages in the experiment lifecycle.\n\"\"\"\nfrom enum import Enum\nfrom enum import unique\n\nimport numpy as np\nimport tensorflow as tf\n\nfrom garage.logger impo... | [
[
"numpy.concatenate",
"tensorflow.nn.batch_normalization",
"tensorflow.reduce_min",
"tensorflow.minimum",
"tensorflow.reshape",
"tensorflow.nn.moments",
"tensorflow.constant",
"tensorflow.placeholder",
"tensorflow.name_scope",
"tensorflow.nn.softplus",
"tensorflow.reduce... |
thomasms/trafficwatch | [
"58368436b24277c26daddc740b052d6d80939827"
] | [
"traffic/tools/optimaltime.py"
] | [
"#!/usr/bin/env python3\nimport sys\nimport pytz\nimport datetime\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.dates as mdates\n\nfrom traffic.core.api import getOptimalRouteTime\n\n\ndef main():\n origin_address = \"Savoy+Ct,+London+WC2R+0EZ\"\n destination_address = \"Francis+St,+... | [
[
"matplotlib.pyplot.savefig",
"matplotlib.dates.DateFormatter",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.show"
]
] |
NCTUMLlab/Chi-Hang-Leong-Online_Compressive_Transformer_for_Speech_Recognition | [
"3f159ba9cf1ca9baabf0782d8acef4bb7332d8b9"
] | [
"online_inference_GUI/main.py"
] | [
"import time\nfrom threading import Thread,Event\nimport numpy as np\nimport torch\nimport time\nfrom espnet.asr.pytorch_backend.asr_init import load_trained_model\nimport torchaudio\nimport argparse\nimport pickle\nfrom espnet.nets.pytorch_backend.nets_utils import pad_list\nfrom online_inference import online_inf... | [
[
"numpy.square",
"torch.cat",
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"numpy.subtract",
"numpy.sqrt",
"torch.std_mean",
"torch.as_tensor"
]
] |
WestHuman/PYPI | [
"c34caa4ca26c06c57a06b37fc2d272863dfab31f"
] | [
"PYPI_siddharth_101816019/topsis/__init__.py"
] | [
"import numpy as np\r\nfrom scipy.stats import rankdata\r\nfrom tabulate import tabulate\r\n\r\ndef main():\r\n import sys\r\n import pandas as pd\r\n if len(sys.argv)!=4:\r\n print(\"Error. Wrong number of parameters inserted \")\r\n print(\"USAGES: $python <programName> <dataset> <weights a... | [
[
"pandas.read_csv",
"scipy.stats.rankdata",
"numpy.arange",
"numpy.zeros"
]
] |
Dan-Eli/geo-deep-learning | [
"40b1ac8d62a3c2722c829cb07d96488927a4e851"
] | [
"augmentation.py"
] | [
"import torch\n# import torch should be first. Unclear issue, mentioned here: https://github.com/pytorch/pytorch/issues/2083\nimport random\nimport numpy as np\nfrom skimage import transform, exposure\n\n\nclass RandomRotationTarget(object):\n \"\"\" Rotate the image and target randomly. The rotation degree is b... | [
[
"numpy.percentile",
"torch.from_numpy",
"numpy.random.uniform",
"numpy.transpose",
"numpy.int64"
]
] |
aleSuglia/cvdn | [
"98469b2bb1be00c65e56a100d690879eb82a9181"
] | [
"scripts/extract_cvdn_images.py"
] | [
"#!/usr/bin/env python\n\n''' Script to precompute image features using a Caffe ResNet CNN, using 36 discretized views\n at each viewpoint in 30 degree increments, and the provided camera WIDTH, HEIGHT\n and VFOV parameters. '''\n\nimport argparse\nimport csv\nimport json\nimport math\nimport os\nimport sys\n... | [
[
"numpy.float32"
]
] |
Youth-Got/mmdetection | [
"ca11860f4f3c3ca2ce8340e2686eeaec05b29111",
"ca11860f4f3c3ca2ce8340e2686eeaec05b29111"
] | [
"mmdet/models/necks/dilated_encoder.py",
"mmdet/datasets/pipelines/loading.py"
] | [
"# Copyright (c) OpenMMLab. All rights reserved.\nimport torch.nn as nn\nfrom mmcv.cnn import (ConvModule, caffe2_xavier_init, constant_init, is_norm,\n normal_init)\nfrom torch.nn import BatchNorm2d\n\nfrom ..builder import NECKS\n\n\nclass Bottleneck(nn.Module):\n \"\"\"Bottleneck block fo... | [
[
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d"
],
[
"numpy.zeros_like",
"numpy.array",
"numpy.zeros",
"numpy.ones",
"numpy.where",
"numpy.stack"
]
] |
jojoduquartier/dsdbmanager | [
"9abb7b14e44be2d9f6d80a0dff412e0e1382aab8",
"9abb7b14e44be2d9f6d80a0dff412e0e1382aab8"
] | [
"dsdbmanager/utils.py",
"test/test_dbobject.py"
] | [
"import typing\nimport functools\nimport toolz\nimport pandas as pd\nimport numpy as np\nimport sqlalchemy as sa\nimport sqlalchemy.orm as orm\nimport sqlalchemy.sql.elements as sqlelements\nfrom .exceptions_ import BadArgumentType, NoSuchColumn\n\nfunction_type_for_dframe = typing.Callable[..., typing.Tuple[np.nda... | [
[
"pandas.DataFrame"
],
[
"pandas.DataFrame",
"pandas.read_sql"
]
] |
williamBlazing/cudf | [
"072785e24fd59b6f4eeaad3b54592a8c803ee96b",
"072785e24fd59b6f4eeaad3b54592a8c803ee96b"
] | [
"python/cudf/cudf/tests/test_dtypes.py",
"python/cudf/cudf/core/dtypes.py"
] | [
"import pandas as pd\nimport pytest\n\nimport cudf\nfrom cudf.core.dtypes import CategoricalDtype\nfrom cudf.tests.utils import assert_eq\n\n\ndef test_cdt_basic():\n psr = pd.Series([\"a\", \"b\", \"a\", \"c\"], dtype=\"category\")\n sr = cudf.Series([\"a\", \"b\", \"a\", \"c\"], dtype=\"category\")\n ass... | [
[
"pandas.CategoricalDtype",
"pandas.Series"
],
[
"pandas.CategoricalDtype"
]
] |
MIPT-Oulu/3D-Histo-Grading | [
"b779a154d0e5b104fc152c8952124768fb7b1dc6"
] | [
"training/components/grading/pca_regression.py"
] | [
"\"\"\"Contains resources for PCA dimensionality reduction and creating regression models.\"\"\"\n\nimport numpy as np\nimport shap\nimport matplotlib.pyplot as plt\n\n\nfrom joblib import dump\nfrom pathlib import Path\nfrom time import strftime\n\nfrom matplotlib import pyplot as plt\nfrom sklearn.linear_model im... | [
[
"sklearn.model_selection.LeaveOneGroupOut",
"sklearn.linear_model.LinearRegression",
"numpy.exp",
"numpy.mean",
"sklearn.metrics.r2_score",
"numpy.concatenate",
"numpy.log",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"sklearn.decomposition.PCA",
"numpy.vstack",
"num... |
adriendelsalle/numpy-benchmarks | [
"5c09448d045726b347e868756f9e1b004d0876ea"
] | [
"numpy_benchmarks/benchmarks/evolve.py"
] | [
"#setup: import numpy as np ; grid_shape = (512, 512) ; grid = np.zeros(grid_shape) ; block_low = int(grid_shape[0] * .4) ; block_high = int(grid_shape[0] * .5) ; grid[block_low:block_high, block_low:block_high] = 0.005\n#run: evolve(grid, 0.1)\n#from: High Performance Python by Micha Gorelick and Ian Ozsvald, http... | [
[
"numpy.roll"
]
] |
kajili/GreensOnly | [
"a92d7360a8cd8bc3f998a005684b3787d9b2a0b3"
] | [
"scripts/colored_region_detection/c_r_d.py"
] | [
"import sys\nimport os\nimport numpy as np\nimport cv2\nimport math\nimport argparse\nimport time\n\n\nimage_folder = './test_images'\nmin_region_size = 14400\n\n# rect = ((min_x, min_y), (max_x, max_y))\ndef place_bounding_box(image, rect):\n\timage = cv2.rectangle(image,(rect[0][1],rect[0][0]),(rect[1][1],rect[1]... | [
[
"numpy.array_equal"
]
] |
shaoormunir/bert | [
"f688e09801bedacf2e1be3ee4f69e1f68349d521"
] | [
"create_pretraining_data.py"
] | [
"# coding=utf-8\n# Copyright 2018 The Google AI Language Team 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# Unl... | [
[
"tensorflow.logging.set_verbosity",
"tensorflow.train.Features",
"tensorflow.gfile.Glob",
"tensorflow.python_io.TFRecordWriter",
"tensorflow.logging.info",
"tensorflow.gfile.GFile",
"tensorflow.app.run"
]
] |
abcbdf/ADC | [
"0e35dcc61aec005ec1d120fcecef3a40fd55af63"
] | [
"TDPlusModel.py"
] | [
"import torch\nfrom typing import Callable, Optional\nfrom torch.nn import Parameter\nfrom torch_geometric.nn import MessagePassing\nfrom torch_geometric.nn.inits import glorot, zeros\nfrom torch_geometric.utils import add_self_loops, degree\nfrom scipy.special import factorial\nfrom torch_geometric.data import Dat... | [
[
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.init.constant_",
"torch.nn.functional.log_softmax",
"torch.nn.ReLU",
"torch.nn.functional.softmax",
"torch.Tensor"
]
] |
Yzx835/AISafety | [
"eb09551814898c7f6d86641b47faf7845c948640",
"eb09551814898c7f6d86641b47faf7845c948640"
] | [
"Models/TestModel/roberta_ifeng.py",
"test/cifartonpy.py"
] | [
"# !/usr/bin/env python\n# coding=UTF-8\n\"\"\"\n@Author: WEN Hao\n@LastEditors: WEN Hao\n@Description:\n@Date: 2021-11-19\n@LastEditTime: 2022-04-01\n\n预置模型,roberta_chinanews\n\"\"\"\n\nimport os\nfrom typing import NoReturn, Optional, Union, Sequence, List\n\nimport torch\nimport numpy as np\nimport transformers\... | [
[
"torch.no_grad"
],
[
"numpy.concatenate",
"numpy.array",
"numpy.zeros",
"numpy.load",
"numpy.unique"
]
] |
jbkoh/hvacmeter | [
"7a801d61d48a98298add9ba95db0940797feaadd"
] | [
"preload_data.py"
] | [
"import pdb\nimport json\nimport arrow\nimport rdflib\nimport pandas as pd\nfrom functools import reduce\ndef updater(x, y):\n x.update(y)\n return x\n\nfrom building_depot import DataService, BDError\nfrom bd3client.CentralService import CentralService as bd3cs\nfrom bd3client.Sensor import Sensor as bd3sens... | [
[
"pandas.Series"
]
] |
Kemok-Repos/kemokrw | [
"bfe2a82e2ef5d3580ed5dfe65129b30bd3fc4971"
] | [
"src/kemokrw/extract_gsheet.py"
] | [
"from kemokrw.extract import Extract\nfrom kemokrw.func_db import model_format_check\nfrom kemokrw.func_api import extract_metadata, match_model, query_model_from_db\nimport pandas as pd\n\n\nclass ExtractGSheet(Extract):\n \"\"\"Clase ExtractGSheet implementación de la clase Extract.\n\n Cumple la función de... | [
[
"pandas.DataFrame"
]
] |
CBIIT/NCI-DOE-Collab-Pilot1-Unified-Drug-Response-Predictor-Multi-tasking | [
"93ac7706741a22ef091fae3bf555d7271fe27bee"
] | [
"common/keras_utils.py"
] | [
"from __future__ import absolute_import\n\n\nfrom tensorflow.keras import backend as K\nfrom tensorflow.keras import optimizers\nfrom tensorflow.keras import initializers\n\nfrom tensorflow.keras.layers import Dropout\nfrom tensorflow.keras.callbacks import Callback\nfrom tensorflow.keras.utils import get_custom_ob... | [
[
"tensorflow.keras.optimizers.SGD",
"sklearn.metrics.r2_score",
"tensorflow.compat.v1.set_random_seed",
"tensorflow.keras.metrics.binary_crossentropy",
"tensorflow.keras.initializers.glorot_uniform",
"tensorflow.keras.initializers.he_normal",
"tensorflow.get_default_graph",
"tensorf... |
lethaiq/machin | [
"7873cada457328952310394afeedcad4bb6a7c4a"
] | [
"examples/tutorials/your_first_program/main.py"
] | [
"from machin.frame.algorithms import DQN\nfrom machin.utils.logging import default_logger as logger\nfrom machin.model.nets import static_module_wrapper, dynamic_module_wrapper\nimport torch as t\nimport torch.nn as nn\nimport gym\n\n# configurations\nenv = gym.make(\"CartPole-v0\")\nobserve_dim = 4\naction_num = 2... | [
[
"torch.nn.Linear",
"torch.no_grad",
"torch.tensor",
"torch.nn.MSELoss"
]
] |
zdu863/3dcorrelation | [
"1683ee0af665e68924e67a11bffda26ab3269fe5"
] | [
"tests/ccl_test_distances.py"
] | [
"import numpy as np\nfrom numpy.testing import assert_allclose, run_module_suite\nimport pyccl as ccl\nfrom os.path import dirname,join,abspath\n# Set tolerances\nDISTANCES_TOLERANCE = 1e-4\n\n# Set up the cosmological parameters to be used in each of the models\n# Values that are the same for all 5 models\nOmega_c... | [
[
"numpy.testing.assert_allclose",
"numpy.array",
"numpy.testing.run_module_suite"
]
] |
trivoldus28/gunpowder | [
"97e9e64709fb616e2c47567b22d5f11a9234fe48",
"97e9e64709fb616e2c47567b22d5f11a9234fe48",
"97e9e64709fb616e2c47567b22d5f11a9234fe48"
] | [
"gunpowder/nodes/csv_points_source.py",
"gunpowder/nodes/scan.py",
"tests/cases/batch.py"
] | [
"import numpy as np\nimport logging\nfrom gunpowder.batch import Batch\nfrom gunpowder.coordinate import Coordinate\nfrom gunpowder.nodes.batch_provider import BatchProvider\nfrom gunpowder.graph import Node, Graph\nfrom gunpowder.graph_spec import GraphSpec\nfrom gunpowder.profiling import Timing\nfrom gunpowder.r... | [
[
"numpy.ones",
"numpy.amax",
"numpy.logical_and",
"numpy.amin"
],
[
"numpy.array",
"numpy.zeros"
],
[
"numpy.zeros"
]
] |
nuaalixu/MatrixSlow | [
"490b7114130919b3d0f0320018308313951f8478"
] | [
"example/ch06/fm_titanic.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Mar 4 20:38:10 2020\n\n@author: chaos\n\"\"\"\n\nimport sys\nsys.path.append('../..')\n\nimport numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import LabelEncoder, OneHotEncoder\nimport matrixslow as ms\n\n# 读取数据,去掉无用列\ndata = pd.read_csv(\"../../data/... | [
[
"numpy.array",
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.preprocessing.OneHotEncoder",
"numpy.mat"
]
] |
saeedshakeri/CodART | [
"ce203b26883ae73d4665e552482d7afe115123a0"
] | [
"metrics/naming.py"
] | [
"\"\"\"\nScript for detecting naming smells in the source code.\n\n\"\"\"\nimport sys\nfrom copy import deepcopy\nimport re as re\nimport random\nfrom collections import Counter\nfrom typing import List\n\nimport numpy as np\nfrom scipy.spatial import distance\n\nfrom sklearn.decomposition import PCA\nfrom sklearn.... | [
[
"numpy.array",
"numpy.add",
"numpy.percentile",
"matplotlib.pyplot.legend",
"numpy.mean",
"matplotlib.pyplot.subplots",
"sklearn.neighbors.NearestNeighbors",
"numpy.greater_equal",
"numpy.less_equal",
"numpy.subtract",
"scipy.spatial.distance.cosine",
"matplotlib.py... |
huryu/DL_Dabry | [
"8bab1db3458d2c467e347eed428f53cf9376990a"
] | [
"Codes_for_ROC_AUC.py"
] | [
"#!/usr/bin/env python\n# coding: utf-8\n\n# In[1]:\n\n\n#!/usr/bin/env python3\n\n#################\n# Module import #\n#################\n\nimport os, sys, glob, pickle, h5py\nimport numpy as np\nimport pandas as pd\nimport matplotlib\n#matplotlib.use('Agg')\nimport matplotlib.pyplot as plt\nfrom datetime import ... | [
[
"matplotlib.pyplot.subplot",
"numpy.array",
"matplotlib.pyplot.xlim",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.plot",
"numpy.load",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figure",
"numpy.where",
"matplotlib.pyplot.show",
"numpy.arange... |
zhourunlong/densenet-ag_news-nlp | [
"38dcf5a18386a3155593d74e3eba6d967501b242"
] | [
"src/han/train.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\n@author: \n - Charles-Emmanuel DIAS <Charles-Emmanuel.Dias@lip6.fr>\n - Ardalan Mehrani <ardalan77400@gmail.com>\n@brief:\n\"\"\"\n\nimport os\nimport re\nimport torch\nimport lmdb\nimport pickle\nimport argparse\nimport numpy as np\nimport torch.nn as nn\nimport pic... | [
[
"numpy.concatenate",
"torch.optim.lr_scheduler.StepLR",
"numpy.zeros",
"numpy.sum",
"torch.save",
"torch.nn.functional.softmax",
"numpy.diag",
"torch.nn.CrossEntropyLoss"
]
] |
jamesobutler/SlicerNetstim | [
"f13c8eb8996f9cd04375cf3ec845c919b12b87ae"
] | [
"StereotacticPlan/StereotacticPlanLib/util.py"
] | [
"import slicer, vtk, qt\nimport numpy as np\nimport re\nfrom datetime import datetime\n\n\nclass StereotaxyReport():\n\n def __init__(self, PDFPath):\n try:\n import pdfplumber\n except:\n slicer.util.pip_install('pdfplumber')\n import pdfplumber \n \n self.pdf = pdfplumber.open(PDF... | [
[
"numpy.array",
"numpy.append"
]
] |
RunxinXu/pytorch-distributed | [
"be1e34fee968142dc4e9b5adaf8a14b34943388d"
] | [
"apex_distributed.py"
] | [
"# https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py\n\nimport csv\n\nimport argparse\nimport os\nimport random\nimport shutil\nimport time\nimport warnings\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.parallel\nimport torch.backends.cudnn as cudnn\nimport torch.distributed as dist... | [
[
"torch.nn.Linear",
"torch.arange",
"torch.distributed.init_process_group",
"torch.nn.CrossEntropyLoss",
"torch.ones",
"torch.nn.ReLU",
"torch.cuda.set_device",
"torch.utils.data.DataLoader",
"torch.randn"
]
] |
montimaj/HydroSAR | [
"c76022a914bd095ecae41d56a2a1dff5c1c1a970"
] | [
"Python_Files/hydrolibs/result_analysis.py"
] | [
"# Author: Sayantan Majumdar\n# Email: smxnv@mst.edu\n\nimport pandas as pd\nfrom Python_Files.hydrolibs.sysops import makedirs\nfrom glob import glob\n\n\ndef create_merged_results(input_dir, remove_cols=('Test', 'F_IMP')):\n \"\"\"\n Create a merged results csv from multiple CSVs\n :param input_dir: Inpu... | [
[
"pandas.DataFrame",
"pandas.read_csv",
"pandas.concat"
]
] |
norabelrose/transformers | [
"0639f72ebcc008dac59757bc5c38d6f074301491"
] | [
"src/transformers/models/electra/modeling_tf_electra.py"
] | [
"# coding=utf-8\n# Copyright 2019 The Google AI Language Team Authors and The HuggingFace Inc. team.\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/... | [
[
"tensorflow.keras.layers.Add",
"tensorflow.matmul",
"tensorflow.reshape",
"tensorflow.keras.layers.Dense",
"tensorflow.tile",
"tensorflow.nn.softmax",
"tensorflow.divide",
"tensorflow.cast",
"tensorflow.transpose",
"tensorflow.constant",
"tensorflow.squeeze",
"tenso... |
ashirwadsangwan/Python | [
"b4e570bb31783178d241b9f2a7145343d830b698"
] | [
"PyTorch/Learning/auto_grad.py"
] | [
"import torch\nimport pdb\n\nx_data = [1.0, 2.0, 3.0, 4.0]\ny_data = [2.0, 4.0, 6.0, 8.0]\nw = torch.tensor([1.0], requires_grad=True)\n\n\n# our model forward pass\ndef forward(x):\n return x * w\n\n\n# Loss function\ndef loss(y_pred, y_val):\n return (y_pred - y_val) ** 2\n\n\n# Before training\nprint(\"Pre... | [
[
"torch.tensor"
]
] |
JohnCremona/sage | [
"5cb72aade9b297c10bb0f1ae8529466e5b5eb41d"
] | [
"src/sage/plot/bezier_path.py"
] | [
"r\"\"\"\nBezier Paths\n\"\"\"\n#*****************************************************************************\n# Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com>,\n# William Stein <wstein@gmail.com>,\n# 2008 Mike Hansen <mhansen@gmail.com>,\n# ... | [
[
"matplotlib.path.Path",
"numpy.array",
"matplotlib.patches.PathPatch"
]
] |
lucienraeg/a-maj | [
"dfc3afef427de0f5b25a5fd117b51da6fab279c7"
] | [
"example-stocks.py"
] | [
"import pandas as pd\nimport pandas.io.data as web\nimport datetime\n\n\"\"\" import tdl\nimport amaj\nimport colors as col\n\n''' initialize '''\n\n# terminal\nt = amaj.Terminal(64, 24)\n\n# subreddit panel\nlist_panel = t.create_window(0, 0, 16, 24)\n[list_panel.draw_char(15, i, None, None, col.BASE00) for i in r... | [
[
"pandas.io.data.DataReader"
]
] |
alexpostnikov/Backprop-MPDM_torch | [
"72d51cc2bbb838a12b9093b2aa8c9c55e40c56e9"
] | [
"scripts/NN/datasets/evaluate.py"
] | [
"import sys\nimport os\nimport dill\nimport json\nimport argparse\nimport torch\nimport numpy as np\nimport pandas as pd\nfrom tqdm import tqdm\nfrom scipy.stats import gaussian_kde\nfrom Dataloader import Dataset_from_pkl\n\nsys.path.append(\"../../\")\nimport Utils\nfrom Param import ROS_Param\nparam = ROS_Param(... | [
[
"torch.rand",
"numpy.linalg.norm",
"torch.cuda.manual_seed_all",
"numpy.random.seed",
"numpy.mean",
"torch.manual_seed",
"scipy.stats.gaussian_kde",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"torch.load"
]
] |
adi-nawal/Iris-Recognition | [
"1cec1471776e0b023e6629ea2e9fedf8ae659354"
] | [
"python/fnc/encode.py"
] | [
"##-----------------------------------------------------------------------------\n## Import\n##-----------------------------------------------------------------------------\nimport numpy as np\n\n\n##-----------------------------------------------------------------------------\n## Function\n##--------------------... | [
[
"numpy.zeros",
"numpy.log",
"numpy.real",
"numpy.fft.fft",
"numpy.arange",
"numpy.abs",
"numpy.imag",
"numpy.fft.ifft"
]
] |
RPGroup-PBoC/fit_seq | [
"7cc7931fd2edf421591de293354348fb940a1a32"
] | [
"code/processing/growth_curves_plate_reader/20210211_r2_MG1655_319_UV5_tc/growth_plate_reader_layout.py"
] | [
"#%%\n# -*- coding: utf-8 -*-\nimport numpy as np\nimport pandas as pd\nimport os\nimport glob\nimport matplotlib\nimport matplotlib.pyplot as plt\nfrom matplotlib import cm\nfrom matplotlib import colors\nimport seaborn as sns\nimport fit_seq.viz\nimport git\n\n# Find home directory for repo\nrepo = git.Repo(\"./\... | [
[
"numpy.random.choice",
"pandas.DataFrame",
"pandas.read_excel",
"matplotlib.pyplot.savefig",
"pandas.ExcelFile"
]
] |
minsu1206/ssdlite_revision | [
"ed7ab8d1aa87fd75c299f5994475a564b50c0d3d"
] | [
"vision/nn/alexnet.py"
] | [
"import torch.nn as nn\r\nimport torch.utils.model_zoo as model_zoo\r\n\r\n# copied from torchvision (https://github.com/pytorch/vision/blob/master/torchvision/models/alexnet.py).\r\n# The forward function is modified for model pruning.\r\n\r\n__all__ = ['AlexNet', 'alexnet']\r\n\r\n\r\nmodel_urls = {\r\n 'alexn... | [
[
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.nn.MaxPool2d",
"torch.utils.model_zoo.load_url",
"torch.nn.ReLU",
"torch.nn.Conv2d"
]
] |
brettkoonce/qml | [
"fe78edd7e724ee18acf6ea5c30fd96aafe179e09"
] | [
"demonstrations/tutorial_ensemble_multi_qpu.py"
] | [
"r\"\"\"\r\nEnsemble classification with Forest and Qiskit devices\r\n=======================================================\r\n\r\n.. meta::\r\n :property=\"og:description\": We demonstrate how two QPUs can be\r\n combined in parallel to help solve a machine learning classification problem,\r\n u... | [
[
"numpy.max",
"matplotlib.lines.Line2D",
"numpy.array",
"torch.nn.functional.softmax",
"torch.max",
"numpy.random.seed",
"matplotlib.pyplot.xlabel",
"numpy.load",
"numpy.min",
"matplotlib.patches.Patch",
"matplotlib.pyplot.ylabel",
"numpy.append",
"matplotlib.pyp... |
yuzhenpeng/PhyKIT | [
"167b9dfe0dd0bddd4b23492d9a3dc34e56debbd7"
] | [
"phykit/services/tree/covarying_evolutionary_rates.py"
] | [
"import getopt\nimport logging\nimport os.path\nimport sys\n\nfrom scipy.stats import zscore\nfrom scipy.stats.stats import pearsonr\n\nfrom Bio import Phylo\nfrom Bio.Phylo.BaseTree import TreeMixin\n\nfrom .base import Tree\n\nclass CovaryingEvolutionaryRates(Tree):\n def __init__(self, args) -> None:\n ... | [
[
"scipy.stats.zscore",
"scipy.stats.stats.pearsonr"
]
] |
wangaxe/kmeans_defense | [
"2dc0ac9aa7fea1bffcacdbf3f0f02694f3b6a328"
] | [
"Evaluation/ImageNet_demo.py"
] | [
"import torch\nfrom torch.autograd import Variable\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torchvision.utils import save_image\n# from torchsummary import summary\nimport matplotlib.pyplot as plt\nimport numpy as np\n# import cv2\nimport argparse\n# from model_mnist import Basic_CNN,modelA,mod... | [
[
"torch.max",
"torch.manual_seed",
"torch.cuda.empty_cache",
"torch.utils.data.DataLoader",
"torch.Tensor"
]
] |
murawaki/creole-mixture | [
"dfe585f2c8d698b24c022ec0933ce30925410cfe"
] | [
"scripts/format_apics/simplex.py"
] | [
"#\n# plot model parameters on a simplex\n#\nimport sys, os\nfrom argparse import ArgumentParser\nimport codecs\nimport numpy as np\nfrom scipy.misc import logsumexp\nfrom scipy.stats import gaussian_kde\nimport matplotlib.pyplot as plt\nfrom matplotlib.tri import UniformTriRefiner, Triangulation\n\nsys.path.insert... | [
[
"numpy.array",
"matplotlib.font_manager.FontProperties",
"matplotlib.pyplot.annotate",
"numpy.sin",
"numpy.zeros",
"matplotlib.pyplot.savefig",
"matplotlib.tri.Triangulation",
"numpy.exp",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.triplot",
"matplotlib.pyplot.scatt... |
iris-edu/piqqa | [
"4824de3494dede5c6a1bcf744a3971248492776d"
] | [
"reportUtils.py"
] | [
"'''\n:copyright:\n Copyright (C) 2021 Laura Keyson, IRIS Data Management Center\n \n:license: \n Licensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership... | [
[
"pandas.to_datetime",
"numpy.sin",
"pandas.merge",
"numpy.log",
"pandas.DataFrame",
"pandas.concat",
"pandas.read_csv"
]
] |
imsanika03/TrainYourOwnYOLO | [
"c03d78f1d9594b44f39096bfb8aa018dfcfff908"
] | [
"2_Training/Train_YOLO.py"
] | [
"\"\"\"\nMODIFIED FROM keras-yolo3 PACKAGE, https://github.com/qqwweee/keras-yolo3\nRetrain the YOLO model for your own dataset.\n\"\"\"\n\nimport os\nimport sys\nimport argparse\n\n\ndef get_parent_dir(n=1):\n \"\"\" returns the n-th parent dicrectory of the current\n working directory \"\"\"\n current_pa... | [
[
"numpy.random.seed",
"numpy.array",
"numpy.random.shuffle"
]
] |
sajastu/RedSumm2021 | [
"4c08d6a1f48a64774635512b16afb9c312331ce7"
] | [
"src/models/model_builder.py"
] | [
"import copy\n\nimport torch\nimport torch.nn as nn\nfrom transformers import BertModel, BertConfig\nfrom torch.nn.init import xavier_uniform_\n\nfrom models.decoder import TransformerDecoder\nfrom models.encoder import Classifier, ExtTransformerEncoder\nfrom models.optimizers import Optimizer\n\ndef build_optim(ar... | [
[
"torch.nn.LogSoftmax",
"torch.nn.Linear",
"torch.is_tensor",
"torch.no_grad",
"torch.nn.init.xavier_uniform_",
"torch.nn.Embedding"
]
] |
oatsu-gh/nnmnkwii | [
"99a0455dc36b4f5ded3456a8807d849c310145bb"
] | [
"tests/test_pack_pad_sequence.py"
] | [
"from __future__ import division, print_function, absolute_import\n\nfrom nnmnkwii.datasets import FileSourceDataset, PaddedFileSourceDataset\nfrom nnmnkwii.datasets import MemoryCacheFramewiseDataset\nfrom nnmnkwii.datasets import MemoryCacheDataset\nfrom nnmnkwii.util import example_file_data_sources_for_acoustic... | [
[
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM",
"torch.nn.MSELoss",
"torch.autograd.Variable",
"torch.from_numpy",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.utils.data.DataLoader",
"torch.nn.utils.rnn.pack_padded_sequence"
]
] |
skvorekn/evalml | [
"2cbfa344ec3fdc0fb0f4a0f1093811135b9b97d8",
"2cbfa344ec3fdc0fb0f4a0f1093811135b9b97d8"
] | [
"evalml/pipelines/components/transformers/preprocessing/delayed_feature_transformer.py",
"evalml/model_understanding/graphs.py"
] | [
"import pandas as pd\nfrom sklearn.preprocessing import LabelEncoder, OrdinalEncoder\nfrom woodwork import logical_types\n\nfrom evalml.pipelines.components.transformers.transformer import Transformer\nfrom evalml.utils import (\n _convert_woodwork_types_wrapper,\n _retain_custom_types_and_initalize_woodwork,... | [
[
"pandas.DataFrame",
"sklearn.preprocessing.LabelEncoder",
"sklearn.preprocessing.OrdinalEncoder",
"pandas.Series"
],
[
"sklearn.metrics.confusion_matrix",
"numpy.tile",
"numpy.mean",
"sklearn.exceptions.NotFittedError",
"numpy.concatenate",
"sklearn.metrics.precision_re... |
rwoodsrobinson/mcu | [
"6bd8f29cffa4afb1a057322ea349a4889bffbe14"
] | [
"mcu/vasp/vasprun.py"
] | [
"#!/usr/bin/env python\n'''\nmcu: Modeling and Crystallographic Utilities\nCopyright (C) 2019 Hung Q. Pham. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http... | [
[
"matplotlib.pyplot.xlim",
"numpy.argmin",
"matplotlib.pyplot.xticks",
"numpy.concatenate",
"matplotlib.pyplot.colorbar",
"numpy.count_nonzero",
"numpy.empty",
"matplotlib.pyplot.clim",
"numpy.argmax",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.zlim",
"matp... |
zhangbo2008/keras-deeplab-v3-plus | [
"40bb38d2394611d2be66bea4668be756734deeaf"
] | [
"2312312312312.py"
] | [
"from tensorflow.python.keras.utils.data_utils import get_file\n\n\nweights_path = get_file('deeplabv3_xception_tf_dim_ordering_tf_kernels_cityscapes.h5',\n 'sdfsdf',\n cache_dir='models',\n cache_subdir='.')\n\n\nprint(wei... | [
[
"tensorflow.python.keras.utils.data_utils.get_file"
]
] |
sfarrens/lenspack | [
"b7a8d6dfd8a1fd4d026a16c0f9f447964d3f0581"
] | [
"lenspack/tests/test_geometry.py"
] | [
"# -*- coding: utf-8 -*-\n\n\"\"\"UNIT TESTS FOR GEOMETRY\n\nThis module contains unit tests for the geometry module.\n\n\"\"\"\n\nfrom unittest import TestCase\nimport numpy.testing as npt\nfrom lenspack.geometry.projections import gnom\nfrom lenspack.geometry.measures import angular_distance, solid_angle\n\n\ncla... | [
[
"numpy.testing.assert_raises"
]
] |
AhnYeonghoo/opensource_project | [
"7c215663180a825c4284fa884a88f0626bb5fb7e"
] | [
"create_db.py"
] | [
"import pandas as pd\n\n\nfile = pd.read_csv(\"./교육과정/1학기_전공.csv\", encoding='utf-8' ,dtype=str)\nfile = file.filter(['학년','과목구분', '과목코드', '과목명', '학점', '학점부여' ])\npd_file = pd.DataFrame(file).dropna()\npd_file = pd_file.query(\"개설학과=='컴퓨터공학과' or 개설학과=='소프트웨어학과' or 개설학과=='소프트웨어학부'\" )\n\n# 1학기 전공 DB\nclass FirstSeme... | [
[
"pandas.DataFrame",
"pandas.read_csv"
]
] |
ubco-mds-2020-labs/hoop_analytics | [
"a979fffc4ec7b793a2244858aaa4fb298425448e"
] | [
"src/app.py"
] | [
"import dash\nimport dash_bootstrap_components as dbc\nimport dash_core_components as dcc\nimport dash_html_components as html\nfrom dash.dependencies import Input, Output, State\nimport altair as alt\nfrom vega_datasets import data\nimport numpy as np\nimport pandas as pd\n\nalt.renderers.set_embed_options(actions... | [
[
"pandas.to_datetime",
"pandas.read_csv",
"pandas.Series"
]
] |
Ji-Xin/bovina | [
"3690ca73c99e0fb451547ce690e03cb9c4d6213c"
] | [
"common/trainers/paired_token_trainer.py"
] | [
"import time\n\nimport datetime\nimport numpy as np\nimport os\nimport torch\nimport torch.nn.functional as F\n\nfrom .generic_trainer import Trainer\n\n\nclass PairedTokenTrainer(Trainer):\n\n def __init__(self, model, embedding, train_loader, trainer_config, train_evaluator, test_evaluator, dev_evaluator):\n ... | [
[
"torch.nn.functional.sigmoid",
"torch.save",
"numpy.array_equal",
"torch.argmax"
]
] |
leandrodemarco/thesis-acor | [
"0dae987fc08f83e0c559ae9936bb90399d190218"
] | [
"acor.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\nimport numpy.matlib as npmatlib\nimport math\nimport matplotlib.pyplot as plt\nfrom decimal import Decimal\n\n# Problem definition\nnum_dimensions = 10 # 3 resistors and 2 capacitors\ncap_min = -10 #1e-9\ncap_max = 10 #8.2e-7\nres_min = -10 #1e3\nres_max = 10 #9.1e5\nva... | [
[
"numpy.concatenate",
"numpy.empty",
"numpy.zeros",
"numpy.sum",
"numpy.random.randn",
"matplotlib.pyplot.figure",
"numpy.random.uniform",
"numpy.cumsum",
"numpy.average",
"numpy.matlib.repmat"
]
] |
YMarrakchi/CICL | [
"adc1c8e38cc9f0a118fb9548aab54303aff9b9c6"
] | [
"util.py"
] | [
"from __future__ import print_function\n\nimport math\nimport numpy as np\nimport torch\nimport torch.optim as optim\n\nclass Cutout(object):\n def __init__(self, length):\n self.length = length\n\n def __call__(self, img):\n h, w = img.size(1), img.size(2)\n mask = np.ones((h, w), np.flo... | [
[
"numpy.asarray",
"torch.save",
"numpy.ones",
"torch.no_grad",
"torch.from_numpy",
"numpy.random.randint",
"numpy.clip"
]
] |
GabrieleParimbelli/Pylians3 | [
"03b6f497c084c6a1c795e8b8f8d1e9c71c5e80cd"
] | [
"library/plotting_library.py"
] | [
"# This library contains scripts that can be used to plot density fields\nimport numpy as np\nimport readgadget\nimport MAS_library as MASL\nimport sys,os\n\n# This routine finds the name of the density field\ndef density_field_name(snapshot, x_min, x_max, y_min, y_max, \n z_min, z_max, dims, ... | [
[
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.load",
"numpy.min",
"numpy.save",
"numpy.where",
"numpy.transpose"
]
] |
mcwitt/pandas | [
"f6d0d0829b0668a6b8c526daa388a7ccf8835d04"
] | [
"pandas/indexes/numeric.py"
] | [
"import numpy as np\nimport pandas.lib as lib\nimport pandas.algos as _algos\nimport pandas.index as _index\n\nfrom pandas import compat\nfrom pandas.indexes.base import Index, InvalidIndexError\nfrom pandas.util.decorators import Appender, cache_readonly\nimport pandas.core.common as com\nfrom pandas.core.common i... | [
[
"numpy.array",
"pandas.lib.isscalar",
"numpy.isnan",
"pandas.core.common._values_from_object",
"pandas.indexes.base.Index",
"pandas.core.indexing.maybe_droplevels",
"pandas.core.series.Series",
"pandas.formats.format.FloatArrayFormatter",
"pandas.core.common.is_dtype_equal",
... |
VarunSreenivasan16/train-track | [
"a3fd9093b39660e3ed6c18a6a496c7eddb22a37f"
] | [
"examples/Architectures/Processing/utils/event_utils.py"
] | [
"# System\r\nimport os\r\nimport argparse\r\nimport logging\r\nimport multiprocessing as mp\r\nfrom functools import partial\r\n\r\n# Externals\r\nimport yaml\r\nimport numpy as np\r\nimport pandas as pd\r\nimport trackml.dataset\r\n\r\nimport torch\r\nfrom torch_geometric.data import Data\r\n\r\nfrom itertools imp... | [
[
"numpy.array",
"torch.save",
"numpy.split",
"torch.from_numpy",
"numpy.arctan2",
"numpy.sqrt",
"numpy.argsort",
"numpy.unique"
]
] |
ZhixiangWang-CN/simple-faster-rcnn-pytorch | [
"67110d9877bc37bfa428ad7c30edaac7dcd7cb96"
] | [
"trainer.py"
] | [
"from __future__ import absolute_import\nimport os\nfrom collections import namedtuple\nimport time\nfrom torch.nn import functional as F\nfrom model.utils.creator_tool import AnchorTargetCreator, ProposalTargetCreator\nfrom model.S4ND import S4ND\nfrom model.micResNet import MiCTResNet\nfrom torch import nn\nimpo... | [
[
"torch.zeros",
"torch.arange",
"torch.save",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.Conv2d",
"torch.load",
"torch.nn.CrossEntropyLoss"
]
] |
nicmcd/ratesim | [
"728925dc491873f85186019e16b3b4ffcfd6f67e"
] | [
"parser/CloseToOne.py"
] | [
"import numpy as np\nfrom numpy import ma\nfrom matplotlib import scale as mscale\nfrom matplotlib import transforms as mtransforms\nfrom matplotlib.ticker import FixedFormatter, FixedLocator\n\n\"\"\"\nhttp://stackoverflow.com/questions/31147893/logarithmic-plot-of-a-cumulat\nive-distribution-function-in-matplotli... | [
[
"numpy.ma.log10",
"matplotlib.transforms.Transform.__init__",
"matplotlib.scale.register_scale",
"matplotlib.scale.ScaleBase.__init__",
"numpy.log10",
"numpy.ma.masked_where"
]
] |
oxford-oxcav/fossil | [
"f5b8e2bba80d8792b149ee75b51d3ee74df9b88e",
"f5b8e2bba80d8792b149ee75b51d3ee74df9b88e"
] | [
"src/shared/activations_symbolic.py",
"experiments/benchmarks/hybrid_barrier.py"
] | [
"# Copyright (c) 2021, Alessandro Abate, Daniele Ahmed, Alec Edwards, Mirco Giacobbe, Andrea Peruffo\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# pylint: disable=no-member\n# definition of vario... | [
[
"numpy.ones",
"numpy.power"
],
[
"torch.manual_seed"
]
] |
smoh/neighbors | [
"6f7e2c5a2d1515911765798a925ac48aa691152f"
] | [
"neighbors/data/mock.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nmodule for generating fake data\n\"\"\"\nimport numpy as np\nimport pandas as pd\n\nfrom ..tools import sample_uniform_sphere, xyz_to_rradec, make_cov\n\n__all__ = ['MockGroup']\n\nclass MockGroup(object):\n \"\"\"class representing mock comovoing group\"\"\"\n def __init__(s... | [
[
"pandas.DataFrame.from_items",
"numpy.shape",
"numpy.eye",
"numpy.random.multivariate_normal",
"numpy.ndim",
"numpy.deg2rad",
"numpy.diag"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.