sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
18953372ed867f57e0923cf2b2da2f74e744047d607e1f47a9b00035f89604e6 | Python | 4,236 | 134 | import time
import torch
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
from torch_geometric.utils import from_networkx
from sklearn.model_selection import train_test_split
from graphxai.datasets.utils.bound_graph import build_bound_graph
from graphxai.gnn_models.node_cla... |
85d1fe3e96d74584f34d1eb10792fb5c9db6520c630e33a3952e9e0551a7b22a | Python | 4,237 | 93 | #!/usr/bin/env python
# Copyright 2017 (author: Chun-Chieh Chang)
# Generate a topology file. This allows control of the number of states in the
# non-silence HMMs, and in the silence HMMs. This is a modified version of
# 'utils/gen_topo.pl'. The difference is that this creates two topologies for
# the non-silence H... |
13ff23ac011a90b14a946e6128ffab8d5e66a25ab7d72498595119610bce4dd8 | Python | 4,240 | 111 | """
A set of functions for running prediction in various settings
"""
import logging
import numpy as np
logger = logging.getLogger(__name__)
def predict_on_generator(model, generator, argmax=False):
"""
Takes a tf.keras model and uses it to predict on all batches in a generator
Stacks the predictions ov... |
a04d007392ec73ba42772b7856d68c6259dc6e34988ebdc521e372d15f5d8744 | Python | 4,241 | 112 | # Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
"""
Train and eval functions used in main.py
"""
import math
import sys
from typing import Iterable, Optional
import torch
from timm.data import Mixup
from timm.utils import accuracy, ModelEma
from losses import DistillationLoss
import utils
def t... |
2a6cdc7e21b2e980acb66923a0ce19ee7b3fbb2aa348f4ad49fd76a87cbc1044 | Python | 4,242 | 119 | import torch
from torchvision import transforms
import numpy as np
import pandas as pd
from pathlib import Path
from retinanet import csv_predict, model
from retinanet.dataloader import CSVDataset, Resizer, Normalizer
assert torch.__version__.split('.')[0] == '1'
# Directories containing slices of CT scans (... |
5cc523252dd3ef8d7e75a76b63d046c6589a8ad3be4d9d02cc372e47af3f81d0 | Python | 4,242 | 117 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
76b14c9e3826ee4b60bfa40bc5b09e7d55c5248a2fe8b2c9ad509c2f37f5d4c7 | Python | 4,248 | 109 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
5dbdfe35df5668d091fdbca61fe8e8805a79673915d7f3f77e3e33d31ff0cc4d | Python | 4,249 | 111 | import os
from os.path import join
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (mean_absolute_error, mean_squared_error,
... |
c0e90ef6e096130482be450821359fdc449edf32fa0a30708c351f262a191920 | Python | 4,249 | 135 | import os
import re
import time
import numpy as np
import pickle
import matplotlib.pyplot as plt
# audio
import librosa
import librosa.display
import sklearn
import torch
from torch.utils.data import Dataset,DataLoader
from tqdm import tqdm
# 读取采样
def load_clip(filename):
x, sr = librosa.load(filen... |
fc69736444c9b7404f6a6ce5c53fd404d826ea92bc07a22f64eba3ee5cee82ad | Python | 4,251 | 104 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import torch.nn.functional as F
from torch import nn
from maskrcnn_benchmark.pytorch_distributed_syncbn.syncbn import DistributedSyncBN
class FPN(nn.Module):
"""
Module that adds FPN on top of a list of feature maps.
The ... |
3645c5a444580ecba24498c8f7e2093348804c4bad6561aabc92499b78dd9236 | Python | 4,252 | 133 | import logging
import pandas as pd
from anndata import AnnData
from scvi._compat import Literal
from scvi.core.data_loaders import ScviDataLoader
from scvi.core.models import BaseModelClass, RNASeqMixin, VAEMixin
from scvi.core.modules import LDVAE
from scvi.core.trainers import UnsupervisedTrainer
from scvi.model._u... |
c0134f983d8abbadaf76495bfe2f5ef0dc13028047fab88ac29f2fdc3c107011 | Python | 4,254 | 123 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
c3b112c34db9502526d01a7ffa60e81d8f92818eb5a98bff7b3697d673264946 | Python | 4,255 | 115 | import random
from dash import dcc, html
import mne
import RV.constants as c
# Add 'hide' to color options
COLOR_OPTIONS = c.ANNOTATION_COLOR_OPTIONS.copy()
COLOR_OPTIONS.insert(0, 'hide') # allows to hide annotations of a given label
def get_annotation_label_radioitem(annotation_label: str, color=None):
""... |
d604f389839c7aff787cad44fd4b63e0261d9a408ed702d784949573700ddb8f | Python | 4,255 | 143 | from .base import *
from ...image_tools.correct_drift import correct_drift
from dask_image.ndfilters import gaussian_filter
from .quot_localizer import BaseDetector, MaxLikelihoodLocalizer
from scipy.ndimage import gaussian_filter1d
from scipy.interpolate import interp1d
class CorrelationDriftCorrector(LocProcessor):... |
9dad3cf2f51de8ffdcbd2a56b52bf76d61551f1b0f7493d2bb0c08c78381fcfb | Python | 4,257 | 131 | # -*- coding: utf-8 -*-
"""The quit module provides classes for interfacing with the `QUIT
<https://github.com/spinicist/QUIT>`_ command line tools.
Heavily inspired by the FSL base class
"""
import json
from copy import deepcopy
from os import path, getcwd
from nipype import logging
from nipype.utils.filemanip impor... |
4185130a95d0ed67d2dc8461591558696b8f2712106b03af743cc091d84ce369 | Python | 4,258 | 141 | import os;
import xml.etree.ElementTree as ET
import csv
import threading
import re
#This function reads the file names and seperates the .cell.nml files from the rest of the files
def readfiles():
print("Processing ",len(os.listdir(dir)))
for filename in os.listdir(dir):
if(filename.endswith(".cell.... |
cad1302eee29005509bb9da780cd6705b1eafc1beede04de927e3b8b9747ea1e | Python | 4,259 | 112 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
075e3a39e4bc6c4469ca4d87b80eb5d23fdbd2e4e4d56bbf5f7cbdc93c8b14a2 | Python | 4,263 | 148 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 19 10:46:09 2022
@author: yuxiushao
"""
import numpy as np
import matplotlib.pylab as plt
import matplotlib
from numpy import linalg as la
from scipy import linalg as scpla
import scipy
# import seaborn as sb
from mpl_toolkits.axes_grid1 import ma... |
845d3a2e1921563d0ad50b1c941e1626d9b7b0144cee2fbf91f7c82a2b29fcad | Python | 4,263 | 104 | # Copyright 2023 Google Research. 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... |
27dd83923fa4ef00b99d85f5059b4b9fa604ecc2dcd48f25f999bec591dc189e | Python | 4,266 | 87 | #!/usr/bin/env python
# Copyright 2014 Johns Hopkins University (Authors: Vijayaditya Peddinti). Apache 2.0.
# normalizes the wave files provided in input file list with a common scaling factor
# the common scaling factor is computed to 1/\sqrt(1/(total_samples) * \sum_i{\sum_j x_i(j)^2}) where total_samples is sum ... |
6831db2dd9eb0b3faae952d2460d79d8665cdf1aa94c72ec8a8742cb6512703e | Python | 4,267 | 107 |
import paddle
import argparse
import cv2
import numpy as np
import os
from models.model import FaceSwap, l2_norm
from models.arcface import IRBlock, ResNet
from utils.align_face import back_matrix, dealign, align_img
from utils.util import paddle2cv, cv2paddle
from utils.prepare_data import LandmarkModel
def get_id_e... |
76db7e5ec99f280ee0c6a93cb2714d926c578d7e80d98da6c7c17f94a36d7029 | Python | 4,267 | 129 | """Test the reading and writing of Kaldi files."""
import csv
from typing import List
from typing import Optional
from unittest.mock import MagicMock
import pytest
from pytest_mock.plugin import MockerFixture # type: ignore
from fi_parliament_tools.segmentFiltering import io
def test_read_ctm_segmented() -> None:
... |
eeb65f24be296ccc361db91473cece54dcd4b73ff29d1a61505c3696d9c97e9e | Python | 4,270 | 122 | #!/usr/bin/env python3
"""
File: cellmap_reference_profile.py
Created: 2020/04/06
Last Changed: 2020/04/26
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
th... |
a23eef7e4558570d5bf8b700dcda50ff0c79ebb0ef70ba6a86a47211d3e81bf4 | Python | 4,271 | 115 | #!/usr/bin/env python3
"""
File: compare_marker_genes_with_truth.py
Created: 2020/07/10
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fre... |
d091ec6d24eb6705560faa73e446e71fbec1fdfd169297b26b80b95529dbbdf8 | Python | 4,271 | 134 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module with useful functions for the tracking.
Created on Mon May 6 11:49:30 2019
@author: nicolas
"""
import numpy as np
def get_rules(image, remove_contradictions=True):
"""
Return the row-order rules between the labelled regions as a 2D array.
... |
ecbc5b8688ed2d5e7c6d9b1aaba5e4cfa70ecb089a289c6be26706e720dcad39 | Python | 4,273 | 129 | import argparse
import os
import time
import autokeras as ak
import kerastuner
import medmnist
import numpy as np
import tensorflow as tf
from medmnist import INFO, Evaluator
from medmnist.info import DEFAULT_ROOT
from tensorflow.keras.models import load_model
def main(data_flag, num_trials, input_root, output_root,... |
54f3769a996587a793e700aaff0246d4fa2c09302b2e5e816f4ca4ef103eff7a | Python | 4,274 | 75 | """OpenDRIVE from a NuRec artifact -> a copy Scenic's parser accepts.
The exporter writes junction connections whose incoming road is ``-1`` (none) or a road that itself belongs to a junction,
and junctions that end up with no usable connection at all. CARLA's OpenDRIVE loader ignores those; Scenic's
``xodr_parser`` o... |
1f767380cbdd235b916199e7f76a7999e290c963902e852d5880cfe905be86d9 | Python | 4,275 | 141 | import pandas as pd
from sklearn.manifold import MDS , LocallyLinearEmbedding
from analysis import *
from datasets import *
import numpy as np
import numpy as np
from sklearn.datasets import make_circles
from scipy import stats
from datasets import *
def genes_score(data,path):
'''
:param data: s... |
358fe3c88d4384130a58ff19334356992376441b2f7be66d5b06cd2c27c007c6 | Python | 4,276 | 155 | import torch
import torch.nn as nn
import numpy as np
class Flatten(torch.nn.Module):
def forward(self, x):
batch_size = x.shape[0]
return x.view(batch_size, -1)
class unFlatten(torch.nn.Module):
def forward(self, x):
batch_size = x.shape[0]
return x.view(batch_size, 1, 32, 32... |
834fc56697ae2d37e224a35c1530dfe4dd6f3db640c8d9f2331c11d533304147 | Python | 4,276 | 91 | #!/usr/bin/env python
# Copyright 2017 (author: Chun-Chieh Chang)
# Generate a topology file. This allows control of the number of states in the
# non-silence HMMs, and in the silence HMMs. This is a modified version of
# 'utils/gen_topo.pl'. The difference is that this creates two topologies for
# the non-silence H... |
34f76c1b9234dc81af3d92b3303c28717789d218aa16ae79ea186eaf136da7cf | Python | 4,277 | 132 | # -*- coding: utf-8 -*-
# File : comm.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 27/01/2018
#
# This file is part of Synchronized-BatchNorm-PyTorch.
# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
# Distributed under MIT License.
import queue
import collections
import threading
... |
e9c08fe54943d72aa8c4e281b804c6043bae0d40a429e675232ebc339e4c5735 | Python | 4,277 | 123 | import os
import pickle
import pandas as pd
import numpy as np
import flydf
import utils_Florian as utils
if not os.path.isdir(utils.output_dir):
raise RuntimeError(f"Output directory {utils.output_dir} does not exist. It is specified in utils.py and created by 00_trials_for_paper.py.")
df = pd.read_pickle(os... |
28c80200ba05c6f09ada9197dc1f42f2b4def5366ddc31d15485494168870a93 | Python | 4,278 | 124 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 ... |
a480d504d651eef51b8419254f00d97d5f0b2d9a4af590713605c0148725b234 | Python | 4,278 | 131 | # -*- coding: utf-8 -*-
# File : comm.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 27/01/2018
#
# This file is part of Synchronized-BatchNorm-PyTorch.
# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
# Distributed under MIT License.
import queue
import collections
import threading... |
d2ef16287e07238204290230ad87bed105f2a61c46cd2c326aa95597c980a5ac | Python | 4,279 | 95 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
7e0e18d6e38bf04cfe0378e7be876909fd3f8347398abd5fd631095669b895a5 | Python | 4,280 | 91 | from config_save import str_gen
def height_list_cpt(net_structure, in_height, kernel_size, stride, padding, pooling_size, pooling_stride, is_in=False):
result = []
k_idx = 0
p_idx = 0
if is_in:
result.append(in_height)
current = in_height
for i in range(len(net_structure)):
... |
5170a7002d994ae57f342a81224969ba48efef2dffc6e231f05fa7d32d732eaf | Python | 4,282 | 145 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from pandas import DataFrame
import argparse
from keras.models import load_model
import cv2
import os
import glob
from keras import backend as K
def make_dir(dir_):
if no... |
37812fabd5dfc13c4ecf42ede9dfbbe34b56fff1d0dbc0d331a7cab21cd99934 | Python | 4,283 | 130 | from concurrent.futures import ProcessPoolExecutor
from functools import partial
import numpy as np
from omegaconf import OmegaConf
import os
import tqdm
from scipy.io.wavfile import write, read
import torch
import glob
from pysptk import sptk
from random import shuffle
import math
from argparse import Argu... |
58ebb38e54a99c44e5fdd7779383d7b22b46cfd19df1150a11dc3c8f8dc21729 | Python | 4,283 | 99 | #!/usr/bin/env python3
# encoding: utf-8
# @Time : 2017/12/16 下午8:41
# @Author : yuchangqian
# @Contact : changqian_yu@163.com
# @File : cityscapes.py
import numpy as np
import os
import torch
from datasets.BaseDataset import BaseDataset
class Cityscapes(BaseDataset):
trans_labels = [7, 8, 1... |
f43ccaae0574248aa01f5d4af564ca0e10a632c7e4f1758f1786859e46ad59ff | Python | 4,284 | 115 | #!/usr/bin/env python
# Copyright 2014 Gaurav Kumar. Apache 2.0
# Extracts one best output for a set of files
# The list of files in the conversations for which 1 best output has to be extracted
# words.txt
from __future__ import print_function
import os
import sys
import subprocess
latticeLocation = 'latjosh-bmm... |
3623f584d52360f42d850e3468153881a88010b1fa38dd23e097a74547cd38ec | Python | 4,285 | 147 | """Example script for training DIVE on HMM simulated data.
- Should achieve a dice score of ~0.99.
"""
import os
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from osl_dynamics import data, simulation
from osl_dynamics.inference import metrics, modes, tf_ops
from osl_dynamic... |
f9814775ad074269775a3738457ce38bda0c3603d75b03bd0602cea2624f3dc8 | Python | 4,285 | 117 | import numpy as np
import torch
from mmcv.ops import nms
from ..bbox import bbox_mapping_back
def merge_aug_proposals(aug_proposals, img_metas, rpn_test_cfg):
"""Merge augmented proposals (multiscale, flip, etc.)
Args:
aug_proposals (list[Tensor]): proposals from different testing
scheme... |
e3ec4efbc99169d7486fe84e01a0d6928a4011a04d8142557a7559a71ee2c825 | Python | 4,286 | 97 | ##########################################################
## ccAF: classifyPrimaryCells_musMusculus.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
020fd95aafe6bf765fdfdad5cdd64a9186b797cf77d5270fb7ffa0bfdbd36344 | Python | 4,287 | 97 | import collections
import pandas as pd
import inspect
import re
import os
import numpy as np
import itertools
import tqdm
import AIS_interp
import functions_basic_sak as funsak
from sklearn.cluster import DBSCAN
from scipy.interpolate import interp1d
import AIS_infer_mmsi
import AIS_parameters
import PI... |
76b6cea06db4e5a2adf4cc51eec42a78780c9ec77554ca339e4b8f29e424edd4 | Python | 4,287 | 118 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
from matplotlib.ticker import ScalarFormatter
class Plot :
TEXT_elements = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
IMG_elements = ['r0','r1','r2','r3','r4','r5',... |
92b89c01f5419b86f05a1ea1414809933654dfa1010576dc5cbdbd0030a00f48 | Python | 4,288 | 109 | from functools import partial
import random
import torch
import torch.nn.functional as F
def DiffAugment(x, types=[]):
for p in types:
for f in AUGMENT_FNS[p]:
x = f(x)
return x.contiguous()
# """
# Augmentation functions got images as `x`
# where `x` is tensor with this dimensions:
# 0 ... |
9e16805edd1c99780ed6b5bf5094d07875beae7cdf30aba03a766e51429892fe | Python | 4,288 | 120 | ####################################################################################################
# Copyright (c) 2020, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis>
#
# This program is free softwar... |
2d5db5b949328234cdb637bc2d7016da2b235c788177088f2a48e87382dc807e | Python | 4,290 | 119 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
3a33130a46c9081d45f7da6a9958f61cc4a8994f5f5516a2cfe8543f3b4cc847 | Python | 4,291 | 110 | from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model.utils.config import cfg
from .proposal_layer import _ProposalLayer
from .anchor_target_layer import _AnchorTargetLayer
from model.utils.net_utils import _smooth_l1_lo... |
62bfd618c65c6c685c648e8962ca7cc7bce3117745ce17fdeb73402d5a47412b | Python | 4,291 | 126 | """
File: cmd_line_arguments.py
Created: 2020/03/13
Last Changed: 2020/03/20
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eit... |
9646459b0bd5d4b9547d1612d6fc177148bbd2e10d53137066e0a46de219d826 | Python | 4,292 | 134 | import os
import numpy as np
import torch
from util.datasets import TrajectoryDataset
from .label_functions import label_functions_list
from .augmentations import augmentation_list
from util.logging import LogEntry
from .preprocess import *
import pickle
ROOT_DIR = 'util/datasets/mouse_v1/data'
# CalMs21 dataset un... |
774682d1848b659c575bddb7b1162e12b97db2178cafeefdaf0c80b15906211d | Python | 4,293 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
# -- Path setup --------------------------------------------------------------
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sy... |
8bf7bf37b7b0802323f6e1b95b3dc5cf4803a35869b2b3b6dab23885f46d7dc5 | Python | 4,294 | 123 | from typing import Iterable
import torch
from .correct_answer import _is_correct_output_batches
def correct_answer(
output: torch.tensor, target_output: torch.tensor, fixation: torch.tensor
) -> torch.tensor:
answer_indexes = torch.where(fixation == 0)[0]
return _is_correct_output_batches(
outp... |
c2279e3d5893d0dc61e7d3985a6d71eb198768a19d3ad24ad29aceaedf90eada | Python | 4,295 | 141 | import os
from skimage import io, transform
from skimage.filters import gaussian
import torch
import torchvision
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms#, utils
# import torch.optim as o... |
63d9a6f3822666d4117d87e8e0fcf7b2bdd49fe60395eed36a16d0e1f53a9add | Python | 4,298 | 105 | #! /usr/bin/env python
# Copyright 2020 Desh Raj (Johns Hopkins University)
# Apache 2.0.
"""This script uses forced alignments of the AMI training data
to generate an RTTM file for the simulated LibriCSS data.
This "new" RTTM file can be used to then obtain new segments
and utt2spk files. We do this because the o... |
9de4da8f5b4774088a02550afc3974a21a59e841b23b15d3f21630d68550200f | Python | 4,298 | 158 | """Elekta Task Dataset: TDE-HMM Pipeline.
In this script we train an Time-Delay Embedded Hidden Markov Model (TDE-HMM)
on source reconstructed task MEG data.
The examples/toolbox_paper/elekta_task/get_data.py script can be used
to download the training data.
Functions listed in the config are defined in osl_dynamics... |
82cb915cc5a0b554e93c8762b4c3566ce174e419e6924940e0b77948fc318d88 | Python | 4,299 | 124 | # Encode alignment file using a weighting scheme derived from Krogh et all (1995).
# Duplicates are filtered and external gaps are skipped.
# No gap is considered to calculate the weight of the sequence.
# Clipping of the AA in the query sequence is implemented as in https://doi.org/10.1101/289033.
# Usage: python3 pr... |
c07f78bb2cd5194edce920ddeed68e376ee369d32b5fb936954bfef6e955b477 | Python | 4,299 | 115 | #!/usr/bin/env python
# Copyright 2014 Gaurav Kumar. Apache 2.0
# Extracts one best output for a set of files
# The list of files in the conversations for which 1 best output has to be extracted
# words.txt
from __future__ import print_function
import os
import sys
import subprocess
latticeLocation = 'latjosh-2-c... |
0c1802306279c330662652254fb0ec064af047e8e0ee75523aae74c5e44391e4 | Python | 4,301 | 131 | '''
Figure 7.
Example of trace: V, I and cos(angle).
'''
from brian2 import *
import yaml
from file_management import *
from pylab import *
import matplotlib.font_manager as fm
import os
from scipy.signal import butter, sosfilt
from fitting import *
from plotting import *
from matplotlib import gridspec
from mpl_toolki... |
1c01488e0544ed5f45150f5cc37373bb7d86d621f7e1f06c1133f3f03c4a80f4 | Python | 4,301 | 103 | import unittest
from unittest.mock import MagicMock
from oaklib import get_adapter
from oaklib.datamodels.vocabulary import HAS_DEFINITION_CURIE, RDFS_LABEL
from tests import INPUT_DIR
TEST_PMID = "PMID:21873635"
REAL_RECORD = INPUT_DIR / "pubmed-efetch-21873635.xml"
EDGE_CASES = INPUT_DIR / "pubmed-efetch-edge-cases... |
6d05ed9038e86f12cd968abfa541ed40ff7abf496a517c205766f64823f51754 | Python | 4,304 | 119 | """Extract the mushroom-body subgraph from the larval connectome.
Returns a sub-connectome containing KCs, MBONs, MBINs (DANs + OANs + modulatory),
plus the projection neurons (PNs) that feed odor information into the calyx.
"""
from __future__ import annotations
from dataclasses import dataclass
import numpy as np... |
793146fc47d978eeb4d3b151042bfee95fc138610bf2f79bf08d49f2fdf96e4f | Python | 4,306 | 114 | # Copyright 2023 Google Research. 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... |
bb13f8a627b26015ffcbfb6f865bda087a80a14d859342d16196d512f2ba6194 | Python | 4,306 | 167 | # SRC: https://github.com/Image-Py/sknw/blob/master/sknw/sknw.py
import numpy as np
import networkx as nx
from Centerline.graph_utils import subsample_graph
def neighbors(shape):
dim = len(shape)
block = np.ones([3] * dim)
block[tuple([1] * dim)] = 0
idx = np.where(block > 0)
idx = np.array(idx, d... |
df9bfac9b0ba39d39164d0cfd5cd5e500700bdb5b82c7d94c3af2757ef7b7d96 | Python | 4,308 | 124 | import torch
import numpy as np
def fit(train_loader, val_loader, model, loss_fn, optimizer, scheduler, n_epochs, cuda, log_interval, metrics=[],
start_epoch=0):
"""
Loaders, model, loss function and metrics should work together for a given task,
i.e. The model should be able to process data outpu... |
d5424cc5cf8eff60e27f5b1f06f5b375948b29a45e77dd768ec43bbb767d922c | Python | 4,309 | 119 | # This script is part of navis (http://www.github.com/schlegelp/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
a35370032b88471689225a8e985fe2356ac6ac540eb4e4a8a5c27396136c40cc | Python | 4,310 | 121 | """Vectorised operations over embedding matrices."""
from typing import Optional
import numpy as np
__all__ = [
"cosine_similarity_matrix",
"jaccard_similarity_matrix",
"weighted_jaccard_similarity_matrix",
"similarity_matrix",
]
_MAX_TEMP_ELEMENTS = 10_000_000
"""Upper bound on the size of tempora... |
80981a2694d68006c7eaca8e5a5eeb0b161e8c93a9fc5bb1f1a4d5543bdd66d4 | Python | 4,312 | 134 | """
File: combine_gte_files.py
Created: 2020/10/08
Last Changed: 2020/10/12
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eithe... |
13972f785c5ce4db452bf9b582de224aa2d44a1c94c6ec32b1b3c30d6dd81b09 | Python | 4,313 | 156 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from joblib import Parallel, delayed
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.a... |
a89f84800918a654039cf4f27b1fdefeeca5947f7981428d31bc9171c68bc8a2 | Python | 4,313 | 107 | #%%
from pymaid_creds import url, name, password, token
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import numpy.random as random
import cmasher as cmr
from contools import Celltype, Celltype_Analy... |
f9e340c5348052a56c31e114829a3c606042cf6b5debda2e4d66f1eb9090af2a | Python | 4,313 | 104 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
364b2e28b13f3ed10189c508ccce5e12878b33c0cdad1fb2a2be7b4b96beadf6 | Python | 4,317 | 119 | import pandas as pd
import torch
from dataset import ViscosityDataset
from torch.utils.data.dataloader import DataLoader
import argparse
import glob
import os
import numpy as np
from model import ViscosityNet
from utils import seed_everything
from utils import generate_eisenberg_grids, get_eisenberg_grids
from utils... |
7bfe86721f0c5f26f75012868839c78947544b8e1f61e1cbe24c5bee4d8ed8ce | Python | 4,318 | 144 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 agree... |
1447c27ac00da9fa6d3fad4418b90f69e042793210716be1a0ee92d0f63eb5d3 | Python | 4,319 | 112 | '''
Inspired by https://stackoverflow.com/a/24092195
Use `run_parallel` function to parallelize a job.
Important:
- Threads have access to the same memory.
- Must be careful that they don't overwrite some shared object.
- Can cause a slowdown when reading shared memory.
- The most natural way to avoid these prob... |
bd8656d935513af87a75413ff31240c4b37f5a7250eb0282ac47bf0380654901 | Python | 4,321 | 177 | # %% [markdown]
# ##
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import Node, NodeMixin, Walker
from graspy.embed import OmnibusEmbed, selectSVD
from graspy.models import DCSBMEstimato... |
3cd40ab25717286b735dbe018328e07b6f1fcb512061c134d85386eb0157a870 | Python | 4,322 | 145 | # model settings
input_size = 300
model = dict(
type='SingleStageDetector',
pretrained=dict(
use_load=True,
load_path='./seed_mbv2.pt',
seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2
),
backbone=dict(
type='FNA_SSDLite',
input_size=input_size,
net... |
4952da606156ca22467a216166a87a4467d87d667977c51c31498ae093df70fa | Python | 4,323 | 110 | # Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# 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 agre... |
ca59a72c6aca6fce5d92d1de73fef5fa15f302b1d6ce2da4787e6ff12c7ff925 | Python | 4,323 | 116 | from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.utils.introspection import package_schemaview
from oaklib.datamodels import obograph
from oaklib.datamodels.vocabulary import IS_A
from tests import output_path
from tests.test_datamodels import AbstractDatamodelTestCase
class TestOboGraphDatamodel(A... |
0aa89d717c70ca439e73aebd796057be6ca6a230238ce28a7ad5bb6311ade8b3 | Python | 4,325 | 113 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
8a82cc53ec7d1570e8c22ec780125dc5720b3023c6c9af8c290415bc31ec0fbc | Python | 4,325 | 112 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
a8114d90855a36420506b80e19d3554f42c2a5c523c54eff8fca0a3eb406fb9f | Python | 4,325 | 151 | # %% [markdown]
# ##
import pandas as pd
import numpy as np
# connector_loc = "maggot_models/data/processed/2020-06-10/connectors.csv"
# connectors = pd.read_csv(connector_loc, index_col=0)
# sizes = connectors.groupby(
# ["connector_id", "presynaptic_type", "postsynaptic_type"]
# ).size()
# sizes.name = "count"
... |
b5a69e000c49856685e16bc99d964b60f27e8b97ab20c3564526eb7a68724343 | Python | 4,326 | 154 | #%%
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from mpl_toolkits.axes_grid1 import make_axes_locatable
from graspy.plot import gridplot, heatmap
from src.data import load_networkx
from src.utils import meta_to_array, savefig
from src.visualization... |
63f460f430a51c7b6d0ca02c1f84e493504ce1befe4c994a5a30ebd77a4a82cd | Python | 4,327 | 132 | import datetime
import cPickle
import os
import random
import sys
import time
from multiprocessing import Process, Value
from threading import Timer
from config import Config
class NumericalInstabilityException(Exception):
pass
class NeuronRunner:
def __init__(self, target, kill_slow_sims=True):
self... |
81fd1619714bf805e0aa1146e2340605c02df3c79f739744270ad9911841700e | Python | 4,327 | 139 | import torch
from torch.nn import Parameter
import torch.nn.functional as F
import torch.nn as nn
from torch_scatter import scatter_add
from torch_scatter import scatter_mean
from torch_geometric.utils import remove_self_loops, add_self_loops, softmax
# torch_geometric import
from torch_geometric.nn.inits import uni... |
19010d7005a1b936abc35073c0eb4c302314b1347086106f2264b8923672a0ac | Python | 4,328 | 201 | """
From https://github.com/wanghao14/Stain_Normalization
Uses the spams package:
http://spams-devel.gforge.inria.fr/index.html
Use with python via e.g https://anaconda.org/conda-forge/python-spams
"""
from __future__ import division
import numpy as np
import cv2 as cv
import spams
import matplotlib.pyplot as plt
... |
45918b629c1803a81b972a8a94db0ccf2214992cdf2752a0908568f7938973a0 | Python | 4,332 | 107 | import json
import os
import numpy as np
import argparse
'''
Script for converting CalMS21 .json files into .npy files, with discovered keypoints.
Based on script provided by CalMS21 dataset: https://data.caltech.edu/records/1991
The .npy files have the same dictionary layout, except the entries are
numpy arrays ins... |
504e48f7cab41890883d1ab7ea2452955baa4e68c11951aa246f451da076a97e | Python | 4,332 | 97 | #!/usr/bin/env python3
# Copyright 2020 Ivan Medennikov (STC-innovations Ltd)
# Apache 2.0.
"""This script modifies TS-VAD output probabilities applying
absolute threshold (--threshold) and relative threshold (--multispk_threshold) for pi/(p1+p2+p3+p4)
(to exclude overlapping regions from i-vectors estimation)"... |
e59a4308f55718431219a5d045a85d44faf861893e61093b189221f9cbdded00 | Python | 4,333 | 90 | #! /usr/bin/env python3
"""Python API, Transfer 2.5 AV over the seven NVIDIA cameras with an hdmap+bbox scene.
python api_av_multiview.py --clip ./clips/av7_town10_30fps [--views 3] [--no-view]
The clip must come from the ``nvidia_av7`` rig at 30 fps with a scene package
(``av7_world_scenario.py --capture-only`` ... |
1540a4d5db29225bd3cd40f7580bceae5b175b41b1fd656d00bb8979ca33c174 | Python | 4,334 | 101 | """Rank loop for Transfer 2.5 general: ``Control2WorldInference`` on every rank (see ``common.ranks``).
``torchrun --nproc_per_node N -m cosmos_workers.transfer25.ranks --context-parallel-size N ...``
with N = the GPUs given to the worker; ``N == 1`` runs the same loop as a plain child process.
"""
from __future__ im... |
d2160c3a54236e5ba330e18174ae3db2eb8978c3e96dbd7c0ddd57e0077e326a | Python | 4,334 | 118 | import os
from os.path import join
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (mean_absolute_error, mean_squared_error,
... |
edbab0a411fc2a855c30e45610f0afe386eb5a783b6c6262912e02fa692586a0 | Python | 4,334 | 112 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
aa511345a2f0e069687b5998831e3cd8e794656064255d91d5b1a181253c9c70 | Python | 4,335 | 149 | """Constants describing the MedMNIST-NAS-Bench schema.
These are kept in code (not just docs) so that downstream users can write::
from medmnist_nas_bench import METRICS_EPOCH_FULL
for m in METRICS_EPOCH_FULL:
...
and have the lists be authoritative.
"""
from __future__ import annotations
SCHEMA_VE... |
6644faf56d2845af14a63f855a8f6402c79893a3d8dc91be908ce870265f88b7 | Python | 4,338 | 130 | import argparse
import os
import time
import autokeras as ak
import kerastuner
import medmnist
import numpy as np
import tensorflow as tf
from medmnist import INFO, Evaluator
from medmnist.info import DEFAULT_ROOT
from tensorflow.keras.models import load_model
def main(data_flag, num_trials, input_root, output_root,... |
778e85a9bb7f1374ea7f8087ad939d3721b2afaf24eac34d619b68a10e035a6e | Python | 4,338 | 117 | import os
from os.path import join
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (mean_absolute_error, mean_squared_error,
... |
158b0f6e246863d087736e49b1c150c1f7b74ab0750ae5f09289c5f886618dc1 | Python | 4,340 | 120 | import argparse
import json
import os
import torch
import numpy as np
from torch.utils.data import DataLoader
from util.datasets import load_dataset
from lib.models import get_model_class
def extract_features(exp_dir,
trial_id,
test_name,
save_name):
... |
69c032ae863a300b2f71b6786350fe920597b1a3609513c1c7522c9f84d5e00a | Python | 4,340 | 147 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import Any, Dict, List, Union
import xml.etree.ElementTree as ET
import requests
class Mapping:
"""
Class for mappin... |
c45ce416ad18b53c843066287f47c6a0ef294ef9385fdeeda4c14d0b55ed3394 | Python | 4,340 | 142 | import logging
import sys
import warnings
from dataclasses import asdict
import chika
import numpy as np
import pandas as pd
from imblearn.metrics import geometric_mean_score
from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metri... |
c9f150c53676b3259ddeae2cb16a3a8995bd5fb2f53a4650b69e54bdd09ca12d | Python | 4,341 | 120 | """
File: create_cov_matrices.py
Created: 2020/10/08
Last Changed: 2020/11/20
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eit... |
6fbd8f6eb13afa97498d9da3c70e7a45266ec631291907b3d23ebad09d934c89 | Python | 4,342 | 133 | """
File: local_settings.py
Created: 2020/03/19
Last Changed: 2020/03/20
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either ... |
dd7796bcd6e1bc4b9054538f75e660c9d1b4e1b455b1939a7f7d3bc7c5be006f | Python | 4,344 | 97 | import torch
import torch.nn as nn
from torch.nn.init import kaiming_normal_
from drugex import DEFAULT_DEVICE, DEFAULT_GPUS
from .layer import PositionalEmbedding, PositionwiseFeedForward, SublayerConnection
from .layer import pad_mask, tri_mask
from drugex.training.models.encoderdecoder import SmilesFragsGeneratorBa... |
26169325502d08545f5a842f64469c50106c12b70cd2baf4cd7dedef8d90126e | Python | 4,348 | 121 | from ase.calculators.calculator import Calculator, all_changes
from PaiNN.data import AseDataReader
import numpy as np
class MLCalculator(Calculator):
implemented_properties = ["energy", "forces"]
def __init__(
self,
model,
energy_scale=1.0,
forces_scale=1.0,
# stress_sc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.