sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
dbf212321efdf0f8bec6251dfee74da2d2344ff2b5dcfbc4893e3bc7d44f8526 | Python | 13,086 | 444 | """Tests for lazy out refs, drift checks, and nested rehydration."""
from __future__ import annotations
import gc
import json
from pathlib import Path
from typing import Any
import pytest
import safetensors # noqa: F401
import torch
from torch import nn
import torchlens as tl
from torchlens import load, save, trac... |
161bd580a7e72a36d26661b737fd06b8e308552a6b5a214a9e775e6305bcb104 | Python | 13,087 | 307 | """Narrow class-method shadow filter for portable ``__setstate__`` loads.
A portable data class rehydrates from a pickled ``state`` dict via
``self.__dict__.update(state)``. Round 54 ``sec_3`` showed that an attacker who
plants a ``state`` key shadowing a class-owned method (``_internal_set``) turns
the instance attri... |
01efaf72193fdf5a3509844055ad7c0886c3dd8e32e25eb0bc7ffa0b09036d0b | Python | 13,091 | 260 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
ed21583ff38322fc96648e35c3b4cf614b756cc7dfc51e9c01d8452672a694bb | Python | 13,091 | 368 | """MongoDB result store backend."""
from datetime import datetime, timedelta, timezone
from kombu.exceptions import EncodeError
from kombu.utils.objects import cached_property
from kombu.utils.url import maybe_sanitize_url, urlparse
from celery import states
from celery.exceptions import ImproperlyConfigured
from cel... |
b1fe9523afbf57127fd3e8241615ce6d51764bf02f072f618f9a8db836a93fd3 | Python | 13,093 | 323 | """Attested coupling on REAL model classes (lane F42; foldA s6 F42 arms).
The realism rule: toy-only validation is disqualifying. The R0 roster's real
distilgpt2 and Llama-family classes (vendored configs, zero network) carry
the coupled arms: interventions before/inside/after generation steps,
changed tokens, zero an... |
f910e70b0c3ef3e5c3c157d18e5ce3dae60435c4559b62f9e9c56873d1c443bf | Python | 13,097 | 274 | #!/usr/bin/python3
##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
#... |
7242bbc7064a3b8d8fbf363b8ef135da185bacdc1f7cc4e40547fdc8858ecb2b | Python | 13,098 | 355 | """The package ships ZERO deprecation shims — and stays that way.
History: this module was the R48 deprecation census. It inventoried eleven
families (~183 deprecated spellings: moved top-level names, paper-era API
shims, warning flat option kwargs, renamed callables, alias properties,
no-op kwargs/functions, deprecat... |
e85d6ea570db434136c0f1574e95a5e8fcdeab5de6284b9eb86378f3e6bae9b0 | Python | 13,098 | 318 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# +
from pat... |
0528c9d9a722cfb22b1978a70503cdd0a9d9dd3f7e0a762bbbf67a4d07878e02 | Python | 13,103 | 292 | # SOURCE: vendored from qugank/sketch-lattice.github.io @ 6ed272f8b4bd9b77860e4cc2b48bfb3375becdb6
# https://raw.githubusercontent.com/qugank/sketch-lattice.github.io/6ed272f8b4bd9b77860e4cc2b48bfb3375becdb6/encoder.py
# https://raw.githubusercontent.com/qugank/sketch-lattice.github.io/6ed272f8b4bd9b77860e4cc2b48bfb337... |
2f2b6c9986f26c701b42a5727cfbd392a8233fc602c2ed087def893159e61bef | Python | 13,103 | 436 | """Features that are depending on the inter-spike intervals."""
from __future__ import annotations
import logging
from typing_extensions import deprecated
import warnings
import numpy as np
from efel.pyfeatures.cppfeature_access import (
_get_cpp_data, get_cpp_feature
)
logger = logging.getLogger(__name__)
@dep... |
deaefc9e2f1afa89a853825f1abd9270bb3e29809f32bdf2edbbf1cda2767d1d | Python | 13,103 | 401 | """Written by @Jinerhal, adapted by @Xiaojieqiu.
"""
import math
from typing import List, Optional, Tuple, Union
import cv2
import numpy as np
from skimage import morphology
from ..configuration import SKM
from ..logging import logger_manager as lm
def fill_grid_label(
adata,
spatial_key,
seg_grid_img,... |
ea86d2aea74fd2817f4d9ddb787bb3b6c321b1a66a76376e2f5de09929016d53 | Python | 13,106 | 311 | """Terminology lint -- the glossary's first mechanical enforcement (SPEC, normative).
The completeness audit found the glossary LOCKED governance-side with zero
mechanical enforcement (DIGEST-AUDIT 3b, miss r2-MISS-20). This module is the
structural fix: the terminology rules that are already ruled and mechanically
ch... |
f25a2c56e910fdbc30ed2a355a8e902e1b508b75cb801f4f659bc5256ccd5fc0 | Python | 13,109 | 273 | #!/usr/bin/env python3
"""
File: export_correlations_to_excel.py
Created: 2022/07/04
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source... |
3b6dcb03822a488ef97315fb8c2a111b1130fffeae5041ef28842ddae11a4211 | Python | 13,110 | 369 | import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from timm.models.registry import register_model
from timm.models.vision_transformer import _cfg
import math
class Mlp(nn.Module):
def __init__(self, in... |
499646ab20496a4546b647234233e3f7f17793949f695c94765fd8ef0abae804 | Python | 13,110 | 350 | #!/usr/bin/env python3
"""
File: create_comparison_scatterplot2.py
Created: 2023/06/22
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this sour... |
7843987f1e9072a21890859f75fbe0b84b37558a4798793ad0040b8239175f4a | Python | 13,110 | 339 | """
Bundles general utility functionality not directly related with the actual analysis
"""
import logging
import pickle
from os import path
import numpy as np
import matplotlib.pyplot as plt
import time
import os
import sys
import torch
from torch import nn
import albumentations
import pandas as pd... |
b9317f088612262d74883a452d1a6adf21f183a2760bd67520466118dbe570e5 | Python | 13,111 | 386 | """Utils for Semantic Segmentation"""
# pylint: disable=consider-using-enumerate,redefined-builtin,broad-except
import threading
from mxnet import autograd
from mxnet.gluon.utils import split_and_load
from mxnet.ndarray import NDArray
try:
import Queue as queue
except ImportError:
import queue
__all__ = ['Da... |
2519ab1246377566efa9256c4170c1b76b38deb7a65c493fe28ea41d55a3682c | Python | 13,115 | 324 | #!/usr/bin/env python3
"""
5D Eval — Paper 5 eval: does IAF / DFA pass Paper 5's 6D criterion?
Paper 5 Table 5 criterion: candidate sixth dimension must produce
monotonic |dz| ≥ 0.30 on BOTH Sleep W→N3 AND Cambridge BL→Mod.
This script extracts IAF and DFA per epoch from Sleep (W, N3) and
Cambridge (Baseline, Moderat... |
acdeb06699f19ec508ea19a3ca0c46af97d309068948085e64b103948828ec01 | Python | 13,116 | 356 | """
Model Sub-Objects
=================
Introducing the objects used within the model object.
In order to flexible fit model definitions to data, the Model object needs to manage
multiple pieces of information, including relating to the data, the fit modes,
the fit algorithm, and the model results. To do so, the mode... |
5344d090b59dbad5473611c778a83173ea7124ecfacf42fbf525d901cf4cf28e | Python | 13,118 | 359 | """Input-preprocessing provenance seam for dataset extraction (tvscope B4/B5).
Split out of :mod:`torchlens.dataset_extraction` under the R43 size ratchet:
the manifest ``input_preprocessing`` block builders, the ``input_transform=``
/ ``input_provenance=`` coercion door, the per-batch input applier, and the
legacy-to... |
6f71e475394498b9207f284d953ae055798154eeb3746ba207589a13b6be9801 | Python | 13,118 | 363 | import os
import numpy as np
import pandas as pd
from typing import Union, List, Optional
from torch.utils.data import DataLoader
from pytorch_lightning import LightningModule, Trainer
from eugene import settings
import xarray as xr
import seqdata as sd
from ._utils import PredictionWriter
def predictions(
model:... |
0de62ba6b2dae22d51673e08c242910ce3493379245adac0fd80965f76ed7079 | Python | 13,123 | 454 | def check_args(argv):
'''This programme should utilise a multicore approach to assigning peaks in a memory efficient way by breaking the
process up into chromosomes and seperating the files out as such so that only one needs to be loaded into RAM at a time.
'''
# step 1: Check we have all the file... |
3f88a45f7a7ad25b988eda5486d67d04a708f6d187b65a00eb7ddb0371800405 | Python | 13,123 | 349 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Modebar(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_st... |
1a37ccada860cc51bfcdccc125066b2e9d8795212b4afcc3e6596dea8264136e | Python | 13,127 | 331 | from typing import Optional
from dataclasses import dataclass
import cutlass
import cutlass.cute as cute
from cutlass import Int32, const_expr
from quack import copy_utils
"""
This consolidates all the info related to sequence length. This is so that we can do all
the gmem reads once at the beginning of each tile, r... |
6f5438f2adfafc3aa546b4622098c7301075a643b1db2e3a2ce0d146d94c3771 | Python | 13,127 | 271 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
87b23dc20464f1dd29ebed0ec53b231d7c7bde75a8b2fee27698df5015623682 | Python | 13,143 | 335 | """
# Code adapted from:
# https://github.com/mapillary/inplace_abn/
#
# BSD 3-Clause License
#
# Copyright (c) 2017, mapillary
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistribution... |
ff24025d4add789c711bb9b457c725ca4e1d1cadcea62821c760183872ea819f | Python | 13,152 | 378 | from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.layers.merging.base_merge import Merge
from keras.src.utils.numerical_utils import normalize
def batch_dot(x, y, axes=None):
"""Batchwise dot product.
`batch_dot` is used to compute dot product of `x` and `y` when
... |
314088041bacd4c17bbbf74995b2fb2a06d839fc8a162a0038f80b090f61327c | Python | 13,153 | 307 | """
ISA datatype
See https://github.com/ISA-tools
"""
import json
import logging
import os
import os.path
import re
import shutil
import tempfile
from typing import (
TYPE_CHECKING,
)
logger = logging.getLogger(__name__)
# Imports isatab after turning off warnings inside logger settings to avoid pandas warning ... |
ca247d15978d577c13177766a363cd3eae11f1124dc552ecd1a1419a21fb7157 | Python | 13,165 | 381 | import copy
import numpy as np
from mirp._data_import.generic_file import ImageFile
class ContourClass:
def __init__(self, contour: np.ndarray, reference_sop_uid: str | None):
# Convert contour to internal vertices, i.e. from (x, y, z) to (z, y, x)
vertices = np.zeros(contour.shape, dtype=np.flo... |
b2777e07f7999e4cd7185ec7932dd62682d7db6302e7979f3e6f9eb7c391dca6 | Python | 13,168 | 379 | """
Unit tests for BaseDatabaseMetadataCache in io/cache.py.
Tests the abstract base class functionality including cache file operations,
metadata handling, experiment info storage, and cache summary generation.
Complements test_cache.py which tests SQLiteDatabaseMetadataCache.
"""
import json
import os
import shutil... |
bc6087f89c1f0f1485a9a3c499a66533b69eddfa4a26c9b6cf09e52a4010247f | Python | 13,169 | 375 | import logging
import os
from collections.abc import Iterable
from typing import (
cast,
NamedTuple,
NewType,
NoReturn,
)
import alembic
from alembic import command
from sqlalchemy import (
create_engine,
MetaData,
)
from sqlalchemy.engine import Engine
from sqlalchemy.exc import OperationalErr... |
0a20ca7f618a5a8244e2751bdd270ab21f58af92c729c81ebc34b55244b452de | Python | 13,170 | 371 | import os
import uuid
from collections.abc import Callable
from functools import (
lru_cache,
wraps,
)
from multiprocessing import get_context
from threading import (
local,
Lock,
)
from typing import (
Any,
cast,
overload,
Protocol,
)
import pebble
from celery import (
Celery,
... |
db316fc4edd6f1d02e6352e215fb21bf35a3c6bf51e5c74f1c0804698e13d292 | Python | 13,177 | 375 | # Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# 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/LIC... |
87c4b34227cb21ddeb49034c6c365f6ebf1524a14a94dcfa5ecd3c4d1d8ace4d | Python | 13,179 | 358 | import torch
import torch.nn.functional as F
import numpy as np
import os
from ovseg import OV_DATA_BASE
from ovseg.utils.io import load_pkl
from ovseg.networks.resUNet import UNetResEncoder
from ovseg.prediction.SlidingWindowPrediction import SlidingWindowPrediction
from scipy.ndimage.filters import gaussian_filter
fr... |
34dfdb94a76cc8ac6ec2ba76187cdbba8bcba7737e5064d2dd8d32e40e5b2397 | Python | 13,184 | 325 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 17 15:16:58 2022
@author: KEPetousakis
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import Code_General_utility_spikes_pickling as util
import matplotlib as mpl
import warnings
import logging
logging.getLogger('matplotlib.font_manager').... |
8f79362cab71363ca285f247dd2cb30398e114d060680d7b502ce2843e7d2eaa | Python | 13,186 | 459 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in July 2019
@author: Thomas Bonald <bonald@enst.fr>
@author: Quentin Lutz <qlutz@enst.fr>
@author: Nathan de Lara <nathan.delara@polytechnique.org>
"""
from math import pi
from typing import Union, Optional, Iterable
import numpy as np
from scipy import spars... |
015ecd01df5a92f75843347b2140246749efdde76b01ba0f84ab34390fd00ef3 | Python | 13,192 | 371 | # -*- coding: utf-8 -*-
"""
Requires python 3
The main() function at the bottom of this file can run from an
interpreter, or, the helper functions can be imported into a
new module or Jupyter notebook (an example is included).
Simple helper functions and python dictionary demonstrating
how to read and manipulate Spik... |
62df026a6da4eaf18bfd7ed6bb6e92bd737c69827ce9e64e4483e4cf4d3b7402 | Python | 13,193 | 268 | from collections.abc import Collection
from typing import Literal
from warnings import warn
import numpy as np
import pandas as pd
from anndata import AnnData
from mudata import MuData
from scipy.sparse import csc_array, csc_matrix, csr_array, csr_matrix, issparse, sparray, spmatrix
from scipy.stats import gmean
from ... |
360da4a896d1efe127734c0e56039b64c92f20924ba8801a9306f2173cc400da | Python | 13,195 | 329 | #!/usr/bin/env python3
"""
File: plot_avg_expression.py
Created: 2022/07/07
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
""... |
9640374377cecfe219cd93c2666b43e9b2a10120f78b4061864a36e378e0b661 | Python | 13,196 | 384 | import warnings
import os
import re
import glob
import pytest
import sys
import subprocess
import shutil
import pysam
import pysam.samtools
import pysam.bcftools
from TestUtils import checkBinaryEqual, slurp_file, \
check_samtools_view_equal, force_bytes, \
make_data_files, BAM_DATADIR
def setUpModule():
... |
b0a5b68607afdd0c0614b7823aab013b3f3500075199a7b2e090beb04d79ac56 | Python | 13,199 | 354 | """A read-only view over the stored variables of one quantized weight.
A quantization mode stores a weight as integer codes (often packed several
to a byte), a scale, and for a grouped scheme a zero point and a group
index. `QuantizedWeight` gathers those variables with a `PackLayout`, which
says how the codes are pac... |
809bec2d688364f2fb97b54164fa3166ed5cf45c7008449994fbcb6d23ddd9d0 | Python | 13,201 | 332 | """Round-34 security + IO-robustness regressions on the sparse ``.tlspec`` surface.
Five confirmed findings, all on files disjoint from the witness/execution lane:
secE-1 (HIGH, trust-gated RCE) -- ``intervention/resolver.py``: the
``path_claims_torchlens`` -> ``not _is_torchlens_owned(obj)`` leg re-enforced
... |
ffb70490d72164b4f1860060b8176c9279839e74e194a6277351ebe0b2001737 | Python | 13,203 | 258 | from os.path import join
import numpy as np
import matplotlib.pyplot as plt
import os
from library.comput_utils import get_tspdiff
from library.script_wrappers import best_worst_analysis, exin_analysis, find_nidx_along_traj
from library.shared_vars import sim_results_dir, plots_dir
from library.utils import load_pickle... |
0cce711eb24b16b9a649b91ce5cce67efe373b49177bb70fe5d52352b8deceef | Python | 13,211 | 343 | #!/usr/bin/env python3
"""
Diagnostic W — medium-effort attempts to lift LOCO above 0.80.
Three domain-adaptation / ensemble strategies tested independently and
combined:
4a. HC-anchored covariance whitening. Extend current per-cohort
z-scoring with whitening of the within-cohort HC feature
covariance. ... |
46ffb8fc2017d44984fdaa034061defa94847fcc6c29948893f19500baf64df7 | Python | 13,216 | 301 | """Install/teardown transactionality of the capture-side guards (B3 L4).
The headline gate here is `test_partial_first_time_decoration_completes_on_retry`, which
was verified RED on the pre-fix tree: `_wrap_torch_locked` keyed its "full decoration vs
re-install from the existing maps" choice on `_state._orig_to_decora... |
fd6761c5767e12f104a6817c9a816f11b0ea3eaeb36270e1b3ede2f166d08eec | Python | 13,218 | 258 | import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import cm
import numpy as np
from pycircstat import mean as cmean
from library.comput_utils import rcc_wrapper
from library.linear_circular_r import rcc
def customlegend(ax, handlelength=1.2, linewidth=1.2, handletextpad=0.1, **kwargs):
leg ... |
ec2d1b786eb7d7c9914301d74033e75b79c19eae3107f3c205e2a2ada9481c79 | Python | 13,221 | 396 | # -*- coding: utf-8 -*-
#
# pyRiemann documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 19 13:17:55 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
941e860c35fdf5119f93693208dc05128722665cd9d78143a581e3c1b3478daa | Python | 13,225 | 293 | import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
if sys.version_info[0] == 2:
VisdomExceptionBase = Exception
else:
VisdomExceptionBase = ConnectionError
def save_images(webpage, visuals, image_path, aspect_ratio=1.0, width=256):
... |
3d3341280f066ffb5c82d39c26f94e827035425ee805079827fa03c4b2d32e5e | Python | 13,231 | 346 | # tests/unit/util/test_util_nan_interpolation.py
"""
Unit tests for larvaworld.lib.util.nan_interpolation module.
Tests NaN interpolation functions with synthetic numpy arrays.
All tests use deterministic data (no randomness) for reproducibility.
"""
import numpy as np
import pytest
from scipy.signal import butter
f... |
780c2fd8d43eff8d9e0cf3c84a8fdaab599fe44edc48a8a677a637959f9bb557 | Python | 13,231 | 311 | import logging
class Signature:
"""Signature class for basic signatures of structural variants. An signature is always detected from a single read.
"""
def __init__(self, contig, start, end, signature, read):
self.contig = contig
self.start = start
self.end = end
self.signat... |
52c7bc5c7f23dbac2588901b2656808c29f0df4138d79a9b779da1113bdb110a | Python | 13,234 | 324 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import numpy as np
from .utils import general as utils
from .write_to_file import write_csv_alone
def get_states_mouse(antennas, times, t_start, t_end,
config, dt):
home_cage_internal_antennas = config.... |
8b157b19c2318dfc3c1fe876b2187054e16940898f8edc451cd306686bb4385a | Python | 13,239 | 261 | import numpy as np
from tigramite.toymodels import structural_causal_processes as toys
def _nb_latent_before(node, observed_context_indices, node_classification):
return len(
[el for el in range(node) if not (el in observed_context_indices or node_classification[el] == "system")])
def _do_dummy_projecti... |
1856f46002762e35166573f6682779233c50e44d199e9b4afbafd0aa8d57963c | Python | 13,242 | 342 | """W1_F6 regression tests: facet scatter wrapper survival and spec graph-compat honesty.
review-1 (CRITICAL): a sticky facet-slice hook (``tl.head(0, "q")`` + ``tl.zero_ablate()``)
must fire through the slice-scatter wrapper on rerun; losing the wrapper silently
applied the helper to the WHOLE home tensor (zeroing eve... |
28c806dee7c5ad4297fd01128b670c56f162e3bb65f38e4183566436d8655a29 | Python | 13,243 | 387 | """Configuration management setup
Some terminology:
- name
As written in config files.
- value
Value associated with a name
- key
Name combined with it's section (section.name)
- variant
A single word describing where the configuration key-value pair came from
"""
import locale
import logging
import os
from ... |
f34e839786f77f87aaf8d7148029c535772b5c78701357956eb54ced0241abed | Python | 13,244 | 343 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 14, 2022
@author: Pieter Barkema
This script has partially been adapted from apply_normative_models.py (author: Saige Rutherford) and transfer_hbr_models.py (author: Seyed Mostafa Kia).
The purpose of this script is to act as frontend for normativ... |
e3f12822233b1b531c7b9b6dbc195f587ae9eab8aafd29d017224ad8daffeb24 | Python | 13,250 | 181 | import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = 'Helvetica'
def mean1(MBE_list9, MBE_list10, MBE_list11, MBE_list12):
mean_list = []
for i in range(0, 24):
mean_v = (MBE_list9[i]+MBE_list10[i]+MBE_list11[i]+MBE_list12[i])/4
mean_list.append(round(mean_v, 5)... |
89459eca3d66ee5e729bc4a86d9b04d487344d8ee13f7d56eefc01169df31fff | Python | 13,252 | 356 | #!/usr/bin/env python3
from contextlib import contextmanager
import gzip
import os
import subprocess
import numpy as np
import sys
import linecache
import torch
import gc
def system(command):
subprocess.call(command, shell=True)
def mkdir(dirname):
if dirname.strip() != '':
os.makedirs(dirname, exis... |
f9f5a3058c62f59542fa85550c557bfa46d3ba21f86cf20f5448b5566be3e18c | Python | 13,252 | 245 | __credits__ = ["Rushiv Arora"]
import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"distance": 4.0,
}
class HalfCheetahEnv(MujocoEnv, utils.EzPickle):
"""
### Description
This environment is based on the work by P. Waw... |
0bc2eeba1fbe15cc8027a067261c6d1829cfd02aafbb8ce62f70890c9b8c77ca | Python | 13,264 | 331 | import torch
import flash_attn
import flash_attn_interface
import itertools
import time
import math
import torch.utils.benchmark as benchmark
def round_up_to_power_of_2(x):
if x <= 1:
return 1
return 1 << (x - 1).bit_length()
def timeit(fn, *args, **kwargs):
torch.cuda.synchronize()
# Warmup... |
e36b1741e7d61e7acbd1da9d69a977c1050aa9af3f7c802deec4b9bb6aa68e0a | Python | 13,271 | 353 | # Install the newest triton version with
# pip install "git+https://github.com/openai/triton.git#egg=triton&subdirectory=python"
import pickle
import math
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat
from flash_attn.utils.benchmark import benchmar... |
2d1e033e2d759b81109c4a10993b835783880ef8823d2acb9e563f8047597f18 | Python | 13,280 | 336 | import torch
from .preprocess import preprocess_adj, preprocess_adj_sparse, preprocess, construct_interaction, construct_interaction_KNN, add_contrastive_label, get_feature, permutation, fix_seed
import time
import random
import numpy as np
from .model import Encoder, Encoder_sparse, Encoder_map, Encoder_sc
from ... |
d3b3918f82be9e7db9c5bcf397971bc43a591da1cc9e9b7094968afb68a42401 | Python | 13,282 | 384 | """
The gut model, tracking ingestion, digestion and absorption.
Food taken in by the feeder passes through the gut before it becomes reserve.
This module models that transit, the residence time and the absorption
efficiency that determine how much of the ingested food reaches the DEB
reserve.
"""
from __future__ imp... |
a25ec05c0982f40e25ab36439be253548ddc75578ad3f1dce1defd57d9fd91ac | Python | 13,283 | 544 | #TimesVector
#
#Created by Inuk Jung on 2016-08-3.
#Copyright (c) 2016 Inuk Jung. All rights reserved.
#
#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 the License, or
#(at you... |
96ced7443c8fd93e50e0eec2a744cd1ef4c0bec402e16f24d532b59982ebd6d8 | Python | 13,284 | 363 | import numpy as np
import pandas as pd
import scanpy as sc
from sklearn.neighbors import kneighbors_graph
from sklearn.model_selection import cross_validate
from sklearn.svm import SVC
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics.cluster import normalized_mutual_info_score
from sklearn.m... |
13a6c0f8bcd0e8a513bc97dfa60d4ffe035af1c8b19cc62f1928e5af10ff979f | Python | 13,289 | 339 | """
classifier_rf_04.py — Random Forest, per-group models
Features per epoch: alpha band power, beta band power, RMS per channel, and
CSP log-variance.
Leakage
-------
CSP is supervised: it uses labels to find spatial filters. Fitting it on all
trials and then cross-validating the resulting features lets test-fold la... |
be46454e4fb610f92f70bd395fd88d179278cdb0f83ba3c968103f37cf7f86c9 | Python | 13,298 | 266 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
0dba53910f328d54c215260393351307616afeebf0f0e3f954f230b8d201170f | Python | 13,302 | 386 | from __future__ import division
import time
import logging
import numpy as np
import pylsl
import socket
import sys
import time
from libmushu.amplifier import Amplifier
from libmushu.driver.bptools.datacurator import DataCurator
logger = logging.getLogger(__name__)
logger.info('Logger started.')
# it IS poss... |
efebeb83d64e0ad86570114257141558413be7809b03988bf0b83f7943d5e3fb | Python | 13,302 | 380 | #################################################################################################################################################################
####################### Training DeepRiPe ####################################################################################################################... |
cb3ce41ee54d439039a4c22857bb0f292a3689f0ac94d29b02e4134e2338f4d2 | Python | 13,304 | 383 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import argparse
import datetime
import os
import networkx as nx
import openbabel as ob
import pybel
isoprene_smarts = pybel.Smarts("C~C(~C)~C~C")
def mol_to_networkxgraph(mol):
edges = []
for bond in ob.OBMolBondIter(mol.OBMol):
# bondorders.append(bond... |
e7bd8f3da984b67890f0669ef103b6e7a7a02f51fec471609f79546864b6f215 | Python | 13,308 | 411 | import numbers
import random
import numpy as np
import PIL
import torch
import torchvision
from . import functional as F
class Compose(object):
"""Composes several transforms
Args:
transforms (list of ``Transform`` objects): list of transforms
to compose
"""
def __init__(self, transforms):... |
d123b6c4e60613c3b83e2f11decc4ca7fbf09c9526038af489a9265c2cafbb18 | Python | 13,310 | 430 | """
Built-in datasets for demonstration, educational and test purposes.
"""
import os
from importlib import import_module
import narwhals.stable.v1 as nw
AVAILABLE_BACKENDS = {"pandas", "polars", "pyarrow", "modin", "cudf"}
BACKENDS_WITH_INDEX_SUPPORT = {"pandas", "modin", "cudf"}
def gapminder(
datetimes=Fals... |
6dd883dbc80e54433293803cbbc74e5210392b6b1f17cbcb499921faceb4f093 | Python | 13,315 | 368 | # Copyright (c) 2022 PaddlePaddle Authors. 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 app... |
59ad2cd31ba82919f8fc8af7dfd95050b24177df96c5d88db6f4be22239e39b1 | Python | 13,317 | 279 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from copy import copy, deepcopy
from pathlib import Path
import torch
from ultralytics.data import YOLOConcatDataset, build_yolo_dataset
from ultralytics.data.augment import LoadVisualPrompt
from ultralytics.engin... |
c4c85245c0ee5f14737be70edb72d845ca68a0079fad659306facae8d60e83e7 | Python | 13,320 | 312 | from __future__ import print_function
import argparse
import datetime
import random
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import DataLoader... |
c822c063bd98de0d1c4b5beef3d3455d99a5041c89ea8853f5f936c480c48e94 | Python | 13,324 | 356 | """Transforms described in https://arxiv.org/abs/1512.02325."""
# pylint: disable=not-callable
from __future__ import absolute_import
import numpy as np
import mxnet as mx
from .. import bbox as tbbox
from .. import image as timage
from .. import experimental
from ....utils import try_import_dali
dali = try_import_da... |
637ce1ba57442ad72052cc93590c72feab71da515805d3b0d4a054b70a44f8f7 | Python | 13,333 | 298 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import torch
import torch.nn.functional as F
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import LOGGER, o... |
814b384b4866276816d71452a73e48c42d86198c0bbbf4d1a7e5c6eb0a5b40df | Python | 13,333 | 396 | # coding=utf-8
# Copyright 2023 The Google Research Authors.
#
# 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 applicab... |
eeacb31fa475e5e0194f1f02e6d13274b40ee0e8be15b48e9b8ea97cdbb304c5 | Python | 13,340 | 364 | '''
# Shell commands
# Parse ground-truth deletions
tail -n +2 deletions.csv | awk '{print $2"\t"$3"\t"$4"\t"$5"\t"$1}' | bedtools sort -i - > del.bed
# Parse ground-truth inversions
tail -n +2 inversions.csv | awk '{print $2"\t"$3"\t"$4"\t"$5"\t"$1}' | bedtools sort -i - > inv.bed
# Parse ground-truth tandem duplica... |
6ce5312942a3cae83116440ab83564c964c0e5d0851dfed6ca0a817fa049dfe1 | Python | 13,345 | 238 | """
RUN INFERENCE
"""
import sys, os, subprocess, pickle, time, json, argparse
script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path = sys.path + [script_dir+'/utils/'] + [script_dir+'/model/']
from sampler import *
sampler_map = {'default':SEQDIFF_sampler, 'cleavage_foldswitch':cleavage_foldswitch_SAMPLER... |
9010a591558c7ef80e903bf89cca78d4fbe97631abf359850664ec8186675f01 | Python | 13,346 | 315 | """
07: Exploring the Model Object
==============================
Further exploring the SpectralModel object, including algorithm settings and available methods.
"""
###################################################################################################
# Import the model object
from specparam import Spe... |
236151ead3d5e3107d575904446359218da5b95a5059f4c5323a365ea60947f4 | Python | 13,352 | 379 | """Transactionality of the host-nondeterminism monitor's arm and unwind (B3 L4).
The monitor mutates ~40 process-global attributes and both profile slots before it can
return. Every leak class below was live on main:
* a ``BaseException`` mid-arm (a Ctrl-C in the O(model-size) generator sweep) escaped the
``except ... |
26383b01b8a52a8d4384b57f4a6d3c42c73fad7dd5fe03cf70cbc8a881ee1f7d | Python | 13,354 | 328 | import os
import json
import numpy as np
import torch
import random
from collections import defaultdict
from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt
from src.utils.util import device
class COPAReader(object):
'''
COPAReader reads COPA dataset
'''
def __init__(self, config, t... |
5ae029efdf635833a08d448ecc1a2cf36ace69104cb9ce7b9434f293302a3086 | Python | 13,355 | 336 | #!/usr/bin/env python3
"""
Diagnostic Y — severity-stratified sensitivity analysis.
Where does the tool catch AD subjects, and where does it miss them?
The hypothesis (Dx U writeup): the tool is biased toward
moderate-to-severe AD (figshare's training contribution) and may miss
mild AD subjects in cohorts like brainla... |
9802aaedc83b0dc2902bc6ec9c06261f62029428385afcdaa4a5b2f610ec10f7 | Python | 13,356 | 307 | """int4 handlers for the lookup family (`Embedding`, `ReversibleEmbedding`)."""
import math
from keras.src import ops
from keras.src.quantizers.modes.common import add_lookup_lora_delta
from keras.src.quantizers.modes.common import add_reverse_lookup_lora_delta
from keras.src.quantizers.modes.common import apply_logi... |
bf25a5c31e85d8fa755416e91be07559498df64c801e92c423e5df16e1722032 | Python | 13,356 | 366 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in complian... |
3c9de82e2ec20a7ae512115fe8a8693dcb22f9bebffd55b37cf99dec94530b03 | Python | 13,359 | 321 | """
Unit tests for SSH configuration setup functionality.
Tests the SSH key generation and system-wide SSH configuration
setup used for ethoscope device connections.
"""
import os
import shutil
import subprocess
import tempfile
from pathlib import Path
from unittest.mock import Mock, call, mock_open, patch
import py... |
11107db8c430b52a92d536a07e6d54e5d80fec0aabce9f064c0030d6720c178a | Python | 13,362 | 323 | """B1-07: the tlspec-v7 `_capture_outcome` codec refuses incoherent payloads.
Two corroborated gaps in the persisted-attestation codec:
(a) CROSS-FIELD COHERENCE. ``attestation_coherent`` checked only structural
booleans (COMPLETE requires ``(not halted) and finished``; FAILED returned
True unconditionally), ... |
2670828be1ff17d1350d5d2cde640797db4606d7b5356018625bab6c2f763eed | Python | 13,364 | 276 | """Target generators for YOLOs."""
# pylint: disable=arguments-differ, unsupported-assignment-operation
from __future__ import absolute_import
from __future__ import division
import numpy as np
from mxnet import gluon
from mxnet import nd
from mxnet import autograd
from ...nn.bbox import BBoxCornerToCenter, BBoxCenter... |
4df26d89a3964b8614155f6a6f75d06662df0bc4539841e4388408ec3fad18ed | Python | 13,366 | 392 | """Result-identity coverage for the Trace accessor alias reverse indexes.
``TraceOpAccessor``/``TraceModuleCallAccessor``/``TraceGradFnCallAccessor`` resolve
non-exact keys through reverse indexes built once per accessor instead of scanning
every item per lookup. These tests pin the indexed answers to the scanning ans... |
49298e89b10b05e7f5f687703b1cef1eddea615e6d634482935b47250bb242b0 | Python | 13,368 | 418 | from functools import lru_cache
from typing import Generator
import numpy as np
from mirp._features.rlm_matrix import MatrixRLM
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
from mirp._features.histogram import get_discretisation_parameters
from mirp._features.texture_... |
c7e33c113716abbe9f82be44bb0e517ab091c43b03931dda80b12c71295dc385 | Python | 13,372 | 430 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ErrorY(_BaseTraceHierarchyType):
_parent_path_str = "bar"
_path_str = "ba... |
ba5c71c3986cb64d520cf840ca7ae3c4e1c4432f7e3d314a10cf45c354bbad3e | Python | 13,383 | 336 | from os import PathLike
from typing import List, Union, Optional
import seqdata as sd
import numpy as np
import xarray as xr
import importlib
from eugene import models, settings
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.loggers import TensorBoardLogger
from ray import tune
from ray.t... |
e0824c78a8f256c4dd8afd6ac40ab615475098c196fa175c52c2766d1dae8980 | Python | 13,386 | 392 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
4fa0aba53b8bd1d5f9468937f55a60bc3cac45b1a16e7b8b89ba2b364476ccba | Python | 13,394 | 343 | """Apache Cassandra result store backend using the DataStax driver."""
import threading
from kombu.utils.encoding import ensure_bytes
from celery import states
from celery.exceptions import ImproperlyConfigured
from celery.utils.log import get_logger
from .base import BaseBackend
try: # pragma: no cover
import... |
44d0800100cd75a8e39699e09f755ea453f7b2eabe13bcb689e362c3d25839d4 | Python | 13,398 | 457 | """Fixture models for module-containment snapshot equality tests."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any, TypeAlias
import torch
from torch import nn
FixtureResult: TypeAlias = tuple[nn.Module, Any, str]
HookedFixtureResult: TypeAlias = tuple[nn.Module, Any... |
83a88e2ebfbc947665cfa6ff90f9ec6a06aeb46cd6d5d463ce996e12efdcd780 | Python | 13,398 | 372 | from __future__ import annotations
from argparse import ArgumentParser
from datetime import datetime
from pathlib import Path
from typing import Dict, Sequence, Tuple, Union
import aim
import capi
import dino
import dinov2
import finetune_eval
import ibot
import knn_eval
import lejepa
import linear_eval
import mae
im... |
59b8b3f80c12dc78d2dddfe815a477a08d17a693efffd5fab3049c7dd01c2ad9 | Python | 13,401 | 448 | import numpy as np
from numpy.testing import assert_array_equal
import pytest
from sklearn.base import clone, is_clusterer
from sklearn.model_selection import cross_val_score
from pytest import approx
from pyriemann.clustering import (
Kmeans,
KmeansPerClassTransform,
MeanShift,
Gaussian,
GaussianM... |
3220df6c5d0e97298ef42f25ae70992d60143e4f5f27d98b1979850e9577c308 | Python | 13,404 | 431 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ErrorY(_BaseTraceHierarchyType):
_parent_path_str = "scatter"
_path_str =... |
8d5224dde76e364554b8bdda57d5b953206f8c1c32bd75219bdda106d0a99d1c | Python | 13,408 | 352 | # import packages
import json
import os
import pydicom
import pandas as pd
from NIfTI_gen import NIfTI_gen
from meta2json import dcm2json
def format_args(args):
include_dicom = True if args.include_dicom == 1 else False
verbose = True if args.verbose == 1 else False
quality_testing = True if args.quality_... |
73b63abdfd82057ab0c749138a9adda772e7bb9c33cb2a76c623c43a501344b1 | Python | 13,409 | 359 | # flake8: noqa: E402 (matplotlib.use has to be right after the import)
import os.path as os_path
import pathlib
import pkg_resources
import signal
import sys
import traceback
import webbrowser
import matplotlib
matplotlib.use('QT5Agg')
from PyQt5 import uic, QtCore, QtWidgets
from PyQt5.QtCore import QStandardPaths
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.