sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
ea6deeae14e519c3823c92c3a463cbe71da2702c8e9fb0a880cc61db1cc13c91 | Python | 17,179 | 517 | """What `tune` records about a trial: its config dump and its tags.
`pprint.pp` (the old call) hardcodes `sort_dicts=False`; `pprint.pformat`
(what it was replaced with) defaults `sort_dicts` to `True`. Left at that
default the dump prints alphabetically instead of in `ModelConfig` field
order, which is what a reader ... |
bbc9d20652144a6c684feb59b1b55550e388213f21dae1bd2d3ad3c1c8e640be | Python | 17,181 | 461 | # NeuriteKymoGeneration: generate multi-channel kymographs from ROI zips.
# Outputs: <imagebase>_kymo\*roi###.tif (multi-channel kymographs).
# ROI zip naming: <image filename>_RoiSet.zip (includes extension).
# Beginner note:
# 1) Pick a root folder with image files.
# 2) Script scans all subfolders for matching image... |
3a08f9f347502752f8bf54c62a8fc8e8755f35082e677031cb5ac6c1e84ccb29 | Python | 17,187 | 454 | #!/usr/bin/env python3
"""Polarity supplement regeneration — uses the correct per-figure prediction caches.
Produces updated Table 1 (between-dataset) and Table 2 (within-dataset)
for the Supplementary Note "Waveform polarity does not confound cell-type
classification accuracy."
Cache mapping (matches the main figure... |
be5c1a2127f2250d0e14731d2f4abe80ae1f1baef2b16211b464b5d00626fc24 | Python | 17,189 | 478 | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import fnmatch
import json
import logging
import os
import shutil
import sys
import tarfile
import tempfile
from contextlib import context... |
01b474617895495abb3bb09dd0e3b1227adcfae7a9f4a1c7719d79d798b96fac | Python | 17,190 | 479 | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import fnmatch
import json
import logging
import os
import shutil
import sys
import tarfile
import tempfile
from contextlib import context... |
872f44e78bcdc9df0a8684e6e02f6a2955eaf1dcd66a19756fefb8754de4819c | Python | 17,203 | 378 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join
import time
import pickle
import socket
import datetime
from collections import defaultdict
import numpy as np
from tqdm import tqdm
from pprint import pprint
import nibabel as nib
f... |
75547594ccbb549f9c0e6e1c99f54a57e97775fdd90a62ac83b8981fff6a148f | Python | 17,208 | 409 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py
# This file includes the modifications to the source codes according to this project!
import tqdm
import numpy as np
import pandas as pd
import gensim
import logging
from scipy.spatial.distance impo... |
ac1816fb26cc59010673ad3ba2d38b895418a0fe014819441a9150faf60e3f25 | Python | 17,218 | 353 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
beabe4d9c32a95fd84a473d6751c760955a0601a110b56542c53e622bfb674ab | Python | 17,219 | 354 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
4aa570a7d2153d1cf7530872d63089b65d49a1a4b5d18017ae48424dddc6f72c | Python | 17,220 | 461 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
bc1a55fcdf4a0aae6670522c7b350595d68f7786606b3ff5a51b6071f0205a6d | Python | 17,227 | 506 | import ast
import hashlib
import importlib.util
import json
import re
from datetime import date
from pathlib import Path
import nbformat
import pytest
ROOT = Path(__file__).parents[1]
COLABS = ROOT / "colabs"
MODEL_DEMOS = {
"gpn_demo.ipynb": "gpn",
"phylogpn_demo.ipynb": "phylogpn",
"gpn_star_demo.ipynb"... |
c582a4426245721b9cc17a8133ca1e956bec6338d075640a7b4740ac20763d50 | Python | 17,237 | 424 | '''
Created on 24 Jun 2016
@author: Andreagiovanni Reina.
University of Sheffield, UK.
'''
# import RungeKutta.bestOfN
import math
import numpy as np
import sys
import os
import copy
import random
# import matplotlib.pyplot as plt
# from plotting import plotit
DEBUG = False
listA = []
listB = []
opdir = '/scratch/da... |
54bf99cac4604ec0b206c56a20a35eed51d153b2413451c94941a172d1c4550b | Python | 17,247 | 589 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from dataclasses import dataclass
from fairseq.modules i... |
22d6d707db8149024fe5c627a185154a2e859603309b8fd0491ba4080cef3800 | Python | 17,252 | 436 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
5ddb3b1164f537ed96ef54d92b3b7a1c872968e86089f945f4bbaee3dbf4cf54 | Python | 17,256 | 501 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import os.path as op
import torch
import torch.nn.functional as F
import numpy as np
from fairseq.data.audio.text_t... |
6438cbfa218012a0a40a6b3aafbdb50b1b5061abb89b53e340266043d1dec93a | Python | 17,265 | 424 | '''
Created on 24 Jun 2016
@author: Andreagiovanni Reina.
University of Sheffield, UK.
'''
# import RungeKutta.bestOfN
import math
import numpy as np
import sys
import os
import copy
import random
# import matplotlib.pyplot as plt
# from plotting import plotit
DEBUG = False
listA = []
listB = []
opdir = '/scratch/da... |
e91a7c289af23a8fdc3bc5ea1b8a4c290bae3c52fa5342c07f08cf2a4f1e5756 | Python | 17,265 | 390 | from __future__ import annotations
from itertools import chain, product
from math import log
from typing import Any
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sklearn.exceptions import ConvergenceWarning
from tqdm.auto import tqdm
from pgmpy import config
from pgmpy.factors.disc... |
1bf38723e501e551c8a1f3c2f519d27c5440567a0fc6e423660c897a3b2f3253 | Python | 17,274 | 468 | from __future__ import annotations
import contextlib
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import Literal
from cleo.helpers import argument
from cleo.helpers import option
from packaging.utils import canonicalize_name
from poetry.core.packages.dependency impo... |
7021adb5109a0439f0f166c81f1fe8025faa39d0a246942a77e4d109e5e228c0 | Python | 17,276 | 479 | """What a `.pt` file carries, and what it refuses to read.
The class head is positional and nothing in a `state_dict` says which class
owns which column, so the column order travels with the weights instead of
being rebuilt beside them. Format 2 dropped the entity-linking head, which is
why everything older is refused... |
84dc1b65b9687b0424a31d3dd84cab21ab9c2b0bdd2edb9fc3ab6c210fc04fb3 | Python | 17,278 | 433 | """
Attribution-aware global stitcher for dynamic_segmentation_CID.
Extends the base stitcher with:
- ``grid_size`` for grid-level global dimensions (Hg_global, Wg_global)
- ``if_attr`` flag that allocates ``global_attr`` tensor
- ``update()`` accepts ``attributions`` kwarg for grid-level stitching
- ``... |
496e9cc3a9e49e780586b92d0cf9e12d61a1e91e11920ef734ffdae9538de893 | Python | 17,285 | 444 | """
Adapted from https://github.com/FunctionLab/selene/tree/master/selene_sdk
This class contains methods to query a file of genomic coordinates,
where each row of [start, end) coordinates corresponds to a genomic feature
in the sequence.
It accepts the path to a tabix-indexed .bed.gz file of genomic coordinates.
Th... |
d9e5c4cd1d562757e3e9f093f7e78e8ceb3717bbabdb786550a9383add25eb7a | Python | 17,297 | 395 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
# Author: Lalith Kumar Shiyam Sundar
# Sebastian Gutschmayer
# Institution: Medical University of Vienna
# Research Group: Quantitative Imaging... |
a6ee2941421ec8d7a051d98f73a09fa35ad326e184fedb0431a873a1ecbd0d1a | Python | 17,315 | 499 | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
ef2e286ae4491c7932cdda8bbd7d7f783f4f1063ba2c58aa38a19c532ea9a7c9 | Python | 17,316 | 500 | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
9aa346e5cc821c3132c2449e85e7765b316b6609bc2685763552e28acd92c74b | Python | 17,330 | 406 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import sys,os, gzip
import numpy as np
import _pickle as cPickle
# Root directory for all dataset... |
bc31ce777d31b22dad1c7cdfb6b0f760a3d905e78bdd6c79a179d18c6ab7a8ea | Python | 17,342 | 405 | #!/usr/bin/env python3
"""Fila de execucao SIESTA com N workers independentes.
Desenho: nao ha processo mestre que distribua trabalho. Cada worker pega a
proxima tarefa nao reivindicada criando o diretorio `run/<nome>` com
`os.mkdir`, que e atomico tanto em disco local quanto em Lustre/NFS. Isso tem
tres consequencias... |
c3cae3be94a943f1c08f1d21ca920e310ee54afed14db0e7da4239e46beb4460 | Python | 17,342 | 528 | import gzip
import pandas as pd
try:
from importlib.resources import files
except ImportError:
# For python 3.8 and lower
from importlib_resources import files
from pgmpy import logger
from pgmpy.utils._warnings import _warn_external
def get_example_model(model: str):
"""
Fetches the specified ... |
2d555cbfbc997b94dd48d4602fa2707ad8d478bc1a0944120ab8458498e1109e | Python | 17,356 | 479 | # -*- coding: utf-8 -*-
"""
@Time:Created on 2019/9/24 15:49
@author: LiFan Chen
@Filename: model_c2.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import math
import numpy as np
from sklearn.metrics import roc_auc_score, precision_score, recall_... |
92f2886c7ab4892dcb6a3a86acd26007cbea626cf8a24613532e53d1556dcd5b | Python | 17,361 | 522 | from celltype_ibl.models.BiModalEmbedding import BimodalEmbeddingModel
import numpy as np
import torch
import umap.umap_ as umap
import matplotlib.pyplot as plt
import colorcet as cc
from celltype_ibl.utils.c4_data_utils import get_c4_labeled_dataset
from celltype_ibl.utils.ibl_data_util import get_ibl_wvf_acg_pairs
f... |
5044666baf469c46b77a124ae01c2ccbea02c185c6a93333d09b9571c088b8b5 | Python | 17,362 | 516 | import json
import pickle
from pathlib import Path
from collections import Counter, OrderedDict
from typing import Dict, Iterable, List, Optional, Tuple, Union
from typing_extensions import Self
import numpy as np
import pandas as pd
import torch
# from transformers.tokenization_utils import PreTrainedTokenizer
# fro... |
6939ad7fa084621553a4d328185128a1f588da4acda7c0331e90699cc79d6c7b | Python | 17,365 | 384 | #%%
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.base import clone
from sklearn.model_selection import cross_val_score, cross_val_predict
from sklearn.metrics import roc_auc_score
from skl... |
9057fea0e4bd10a255df1cbac7454756d2a5cb85efc80046fc429882548e836a | Python | 17,368 | 466 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 26 16:21:46 2025
@author: vbp
Model fit for the additional target regions (TS, NAc_c, OT), for Figure
S5E, S5F, S5G.
IMPORTANT: unlike the main-region regression scripts, this one does NOT
fit alpha/delta per session — it uses fixed values (alpha=... |
dfc1d3e3df0e1966ed361f4dbaf9fc59fd525a8458bb7c4187c9c70d168ef749 | Python | 17,388 | 459 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
f18c3d6ccee7e6123a574cc390071606b0881f72cea49159b7e546bee1fc9146 | Python | 17,396 | 486 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Flashlight decoders.
"""
import gc
import itertools as it
import os.path as osp
from typing import List
import wa... |
3156a59eaf97a1c897be6fde3dcb03be5c89e0458b705c76d0d6183292be7752 | Python | 17,404 | 394 | '''
By K. Butenko
This script trains and tests an ANN model to approximate pathway activation for a given electrode position
'''
import matplotlib
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
import numpy as np
import os
import sys
import json
from typing import Tuple, List, Optional, D... |
c23ca8c9fd7d46b97718417902cdfccc89c1239b6e1c7823cf80f3295fefd886 | Python | 17,411 | 511 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
## MLPerf Calibration set for ImageNet
## Source: https://github.com/mlcommons/inference... |
fed24f1933e280f4c3c93042276619e3af40b74be5b87b220f86e01bea94d9c4 | Python | 17,418 | 320 | import argparse
import random,os
import numpy as np
import csv
import pandas as pd
import keras.backend as K
from keras.callbacks import ModelCheckpoint,Callback
from keras.optimizers import Adam
from scipy.stats import pearsonr,spearmanr
from model import KerasMultiSourceGCNModel
import hickle as hkl
import scipy.spar... |
48dbd4280004dce09841e5ba3069aa50a01dd2a8e3cc4249372d43eb8a43849d | Python | 17,443 | 320 | import argparse
import random,os
import numpy as np
import csv
import pandas as pd
import keras.backend as K
from keras.callbacks import ModelCheckpoint,Callback
from keras.optimizers import Adam
from scipy.stats import pearsonr,spearmanr
from model import KerasMultiSourceGCNModel
import hickle as hkl
import scipy.spar... |
b94092522becf1eacb41f54b3dd8ec3eb469a6ceaf0b21561cbf7322ee682195 | Python | 17,449 | 462 | import dinf
import tskit
import torch
import numpy as np
import allel
import pandas as pd
from dinf.misc import ts_individuals
class BaseProcessor:
def __init__(self, config: dict, default: dict):
for key in config:
if key == "class_name": continue
assert key in default, f"Option {... |
54b0022f1dd8dd53ef60f9a3563ff1a90bc03d2be05cddec02087e0c76c7c671 | Python | 17,450 | 448 | """A dataset class used for neural network models with the
frame classification task, where the source data consists of audio signals
or spectrograms of varying lengths.
Unlike :class:`vak.datasets.frame_classification.InferDatapipe`,
this class does not return entire samples
from the source dataset.
Instead each pair... |
e8c8734a35909934f381332801cad6c1e4c240822798c6b7757acb79ee2c6d2a | Python | 17,476 | 451 | """Measurement: does keeping token embeddings on the GPU cost peak VRAM?
Runs both placements over the same pre-drawn batches in one process,
alternating across rounds, and reports peak allocated bytes, the seconds inside
`get_token_embeddings`, and whether the two agree bit for bit. One process is
what makes the timi... |
54da234838e8b2cf73809bf37e06029f4c40eadccdae21ab1415a03063be4e07 | Python | 17,487 | 471 | from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.data.fields import (
CategoricalObsField,
LabelsWithUnlabeledObsField,... |
6ea045a2e3141662f68e2b9d82e763297c74a60430c6b958e648caf7af56c268 | Python | 17,487 | 357 | import os
import json
import zipfile
import requests
import shutil
from typing import Tuple, List, Dict
from moosez import system
from moosez.constants import (KEY_FOLDER_NAME, KEY_URL, DEFAULT_SPACING, DEFAULT_TRANSPOSE_IDENTITY,
FILE_NAME_DATASET_JSON, FILE_NAME_PLANS_JSON, ANSI_GREEN, A... |
ed3a10dda529625449ede30ff687f076ae9250a0eb0852723e948617186e40b9 | Python | 17,492 | 519 | from typing import Any, Optional
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression, LinearRegression, ElasticNet
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.svm import SVC, SVR
from sklearn.neural_network import MLPClassifier, MLPRegre... |
13fd89ce197b171127a947b2aa3adbb067682096a79c74a0caa1144a84679465 | Python | 17,509 | 412 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py
# This file includes the modifications to the source codes according to this project!
import tqdm
import numpy as np
import pandas as pd
import gensim
import logging
from scipy.spatial.distance impo... |
83bfe04933d107865cdf1d346eaa193cd85e596a5ce0b0d29c19aa66227b6bce | Python | 17,512 | 383 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
#
# This file has been adapted from Keras:
# https://github.com/keras-team/keras-applicat... |
12f38ea401e5f8584def3911120803ab53d884d0c6a31d15f658f726687902b7 | Python | 17,518 | 476 | import os
import cv2
import torch
import sparse
import random
import pyvips
import argparse
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
from torchvision import utils
def setup_seed(seed):
r"""
Args:
seed: Seed for reproducible ran... |
fd7270136ca87a364f0d02ceec657b19fa0eec734860450a65de25d1b1a35fc8 | Python | 17,526 | 474 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Any, Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import uti... |
560288ba8ce29507e09f6c08daf087801c246c934b6e49df44d058af2ff24133 | Python | 17,530 | 409 | # Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
3ed9fc8cd7dc6cb65b047fd746c4b5225ed151c21e09a7ff27164adab79334e7 | Python | 17,548 | 473 | import os
import pandas as pd
import click
import numpy as np
from scipy.stats import norm
import pingouin as pg
from compositionality_study.constants import (
MEMORY_TEST_DIR,
BIDS_DIR
)
def calculate_dprime(hits, n_signals, fa, n_noise):
"""
Calculates d' using the loglinear correction to handle edg... |
8e5a0127cc072cf69309dbafafa56a84923cf5449bb14c33b7bbe739950de03e | Python | 17,561 | 350 | import os
import pandas as pd
import numpy as np
import pandas as pd
import networkx as nx
from tqdm import tqdm
from currentscape_calculator.partitioning_order import create_directed_graph, get_partitioning_order
def partition_iax(im: pd.DataFrame, iax: pd.DataFrame, timepoints: list, target: str, partition_by: st... |
b5afd44030c18ab9baa120422f73540ba1011093c30d35c4234d2da9850b2012 | Python | 17,583 | 450 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import os
from collections import defaultdict
import pickle
import pandas as pd
import pingouin as pg
def get_plot_group_order(n_components):
if n_components == 2:
plot_group_order = [1, 2]
elif n_components == 3:
plot_gro... |
1c7ff928e23236984a34c635b1e3a6eee8ed97190a215d6a6236528b3ff5e360 | Python | 17,597 | 446 | from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from scvi.data import AnnDataManager
from scvi.data._download import _download
from scvi.data._preprocessing import _dna_to_code
from scvi.data.fields import... |
84a6c452ebf9218c5fee8609f1b9fdc7701551735e5d3dcbf3d335343093aae0 | Python | 17,633 | 476 | import pytest
from pgmpy.factors.discrete import State, TabularCPD
from pgmpy.inference import VariableElimination
from pgmpy.models import DiscreteBayesianNetwork, DiscreteMarkovNetwork
from pgmpy.sampling import BayesianModelSampling
from pgmpy.sampling.base import BayesianModelInference
@pytest.fixture
def bayesi... |
173ebd60f3e8309584a4d5b8ab1d3ef3e1a039b88431ff57dead3be8165a5f8e | Python | 17,640 | 343 | #定义视觉刺激参数设置的类
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class VisualstimulusSet(QWidget):
def __init__(self):
super(VisualstimulusSet, self).__init__()
self.setWindowTitle("视觉刺激参数设置")
self.setWindowIcon(QIcon('./images/visualstim... |
c8418e0b9a7ece6a3f80b3977996a173942366b30e559f6f2809a0c35ab5cd0a | Python | 17,643 | 621 | """
This module builds base trainer for all pre & downstream tasks.
Author: wangning(wangning.roci@gmail.com)
Date : 2022/12/8 2:43 PM
"""
import copy
import os
import shutil
import numpy as np
import abc
import os.path as osp
from sklearn.metrics import (
accuracy_score,
precision_score,
recall_score,
... |
190ef6a080b4191aee66424560a7419a6b83c8520450a502dc07126d4231743d | Python | 17,649 | 578 | from __future__ import annotations
import re
from typing import TYPE_CHECKING
import pytest
from poetry.core.masonry.utils.module import ModuleOrPackageNotFoundError
from poetry.core.packages.dependency_group import MAIN_GROUP
from poetry.console.commands.installer_command import InstallerCommand
from poetry.conso... |
978d23a91bef2517bbb795a92fd23dd1173841cc4191aaf6a3002d95c9c3db72 | Python | 17,665 | 504 | #!/usr/bin/env python3
import math
import torch
import torch.nn as nn
from fairseq.data.data_utils import compute_mask_indices
from fairseq.models import FairseqEncoder
from fairseq.models.wav2vec import ConvFeatureExtractionModel
from fairseq.modules import GradMultiply, LayerNorm, SamePad, TransformerEncoderLayer
... |
c3fa8c8fd1a5a958a8b87b8ec3553cd0de9da16b824d7b8fa00554e0ffb99a6f | Python | 17,673 | 518 | """
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
Fast block jackknives.
Everything in this module deals with 2D numpy arrays. 1D data are represented as arrays
with dimension (N, 1) or (1, N), to avoid bugs arising from numpy treating (N, ) as
a fundamentally different shape from (N, 1). The convention in this... |
aab9c90fa0a7c747fb628df6dc94de3aaec8bcf75c1bf9561d65d00119b760d9 | Python | 17,685 | 484 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BINND(nn.Module):
def __init__(self):
super(BINND, self).__init__()
# 2D Convolutional Block: Extracts spatial features from input
self.conv2d_block = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=1... |
b6e2790a4a5e1bbf55b1e56b4258fc9413827fe06ef4f37e04e719c3ef340160 | Python | 17,691 | 452 | """Main module."""
from collections.abc import Iterable, Sequence
from typing import Literal
import numpy as np
import torch
import torch.nn.functional as F
from torch.distributions import Categorical, Normal
from torch.distributions import kl_divergence as kl
from torch.nn.functional import one_hot
from scvi import... |
341f174eb303944e20b753c560b6ee523640d4c4a9c38d0ba6e7e1e65f565774 | Python | 17,702 | 414 | from PyQt5.QtCore import pyqtSlot, Qt
from PyQt5.QtGui import QFontMetrics
from PyQt5.QtWidgets import QWidget
import numpy as np
from mdt.gui.maps_visualizer.actions import SetMapTitle, SetMapColormap, SetMapScale, SetMapClipping, \
SetMapColorbarLabel
from mdt.gui.maps_visualizer.base import DataConfigModel
from ... |
d3f3981fd732544799c7c80b8a282464d6e7f6052c11a44e1b112006cb601cf3 | Python | 17,712 | 415 | # -*- coding: utf-8 -*-
"""Python wrapper for timsdata.dll"""
import numpy as np
import sqlite3
import os, sys
from ctypes import *
from pathlib import Path
from enum import Enum
if sys.platform[:5] == "win32":
libname = "./timsdata.dll"
elif sys.platform[:5] == "linux":
libname = "libtimsdata.so... |
32086260fb1182c9f1acbb38d1dd556c8f34f122e3bcf7ddaa271b8cb373e3d3 | Python | 17,717 | 384 | # coding=utf-8
# Copyright 2019-present CNRS, Facebook Inc. and the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
865598946d231249d8dad40c2735a4ed3823ebef2b0f64087dfd79596be99158 | Python | 17,718 | 385 | # coding=utf-8
# Copyright 2019-present CNRS, Facebook Inc. and the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
40e141061b0ea994012d403b9ab143060f3fd4b21462963eb80be662e9e4f1bb | Python | 17,731 | 383 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import tifffile as tifffile
import argparse
import skimage as ski
from scipy.ndimage import gaussian_filter
from skimage.morphology import disk, ball
import scipy as sp
import warnings
warnings.filterwarnings("ignore")
def bin_means_by_pr... |
8d2eb17d71af8e16a1f36d8936f582d5c9239b0184a8ef15cf0c577fff1efea3 | Python | 17,731 | 548 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
7554fa9607267d73bc34f8bcd38c37b9be7d827306c7f9d438c9d670ac143ed5 | Python | 17,734 | 548 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
be01a7afcc955fac8162d9dc87e85741788a102164a1aa5f7f7b33110fbe7d94 | Python | 17,739 | 490 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import itertools
import logging
import os
import numpy as np
import torch
from fairseq.logging imp... |
8c0b74a1d4e893089e466d5b70fad82c74794637eade562ab6f32284c8f80537 | Python | 17,740 | 548 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
e284d083c3f998afdbdb216336d35033d3905ea985d2e4997086320643cc57b7 | Python | 17,740 | 458 | import pytest
import torch
from scvi.external.contrastivevi import ContrastiveDataLoader, ContrastiveVAE
from scvi.model._utils import _init_library_size
from scvi.module.base import LossOutput
REQUIRED_DATA_SOURCES = ["background", "target"]
REQUIRED_INFERENCE_INPUT_KEYS = ["x", "batch_index"]
REQUIRED_INFERENCE_OUT... |
6b66f7dcc8d150294373b49de52f5867f2a4dd9f651588f511f93c65896f33bb | Python | 17,746 | 548 | import numpy as np
import pandas as pd
from matplotlib.lines import Line2D
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ... |
7bac5d7507773f243fd7fe354224534454d4cbeb215c08f3651cc0a016311873 | Python | 17,750 | 439 | from functools import reduce
from pgmpy.factors.base import BaseFactor
class FactorSet:
r"""
Base class of *DiscreteFactor Sets*.
A factor set provides a compact representation of higher dimensional factor
:math:`\phi_1\cdot\phi_2\cdots\phi_n`
For example the factor set corresponding to factor... |
e6dff8a3af5d44370aeb60ca4be3d3a2eab556f6620b3db4eb0df8e1d312388c | Python | 17,771 | 789 | import os
import math
import torch
import numpy as np
from torch_geometric.loader import DataLoader
from sklearn.metrics import mean_squared_error
from scipy.stats import pearsonr
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from model import GeometryAwareGNN
... |
66d3040b5a9d9ed6b91e9263e484ddd1ddec6a36df8f5cb0e693ce5ec8577e20 | Python | 17,776 | 519 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 18:24:03 2021
@author: bianca
"""
##############################################
##
## Decoding action predictions - Behavioural experiment
##
## !! Updated version !!
## Cue is now fixation dot changing colour instead of enlargin... |
ec3de17a14b46bf4002cc41594140c83c570c44d7e5aaed4ad5273ba5ff41ce6 | Python | 17,782 | 487 | import timeit
import logging
import torch
from pypapi import events, papi_high as high
from memory_profiler import memory_usage
from torch import nn
from argparse import Namespace
from fairseq.dataclass.utils import convert_namespace_to_omegaconf
from fairseq.data import data_utils as fairseq_data_utils
from fairseq im... |
3733d14a65117019eb9d4be885f2210f04ecae16924790dae016f4233c7abaac | Python | 17,783 | 538 |
import os
from matplotlib import pyplot as plt
plt.switch_backend("agg")
import networkx as nx
import numpy as np
from tensorboardX import SummaryWriter
from utils import synthetic_structsim
from utils import featgen
import utils as io_utils
import pandas as pd
import scipy.sparse as sp
from sklearn.model_selec... |
ff056cec33f220e906d5817fc1169af65366f0aed7db604e0ae4a6d7540687d8 | Python | 17,804 | 494 | """Tests for MooveTAF – the real-time recording / bout-detection script.
moovetaf.py reads config and sets globals at import time.
Tests cover pure functions and stream_callback bout-detection logic.
"""
import configparser
import datetime
import os
import shutil
import textwrap
import threading
import time
import nu... |
a4869c4ce4ca529640de6d07603aef45b7d301aa184687bcb61be8bddfd3da99 | Python | 17,806 | 492 | import itertools
class Independencies:
"""
Base class for independencies.
independencies class represents a set of Conditional Independence
assertions (eg: "X is independent of Y given Z" where X, Y and Z
are random variables) or Independence assertions (eg: "X is
independent of Y" where X and... |
3f803f7e5c4bc1cc90ebae102a29bc0b313762744ce3f8a1d2c6688975ca8c3b | Python | 17,818 | 525 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 16:43:41 2021
@author: bianca
"""
#############################################################################
#
# Decoding action predictions - Demo for behavioural experiment
#
# !! Updated version !!
# Cue is now fixation dot changing c... |
029d67746e9442c4916e4275a74a673dc5c62e97f0b834cef3727cb0ad15b1d0 | Python | 17,821 | 526 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 9 15:53:51 2021
@author: bianca
"""
#############################################################################
#
# Decoding action predictions - Refresher for fMRI experiment
#
# !! Updated version !!
# Cue is now fixation dot changing co... |
f8d0b1b3840aeb141e7826623caa66c24ae237db2b8e30eec5efc1e15f4fca58 | Python | 17,823 | 554 | """Wrappers for VTK data objects."""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
import numpy as np
from vtk.numpy_interface import dataset_adapter as dsa
from vtk.util.vtkConstants import (VTK_POLY_VERTEX, VTK_POLY_LINE,
VTK_TRIA... |
e609b01547e72ace1c1638b961e8e40af06a245d5033cf31b44d9a9aaa9d3a70 | Python | 17,833 | 503 | import os
import textwrap
try:
import importlib.resources as pkg_resources
except ImportError:
import importlib_resources as pkg_resources
from parcellate import resources
import numpy as np
from scipy import signal, optimize
from nilearn import image, masking
from parcellate.util import REFERENCE... |
3f35ce9649126adc912815799fe19a9c17bcc6fb975e8f9e77d3ec4b5a90c0b6 | Python | 17,836 | 527 |
import torch
import numpy as np
from contextlib import contextmanager
import torch.nn as nn
from torchdiffeq import odeint as odeint
from torch.nn.utils.rnn import pad_sequence
from lib.utils.utils_preprocess import destandardize_concentration
def sample_from_prior(encoder, batch_size, device):
"""
Dra... |
828cb107a598e4677a9b3a65fbb192265e7961b290b5fbc13e8116430aecc993 | Python | 17,849 | 559 | import logging
import os
import random
import sys
from collections import defaultdict
import hydra
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from einops.layers.torch import Rearrange
from scipy.io.wavfile import read
from scipy.ndimage import gau... |
db1f6aa32078c9341e4f28662946fde08379b037d4926b7a5b5cdf8f14cee89a | Python | 17,854 | 452 | """Honeycomb (graphene) and square 2D lattices for percolation studies.
Honeycomb has 2 atoms per unit cell (A and B sublattices), each with
3 nearest neighbours. Lattice vectors and atom positions follow the
zig-zag convention used by ASE / nanoribbon code:
a1 = a (3/2, √3/2)
a2 = a (3/2, -√3/2)
A posi... |
998a534f98a127a8dcd77aff60f13813cb9000390d7de232ce2f6281f9fc22db | Python | 17,861 | 467 | """Tests for VIVS model."""
import numpy as np
import pytest
import torch
from scvi.data import synthetic_iid
from scvi.external.vivs._constants import VIVS_REGISTRY_KEYS
def test_vivs_registry_keys():
assert VIVS_REGISTRY_KEYS.Y_KEY == "Y"
def test_importance_score_net_mlp_shapes():
from scvi.external.vi... |
fef6a356f525b416d0af00293d107db5ef643750893f6765808048ab761c752c | Python | 17,891 | 516 | import torch
import torch.nn as nn
from celltype_ibl.models.linear_probe import classifier_probe_train_val
from celltype_ibl.utils.ibl_data_util import (
get_ibl_wvf_acg_pairs,
get_ibl_wvf_acg_per_depth,
)
from celltype_ibl.models.BiModalEmbedding import (
BimodalEmbeddingModel,
SimclrEmbeddingModel,
)
... |
9ee820616a3a634d46abdae7c92a943b0b5a738076bd492cf489f117c4f2b155 | Python | 17,892 | 525 | """Training plan for DIAGVI model."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import torch
from scvi import REGISTRY_KEYS
from scvi.external.diagvi._utils import (
compute_graph_loss,
kl_divergence_graph,
)
from scvi.train import TrainingPlan
from scvi.utils import... |
b44bed735d834f5f13e6a6dace8d0a9d135e95546d4e0f1cb82a463571bbd8d9 | Python | 17,902 | 501 | """Scoring utilities: FuzzyScore, SWI solubility, and sequence helpers."""
import contextlib
from typing import List, Sequence as SeqType, Union
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
# ---------- sequence utilities ----------
AAS = "ILVAGMFYWEDQNHCRKSTP"
def string_to_one_h... |
3e380eee4c210c78a6de92b0c66c32ff76de2ac20b25a79f0d303d4956fe5b8d | Python | 17,905 | 507 | # @license
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
1151a914f631f5f7e81e01bcb92bcd05398a806a5925427cdcdd60b400f32657 | Python | 17,912 | 306 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pylab
import re
import os
import glob
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from optparse import OptionParser
CONDITION = "_163264_witho... |
ea2fff64a7d77888e2c1ebe229f9d040dc229935dfa68dafa979f9f8963bb17d | Python | 17,916 | 537 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
from dataclasses import dataclass, field
from typing import Optional
from omegaconf import II
import torch
import... |
53c16ec3972cd0d39313d438a317f01b1070d7868c567a92bb5221ca17af20b9 | Python | 17,918 | 415 | #!/usr/bin/env python3
"""Fila de execucao SIESTA com N workers independentes.
Desenho: nao ha processo mestre que distribua trabalho. Cada worker pega a
proxima tarefa nao reivindicada criando o diretorio `run/<nome>` com
`os.mkdir`, que e atomico tanto em disco local quanto em Lustre/NFS. Isso tem
tres consequencias... |
6c1a53ed9a68c6256bd9b4f5f20b119e19e07d49ba9c4c79d2c0521514515b02 | Python | 17,923 | 718 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import Normalize
from matplotlib.cm import ScalarMappable
from pathlib import Path
import torch
def compute_residual_quantiles(
y_true,
y_pred,
quantiles=(0.025, 0.16, 0.84, 0.975),
):
"""
Compute per... |
76903dc7766c2f3c27d45521f95d11f31a9356fde17d2d52a8312c901316f14f | Python | 17,923 | 466 | """The embeddings LMDB is written by one function and read by another.
`precompute-embeddings` compresses each document's embedding matrix on the way
into the store. Nothing in the library reads it back yet, so until something
does, the only thing keeping the byte layout honest is that its inverse exists
and round-tri... |
a8a3250ab71cd5f497b5360a0c397ca1077a73e7589dd5c240937fa2d4c7b910 | Python | 17,926 | 465 | from neuron import h#, gui
import math
import time
import random
import numpy
class cell() :
def __init__(self, verbose=True):
#random.seed(1) #use the same seed to get same number in every run
random.seed(time.time())
cellspec = dict()
cellspec["soma_diam"] = 17
... |
db7af29689f3c7da4c1f4a6ae72ba7b30d06011966d886d82e2efc8bab593692 | Python | 17,926 | 441 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import logging
import time
import torch
from fairseq.data import (
FairseqDataset,
LanguagePairDataset,
ListDatas... |
1d3bc8c4770e64430fa681111024c5783be1ab1cc97cf8f8dad17af617269c9b | Python | 17,932 | 499 | """The CPU embeddings cache is budgeted in bytes, not in documents.
A cached entry is one row per token of a full paper — 14.5 MB on average over
this corpus and 56 MB at the tail — so a budget counted in entries is four
orders of magnitude from what it costs, and the count that reads as modest is
the one that gets th... |
6933979f2219ae971e173c63f40e35fcb795f602a2e03b308f94d209ee15e6af | Python | 17,937 | 335 | #!/usr/bin/env python3
"""Summarize external validation JSON/log reports as readable CSV tables."""
from __future__ import annotations
import argparse
import csv
import json
from collections import Counter
from pathlib import Path
from typing import Any
ROOT = Path("/tmp/gmx_MMPBSA-validation")
def load(path: Pat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.