repo_name stringlengths 8 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
mixib/brightway2-calc | [
"0fa409b6e7bccbef2a220dd6a811356798518ebe"
] | [
"bw2calc/graph_traversal.py"
] | [
"from . import spsolve\nfrom heapq import heappush, heappop\nimport numpy as np\nimport warnings\n\n\nclass GraphTraversal:\n \"\"\"\nTraverse a supply chain, following paths of greatest impact.\n\nThis implementation uses a queue of datasets to assess. As the supply chain is traversed, datasets inputs are added... | [
[
"numpy.zeros"
]
] |
vishalbelsare/emmental-tutorials | [
"5920cb71de07bfdb717e46ddfbe76457e8868fa7"
] | [
"data_augmentation/eda/image/modules/soft_cross_entropy_loss.py"
] | [
"from typing import List\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torch import Tensor\n\n\nclass SoftCrossEntropyLoss(nn.Module):\n \"\"\"\n Calculate the CrossEntropyLoss with soft targets.\n\n :param weight: Weight to assign to each of the classes. Default: None\n ... | [
[
"torch.Tensor",
"torch.nn.functional.cross_entropy"
]
] |
muthissar/homework | [
"9ee6361183da84f58e8b4842cc2c6047f7d743e1"
] | [
"hw3/train_ac_f18.py"
] | [
"\"\"\"\nOriginal code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017\nAdapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam\nAdapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn\n\"\"\"\nimport numpy as np\nimport tensorflow as tf\nimport tensorflow_pro... | [
[
"numpy.random.seed",
"tensorflow.variable_scope",
"numpy.log",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.nn.softmax",
"tensorflow.reduce_sum",
"tensorflow.global_variables_initializer",
"numpy.mean",
"tensorflow.cast",
"numpy.max",
"tensorflo... |
loganlebanoff/datasets | [
"44649ac4f8fefdbaae0a66918b03ae7dd8169f1e"
] | [
"tensorflow_datasets/core/utils/gcs_utils.py"
] | [
"# coding=utf-8\n# Copyright 2020 The TensorFlow Datasets 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 ... | [
[
"tensorflow.compat.v2.io.gfile.exists",
"tensorflow.compat.v2.io.gfile.listdir"
]
] |
YifanShenSZ/pytorch | [
"b4232f7cbe407909f9d95b91304c73fdc4c66a50"
] | [
"test/ao/sparsity/test_sparsifier.py"
] | [
"# -*- coding: utf-8 -*-\n# Owner(s): [\"module: unknown\"]\n\nimport itertools\nimport logging\nimport re\n\nimport torch\nfrom torch import nn\nfrom torch.ao.sparsity import BaseSparsifier, WeightNormSparsifier, FakeSparsity, NearlyDiagonalSparsifier\nfrom torch.nn.utils.parametrize import is_parametrized\n\nfrom... | [
[
"torch.ao.sparsity.WeightNormSparsifier",
"torch.ones",
"torch.nn.Linear",
"torch.randn",
"torch.all",
"torch.arange",
"torch.nn.utils.parametrize.is_parametrized",
"torch.nn.Sequential",
"torch.zeros",
"torch.eye",
"torch.ao.sparsity.NearlyDiagonalSparsifier"
]
] |
switchablenorms/SwitchNorm_Detection | [
"ab6848667bc8976367fdacb4b8ebbaeefdc79bd6"
] | [
"lib/core/test_engine.py"
] | [
"# Copyright (c) 2017-present, Facebook, 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 applicabl... | [
[
"torch.nn.Softmax",
"torch.load"
]
] |
NeoBert/liudengfeng-zipline | [
"dd436fa066a1a9718f676fa161fda32bbbf0f5d9"
] | [
"zipline/examples/pairtrade.py"
] | [
"#!/usr/bin/env python\n#\n# Copyright 2013 Quantopian, 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 requir... | [
[
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.ylabel",
"numpy.std",
"numpy.mean"
]
] |
HSE-DynGraph-Research-team/DynGraphModelling | [
"890326f4bd7991ef88a7a79cd2c8a77541621423"
] | [
"models/CAW/utils.py"
] | [
"import numpy as np\nimport torch\nimport os\nimport random\n\n\nclass EarlyStopMonitor(object):\n def __init__(self, max_round=3, higher_better=True, tolerance=1e-3):\n self.max_round = max_round\n self.num_round = 0\n\n self.epoch_count = 0\n self.best_epoch = 0\n\n self.last... | [
[
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"numpy.random.seed",
"numpy.abs",
"numpy.concatenate",
"numpy.unique"
]
] |
xopclabs/random-rotation-sklearn | [
"41f624066cfb1830bf067f77da9d284c6e46f1a1"
] | [
"rrsklearn/boosting.py"
] | [
"import numpy as np\nfrom sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor\nfrom sklearn.ensemble._gb import BaseGradientBoosting\nfrom .tree import RRDecisionTreeRegressor\n\n\nclass RRBaseGradientBoosting(BaseGradientBoosting):\n \"\"\"Abstract base class for Random Rotation Gradie... | [
[
"numpy.array"
]
] |
DimitryRakhlei/BTECH | [
"fefe469bd7d1f4adbc70bdc57670e793ad4c31f6"
] | [
"c8005/a1/src/avg.py"
] | [
"import glob\nimport numpy as np\n#import matplotlib.pyplot as plt\n\nmt_files = glob.glob(\"../logs/mt_*.log\")\nmp_files = glob.glob(\"../logs/mp_*.log\")\n\nprint(mt_files)\nprint(mp_files)\n\nvalues = {}\nfor fn in mt_files:\n with open(fn, \"r\") as file:\n values[fn] = np.array([float(x.rstrip()) fo... | [
[
"numpy.mean"
]
] |
tk1012/ion-kit | [
"d42be09dfd78fe415058723c186a76a84c699d45"
] | [
"python/tests/test_all.py"
] | [
"# https://github.com/fixstars/ion-csharp/blob/master/test/Test.cs\nfrom ionpy import Node, Builder, Buffer, PortMap, Port, Param, Type, TypeCode\nimport numpy as np # TODO: rewrite with pure python\n\n\ndef test_all():\n t = Type(code_=TypeCode.Int, bits_=32, lanes_=1)\n input_port = Port(key='input', type=t... | [
[
"numpy.full",
"numpy.frombuffer"
]
] |
CadQuery/PostMesh | [
"d68f44707166d6556042ed79b336c996d8ae52c5"
] | [
"setup.py"
] | [
"from setuptools import setup\nfrom setuptools import find_packages\nfrom distutils.command.clean import clean\nfrom distutils.extension import Extension\nfrom distutils.sysconfig import get_config_vars\nfrom Cython.Build import cythonize\nimport os, platform, sys, fnmatch\nimport numpy\n\n\ndef setup_package():\n\... | [
[
"numpy.get_include"
]
] |
itsAbdulKhadar/Machine-Learning-with-Streamlit | [
"c8a0c7ca5a1bcf2730ae9587bcddfebe323965a3"
] | [
"venv/Lib/site-packages/pandas/tests/series/methods/test_replace.py"
] | [
"import re\n\nimport numpy as np\nimport pytest\n\nimport pandas as pd\nimport pandas._testing as tm\n\n\nclass TestSeriesReplace:\n def test_replace(self, datetime_series):\n N = 100\n ser = pd.Series(np.random.randn(N))\n ser[0:4] = np.nan\n ser[6:10] = 0\n\n # replace list w... | [
[
"pandas.timedelta_range",
"pandas.Series",
"pandas.date_range",
"pandas.array",
"pandas._testing.assert_produces_warning",
"pandas.Timestamp.now",
"numpy.random.randn",
"pandas.isna",
"pandas.Categorical",
"numpy.arange",
"pandas._testing.assert_series_equal",
"pand... |
octaviomtz/inpaint_melanoma | [
"19cf85a0d51f04ad3e1e3ef68ddf1cc5e27a0b84"
] | [
"inpaint_melanoma/core.py"
] | [
"# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).\n\n__all__ = ['rgb2gray', 'otsu_thresh_4largest_component', 'component_closest_center', 'get_center', 'denormalizePatches',\n 'figs_horizontal2', 'figs_comparison', 'figs_horizontal3', 'plot_inpaints_pairs', 'channels... | [
[
"scipy.ndimage.morphology.binary_fill_holes",
"matplotlib.pyplot.tight_layout",
"numpy.asarray",
"scipy.ndimage.morphology.binary_dilation",
"matplotlib.pyplot.figure",
"numpy.reshape",
"numpy.expand_dims",
"numpy.where",
"matplotlib.gridspec.GridSpec",
"numpy.unique",
... |
maxibor/coproID | [
"7dc3362267bc89ce658651d47534455e01dc152b"
] | [
"bin/merge_bp_sp.py"
] | [
"#!/usr/bin/env python3\n\n\nimport argparse\nimport pandas as pd\nimport sys\n\n\ndef get_args():\n '''This function parses and return arguments passed in'''\n parser = argparse.ArgumentParser(\n prog='normalizedReadCount',\n description='Counts reads aligned to genome, and normalize by genome ... | [
[
"pandas.read_csv",
"pandas.DataFrame"
]
] |
pashatab1/tablab_fish | [
"4e49c19ca9eb94f059fa1c15231401ffc4405195"
] | [
"common/find_pixel_size.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"Determine pixel/inch ratio from linescan across ruler\n\nInputs:\nfilename - full path to csv file containing Position and Intensity Value\n\nAssumes:\nImage is taken of inch side of ruler, and smallest ticks are 1/8 inch increment\n\n@author: tabatabai\n\"\"\... | [
[
"pandas.read_csv",
"numpy.conj",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot"
]
] |
GeoffKriston/deep-learning-v2-pytorch | [
"92f7b12e8afeb12753bc990829bfa8307b26ef6c"
] | [
"intro-to-pytorch/fc_model.py"
] | [
"import torch\nfrom torch import nn\nimport torch.nn.functional as F\n\n\nclass Network(nn.Module):\n def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):\n ''' Builds a feedforward network with arbitrary hidden layers.\n \n Arguments\n ---------\n ... | [
[
"torch.nn.functional.log_softmax",
"torch.FloatTensor",
"torch.nn.Linear",
"torch.no_grad",
"torch.exp",
"torch.nn.Dropout"
]
] |
lauromoraes/promoter_paper | [
"62aea776cb318a13e142f84dd84bb0a29fb0e83f"
] | [
"mymodels/parent_models.py"
] | [
"#!/usr/bin/python\n# -*- encoding: utf-8 -*-\n\n\"\"\"\n@ide: PyCharm\n@author: Lauro Ângelo Gonçalves de Moraes\n@contact: lauromoraes@ufop.edu.br\n@created: 20/06/2020\n\"\"\"\nimport tensorflow as tf\nfrom tensorflow.keras import models\nfrom tensorflow.keras.layers import (\n Input,\n Embedding,\n Con... | [
[
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.models.Model",
"tensorflow.keras.backend.shape",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Conv2D"
]
] |
TariniHardikar/OpenFermion | [
"1a1538c976d3c867c66c04a7b63766910ed73bf1"
] | [
"src/openfermion/ops/_quadratic_hamiltonian.py"
] | [
"# 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 to in writing, software... | [
[
"numpy.eye",
"numpy.sum",
"numpy.zeros",
"scipy.linalg.schur",
"numpy.argmin",
"numpy.linalg.eigh",
"numpy.abs",
"numpy.trace",
"numpy.sqrt"
]
] |
vijayrgopu/neo4j-lib | [
"45a5abc43ee057ea0908fba0746727c36ab8f444"
] | [
"neo_lib.py"
] | [
"from contextlib import nullcontext\nimport pandas as pd\nfrom pprint import pprint\n\nfrom neo4j import GraphDatabase, basic_auth\nfrom py2neo import Graph\nempty_cq = \"\"\"\n// Your query goes here\n\n\"\"\"\n'''\nThis is a neo4j library 1.0\n'''\n\nclass Neo_lib:\n def __init__(self, neo_url, neo_user, neo_p... | [
[
"pandas.DataFrame",
"pandas.DataFrame.from_dict"
]
] |
wsustcid/FlowDriveNet | [
"3604495269ae45e5b43964046104f685ec66e383"
] | [
"eval.py"
] | [
"'''\n@Author: Shuai Wang\n@Github: https://github.com/wsustcid\n@Version: 1.0.0\n@Date: 2020-09-11 23:42:23\n@LastEditTime: 2020-10-13 22:32:20\n'''\n\nimport os\nimport sys\nimport argparse\nfrom datetime import datetime\nimport time\nfrom tqdm import tqdm\nimport time\n\nimport numpy as np\nimport tensorflow as ... | [
[
"tensorflow.placeholder",
"tensorflow.minimum",
"tensorflow.constant_initializer",
"numpy.zeros",
"tensorflow.global_variables_initializer",
"tensorflow.Graph",
"numpy.hstack",
"tensorflow.Session",
"tensorflow.train.Saver",
"numpy.concatenate",
"numpy.square",
"ten... |
flowmatters/veneer-py | [
"af551b49038f5f93358b510fb893015c590bf6d4"
] | [
"veneer/losses.py"
] | [
"from types import MethodType\nimport pandas as pd\nimport numpy as np\nfrom .server_side import VeneerNetworkElementActions\nfrom .utils import _quote_string\n\nGET_LOSS_TABLE_SCRIPTLET='''\nignoreExceptions=False\nfn = target.lossFct\nfor row in fn:\n result.append((row.Key,row.Value))\n'''\n\nclass VeneerLoss... | [
[
"pandas.DataFrame"
]
] |
rudolfspetrovs/benchml | [
"896673f387a6bb9b185664ddd54f569a1ba54e51"
] | [
"benchml/models/mod_basic.py"
] | [
"import numpy as np\n\nimport benchml.transforms as btf\nfrom benchml.hyper import BayesianHyper, GridHyper, Hyper\nfrom benchml.models.mod_dscribe import compile_dscribe, compile_dscribe_periodic\n\n\ndef compile_null(**kwargs):\n return []\n\n\ndef compile_physchem(custom_fields=None, with_hyper=False, **kwarg... | [
[
"numpy.linspace",
"numpy.logspace"
]
] |
catnlp/metaLSTM | [
"08b3086ebc558b936898022dd7eea7d726e6d491"
] | [
"NER/Module/crf.py"
] | [
"# encoding:utf-8\n'''\n@Author: catnlp\n@Email: wk_nlp@163.com\n@Time: 2018/5/2 15:02\n'''\nimport torch\nimport torch.autograd as autograd\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport numpy as np\nSTART_TAG = -2\nSTOP_TAG = -1\n\ndef log_sum_exp(vec, m_size):\n _, idx = torch.max(vec, 1)\n ... | [
[
"torch.sum",
"torch.gather",
"torch.nn.Parameter",
"torch.max",
"torch.zeros",
"torch.LongTensor",
"torch.cat"
]
] |
hjc3613/simpletransformers | [
"bce58639f3fa8f45f445b053b5aaae428c3c5429"
] | [
"simpletransformers/classification/classification_model.py"
] | [
"#!/usr/bin/env python\n# coding: utf-8\n\n\nfrom __future__ import absolute_import, division, print_function\n\nimport json\nimport logging\nimport math\nimport os\nimport random\nimport warnings\nfrom multiprocessing import cpu_count\n\nimport numpy as np\nfrom scipy.stats import mode, pearsonr\nfrom sklearn.metr... | [
[
"torch.utils.data.DataLoader",
"torch.cuda.manual_seed_all",
"scipy.stats.mode",
"torch.no_grad",
"numpy.random.seed",
"torch.cuda.is_available",
"sklearn.metrics.label_ranking_average_precision_score",
"torch.save",
"torch.nn.DataParallel",
"torch.utils.data.RandomSampler"... |
NarendraPatwardhan/gym_venv | [
"9c7456cc64d416556f1d1d8eca7a72df0821cf00"
] | [
"model.py"
] | [
"import numpy as np\nimport mxnet as mx\nimport matplotlib.pyplot as plt\n\n#-----------------------------------------------------------------------------\n\nclass StateModel(mx.gluon.Block):\n def __init__(self,config):\n super(StateModel, self).__init__()\n self.config = config\n x = mx.nd... | [
[
"numpy.array",
"numpy.random.randn",
"matplotlib.pyplot.subplots"
]
] |
AlexanderDokuchaev/mmsegmentation | [
"0c443ee370cce6227661b802184072174c4e3f64"
] | [
"mmseg/apis/ote/apis/segmentation/openvino_task.py"
] | [
"# Copyright (C) 2021 Intel Corporation\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 a... | [
[
"numpy.pad",
"numpy.transpose"
]
] |
USGS-WiM/Gage-Cam-Sensor-AI | [
"6e38517cbf90a82b6f679b8eee289cfdc12dd1b1"
] | [
"sensor_AI/run_lite.py"
] | [
"from tensorflow import keras\nimport numpy as np\nimport pidash\nimport os\n#import gc\n\nPATH = os.path.dirname(__file__)\n\n# This is a prototype implementation of the sensor AI deployment. \n#This is not final code and should not be reguarded as a best practices.\n\n\n\n# get_exposed() is a simple pixel count r... | [
[
"numpy.load",
"tensorflow.keras.models.load_model",
"numpy.resize"
]
] |
asplos2020/DRTest | [
"85c3c9b2a46cafa7184130f2596c5f9eb3b20bff"
] | [
"attack_metrics/rgb.py"
] | [
"from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport sys\n\nimport numpy as np\nimport tensorflow as tf\nfrom tensorflow.python.platform import flags\n\nsys.path.append(\"../\")\n\nfrom nmutant_model.model_... | [
[
"numpy.ceil",
"tensorflow.app.run",
"numpy.argmax",
"tensorflow.python.platform.flags.DEFINE_string",
"tensorflow.reset_default_graph"
]
] |
Sinha-Raunak/gan-toolkit | [
"6d2d86833bb00833b2d9cd11a1a83476f44b65fd"
] | [
"agant/models/pytorch/loss/NLL.py"
] | [
"import torch\nimport numpy as np\nfrom torch.autograd import Variable\n\nclass loss_block:\n def __init__(self):\n super(loss_block, self).__init__()\n self.criterion = torch.nn.NLLLoss(size_average=False)\n cuda = True if torch.cuda.is_available() else False\n if cuda:\n ... | [
[
"torch.nn.NLLLoss",
"torch.cuda.is_available"
]
] |
jake-is-ESD-protected/scipy | [
"d7283ff75c218c300f372b5fdd960b987c1709a1"
] | [
"doc/source/tutorial/examples/optimize_global_1.py"
] | [
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import optimize\n\n\ndef eggholder(x):\n return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1] + 47))))\n -x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47)))))\n\nbounds = [(-512, 512), (-512, 512)]\n\nx = np.arange(-512, 513)\ny = np.a... | [
[
"scipy.optimize.shgo",
"scipy.optimize.dual_annealing",
"matplotlib.pyplot.figure",
"numpy.arange",
"scipy.optimize.differential_evolution",
"matplotlib.pyplot.show",
"numpy.stack",
"numpy.meshgrid"
]
] |
rexdivakar/Telegram-Notify | [
"7d4f317548e6c1fa14db1c636c328aac02224dc9"
] | [
"temp.py"
] | [
"import ssl\nfrom notifly import tf_notifier\nimport tensorflow as tf\nfrom dotenv import load_dotenv\nimport os\n\n\nload_dotenv()\n\nssl._create_default_https_context = ssl._create_unverified_context\ntoken = os.getenv('TOKEN')\nnotifier = tf_notifier.TfNotifier(token=token, platform='discord')\n\n\nclass TestCal... | [
[
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.layers.Dense"
]
] |
realfolkcode/PyTorch-VAE | [
"6abff8c2483e04bbec936bcd1cf20f8f2705266d"
] | [
"models/vanilla_vae.py"
] | [
"import torch\nfrom models import BaseVAE\nfrom torch import nn\nfrom torch.nn import functional as F\nfrom .types_ import *\n\n\nclass VanillaVAE(BaseVAE):\n\n\n def __init__(self,\n in_channels: int,\n latent_dim: int,\n hidden_dims: List = None,\n ... | [
[
"torch.randn_like",
"torch.nn.Linear",
"torch.randn",
"torch.flatten",
"torch.exp",
"torch.nn.Tanh",
"torch.nn.Sequential",
"torch.nn.Sigmoid"
]
] |
kantharajucn/job_seniority_prediction | [
"cad9147ffddab1c5ead878c2f9d9e48199dc0da9"
] | [
"src/dataset.py"
] | [
"import torch\nfrom sklearn.preprocessing import LabelEncoder\nfrom torch.utils.data import Dataset, DataLoader\n\n\nclass JobsDataset(Dataset):\n def __init__(self, X, y, tokenizer, max_len=512):\n self.len = len(X)\n self.data = X\n self.y = y\n self.tokenizer = tokenizer\n s... | [
[
"torch.utils.data.DataLoader",
"torch.tensor",
"sklearn.preprocessing.LabelEncoder"
]
] |
MATHplus-Young-Academy/P3-Morph-Scoring | [
"0e2ba66cf28e30525b22706cc50d23b9de09a58a"
] | [
"morphomatics_med/manifold/Bezierfold.py"
] | [
"################################################################################\n# #\n# This file is part of the Morphomatics library #\n# see https://github.com/morphomatics/morphomatics ... | [
[
"numpy.sqrt",
"numpy.sum",
"numpy.zeros_like",
"numpy.zeros",
"numpy.abs",
"scipy.integrate.simps",
"numpy.isnan",
"numpy.array",
"numpy.concatenate",
"numpy.linspace"
]
] |
jyericlin/VBC | [
"cc34169e4f4ece500ad8c33ab69378f0a700a73e"
] | [
"src/learners/q_learner_6h_vs_8z_vbc.py"
] | [
"import copy\nfrom components.episode_buffer import EpisodeBatch\nfrom modules.mixers.vdn import VDNMixer\nfrom modules.mixers.qmix import QMixer\nimport torch as th\nimport numpy as np\nfrom torch.optim import RMSprop\n\n# learning for 6h_vs_8z scenario\nclass QLearner_6h_vs_8z:\n def __init__(self, mac, scheme... | [
[
"torch.stack",
"torch.nn.utils.clip_grad_norm_",
"torch.std",
"torch.gather",
"torch.optim.RMSprop"
]
] |
choderalab/fragmenter_examples | [
"01d63aea340e91f8cbb3a21253a906a0c3c66da3"
] | [
"wbo-manuscript-figures/proof_of_concept/generate_figures_coverage.py"
] | [
"import json\nimport seaborn as sbn\nfrom scipy import stats\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib.colors as mcolors\nimport pandas as pd\nimport arch.bootstrap\nimport math\nimport qcfractal.interface as ptl\nfrom fragmenter.utils import HARTREE_2_KJMOL\nfrom fragmenter import che... | [
[
"numpy.unique",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.annotate",
"numpy.asarray",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.xlim",
"scipy.stats.linregress",
"matplotlib.py... |
bennyrowland/suspect | [
"c09ab0a5013c5a199218214cdd791659243d7e41"
] | [
"suspect/processing/water_suppression.py"
] | [
"import numpy\n\nimport suspect.basis\n\n\ndef hsvd(data, rank, L=None):\n if L is None:\n L = data.np // 2\n # start by building the Hankel matrix\n hankel_matrix = numpy.zeros((L, data.np - L), \"complex\")\n for i in range(int(data.np - L)):\n hankel_matrix[:, i] = data[i:(i + L)]\n\n ... | [
[
"numpy.zeros_like",
"numpy.zeros",
"numpy.diag",
"numpy.linalg.inv",
"numpy.matrix",
"numpy.reshape",
"numpy.angle",
"numpy.linalg.eig"
]
] |
yanndupis/tf-encrypted | [
"cfaea3ba87520f73979ed4e4f397eba3beb0a535"
] | [
"examples/deprecated/inputs.py"
] | [
"import sys\n\nimport numpy as np\nimport tensorflow as tf\nimport tf_encrypted as tfe\n\nconfig = tfe.get_config()\n\nif len(sys.argv) > 1:\n\n #\n # assume we're running as a server\n #\n\n player_name = str(sys.argv[1])\n\n server = config.server(player_name)\n server.start()\n server.join()... | [
[
"numpy.array",
"tensorflow.constant",
"tensorflow.print",
"tensorflow.global_variables_initializer"
]
] |
suvarnak/datasets | [
"682b5adee6c36e9867f397076080ec23d9616dcc"
] | [
"tensorflow_datasets/core/download/download_manager.py"
] | [
"# coding=utf-8\n# Copyright 2019 The TensorFlow Datasets 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 ... | [
[
"tensorflow.io.gfile.exists",
"tensorflow.io.gfile.rmtree",
"tensorflow.io.gfile.makedirs",
"tensorflow.io.gfile.rename",
"tensorflow.io.gfile.listdir",
"tensorflow.io.gfile.stat"
]
] |
alisiahkoohi/devito | [
"f535a44dff12de2837eb6e3217a65ffb2d371cb8"
] | [
"tests/test_derivatives.py"
] | [
"import numpy as np\nimport pytest\nfrom sympy import simplify, diff, cos, sin, Float\n\nfrom devito import (Grid, Function, TimeFunction, Eq, Operator, NODE,\n ConditionalDimension, left, right, centered, div, grad)\nfrom devito.finite_differences import Derivative, Differentiable\nfrom devito.f... | [
[
"numpy.allclose",
"numpy.ones",
"numpy.isclose",
"numpy.arange",
"numpy.linspace",
"numpy.mean"
]
] |
Leedk3/pvcnn | [
"8e3bddbc0719bdc262c5d438273eb2a54e45d9d4"
] | [
"data/kitti/example.py"
] | [
"''' Prepare KITTI data for 3D object detection.\n\nAuthor: Charles R. Qi\nDate: September 2017\n'''\nfrom __future__ import print_function\n\nimport os\nimport sys\nimport numpy as np\nimport cv2\nfrom PIL import Image\nBASE_DIR = os.path.dirname(os.path.abspath(__file__))\nROOT_DIR = os.path.dirname(BASE_DIR)\nsy... | [
[
"numpy.zeros_like",
"numpy.arctan2",
"numpy.sum",
"numpy.zeros",
"scipy.spatial.Delaunay",
"numpy.random.random",
"numpy.array"
]
] |
vsuomi/fibroid-classification | [
"749e77af4dbd28b00184a9aa9e32b9d891493bd4"
] | [
"scale_features.py"
] | [
"# -*- coding: utf-8 -*-\n'''\nCreated on Thu May 31 11:38:48 2018\n\n@author:\n \n Visa Suomi\n Turku University Hospital\n May 2018\n \n@description:\n \n This function is used to scale features using different scaling types\n \n'''\n\n#%% import necessary packages\n\nimport numpy as np\ni... | [
[
"numpy.zeros_like",
"numpy.log"
]
] |
MaiRajborirug/scikit-learn | [
"c18d015372f7041099d19c215cd4c36ffd6fe5c5"
] | [
"sklearn/tests/test_config.py"
] | [
"import time\nfrom concurrent.futures import ThreadPoolExecutor\n\nfrom joblib import Parallel\nimport joblib\nimport pytest\n\nfrom sklearn import get_config, set_config, config_context\nfrom sklearn.utils.fixes import delayed\nfrom sklearn.utils.fixes import parse_version\n\n\ndef test_config_context():\n asse... | [
[
"sklearn.get_config",
"sklearn.utils.fixes.delayed",
"sklearn.set_config",
"sklearn.config_context",
"sklearn.utils.fixes.parse_version"
]
] |
davidpneal/adventofcode | [
"f31b5132462b44aeadfdbcffe75f25215961a9ae"
] | [
"2018/day11/day11p2.py"
] | [
"#12/24/2018\n#Find the square which has the largest total power, the square can be anywhere from 1x1 to 300x300\n\n#The package numpy has some tools that can help with the multidimensional arrays and creating the summed area table\n#Note that numpy uses matrix indexing (i,j / row,col) vs cartesian indexing (x,y) -... | [
[
"numpy.zeros"
]
] |
ddempsey/python_for_geoscientists | [
"428e2eaeb869f8478a3517d01a5fdff6de30e7d2"
] | [
"2_visualisation/mesh_plot.py"
] | [
"# import tools for 3D axes\nfrom matplotlib import pyplot as plt \nfrom mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib import cm \nimport numpy as np \n\n# create a grid\nxg = np.linspace(0,1,31) # evenly spaced grid points\nyg = np.linspace(0,1,31)\nymin,ymax = [0.15,0.85] # crea... | [
[
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.show",
"matplotlib.pyplot.colorbar",
"numpy.meshgrid",
"numpy.linspace",
"numpy.mean"
]
] |
ing-bank/popmon | [
"729d61a4bfe45715d3970326d28b70b09d7fc13a"
] | [
"popmon/pipeline/report.py"
] | [
"# Copyright (c) 2021 ING Wholesale Banking Advanced Analytics\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy of\n# this software and associated documentation files (the \"Software\"), to deal in\n# the Software without restriction, including without limitation the rights to\n# u... | [
[
"pandas.Timestamp",
"pandas.Timedelta"
]
] |
HanChangHun/dsn_fewshot | [
"dbe8d637bce1cb17bfb7c7fd7784bcdebb79085c"
] | [
"Conv4/algorithm/subspace_projection.py"
] | [
"import torch\nimport torch.nn as nn\n\nclass Subspace_Projection(nn.Module):\n def __init__(self, num_dim=5):\n super().__init__()\n self.num_dim = num_dim\n\n def create_subspace(self, supportset_features, class_size, sample_size):\n all_hyper_planes = []\n means = []\n fo... | [
[
"torch.sum",
"torch.stack",
"torch.mean",
"torch.squeeze",
"torch.transpose"
]
] |
rosefiero/AI-102-AIEngineer | [
"6d2ffa3b578e600fee908fa93107f73f3d74ece3"
] | [
"20-ocr/Python/read-text/read-text.py"
] | [
"from dotenv import load_dotenv\nimport os\nimport time\nfrom PIL import Image, ImageDraw\nfrom matplotlib import pyplot as plt\n\n# Import namespaces\n# import namespaces\nfrom azure.cognitiveservices.vision.computervision import ComputerVisionClient\nfrom azure.cognitiveservices.vision.computervision.models impor... | [
[
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.imshow"
]
] |
goncaloperes/bokeh | [
"b857d2d17d7c19779bb0a7be2601d8238fb1d5e9"
] | [
"tests/unit/bokeh/core/property/test_primitive.py"
] | [
"#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.\n# All rights reserved.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#---------------------------------------------------------... | [
[
"numpy.int8",
"numpy.complex64",
"numpy.complex128",
"numpy.uint16",
"numpy.bool8",
"numpy.float32",
"numpy.int64",
"numpy.int32",
"numpy.uint32",
"numpy.uint64",
"numpy.float16",
"numpy.complex256",
"numpy.int16",
"numpy.float64",
"numpy.uint8"
]
] |
chinvib66/Niffler | [
"6fcf46c505249ac116b16ed2efda92685ba153c1"
] | [
"modules/png-extraction/ImageExtractor.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport os\nimport glob \nfrom shutil import copyfile\nimport hashlib\nimport json\nimport sys\nimport subprocess\nimport logging\nfrom multiprocessing import Pool\nimport pdb\nimport time\nimport pickle\nimport numpy as np\nimport pandas as pd\nimport pydicom as dic... | [
[
"pandas.read_csv",
"pandas.DataFrame",
"numpy.uint16",
"numpy.asarray",
"numpy.array_split",
"pandas.concat",
"numpy.maximum",
"numpy.uint8"
]
] |
jasonfan1997/umd_icecube_analysis_tutorial | [
"50bf3af27f81d719953ac225f199e733b5c0bddf"
] | [
"mla/mla/sensitivtiy.py"
] | [
"'''Core functionality'''\r\n\r\nfrom __future__ import print_function, division\r\nimport os, sys, glob, numpy as np, matplotlib, scipy, time\r\nfrom scipy import stats, interpolate, optimize\r\nfrom math import pi\r\nimport numpy.lib.recfunctions as rf\r\nfrom mla.spectral import *\r\nfrom mla.tools import *\r\n... | [
[
"numpy.load",
"numpy.lib.recfunctions.drop_fields",
"numpy.append",
"numpy.any",
"numpy.random.poisson",
"matplotlib.pyplot.subplots",
"numpy.random.choice",
"numpy.arange",
"numpy.percentile",
"scipy.interpolate.UnivariateSpline",
"matplotlib.pyplot.close",
"numpy.... |
yetyetanotherusername/vaex | [
"71ff313486f9ee3a142d9fb4e80c7bdc0e1270c5"
] | [
"tests/join_test.py"
] | [
"import pytest\nimport vaex\nimport numpy as np\nimport numpy.ma\n\ndf_a = vaex.from_arrays(a=np.array(['A', 'B', 'C']),\n x=np.array([0., 1., 2.]),\n y=np.ma.array([0., 9., 2.], mask=[False, True, False]),\n m=np.ma.array([1, 2, 3], mask=[False, ... | [
[
"numpy.arange",
"numpy.ma.array",
"numpy.array"
]
] |
ALexanderpu/CUDAC-PerformanceEvaluation | [
"1106792a41781b490685941d53bcf5bf43f4ca32"
] | [
"SparkCCM.py"
] | [
"# running under python 2.7 \n__author__ = \"Bo Pu\"\n\nimport sys\nimport ConfigParser\nimport pandas as pd\nfrom pyspark.sql import SparkSession\nimport json\nimport numpy as np\nimport os\n\n# for single L; which will be not used \n# read parameter combinations config and fill into the objects\nclass Sample... | [
[
"pandas.read_csv"
]
] |
justinpayan/StackOverflowNER-NS | [
"8459cee99582e5bddf94fb1dff4fcad5fc93fd54"
] | [
"regularizers.py"
] | [
"import abc\nimport math\nimport torch\nfrom torch.optim import Optimizer, SGD\nfrom settings import args, FILL_VAL, TOKENS_WEIGHT\nfrom utils import get_losses, get_model_dir\nfrom parallel import DataParallelCriterion\nfrom torch.nn import CrossEntropyLoss, MSELoss\nimport pickle as pkl\nimport os\nfrom torch.nn.... | [
[
"torch.nn.MSELoss",
"torch.add",
"torch.nn.Softmax",
"torch.nn.L1Loss",
"torch.zeros_like",
"torch.nn.CrossEntropyLoss"
]
] |
divyanshugit/Machine-Learning-Lab-EC792B | [
"2c0ceeef67dcbf9dd1135d0b4616d9f94205fd66"
] | [
"kNN/kNN.py"
] | [
"import numpy as np\nfrom math import sqrt\n\nclass KNN():\n \"\"\" K Nearest Neighbors classifier.\n Parameters:\n -----------\n k: int\n The number of closest neighbors that will determine the class of the \n sample that we wish to predict.\n \"\"\"\n def __init__(self, k=5):\n ... | [
[
"numpy.array",
"numpy.empty",
"numpy.random.randint",
"numpy.random.rand"
]
] |
chen0040/keras-language-translator-web-api | [
"06dc1d106e2293abaadd506992988a4a66b5eb78"
] | [
"translator_train/eng_to_fra_glove_translator_train.py"
] | [
"from keras.models import Model\nfrom keras.callbacks import ModelCheckpoint\nfrom keras.layers.recurrent import LSTM\nfrom keras.layers import Dense, Input, Embedding\nfrom keras.preprocessing.sequence import pad_sequences\nfrom collections import Counter\nimport nltk\nimport numpy as np\nimport os\nimport sys\nim... | [
[
"numpy.array",
"numpy.save",
"numpy.random.randn",
"numpy.zeros"
]
] |
jesbu1/spinningup | [
"fd54d9e06febc7ff5696a63d1e84e2c16d38e486"
] | [
"gym/quick_script.py"
] | [
"import gym\nimport numpy as np\nenv = gym.make('SawyerPush-v0')\nfor _ in range(100):\n env.reset()\n for i in range(150):\n env.render()\n env.step(np.random.uniform(0, 1, size=(4,)))\n"
] | [
[
"numpy.random.uniform"
]
] |
NICALab/Inducing-Functions-through-RL | [
"e2171ff5e14bb272353e7df5156104ad2a85a3ae"
] | [
"scripts/plot.py"
] | [
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport glob\nimport argparse\nfrom collections import defaultdict\nimport seaborn as sns\nimport pandas as pd\n\ntask_default_list = ['task_b_2021',\n 'task_b_vision_only_2021',\n 'task_b_sequence_ext_... | [
[
"numpy.ones",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xticks",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"numpy.concatenate",
... |
gamaievsky/DescripteursHarmoniquesAudio | [
"551e253058502049a91803da8b0412b5ffb1bd60"
] | [
"Comparison.py"
] | [
"# Representations abstraites\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pickle\nimport params\n\n# # Ouverture des listes\n# with open ('liste1', 'rb') as fp:\n# l1x = pickle.load(fp)\n# with open ('liste2', 'rb') as fp:\n# l1y = pickle.load(fp)\n# with open ('liste1v', 'rb') as fp:\n# ... | [
[
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.std",
"numpy.asarray",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.array",
"matplotlib.pyplot.plot"
]
] |
DzAvril/tvm | [
"89fa6d3363926a6770084c10f9dee2cf78129903"
] | [
"apps/deploy_tflite_cpp/build_input.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... | [
[
"numpy.expand_dims",
"numpy.asarray"
]
] |
LucasFidon/trustworthy-ai-fetal-brain-segmentation | [
"84959da54d8c2fb156da2b06cca30fa31a1c926d"
] | [
"docker/third-party/nnUNet/nnunet/dataset_conversion/Task172_CovidSegChallengeAutoCorrect.py"
] | [
"import os\nimport pickle\nfrom scipy.ndimage.measurements import label\nimport numpy as np\nimport SimpleITK as sitk\nfrom collections import OrderedDict\nfrom lungmask import mask\nfrom batchgenerators.utilities.file_and_folder_operations import *\nfrom nnunet.paths import nnUNet_raw_data\n\nMAIN_DATA_FOLDER = '/... | [
[
"numpy.ones",
"numpy.zeros_like",
"numpy.sum",
"numpy.load",
"numpy.zeros",
"numpy.logical_and",
"numpy.argmax",
"numpy.where",
"numpy.max",
"numpy.min",
"numpy.array",
"scipy.ndimage.measurements.label"
]
] |
SudoHead/cs231n.github.io | [
"652285518ff5ed8c02503bac6cb24aaea0d6ff75"
] | [
"assignments/2019/assignment1/cs231n/data_utils.py"
] | [
"from __future__ import print_function\n\nfrom builtins import range\nfrom six.moves import cPickle as pickle\nimport numpy as np\nimport os\n\n# scipy.misc.imread is deprecated, so use imageio.imread\nfrom scipy.misc import imread\nimport platform\n\ndef load_pickle(f):\n version = platform.python_version_tuple... | [
[
"numpy.load",
"numpy.ones",
"numpy.zeros",
"numpy.array",
"numpy.concatenate",
"scipy.misc.imread",
"numpy.mean"
]
] |
WildbookOrg/wbia-deprecate-tpl-brambox | [
"9aa6a69f706d0653a65520c696a7cd66715b6a37"
] | [
"brambox/boxes/statistics/pr.py"
] | [
"# -*- coding: utf-8 -*-\n#\n# Copyright EAVISE\n# Author: Maarten Vandersteegen\n# Author: Tanguy Ophoff\n#\n# Functions for generating PR-curve values and calculating average precision\n#\n\nimport math\nfrom statistics import mean\nimport numpy as np\nimport scipy.interpolate\n\nfrom .util import *\n\n__... | [
[
"numpy.array",
"numpy.argmin",
"numpy.arange"
]
] |
Utsav-Patel/The-Imitation-Game | [
"09dfaffdf917c1adfb1d8cd3e09a216b9a014e52"
] | [
"models/project2/dense/20x20/model1.py"
] | [
"import pickle\nimport numpy as np\nfrom sklearn.model_selection import train_test_split\nimport tensorflow as tf\nfrom tensorflow.keras.utils import to_categorical\n\nfrom constants import CHECKPOINT_FILEPATH, PROJECT2_DATA_PATH, PROJECT2_VALIDATION_PATH\nfrom model_architectures import create_model_project2_dense... | [
[
"tensorflow.keras.utils.to_categorical",
"tensorflow.compat.v1.Session",
"tensorflow.compat.v1.ConfigProto",
"numpy.array",
"tensorflow.keras.callbacks.ModelCheckpoint",
"sklearn.model_selection.train_test_split"
]
] |
Hotpotfish/pysc2 | [
"3d7f7ffc01a50ab69d435b65c892cd0bc11265a8"
] | [
"pysc2/agents/myAgent/myAgent_7/net/lenet.py"
] | [
"import tensorflow as tf\n\n\nclass Lenet():\n\n def __init__(self, mu, sigma, learning_rate, action_dim, parameterdim, statedim, name):\n self.mu = mu\n self.sigma = sigma\n self.learning_rate = learning_rate\n\n self.action_dim = action_dim\n self.parameterdim = parameterdim\... | [
[
"tensorflow.summary.scalar",
"tensorflow.placeholder",
"tensorflow.summary.histogram",
"tensorflow.zeros",
"tensorflow.reshape",
"tensorflow.summary.merge_all",
"tensorflow.nn.avg_pool",
"tensorflow.truncated_normal",
"tensorflow.multiply",
"tensorflow.train.AdamOptimizer",... |
zhuboli/alf | [
"b357565638c9336ebd88cecb9766a17d72d5d0c3"
] | [
"alf/environments/suite_carla.py"
] | [
"# Copyright (c) 2020 Horizon Robotics. 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/licenses/LICENSE-2.0\n#\n# Unless requi... | [
[
"numpy.matmul",
"numpy.get_printoptions",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.set_printoptions",
"numpy.cos",
"numpy.float32",
"numpy.all",
"torch.arange",
"numpy.sqrt",
"numpy.sin",
"numpy.linalg.norm"
]
] |
rougier/JCGT-2014a | [
"78793d05a145af79d9cacf87a6e1ffaaea501394"
] | [
"demo-continuous.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (C) 2013 Nicolas P. Rougier. All rights reserved.\n# \n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the f... | [
[
"numpy.array",
"numpy.eye"
]
] |
rhambach/TEMareels | [
"92a907f483baeb919dd485895c56454f0b552c76"
] | [
"tools/remove_stripes.py"
] | [
"\"\"\"\n IMPLEMENTATION:\n - crude method for removing periodic noise in images recorded \n on Tietz CMOS slave camera in wq-mode\n - integrates over several lines (e.g. 10x4096) of noise and \n substracts signal from each line in sector\n \n Copyright (c) 2013, pwachsmuth, rhambach\n This... | [
[
"matplotlib.pylab.title",
"numpy.asarray",
"matplotlib.pylab.show",
"matplotlib.pylab.imshow",
"numpy.array"
]
] |
pyronear/pyro-dataset | [
"b6445f6051058f20f2fc821040ec3705dc60464c"
] | [
"test/test_datasets.py"
] | [
"# Copyright (C) 2021, Pyronear contributors.\n\n# This program is licensed under the GNU Affero General Public License version 3.\n# See LICENSE or go to <https://www.gnu.org/licenses/agpl-3.0.txt> for full license details.\n\nimport unittest\nimport tempfile\nfrom pathlib import Path\nimport json\nfrom PIL.Image ... | [
[
"torch.utils.data.DataLoader",
"pandas.DataFrame",
"torch.Size",
"torch.tensor"
]
] |
alesanmed/as-route | [
"fc7fcb65496188f7c7e12626e2169f5315e4e3d1"
] | [
"heuristic/Constructive.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\nimport heuristic.utils as utils\nimport random\n\nfrom heuristic.Graph import TSP_Graph\nfrom heuristic.Solution import Solution\n\ndef random_solution(graph, customers_list):\n if not isinstance(graph, TSP_Graph):\n utils.raise_value_error(graph, TSP_Graph, t... | [
[
"numpy.where",
"numpy.concatenate",
"numpy.argsort"
]
] |
arthur801031/3d-multi-resolution-rcnn | [
"8e5454a72f8daa174bf3eabfa5964152f04ab287"
] | [
"mmdet/models/backbones/unet3d.py"
] | [
"# based on implementation: https://github.com/usuyama/pytorch-unet/blob/master/pytorch_unet.py\n\nfrom ..registry import BACKBONES\n\nimport torch\nimport torch.nn as nn\n\ndef double_conv(in_channels, out_channels):\n return nn.Sequential(\n nn.Conv3d(in_channels, out_channels, 3, padding=1),\n n... | [
[
"torch.nn.MaxPool3d",
"torch.nn.ReLU",
"torch.cat",
"torch.nn.Conv3d",
"torch.nn.functional.interpolate"
]
] |
DefTruth/tensorpack | [
"df82c65a29883984a04a75885e0475df19ca4f19"
] | [
"examples/FasterRCNN/predict.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport argparse\nimport itertools\nimport numpy as np\nimport os\nimport shutil\nimport tensorflow as tf\nimport cv2\nimport six\nimport tqdm\n\nassert six.PY3, \"This example requires Python 3!\"\n\nimport tensorpack.utils.viz as tpviz\nfrom tensorpack.predict impor... | [
[
"tensorflow.python.framework.test_util.IsMklEnabled",
"numpy.concatenate",
"tensorflow.test.is_gpu_available"
]
] |
aitoehigie/britecore_flask | [
"eef1873dbe6b2cc21f770bc6dec783007ae4493b"
] | [
"venv/lib/python3.6/site-packages/pylint/test/functional/undefined_variable.py"
] | [
"# pylint: disable=missing-docstring, multiple-statements, useless-object-inheritance\n# pylint: disable=too-few-public-methods, no-init, no-self-use,bare-except,broad-except, import-error\nfrom __future__ import print_function\n\nDEFINED = 1\n\nif DEFINED != 1:\n if DEFINED in (unknown, DEFINED): # [undefined-... | [
[
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
]
] |
QuadCtrl/quad-ctrl | [
"ed1a6b7ee747a7ab045f9591b4747c6a2fe0a2f4"
] | [
"gym_pybullet_drones/envs/BaseAviary.py"
] | [
"import os\nfrom sys import platform\nimport time\nimport collections\nfrom datetime import datetime\nfrom enum import Enum\nimport xml.etree.ElementTree as etxml\nfrom PIL import Image\n# import pkgutil\n# egl = pkgutil.get_loader('eglRenderer')\nimport numpy as np\nimport pybullet as p\nimport pybullet_data\nimpo... | [
[
"numpy.ones",
"numpy.sum",
"numpy.diag",
"numpy.reshape",
"numpy.abs",
"numpy.where",
"numpy.identity",
"numpy.sqrt",
"numpy.tile",
"numpy.zeros",
"numpy.hstack",
"numpy.max",
"numpy.min",
"numpy.linalg.norm",
"numpy.resize",
"numpy.linalg.inv",
... |
aroig/nnutil | [
"88df41ee89f592a28c1661ee8837dd8e8ca42cf3"
] | [
"nnutil/visual/bars.py"
] | [
"import numpy as np\nimport math\n\n_vbars = \" ▁▂▃▄▅▆▇█\"\n\ndef bar_graph(data):\n if len(data) > 64:\n data = np.interp(np.linspace(0, len(data), 64),\n np.arange(0, len(data)),\n np.array(data))\n\n M = max(data)\n def _bar(alpha):\n if math... | [
[
"numpy.array"
]
] |
ValterFallenius/metnet | [
"7cde48a7b5fc0b69a8ce9083f934949362620fd5"
] | [
"metnet/layers/ConvLSTM.py"
] | [
"\"\"\"Originally adapted from https://github.com/aserdega/convlstmgru, MIT License Andriy Serdega\"\"\"\nfrom typing import Any, List, Optional\n\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom torch import Tensor\n\n\nclass ConvLSTMCell(nn.Module):\n \"\"\"ConvLSTM Cell\"\"\"\n\n ... | [
[
"torch.nn.init.calculate_gain",
"torch.nn.functional.sigmoid",
"torch.split",
"torch.nn.Conv2d",
"torch.nn.ModuleList",
"torch.cat"
]
] |
sundogu/ML-Bayes-Rule-Classification | [
"ac476e21130c86d082783ab83b8badd368c87291"
] | [
"bayes_rule_classifier.py"
] | [
"import numpy as np\r\nimport scipy.stats as stats\r\n\r\n\r\nclass Classifier:\r\n # Class Variables\r\n _n_class = _p_m_s = None\r\n\r\n # Constructor\r\n def __init__(self, col_1, col_2, n_class):\r\n self._init_var(col_1, col_2, n_class)\r\n\r\n # Methods\r\n def _init_var(self, col_1, ... | [
[
"numpy.std",
"scipy.stats.norm",
"numpy.mean"
]
] |
wangjinjia1/dcase2019task5_YSU | [
"c307cd118bb27cb913850f80d14f327399145ee9"
] | [
"train.py"
] | [
"#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Jul 3 08:08:11 2019\n\n@author: barry\n\"\"\"\nimport os\nimport sys\nsys.path.insert(1, os.path.join(sys.path[0], '../utils'))\nimport numpy as np\nimport argparse\nimport h5py\nimport math\nimport time\nimport logging\nimport matplotlib.pyp... | [
[
"torch.save",
"torch.cuda.is_available"
]
] |
ahmednader10/Machine_Learning | [
"fab0c7cd773b5e001b56c5349550085e34661e4d"
] | [
"Tensorflow/MNIST/Chapter1.py"
] | [
"import tensorflow as tf\n\nfrom tensorflow.examples.tutorials.mnist import input_data\nmnist = input_data.read_data_sets('MNIST_data', one_hot=True)\n\nX = tf.placeholder(tf.float32, [None, 28, 28, 1])\nW = tf.Variable(tf.zeros([784,10]))\nb = tf.Variable(tf.zeros([10]))\n\nX = tf.reshape(X, [-1, 784])\n#model\nY ... | [
[
"tensorflow.initialize_all_variables",
"tensorflow.placeholder",
"tensorflow.zeros",
"tensorflow.reshape",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.matmul",
"tensorflow.cast",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.Session",... |
anonymousprojs/ISSTA2022-study | [
"94cef7fc4c098c03bb08ff8865d0c1d9a5de86b2"
] | [
"coverage/rq3/rq3_script.py"
] | [
"import argparse\r\nimport configparser\r\nimport os\r\nimport numpy as np\r\nfrom datetime import datetime, date\r\n\r\nfrom pandas import DataFrame\r\n\r\nfrom coverage import root_dir\r\nimport coverage.tools.dataloader as dataloader\r\nfrom coverage.tools import common_utils\r\nimport coverage.tools.model_utils... | [
[
"pandas.DataFrame",
"numpy.random.choice",
"numpy.arange",
"numpy.max",
"numpy.min",
"numpy.concatenate",
"numpy.random.randint",
"numpy.nonzero"
]
] |
BolunDai0216/ConsensusControl | [
"12f36fa3a70897b9e6cbcdab19734ca8360211a5"
] | [
"series3/Exercise2.py"
] | [
"import numpy as np\nimport math\nfrom numpy.linalg import matrix_rank\n\n\ndef main():\n R = np.array([[-2, 0, 2, 0, 0, 0, 0, 0],\n [0, 0, 0, 2, 0, -2, 0, 0],\n [-2, 2, 0, 0, 2, -2, 0, 0],\n [(math.sqrt(14)-2)/2, (math.sqrt(14)+2)/2, 0, 0,\n 0... | [
[
"numpy.linalg.matrix_rank"
]
] |
slps20425/reinforment-learn | [
"fcae362d1fe8458c2b8f00a624aae93c48318141"
] | [
"finlab-20210319T093946Z-001/finlab/crawler.py"
] | [
"import datetime\nimport requests\nimport pandas as pd\nimport pickle\nimport time\nimport urllib\nimport os\nfrom io import StringIO\nimport numpy as np\nimport warnings\nimport os\nimport datetime\nimport time\nfrom tqdm import tnrange, tqdm_notebook\nfrom requests.exceptions import ConnectionError\nfrom requests... | [
[
"pandas.read_pickle",
"pandas.Series",
"pandas.to_numeric",
"pandas.DataFrame",
"pandas.read_html",
"pandas.to_datetime",
"pandas.concat",
"pandas.MultiIndex"
]
] |
abhishekkumkar/dockrized-neural-photo-editor-using-GAN | [
"d234cf1f80cf8c8f621f871dc704dc43e212201f"
] | [
"ML/discgen_utils.py"
] | [
"# Plot Image Grid function imported from Discriminative Regularization for Generative Models by Lamb et al:\n# https://github.com/vdumoulin/discgen\nimport six\nimport matplotlib\nmatplotlib.use('Agg')\nfrom matplotlib import cm, pyplot\nfrom mpl_toolkits.axes_grid1 import ImageGrid\n\n\n\ndef plot_image_grid(imag... | [
[
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.pyplot.close",
"matplotlib.use"
]
] |
bainro/loss_landscape | [
"30bdd84d6946facee973151128bf0ea108c12ca1"
] | [
"plot_surface.py"
] | [
"\"\"\"\n Calculate and visualize the loss surface.\n Usage example:\n >> python plot_surface.py --x=-1:1:101 --y=-1:1:101 --model resnet56 --cuda\n\"\"\"\nimport argparse\nimport copy\nimport h5py\nimport torch\nimport time\nimport socket\nimport os\nimport sys\nimport numpy as np\nimport torchvision\nim... | [
[
"numpy.ones",
"torch.nn.MSELoss",
"torch.manual_seed",
"torch.cuda.device_count",
"torch.nn.CrossEntropyLoss",
"torch.cuda.is_available"
]
] |
WangYuxuan93/IJCAI2019-dp-sa | [
"02ca4234160a102e5481761522a149257bedcc6a"
] | [
"biaffine-parser-sa-bert/data/Dataloader.py"
] | [
"from data.Vocab import *\nimport numpy as np\nimport torch\nfrom torch.autograd import Variable\n\ndef read_corpus(file_path, vocab=None):\n data = []\n with open(file_path, 'r') as infile:\n for sentence in readDepTree(infile, vocab):\n data.append(sentence)\n return data\n\ndef sentenc... | [
[
"numpy.random.shuffle",
"torch.Tensor",
"numpy.zeros",
"torch.LongTensor"
]
] |
VIGNESHinZONE/dgl-lifesci | [
"9a892fd0935a7d8ab125530f54ce1e2a38b2377a"
] | [
"python/dgllife/model/pretrain/__init__.py"
] | [
"# -*- coding: utf-8 -*-\n#\n# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n# SPDX-License-Identifier: Apache-2.0\n#\n# pylint: disable= no-member, arguments-differ, invalid-name\n#\n# Utilities for using pre-trained models.\n\nimport torch\n\nfrom dgl.data.utils import _get_dgl_url, download... | [
[
"torch.load"
]
] |
siddheshshaji/FLAML | [
"ffee24e8afd9009ccb5d269e72f5d50c894da531"
] | [
"test/reg.py"
] | [
"from flaml import AutoML\nfrom sklearn.datasets import fetch_california_housing\n\n# Initialize an AutoML instance\nautoml = AutoML()\n# Specify automl goal and constraint\nautoml_settings = {\n \"time_budget\": 1, # in seconds\n \"metric\": \"r2\",\n \"task\": \"regression\",\n \"log_file_name\": \"t... | [
[
"sklearn.datasets.fetch_california_housing"
]
] |
tanishqjha2298/Toxic-message-filtering-app | [
"bc182b5e2503d5b332e8928aa0e42cc9b58dae2d"
] | [
"flask_api_output.py"
] | [
"# Load libraries\nimport flask\nimport pandas as pd\nimport tensorflow as tf\nimport keras\nfrom keras.models import load_model\n\n# instantiate flask \napp = flask.Flask(__name__)\n\n# load the model, and pass in the custom metric function\nglobal graph\ngraph = tf.get_default_graph()\nmodel = load_model('Model_f... | [
[
"tensorflow.get_default_graph"
]
] |
mlopezarango/Python | [
"2d3d660155241113b23e4ed810e05479b2fc4bba"
] | [
"machine_learning/random_forest_regressor.py"
] | [
"# Random Forest Regressor Example\n\nfrom sklearn.datasets import load_boston\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.metrics import mean_absolute_error\nfrom sklearn.metrics import mean_squared_error\n\n\ndef main():\n\n \"\"\"\n ... | [
[
"sklearn.metrics.mean_squared_error",
"sklearn.metrics.mean_absolute_error",
"sklearn.datasets.load_boston",
"sklearn.ensemble.RandomForestRegressor",
"sklearn.model_selection.train_test_split"
]
] |
mengzaiqiao/TVBR | [
"cdac86a753c41f8f3c55a025be8d88dd305325f5"
] | [
"beta_rec/models/ngcf.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.sparse as sparse\n\nfrom beta_rec.models.torch_engine import ModelEngine\n\n\nclass NGCF(torch.nn.Module):\n \"\"\"Model initialisation, embedding generation and prediction of NGCF.\"\"\"\n\n def __init__(self, config, norm_ad... | [
[
"torch.nn.init.xavier_uniform_",
"torch.nn.Linear",
"torch.split",
"torch.nn.functional.logsigmoid",
"torch.nn.functional.normalize",
"torch.no_grad",
"torch.tensor",
"torch.nn.Embedding",
"torch.mul",
"torch.nn.ModuleList",
"torch.sparse.mm",
"torch.cat",
"torc... |
Tim232/Python-Things | [
"05f0f373a4cf298e70d9668c88a6e3a9d1cd8146"
] | [
"Lectures/DeepLearningClass/chapter5/train_neuralnet_mnist_3_layer_momentum.py"
] | [
"# epoch - 0 , train_acc - 0.0754 , test_acc - 0.0728\n# epoch - 1 , train_acc - 0.86505 , test_acc - 0.865\n# epoch - 2 , train_acc - 0.9139 , test_acc - 0.9139\n# epoch - 3 , train_acc - 0.938466666667 , test_acc - 0.9385\n# epoch - 4 , train_acc - 0.95845 , test_acc - 0.9538\n# epoch - 5 , train_acc - 0.96716666... | [
[
"numpy.random.choice"
]
] |
astrojhgu/ares | [
"42008c8e4bf79f0b000cc833e02a86510bce7611"
] | [
"ares/static/Grid.py"
] | [
"\"\"\"\n\nGrid.py\n\nAuthor: Jordan Mirocha\nAffiliation: University of Colorado at Boulder\nCreated on: Thu Sep 20 14:18:27 2012\n\nDescription: \n\n\"\"\"\n\nimport copy, types\nimport numpy as np\nfrom ..util.Stats import rebin\nfrom collections import Iterable\nfrom ..physics.Hydrogen import Hydrogen\nfrom ..p... | [
[
"numpy.ones",
"numpy.cumsum",
"numpy.zeros",
"numpy.diff",
"numpy.arange",
"numpy.log10",
"numpy.array",
"numpy.linspace"
]
] |
yfukai/exputils | [
"aab7bb69d12887f069e6768144dc767ea82e6306"
] | [
"lib/exputils/plotutils/__init__.py"
] | [
"import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib as mpl\nfrom matplotlib import ticker\nfrom . import cm\n\n#https://stackoverflow.com/questions/31940285/plot-a-polar-color-wheel-based-on-a-colormap-using-python-matplotlib\ndef color_wheel(cmap,fig=plt.figure(),figsize=(4,4)):\n #Generate ... | [
[
"numpy.transpose",
"matplotlib.ticker.LogLocator",
"matplotlib.ticker.LogFormatter",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca",
"numpy.logical_and",
"numpy.argsort",
"matplotlib.ticker.FormatStrFormatter",
"numpy.max",
"numpy.log... |
gujralsanyam22/pyrobot | [
"a0448714857b684d8b280f710e9304988524d2e0"
] | [
"src/pyrobot/vrep_locobot/camera.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 numpy as np\nimport pyrobot.utils.util as prutil\nfrom pyrobot.core import Camera\n\nfrom pyrobot.utils.util import try_cv2_im... | [
[
"numpy.array"
]
] |
DPBayes/data-sharing-examples | [
"f9fffc5b8f45d8dd7b93cb7e812439decfa51193"
] | [
"adult/dp_logistic_regression_onehot/classify_anticipated.py"
] | [
"import pickle, torch\nimport numpy as np\nimport pandas as pd\n\ntarget_epsilons = [1.1, 2.0, 4.0, 8.0, 14.0]\nanticipated_Ts = [2, 5, 10, 20]\nmodels_dict = {}\nfor eps in target_epsilons:\n\tmodels_dict[eps] = pickle.load(open('./res/models_2019-11-05_{}.p'.format(eps), 'rb'))\n\n\nX_test = pd.read_csv('./onehot... | [
[
"numpy.zeros",
"pandas.read_csv",
"numpy.exp",
"numpy.mean",
"numpy.split"
]
] |
aldajo92/UDACITY-SDC_BehavioralCloning | [
"c2119a1bd244d7a4a1da37209e8c6174c9273628"
] | [
"read_and_train_6.py"
] | [
"import csv\nimport cv2\nimport numpy as np\n\n# dataPath: folder path where all IMG's and driving_log's are stored\ndataPath = 'data'\ndriving_log_list = {'driving_log.csv':'IMG', 'driving_log2.csv':'IMG2'}\n\ncorrection = 0.5 # this is a parameter to tune\n\ndef get_image_from_sourcepath(source_path, folder):\n ... | [
[
"numpy.array"
]
] |
qcc4cp/qcc | [
"63227bbe36251b6f0bb3f78f2233337edcef547e"
] | [
"src/subset_sum.py"
] | [
"# python3\n\"\"\"Example: Number set partitioning such set sum(A) == sum(B).\"\"\"\n\n\n# Based on this paper:\n# https://cds.cern.ch/record/467590/files/0010018.pdf\n#\n# For a set A of integers, can A be partitioned into\n# two sets A1 and A2, such that:\n# sum(A1) == sum(A2)\n#\n# For this to work, sum(A) ... | [
[
"numpy.count_nonzero"
]
] |
wookayin/acme | [
"71b2ab8577a118c103718f034fa62c5ad2c0fd97"
] | [
"acme/agents/jax/ppo/networks.py"
] | [
"# Copyright 2018 DeepMind Technologies Limited. 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/licenses/LICENSE-2.0\n#\n# Unle... | [
[
"numpy.prod"
]
] |
Leajian/lpp-py | [
"299860a5d5f52189bb62e50cd4b3eda8aab01553"
] | [
"lpIO.py"
] | [
"import re\nimport json\nfrom numpy import array, squeeze\n\n\ndef sanityCheck(problem):\n hasNaturalConstraints = False\n keywordPattern = re.compile('max|min|s\\.?t\\.?|subject\\s*to|with|end', re.IGNORECASE)\n keywords = re.findall(keywordPattern, problem)\n\n if re.match('max|min', keywords[0], re.I... | [
[
"numpy.array",
"numpy.squeeze"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.