repo_name stringlengths 6 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
d-ataman/lmm | [
"83a3c2d9289e2f4cc24c03b177c81ba16e000b55"
] | [
"onmt/Samplers.py"
] | [
"from __future__ import division\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\nfrom torch.autograd import Variable\n\nimport onmt\nfrom onmt.Utils import aeq\nimport torch.distributions as tdist\n\n\nclass Sampler(nn.Module):\n \"\"\"\n The inference network based on MLP to learn th... | [
[
"torch.Size",
"torch.nn.Softplus",
"torch.Tensor",
"torch.zeros_like",
"torch.lt",
"torch.tensor",
"torch.nn.Tanh",
"torch.nn.Linear",
"torch.pow",
"torch.log",
"torch.rand",
"torch.full_like",
"torch.ones_like"
]
] |
amperie/user-models | [
"5236c50d0f20a7bac81acc5d1936a3502de2f5f3"
] | [
"task_templates/pipelines/python3_sklearn_multiclass/custom.py"
] | [
"import pickle\nfrom typing import List, Optional, Any\n\nimport numpy as np\nimport pandas as pd\nfrom create_pipeline import make_classifier\nimport logging\n\nlogger = logging.getLogger()\n\n\ndef transform(data: pd.DataFrame, model: Any) -> pd.DataFrame:\n \"\"\"\n Intended to apply transformations to the... | [
[
"numpy.dtype"
]
] |
peper0/mpldock | [
"47bb3f112481e0f55b8c4460bc545e0eeac08461"
] | [
"examples/factory_default.py"
] | [
"import os.path\n\nimport matplotlib\n\nfrom mpldock import persist_layout\n\nmatplotlib.use('module://mpldock.backend')\n\nimport matplotlib.pyplot as plt\n\npersist_layout('1e2682b5-4408-42a6-ae97-3290153294', os.path.join(os.path.dirname(os.path.realpath(__file__)), 'fd_layout.json'))\n\nplt.figure(\"some plot\"... | [
[
"matplotlib.pyplot.plot",
"matplotlib.use",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure"
]
] |
hanshantong/MachineLearningWithPython3 | [
"f9054904d5662a4d24d84d5bb7a3e87ed137efd2"
] | [
"plots.py"
] | [
"# -*- coding: utf-8 -*-\n\nfrom matplotlib.colors import ListedColormap\nimport numpy as np\n\n\ndef plot_decision_regions(X, y, classifier, resolution=0.02):\n '''\n plot decision regions\n\n Parameters\n ------------\n X: array-like, shape=(n_samples, 2)\n the train array with a shape (n_sam... | [
[
"numpy.arange",
"numpy.unique"
]
] |
Mark-sloan/IKC | [
"f70af607e9434931c22e4971469aaed7683a22a3"
] | [
"codes/train_SFTMD.py"
] | [
"import os\nimport math\nimport argparse\nimport random\nimport logging\nimport numpy as np\nimport torch\nimport torch.distributed as dist\nimport torch.multiprocessing as mp\nfrom data.data_sampler import DistIterSampler\n\nimport options.options as option\nfrom utils import util\nfrom data import create_dataload... | [
[
"torch.multiprocessing.set_start_method",
"torch.distributed.init_process_group",
"torch.cuda.set_device",
"torch.cuda.current_device",
"numpy.size",
"torch.multiprocessing.get_start_method",
"torch.distributed.get_rank",
"torch.cuda.device_count",
"torch.distributed.get_world_... |
ghokun-thesis/domain-networks | [
"8f64182a5ef404a0e41eb023812de5efefe4233e"
] | [
"models/corrnet.py"
] | [
"\"\"\"\nproposed model only with the correlation branch.\n\nauthor: David-Alexandre Beaupre\ndate: 2020-04-27\n\"\"\"\n\nimport torch\nimport torch.nn as nn\n\nfrom models.features import Features\nfrom models.classifier import Classifier\n\n\nclass CorrNet(nn.Module):\n def __init__(self, num_channels: int):\n... | [
[
"torch.matmul"
]
] |
MASILab/AID | [
"1525e2e0273b5c1c87934c6e2cddcdf7f977f7e7"
] | [
"torchsrc/models/layers/grid_attention_layer.py"
] | [
"import torch\nfrom torch import nn\nfrom torch.nn import functional as F\nfrom ..networks_other import init_weights\n\n\nclass _GridAttentionBlockND(nn.Module):\n def __init__(self, in_channels, gating_channels, inter_channels=None, dimension=3, mode='concatenation',\n sub_sample_factor=(2,2,2))... | [
[
"torch.nn.functional.upsample",
"torch.nn.functional.softmax",
"torch.max",
"torch.min",
"torch.sum",
"torch.nn.functional.sigmoid",
"torch.nn.DataParallel",
"torch.nn.functional.relu",
"torch.rand",
"torch.nn.init.constant",
"torch.nn.functional.softplus"
]
] |
rogerbao/pytorch-deeplab-xception | [
"43f8b71295712a5d1e474af37c379d05d8e67cb0"
] | [
"modeling/decoder.py"
] | [
"import math\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d\n\nfrom torchsummary import summary\n\nclass Decoder(nn.Module):\n def __init__(self, num_classes, backbone, BatchNorm):\n super(Decoder, self).__init__... | [
[
"torch.nn.Dropout",
"torch.cat",
"torch.nn.Conv2d",
"torch.rand",
"torch.nn.ReLU",
"torch.nn.init.kaiming_normal_"
]
] |
QTIM-Lab/AdrenalMGB-Version-1 | [
"973cf2df352f21f697370b1089036a4209c96ba3"
] | [
"train_cluster.py"
] | [
"#TODO: If re-starting training for a certain saved model, evaluate validation set first to get accurate monitor value\r\n#TODO: If re-starting training, ensure original model isn't overwritten\r\n#TODO: Add ability to choose model to use for training/inference from snapshots\r\n#TODO: Fix random seed issue to make... | [
[
"numpy.random.seed",
"tensorflow.distribute.MirroredStrategy",
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.random.set_seed",
"tensorflow.summary.create_file_writer"
]
] |
dg1223/ML-pipeline | [
"b421fd8dddb695689ffe6dcf58c7640625066074"
] | [
"tests/unit/inputdata_test.py"
] | [
"# This script checks the input dataset using Pytest for the machine learning experiment.\n# Sample unit testing for the workshop.\n\n# Soure code reference: Microsoft Azure Machine Learning\n\nimport os\nimport numpy as np\nimport pandas as pd\n\n\n# Get absolute path of csv files from data folder in your git repo... | [
[
"pandas.read_csv"
]
] |
hadaev8/waveglow | [
"5109a336ef1fdfd3d40dc72b20eebbc4a8d1da43"
] | [
"stft.py"
] | [
"\"\"\"\nBSD 3-Clause License\n\nCopyright (c) 2017, Prem Seetharaman\nAll rights reserved.\n\n* Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notic... | [
[
"numpy.imag",
"torch.max",
"scipy.signal.get_window",
"torch.sin",
"numpy.concatenate",
"torch.FloatTensor",
"torch.sqrt",
"numpy.eye",
"torch.from_numpy",
"torch.nn.functional.conv_transpose1d",
"numpy.real",
"numpy.zeros",
"torch.cos",
"torch.min",
"to... |
witwolf/agents | [
"e084e5184757dd84374e9b67176b8623d4b18a0f"
] | [
"tf_agents/networks/expand_dims_layer.py"
] | [
"# coding=utf-8\n# Copyright 2018 The TF-Agents 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 b... | [
[
"tensorflow.keras.utils.get_custom_objects",
"tensorflow.TensorShape",
"tensorflow.expand_dims"
]
] |
cxqj/33-tensorflow-audio-classification | [
"934162d497a66bc59c87f527448464e121a3a306"
] | [
"vggish/mel_features.py"
] | [
"# Copyright 2017 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 requi... | [
[
"numpy.log",
"numpy.minimum",
"numpy.linspace",
"numpy.arange",
"numpy.lib.stride_tricks.as_strided",
"numpy.floor",
"numpy.empty"
]
] |
divyanshupandey/Twitter_sentiment_analysis | [
"94128ea799c44f402edfa7193146cba9d5ed6936"
] | [
"plot.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Feb 27 17:55:49 2018\n\n@author: user\n\"\"\"\n# importing necessary libraries\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\nfrom matplotlib import style\nstyle.use('fivethirtyeight')\n\n#setting graph for pie cha... | [
[
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"matplotlib.animation.FuncAnimation",
"matplotlib.style.use"
]
] |
yexiguafuqihao/crowddet-megengine | [
"866c0fd3767e8f3cce84a78efc0ff95f23ef6b61"
] | [
"model/cascade.rcnn/yexiguafu/res50.rcnn.one.head.two.stages.baseline/config.py"
] | [
"import os\nimport sys\nimport os.path as osp\nimport numpy as np\nimport getpass\nimport pdb\ndef add_path(path):\n if path not in sys.path:\n sys.path.insert(0, path)\n\n\nroot_dir = '../../../..'\nadd_path(os.path.join(root_dir))\nadd_path(os.path.join(root_dir, 'lib'))\nadd_path(os.path.join(root_dir,... | [
[
"numpy.array"
]
] |
Shushman/PlaNet | [
"a27a119f6a165da01cca6da211afb51cd1f92537"
] | [
"memory.py"
] | [
"import numpy as np\nimport torch\nfrom env import postprocess_observation, preprocess_observation_\n\n\nclass ExperienceReplay():\n def __init__(self, size, symbolic_env, observation_size, action_size, bit_depth, device):\n self.device = device\n self.symbolic_env = symbolic_env\n self.size = size\n s... | [
[
"numpy.arange",
"torch.as_tensor",
"numpy.empty",
"numpy.random.randint"
]
] |
Tramac/MaiHaHi-pytorch | [
"61ddd2b0cdf53fdc17642423f7a4431b4a2512c3"
] | [
"utils/face_alignment/detection/sfd/sfd_detector.py"
] | [
"import os\nimport cv2\nimport torch\nfrom torch.utils.model_zoo import load_url\n\nfrom ..core import FaceDetector\n\nfrom .net_s3fd import s3fd\nfrom .bbox import *\nfrom .detect import *\n\nmodels_urls = {\n 's3fd': 'https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth',\n}\n\n\nclass SFDDetec... | [
[
"torch.utils.model_zoo.load_url",
"torch.load"
]
] |
alburke/hagelslag | [
"fb94c775232da316893e04104761f483b88f4db5"
] | [
"demos/obj_tracking.py"
] | [
"#!/bin/env python\n\n# coding: utf-8\n\n# Severe Weather Forecasting with Python and Data Science Tools: Interactive Demo\n# David John Gagne, University of Oklahoma and NCAR\n# Introduction\n# Severe weather forecasting has entered an age of unprecedented access to large model and observational datasets with even... | [
[
"scipy.ndimage.gaussian_filter",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.colorbar",
"numpy.append",
"scipy.ndimage.find_objects",
"numpy.maximum.reduce",
"numpy.array",
"numpy.where",
"matplotlib.pyplot.figure"
]
] |
mufernando/pyslim | [
"f9067959dfa412534ff25683fa47daea27347b96"
] | [
"pyslim/slim_tree_sequence.py"
] | [
"import attr\nimport struct\nimport msprime\nimport tskit\nimport kastore\nimport json\nfrom collections import OrderedDict\nimport warnings\nimport numpy as np\n\nfrom .slim_metadata import *\nfrom .provenance import *\nfrom .slim_metadata import _decode_mutation_pre_nucleotides\n\nINDIVIDUAL_ALIVE = 2**16\nINDIVI... | [
[
"numpy.int32",
"numpy.argmax",
"numpy.repeat",
"numpy.logical_and",
"numpy.zeros",
"numpy.where"
]
] |
shobrook/topigraph | [
"abd18b48507f76ebac87c7e2241063a4aa5367a6"
] | [
"topigraph/topigraph.py"
] | [
"# Third Party\nfrom nltk import pos_tag\nfrom nltk.tokenize import word_tokenize\nfrom nltk.probability import FreqDist\nfrom nltk.corpus import stopwords\nfrom nltk.stem.wordnet import WordNetLemmatizer\nfrom numpy import dot\nfrom numpy.linalg import norm\nfrom youtube_transcript_api import YouTubeTranscriptApi\... | [
[
"numpy.dot",
"numpy.linalg.norm"
]
] |
sebdenis/pdsim | [
"1219d257d4952f396022f2a41c245765c8728ab0"
] | [
"PDSim/core/core.py"
] | [
"from __future__ import division, absolute_import, print_function\n\nimport math\nfrom math import pi\nfrom timeit import default_timer\nimport inspect\nimport six\n\n##-- Package imports --\nfrom PDSim.flow import flow,flow_models\nfrom .containers import STATE_VARS_TM, CVArrays, ControlVolumeCollection,TubeColl... | [
[
"numpy.linalg.solve",
"numpy.ones_like",
"numpy.abs",
"numpy.power",
"numpy.isnan",
"numpy.mean",
"numpy.diff",
"numpy.zeros_like",
"numpy.trapz",
"numpy.array",
"numpy.zeros",
"numpy.sum"
]
] |
djape24394/gmphd_filter | [
"877c4fcd99a587e08a30ce1b845242288c78dfb1"
] | [
"gmphd.py"
] | [
"import numpy as np\r\nimport numpy.linalg as lin\r\nfrom typing import List, Dict, Any\r\n\r\n\r\ndef multivariate_gaussian(x: np.ndarray, m: np.ndarray, P: np.ndarray) -> float:\r\n \"\"\"\r\n Multivatiate Gaussian Distribution\r\n\r\n :param x: vector\r\n :param m: distribution mean vector\r\n :pa... | [
[
"numpy.linalg.inv",
"numpy.linalg.det",
"numpy.round",
"numpy.exp",
"numpy.outer",
"numpy.array",
"numpy.zeros",
"numpy.sum"
]
] |
tusharip/augmentations | [
"426122ce032e4ee5309fb6fd756f659353352632"
] | [
"codes/audio/utils.py"
] | [
"import torch\nimport torchaudio\nimport torchaudio.functional as F\nimport sounddevice as sd\nfrom IPython.display import Audio, display\nimport matplotlib.pyplot as plt\nimport numpy as np\n\ndef plot_waveform(waveform, sample_rate, title=\"Waveform\", xlim=None, ylim=None):\n waveform = waveform.numpy()\n\n ... | [
[
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"torch.arange"
]
] |
vijay4313/proxemo | [
"7b09828c3b63b01617824c3b27a059584eb11ca4"
] | [
"pose_tracking/human_tracking_3D.py"
] | [
"#!/usr/bin/env python\n# Title :loader.py\n# Author :Venkatraman Narayanan, Bala Murali Manoghar, Vishnu Shashank Dorbala, Aniket Bera, Dinesh Manocha\n# Copyright :\"Copyright 2020, Proxemo project\"\n# Version :1.0\n# License :\"MIT\"\n# Maintainer :Venkatraman Naray... | [
[
"numpy.hstack",
"numpy.expand_dims",
"numpy.asarray",
"numpy.any",
"numpy.array"
]
] |
XavierCarrera/robust-integration | [
"a0b0236d2095dd999eab3b95440a62183e94dfc9"
] | [
"cross_val.py"
] | [
"import pandas as pd\nimport numpy as np\n\nfrom sklearn.tree import DecisionTreeRegressor\n\nfrom sklearn.model_selection import (\n cross_val_score, KFold\n)\n\nif __name__ == \"__main__\":\n\n dataset = pd.read_csv('./data/felicidad.csv')\n\n X = dataset.drop(['country', 'score'], axis=1)\n y = datas... | [
[
"pandas.read_csv",
"sklearn.tree.DecisionTreeRegressor",
"sklearn.model_selection.cross_val_score",
"sklearn.model_selection.KFold",
"numpy.mean"
]
] |
TheJacksonLaboratory/imc-preprocessor | [
"1f11c6c40472affb086e4e66c5fe6a6694d6a451"
] | [
"imcpp/processing.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .mcd import MCD\n\nimport numpy as np\nfrom argparse import Namespace\nfrom scipy.signal import convolve2d\nfrom skimage.morphology import white_tophat\nfrom skimage.morphology import square, disk, diamond\nfrom skimage.exposure import equalize_hist, equalize_... | [
[
"numpy.linalg.inv",
"numpy.arange",
"scipy.signal.convolve2d",
"numpy.percentile",
"numpy.max",
"numpy.moveaxis",
"numpy.zeros"
]
] |
ashadhaz/pml | [
"8d9261c8885a82d795c89de23f53ff7d05ef9495"
] | [
"pml/utils/distance_utils.py"
] | [
"# Copyright (C) 2012, 2013 David Rusk\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy \n# of this software and associated documentation files (the \"Software\"), to \n# deal in the Software without restriction, including without limitation the \n# rights to use, copy, modify, mer... | [
[
"numpy.asarray",
"numpy.dot"
]
] |
nitinkumar388/Coronavirus-Probability-Detector | [
"af054a230160d5f79093bde85558a21374188ce2"
] | [
"myTraining.py"
] | [
"import numpy as np\r\nimport pandas as pd\r\nimport matplotlib.pyplot as plt\r\nfrom sklearn.linear_model import LogisticRegression\r\nimport pickle\r\n\r\ndef train_test_split(data, ratio):\r\n\r\n np.random.seed(56)\r\n shuffled = np.random.permutation(len(data))\r\n test_set_size = int(len(data)*ratio)... | [
[
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"numpy.random.seed"
]
] |
Gleiphir/AinuGAN | [
"963dbca303ca13f053a25c9a4f07eb4eda614091"
] | [
"main_1v3.py"
] | [
"import argparse\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\n#from torch.optim.lr_scheduler import ExponentialLR\nfrom torchvision import datasets, transforms\nfrom torch.autograd import Variable\nimport torchvision\n\nimport time\n\nimport numpy as np\nimport... | [
[
"matplotlib.use",
"torch.randn",
"matplotlib.pyplot.subplot",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"torch.nn.ReLU",
"matplotlib.pyplot.figure"
]
] |
yangggzhang/heterogeneous-sampling | [
"2d65a077f0bee63154c295f1540505132111ac42"
] | [
"src/sampling_measurement/script/measurement_simulation_server.py"
] | [
"#!/usr/bin/env python\nimport itertools\nimport numpy as np\nimport rospkg\nimport rospy\nfrom sampling_msgs.srv import RequestMeasurement, RequestMeasurementResponse\n\nclass MeasurementSimulator(object):\n def __init__(self):\n rospy.init_node('measurement_simulation_node')\n measurement_trial =... | [
[
"numpy.linalg.lstsq",
"numpy.random.normal",
"numpy.array",
"numpy.zeros",
"numpy.loadtxt"
]
] |
julioadl/mlCodebase | [
"a7a3f9bd9333a040018d7e0865a9933e46d92712"
] | [
"development/ml/models/base.py"
] | [
"from typing import Callable, Dict\nimport pathlib\nfrom boltons.cacheutils import cachedproperty\n\nimport numpy as np\nfrom sklearn import metrics\nfrom sklearn.externals import joblib\nfrom tensorflow.keras.models import Model as KerasModel\nfrom tensorflow.keras.optimizers import RMSprop\n\nfrom datasets.sequen... | [
[
"sklearn.externals.joblib.dump",
"tensorflow.keras.optimizers.RMSprop",
"numpy.argmax",
"sklearn.externals.joblib.load",
"sklearn.metrics.classification_report"
]
] |
SooluThomas/qiskit-terra | [
"25b47af83f14afb3441d7b2c1bd31bda93e3549d"
] | [
"qiskit/quantum_info/operators/symplectic/base_pauli.py"
] | [
"# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2020\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modification... | [
[
"numpy.logical_xor",
"numpy.asarray",
"numpy.arange",
"scipy.sparse.csr_matrix",
"numpy.all",
"numpy.mod",
"numpy.logical_and",
"numpy.zeros",
"numpy.sum",
"numpy.vstack",
"numpy.isclose"
]
] |
iesl/expLinkage | [
"4d46683a3eb86b4a40425acf08b608ab44f5006b"
] | [
"src/trainer/train_vect_data.py"
] | [
"\"\"\"\nCopyright (C) 2019 University of Massachusetts Amherst.\nThis file is part of \"expLinkage\"\nhttp://github.com/iesl/expLinkage\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\nhttp... | [
[
"torch.cuda.is_available",
"torch.save"
]
] |
Prabhdeep1999/Caffe-Model-to-Keras-.h5-conversion | [
"54f1d76fb54dbdfe8d3ac378b4b53c2d1fbd78d5"
] | [
"caffe_weight_converter.py"
] | [
"'''\nA tool to convert `.caffemodel` weights to Keras-compatible HDF5 files or to export them to a simpler Python dictionary structure for further processing.\nCopyright (C) 2018 Pierluigi Ferrari\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public Li... | [
[
"numpy.array",
"numpy.transpose"
]
] |
evandrocapo/Keras | [
"5e2f73254e38d99ea1027b07c8e887be0d71fcac"
] | [
"keras_ai#2.py"
] | [
"import numpy as np\nfrom tensorflow import keras\nfrom keras.models import Sequential\nfrom keras.layers import Dense\n\nx = np.array([[0.1],[0.2],[0.3]])\ny = np.array([[0.2],[0.4],[0.6]])\n\nmodel = Sequential() # modelo\n\nmodel.add(Dense(3, input_dim=1)) # adicinou uma layer\nmodel.add(Dense(1))\n\nmodel.compi... | [
[
"numpy.asmatrix",
"numpy.array"
]
] |
davidcsterratt/snl | [
"5c086fac092209c5efd2e4b882bbcb197e2facf8"
] | [
"simulators/markov_jump_processes.py"
] | [
"from __future__ import division\n\nimport numpy as np\nimport util.math\n\n\nclass SimTooLongException(Exception):\n \"\"\"\n Exception to be thrown when a simulation runs for too long.\n \"\"\"\n\n def __init__(self, max_n_steps):\n self.max_n_steps = max_n_steps\n\n def __str__(self):\n ... | [
[
"numpy.asarray",
"numpy.array",
"numpy.empty"
]
] |
FlorentF9/skstab | [
"7f5304d5012f0f1eb468a7670db95db6029097d7"
] | [
"example_modelorderselection.py"
] | [
"import numpy as np\nfrom skstab import ModelOrderSelection\nfrom skstab.datasets import load_dataset\nfrom sklearn.cluster import KMeans\nfrom sklearn.neighbors import KNeighborsClassifier\n\ndataset = 'exemples2_5g'\nX, y = load_dataset(dataset)\nprint('Dataset: {} (true number of clusters: K = {})'.format(datase... | [
[
"numpy.unique"
]
] |
fongchun/ProDy | [
"cd781b105e3f502d581ee184c9009264b6245bcd"
] | [
"prody/proteins/ciffile.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"This module defines functions for parsing `mmCIF files`_.\n\n.. _mmCIF files: http://mmcif.wwpdb.org/docs/tutorials/mechanics/pdbx-mmcif-syntax.html\"\"\"\n\n\nfrom collections import defaultdict\nimport os.path\n\n\nimport numpy as np\n\nfrom prody.atomic import AtomGroup\nfrom prod... | [
[
"numpy.zeros"
]
] |
john-ramsey/darts | [
"8fa7dbfa48577587ba247244b381c48d01153a70"
] | [
"darts/models/forecasting/random_forest.py"
] | [
"\"\"\"\nRandom Forest\n-------------\n\nA forecasting model using a random forest regression. It uses some of the target series' lags, as well as optionally\nsome covariate series' lags in order to obtain a forecast.\n\nSee [1]_ for a reference around random forests.\n\nThe implementations is wrapped around `Rando... | [
[
"sklearn.ensemble.RandomForestRegressor"
]
] |
jphdotam/EAE-ECG-autoencoder | [
"9e556818f9a6ad80254f86a1ba22c7c0513b06cc"
] | [
"lib/training.py"
] | [
"import os\nimport torch\nfrom collections import deque\n\n\nclass Am:\n \"\"\"Simple average meter which stores progress as a running average\"\"\"\n\n def __init__(self, n_for_running_average=100): # n is in samples not batches\n self.n_for_running_average = n_for_running_average\n self.reset... | [
[
"torch.no_grad",
"torch.save"
]
] |
sulfurheron/py-motmetrics | [
"cda11f1a4e5feb6716dd906665bbbe08fce384f5"
] | [
"motmetrics/io.py"
] | [
"# py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.\n# https://github.com/cheind/py-motmetrics/\n#\n# MIT License\n# Copyright (c) 2017-2020 Christoph Heindl, Jack Valmadre and others.\n# See LICENSE file for terms.\n\n\"\"\"Functions for loading data and writing summaries.\"\"\"\n\nfrom __fu... | [
[
"pandas.read_csv",
"pandas.DataFrame"
]
] |
thekylesaurus/yellowbrick | [
"7447db6ccc30aea9f38d063162eab55e485dfa9d"
] | [
"tests/test_features/test_scatter.py"
] | [
"# tests.test_features.test_scatter\n# Test the ScatterViz feature analysis visualizers\n#\n# Author: Nathan Danielsen <nathan.danielsen@gmail.com>\n# Created: Fri Feb 26 19:40:00 2017 -0400\n#\n# Copyright (C) 2016 District Data Labs\n# For license information, see LICENSE.txt\n#\n# ID: test_scatter.py [fc94ec4... | [
[
"numpy.dtype",
"numpy.array",
"pandas.DataFrame"
]
] |
bbrauser/DS-Unit-3-Sprint-2-SQL-and-Databases | [
"a0fb261e31891184c2d57d9fb7d018d5896e672b"
] | [
"module4-acid-and-database-scalability-tradeoffs/mongo_titanic.py"
] | [
"import pandas as pd\nfrom sqlalchemy import create_engine\n\ndf = pd.read_csv('titanic.csv')\n\nengine = create_engine('postgres://kbgqljxh:QHI-WkUVtOcs-pFDVaPgU60nqANxVObL@isilo.db.elephantsql.com:5432/kbgqljxh')\ndf.to_sql('titanic_regress', con = engine)"
] | [
[
"pandas.read_csv"
]
] |
hackerspace/hacked_cnc | [
"dcd70b4de18b525748ec45727ac7f37fcd8b2ac1"
] | [
"hc/ui/glitems/grid.py"
] | [
"import numpy as np\n\nimport OpenGL.GL as gl\nfrom PyQt5 import QtGui\n\nfrom hc.ui.glitems import displaylist, HCItem\n\n\n# based on pyqtgraphs's grid\nclass Grid(HCItem):\n \"\"\"\n Displays a wire-grame grid.\n \"\"\"\n\n def __init__(self, size=None, color=None, antialias=True, glOptions='transluc... | [
[
"numpy.arange"
]
] |
ilyakava/ACGAN-PyTorch | [
"a2ac29d4d297e091a9c6a80281767f796b390be2"
] | [
"closest_faces_plot.py"
] | [
"from __future__ import absolute_import, division, print_function\nimport argparse\nimport os\nimport re\nfrom collections import defaultdict\nimport glob\nimport time\nimport pathlib\nimport imageio\nimport sys\nimport numpy as np\nimport fid\nimport imageio\nimport torch\nimport torchvision.utils as vutils\nimpor... | [
[
"sklearn.metrics.pairwise_distances",
"torch.Tensor",
"torch.load",
"numpy.arange",
"torch.utils.data.DataLoader",
"torch.from_numpy",
"numpy.ones",
"numpy.random.normal",
"torch.FloatTensor",
"numpy.argpartition",
"numpy.prod",
"numpy.moveaxis",
"torch.device",... |
ArthurAllshire/hack-day-2018 | [
"8b694a3e7110825a219a837ca68e7d6aaa2fe021"
] | [
"github.py"
] | [
"import requests\nfrom datetime import datetime\nimport time\nimport math\nimport numpy as np\nfrom urllib.parse import urlparse, parse_qs\n\nclass GitHub:\n \"\"\"\n Class to fetch from GitHub REST api and return list of commits from a\n specific repo.\n \"\"\"\n API_URL = \"https://api.github.com\"... | [
[
"numpy.digitize",
"numpy.linspace"
]
] |
Sawato/gail-driver | [
"358040faa6591e0b0a24776e15778fe39e8eb1c4"
] | [
"tf_rllab/samplers/batch_sampler.py"
] | [
"from rllab.sampler.base import BaseSampler\nfrom rllab.sampler import parallel_sampler\nfrom rllab.sampler.stateful_pool import singleton_pool\nimport tensorflow as tf\n\n\ndef worker_init_tf(G):\n G.sess = tf.Session()\n G.sess.__enter__()\n\n\ndef worker_init_tf_vars(G):\n G.sess.run(tf.initialize_all_v... | [
[
"tensorflow.initialize_all_variables",
"tensorflow.Session"
]
] |
MoMe36/Q-Learning-PyTorch | [
"bc2ecb9df2d7b294d490eea653b691ef8ff4c680"
] | [
"ddqn.py"
] | [
"import torch \nimport torch.nn as nn \nimport torch.nn.functional as F \nimport torch.optim as optim \n\n\nfrom common import ReplayBuffer, Env \nimport numpy as np \nimport gym \nfrom collections import deque\nimport random \nimport copy\n\nimport matplotlib.pyplot as plt \nplt.style.use('ggplot')\n\n\nclass DQN(... | [
[
"numpy.random.random",
"torch.max",
"torch.nn.Module.__init__",
"torch.randint",
"torch.tensor",
"matplotlib.pyplot.plot",
"torch.nn.Linear",
"numpy.exp",
"torch.nn.ReLU",
"matplotlib.pyplot.show",
"matplotlib.pyplot.style.use",
"numpy.random.randint"
]
] |
odenio/beam | [
"d6d6f30723fbfb1a0472fe814b419232e06952a5"
] | [
"sdks/python/apache_beam/dataframe/frames_test.py"
] | [
"#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); yo... | [
[
"pandas.testing.assert_series_equal",
"pandas.Series",
"pandas.MultiIndex",
"numpy.arange",
"pandas.DataFrame",
"pandas.MultiIndex.from_arrays",
"pandas.DatetimeIndex",
"numpy.random.randn",
"pandas.__version__.split",
"pandas.testing.assert_frame_equal",
"pandas.date_r... |
ostamand/tensorflow-tabnet | [
"cc676d75a5879df61d3b154ea783fbc364caf2a2"
] | [
"tabnet/models/model.py"
] | [
"from typing import List, Tuple\n\nimport tensorflow as tf\n\nfrom tabnet.models.transformers import (\n FeatureTransformer,\n AttentiveTransformer,\n)\n\n\nclass TabNet(tf.keras.Model):\n def __init__(\n self,\n num_features: int,\n feature_dim: int,\n output_dim: int,\n ... | [
[
"tensorflow.multiply",
"tensorflow.keras.layers.DenseFeatures",
"tensorflow.shape",
"tensorflow.zeros",
"tensorflow.ones",
"tensorflow.expand_dims",
"tensorflow.math.log",
"tensorflow.keras.activations.relu",
"tensorflow.keras.layers.BatchNormalization"
]
] |
Danial-Hussain/MyModel | [
"acbe4354a7b5e3dd32cdd92f3b4003c5848bbb3d"
] | [
"server/algo/utils.py"
] | [
"from typing import Union\nfrom django.core import exceptions\nimport statsmodels.api as sm\nfrom io import StringIO\nimport sklearn as sk\nimport numpy as np\nimport pandas as pd\nimport typing\nimport jwt\nimport os\n\n\ndef authorize(token: str) -> typing.Union[str, None]:\n \"\"\"\n Authorize jwt token\n ... | [
[
"sklearn.metrics.mean_absolute_error",
"pandas.read_csv",
"sklearn.metrics.r2_score",
"sklearn.metrics.mean_squared_error"
]
] |
bfbechlin/meanderpy | [
"502cf6a0cb4b254908977576fd5edf477ccd740e"
] | [
"meanderpy/main00.py"
] | [
"import meanderpy as mp\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nONE_YEAR = 365*24*60*60.0\n\nL = 20000\nds = 100\n\nx = np.linspace(0, L, int(L/ds) + 1)\ny = 500 * np.exp(( 1.0 / L) * x) * np.cos((x / L) * 16 * np.pi) / (np.exp((x - 0.75 * L) / (0.025 * L)) + 1)\n\nz = np.tan(5.0 * np.pi / 180) / (2... | [
[
"numpy.tan",
"numpy.exp",
"numpy.cos",
"matplotlib.pyplot.show"
]
] |
LibRec-Practical/ideaman-offline | [
"f8341fc9ca77adcc1191c01037dda18c02d77b29"
] | [
"ideaman_rec/Sort/GBDT/GBDT.py"
] | [
"import pandas as pd\nimport numpy as np\nfrom sklearn.ensemble import GradientBoostingClassifier\nfrom sklearn import metrics\nimport matplotlib.pylab as plt\nfrom sklearn.model_selection import train_test_split\n\nimport sys, os\n\nsys.path.append(\"../../\")\nsys.path.extend([os.path.join(root, name) for root, d... | [
[
"pandas.read_csv",
"sklearn.ensemble.GradientBoostingClassifier"
]
] |
JRMeyer/tensorflow-tutorial | [
"dbbf65bc7e4516a61d27d30954bf59e1477e28f3"
] | [
"logistic_regression_predict.py"
] | [
"import numpy as np\nimport tensorflow as tf\nimport tarfile\nimport os\n\ndef csv_to_numpy_array(filePath, delimiter):\n return np.genfromtxt(filePath, delimiter=delimiter, dtype=None)\n\ndef import_data():\n if \"data\" not in os.listdir(os.getcwd()):\n # Untar directory of data if we haven't already... | [
[
"tensorflow.matmul",
"tensorflow.nn.sigmoid",
"tensorflow.zeros",
"tensorflow.cast",
"tensorflow.placeholder",
"numpy.genfromtxt",
"tensorflow.initialize_all_variables",
"numpy.argmax",
"tensorflow.add",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.ar... |
uditarora/pytorch-lightning | [
"7245e48153909d9de8458b1f5b8b2bc740d80104"
] | [
"pytorch_lightning/trainer/trainer.py"
] | [
"import inspect\nimport os\nfrom argparse import ArgumentParser, Namespace\nfrom typing import Union, Optional, List, Dict, Tuple, Iterable, Any\n\nimport torch\nimport torch.distributed as torch_distrib\nimport torch.multiprocessing as mp\nfrom torch.utils.data import DataLoader\n\nfrom pytorch_lightning import _l... | [
[
"torch.multiprocessing.spawn",
"torch.cuda.empty_cache",
"torch.distributed.barrier",
"torch.cuda.amp.GradScaler",
"torch.cuda.is_available",
"torch.device",
"torch.cuda.device"
]
] |
sebastian-sosa/nlpaug | [
"db8f0412a09ca0decb3eb6f8d1deeb4f03e6968e"
] | [
"nlpaug/model/lang_models/xlnet.py"
] | [
"import logging\n\ntry:\n import torch\n from transformers import AutoModelForCausalLM, AutoTokenizer\nexcept ImportError:\n # No installation required if not using this function\n pass\n\nfrom nlpaug.model.lang_models import LanguageModels\nfrom nlpaug.util.selection.filtering import *\n\n\n# TODO: no ... | [
[
"torch.no_grad",
"torch.tensor"
]
] |
eshanking/seascapes_figures | [
"a9afc339a3565a5c71a05cd44d790eb839a79262"
] | [
"figure_code/seascape_v_landscape_fig.py"
] | [
"from seascapes_figures.utils import plotter, results_manager\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport os\nimport pickle\n\ndef unpack(sim_path):\n\n data_dict = pickle.load(open(sim_path,'rb'))\n counts = data_dict['counts']\n drug_conc = data_dict['drug_curve']\n\n return counts, d... | [
[
"numpy.arange",
"numpy.array",
"matplotlib.pyplot.subplots"
]
] |
kenneym/py-feat | [
"59a25139ad52914d41ebf7fd63e25357c097b745"
] | [
"feat/facepose_detectors/pnp/pnp_model.py"
] | [
"import os\r\nimport cv2\r\nimport numpy as np\r\nfrom feat.utils import get_resource_path\r\nfrom feat.facepose_detectors.utils import convert_to_euler\r\nTHREED_FACE_MODEL = os.path.join(get_resource_path(), \"reference_3d_68_points_trans.npy\")\r\n\r\n\r\nclass PerspectiveNPointModel:\r\n \"\"\" Class that le... | [
[
"numpy.load",
"numpy.squeeze",
"numpy.array",
"numpy.zeros"
]
] |
angelolovatto/raylab | [
"ebaea8df1a391fb844e75df62ccf1e2e07311d88"
] | [
"raylab/policy/torch_policy.py"
] | [
"\"\"\"Base for all PyTorch policies.\"\"\"\nimport textwrap\nfrom typing import Dict, List, Optional, Set, Tuple, Type, Union\n\nimport torch\nfrom gym.spaces import Space\nfrom nnrl.utils import convert_to_tensor\nfrom ray.rllib import Policy, SampleBatch\nfrom ray.rllib.evaluation.episode import MultiAgentEpisod... | [
[
"torch.jit.script",
"torch.no_grad",
"torch.cuda.is_available"
]
] |
frednam93/FDY-SED | [
"5824ffb1f7806315f85946c27a7ec62b3bd3b46c"
] | [
"utils/model.py"
] | [
"#Some codes are adopted from https://github.com/DCASE-REPO/DESED_task\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\n\nclass GLU(nn.Module):\n def __init__(self, in_dim):\n super(GLU, self).__init__()\n self.sigmoid = nn.Sigmoid()\n self.linear = nn.Linear(in_dim... | [
[
"torch.mean",
"torch.nn.functional.softmax",
"torch.nn.Softmax",
"torch.nn.GRU",
"torch.sum",
"torch.nn.LeakyReLu",
"torch.nn.Dropout",
"torch.randn",
"torch.nn.Sigmoid",
"torch.nn.GroupNorm",
"torch.nn.Sequential",
"torch.nn.BatchNorm1d",
"torch.nn.init.constan... |
jonojace/fairseq | [
"ce287a3ca25fb26e65ae4d12614bbf174371eaa9"
] | [
"examples/tac/Hubert_ASR_generate_transcripts.py"
] | [
"import torch\nfrom transformers import HubertForCTC, Wav2Vec2Processor\nfrom datasets import load_dataset\nimport soundfile as sf\nimport librosa\n\nprocessor = Wav2Vec2Processor.from_pretrained(\"facebook/hubert-large-ls960-ft\")\nmodel = HubertForCTC.from_pretrained(\"facebook/hubert-large-ls960-ft\")\n\ndef rep... | [
[
"torch.argmax"
]
] |
mannurulz/Cirq | [
"78218a61c816b8c4b2b7a3d91b8c24df2dce30a0"
] | [
"cirq/ops/eigen_gate.py"
] | [
"# Copyright 2018 The Cirq Developers\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# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law o... | [
[
"numpy.round"
]
] |
dasushi/silkymitties-server | [
"8314de95647fefb8556e0ba7aff96545a405088c"
] | [
"core/lstm.py"
] | [
"import numpy as np\nfrom keras.models import Sequential, Model, model_from_json\nfrom keras.layers import Input\nfrom keras.layers.core import Dense, Activation, Dropout, Merge, RepeatVector\nfrom keras.layers.recurrent import LSTM\nfrom keras.layers.embeddings import Embedding\nfrom keras.preprocessing import seq... | [
[
"numpy.vstack",
"numpy.zeros",
"numpy.empty"
]
] |
AlessandroPierro/trajectory-optimization | [
"e474af45067894b11eea263cf07d850c5537767c"
] | [
"problema_test/smoothing.py"
] | [
"# Importing numerical libraries\nimport numpy as np\nfrom scipy import optimize\n\n# Importing plotting libraries\nfrom bokeh.plotting import figure, show\nfrom bokeh.io import export_png\n\n\nexport = True\n\n\ndef solve_NLP(N, smoothing=False):\n\n if N % 2 == 0:\n N += 1 # assicura che il numero dei... | [
[
"numpy.linspace",
"numpy.power",
"numpy.full",
"scipy.optimize.Bounds",
"scipy.optimize.minimize",
"numpy.zeros"
]
] |
yupeng-zglue/tensorflow | [
"2eb1429580a15af5de0751da1ab9b750eb07bea8"
] | [
"tensorflow/python/keras/engine/base_layer_v1.py"
] | [
"# Copyright 2015 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.keras.mixed_precision.experimental.policy.serialize",
"tensorflow.python.training.tracking.layer_utils.filter_empty_layer_containers",
"tensorflow.python.keras.backend.name_scope",
"tensorflow.python.keras.backend.batch_get_value",
"tensorflow.python.util.tf_inspect.getfulla... |
star936/python-learning | [
"02fe35a3944cb75184f1c9196618202ccf02c210"
] | [
"examples/read_city.py"
] | [
"# coding: utf-8\n\nimport pandas as pd\nimport sqlite3\nimport psycopg2\n\nHOST = 'localhost'\nPORT = 5432\nDATABASE = 'test'\nUSER = 'root'\nPASSWORD = 'root'\n\npg_conn = psycopg2.connect(host=HOST,\n port=PORT,\n user=USER,\n password... | [
[
"pandas.DataFrame"
]
] |
mmlanger/pyrbfpu | [
"005ac2778c913c4d3a7d836da9ecdf27afb44c74"
] | [
"error_local.py"
] | [
"import time\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\nfrom pyrbfpu.common import *\n\n\nnp.random.seed(12351)\npoints = np.random.uniform(0, 3, (200, 2))\n\n\ndef test_func(point):\n x, y = point\n r = np.sqrt(x ** 2 + y ** 2)\n return np.sin(x) * np.cos(y) * (10 - r)\n\n\nkernel = ge... | [
[
"matplotlib.pyplot.legend",
"numpy.sqrt",
"numpy.random.seed",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.random.uniform",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure"
]
] |
pourabkarchaudhuri/unsupervised-clustering-faces-tensorflow | [
"1267df0e32e8f7bbdc7b6072bf1383c40d35163d"
] | [
"face_detect_demo.py"
] | [
"import tensorflow as tf\nfrom align import detect_face\nimport cv2\nimport imutils\nimport numpy as np\nimport argparse\n\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--img\", type = str, required=True)\nargs = parser.parse_args()\n\n# some constants kept as default from facenet\nminsize = 20\nthresh... | [
[
"numpy.maximum",
"numpy.minimum",
"numpy.asarray",
"numpy.squeeze",
"tensorflow.Session",
"numpy.zeros"
]
] |
syahrulhamdani/disaster-response-pipeline | [
"b5ce11d0c29972120e500e8effecaa9c44f765d7"
] | [
"apps/routes.py"
] | [
"import json\n\nimport joblib\nimport pandas as pd\nimport plotly\nfrom flask import Flask, render_template, request, jsonify\nfrom nltk.stem import WordNetLemmatizer\nfrom nltk.tokenize import word_tokenize\n# from plotly.graph_objs import Bar\nfrom plotly.graph_objects import Bar\nfrom sqlalchemy import create_en... | [
[
"pandas.read_sql_table"
]
] |
Panaetius/python-profiling-presentation | [
"0ed7a20fcefbb3bb5afc2fe7f99b603e458a0575"
] | [
"examples/example2/example_better.py"
] | [
"import numpy as np\n\n\ndef main():\n x = np.array(range(10**7))\n y = np.random.uniform(0, 100, size=(10**8))\n\n\nmain()\n"
] | [
[
"numpy.random.uniform"
]
] |
takumihonda/TC202010 | [
"e661288cba8f2bffea0712c0fb23901eec509ae6"
] | [
"src/tseries_besttrack.py"
] | [
"import numpy as np\nimport matplotlib.pyplot as plt\n\nimport matplotlib.dates as mdates\n\nfrom datetime import datetime, timedelta\n\nfrom tools_TC202010 import get_besttrack, plot_or_save\n\nquick = False\n\ndef main( stime=datetime( 2020, 8, 26, 0 ), etime=datetime( 2020, 9, 6, 0, )):\n tlons, tlats, tslps,... | [
[
"numpy.arange",
"matplotlib.dates.HourLocator",
"matplotlib.pyplot.subplots",
"matplotlib.dates.DateFormatter"
]
] |
kongwilson/kaggle-feedback-prize | [
"475cbc88fea6618cdd2281e051c9cb69dd8bc2d7"
] | [
"main-longformer_tutorial.py"
] | [
"\"\"\"\nbase on\nhttps://www.kaggle.com/abhishek/two-longformers-are-better-than-1\n\nCopyright (C) Weicong Kong, 17/02/2022\n\"\"\"\n# %% [code] {\"jupyter\":{\"outputs_hidden\":false},\"execution\":{\"iopub.status.busy\":\"2022-01-05T18:19:34.765636Z\",\"iopub.execute_input\":\"2022-01-05T18:19:34.766525Z\",\"io... | [
[
"torch.softmax",
"pandas.concat",
"torch.cuda.empty_cache",
"pandas.DataFrame",
"torch.tensor",
"numpy.max",
"torch.nn.Linear",
"numpy.argmax"
]
] |
real-tesco/Multi-Step-Reasoning | [
"12c57714c490c5ef5aea9ecabce2143ca89d90b2"
] | [
"msr/data/datasets/rankingdataset.py"
] | [
"import json\nimport logging\nimport numpy as np\nfrom typing import List\n\nimport torch\nfrom torch.utils.data import Dataset\n\n\nlogger = logging.getLogger()\n\n\nclass RankingDataset(Dataset):\n def __init__(\n self,\n doc_embedding_files: List,\n doc_ids_files: List,\n query_emb... | [
[
"numpy.concatenate",
"numpy.load",
"torch.stack",
"torch.cat"
]
] |
bobmshannon/ReliableTransportProtocols | [
"5f06534684a445a030c33840aaf5d0103f45846a"
] | [
"scripts/Experiment 3 Results/exp3-graphs.py"
] | [
"import matplotlib.pyplot as plt\n\n\"\"\"\nLoss=0,Corruption=0,t=0.1,m=10000\nX-axis: Window size;\nY-axis: Throughput (ABT, GBN and SR) in one graph/plot.\n\"\"\"\ndef graph_one():\n\t# X-axis (ABT, GBN, SR)\n\twsize = [10, 50, 100, 200, 500]\n\t# Y-axis (ABT)\n\tabt_throughput = [0.0696589, 0.0696589, 0.0696589,... | [
[
"matplotlib.pyplot.legend",
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel"
]
] |
SimonBlanke/derivative-free-optimizers | [
"e7a95503195ea7c0b3590241caf499ea307085f2"
] | [
"gradient_free_optimizers/optimizers/local_opt/downhill_simplex.py"
] | [
"# Author: Simon Blanke\n# Email: simon.blanke@yahoo.com\n# License: MIT License\n\n\nimport random\nimport numpy as np\n\nfrom ..base_optimizer import BaseOptimizer\nfrom ...search import Search\n\n\ndef sort_list_idx(list_):\n list_np = np.array(list_)\n idx_sorted = list(list_np.argsort()[::-1])\n retur... | [
[
"numpy.array",
"numpy.array_equal"
]
] |
isLinXu/Yolov5_Efficient | [
"2d9ff5552bb6e608a810b063fc68e192d9264924"
] | [
"yolov5_master/utils/loggers/__init__.py"
] | [
"# YOLOv5 🚀 by Ultralytics, GPL-3.0 license\n\"\"\"\nLogging utils\n\"\"\"\n\nimport os\nimport warnings\nfrom threading import Thread\n\nimport pkg_resources as pkg\nimport torch\nfrom torch.utils.tensorboard import SummaryWriter\n\nfrom yolov5_master.utils.general import colorstr, emojis\nfrom yolov5_master.util... | [
[
"torch.load"
]
] |
BanafshehKhaki/pHandDOprediction-models | [
"5164559f22e770ef3d60867380e1f367ec3d8a83"
] | [
"python_Scripts/univariate_models_train.py"
] | [
"import numpy as np\nimport pandas as pd\nimport re\nimport matplotlib.pyplot as plt\nimport os\nimport gc\nimport joblib\nfrom sklearn.metrics import r2_score\nfrom sklearn.metrics import precision_score\nfrom sklearn.metrics import f1_score\nimport sklearn.metrics as skm\nfrom sklearn.metrics import confusion_mat... | [
[
"matplotlib.pyplot.legend",
"pandas.concat",
"pandas.read_csv",
"pandas.to_datetime",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.close",
"matplotlib.pyplot.xticks",
"numpy.array"
]
] |
openforcefield/beryllium | [
"0870e93c45caa57ff738efa89f2c2cba1680c3cc"
] | [
"arsenic/tests/test_stats.py"
] | [
"import itertools\n\nimport networkx as nx\nimport numpy as np\nfrom arsenic import stats\nfrom arsenic.stats import bootstrap_statistic\n\n\ndef test_mle_easy():\n \"\"\"\n Test that the MLE for a graph with an absolute\n estimate on all nodes will recapitulate it\n \"\"\"\n input_absolutes: list = ... | [
[
"numpy.random.uniform",
"numpy.abs"
]
] |
LBJ-Wade/aplpy_astro_plotting_lib | [
"3edc7f1ddb005ffac2ed79c42c189e991f5a9291"
] | [
"aplpy/angle_util.py"
] | [
"from __future__ import absolute_import, print_function, division\n\nimport math\nimport struct\n\nimport numpy as np\nfrom . import math_util\n\n\ndef almost_equal(a, b):\n c = struct.pack(\"<dd\", a, b)\n d = struct.unpack(\"<qq\", c)\n diff = abs(d[1] - d[0])\n return diff < 100\n\n\nclass Angle(obje... | [
[
"numpy.mod",
"numpy.abs"
]
] |
LesterLian/CROWN-IBP | [
"dbe9fa67221940f88da73292298051a5401b3a84"
] | [
"train_ada.py"
] | [
"## Copyright (C) 2019, Huan Zhang <huan@huan-zhang.com>\n## Hongge Chen <chenhg@mit.edu>\n## Chaowei Xiao <xiaocw@umich.edu>\n## \n## This program is licenced under the BSD 2-Clause License,\n## contained in the LICENCE file in this directory.\n##\nimport copy\nimport sys\ni... | [
[
"torch.optim.lr_scheduler.MultiStepLR",
"torch.abs",
"torch.LongTensor",
"torch.max",
"torch.Tensor",
"torch.reshape",
"torch.min",
"torch.eye",
"torch.argmax",
"numpy.finfo",
"torch.tensor",
"torch.no_grad",
"numpy.mean",
"torch.arange",
"numpy.zeros",
... |
akbapu14/GOSeq2Seq | [
"779b7b105db544cdc1278fac4187e00521bf0fd8"
] | [
"stackedSeq2Seq.py"
] | [
"import tensorflow as tf\nfrom seq2seq.models import bridges\nfrom seq2seq.encoders import rnn_encoder\nfrom seq2seq.decoders import attention_decoder\nfrom seq2seq.decoders import basic_decoder\nfrom seq2seq.decoders import attention\nfrom seq2seq.training import utils as training_utils\nfrom seq2seq.contrib.seq2s... | [
[
"tensorflow.local_variables_initializer",
"tensorflow.transpose",
"tensorflow.dynamic_partition",
"tensorflow.reduce_mean",
"tensorflow.stack",
"tensorflow.reduce_sum",
"tensorflow.contrib.framework.get_global_step",
"tensorflow.placeholder",
"tensorflow.global_variables_initia... |
hyeon-jo/C3D-DeepFakeDetection-pytorch | [
"3ce1b22f76ba5f0871fbd4e8745d4915bae76d3b"
] | [
"models/c3d.py"
] | [
"\"\"\"C3D\"\"\"\r\nimport math\r\nfrom collections import OrderedDict\r\n\r\nimport torch\r\nimport torch.nn as nn\r\nfrom torch.nn.modules.utils import _triple\r\n\r\n\r\nclass Flatten(nn.Module):\r\n def forward(self, x):\r\n return x.view(x.size(0), 1)\r\n\r\n\r\nclass AttentionModule(nn.Module):\r\n ... | [
[
"torch.nn.AdaptiveMaxPool3d",
"torch.nn.Sigmoid",
"torch.nn.AdaptiveAvgPool3d",
"torch.nn.MaxPool3d",
"torch.nn.Conv3d",
"torch.nn.Linear",
"torch.nn.ReLU",
"torch.nn.BatchNorm3d",
"torch.squeeze"
]
] |
RaghuSpaceRajan/ConfigSpace | [
"0e0cd1dbafc8485c3d3e44add342f0c9a223ed9f"
] | [
"test/read_and_write/test_irace_writer.py"
] | [
"# Copyright (c) 2014-2017, ConfigSpace developers\n# Matthias Feurer\n# Katharina Eggensperger\n# Mohsin Ali\n# and others (see commit history).\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are... | [
[
"numpy.exp"
]
] |
zcemycl/autonomous_mobile_robot | [
"302b3336005acd81202ebbbb0c52a4b2692fa9c7"
] | [
"robot_control/src/path_planner.py"
] | [
"#!/usr/bin/python\n\nimport numpy as np\nimport yaml\nimport math\nfrom operator import itemgetter\nimport heapq\nimport pprint\n\n\n\n\ndef dijkstras(occupancy_map, x_spacing, y_spacing, start, goal):\n \"\"\"\n Implements Dijkstra's shortest path algorithm\n Input:\n occupancy_map - an N by M numpy a... | [
[
"numpy.array"
]
] |
soujyo/punctuation-restoration | [
"cfbc3f76cba3c7f4a1597166deba267c713424a5"
] | [
"src/focal_loss.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\nclass FocalLoss(nn.Module):\n def __init__(self, weight=None, gamma=2, reduction='mean'):\n super(FocalLoss, self).__init__()\n self.gamma = gamma\n self.reduction = reduction\n self.weight = weight\n\n def ... | [
[
"torch.exp",
"torch.nn.functional.cross_entropy"
]
] |
GeorgRamer/spectroscopy_data | [
"f8eab01bcfa5c1ec8b47eec91954775dfe81d274"
] | [
"spectroscopy_data/utils.py"
] | [
"import numpy as np\n\n\ndef gaussian_band(wn, A, s, m):\n return A/s*np.sqrt(2*np.pi)*np.exp(-(wn-m)**2/2/s**2)\n \ndef lorentzian_band(wn, A, w, m):\n return A /(1 + (wn - m)**2/w**2)/(w*np.pi)\n\n\ndef band(wn, band_params):\n if band_params[0] == \"gauss\":\n return gaussian_band(wn, *band_pa... | [
[
"numpy.random.randn",
"numpy.exp",
"numpy.zeros_like",
"numpy.sqrt"
]
] |
ulises1229/Python-Raytracer | [
"ad89b9dabda1c3eeb68af2d3578c3f38dee9f5b9"
] | [
"sightpy/utils/colour_functions.py"
] | [
"import numpy as np\r\n\r\ndef sRGB_linear_to_sRGB(rgb_linear):\r\n\r\n '''sRGB standard for gamma inverse correction.'''\r\n rgb = np.where( rgb_linear <= 0.00304, 12.92 * rgb_linear, 1.055 * np.power(rgb_linear, 1.0/2.4) - 0.055)\r\n \r\n # clip intensity if needed (rgb values > 1.0) by scaling\r\n ... | [
[
"numpy.amax",
"numpy.where",
"numpy.power"
]
] |
isaaccorley/torchrs | [
"bb27a29e344741f8dda504ac296af6d03a20e7df"
] | [
"torchrs/datasets/tiselac.py"
] | [
"import os\nfrom typing import Tuple\n\nimport torch\nimport numpy as np\nfrom einops import rearrange\n\nfrom torchrs.transforms import Compose, ToTensor\n\n\nclass Tiselac(torch.utils.data.Dataset):\n \"\"\" TiSeLac dataset from the Time Series Land Cover Classification Challenge (2017)\n https://sites.goog... | [
[
"torch.tensor"
]
] |
leondz/danlp | [
"6860d217effa30c8c1b7bdb0c53f72aaef301056"
] | [
"danlp/models/xlmr_models.py"
] | [
"from danlp.download import DEFAULT_CACHE_DIR, download_model, \\\n _unzip_process_func\n\nfrom allennlp.models.archival import load_archive\nfrom allennlp.common.util import import_module_and_submodules\nfrom allennlp.common.util import prepare_environment\nimport torch\nimport os, warnings\n\nimport_module_and... | [
[
"torch.nn.functional.softmax"
]
] |
isi-vista/rtg | [
"149415f424f2a6585cbe0d97f0007b8b0b53d164"
] | [
"rtg/exp.py"
] | [
"import copy\nimport os\nimport random\nfrom datetime import datetime, timedelta\nfrom pathlib import Path\nfrom functools import partial\nfrom typing import Optional, Dict, List, Tuple, Union, Any\nimport time\nfrom collections import Counter\n\nimport numpy as np\nimport torch\nimport hashlib\nimport portalocker\... | [
[
"numpy.random.seed",
"torch.load",
"torch.zeros",
"torch.manual_seed",
"torch.tensor",
"torch.cuda.is_available",
"torch.save"
]
] |
joesdesk/ssnmf | [
"7ae321a2a19cde174679ba5acde2f151cf0c99e8"
] | [
"nonnegfac/nnls.py"
] | [
"import numpy as np\nimport scipy.optimize as opt\nimport scipy.sparse as sps\nimport numpy.linalg as nla\nimport scipy.linalg as sla\nimport time\n\n\ndef nnlsm_blockpivot(A, B, is_input_prod=False, init=None):\n \"\"\" Nonnegativity-constrained least squares with block principal pivoting method and column grou... | [
[
"numpy.all",
"numpy.argmin",
"numpy.any",
"numpy.ix_",
"scipy.sparse.issparse",
"numpy.allclose",
"numpy.arange",
"numpy.zeros",
"numpy.logical_or",
"numpy.random.rand",
"numpy.logical_and",
"numpy.array",
"numpy.sum",
"numpy.linalg.solve",
"numpy.array_... |
davidGCR/VioDenseDuplication | [
"6bfe92a26603eba87373ae66cfcf71ef82b8c35d"
] | [
"src/TubeletGeneration/visual_utils.py"
] | [
"import os\nimport numpy as np\nimport cv2\n\nfrom PIL import Image\n\ncolor = {'green':(0,255,0),\n 'blue':(255,165,0),\n 'dark red':(0,0,139),\n 'red':(0, 0, 255),\n 'dark slate blue':(139,61,72),\n 'aqua':(255,255,0),\n 'brown':(42,42,165),\n 'deep pink':(147,20,2... | [
[
"numpy.array"
]
] |
BioPyTeam/biopy | [
"5c1444280d0a5098b61a99d96dc2825259c7ced5"
] | [
"src/biopy/metrics/reconstruction_error.py"
] | [
"import torch\nimport torch.nn as nn\nfrom torch.utils import data\nfrom collections import defaultdict\nfrom torch.utils.data import DataLoader\nfrom torch.nn import MSELoss\nfrom ..models import DomainTranslator\n\n\nclass LatentSpace:\n\n def __init__(self, dim, model, dataset, omics=['miRNA', 'mRNA', 'meth27... | [
[
"torch.utils.data.DataLoader",
"torch.nn.MSELoss",
"torch.cuda.is_available"
]
] |
evhub/roe | [
"7d5c90e73a97cad66d6efddc87d6d7b8a22d8aed"
] | [
"bbopt/backends/hyperopt.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# __coconut_hash__ = 0xfdeb9be1\n\n# Compiled with Coconut version 2.0.0-a_dev53 [How Not to Be Seen]\n\n\"\"\"\nThe hyperopt backend. Does black box optimization using hyperopt.\n\"\"\"\n\n# Coconut Header: -----------------------------------------------------------... | [
[
"numpy.random.RandomState",
"numpy.random.default_rng"
]
] |
EPRI-SQA/Melody | [
"b9e576676fecefc7a3da1611e1c068f3cc728a89"
] | [
"srcs/utils/pcap_visualize.py"
] | [
"import dpkt\nfrom argparse import ArgumentParser\nfrom srcs.proto import css_pb2\nimport pandas as pd\nimport plotly.offline as py\nimport plotly.graph_objs as go\n\n\ndef process_pcap(pcap_file,keys_to_plot):\n\t\n\tpcap = dpkt.pcap.Reader(open(pcap_file))\n\tpkt_parsed = css_pb2.CyberMessage()\n\n\tunique_app_id... | [
[
"pandas.concat",
"pandas.DataFrame"
]
] |
jhkennedy/asf-tools | [
"435a544bd6f3f4953679e5d891c0e454f7bdd471"
] | [
"asf_tools/tile.py"
] | [
"from typing import Tuple, Union\n\nimport numpy as np\n\n\ndef tile_array(array: Union[np.ndarray, np.ma.MaskedArray], tile_shape: Tuple[int, int] = (200, 200),\n pad_value: float = None) -> Union[np.ndarray, np.ma.MaskedArray]:\n \"\"\"Tile a 2D numpy array\n\n Turn a 2D numpy array like:\n ... | [
[
"numpy.ceil",
"numpy.ma.MaskedArray",
"numpy.zeros",
"numpy.pad"
]
] |
klobrien89/differential-privacy | [
"327972c1ae710e8cd0a4754fffdd78c3500272ee"
] | [
"python/dp_accounting/privacy_loss_distribution.py"
] | [
"# Copyright 2020 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed... | [
[
"numpy.exp"
]
] |
samtkapadia/IMT_new_languages | [
"71439a8623de0bbbbb982b2ba7788f76e386818a"
] | [
"IMT_django/teacher/helper_functions.py"
] | [
"import numpy as np\nimport os\n\n\ndef pad_audio(audio_in, length=40000):\n trail_space = max(length - audio_in.shape[0], 0)\n\n print(trail_space)\n audio_padded = np.pad(audio_in, (0, trail_space))\n\n return audio_padded\n\n\ndef calculate_final_score(request):\n total_score = np.sum(request.sess... | [
[
"numpy.sum",
"numpy.pad"
]
] |
dnnspark/trainer | [
"cdf28eaf22e4b97e11b08d4d04274e2e178f20e3"
] | [
"experiment_interface/utils.py"
] | [
"import numpy as np\n\ndef np_encode(x):\n\t'''\n\tInput\n\t=====\n\t\tx : np.ndarray\n\n\n\tReturn\n\t======\n\t\tencoded_array: bytes\n\t\tencoded_shape: bytes\n\t\tencoded_dtype: bytes\n\t'''\n\n\tencoded_array = x.tostring()\n\tencoded_shape = str(x.shape)[1:-1]\n\tencoded_dtype = str(x.dtype)\n\n\treturn encod... | [
[
"numpy.frombuffer",
"numpy.fromstring",
"numpy.dtype"
]
] |
aboddie/pandaSDMX | [
"224bf7c86ca159628e0087c8041be6cf9228f4c5"
] | [
"pandasdmx/tests/writer/test_pandas.py"
] | [
"\"\"\"Tests for pandasdmx/writer.py.\"\"\"\nimport pandas as pd\nimport pytest\nfrom pytest import raises\n\nimport pandasdmx\nfrom pandasdmx.model import TimeDimension\nfrom pandasdmx.tests import assert_pd_equal\nfrom pandasdmx.tests.data import expected_data, specimen, test_files\n\n# file name → (exception rai... | [
[
"pandas.merge"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.