repo_name stringlengths 6 130 | hexsha list | file_path list | code list | apis list |
|---|---|---|---|---|
haozhu233/time_series_prediction | [
"9fc40ebd76d44217025aa29b63bd620163773902"
] | [
"src/cnn_hao/dataloader.py"
] | [
"import torch\nfrom torch.utils.data import Dataset, DataLoader\nimport pandas as pd\nimport numpy as np\n\n# Model/dataloader definitions\nclass tsPredDataset(Dataset):\n def __init__(self, x_df, y_df, seq_id, x_cols, y_col, ts_steps=None):\n list_of_x = x_df[[seq_id] + x_cols] \\\n .g... | [
[
"pandas.read_csv",
"numpy.random.random",
"numpy.random.seed",
"numpy.stack",
"pandas.unique"
]
] |
maxlz/ML | [
"4929ee496a822e9b2d0981f17bf4b607d42953ad"
] | [
"keras_transfer_catdog.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nSpyder Editor\n\nThis is a temporary script file.\n\"\"\"\n\nfrom keras.models import Sequential\nfrom keras.layers.core import Flatten, Dense, Dropout\nfrom keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D\nfrom keras.optimizers import SGD\nfrom keras.p... | [
[
"numpy.load",
"numpy.array"
]
] |
dathudeptrai/rfcx-kaggle | [
"e0d4705cd27c02142f3b2cac42083d6569a90863"
] | [
"backbones/inceptionv3.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.applications.imagenet_utils.decode_predictions",
"tensorflow.python.keras.backend.image_data_format",
"tensorflow.python.keras.utils.data_utils.get_file",
"tensorflow.python.keras.layers.VersionAwareLayers",
"tensorflow.python.util.tf_export.keras_export",
"tensorf... |
HesNobi/d4rl | [
"5f7834fee82902950cc27be8962bb32f18821f9c"
] | [
"d4rl/__init__.py"
] | [
"import os\nimport sys\nimport collections\nimport numpy as np\n\nimport d4rl.infos\nfrom d4rl.offline_env import set_dataset_path, get_keys\n\nSUPPRESS_MESSAGES = bool(os.environ.get('D4RL_SUPPRESS_IMPORT_ERROR', 0))\n\n_ERROR_MESSAGE = 'Warning: %s failed to import. Set the environment variable D4RL_SUPPRESS_IMPO... | [
[
"numpy.array"
]
] |
sylviemonet/thewalrus | [
"b39e49573943075d0160baf1cccb3f2ecf653495"
] | [
"thewalrus/_hermite_multidimensional.py"
] | [
"# Copyright 2019 Xanadu Quantum Technologies Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applica... | [
[
"numpy.real_if_close",
"numpy.complex128",
"numpy.reshape",
"numpy.arange",
"numpy.ones",
"numpy.array",
"numpy.zeros"
]
] |
vishalbelsare/resilience | [
"596a9b8224fc6168bd6ee5718ea6c57425b7f273"
] | [
"resilience/agents/AssetManager.py"
] | [
"import logging\n\nimport numpy as np\n\nfrom ..contracts import Shares\nfrom ..parameters import eps, isequal_float\nfrom .Institution import Institution\nfrom .DefaultException import DefaultException\n\n\nclass AssetManager(Institution):\n def __init__(self, name: str, model):\n super().__init__(name, ... | [
[
"numpy.clip"
]
] |
ajmaurais/ms2_annotator | [
"103fa6bef497589005c7fd264a9b68355d4fc056"
] | [
"python/parsers/parse_maxquant.py"
] | [
"\nimport sys\nimport os\nimport re\nimport argparse\nimport pandas as pd\n\nfrom modules.parent_parser import PARENT_PARSER\nfrom modules import tsv_constants\nfrom modules import maxquant_constants\nfrom modules.molecular_formula import MolecularFormula\nfrom modules import atom_table\nfrom modules import utils\n... | [
[
"pandas.read_csv",
"pandas.Series",
"pandas.DataFrame"
]
] |
akshat2048/MSOE_ML | [
"78d8d5753d70bb72b36df44926c95a808ad12f53"
] | [
"pytorch/denseNet121Test/DenseNet121.py"
] | [
"import torch\nmodel = torch.hub.load('pytorch/vision:v0.10.0', 'densenet121', pretrained=True)"
] | [
[
"torch.hub.load"
]
] |
has2k1/scikit-misc | [
"21f88c85dc7f4b88b26a85ad228e825dc98018ec"
] | [
"skmisc/loess/tests/test_loess.py"
] | [
"import os\n\nimport pytest\nimport numpy as np\nimport numpy.testing as npt\n\nfrom skmisc.loess import loess, loess_anova\n\ndata_path = os.path.dirname(os.path.abspath(__file__))\n\n\ndef madeup_data():\n dfile = os.path.join(data_path, 'madeup_data')\n rfile = os.path.join(data_path, 'madeup_result')\n\n ... | [
[
"numpy.testing.assert_almost_equal",
"numpy.array",
"numpy.testing.assert_equal"
]
] |
kkirtac/ms-tcn | [
"9905a3342d8f7fe2157b0dd8cda87bf6d2c84d62"
] | [
"dataset.py"
] | [
"import copy\nimport os\nimport pandas as pd\nimport torch\nimport torch.utils.data as data\nfrom tqdm import tqdm\nimport numpy as np\n\n\ndef load_feature_from_index(video_feat_path, frame_index):\n feat_path = os.path.join(video_feat_path, 'image_{:06d}.npy'.format(frame_index))\n\n if os.path.exists(feat_... | [
[
"torch.LongTensor",
"pandas.read_csv",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor",
"numpy.row_stack",
"numpy.load"
]
] |
kangkang59812/GCNCaption | [
"25314dbf17e67fe0b39acae554f99817e8f02be1"
] | [
"models/gcn/relaAttention.py"
] | [
"import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n\nclass ScaledDotProductAttention(nn.Module):\n ''' Scaled Dot-Product Attention '''\n\n def __init__(self, temperature, attn_dropout=0.0):\n super().__init__()\n self.temperature = temperature\n self.dropout = nn.Dr... | [
[
"torch.nn.Linear",
"torch.matmul",
"torch.nn.Dropout",
"torch.nn.functional.softmax"
]
] |
useanalias/logistic | [
"9ac196af82bf2d2dbf4e171c7b340c308ed40ad6"
] | [
"logistic/utils.py"
] | [
"import numpy as np\n\n\ndef gradient_descent(cost_func, grad_func, m, alpha=1e-5, beta=1e-7, epsilon=1e-6):\n theta = 2 * (np.random.rand(m) - 0.5) * beta\n cost = cost_func(theta)\n while True:\n delta = alpha * grad_func(theta)\n print(\"WAT\")\n print(cost)\n theta -= delta\... | [
[
"numpy.abs",
"numpy.asarray",
"numpy.random.rand",
"numpy.transpose",
"numpy.exp",
"numpy.array"
]
] |
sudo-michael/gail-airl-ppo.pytorch | [
"5864ea9a0d1f4ab533aadc869cbb1ac0fe6ce927"
] | [
"gail_airl_ppo/network/utils.py"
] | [
"import math\nimport torch\nfrom torch import nn\n\n\ndef build_mlp(\n input_dim,\n output_dim,\n hidden_units=[64, 64],\n hidden_activation=nn.Tanh(),\n output_activation=None,\n):\n layers = []\n units = input_dim\n for next_units in hidden_units:\n layers.append(nn.Linear(units, ne... | [
[
"torch.randn_like",
"torch.nn.Sequential",
"torch.nn.Tanh",
"torch.tanh",
"torch.nn.Linear",
"torch.log"
]
] |
Hyunsooooo/silent_speech1 | [
"03f69576f6c6b984340c1ddef2288e3f7d1102ca"
] | [
"pytorch/integration_test.py"
] | [
"# *****************************************************************************\n# Copyright (c) 2018, NVIDIA CORPORATION. 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 met:\n# * Redi... | [
[
"scipy.io.wavfile.write",
"torch.zeros"
]
] |
daidaiershidi/Paddle | [
"b7bcd0f643b90e87da749251011e364e3681e5d7"
] | [
"python/paddle/fluid/tests/unittests/auto_parallel/test_auto_parallel_while_op.py"
] | [
"# Copyright (c) 2022 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.random.random"
]
] |
nse1994/l5kit | [
"80530d6920eebd636e41e30793bcef1110a39f7b"
] | [
"l5kit/l5kit/tests/evaluation/compute_mse_loss_test.py"
] | [
"from pathlib import Path\n\nimport numpy as np\nimport pytest\n\nfrom l5kit.data import ChunkedDataset\nfrom l5kit.evaluation import compute_mse_error_csv, export_zarr_to_ground_truth_csv\n\n\ndef test_compute_mse_error(tmp_path: Path, zarr_dataset: ChunkedDataset) -> None:\n future_num_frames = 12 # coords di... | [
[
"numpy.all",
"numpy.random.rand",
"numpy.any",
"numpy.asarray"
]
] |
jolynch/python_performance_toolkit | [
"c38abd5b75caf2fde9b6f8d4e0fea1af0411de27"
] | [
"notebooks/queueing_theory/src/latency_aware_simulator.py"
] | [
"import random\nfrom collections import namedtuple\n\nimport numpy as np\nimport simpy\n\nLatencyDatum = namedtuple(\n 'LatencyDatum',\n ('t_queued', 't_processing', 't_total')\n)\n\n\nclass LatencyAwareRequestSimulator(object):\n \"\"\" Simulates a M/G/k process common in request processing (computing)\n\... | [
[
"numpy.random.seed"
]
] |
FrazerClews/audacity | [
"b3539ed2b84e2c678f9e645c55150d6fee0c2ea8"
] | [
"lib-src/lv2/lilv/bindings/python/lv2_apply.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\nimport lilv\nimport sys\nimport wave\nimport numpy\n\nclass WavFile(object):\n \"\"\"Helper class for accessing wav file data. Should work on the most common\n formats (8 bit unsigned, 16 bit signed, 32 bit signed). Audio data is\n converted t... | [
[
"numpy.array",
"numpy.array_split",
"numpy.dstack"
]
] |
NWC-CUAHSI-Summer-Institute/ml_data_processing | [
"ed74a1cdecfb4f3b9015a652c8c807a87ae6c48b"
] | [
"streamflow/reynolds_creek/reynolds_streamflow.py"
] | [
"import numpy as np\nimport pandas as pd\nimport glob\nimport numbers\n\n# Get all the file paths for the data\nreynolds_files = glob.glob('*.dat')\n\n# The hourly data in Martin's paper uses these headers\nhourly_headers = ['date','QObs(mm/h)','QObs count','qualifiers','utcoffset(h)','(iv-camels)/camels','QObs_CAM... | [
[
"pandas.to_datetime",
"pandas.read_csv"
]
] |
huminghe/mmdetection | [
"37a3e5d1891a177f9cd16f3ed53195f2d8c2ef70"
] | [
"mmdet/core/visualization/image.py"
] | [
"import matplotlib.pyplot as plt\nimport mmcv\nimport numpy as np\nimport pycocotools.mask as mask_util\nfrom matplotlib.collections import PatchCollection\nfrom matplotlib.patches import Polygon\n\nfrom ..utils import mask2ndarray\n\nEPS = 1e-2\n\n\ndef color_val_matplotlib(color):\n \"\"\"Convert various input... | [
[
"matplotlib.pyplot.imshow",
"numpy.split",
"numpy.concatenate",
"matplotlib.patches.Polygon",
"numpy.random.randint",
"matplotlib.pyplot.gca",
"numpy.full",
"numpy.frombuffer",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.figure",
... |
tudo-astroparticlephysics/LST_mono_analysis | [
"0054b0e5c314e493c5e859dd8653c14b2e6de5c8"
] | [
"theta2_wobble.py"
] | [
"import click\nimport operator\n\nimport plotting\nimport calculation\n\nfrom multiprocessing import Pool, cpu_count\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd\nfrom fact.io import read_h5py\n\nimport astropy.units as u\nfrom astropy import table\nfrom astropy.io import fits\n\nfrom... | [
[
"matplotlib.backends.backend_pdf.PdfPages",
"pandas.concat",
"numpy.sqrt",
"matplotlib.get_backend",
"numpy.concatenate",
"numpy.full_like",
"numpy.sum",
"matplotlib.pyplot.figure"
]
] |
IshitaTakeshi/SBA | [
"83a9dd14ab6cb33b4da73a15c8b42c783ad36525"
] | [
"sparseba/utils.py"
] | [
"import numpy as np\n\n\ndef all_symmetric(XS):\n # check if top right and bottom left are same\n assert(XS.shape[1:3] == (2, 2))\n return np.allclose(XS[:, 0, 1], XS[:, 1, 0])\n\n\ndef identities2x2(n):\n I = np.zeros((n, 2, 2))\n I[:, [0, 1], [0, 1]] = 1\n return I\n\n\ndef can_run_ba(n_viewpoin... | [
[
"numpy.zeros",
"numpy.allclose"
]
] |
ZhangJUJU/TransferLearning | [
"1e5ed495595ffa6d727eb182f2349dbf2aac169c"
] | [
"DTN/train.py"
] | [
"import tensorflow as tf\r\nimport numpy as np\r\nfrom sklearn.manifold import TSNE\r\n\r\nfrom load_dataset import *\r\nBATCH_SIZE=4000\r\nlearningrate=0.00001\r\nlamda=10\r\nmiu=10\r\nMAX_STEP=500\r\nY = tf.placeholder('float', shape=[None, 10])\r\nX = tf.placeholder('float', shape=[None, 256])\r\nsource_image,so... | [
[
"tensorflow.concat",
"tensorflow.nn.max_pool",
"tensorflow.cast",
"tensorflow.nn.conv2d",
"numpy.square",
"tensorflow.Variable",
"numpy.arange",
"tensorflow.Session",
"numpy.float32",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.truncated_normal",
"tens... |
DenisVVV/test | [
"f56699ebdd6f1d141427ce766498506c923247a2"
] | [
"tests/c_api_test/test.py"
] | [
"import sys\nimport os\nimport ctypes\nimport collections\n\nimport numpy as np\nfrom scipy import sparse\n\ndef LoadDll():\n if os.name == 'nt':\n lib_path = '../../windows/x64/DLL/lib_lightgbm.dll'\n else:\n lib_path = '../../lib_lightgbm.so'\n lib = ctypes.cdll.LoadLibrary(lib_path)\n r... | [
[
"scipy.sparse.csc_matrix",
"numpy.array",
"numpy.zeros",
"scipy.sparse.csr_matrix"
]
] |
dataiku-research/mealy | [
"039978fbb4bbda4e89e55ae05a75bdb3560191e2"
] | [
"mealy/error_analyzer.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\nimport collections\nfrom sklearn import tree\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.base import is_regressor\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.base import BaseEstimator\nfrom skle... | [
[
"numpy.abs",
"numpy.random.seed",
"numpy.linspace",
"numpy.unique",
"numpy.in1d",
"sklearn.exceptions.NotFittedError",
"numpy.full_like",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.metrics.make_scorer",
"numpy.count_nonzero",
"sklearn.base.is_regressor",
"numpy... |
ErikHambardzumyan/dowhy | [
"685f64723e2a37334164dbb8da7d55f4e45975de"
] | [
"dowhy/causal_estimators/propensity_score_estimator.py"
] | [
"import numpy as np\r\nimport pandas as pd\r\n\r\nfrom dowhy.causal_estimator import CausalEstimator\r\n\r\nclass PropensityScoreEstimator(CausalEstimator):\r\n\r\n def __init__(self, *args, **kwargs):\r\n super().__init__(*args, **kwargs)\r\n\r\n # We need to initialize the model when we create an... | [
[
"pandas.api.types.is_bool_dtype",
"pandas.get_dummies"
]
] |
hussainsan/enas | [
"4bcfd73b524627ea96574e5fed33da74bc7855d5"
] | [
"src/ptb/ptb_enas_child.py"
] | [
"from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nimport numpy as np\nimport tensorflow as tf\n\nfrom src.common_ops import lstm\n\nfrom src.utils import count_model_params\nfrom src.utils import get_train_ops\n\nfrom src.ptb.... | [
[
"tensorflow.get_variable",
"numpy.minimum",
"tensorflow.concat",
"tensorflow.control_dependencies",
"tensorflow.reduce_sum",
"tensorflow.stack",
"tensorflow.equal",
"tensorflow.tanh",
"numpy.exp",
"tensorflow.add_n",
"tensorflow.boolean_mask",
"tensorflow.while_loop... |
wangz49777/Play-Sudoku-automatically | [
"eda522e7ba390a3964874f4e0553048c8acf1fc3"
] | [
"auto_solve_sudoku.py"
] | [
"import cv2\nimport numpy as np\nimport pyautogui\nimport sudoku99\n\nleft = 731\ntop = 120\nwidth = 82\n\n\ndef read_img(image):\n sudoku = np.zeros([9, 9], dtype=np.int)\n img_gray = np.array(image.convert('L'))\n for i in range(1, 10):\n template = cv2.imread('img/{}.png'.format(i), 0)\n h... | [
[
"numpy.asarray",
"numpy.zeros",
"numpy.where"
]
] |
bhavsarpratik/jina-hub | [
"5d9a804f768e6e8042bbdc0a15fa9d3b8b68ddda"
] | [
"encoders/nlp/FlairTextEncoder/tests/test_flairtextencoder.py"
] | [
"import os\nimport numpy as np\nimport shutil\nimport mock\nimport pytest\n\nfrom .. import FlairTextEncoder\nfrom jina.executors import BaseExecutor\nfrom jina.executors.metas import get_default_metas\n\ntarget_output_dim = 100\n\n\ndef get_metas():\n metas = get_default_metas()\n if 'JINA_TEST_GPU' in os.en... | [
[
"numpy.array",
"numpy.random.random"
]
] |
ibutsky/cv | [
"4f39bb62871ba9de70284764d38a14b26460335a"
] | [
"get_pubs.py"
] | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import division, print_function\n\nimport json\nfrom operator import itemgetter\nimport re\nimport ads\nfrom utf8totex import utf8totex\nfrom titlecase import titlecase\nfrom tqdm import tqdm\nimport numpy as np\nimport time\n\n__all__ = [\"get_pape... | [
[
"numpy.savetxt"
]
] |
andrescevp/pyEX | [
"4c8daa411b01133a292d341a78f6e1b80cc2be99"
] | [
"pyEX/studies/technicals/pattern.py"
] | [
"# -*- coding: utf-8 -*-\nimport talib as t\nimport pandas as pd\n\n\ndef cdl2crows(\n client,\n symbol,\n timeframe=\"6m\",\n opencol=\"open\",\n highcol=\"high\",\n lowcol=\"low\",\n closecol=\"close\",\n):\n \"\"\"This will return a dataframe of Two crows for the given symbol across\n ... | [
[
"pandas.DataFrame"
]
] |
roysaurabh1308/Cryptographic-Algorithms | [
"a8a92548b8d15fe317e0658f14385b6a4e29c5ce"
] | [
"Playfair_cipher.py"
] | [
"import numpy as np\r\nimport random\r\n#X=np.array([chr(x) for x in range(65,91) and x!=73])\r\nKey=np.array([['L','G','D','B','A'],['Q','M','H','E','C'],['U','R','N','I','F'],['X','V','S','O','K'],['Z','Y','W','T','P']])\r\nmsg=input(\"Enter message: \")\r\nMsg=[x for x in msg]\r\nT=[];i=-1\r\nfor x in range(len(... | [
[
"numpy.array",
"numpy.where"
]
] |
anthonyhsyu/tune-sklearn | [
"9216d31c25a09c61b650a85560b9045cbbac94ce"
] | [
"examples/sgd.py"
] | [
"\"\"\"\nAn example training an SGDClassifier, performing grid search\nusing TuneGridSearchCV.\n\nThis example uses early stopping to further improve runtimes\nby eliminating worse hyperparameter choices early based off\nof its average test score from cross validation.\n\"\"\"\n\nfrom tune_sklearn import TuneGridSe... | [
[
"numpy.array",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_digits",
"sklearn.linear_model.SGDClassifier"
]
] |
kids-first/kf-lib-data-ingest | [
"92889efef082c64744a00a9c110d778da7383959"
] | [
"kf_lib_data_ingest/validation/reporting/table.py"
] | [
"\"\"\"\nTable based validation report builder. Produces the following tabular files:\n\ntable_reports/\n - validation_results.tsv\n - files_validated.tsv\n - type_counts.tsv\n\nUnpack the validation results JSON into a tabular form where the content is\na little bit less nested and verbose\n\nExtends kf_lib_dat... | [
[
"pandas.DataFrame"
]
] |
mewim/d3l | [
"ce3874b98965be828059c7d9eee7c1ee810a84b2"
] | [
"d3l/indexing/feature_extraction/values/fasttext_embedding_transformer.py"
] | [
"import os\nimport shutil\nfrom typing import Iterable, Optional, Set\nfrom urllib.request import urlopen\n\nimport numpy as np\nimport gzip\nfrom fasttext import load_model\nfrom sklearn.feature_extraction.text import TfidfVectorizer\n\nfrom d3l.utils.constants import FASTTEXTURL, STOPWORDS\nfrom d3l.utils.functio... | [
[
"numpy.array",
"numpy.argmin",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.empty"
]
] |
dankovacek/flood_frequency | [
"3bdbac49f5eb033f891058b17c755c83fade043a"
] | [
"main.py"
] | [
"import os\nimport math\n\nimport numpy as np\nimport pandas as pd\nimport time\n\nimport scipy.special\nimport scipy.stats as st\n\nfrom multiprocessing import Pool\n\nfrom bokeh.layouts import row, column\nfrom bokeh.models import CustomJS, Slider, Band, Spinner\nfrom bokeh.plotting import figure, curdoc, ColumnD... | [
[
"scipy.stats.norm.ppf",
"scipy.stats.pearson3.cdf",
"numpy.linspace",
"numpy.power",
"numpy.subtract",
"pandas.DataFrame",
"numpy.log10",
"numpy.mean",
"numpy.var",
"numpy.add",
"scipy.stats.skew"
]
] |
zj1008/GALD-DGCNet | [
"be7ebfe2b3d28ea28a2b4714852999d4af2a785e"
] | [
"libs/core/loss.py"
] | [
"# CE-loss\nimport torch.nn as nn\nimport torch\nimport torch.nn.functional as F\n\n\nclass OhemCrossEntropy2dTensor(nn.Module):\n def __init__(self, ignore_label, reduction='elementwise_mean', thresh=0.6, min_kept=256,\n down_ratio=1, use_weight=False):\n super(OhemCrossEntropy2dTensor, s... | [
[
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.upsample",
"torch.nn.functional.softmax",
"torch.FloatTensor"
]
] |
pchtsp/metaheuristics | [
"61f17002265d6fa50e094cc36ef49749538dbe14"
] | [
"notebooks/01-voronoi_mouse.py"
] | [
"# Squelette d'un fichier .py indépendant\n\nimport numpy as np\nfrom vispy import app\n\nfrom stochastic.voronoi import Voronoi\n\nclass Discover(Voronoi):\n\n def __init__(self, nb_points, nb_colors):\n Voronoi.__init__(self, nb_points=nb_points, nb_colors=nb_colors)\n self.current = 0\n\n def... | [
[
"numpy.array"
]
] |
paskino/ML-exercises | [
"6f6586595583c9d85be72944ce8a1a97fdcd0d91"
] | [
"faces/nn.py"
] | [
"import numpy\nfrom functools import reduce\nimport matplotlib.pyplot as plt\nimport pickle\nimport tensorflow as tf\nimport sys\n\n__version__ = '0.1.0'\n\n# PCA matrix\nu = numpy.load(\"lfwfp1140eigim.npy\")\n\n# coordinates\nv = numpy.load(\"lfwfp1140coord.npy\")\n\n# neig total number of eigenvectors, ni total ... | [
[
"numpy.dot",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.legend",
"numpy.hstack",
"numpy.reshape",
"numpy.asarray",
"tensorflow.keras.layers.Dense",
"numpy.ones",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.subplot",
"numpy.load",
"matplotlib.pyplot.show",
"... |
opensystra/systra | [
"442a884ba17dc0a04d0421d0072f7239ef28ab0d"
] | [
"syspy/spatial/geometries.py"
] | [
"\"\"\"\nThis module provides tools for geometry processing.\n\"\"\"\n\n__author__ = 'qchasserieau'\n\nfrom tqdm import tqdm\nimport shapely\nimport json\nfrom math import pi\nimport numpy as np\nimport pandas as pd\n\ndef reversed_polyline(polyline):\n coords = list(polyline.coords)\n return shapely.geometry... | [
[
"pandas.concat",
"numpy.arctan",
"pandas.Series",
"pandas.DataFrame"
]
] |
prowe12/game-solver | [
"0c197c077a82c79c97c9cf1ed5bcda0dc38eed61"
] | [
"sudoku/create_image.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Jan 24 09:39:43 2022\n\n@author: prowe\n\"\"\"\n\n\nimport imageio\nimport os\nimport numpy as np\n\nfignames = []\nfnames = os.listdir()\nfor fname in fnames:\n if fname[:3] == 'fig' and fname[-4:] == '.png':\n fignames.append(fname... | [
[
"numpy.sort"
]
] |
TooSchoolForCool/CS275-Parkour-Go | [
"a302357c0f2373bb4e03318d4cf37765b77ec8f3"
] | [
"a3c/src/trainer.py"
] | [
"import logging\nimport time\n\nimport gym\nimport torch\nimport numpy as np\nfrom setproctitle import setproctitle as ptitle\nfrom torch.autograd import Variable\n\nimport environment\nfrom utils import setup_logger, ensure_shared_grads\nfrom network import MLP\nfrom agent import Agent\n\nRANDOM_SEED = 1\n\ndef te... | [
[
"torch.autograd.Variable",
"torch.from_numpy",
"torch.zeros"
]
] |
wzt1001/indoor_space_cnn_classifier | [
"2d0f2bff63a8d20e8e1d5a03ce8b81bcc2b0c13e"
] | [
"scripts/frame_extraction.py"
] | [
"import cv2\r\nimport os\r\nfrom os import listdir\r\nfrom os.path import isfile, join\r\nfrom sys import stdout\r\nimport psycopg2\r\nimport pickle\r\nimport numpy as np\r\nimport math\r\nfrom PIL import Image\r\nfrom math import floor\r\nimport hashlib\r\nimport random\r\nfrom multiprocessing.dummy import Pool as... | [
[
"numpy.concatenate",
"sklearn.utils.shuffle",
"numpy.array",
"numpy.ones"
]
] |
PreetamSrikar/brain_dynamics | [
"f3d2133ca382664a8d46f9002e809d6ee9405140"
] | [
"modeling_FC_states.py"
] | [
"\"\"\"\nK-means clustering of the reduced components vectors with silhouette analysis on \nthe best number or clusters.\n\nHidden Markov Model on reduced dim data with log likelihood score to choose the \nbest number of components.\n\nDBSCAN clustering model on reduced dim data.\n\nAutoencoder implemented in Keras... | [
[
"numpy.dot",
"numpy.expand_dims",
"sklearn.cross_validation.train_test_split",
"sklearn.cluster.KMeans",
"sklearn.metrics.silhouette_score",
"sklearn.metrics.silhouette_samples",
"sklearn.cluster.DBSCAN",
"numpy.all",
"numpy.nanmean",
"sklearn.cluster.AgglomerativeClusterin... |
LucasYoung/pocketjudge | [
"bf11336160ded127edabcd57cc6f840f006c4722"
] | [
"pjdata.py"
] | [
"import matplotlib.pyplot as plt\nimport numpy as np\nimport torchvision\nimport torchvision.transforms as transforms\nfrom torch.utils.data import DataLoader\nimport torch\n\nfrom utils import calc_dataset_stats\nimport pjdataset\n\nclass StandardizeSizeTransform():\n def __init__(self):\n pass\n\n de... | [
[
"torch.cat",
"torch.zeros"
]
] |
kampta/PatchGame | [
"12411e3202643217dd47a3590c413e95e960f1fc"
] | [
"eval_patchrank.py"
] | [
"import os\nimport argparse\nimport random\nimport timm\nfrom timm.models.vision_transformer import VisionTransformer\nfrom timm.models.vision_transformer import default_cfgs as timm_vit_cfgs\nimport torch\nfrom torch import nn\nimport torch.backends.cudnn as cudnn\nfrom torchvision import datasets\nfrom torchvisio... | [
[
"torch.nn.CrossEntropyLoss",
"torch.utils.data.DistributedSampler",
"torch.cat",
"torch.utils.data.DataLoader",
"torch.nn.SyncBatchNorm.convert_sync_batchnorm",
"torch.no_grad",
"torch.jit.is_scripting",
"torch.nn.functional.interpolate",
"torch.nn.parallel.DistributedDataParal... |
iionez/hai-project | [
"db81b3d03acf5cfe9bd5827149158c8a0dd58a9a"
] | [
"notebooks/mlworkflows/plot.py"
] | [
"import altair as alt\nimport pandas as pd\nimport numpy as np\n\n\n\nMAX_POINTS = 2500\n\ndef activate():\n pass\n \ndef plot_points(df, **kwargs):\n activate()\n plot_df = df.sample(min(len(df), MAX_POINTS))\n return alt.Chart(plot_df).encode(**kwargs).mark_point().interactive()\n\n\ndef plot_pca(d... | [
[
"sklearn.utils.multiclass.unique_labels",
"sklearn.metrics.confusion_matrix",
"pandas.DataFrame"
]
] |
mail-ecnu/multiagent-particle-envs | [
"a3ccb43851dc6b04bab5a6e3f7443a35a4dd445f"
] | [
"multiagent/environment.py"
] | [
"import gym\nfrom gym import spaces\nfrom gym.envs.registration import EnvSpec\nimport numpy as np\n\n# environment for all agents in the multiagent world\n# currently code assumes that no agents will be created/destroyed at runtime!\nclass MultiAgentEnv(gym.Env):\n metadata = {\n 'render.modes' : ['human... | [
[
"numpy.random.seed",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.all",
"numpy.argmax",
"numpy.array",
"numpy.zeros",
"numpy.sum"
]
] |
georgejeno8/modular-layers | [
"6043cca7179955334e638abb6089314affd14efb"
] | [
"mnistalt.py"
] | [
"from __future__ import division, print_function, absolute_import\nimport os\nimport struct\nfrom array import array\nimport numpy as np\n\n\ndef load_mnist(section=\"training\", offset=0, count=None, ret='xy',\n x_dtype=np.float64, y_dtype=np.int64, path=None):\n \"\"\"\n Loads MNIST files into... | [
[
"numpy.asarray"
]
] |
ShirleyPmy/lgb_football | [
"305e57d6a865ac5d81d0c8d1b84abdd3052e2de3"
] | [
"code/feature.py"
] | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Mar 6 14:36:36 2022\n\n@author: pmy\n\"\"\"\nimport pandas as pd\nimport numpy as np\nimport time\nimport utils\nimport sys\n\npd.set_option('mode.chained_assignment', None)\n\ndef steps_left_bin(data):\n df_model = data.df_model.copy()\n ... | [
[
"numpy.ceil",
"pandas.set_option",
"numpy.array",
"numpy.mean"
]
] |
anirudhbhashyam/911-Calls-Seattle-Predictions | [
"8c975ab6c6a85d514ad74388778e1b635ed3e63d"
] | [
"src/train_nn.py"
] | [
"import os\nfrom typing import Union\n\nimport tensorflow as tf\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.model_selection import train_test_split, KFold\n\nimport utility as ut\nfrom variables import *\n\n\n# Read the data.\ntrain_data = pd.read_csv(os.path.join(DATA_... | [
[
"tensorflow.keras.layers.Dropout",
"matplotlib.pyplot.title",
"tensorflow.keras.layers.Dense",
"sklearn.model_selection.train_test_split",
"pandas.DataFrame",
"numpy.ones",
"tensorflow.keras.layers.GaussianNoise",
"tensorflow.keras.layers.LSTM",
"matplotlib.pyplot.xlabel",
... |
kmrozewski-kainos/DeepNeuralNetworkWithNumpy | [
"6394e70bedac5f5e09f33632639ce1d85ba91a32"
] | [
"deep_neural_network/predict.py"
] | [
"# -*- coding: utf-8 -*-\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom deep_neural_network.forward_propagation import Forward_Propagation\n\nclass Predict(object):\n\n def __init__(self):\n self.forward_propagation = Forward_Propagation()\n\n def predict(self, X, y, parameters):\n \... | [
[
"matplotlib.pyplot.subplot",
"numpy.where",
"matplotlib.pyplot.axis",
"numpy.zeros",
"numpy.sum"
]
] |
Bruce198899/YOLOX_Runway | [
"aa3bd25112cfe131556e9e9354288f6b50f3892c"
] | [
"yolox/data/datasets/voc.py"
] | [
"#!/usr/bin/env python3\n# -*- coding:utf-8 -*-\n# Code are based on\n# https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py\n# Copyright (c) Francisco Massa.\n# Copyright (c) Ellis Brown, Max deGroot.\n# Copyright (c) Megvii, Inc. and its affiliates.\n\nimport os\nimport os.path\nimport pi... | [
[
"numpy.round",
"numpy.vstack",
"numpy.mean",
"numpy.empty"
]
] |
mysterefrank/covid-test | [
"8651d9515376ca88e25b309c710c256bb22804d9"
] | [
"scripts/score.py"
] | [
"import configs\nimport covid.util as util\nimport covid.states as states\nimport covid.models.SEIRD_variable_detection\nimport covid.jhu as jhu\nimport numpy as np\nimport pandas as pd\nimport argparse\n\nfrom pathlib import Path\n\nroot='results1'\n\nconfig_names=['counties']\nforecast_dates=[\"2020-05-17\", \"20... | [
[
"pandas.DataFrame"
]
] |
cxq1/paddle_VinVL | [
"f9136871c43b033cd209ddc7579fa986208e37db"
] | [
"tests/test_box_coder.py"
] | [
"# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n\nimport unittest\n\nimport numpy as np\nimport paddle\nfrom maskrcnn_benchmark.modeling.box_coder import BoxCoder\n\n\nclass TestBoxCoder(unittest.TestCase):\n def test_box_decoder(self):\n \"\"\" Match unit test UtilsBoxesTest.Tes... | [
[
"numpy.array"
]
] |
alempedroso/mxnet-lambda | [
"22a683c63b7d0153cc2249a94d76b3c8969b1972"
] | [
"src/mxnet/ndarray/ndarray.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.ascontiguousarray",
"numpy.dtype",
"numpy.array",
"numpy.empty"
]
] |
Gustavo6046/polydung | [
"e8626c67b0f59e00a2400b5a5c644e3f6b925e00"
] | [
"pdserver/objects.py"
] | [
"import base64\nimport random\nimport string\nimport netbyte\nimport numpy as np\n\ntry:\n import simplejson as json\n \nexcept ImportError:\n import json\n \n\nkinds = {}\n\nclass PDObject(object):\n def __init__(self, game, kind, id, pos, properties):\n self.game = game\n self.kind = ... | [
[
"numpy.array"
]
] |
taesupkim/bmaml | [
"10ef3e5dc288d0d8e18e46bcad99da1e7c114605"
] | [
"utils.py"
] | [
"import os \nimport time \nimport socket\nimport random\nimport tensorflow as tf\n\nfrom tensorflow.contrib.layers.python import layers as tf_layers\nfrom tensorflow.python.platform import flags\n\n# NOTE: this script is based on https://github.com/cbfinn/maml/blob/master/utils.py\n\nFLAGS = flags.FLAGS\n\n## Image... | [
[
"tensorflow.clip_by_value"
]
] |
ssktotoro/catalyst | [
"2ff687e802250772f8614583af933d6613f87788"
] | [
"catalyst/tests/test_mnist_multioptimizer.py"
] | [
"# flake8: noqa\n\nimport os\nfrom tempfile import TemporaryDirectory\n\nfrom pytest import mark\nfrom torch import nn, optim\nfrom torch.nn import functional as F\nfrom torch.utils.data import DataLoader\n\nfrom catalyst import dl, metrics, utils\nfrom catalyst.contrib.datasets import MNIST\nfrom catalyst.data.tra... | [
[
"torch.nn.Linear",
"torch.nn.CrossEntropyLoss",
"torch.nn.Flatten"
]
] |
killdary/genetic_algorithm_route_calculation | [
"f7d9c114d8780bad6124ee61214b7dce0557d312"
] | [
"solution/Make_map.py"
] | [
"from GA_TOPMD import GaTopMd\nfrom PSO_TOP import PSO\nimport gc\nfrom datetime import datetime\nimport os\nimport re\nimport numpy as np\n\npaths = [\n\n 'GATOPMD/mapas/artigo/mapa_4r_40_1d.txt',\n\n]\n\nprizes = [\n 'GATOPMD/mapas/artigo/premio_4r_40_1d.txt',\n]\n\nsize_population = [.1,\n ... | [
[
"numpy.fromstring"
]
] |
colemakdvorak/probability | [
"8164538be2cd1c06b5593b100df1dc605b6d5733"
] | [
"tensorflow_probability/python/distributions/distribution_properties_test.py"
] | [
"# Copyright 2018 The TensorFlow Probability 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 a... | [
[
"tensorflow.compat.v2.math.tanh",
"tensorflow.compat.v2.math.reduce_max",
"tensorflow.compat.v2.executing_eagerly",
"tensorflow.compat.v2.TensorShape",
"numpy.where",
"tensorflow.compat.v2.linspace",
"tensorflow.compat.v2.is_tensor",
"numpy.float32",
"tensorflow.compat.v2.abs",... |
jthacker/jtmri | [
"10af3dd932bf73a91e6662eaff8f844fdf07c067"
] | [
"jtmri/learn/features.py"
] | [
"import numpy as np\nimport pylab as pl\nimport itertools\nimport jtmri.utils\n\n\ndef generate_spatial_context_features(n, min_distance=0, max_distance=100, min_region_len=0, max_region_len=100):\n \"\"\"Create n features based on Criminsi2009 long range spatial features\n A feature consists of the mean valu... | [
[
"matplotlib.patches.Arrow",
"matplotlib.patches.Rectangle",
"numpy.cos",
"numpy.sin",
"numpy.random.uniform"
]
] |
huster-wgm/mmsegmentation | [
"b46bbfdeed127b1cab325f707c090014f9333c11"
] | [
"tools/onnx2tensorrt.py"
] | [
"# Copyright (c) OpenMMLab. All rights reserved.\nimport argparse\nimport os\nimport os.path as osp\nfrom typing import Iterable, Optional, Union\n\nimport matplotlib.pyplot as plt\nimport mmcv\nimport numpy as np\nimport onnxruntime as ort\nimport torch\nfrom mmcv.ops import get_onnxruntime_op_path\nfrom mmcv.tens... | [
[
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"torch.cat",
"torch.no_grad",
"numpy.testing.assert_allclose",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure"
]
] |
jens321/allennlp-models | [
"cee3a7507cf8d15cd8520808bd9c6381369e868e"
] | [
"tests/rc/qanet/stacked_self_attention_test.py"
] | [
"import torch\nfrom torch.nn.parallel.data_parallel import DataParallel\n\nimport pytest\n\nfrom allennlp.common.testing import AllenNlpTestCase\n\nfrom allennlp_models.rc.qanet.stacked_self_attention import StackedSelfAttentionEncoder\n\n\nclass TestStackedSelfAttention(AllenNlpTestCase):\n def test_get_dimensi... | [
[
"torch.randn",
"torch.cuda.device_count",
"torch.nn.parallel.data_parallel.DataParallel"
]
] |
zshyang/FieldConvolution | [
"ca88df568a6f2143dcb85d22c005fce4562a7523"
] | [
"SDFConv/data_code/generate_size_meta.py"
] | [
"import os\nimport shutil\nimport trimesh\nimport json\nimport numpy as np\n\nfrom glob import glob\nfrom tqdm import tqdm\n\n\nleft_mesh_name = \"LHippo_60k.obj\"\nright_mesh_name = \"RHippo_60k.obj\"\n\n\ndef move_meta():\n meta_folder_path = os.path.join(\"..\", \"..\", \"PointNetBaseline\", \"data\", \"meta\... | [
[
"numpy.concatenate",
"numpy.array",
"numpy.mean",
"numpy.sum"
]
] |
goldentom42/py_ml_utils | [
"95a2788dd78b38d13f2c7c0e311319aac48f028a"
] | [
"py_ml_utils/test/test_featureSelector.py"
] | [
"from unittest import TestCase\nfrom py_ml_utils.feature_transformer import *\nfrom py_ml_utils.feature_selector import *\nfrom sklearn.model_selection import StratifiedKFold\nfrom sklearn import datasets\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.metrics import log_loss, accuracy_score\nfro... | [
[
"sklearn.datasets.load_iris",
"sklearn.model_selection.StratifiedKFold",
"sklearn.ensemble.RandomForestClassifier"
]
] |
nvnovitskiy/python_sstu_course | [
"5de1830eb4430349df8ab1c65a9f16f82a9b91a6"
] | [
"chapter4/task12.py"
] | [
"import numpy as np\n\n\"\"\"\nЗаполнить последовательными натуральными числами прямоугольную матрицу \nиз n строк и m столбцов. Получить и вывести на экран транспонированную \nматрицу. Пример: A = [[1,2,3],[4,5,6]], тогда A^T= [[1, 4], [2, 5], [3, 6]].\n\"\"\"\n\nlines, columns = map(int, input(\"Введите количеств... | [
[
"numpy.random.randint"
]
] |
chenxinfeng4/mmdetection | [
"c72bc707e661d61cf09aca0a53ad21812ef874d0"
] | [
"mmdet/datasets/custom.py"
] | [
"# Copyright (c) OpenMMLab. All rights reserved.\nimport os.path as osp\nimport warnings\nfrom collections import OrderedDict\n\nimport mmcv\nimport numpy as np\nfrom mmcv.utils import print_log\nfrom terminaltables import AsciiTable\nfrom torch.utils.data import Dataset\n\nfrom mmdet.core import eval_map, eval_rec... | [
[
"numpy.where",
"numpy.unique",
"numpy.random.choice"
]
] |
RamiSketcher/pddm | [
"54ef66e50c2b7ccbefb31c4dfe45c6e94718f71d"
] | [
"pddm/spinup/pddm_envs/mujoco_env.py"
] | [
"# Copyright 2019 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.asarray",
"numpy.concatenate",
"numpy.round",
"numpy.std",
"numpy.mean",
"numpy.zeros",
"numpy.sum"
]
] |
pauldmccarthy/pandas | [
"b835ca2fc2f772c27c914ae532cd32f8db69724a"
] | [
"pandas/tests/frame/constructors/test_from_records.py"
] | [
"from datetime import datetime\nfrom decimal import Decimal\n\nimport numpy as np\nimport pytest\nimport pytz\n\nfrom pandas.compat import is_platform_little_endian\n\nfrom pandas import (\n CategoricalIndex,\n DataFrame,\n Index,\n Int64Index,\n Interval,\n RangeIndex,\n Series,\n)\nimport pan... | [
[
"pandas.Series",
"pandas.RangeIndex",
"pandas.DataFrame",
"numpy.dtype",
"numpy.random.randn",
"numpy.core.records.fromarrays",
"pandas.DataFrame.from_records",
"pandas._testing.assert_frame_equal",
"numpy.random.randint",
"numpy.arange",
"pandas.Index",
"pandas.Int... |
thanhkaist/datasets | [
"02da35c558ec8ea704e744a2008c5cecb2e7a0a1"
] | [
"tensorflow_datasets/image/coco.py"
] | [
"# coding=utf-8\n# Copyright 2019 The TensorFlow Datasets Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless ... | [
[
"tensorflow.io.gfile.GFile"
]
] |
jamiechang917/eddy | [
"157bd035e6e60b9f642a6afcb463671b0c7ee906"
] | [
"eddy/helper_functions.py"
] | [
"from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable\nfrom scipy.optimize import curve_fit\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n\n# -- MCMC / OPTIMIZATION FUNCTIONS -- #\n\ndef random_p0(p0, scatter, nwalkers):\n \"\"\"Introduce scatter to starting positions.\"\"\"\n p0 = n... | [
[
"numpy.diag",
"numpy.sqrt",
"numpy.squeeze",
"numpy.max",
"numpy.exp",
"scipy.optimize.curve_fit",
"numpy.where",
"numpy.trapz",
"numpy.sin",
"numpy.zeros",
"numpy.log",
"numpy.power",
"numpy.isnan",
"numpy.append",
"numpy.isfinite",
"matplotlib.pypl... |
yanlai00/cog | [
"01dbfcbe336072b6f4cb2b9952606bd45c65af7f"
] | [
"rlkit/torch/networks.py"
] | [
"\"\"\"\nGeneral networks for pytorch.\n\nAlgorithm-specific networks should go else-where.\n\"\"\"\nimport torch\nfrom torch import nn as nn\nfrom torch.nn import functional as F\n\nfrom rlkit.policies.base import Policy\nfrom rlkit.torch import pytorch_util as ptu\nfrom rlkit.torch.core import eval_np\nfrom rlkit... | [
[
"torch.nn.Linear",
"torch.nn.utils.spectral_norm",
"torch.cat"
]
] |
IvanProdaiko94/UCU-deep-learning-homework | [
"e2a1ce91653696badebb69f17326c3218227be3c"
] | [
"layers/pooling.py"
] | [
"from __future__ import print_function\nimport torch\nfrom .utilities import im2col\n\n\ndef pool2d_vector(a, device, window_size=2):\n N_batch, C_in, img_size, _ = a.shape\n z_col = im2col(a, window_size, device, stride=2)\n out_size = img_size // window_size\n max_val = z_col.max(dim=0)[0]\n return... | [
[
"torch.empty"
]
] |
leokale/yolo_v1 | [
"ddafb5b06e0dc80b61d9271e4c1d4f48a9f050fc"
] | [
"yolo_data.py"
] | [
"# -*- coding:utf-8 -*-\n__author__ = 'Leo.Z'\n\n'''\nimage_name.jpg x y x2 y2 c x y x2 y2 c xy为左上角坐标,x2y2为右下角坐标\n'''\nimport os\nimport os.path\n\nimport random\nimport numpy as np\n\nimport torch\nimport torch.utils.data as data\nimport torchvision.transforms as transforms\n\nimport cv2\n\n\nclass yoloDataset(d... | [
[
"torch.LongTensor",
"torch.Tensor",
"torch.zeros",
"numpy.clip",
"numpy.fliplr",
"torch.FloatTensor",
"numpy.array",
"numpy.zeros"
]
] |
Armannas/SVDD | [
"66a8d3c753aca0759ee6c9e0434d2f54dbc51333"
] | [
"SVDD.py"
] | [
"\n# Author: Arman Naseri Jahfari (a.naserijahfari@tudelft.nl)\n# Original paper: Tax, D. M. J., & Duin, R. P. W. (2004).\n# # Support Vector Data Description. Machine Learning, 54(1), 45–66. https://doi.org/10.1023/B:MACH.0000008084.60811.49\nimport numpy as np\nfrom scipy.spatial.distance import cdist\nfrom scipy... | [
[
"numpy.diag",
"matplotlib.pyplot.legend",
"numpy.mean",
"numpy.where",
"numpy.double",
"numpy.hstack",
"numpy.arange",
"numpy.eye",
"numpy.greater_equal",
"numpy.outer",
"numpy.zeros",
"matplotlib.pyplot.title",
"scipy.spatial.distance.cdist",
"matplotlib.py... |
Joukahainen/chartpy | [
"410f9e4553cb07be7d11823cad404f10da079ada"
] | [
"chartpy/chart.py"
] | [
"__author__ = 'saeedamen' # Saeed Amen\n\n#\n# Copyright 2016 Cuemacro\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the\n# License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required... | [
[
"pandas.DataFrame"
]
] |
pmdaly/supereeg | [
"750f55db3cbfc2f3430e879fecc7a1f5407282a6"
] | [
"tests/test_load.py"
] | [
"from builtins import str\nfrom builtins import range\nimport supereeg as se\nimport numpy as np\nimport os\nimport nibabel as nib\nimport pytest\n\nbo = se.load('example_data')\nbo_s = bo.get_slice(sample_inds=[0,1,2])\n\nlocs = np.array([[-61., -77., -3.],\n [-41., -77., -23.],\n ... | [
[
"numpy.array"
]
] |
granttremblay/SloanSpec | [
"5f8879429f7735cd22c61b1c1930b3d3451a5c09"
] | [
"sloanspec/sloanspec.py"
] | [
"\"\"\"Handle an SDSS Spectrum in an object-oriented manner.\"\"\"\n\nimport os\nfrom astropy.io import fits\n\n\nclass SloanSpec(object):\n \"\"\"\n A single SDSS Spectrum, read from a spec-PLATE-MJD-FIBER.fits file.\n\n See the datamodel for details about the file:\n http://data.sdss3.org/datamode... | [
[
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.subplot",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.figure"
]
] |
tufts-ml/false-alarm-control | [
"e9dd263d7a98dde53b6b43c1b379fe6075a3f857"
] | [
"AdversarialPredictionUtils.py"
] | [
"import sys\nimport os\nimport numpy as np\nimport pandas as pd\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\nfrom torch.utils.data import Dataset, DataLoader, random_split\n\nfrom sklearn.preprocessing import StandardScaler\n\nfrom ap_perf import PerformanceMet... | [
[
"numpy.diag",
"numpy.hstack",
"numpy.random.seed",
"numpy.asarray",
"torch.manual_seed",
"torch.utils.data.DataLoader",
"numpy.ones",
"torch.tensor",
"torch.nn.Linear",
"numpy.std",
"torch.nn.BCEWithLogitsLoss",
"numpy.mean",
"torch.cuda.is_available",
"torc... |
hwong557/tutorials | [
"5eaaf35080dee4545f4b3c6762d82b5487a34e22"
] | [
"beginner_source/nn_tutorial.py"
] | [
"# -*- coding: utf-8 -*-\n\"\"\"\nWhat is `torch.nn` *really*?\n============================\nby Jeremy Howard, `fast.ai <https://www.fast.ai>`_. Thanks to Rachel Thomas and Francisco Ingham.\n\"\"\"\n###############################################################################\n# We recommend running this tutori... | [
[
"numpy.multiply",
"torch.zeros",
"torch.randn",
"torch.utils.data.TensorDataset",
"torch.nn.Conv2d",
"torch.utils.data.DataLoader",
"torch.nn.functional.avg_pool2d",
"torch.nn.Linear",
"torch.nn.AvgPool2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.no_grad",
"torch.cuda.... |
alihakimtaskiran/Rainbow-Utils | [
"e97403b203f94e7f507cd2141afcf91bca9b640f"
] | [
"rainbow.py"
] | [
"import numpy as np\n\nclass Ambient(object):\n def __init__(self, e_r=1, mu_r=1, name=''):\n if not isinstance(e_r, (int, float, complex)):\n raise TypeError('e_r(relative permittivity) of the ambient must be a int, flat or complex')\n\n if not isinstance(mu_r, (int, float, complex)):\n... | [
[
"numpy.dot",
"numpy.conj",
"numpy.sqrt",
"numpy.sin",
"numpy.exp",
"numpy.array"
]
] |
Jey1394/ARC | [
"877ac3219fe802a7421d3a669c9f6bd077e1dcfa"
] | [
"src/utils/common_utility.py"
] | [
"'''\nCode for common utilies used by all 3 tasks.\n'''\nimport json\nimport matplotlib.pyplot as plt\n\n\ndef json_src_reader(json_file):\n '''\n Function to read and return the json file and split the data into train input, train output, test input, test output. \n \n Parameters: \n -----------\n ... | [
[
"matplotlib.pyplot.matshow",
"matplotlib.pyplot.show"
]
] |
xinjiyuan97/statisticalMachineLearning | [
"d937c2a62b6f20ec463bc65bb5afa55b821e99ad"
] | [
"kNearestNeighbor(kdTree).py"
] | [
"import numpy as np\n\n\ndef createData():\n x = np.array([[2, 3], [5, 4], [9, 6], [4, 7], [8, 1], [7, 2]])\n return x;\n\ndef createTree(dataSet, k, j):\n if len(dataSet) == 0:\n return\n if len(dataSet) == 1:\n print(dataSet[0, :], j)\n return\n #return dataSet[0, :]\n n... | [
[
"numpy.argsort",
"numpy.array"
]
] |
haowei01/pytorch | [
"b5e832111e5e4bb3dd66d716d398b81fe70c6af0"
] | [
"torch/testing/_internal/common_methods_invocations.py"
] | [
"from functools import wraps, partial\nfrom itertools import product, chain\nimport itertools\nimport collections\nimport copy\nimport operator\nimport random\n\nimport torch\nimport numpy as np\nfrom torch._six import inf\nimport collections.abc\n\nfrom typing import List, Sequence, Tuple, Union\n\nfrom torch.test... | [
[
"torch.testing._internal.common_utils.random_symmetric_pd_matrix",
"torch.testing._internal.common_utils.random_symmetric_matrix",
"numpy.sqrt",
"torch.zeros",
"torch.randperm",
"torch.testing.all_types_and",
"torch.testing.floating_and_complex_types_and",
"torch.testing.all_types_... |
dgketchum/itype | [
"f679d95b489765cb8deadd276872ea3e238bc6ca"
] | [
"predict.py"
] | [
"import os\nimport numpy as np\nfrom argparse import ArgumentParser\nfrom pathlib import Path\n\nfrom matplotlib import pyplot as plt\nfrom matplotlib import colors\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\nfrom pytorch_lightning import Trainer\n\nfrom models.unet.unet import UNet\nfrom configure im... | [
[
"matplotlib.pyplot.tight_layout",
"numpy.unique",
"matplotlib.pyplot.subplots",
"numpy.dstack",
"matplotlib.pyplot.savefig",
"matplotlib.colors.ListedColormap",
"matplotlib.pyplot.close",
"matplotlib.pyplot.show"
]
] |
DanyloAntsybor/DAT210x-master | [
"47901140d592352e172f0b22fbf275ebbb640219"
] | [
"Module5/assignment8.py"
] | [
"import pandas as pd\nimport numpy as np\nimport matplotlib\nimport matplotlib.pyplot as plt\n\nmatplotlib.style.use('ggplot') # Look Pretty\n\n\ndef drawLine(model, X_test, y_test, title):\n # This convenience method will take care of plotting your\n # test observations, comparing them to the regression line,\n ... | [
[
"matplotlib.pyplot.yticks",
"pandas.read_csv",
"matplotlib.style.use",
"matplotlib.pyplot.colorbar",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure"
]
] |
jwoehr/pennylane | [
"5de272a1ce6ed39b5c6ee34035f11f8c309266ee"
] | [
"tests/beta/test_vqe.py"
] | [
"# Copyright 2019 Xanadu Quantum Technologies Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applica... | [
[
"tensorflow.enable_eager_execution",
"numpy.allclose",
"numpy.random.seed",
"tensorflow.Variable",
"numpy.sqrt",
"numpy.cos",
"torch.tensor",
"numpy.all",
"numpy.sin",
"tensorflow.GradientTape",
"numpy.shape",
"numpy.array",
"torch.autograd.Variable"
]
] |
lockwo/quantum_computation | [
"a377c60e1dcaada466eebfbcb412cd243e54e34c"
] | [
"TFQ/QAE/quantum_autoencoder.py"
] | [
"import tensorflow_quantum as tfq\nimport cirq \nimport sympy\nimport numpy as np\nimport tensorflow as tf\nimport matplotlib.pyplot as plt\nimport random\nfrom itertools import product\n\ndef layer(qs, params):\n circ = cirq.Circuit()\n for i in reversed(range(len(qs)-1)):\n circ += cirq.CNOT(qs[i], q... | [
[
"matplotlib.pyplot.legend",
"tensorflow.keras.Input",
"tensorflow.keras.models.Model",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"tensorflow.keras.optimizers.Adam",
"matplotlib.pyplot.xlabel",
"tensorflow.keras.callbacks.EarlyStopping",
"matplotlib.pyplot.show",
... |
AHGOverbeek/eve-ros2-examples | [
"b61fbdc5dfd2b7895f1e29c493b2126a8e811d51"
] | [
"eve_ros2_examples/task_box.py"
] | [
"#!/usr/bin/env python3\n\n# Copyright 2021 Halodi Robotics\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... | [
[
"scipy.spatial.transform.Rotation.from_euler",
"numpy.deg2rad"
]
] |
ben-heil/hetio | [
"9a2a218513ff270357775e58360ba950c30197d1"
] | [
"hetio/matrix.py"
] | [
"from collections import OrderedDict\n\nimport logging\nimport numpy\nimport scipy.sparse\n\n\ndef get_nodes(graph, metanode):\n \"\"\"\n Return a list of nodes for a given metanode, in sorted order.\n \"\"\"\n metanode = graph.metagraph.get_metanode(metanode)\n metanode_to_nodes = graph.get_metanode... | [
[
"numpy.prod",
"numpy.count_nonzero"
]
] |
MeteorKepler/laughing-invention | [
"6f856d7ba27f956d8dceb18fe14ba2575beae6aa"
] | [
"ricga/eval_tools/pycocoevalcap/rouge/rouge.py"
] | [
"#!/usr/bin/env python\n# \n# File Name : rouge.py\n#\n# Description : Computes ROUGE-L metric as described by Lin and Hovey (2004)\n#\n# Creation Date : 2015-01-07 06:03\n# Author : Ramakrishna Vedantam <vrama91@vt.edu>\n\nimport numpy as np\n\n\ndef my_lcs(string, sub):\n \"\"\"\n Calculates longest common ... | [
[
"numpy.array"
]
] |
cyberbaker/CSML | [
"c2adad5e796fa12b5afcfafd5fd1b51f642ce730"
] | [
"ex5/polyFeatures.py"
] | [
"import numpy as np\n\ndef polyFeatures(X, p):\n \"\"\"takes a data matrix X (size m x 1) and\n maps each example into its polynomial features where\n X_poly(i, :) = [X(i) X(i).^2 X(i).^3 ... X(i).^p]\n \"\"\"\n# You need to return the following variables correctly.\n X_poly = np.zeros((X.size, p))\... | [
[
"numpy.zeros"
]
] |
pombredanne/pandas | [
"aa084162bcaa7ce0efdc044bc8077f6bfca70674"
] | [
"pandas/core/indexes/base.py"
] | [
"from datetime import datetime, timedelta\nimport operator\nfrom textwrap import dedent\nimport warnings\n\nimport numpy as np\n\nfrom pandas._libs import (\n algos as libalgos, index as libindex, join as libjoin, lib)\nfrom pandas._libs.lib import is_datetime_array\nfrom pandas._libs.tslibs import OutOfBoundsDa... | [
[
"pandas.core.dtypes.common.ensure_object",
"numpy.where",
"pandas.core.dtypes.common.is_interval_dtype",
"pandas.core.dtypes.concat._concat_index_asobject",
"pandas.core.common.cast_scalar_indexer",
"pandas.core.common._not_none",
"pandas.core.dtypes.common.is_iterator",
"pandas.co... |
mgkagk01/Coding-Theory | [
"58229b6db4ff42fc529e0ffa6d895e19c1c1c162"
] | [
"LDPC/DecoderExample/LdpcDecoder.py"
] | [
"import numpy as np\r\n\r\nclass Node:\r\n def __init__(self, id, idxStore, idxRead):\r\n self.id = id\r\n self.idxStore = idxStore\r\n self.idxRead = idxRead\r\n self.next = None\r\n\r\n\r\nclass LdpcDecoder():\r\n def __init__(self, fileName, a):\r\n self.a = a\r\n ... | [
[
"numpy.sign",
"numpy.tanh",
"numpy.zeros",
"numpy.sum"
]
] |
AvocadoTan/cogdl | [
"90e6ea74209fd8a8a310efc4d7e7060bcb313a5e"
] | [
"examples/hyper_search.py"
] | [
"import torch\nimport optuna\n\nfrom cogdl.utils import build_args_from_dict\nfrom cogdl.models import build_model\nfrom cogdl.datasets import build_dataset\nfrom cogdl.tasks import build_task\nfrom cogdl.utils import set_random_seed\n\n\nN_SEED = 5\n\n\nclass HyperSearch(object):\n \"\"\"\n This class do... | [
[
"torch.cuda.is_available"
]
] |
gustavovaliati/obj-det-experiments | [
"e81774a18b34c22d971ad15d7ac6eb8663ac6f22"
] | [
"tensorflow/bbox/jrieke-tf-parse/jrieke_tf_dataset.py"
] | [
"'''\nThis code is based on https://github.com/jrieke/shape-detection/\n'''\n\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport numpy as np\nimport tensorflow as tf\nimport datetime\n\nclass JriekeBboxDataset:\n def generate(self):\n # Create images with random rectangles and bounding boxes.\n ... | [
[
"matplotlib.pyplot.gca",
"matplotlib.pyplot.imshow",
"matplotlib.patches.Rectangle",
"numpy.std",
"matplotlib.pyplot.subplot",
"numpy.mean",
"numpy.random.randint",
"matplotlib.pyplot.show",
"numpy.zeros",
"matplotlib.pyplot.figure"
]
] |
romainmartinez/aqua | [
"dd031641a5e1e6f12fa29271d447bea7e49407a0",
"dd031641a5e1e6f12fa29271d447bea7e49407a0"
] | [
"aqua/data.py",
"bayes.py"
] | [
"import pandas as pd\n\n\ndef load_raw_data(data_path: str = \"./data/raw.csv\") -> pd.DataFrame:\n return pd.read_csv(data_path)\n",
"import streamlit as st\n\nfrom aqua import ui, data, processing, ml, plots\n\nui.make_title()\nprocessing_options, modelling_options = ui.make_sidebar()\n\nraw_data = data.load... | [
[
"pandas.read_csv"
],
[
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplots",
"numpy.linspace"
]
] |
jangarrevoet/pyFAI | [
"0779ac9aa5d72ac582413921989a8375bb7a990a"
] | [
"pyFAI/test/test_openCL.py"
] | [
"#!/usr/bin/env python\n# coding: utf-8\n#\n# Project: Azimuthal integration\n# https://github.com/silx-kit/pyFAI\n#\n# Copyright (C) 2015-2018 European Synchrotron Radiation Facility, Grenoble, France\n#\n# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)\n#\n# Permission is her... | [
[
"numpy.dot",
"numpy.random.random",
"numpy.arange",
"numpy.int32",
"numpy.sort",
"numpy.array",
"numpy.sum"
]
] |
Colossalhavoc/PepeBot | [
"238f246e84696970a93eba508c3b084704b44944"
] | [
"stdplugins/ascii.py"
] | [
"# based on https://gist.github.com/wshanshan/c825efca4501a491447056849dd207d6\n# Ported for ProjectAlf by Alfiananda P.A\n# Kanged from @Nitesh_XD\n\nimport os\nimport random\n\nimport numpy as np\nfrom colour import Color\nfrom hachoir.metadata import extractMetadata\nfrom hachoir.parser import createParser\nfrom... | [
[
"numpy.asarray"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.