repo_name
stringlengths
6
130
hexsha
list
file_path
list
code
list
apis
list
zhooda/learn-ml
[ "e35765fdc3b27fd923cff89cc086d5093eeee25b" ]
[ "src/derivatives.py" ]
[ "import matplotlib.pyplot as plt\nimport numpy as np\n\ndef f(x):\n return 2*x**2\n\nx = np.arange(0, 5, 0.001)\ny = f(x)\n\nplt.plot(x, y)\n\ncolors = ['k', 'g', 'r', 'b', 'c']\n\ndef approximate_tangent_line(x, approximate_derivative):\n return (approximate_derivative*x) + b\n\nfor i in range(5):\n p2_de...
[ [ "matplotlib.pyplot.plot", "numpy.arange", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter" ] ]
dumpmemory/Uneven_training_data
[ "63350037744b761619d4d8bc7d2122d2bffa2c95" ]
[ "cartography/classification/run_glue.py" ]
[ "# coding=utf-8\n# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.\n# Copyright (c) 2018, NVIDIA CORPORATION. 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...
[ [ "scipy.stats.entropy.size", "torch.max", "torch.load", "numpy.squeeze", "torch.utils.data.DataLoader", "numpy.mean", "torch.no_grad", "torch.cuda.manual_seed_all", "torch.cuda.is_available", "torch.device", "torch.distributed.get_rank", "numpy.zeros_like", "torc...
ajd98/shap
[ "922fa0fe9f198011edd875289fc68b906ff9f2b8" ]
[ "shap/explainers/kernel.py" ]
[ "from iml.common import convert_to_instance, convert_to_model, match_instance_to_data, match_model_to_data, convert_to_instance_with_index\nfrom iml.explanations import AdditiveExplanation\nfrom iml.links import convert_to_link, IdentityLink\nfrom iml.datatypes import convert_to_data, DenseData\nfrom scipy.special ...
[ [ "numpy.sqrt", "sklearn.cluster.KMeans", "numpy.squeeze", "pandas.DataFrame", "numpy.hstack", "numpy.reshape", "numpy.arange", "sklearn.linear_model.Lasso", "numpy.ceil", "numpy.zeros", "pandas.concat", "numpy.nonzero", "numpy.random.choice", "scipy.special.b...
brendanjmeade/dmd_gps
[ "bddc401e7a2e8d0fb44fa830d58197f1319b11c9" ]
[ "dmd_japan.py" ]
[ "import json\nimport datetime\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport pydmd as dmd\n\nplt.close(\"all\")\n\n\nwith open('GeonetTimeSeries.json') as json_file: \n data = json.load(json_file)\n\nn_stations = len(data)\nstation_idx = 1\nstation_data = data[station_idx]\n\n# Loop over all time ...
[ [ "matplotlib.pyplot.matshow", "matplotlib.pyplot.show", "numpy.zeros", "matplotlib.pyplot.close" ] ]
zhfeing/deep-learning-lib-PyTorch
[ "f96e3a71ae2dbeb44696725ec127ff8f37d4c6e9" ]
[ "cv_lib/classification/models/cifar_large_resnet.py" ]
[ "import torch.nn as nn\r\nimport torch.nn.functional as F\r\n\r\n\r\n__all__ = [\r\n \"ResNet_CL\",\r\n \"resnet18_cl\",\r\n \"resnet34_cl\",\r\n \"resnet50_cl\",\r\n \"resnet101_cl\",\r\n \"resnet152_cl\"\r\n]\r\n\r\n\r\nclass BasicBlock(nn.Module):\r\n expansion = 1\r\n\r\n def __init__(se...
[ [ "torch.nn.Sequential", "torch.nn.init.constant_", "torch.nn.ModuleList", "torch.nn.Conv2d", "torch.nn.Linear", "torch.nn.functional.relu", "torch.nn.AdaptiveAvgPool2d", "torch.nn.BatchNorm2d", "torch.nn.init.kaiming_normal_" ] ]
photoszzt/pytorch
[ "f2857883c4c148ced4f920431b38532fe8081b73" ]
[ "test/distributed/test_c10d_gloo.py" ]
[ "import copy\nimport logging\nimport math\nimport operator\nimport os\nimport random\nimport sys\nimport tempfile\nimport unittest\nfrom functools import reduce\nfrom itertools import groupby\n\nimport torch\nimport torch.distributed as c10d\n\nif not c10d.is_available():\n print(\"c10d not available, skipping t...
[ [ "torch.nn.functional.softmax", "torch.randint", "torch.testing._internal.common_utils.find_free_port", "torch.zeros", "torch.load", "torch.testing._internal.common_distributed.verify_ddp_error_logged", "torch.distributed.PrefixStore", "torch.sparse_coo_tensor", "torch.FloatTens...
zhangyingying94/models
[ "bf46247b4207698bbeb315d9086eb81662015359" ]
[ "adversarial_text/data/data_utils.py" ]
[ "# Copyright 2017 Google, Inc. 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 required by app...
[ [ "tensorflow.gfile.MakeDirs", "tensorflow.train.SequenceExample", "tensorflow.python_io.TFRecordWriter" ] ]
mrdon/manim
[ "d023c76cdef915226bb9a1e41c20168959a02881" ]
[ "manim/scene/scene.py" ]
[ "\"\"\"Basic canvas for animations.\"\"\"\n\n\n__all__ = [\"Scene\"]\n\n\nimport inspect\nimport random\nimport warnings\nimport platform\nimport copy\n\nfrom tqdm import tqdm as ProgressDisplay\nimport numpy as np\n\nfrom .. import config, logger\nfrom ..animation.animation import Animation, Wait\nfrom ..animation...
[ [ "numpy.max", "numpy.arange", "numpy.random.seed" ] ]
AutoDash/AutoDash
[ "3924795a04159f80ea3b65b2172747babd15f35f" ]
[ "src/executor/SegmentSplitter.py" ]
[ "from ..data.VideoItem import VideoItem\nfrom ..data.VideoFile import VideoFile\nfrom .iExecutor import iExecutor\nfrom ..signals.SkipSignal import SkipSignal\nimport re\nimport numpy as np\n\nclass SegmentSplitter(iExecutor):\n def __init__(self, *parents, clip_length='5s', length_threshold='3s'):\n supe...
[ [ "numpy.searchsorted", "numpy.array", "numpy.sort", "numpy.unique" ] ]
Joao16am/si
[ "813ca373022fc5ee35eac69147b5567275718b46" ]
[ "src/si/util/im2col.py" ]
[ "import numpy as np\n\n\ndef calc_pad_dims_2D(X_shape, out_dim, kernel_shape, stride):\n if not isinstance(X_shape, tuple):\n raise ValueError(\"`X_shape` must be of type tuple\")\n\n if not isinstance(out_dim, tuple):\n raise ValueError(\"`out_dim` must be of type tuple\")\n\n if not isinsta...
[ [ "numpy.pad", "numpy.arange", "numpy.tile", "numpy.array", "numpy.zeros" ] ]
SWang848/DCRAC
[ "695d83063cf484cd54d7744c8c719fde94c3cde5" ]
[ "history.py" ]
[ "import numpy as np\nimport time\nimport cv2\ntry:\n from PIL import Image\nexcept:\n import Image\n\nfrom utils import *\n\n\nclass History():\n \"\"\"\n Manages frame history\n \"\"\"\n\n def __init__(self, length, im_shape, nb_action):\n \"\"\"\n Args:\n len...
[ [ "numpy.zeros", "numpy.roll", "numpy.ones" ] ]
Wendy-Xiao/ext_summ_disco_tree_attn
[ "5ff99c8260350c677e140b02521c75ac03d16673" ]
[ "utils.py" ]
[ "from collections import Counter\nfrom pathlib import Path\nfrom random import random\nimport rouge_papier_v2\nimport pandas as pd\nimport re\nimport numpy as np\nimport os\nimport json \nimport torch\nimport os\nimport subprocess\n# import matplotlib.pyplot as plt\n\n# Utility functions\ndef get_posweight(inputs_d...
[ [ "numpy.asarray", "numpy.array", "torch.load" ] ]
mrshu/onnxruntime
[ "a7a2a16edddc283b53d7737f897b4bbda5e86209" ]
[ "orttraining/orttraining/test/python/orttraining_test_ortmodule_poc.py" ]
[ "import argparse\nimport logging\nimport os\nimport torch\nimport time\nfrom torchvision import datasets, transforms\n\nimport onnxruntime\nfrom onnxruntime.training import ORTModule\n\n\nclass NeuralNet(torch.nn.Module):\n def __init__(self, input_size, hidden_size, num_classes):\n super(NeuralNet, self)...
[ [ "torch.nn.CrossEntropyLoss", "torch.manual_seed", "torch.nn.Linear", "torch.no_grad", "torch.cuda.is_available", "torch.nn.ReLU" ] ]
haochenucr/scdiff2
[ "ebc4149851399b2f15ed5b5874d44764b5f130fb" ]
[ "scdiff2/prerun.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n# Author: Jun Ding\n# Email: junding (at) cs (dot) cmu (dot) edu\n# Date: June. 29th, 2020\n# \n# This scdiff software suite is desinged to infer the clusters, trajectories, and regulatory\n# networks underlying dynamic biological process (e.g., cell differntiation, disease ...
[ [ "matplotlib.use" ] ]
IQcollaboratory/galpopFM
[ "1b30abc1cc2fd1119d0f34a237b0c1112d7afc9d" ]
[ "galpopfm/dust_infer.py" ]
[ "'''\n\n\n\n'''\nimport os \nimport sys \nimport h5py \nimport numpy as np \nfrom scipy.stats import chi2 \nnp.seterr(divide='ignore', invalid='ignore')\n# -- abcpmc -- \nimport abcpmc\nfrom abcpmc import mpi_util\n# -- galpopfm --\nfrom . import dustfm as dustFM\nfrom . import measure_obs as measureObs\n\ndat_dir ...
[ [ "scipy.stats.chi2.rvs", "numpy.abs", "numpy.isfinite", "numpy.random.seed", "numpy.arange", "numpy.median", "numpy.cumsum", "numpy.histogramdd", "numpy.concatenate", "numpy.seterr", "numpy.random.normal", "numpy.random.rand", "numpy.array", "numpy.sum", ...
PedrV/stfX
[ "017436cd4ade7f0ea95185d82408697c43ac6ce6" ]
[ "validation/utils/m1.py" ]
[ "import unittest\nimport os\nfrom matplotlib import pyplot as plt\nfrom shapely import geometry, affinity\n\nX_COORDINATE = 0\nY_COORDINATE = 1\n\n\ndef extract_x_y(polygon: list) -> (list, list):\n \"\"\"Extract the x and y coordinates as two separate lists\"\"\"\n x_list = []\n y_list = []\n\n for ver...
[ [ "matplotlib.pyplot.figure", "matplotlib.pyplot.savefig", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.fill", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylabel" ] ]
rostyboost/cvxpy
[ "95e728b01b6bb442c924812c7eac631019c5cbc6" ]
[ "cvxpy/tests/test_examples.py" ]
[ "\"\"\"\nCopyright 2013 Steven Diamond\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://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to i...
[ [ "numpy.random.random", "numpy.random.seed", "numpy.logspace", "scipy.sparse.eye", "numpy.eye", "scipy.sparse.rand", "numpy.linalg.norm", "numpy.ones", "numpy.random.normal", "numpy.random.randn", "numpy.array", "numpy.zeros", "numpy.random.randint" ] ]
nids2001/UncertainSCI
[ "b3105bddc064575477589d7a930c71fa3149ef36" ]
[ "demos/anisotropic_distribution.py" ]
[ "# Demonstrates generation of anisotropic distributions. Example is similar to\n# quantiles.py demo.\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\nfrom UncertainSCI.distributions import BetaDistribution\nfrom UncertainSCI.model_examples import sine_modulation\nfrom UncertainSCI.indexing import Tota...
[ [ "matplotlib.pyplot.legend", "numpy.linspace", "numpy.arange", "matplotlib.pyplot.plot", "matplotlib.pyplot.fill_between", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.show", "numpy.zeros" ] ]
ZohrehShams/IntegrativeRuleExtractionMethodology
[ "fd7b569d11de540ffe94e0cc588e78305e45689e" ]
[ "code/src/functionality_helpers.py" ]
[ "import numpy as np\nimport pickle\nimport dnn_re\nfrom evaluate_rules.predict_explain import predict_explain, print_explanation\nfrom evaluate_rules.overlapping_features import features_recurrence_in_explanation\nfrom src import *\nfrom evaluate_rules.predict_explain import predict_explain, print_explanation\nfrom...
[ [ "numpy.load", "numpy.random.uniform", "numpy.random.seed", "numpy.random.randint" ] ]
Justin-A/PyTorch-tutorials-kr
[ "0d8e407523e5e75de0081becf800b82b37eb912f" ]
[ "intermediate_source/pruning_tutorial.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\n가지치기 기법(Pruning) 튜토리얼\n=====================================\n**저자**: `Michela Paganini <https://github.com/mickypaganini>`_\n**번역** : `안상준 <https://github.com/Justin-A>`_\n\n최첨단 딥러닝 모델들은 굉장히 많은 수의 파라미터값들로 구성되기 때문에, 쉽게 배포되기 어렵습니다.\n이와 반대로, 생물학적 신경망들은 효율적으로 희소하게 연결된 것으로 알려져 있습니다.\n모...
[ [ "torch.nn.utils.prune.ln_structured", "torch.nn.utils.prune.remove", "torch.nn.Conv2d", "torch.sum", "torch.nn.Linear", "torch.nn.utils.prune.l1_unstructured", "torch.cuda.is_available", "torch.nn.utils.prune.global_unstructured", "torch.nn.utils.prune.random_unstructured" ] ...
CWSmith022/yigit-lab
[ "8ec1f7d0242d36351ef92bc6698358c9431f4c34" ]
[ "AGONS/AGONS/test.py" ]
[ "# %%\n\"\"\"Test how custom functions work with sklearn package.\"\"\"\nimport numpy as np\nfrom sklearn.preprocessing import FunctionTransformer\nfrom sklearn.preprocessing import StandardScaler, MinMaxScaler\nx = np.array([[1,2,3], [6,5,4], [8,7,9]])\nprint(x)\ndef SSRow(X):\n X_ = X.copy()\n X_t = Standar...
[ [ "sklearn.preprocessing.StandardScaler", "numpy.array", "sklearn.preprocessing.MinMaxScaler", "sklearn.preprocessing.FunctionTransformer" ] ]
hoaaoh/Audio2Vec
[ "96711c2300646ce10878113fa0d506d703db96d7" ]
[ "src/plot_perfomance.py" ]
[ "#!/usr/bin/env python3\n\nimport argparse\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.interpolate import spline\ndef main():\n AE_small_list = [ 0.730, 0.685, 0.737, 0.693, 0.881, 0.713 ]\n AE_large_list = [ 0.234, 0.307, 0.400, 0.323, 0.317, 0.233 ]\n ### m = [ 3, 6, 10, 15, 21, 26 ]...
[ [ "matplotlib.pyplot.legend", "matplotlib.pyplot.plot", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.show", "matplotlib.pyplot.ylabel" ] ]
Boltuzamaki/Monk_Object_Detection
[ "baf113ef6db8b531d0ef6413538e49d422163a20" ]
[ "12_tf_obj_1/lib/calculate_map.py" ]
[ "# Code from - https://github.com/Cartucho/mAP\n\nimport glob\nimport json\nimport os\nimport shutil\nimport operator\nimport sys\nimport argparse\nimport math\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n\n\n\ndef log_average_miss_rate(prec, rec, num_images):\n \"\"\"\n log-average miss rate:\...
[ [ "matplotlib.pyplot.legend", "matplotlib.pyplot.gca", "numpy.maximum", "matplotlib.pyplot.title", "numpy.logspace", "matplotlib.pyplot.gcf", "numpy.insert", "matplotlib.pyplot.close", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.text", "matplotlib.pyplot.show", "nu...
USEPA/sensortoolkit
[ "a9da32fd4df492154c6e4cc570011d14e933ee83" ]
[ "sensortoolkit/evaluation_objs/_sensor_eval.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nTop-level analysis module for the ``sensortoolkit`` library.\n\nContains the front-facing ``SensorEvaluation`` class for conducting analysis\nof sensor data.\n\n===============================================================================\n\n@Author:\n | Samuel Frederick, NSSC...
[ [ "pandas.to_datetime", "matplotlib.pyplot.subplots", "pandas.Timedelta", "pandas.DataFrame", "pandas.to_timedelta" ] ]
markyong97/retinafacetest
[ "b72317d682c9e17492f5418073073e63c4ce2ce2" ]
[ "retinaface/inference.py" ]
[ "import argparse\nimport json\nfrom pathlib import Path\nfrom typing import Any, Dict, List, Optional, Tuple, Union\n\nimport albumentations as albu\nimport cv2\nimport numpy as np\nimport torch\nimport torch.nn.parallel\nimport torch.utils.data\nimport torch.utils.data.distributed\nimport yaml\nfrom albumentations...
[ [ "torch.nn.functional.softmax", "torch.distributed.init_process_group", "torch.utils.data.distributed.DistributedSampler", "torch.utils.data.DataLoader", "numpy.tile", "torch.no_grad", "torch.where", "torch.device", "numpy.array", "torch.nn.parallel.DistributedDataParallel" ...
pentschev/xarray
[ "de6144c0e8c8fc316cfc412a2057af4d1a04edfd" ]
[ "xarray/tests/test_dataset.py" ]
[ "import pickle\nimport sys\nimport warnings\nfrom copy import copy, deepcopy\nfrom io import StringIO\nfrom textwrap import dedent\n\nimport numpy as np\nimport pandas as pd\nimport pytest\nfrom pandas.core.computation.ops import UndefinedVariableError\nfrom pandas.core.indexes.datetimes import DatetimeIndex\nfrom ...
[ [ "pandas.tseries.frequencies.to_offset", "pandas.Series", "numpy.linspace", "numpy.asarray", "numpy.issubdtype", "pandas.MultiIndex.from_tuples", "pandas.DataFrame", "numpy.dtype", "numpy.random.randn", "numpy.mean", "scipy.integrate.cumtrapz", "numpy.trapz", "nu...
vfcosta/coegan-trained
[ "44174e68909d9c03bf2e4b7e4c7a48237a560183" ]
[ "evolution/evaluator.py" ]
[ "import util.tools as tools\nfrom util import config\nimport torch\nimport logging\nimport numpy as np\nfrom evolution.population import Population\n\nlogger = logging.getLogger(__name__)\n\n\nclass Evaluator:\n\n def __init__(self, train_loader, validation_loader):\n self.train_loader = train_loader\n ...
[ [ "numpy.random.choice", "torch.cat", "torch.cuda.empty_cache", "torch.no_grad", "numpy.array" ] ]
ReneeYe/XSTNet
[ "c5e508aed878d13fea790caee71db1ce77619465", "c5e508aed878d13fea790caee71db1ce77619465" ]
[ "neurst/tasks/cross_modal_translation.py", "neurst/tasks/seq2seq.py" ]
[ "# Copyright 2020 ByteDance Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agre...
[ [ "tensorflow.data.experimental.group_by_window", "tensorflow.cond", "tensorflow.TensorShape", "tensorflow.constant", "tensorflow.concat", "tensorflow.shape", "tensorflow.less", "tensorflow.reshape", "tensorflow.cast", "tensorflow.expand_dims", "tensorflow.where", "te...
Albert0147/G-SFDA
[ "6ded750224266cd4cdb100a7fcedfa95688d22da" ]
[ "train_tar_visda.py" ]
[ "import argparse\nimport os, sys\nimport os.path as osp\nimport torchvision\nimport numpy as np\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom torchvision import transforms\nimport network, loss\nfrom torch.utils.data import DataLoader\nfrom data_list import ImageList, ImageList_idx\nimport...
[ [ "torch.nn.functional.normalize", "torch.nn.Softmax", "torch.mean", "torch.max", "torch.cuda.manual_seed", "numpy.random.seed", "torch.load", "torch.randn", "torch.manual_seed", "torch.utils.data.DataLoader", "numpy.round", "torch.utils.data.random_split", "torch...
maxburke/arrow
[ "344ed4bed675c4913db5cc7b17d0e6cc57ea55c4" ]
[ "python/pyarrow/tests/test_parquet.py" ]
[ "# -*- coding: utf-8 -*-\n# 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....
[ [ "pandas.Categorical.from_codes", "pandas.concat", "pandas.to_datetime", "pandas.Series", "numpy.random.seed", "pandas.Timestamp", "numpy.arange", "pandas.Categorical", "pandas.DataFrame", "pandas.MultiIndex.from_arrays", "pandas.util.testing.assert_frame_equal", "nu...
dddd1007/mne-python
[ "844d53c866bbea932dd6c89ab444bb7f882f0b6f" ]
[ "mne/viz/_brain/_brain.py" ]
[ "# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>\n# Eric Larson <larson.eric.d@gmail.com>\n# Oleh Kozynets <ok7mailbox@gmail.com>\n# Guillaume Favelier <guillaume.favelier@gmail.com>\n# jona-sassenhagen <jona.sassenhagen@gmail.com>\n# Joan Massich <mailsik@gm...
[ [ "numpy.diag", "numpy.dot", "numpy.asarray", "numpy.in1d", "numpy.round", "numpy.max", "numpy.concatenate", "matplotlib.image.imread", "numpy.mean", "numpy.any", "numpy.searchsorted", "numpy.cross", "numpy.where", "numpy.clip", "numpy.unique", "numpy....
tuq820/efficientdet_with_landmark
[ "438d92168e5bb91d9ea9bd4b5c743ef41f936fde" ]
[ "train.py" ]
[ "import os\nimport argparse\nimport torch\nimport torch.nn as nn\nfrom torch.utils.data import DataLoader\nfrom torchvision import transforms\nfrom src.dataset import CocoDataset, Resizer, Normalizer, Augmenter, collater, MaJiaDataset\nfrom src.model import EfficientDet\nfrom tensorboardX import SummaryWriter\nimpo...
[ [ "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.cuda.manual_seed", "torch.load", "torch.manual_seed", "torch.utils.data.DataLoader", "torch.nn.DataParallel", "numpy.mean", "torch.rand", "torch.cuda.is_available", "torch.no_grad", "torch.cuda.device_count" ] ]
maneeshdisodia/skills-ml
[ "194b262aa5bad1af381d1f63f8b327cf96523950" ]
[ "skills_ml/algorithms/sampling/methods.py" ]
[ "\"\"\"Generic sampling methods\"\"\"\nimport numpy as np\nimport heapq as hq\nimport random\n\ndef reservoir(it, k):\n \"\"\"Reservoir sampling with Random Sort from a job posting iterator\n\n Randomly choosing a sample of k items from a streaming iterator. Using random sort to implement the algorithm.\n ...
[ [ "numpy.random.uniform" ] ]
bird-house/blackswan
[ "5f1f20423874315f5e8eea2cf7302f9d0c05adae" ]
[ "blackswan/pythonanattribution.py" ]
[ "# import logging\n# LOGGER = logging.getLogger(\"PYWPS\")\n\nimport pandas\nimport random\nimport numpy as np\n\n\ndef analogs_generator(anafile, yfile, nsim=20):\n \"\"\"\n Simulates nsim values of the variable y using analogues for all the dates present in the file anafile\n \n :param anafile: path t...
[ [ "pandas.read_table", "pandas.concat", "numpy.repeat", "pandas.DataFrame" ] ]
PrateekMunjal/TorchAL
[ "ec60b093333c66e4c8862d128d81680060fddf36", "ec60b093333c66e4c8862d128d81680060fddf36" ]
[ "al_utils/vae_sampling.py", "pycls/models/resnet_style/shake_shake_function.py" ]
[ "import torch\nimport os\nimport math\nimport numpy as np\nfrom copy import deepcopy\nfrom pycls.core.config import cfg\nimport pycls.utils.distributed as du\nfrom tqdm import tqdm\n\n\nclass AdversarySampler:\n def __init__(self, budget):\n self.budget = budget\n self.cuda_id = torch.cuda.current_...
[ [ "numpy.dot", "torch.transpose", "torch.mm", "torch.cuda.current_device", "numpy.min", "numpy.arange", "torch.reshape", "torch.min", "torch.cat", "torch.from_numpy", "numpy.concatenate", "numpy.argmax", "torch.no_grad", "torch.stack", "numpy.argsort", ...
SchernHe/FairML
[ "ebd32df6dec1d5232e05e18c88e89179a420659e" ]
[ "fairml/metrics/utils.py" ]
[ "\"\"\"Provides useful functions to calculate fairness metrics\"\"\"\nfrom sklearn.metrics import confusion_matrix, accuracy_score, precision_score\nimport numpy as np\nimport pandas as pd\n\n\ndef calculate_precision(df, target_variable, prediction_variable):\n \"\"\"Calculate precision / positive predictive va...
[ [ "numpy.arange", "sklearn.metrics.precision_score", "sklearn.metrics.confusion_matrix", "numpy.array", "sklearn.metrics.accuracy_score" ] ]
mpiecka/metalcode
[ "b0306dc9d8de53d797c946254fa63fa8b3fbf093" ]
[ "metalcode_v1_0.py" ]
[ "from numpy import *\r\nimport matplotlib.pyplot as plt\r\nimport time\r\nimport os\r\nimport warnings\r\nwarnings.filterwarnings(\"ignore\", category=VisibleDeprecationWarning)\r\n\r\n# from metalcode_calib_metal import metal_transf\r\nfrom metalcode_calib_tempe import Teff\r\nfrom metalcode_calib_tempe import Bol...
[ [ "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.locator_params", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.subplot", "matplotlib.pyplot.close", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.figure" ] ]
haoyu0831/Covid-Mobility-Network-Analysis
[ "8464b0a25db03585219c1fc6d8e257a9ed826628" ]
[ "model.py" ]
[ "import networkx as nx\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\n'''\nThis function is to generate a graph with data produced by read_file.py\n'''\n\n\ndef generate_d_network(dest_cbgs):\n G = nx.DiGraph()\n # add edges\n for i in dest_cbgs:\n G.add_edge(*i, weight=dest_cbgs[i])\n\n ...
[ [ "numpy.array" ] ]
cperreault11/scikit-learn
[ "0b78cb00e69109f498c326ad84953954e349d11f" ]
[ "sklearn/dummy.py" ]
[ "# Author: Mathieu Blondel <mathieu@mblondel.org>\n# Arnaud Joly <a.joly@ulg.ac.be>\n# Maheshakya Wijewardena <maheshakya.10@cse.mrt.ac.lk>\n# License: BSD 3 clause\n\nimport warnings\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom .base import BaseEstimator, ClassifierMixin, RegressorMixin\n...
[ [ "numpy.log", "scipy.sparse.issparse", "numpy.reshape", "numpy.asarray", "numpy.median", "numpy.tile", "numpy.percentile", "numpy.ones", "numpy.atleast_1d", "numpy.isscalar", "numpy.ravel", "numpy.array", "numpy.average", "numpy.zeros", "numpy.where", ...
ceausuveronica/OpenCV-projects
[ "fe9a95eead97212de5afeb59b31a8996ce7fb116" ]
[ "colored-led-counter/app.py" ]
[ "# import the necessary packages\nimport argparse\nimport numpy as np\nfrom pprint import pprint\n\n\ntry:\n from cv2 import cv2\n\n ap = argparse.ArgumentParser()\n ap.add_argument(\"-i\", \"--image\", required=True,\n help=\"path to the input image\")\n ap.add_argument(\"-c\", \"--c...
[ [ "numpy.array", "numpy.zeros" ] ]
jtmccr1/variant_pipeline
[ "b4a26398a5707814884cbf80a2e22032476e6479" ]
[ "scripts/position_data.py" ]
[ "from __future__ import division\nimport pysam\nimport numpy as np\nimport yaml \nfrom Bio import SeqIO \nfrom Bio.Seq import Seq\nfrom Bio.Alphabet import generic_dna\n#from scripts.seq_classes import locus, segment, tally, allele # %%\nfrom seq_classes import locus, segment, tally, allele\n#from scripts.trim_to_r...
[ [ "numpy.cumsum" ] ]
willzhang100/diora
[ "40b3533e0a181c23cb3d17a65fca528c72813cfb" ]
[ "pytorch/diora/net/outside_index.py" ]
[ "import torch\nfrom diora.net.offset_cache import get_offset_cache\n\n\nclass OutsideIndex(object):\n def get_pairs(self, level, i, n):\n \"\"\"\n Returns all (parent, sibling) coordinate pairs that\n are used to construct a node at coordinates\n (level, i) where there n leaf nodes.\n...
[ [ "torch.cuda.current_device", "torch.tensor" ] ]
Geolem/tensorflow
[ "cfc9d3e1ba3b50dc66f1b81eaea537772ab16024" ]
[ "tensorflow/python/distribute/collective_all_reduce_strategy.py" ]
[ "# Copyright 2018 The TensorFlow Authors. 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 requ...
[ [ "tensorflow.python.distribute.distribute_lib.StrategyExtendedV1.__init__", "tensorflow.python.platform.tf_logging.error", "tensorflow.python.eager.context.async_wait", "tensorflow.python.distribute.numpy_dataset.SingleDevice", "tensorflow.python.framework.ops.executing_eagerly_outside_function...
a07458666/UncertaintyFlow
[ "cef2512901d4e27bb22fc3997522cd47c03b569c" ]
[ "module/dun_datasets/additional_gap_loader.py" ]
[ "import zipfile\r\nimport pickle\r\ntry:\r\n import urllib\r\n from urllib import urlretrieve\r\nexcept Exception:\r\n import urllib.request as urllib\r\nfrom os import path\r\n\r\nimport numpy as np\r\nfrom numpy.random import uniform, randn\r\nimport matplotlib.pyplot as plt\r\nfrom sklearn.model_selecti...
[ [ "numpy.hstack", "numpy.abs", "numpy.random.seed", "numpy.eye", "sklearn.model_selection.train_test_split", "numpy.save", "numpy.stack", "numpy.concatenate", "numpy.random.uniform", "numpy.sin", "numpy.cos", "numpy.random.randn", "numpy.load", "numpy.zeros" ...
sumanbanerjee1/Code-Mixed-Dialog
[ "9df1d4dc800548a883f8bc1a9ce4116c77aebc02" ]
[ "code/train_seq2seq.py" ]
[ "import tensorflow as tf\nimport numpy as np\nimport json\nimport pickle\nimport os\nimport subprocess\nimport matplotlib.pyplot as plt\nimport matplotlib.ticker as ticker\n\nfrom tqdm import tqdm\nfrom seq2seq.model import Seq2seqModel\nfrom seq2seq.data_utils import pad, replace_token_no, get_len\n\nflags = tf.ap...
[ [ "tensorflow.train.get_checkpoint_state", "matplotlib.ticker.MultipleLocator", "tensorflow.Graph", "numpy.asarray", "numpy.squeeze", "matplotlib.pyplot.savefig", "tensorflow.global_variables_initializer", "numpy.delete", "numpy.mean", "numpy.row_stack", "tensorflow.Sessi...
LaplaceKorea/Data
[ "8c16fc8c4cc29c1dc42d340ba1452c7fbc222bd3" ]
[ "FeaturesSP500.py" ]
[ "\nfrom typing import Any, Dict, List, Tuple\nfrom Config import cfg\nfrom Features import *\nimport numpy as np\n\nDELAYED_BID = 66\nDELAYED_ASK = 67\nDELAYED_LAST = 68\nDELAYED_BID_SIZE = 69\nDELAYED_ASK_SIZE = 70\nDELAYED_LAST_SIZE = 71\nDELAYED_HIGH = 72\nDELAYED_LOW = 73\nDELAYED_VOLUME = 74\nDELAYED_CLOSE = 7...
[ [ "numpy.vstack" ] ]
Chen-Yifan/weaver
[ "431a1427a185fa6357e40b729b8adcf263c349d2" ]
[ "utils/data/config.py" ]
[ "import numpy as np\nimport yaml\nimport copy\n\nfrom ..logger import _logger\nfrom .tools import _get_variable_names\n\n\ndef _as_list(x):\n if x is None:\n return None\n elif isinstance(x, (list, tuple)):\n return x\n else:\n return [x]\n\n\ndef _md5(fname):\n '''https://stackover...
[ [ "numpy.array" ] ]
developmentseed/label-maker-dask
[ "700d2fa224ac674171fd8c4f8709a67f862eac36" ]
[ "label_maker_dask/utils.py" ]
[ "# pylint: disable=unused-argument\n\"\"\"Provide utility functions\"\"\"\nimport os\nfrom io import BytesIO\nfrom urllib.parse import parse_qs\n\nimport numpy as np\nimport rasterio\nimport requests # type: ignore\nfrom mercantile import Tile, bounds\nfrom PIL import Image, ImageColor\nfrom rasterio.crs import CR...
[ [ "numpy.count_nonzero", "numpy.moveaxis" ] ]
DanielCalimayor/DS-Unit-3-Sprint-3-Productization-and-Cloud
[ "d1479de0badb674daf9cbb8b5f738d214de831ed" ]
[ "Iris_Deploy.py" ]
[ "#!/usr/bin/env python\n# coding: utf-8\n\n# In[ ]:\n\n\n#pip install pickle-mixin\n\n\n# In[1]:\n\n\n#import the basics but important libraries\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n#Sklearn Preprocessing\nfrom sklearn.preprocessing import LabelEncoder\...
[ [ "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.tree.DecisionTreeClassifier", "sklearn.preprocessing.LabelEncoder", "sklearn.metrics.classification_report", "matplotlib.pyplot.hist", "matplotlib.pyplot.show", "sklearn.metrics.accuracy_score" ] ]
cnheider/MinkowskiEngine
[ "ae6db31203ba012df2f695576e2d3819d49bf2d7" ]
[ "examples/indoor.py" ]
[ "# Copyright (c) Chris Choy (chrischoy@ai.stanford.edu).\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# use, co...
[ [ "torch.load", "torch.from_numpy", "torch.no_grad", "torch.cuda.is_available", "numpy.array" ] ]
AcodeC/video
[ "5d4497621cba764dc51ae22b10e1196c6e9e28bc" ]
[ "dataset/transform.py" ]
[ "import math\nimport re\nimport string\n\nimport numpy as np\nimport torch\n\n\nclass UniformSample:\n def __init__(self, n_sample):\n self.n_sample = n_sample\n\n def __call__(self, frames):\n n_frames = len(frames)\n if n_frames < self.n_sample:\n return frames\n\n sam...
[ [ "numpy.linspace", "numpy.random.choice", "numpy.asarray", "torch.from_numpy", "numpy.random.normal", "numpy.zeros_like" ] ]
isomorphicdude/Highlighted-Text-OCR
[ "07557bf77172b5e411f83352d8c4a6ba1b46fe6a" ]
[ "detect_mask_and_ocr.py" ]
[ "import cv2\r\nimport numpy as np\r\nimport torch\r\nimport easyocr\r\n\r\n# Reading the image\r\n\r\nimg = cv2.imread('image.jpg')\r\n\r\n#define kernel size \r\nkernel = np.ones((7,7),np.uint8)\r\n\r\n\r\n# convert to hsv colorspace \r\nhsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\r\n\r\n# lower bound and upper bo...
[ [ "numpy.array", "numpy.ones" ] ]
OSUmageed/pyHeatTransfer
[ "b1db8ca7594a657826a1ccfb38a4e4eb102cce55" ]
[ "pyHeatTransfer/conduction.py" ]
[ "#I suppose the idea is that it gets these values from somewhere and takes off.\r\n#Regardless of where those values come from.\r\n\r\nimport os\r\nimport os.path as op\r\nimport sys\r\nimport numpy as np\r\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\nimport CoolProp.CoolProp as cp\r\nimport coll...
[ [ "matplotlib.pyplot.clabel", "numpy.meshgrid", "numpy.arange", "matplotlib.pyplot.contour", "numpy.zeros_like", "matplotlib.pyplot.grid", "numpy.interp", "matplotlib.pyplot.xlabel", "numpy.array", "matplotlib.pyplot.show", "matplotlib.pyplot.ylabel" ] ]
pranavsb/RL_smart_grid
[ "b23b407d3c873171d9a2af6d5a0104a7bcadc6cd" ]
[ "model/DynamicPricing.py" ]
[ "from Environment import Environment\nfrom QTableAgent import QTableAgent\nimport time, os\nimport numpy as np\nimport pickle\nfrom Utils import get_battery_reward_factor\n\nSOURCE_DEMAND_STATE = 'demand'\nSOURCE_SMART_LOADS = True\nSOURCE_LEARNING_RATE = 0.03\nSOURCE_DISCOUNT_FACTOR = 0.95\nSOURCE_NUM_LOADS = 10\n...
[ [ "numpy.mean" ] ]
ssriblo/ionic-smarthome-test-1
[ "060bc247e0b8295d6cd869d90b364756515cfc19" ]
[ "python-opcua/timetable_parser.py" ]
[ "import numpy as np\nimport sys\nimport json\n\nclass DataParserTT(object):\n def __init__(self):\n pass\n # Let convert from string to json: \n # \n\n def timetableParser(self, str):\n# ob = self.obj\n a = [None]*16\n print(f\"\\n\\nstr type\", type(str), str) ...
[ [ "numpy.packbits" ] ]
QuMuLab/PDKB-Planning
[ "61a96c006b606aa051b2c7c9b5bfc9b6473d2a4d" ]
[ "pdkb/test/aamas.py" ]
[ "\nimport sys, random, time\n\nfrom pdkb.kd45 import *\nfrom pdkb.indexed_kd45 import *\nfrom pdkb.pinf import *\nfrom pdkb.rml import *\nfrom pdkb.test.utils import random_pdkb, random_rml, write_file, append_file\n\nTYPE = 'normal'\nNUM_PDKBS = 10\nQUERIES_PER_PDKB = 10\n\nif 'small' == TYPE:\n AGENTS = (2,3)\...
[ [ "numpy.log", "numpy.arange", "matplotlib.lines.Line2D", "matplotlib.ticker.MaxNLocator", "numpy.ravel", "matplotlib.pyplot.show", "matplotlib.pyplot.figure" ] ]
PKUxxz/simp-detr
[ "c83846b1b6fc0e396e268dcfef278e162cf231c5" ]
[ "models/main.py" ]
[ "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport argparse\nimport datetime\nimport json\nimport random\nimport sys\nimport time\nfrom pathlib import Path\n\nimport numpy as np\nimport torch\nfrom torch.utils.data import DataLoader, DistributedSampler\n\nsys.path.append(\"../../../lib\...
[ [ "torch.utils.data.DistributedSampler", "numpy.random.seed", "torch.load", "torch.manual_seed", "torch.utils.data.SequentialSampler", "torch.utils.data.DataLoader", "torch.utils.data.RandomSampler", "torch.optim.AdamW", "torch.save", "torch.nn.parallel.DistributedDataParalle...
goitom/eemeter
[ "bb05d5b776546858f8f3a8d3a95bec202728d9f0" ]
[ "tests/test_segmentation.py" ]
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\n\n Copyright 2018 Open Energy Efficiency, 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.apac...
[ [ "numpy.linspace", "pandas.DataFrame", "pandas.date_range" ] ]
Alhassan20/mealpy
[ "7ed365c5c495ad1c1e066662c90159b3d5e9b8e3" ]
[ "mealpy/bio_based/VCS.py" ]
[ "#!/usr/bin/env python\n# ------------------------------------------------------------------------------------------------------%\n# Created by \"Thieu Nguyen\" at 22:07, 11/04/2020 %\n# ...
[ [ "numpy.abs", "numpy.random.uniform", "numpy.random.normal", "numpy.mean", "numpy.log1p", "numpy.sum" ] ]
patrickltobing/shallow-wavenet
[ "a7348805825e47a24e3ad0e759cecfe85284ba9f" ]
[ "src/bin/feature_extract.py" ]
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright 2019 Patrick Lumban Tobing (Nagoya University)\n# based on PyTorch implementation for WaveNet vocoder by Tomoki Hayashi (Nagoya University)\n# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n\nfrom __future__ import division\nfrom __future__ ...
[ [ "numpy.log", "numpy.expand_dims", "numpy.pad", "numpy.arange", "numpy.set_printoptions", "numpy.concatenate", "scipy.interpolate.interp1d", "numpy.float32", "scipy.signal.lfilter", "numpy.array", "numpy.array_split", "numpy.where", "scipy.signal.firwin" ] ]
yfletberliac/ray
[ "a77d9c228a6891b304e789ba2758a4cbfdb75ec0" ]
[ "python/ray/tune/test/trial_scheduler_test.py" ]
[ "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport random\nimport unittest\nimport numpy as np\n\nimport ray\nfrom ray.tune.schedulers import (HyperBandScheduler, AsyncHyperBandScheduler,\n PopulationBasedTraining...
[ [ "numpy.ceil" ] ]
cclauss/xmodaler
[ "3e128a816876988c5fb07d842fde4a140e699dde" ]
[ "xmodaler/utils/colormap.py" ]
[ "# Copyright (c) Facebook, Inc. and its affiliates.\n\n\"\"\"\nAn awesome colormap for really neat visualizations.\nCopied from Detectron, and removed gray colors.\n\"\"\"\n\nimport numpy as np\n\n__all__ = [\"colormap\", \"random_color\"]\n\n# fmt: off\n# RGB:\n_COLORS = np.array(\n [\n 0.000, 0.447, 0.7...
[ [ "numpy.array" ] ]
Roxot/AEVNMT
[ "5ebc6ec76b2c891ab76a5584a15e735145fdc43b" ]
[ "nmt/joint/csimplejoint.py" ]
[ "\"\"\"\n:Authors: - Bryan Eikema\n\"\"\"\n\nimport tensorflow as tf\n\nimport nmt.utils.misc_utils as utils\n\nfrom . import DSimpleJointModel\nfrom nmt import model_helper\nfrom .utils import language_model\nfrom nmt.utils.gaussianhelper import GaussianHelper\nfrom nmt.utils.amt_utils import enrich_embeddings_wit...
[ [ "tensorflow.cond", "tensorflow.nn.dynamic_rnn", "tensorflow.contrib.distributions.matrix_diag_transform", "tensorflow.contrib.rnn.GRUCell", "tensorflow.reduce_sum", "tensorflow.summary.scalar", "tensorflow.contrib.distributions.MultivariateNormalDiag", "tensorflow.layers.dense", ...
asappinc/emergent_comms_negotiation
[ "19ad405dcb83a3a521b6e1752cec075b69aa164b" ]
[ "nets.py" ]
[ "import torch\nfrom torch import nn, autograd\nfrom torch.autograd import Variable\nimport torch.nn.functional as F\n\n\nclass NumberSequenceEncoder(nn.Module):\n def __init__(self, num_values, embedding_size=100):\n \"\"\"\n eg for values 0,1,2,3,4,5, num_values will be: 6\n for 0,1,..,9 nu...
[ [ "torch.nn.functional.softmax", "torch.cat", "torch.nn.Embedding", "torch.multinomial", "torch.nn.LSTMCell", "torch.nn.Linear", "torch.nn.functional.sigmoid", "torch.nn.functional.relu", "torch.bernoulli", "torch.autograd.Variable" ] ]
varunsingh251/Indian-Sign-Language-Recognition
[ "40604e5c0a2a9b6310e26c0fa31b4f4f1c30de45" ]
[ "Bag of Features/preprocessing_surf.py" ]
[ "import numpy as np\nimport cv2\nimport os\nimport csv\nimport sklearn.metrics as sm\nfrom surf_image_processing import func,func2\nfrom sklearn.cluster import MiniBatchKMeans\nfrom sklearn.svm import SVC\nfrom sklearn.grid_search import GridSearchCV\nimport random\nimport warnings\nimport pickle\nfrom sklearn.naiv...
[ [ "sklearn.neural_network.MLPClassifier", "sklearn.naive_bayes.GaussianNB", "sklearn.linear_model.LogisticRegression", "numpy.random.choice", "sklearn.metrics.precision_score", "sklearn.neighbors.KNeighborsClassifier", "numpy.bincount", "sklearn.svm.SVC", "sklearn.metrics.f1_scor...
davidastephens/zipline
[ "1da206df936bb8125913bae9fc182fd4f611a691" ]
[ "zipline/algorithm.py" ]
[ "#\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 required by applicable law or...
[ [ "numpy.allclose", "pandas.DataFrame", "numpy.datetime64" ] ]
redhood-97/sms.ai
[ "8b787e3f678003826e36e233d966c7108989354c" ]
[ "spam.py" ]
[ "\nimport os, csv, re, nltk\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nfrom sklearn import preprocessing\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn.feature_extraction.text import TfidfTransformer\...
[ [ "sklearn.model_selection.train_test_split", "sklearn.feature_extraction.text.CountVectorizer", "sklearn.naive_bayes.BernoulliNB", "numpy.array", "sklearn.preprocessing.LabelEncoder" ] ]
DrFargo/Starship-Simulation
[ "ff1c30cd8227c7041357a1e2da2fcb34ab06a757" ]
[ "src/base.py" ]
[ "## Author DrFargo\r\n## Created: 2021-02-07\r\n## Latest update: 2021-02-12\r\n\r\nimport matplotlib\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\nimport numpy as np\r\nimport scipy.linalg as la\r\nimport matplotlib.pyplot as plt\r\n\r\nclass starshipSimulation:\r\n def parameters(self, g, lox, engines):\r\n ...
[ [ "numpy.max", "matplotlib.pyplot.show", "matplotlib.pyplot.savefig", "matplotlib.pyplot.figure" ] ]
roshan19041/Causal-Discovery
[ "900cfc94d9fc3ff3d75366b00bda3acd044ed638", "900cfc94d9fc3ff3d75366b00bda3acd044ed638" ]
[ "src/Loss.py", "src/OrientationModels.py" ]
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Jun 23 18:59:20 2019\n\n@author: roshanprakash\n\"\"\"\nimport tensorflow as tf\n\ndef compute_loss(generated_data, observed_data):\n \"\"\"\n Computes the Maximum Mean Discrepancy between generated data and observational data.\n \n ...
[ [ "tensorflow.transpose", "tensorflow.concat", "tensorflow.constant", "tensorflow.shape", "tensorflow.scalar_mul", "tensorflow.ones", "tensorflow.square" ], [ "numpy.random.get_state", "tensorflow.concat", "sklearn.model_selection.ShuffleSplit", "sklearn.tree.Decision...
shivammehta007/NLPinEnglishLearning
[ "ae869d868e39df9b1787134ba6e964acd385dd2e" ]
[ "classifier/train.py" ]
[ "\"\"\"\nTraining script for the model\n\"\"\"\nimport argparse\nimport logging\nimport os\nimport time\n\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom tqdm.auto import tqdm\n\nfrom config.hyperparameters import (\n BATCH_SIZE,\n BIDIRECTION,\n DROPOUT,\n EMBEDDING_DIM,\n EP...
[ [ "torch.nn.CrossEntropyLoss", "torch.load", "torch.zeros" ] ]
JoshMend/prebotc-graph-model
[ "4002e51ab965be366b30c2a6d900ac288fa41245" ]
[ "postprocessing_preBotBot/doPost.py" ]
[ "#!/usr/bin/env python\n'''\nThis file does all the post processing for a given mat file at once. This includes: \n\n1) Deleting Transient\n2)Binning the spikes \n3)Filter spikes using gaussian distribution \n4)Using butterworth filter to remove high frequency signals to smooth \n5)Finds Phase Lag and Population Co...
[ [ "numpy.sqrt", "numpy.linspace", "numpy.asarray", "numpy.isneginf", "numpy.mean", "numpy.nanmean", "numpy.nanstd", "numpy.where", "numpy.square", "numpy.hstack", "numpy.pad", "numpy.arange", "numpy.ceil", "numpy.std", "numpy.diff", "numpy.zeros", ...
RammySekham/Data-Engineering
[ "eec1020defe9c54403f6a80ba91fc071ed22b727" ]
[ "DataModelling_PostgreSQL/etl.py" ]
[ "import os\nimport glob\nimport psycopg2\nimport pandas as pd\nimport settings\nfrom sql_queries import *\n\n\ndef process_song_file(cur, filepath):\n \"\"\"\n process the json song file to insert song record into SQL table\n \"\"\"\n \n # open song file\n df = pd.read_json(filepath, lines=True)\n...
[ [ "pandas.to_datetime", "pandas.Timestamp", "pandas.read_json", "pandas.DataFrame" ] ]
dvhg/tvm
[ "288e9ef41d7884cea3d868d6d2bbb672c058757b" ]
[ "python/tvm/testing.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.abs", "numpy.isfinite", "numpy.argwhere", "numpy.all", "numpy.asanyarray", "numpy.zeros_like", "numpy.prod", "numpy.testing.assert_allclose", "numpy.unravel_index", "numpy.sum" ] ]
kyuhyoung/yolact
[ "98fc78e963264d2ec18cf1b85de7a328abcd6e96" ]
[ "train.py" ]
[ "from data import *\nfrom utils.augmentations import SSDAugmentation, BaseTransform\nfrom utils.functions import MovingAverage, SavePath\nfrom utils.logger import Log\nfrom utils import timer\nfrom layers.modules import MultiBoxLoss\nfrom yolact import Yolact\nimport os\nimport sys\nimport time\nimport math, random...
[ [ "torch.set_default_tensor_type", "torch.zeros", "torch.utils.data.DataLoader", "torch.isfinite", "torch.no_grad", "torch.cuda.is_available", "torch.stack", "torch.cuda.device_count" ] ]
HenrikJantti/xFELTOR
[ "321fe73ce28fa590baedabc0aa13c5ba50a32dff" ]
[ "xfeltor/load.py" ]
[ "import xarray as xr\nimport numpy as np\nfrom typing import Union\nimport json\n\n\ndef open_feltordataset(\n datapath: str = \"./*.nc\",\n chunks: Union[int, dict] = None,\n restart_indices: bool = False,\n probes: bool = False,\n **kwargs: dict,\n) -> xr.Dataset:\n \"\"\"Loads FELTOR output int...
[ [ "numpy.reshape", "numpy.unique" ] ]
alexchungio/under-water-detect
[ "312672ccbe5e31ca21dffab26e1438ea190f3e5a" ]
[ "docs/check_and_draw_box.py" ]
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#------------------------------------------------------\n# @ File : check_and_draw_box.py\n# @ Description: \n# @ Author : Alex Chung\n# @ Contact : yonganzhong@outlook.com\n# @ License : Copyright (c) 2017-2018\n# @ Time : 2021/1/26 下午2:43\n# ...
[ [ "numpy.array", "matplotlib.font_manager.FontProperties", "numpy.floor" ] ]
UKPLab/tacl2018-preference-convincing
[ "65eb1cd3bf76f8068889880e0f80178e790350ce" ]
[ "python/analysis/habernal_comparison/analyse_features.py" ]
[ "'''\nCreated on 1 Jun 2017\n\nLoad a set of feature lengthscales from a good run with 'both' types of features. \nSort them by lengthscale.\nPlot the distribution.\n\nIdentify which type of feature they are: add colours or markers to the plot.\n\nProvide a zoomed-in variant for the best 25 features.\n\n@author: si...
[ [ "matplotlib.pyplot.title", "numpy.unique", "numpy.min", "numpy.arange", "matplotlib.pyplot.savefig", "numpy.argwhere", "numpy.concatenate", "numpy.max", "matplotlib.pyplot.ylabel", "numpy.fromstring", "matplotlib.rcParams.update", "numpy.savetxt", "numpy.argsort...
bibekuchiha/dataquest
[ "c7d8a2966fe2eee864442a59d64309033ea9993e" ]
[ "5. Probability and Statistics/statistics-intermediate/The Mode-307.py" ]
[ "## 1. Introduction ##\n\nimport pandas as pd\n\nhouses = pd.read_table('AmesHousing_1.txt')\nprint(houses[['Land Slope','Roof Style','Kitchen AbvGr']])\n\nscale_land = 'ordinal'\n\nscale_roof = 'nominal'\n\nkitchen_variable = 'discrete'\n\n\n## 2. The Mode for Ordinal Variables ##\n\ndef mode(array):\n counts ...
[ [ "pandas.read_table", "pandas.interval_range", "pandas.Series", "matplotlib.pyplot.legend" ] ]
swkokr/FetchPickAndPlace_HER_DDPG
[ "8378b53dac922cffeff8e2bdabca69cf6fd8bd54" ]
[ "baselines/her/ddpg.py" ]
[ "from collections import OrderedDict\n\nimport numpy as np\nimport tensorflow as tf\nfrom tensorflow.contrib.staging import StagingArea\n\nfrom baselines import logger\nfrom baselines.her.util import (\n import_function, store_args, flatten_grads, transitions_in_episode_batch, convert_episode_to_batch_major)\nfr...
[ [ "numpy.random.randn", "tensorflow.boolean_mask", "numpy.clip", "tensorflow.get_collection", "tensorflow.stop_gradient", "tensorflow.square", "numpy.load", "numpy.zeros", "tensorflow.placeholder", "numpy.random.binomial", "numpy.array", "tensorflow.clip_by_value", ...
devillove084/CollageDesign
[ "e2a85a8d15f82d1f72b754de04af78126eae9a1c" ]
[ "MLCtr/machineLearning/decision_tree.py" ]
[ "from __future__ import division, print_function\nimport numpy as np\nimport cupy\n\n\nfrom graduateutil import divide_on_feature, train_test_split, standardize, mean_squared_error\nfrom graduateutil import calculate_entropy, accuracy_score, calculate_variance\n\nclass DecisionNode():\n \"\"\"Class that represen...
[ [ "numpy.expand_dims", "numpy.unique", "numpy.concatenate", "numpy.mean", "numpy.shape" ] ]
jcboyd/cyclegan-roi
[ "f0c80c6122d17406f5282f58ea09abaf2b70c388" ]
[ "src/utils.py" ]
[ "import numpy as np\nimport torch\nfrom torch.nn import UpsamplingNearest2d, UpsamplingBilinear2d\n\nfrom rectpack import newPacker\n\n\ndef get_mnist_canvas(images, labels, nb_classes=10, dim=128):\n\n canvas = -torch.ones((dim, dim))\n noise_canvas = torch.zeros((nb_classes, dim, dim))\n condition_canvas...
[ [ "torch.randint", "torch.ones", "torch.max", "torch.cat", "torch.zeros", "torch.randn", "torch.Tensor", "numpy.clip", "torch.nn.UpsamplingBilinear2d", "numpy.random.randn", "torch.nn.UpsamplingNearest2d" ] ]
ireina7/gzsl-seg
[ "9aad220274b4a58b59f5da430f873b5dfc21e458" ]
[ "src/util/logging.py" ]
[ "import sys\nimport matplotlib.pyplot as plt\n\nfrom util.typing.basic import *\nfrom src.config import *\n\n\ndef show_figure_nonblocking() -> None:\n plt.show(block = False)\n plt.pause(0.001)\n #end show_figure_nonblocking\n\ndef show_figure_blocking() -> None:\n plt.show()\n #end show_figure_blocking\n\nde...
[ [ "matplotlib.pyplot.imshow", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "matplotlib.pyplot.plot", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.grid", "matplotlib.pyplot.show", "matplotlib.pyplot.pause", "matplotlib.pyplot.figure" ] ]
plenoi/EvoloPy
[ "7c943925b9a73ad671735493ce281b67d178dc7c" ]
[ "PSO.py" ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun May 15 22:37:00 2016\n\n@author: Hossam Faris\n\"\"\"\n\nimport random\nimport numpy\nfrom colorama import Fore, Back, Style\nfrom solution import solution\nimport time\n\n\n\n\n\n\ndef PSO(objf,lb,ub,dim,PopSize,iters):\n\n # PSO parameters\n \n# dim=30\n# ...
[ [ "numpy.random.uniform", "numpy.zeros", "numpy.clip" ] ]
esowc/DAAQS
[ "141b4d97edb319ab67d9f42a1aa54a4555829de2" ]
[ "DAAQS/utils/preprocess.py" ]
[ "import numpy as np\n\nfrom DAAQS.utils.misc import index_to_center\n\ndef temporal_average(c_data, o_data, index_lat, index_lon):\n\n ## Ideally CAMS data is time_step x 3 x 3\n ## And openaq_data is list of all stations in that 3x3 grid \n\n ## CAMS Data\n c_grid = c_data[:,index_lat-1:index_lat+2,ind...
[ [ "numpy.ravel", "numpy.mean", "numpy.stack" ] ]
HolmesShuan/Location-aware-Upsampling-for-Semantic-Segmentation
[ "83822e86570bbff4ca721d80089b5d82f1958852" ]
[ "LaU-reg/experiments/segmentation/option.py" ]
[ "###########################################################################\n# Created by: Hang Zhang \n# Email: zhang.hang@rutgers.edu \n# Copyright (c) 2017\n###########################################################################\nimport argparse\n\nimport torch\n\nclass Options():\n def __init__(self):\n...
[ [ "torch.cuda.is_available" ] ]
andreea-zaharia/flower
[ "c576f0118e5c3d7a7d774dc156fb4b6db194655d", "c576f0118e5c3d7a7d774dc156fb4b6db194655d" ]
[ "examples/dp-sgd-mnist/server.py", "baselines/flwr_baselines/publications/fedbn/convergence_rate/client.py" ]
[ "import argparse\nimport os\n\nimport tensorflow as tf\n\nimport flwr as fl\n\nimport common\n\n# Make TensorFlow logs less verbose\nos.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n\n\ndef get_eval_fn(model):\n \"\"\"Return an evaluation function for server-side evaluation.\"\"\"\n\n # Load test data here to av...
[ [ "tensorflow.keras.losses.CategoricalCrossentropy", "tensorflow.keras.datasets.mnist.load_data" ], [ "torch.nn.CrossEntropyLoss", "torch.max", "torch.utils.data.DataLoader", "torch.tensor", "torch.no_grad", "torch.cuda.is_available" ] ]
RPGroup-PBoC/mwc_mutants
[ "35581602c35793fc8ec42c8aff37b8305c5e54e1" ]
[ "mut/flow.py" ]
[ "import numpy as np\nimport fcsparser\nimport pandas as pd\nfrom ._fit_bivariate_normal_AstroML import fit_bivariate_normal\nimport scipy.stats\n\n# #######################\n# Automated Gating\n# #######################\ndef fit_2D_gaussian(df, x_val='FSC-H', y_val='SSC-H', log=False):\n '''\n This function h...
[ [ "numpy.dot", "numpy.linalg.inv", "numpy.cos", "pandas.DataFrame", "numpy.sin", "numpy.linalg.det", "numpy.log10", "numpy.array", "numpy.sum" ] ]
fkopsaf/OpenAeroStruct
[ "414bd76a7f14f1bd52d6dacc6694382d52e5fabc" ]
[ "openaerostruct/geometry/utils.py" ]
[ "from __future__ import print_function, division\r\nimport warnings\r\nimport numpy as np\r\nfrom numpy import cos, sin, tan\r\n\r\nfrom openaerostruct.geometry.CRM_definitions import get_crm_points\r\n\r\n\r\ndef rotate(mesh, theta_y, symmetry, rotate_x=True):\r\n \"\"\"\r\n Compute rotation matrices given m...
[ [ "numpy.linspace", "numpy.einsum", "numpy.arctan", "numpy.vstack", "numpy.concatenate", "numpy.hstack", "matplotlib.pyplot.tight_layout", "numpy.sin", "numpy.interp", "matplotlib.pyplot.subplots_adjust", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.tan", ...
keforres/PreREISE
[ "fcc111fdccc0626d3d34f1749a14035e47991043" ]
[ "prereise/gather/demanddata/eia/tests/test_get_eia_data.py" ]
[ "import getpass\nimport os\nfrom datetime import datetime\n\nimport pandas as pd\nimport pytest\n\nfrom prereise.gather.demanddata.eia import get_eia_data\n\n\n@pytest.mark.skip(reason=\"Need API key\")\ndef test_eia_download():\n \"\"\"Check data frame assembled from data download by API call from EIA. Test\n ...
[ [ "pandas.to_datetime" ] ]
zegerk/gym-micropolis
[ "554bf41e9c4001140cdba90c5bbb3cc6bacf4c65" ]
[ "arguments.py" ]
[ "import argparse\n\nimport torch\n\n\ndef get_args():\n parser = argparse.ArgumentParser(description='RL')\n parser.add_argument('--algo', default='a2c',\n help='algorithm to use: a2c | ppo | acktr')\n parser.add_argument('--lr', type=float, default=7e-4,\n hel...
[ [ "torch.cuda.is_available" ] ]
abecker99/Interpolation
[ "0527e6296c98b1c7f6cf512e614090f61754705d" ]
[ "TestingBisection.py" ]
[ "import numpy as np\n\n\ndef find_sign_change(f, step, a, b):\n x = a\n pairs = []\n while (x + step < b):\n if (f(x + step)/f(x) < 0):\n pairs.append([x, x+step])\n x += step\n return pairs\n\ndef bisect(f, pairs, tolerance):\n zeros = []\n for pair in pairs:\n mid...
[ [ "numpy.sin" ] ]
wangxinxin08/Paddle
[ "1b0c5ef264b52a9d75f971216618ebbbbc7e5931" ]
[ "python/paddle/tensor/manipulation.py" ]
[ "# Copyright (c) 2020 PaddlePaddle Authors. 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 ...
[ [ "numpy.asscalar" ] ]
BillyGareth/pyod
[ "7aeefcf65ceb0196434b7adb4fd706bfb404e4e2" ]
[ "pyod/test/test_xgbod.py" ]
[ "# -*- coding: utf-8 -*-\n\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os\nimport sys\nfrom os import path\n\nimport unittest\n# noinspection PyProtectedMember\nfrom numpy.testing import assert_allclose\nfrom numpy.testing import assert_array_less\nfrom numpy.testing import ass...
[ [ "numpy.testing.assert_equal", "sklearn.metrics.roc_auc_score", "scipy.stats.rankdata", "sklearn.model_selection.train_test_split", "numpy.testing.assert_array_less", "sklearn.base.clone", "numpy.testing.assert_raises", "sklearn.utils.validation.check_X_y" ] ]
Asjidkalam/analytics-zoo
[ "0afa8437abc3e5cf5289d2cfde68b237a45f9d0d" ]
[ "pyzoo/zoo/tfpark/tf_optimizer.py" ]
[ "#\n# Copyright 2018 Analytics Zoo 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 applicable ...
[ [ "tensorflow.shape", "tensorflow.get_collection", "tensorflow.keras.backend.get_session", "tensorflow.keras.backend.learning_phase", "tensorflow.assign", "tensorflow.is_numeric_tensor", "tensorflow.placeholder", "tensorflow.identity", "tensorflow.global_variables_initializer", ...
tunbehaun273/crabmeyerpy
[ "d36fe3ed9b8591bb92bd9915996dd21d79fc4dad" ]
[ "crabmeyerpy/ssc.py" ]
[ "import yaml\nfrom scipy.special import kv # Bessel function\nfrom scipy.integrate import simps\nfrom scipy.interpolate import interp1d\n\n# imports to speed up integrations:\nfrom numpy import meshgrid, linspace, ones, zeros\nfrom numpy import log, exp, pi, sqrt, power, tan\n\n# import functions for photon fields...
[ [ "numpy.log", "numpy.sqrt", "numpy.meshgrid", "numpy.linspace", "numpy.power", "numpy.tan", "scipy.integrate.simps", "numpy.exp", "numpy.zeros" ] ]
cvlab-stonybrook/BodyHands
[ "dcfe470f6fd31a048d4d17d4ae9a2a524538b380" ]
[ "bodyhands/utils/extend_utils_boxes.py" ]
[ "import torch\nfrom detectron2.structures import Boxes\n\ndef pairwise_intersection(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor:\n\n boxes1, boxes2 = boxes1.tensor, boxes2.tensor\n width_height = torch.min(boxes1[:, None, 2:], boxes2[:, 2:]) - torch.max(\n boxes1[:, None, :2], boxes2[:, :2]\n ) #...
[ [ "torch.min", "torch.max", "torch.zeros" ] ]
maxscheurer/pyscf
[ "162c37942289c0aec70e70ba1ea98ade3ec34da5" ]
[ "pyscf/lo/orth.py" ]
[ "#!/usr/bin/env python\n# Copyright 2014-2020 The PySCF Developers. 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/LIC...
[ [ "numpy.hstack", "numpy.sqrt", "numpy.einsum", "numpy.eye", "numpy.ones", "numpy.linalg.det", "numpy.linalg.cholesky", "numpy.linalg.qr", "numpy.argsort", "numpy.zeros", "numpy.where" ] ]
diegoolano/biomedical_interpretable_entity_representations
[ "3c35f02ee8dd7ee0f2a23b0014e4b112beab6461" ]
[ "ier_model/run_et.py" ]
[ "#!/usr/bin/env python3\nimport argparse\nimport gc\nimport json\nimport numpy as np\nimport pickle\nimport random\nimport time\nimport torch\nimport torch.nn as nn\nfrom tqdm import tqdm\nfrom transformers import AdamW, get_linear_schedule_with_warmup\n\nimport transformer_constant\nimport transformer_data_utils\n...
[ [ "torch.distributed.init_process_group", "numpy.random.seed", "torch.load", "torch.cuda.set_device", "torch.manual_seed", "torch.cuda.device_count", "torch.distributed.barrier", "torch.nn.Sigmoid", "numpy.argmax", "torch.cuda.is_available", "torch.cuda.manual_seed_all", ...
drewhayward/DFOL-VQA
[ "8c7d403bac560588ab3ac45774a3e4f71fbe9c90" ]
[ "src/nsvqa/nn/interpreter/batch_base_interpreter.py" ]
[ "# Copyright (c) Microsoft. All rights reserved.\n# Licensed under the MIT license. See LICENSE.md file\n# in the project root for full license information.\n\nimport torch\nimport torch.nn as nn\nimport os\n\nfrom operator import itemgetter\nfrom nsvqa.nn.interpreter import util\nfrom nsvqa.nn.interpreter.batch_ba...
[ [ "torch.cat", "torch.tensor" ] ]
weecology/albumentations
[ "cc8fbb6e2fcc4f6a4c87a29b6b0784391b0e2db4" ]
[ "tests/test_transforms.py" ]
[ "from functools import partial\n\nimport cv2\nimport numpy as np\nimport pytest\nimport random\n\nimport albumentations as A\nimport albumentations.augmentations.functional as F\nimport albumentations.augmentations.geometric.functional as FGeometric\n\nfrom torchvision.transforms import ColorJitter\nfrom PIL import...
[ [ "numpy.random.random", "numpy.allclose", "numpy.array_equal", "numpy.random.seed", "numpy.abs", "numpy.unique", "numpy.eye", "numpy.arange", "numpy.ones", "numpy.all", "numpy.testing.assert_almost_equal", "numpy.testing.assert_array_equal", "numpy.random.rand", ...