sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9a90b887f88db17baa3b6e340408cc3f2eed25fe2454aedbf67a20b71eeb95fe | Python | 5,841 | 172 | # Copyright (c) MONAI Consortium
# 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 writing, so... |
37ffbd2567e375a944ea1965291b18334cb933ea8af9bc3760c68154a2308e2b | Python | 5,842 | 152 | # todo upgrade to keras 2.0
from keras import optimizers
from keras.models import Model
from keras.layers import Layer, Lambda
import keras.backend as K
from keras.layers import Input, concatenate, AveragePooling2D
from keras.layers import MaxPooling2D, UpSampling2D, Conv2D, subtract, add, multiply, GlobalAveragePooli... |
b5b8ff64900078780409d50c556baa25deba303de418d858fd704c1442826a28 | Python | 5,844 | 142 | import numpy as np
import gym
from stable_baselines3 import PPO
import torch
from stable_baselines3 import A2C, PPO
from stable_baselines3.common.callbacks import CheckpointCallback, BaseCallback
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
from typing import Any, Callable, Dict, Lis... |
ba9bc09ae5cf0a4b090ad7f87d7da8c1997bcf11d101a89aefff6a4f77ac6508 | Python | 5,844 | 142 | import numpy as np
import gym
from stable_baselines3 import PPO
import torch
from stable_baselines3 import A2C, PPO
from stable_baselines3.common.callbacks import CheckpointCallback, BaseCallback
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
from typing import Any, Callable, Dict, Lis... |
ce6cc0bb56f5eec906277d4850356aec8fd66c188d641119ed1c7f57525f0e29 | Python | 5,844 | 137 | # Copyright 2019 DeepMind Technologies Limited. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
d6ffd764d7dd063fbad6d6aff5921461e31267e0d5bc5a18afe7a79bd9e613a9 | Python | 5,845 | 178 | """
##############################################################################
#
# Create sitecount matrix with raw k-mer counts.
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gmail.com
# CREATED: 18-04-2020
# LICE... |
4fffa5fb5f4148126836b633b87b37ef8f7917a1f234fa88b68cffc431caa3a7 | Python | 5,851 | 176 | import random
import pytest
from langchain_classic.evaluation.parsing.base import (
JsonEqualityEvaluator,
JsonValidityEvaluator,
)
@pytest.fixture
def json_validity_evaluator() -> JsonValidityEvaluator:
return JsonValidityEvaluator()
def test_json_validity_evaluator_requires_input(
json_validity_... |
c1a51e6750c787165723f0990881592081ebab7a4a91a76b5b888e7a76d207e4 | Python | 5,851 | 73 | import argparse
def create_parser_main_pattern():
parent_parser = argparse.ArgumentParser()
main_parser = argparse.ArgumentParser()
main_parser.add_argument('--save_dir', type=str, help='save_dir', default='../Simu')
main_parser.add_argument('--name', type=str, help='Name', default='local/test')
ma... |
64d8cf30b4d45aee10eadd143d54949daca941edc7909ddb227dd3cb17fd79dc | Python | 5,855 | 147 | from __future__ import annotations
import random
from pathlib import Path
from typing import Dict, List
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from libs.function.utils import clip_param
class Visualizer:
def __init__(self, input_dim: int, hidden_dim: int, out... |
ffcbfb43bdbdfc33485afd3221df91c2b39afeb4cac67aa837a07efb06ec543a | Python | 5,858 | 174 | import numpy as np
from sklearn import metrics
# for decompensation, in-hospital mortality
def print_metrics_binary(y_true, predictions, verbose=1):
predictions = np.array(predictions)
if len(predictions.shape) == 1:
predictions = np.stack([1 - predictions, predictions]).transpose((1, 0))
cf = m... |
c40518d05b2c45230320636a5a409ee877577c318dd5fda1b7e601d93025c2ec | Python | 5,862 | 200 | """ Utility functions for dicom files """
import warnings
from pathlib import Path
from re import search
from typing import Union
import dicom2nifti
import pydicom
from MRdataset import logger
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
# logger = logging.getLogger('root')
def is_bids_fil... |
383f65d27e4a3317a3a3281c7f137d45bb0a762138025828b38f37599afd4099 | Python | 5,865 | 170 | import numpy as numx
import pydeep.base.numpyextension as npExt
import DBM3LayerBinary.model as MODEL
import DBM3LayerBinary.trainer as TRAINER
import DBM3LayerBinary.estimator as ESTIMATOR
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.measuring as MEASURE
import pydeep.misc.io as IO
import pyde... |
29edfb6d596bb8b3dc6b0ed7361c436b5ffe4bd418f20579d4b805de2c50e3e8 | Python | 5,866 | 120 | """Failure, corruption and dependency checks for resumable pipeline stages."""
import json
import os
from pathlib import Path
import tempfile
import unittest
import numpy as np
import SimpleITK as sitk
from preprocessing.cache import related_files, validate_output
from utils.stages import StageCache, subject_lock
c... |
41bb662088c78f8cb5a3cb1eed952e1fc625a745d89ca2d8970946c50ae783d7 | Python | 5,869 | 149 | from collections.abc import Iterable
import numpy as np
import pandas as pd
def collect_state_names(data: pd.DataFrame, variable: str) -> list:
"""Return the sorted observed states for `variable` in `data`."""
return sorted(list(data.loc[:, variable].dropna().unique()))
def build_state_names(data: pd.DataF... |
ff829a7c3f3d5dadfa6a3e910aacada4a79965083762411a7644cf81499d8b5c | Python | 5,871 | 169 | from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, add, multiply, Conv3D, LeakyReLU, Lambda, UpSampling3D, ReLU
import tensorflow as tf
def XxGlobalAveragePooling(input):
return tf.reduce_mean(input, axis=(1, 2, 3), keepdims=True)
def CALayer(input, channel, reduction=16):
W... |
3b32ea78b5691edc57fa2b0bfe461a3fcc8b4984fcbe5f937225d62ab485323d | Python | 5,872 | 151 | # Bond lengths from:
# http://www.wiredchemist.com/chemistry/data/bond_energies_lengths.html
# And:
# http://chemistry-reference.com/tables/Bond%20Lengths%20and%20Enthalpies.pdf
bonds1 = {'H': {'H': 74, 'C': 109, 'N': 101, 'O': 96, 'F': 92,
'B': 119, 'Si': 148, 'P': 144, 'As': 152, 'S': 134,
... |
e65811c741613040e316187afddc3d935ca0594b735c29eb072c7b7f1527df3d | Python | 5,872 | 177 | # Copyright 2022 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
1ef8e7fffdf44eaae52128fb831105bd75eb942b8164698f4f973e8dfb4e1890 | Python | 5,878 | 196 | ######################################################################
######################################################################
# HOW TO USE:
# Install all necessary python modules:
# python -m pip install openpyxl progress pandas numpy psutil GPUtil jinja2
# Compile RAYX in Release mode
# Close all oth... |
e01bfc9a3a23942e9cbc0ea47af29e218a1c9f8d71e8d52e9c9d9c5dac7be6f1 | Python | 5,880 | 170 | '''
PipelineMedip.py - tasks associated with MedipSeq analysis
==========================================================
'''
import re
import os
import collections
import cgatcore.experiment as E
from cgatcore import pipeline as P
import cgatcore.database as Database
import cgatcore.iotools as iotools
from rpy2.r... |
5b6cca14c19ac0046905035c5bae68976cf0edcc951d27424dbcc9c290c839fb | Python | 5,881 | 202 | import logging
import unittest
from nipype.algorithms.icc import ICC_rep_anova
# from nltools.data.brain_data import Brain_Data
import numpy as np
# from helpers.icc import compute_ICC
# from helpers.icc import compute_icc_scores_pingouin
from helpers.i2c2 import compute_i2c2
logging.basicConfig(
format='%(ascti... |
25ab14aab35b4141f4cddf399234073f2e3ed822fd5d1320fe9d462cdd5068ac | Python | 5,885 | 199 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import functools
from typing import Optional
import h5py
import torch
# import torchdata.datapipes as dp
from .common import build_datapipes
class NavierStokesDatasetOpener(torch.utils.data.Dataset):
"""DataPipe to load Navier-Stokes datas... |
25b0c889725edf4e0a0451725fe770ff666d144412fd6d4e7f080bcba8d80473 | Python | 5,886 | 177 | """Trust Region Reflective algorithm for least-squares optimization.
"""
import torch
import numpy as np
from scipy.optimize import OptimizeResult
from scipy.optimize._lsq.common import (print_header_nonlinear,
print_iteration_nonlinear)
from .cg import cgls
from .lsmr import ls... |
d2834d47204a63de59ad815ddf81fdcc186e8a56876830f1dfc107eb2852c708 | Python | 5,886 | 206 | """A mock Robot server."""
from enum import Enum
from typing import Annotated, Any
from uuid import uuid4
import uvicorn
from fastapi import FastAPI, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware
from fastapi.openapi.utils import get_openapi
from pydantic import BaseModel, Field
PORT = 7289... |
9de06a682b77fd07f27cc25bdd53ccfcfe5e1f6e96511e12e20b4a6904653538 | Python | 5,888 | 169 | '''SqueezeNet in PyTorch.
See the paper "SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" for more details.
'''
import math
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.autograd import Variable
from functools import parti... |
2bb0057b3fa7ef6a6f95eab45eaaa13adcf43b6a9c288453e1c7c14d4f3982cc | Python | 5,890 | 177 | """Dictionary prompt template."""
import warnings
from functools import cached_property
from typing import Any, Literal, cast
from pydantic import model_validator
from typing_extensions import override
from langchain_core.load import dumpd
from langchain_core.prompts.string import (
DEFAULT_FORMATTER_MAPPING,
... |
ea82f2ec0ee018c8a99122a9d97b46756510bed62dbcec3ca696f17137e85a95 | Python | 5,891 | 194 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 09:28:41 2021
@author: pku
"""
import matplotlib.pyplot as plt
#%%
import numpy as np
import tensorflow as tf
from tensorflow.keras import applications, regularizers, optimizers, activations
from tensorflow.keras.models import Model, Sequential
from tens... |
1457cd62709723abf57bbd374f2a5d896dba3848a100640d132336b9f4a3cbd1 | Python | 5,895 | 153 | import numpy as np
import pandas as pd
import pytest
from pgmpy.causal_discovery import ANM
@pytest.fixture
def nonlinear_data(n=1000):
"""Generate additive-noise data with X -> Y, where Y = X ** 3 + noise."""
rng = np.random.default_rng(0)
x = rng.uniform(-2, 2, n)
y = x**3 + rng.normal(0, 0.5, n)
... |
01ae73f664bf90bb516bcf180fc5502e1140bfc37d6c8476674185d1e807a11c | Python | 5,897 | 141 | """ Componets of the model
"""
import torch.nn as nn
import torch
import torch.nn.functional as F
import numpy as np
def xavier_init(m):
if type(m) == nn.Linear:
nn.init.xavier_normal_(m.weight)
if m.bias is not None:
m.bias.data.fill_(0.0)
class GraphAttentionLayer(nn.Modul... |
b71b962b2919e2ab67295e275972064791b04c5c48d70523a99aaad0c5ed8dcf | Python | 5,897 | 122 | # Imports
import sys
import os
import argparse
import inspect
from datetime import datetime
import numpy as np
import torch
from helper_for_prescient import *
from visualization_inte import *
def _build_save_file_name(save_path, epochs):
return 'prescient_{}-{}-{}({};{})_{}_{}epochs'.format(str(datetime.now().... |
218770b01c9a9cab3ef2fbb00087233bcdebd121c88f3bb9526c3c4c475321cc | Python | 5,904 | 151 | from typing import Any
from langchain_core._api import deprecated
from langchain_core.messages import BaseMessage, get_buffer_string
from langchain_core.utils import pre_init
from typing_extensions import override
from langchain_classic.memory.chat_memory import BaseChatMemory
from langchain_classic.memory.summary im... |
9123c5130ff0907a507d1161489c9d0f9c283b6be5dfe12e2e6d7d22796b07ff | Python | 5,904 | 112 | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import random
import seaborn as sns
import torch
import matplotlib.pyplot as plt
import h5py
from sklearn.preprocessing import MinMaxScaler,StandardScaler
import argparse
def get_sub_network_score(pathway_name_path,pathway_crosstalk_network,sav... |
05f7de4943a4ca7b43acbb248f82e70349e21baa649f7694b59bfab3dbe34218 | Python | 5,905 | 184 | import json
import numpy
class CiliaAnalysisAnnotatedCell:
def __init__(self, neuroglancer_pt_annotations=None,
static_cilium_seg_id=None, static_soma_seg_id=None,
dynamic_cilium_seg_id=None, dynamic_soma_seg_id=None,
soma_valence_pt_pix=None,
s... |
f45011f0d92f3549eb2192b8c1f03d2ec822705d6f9de7e31b17b3efddd08642 | Python | 5,908 | 226 | """
2023.08.30
author: femke.hurtak@epfl.ch
Helping functions for the interfacing between dataframes and matrices
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy as sc
import scipy.cluster.hierarchy as sch
from loaddata import get_name_from_rootid
def connections_up_to_n_hops(matrix, n):
""... |
0a86d86397c3d9d49bdad082ece0c6c2a742d997db43d65f93b19501f26cf6bc | Python | 5,912 | 171 | #!/usr/bin/env python
"""
Create GM, WM and CSF tissue masks from Freesurfer output
- requires Freesurfer reconstructed subject directory
- uses mri/ribbon.mgz, wmparc.mgz and T1.mgz
Authors
----
Mike Tyszka, Caltech Brain Imaging Center
Dates
----
2017-06-21 JMT Expand from Julien Dubois code fragment
License
---... |
76cdbc1c5501fa4628ec26758d65b97b81dbc3f8ee5d911d6c7e0d1f29b073d7 | Python | 5,912 | 159 | import numpy as np
import os
import random
import sys
import uuid
# For preprocessing
from sklearn.preprocessing import StandardScaler
import torch # For building the networks
torch.backends.cudnn.deterministic = True
import torchtuples as tt # Some useful functions
from pycox.evaluation import EvalSurv
from pycox.... |
3bdf83b5e02db4a77c600bd75e6f982877cbb2d3d6017df3d77b3110db8d7c7b | Python | 5,916 | 180 | """ This class contains some example toy problems for RBMs.
:Implemented:
- Bars and Stripes dataset
- Shifting bars dataset
- 2D mixture of Laplacians
:Version:
1.1.0
:Date:
19.03.2017
:Author:
Jan Melchior
:Contact:
JanMelchior@gmx.de
... |
3a4d57b91a4d20996c1654fc697b5739d5dbe70f28214e8b4c42ba3bee596d68 | Python | 5,919 | 162 | import importlib
import pathlib
import warnings
from typing import TYPE_CHECKING
from openff.toolkit import Quantity, unit
from openff.toolkit.utils.base_wrapper import ToolkitWrapper
from openff.toolkit.utils.exceptions import (
ToolkitUnavailableException,
)
if TYPE_CHECKING:
from openff.toolkit.topology.mo... |
837c3a4aa3a582bf8001ebeb0068591aa406dfe7128b402423276cc9d44794a7 | Python | 5,923 | 173 | from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import BaseMessage, SystemMessage, get_buffer_string
from langch... |
c93637c985e448237d0f255035b732deca6612a49ad852ac898404e3d07b87a1 | Python | 5,923 | 96 | """Shift-matched (leave-one-source-out) conformal calibration under P4.
Standard split conformal calibrates on held-out CELLS of the source datasets, so its scores reflect the
within-distribution residuals and coverage collapses on an unseen dataset (conformal_v0: ~36-44% at a 90% target).
Shift-matched calibration in... |
3d5b00a0ab7e0c228fc701a6f437a5140dd7d5cae48a9a18e17ebae58b399165 | Python | 5,925 | 165 | import ast
import importlib
import warnings
from importlib.util import find_spec
from pathlib import Path
from typing import Any
# Attempt to recursively import all modules in langchain
PKG_ROOT = Path(__file__).parent.parent.parent
COMMUNITY_NOT_INSTALLED = find_spec("langchain_community") is None
def test_import_... |
4143144c22255df59d44e1ee16eeec76fe77f833d574f28c54f19bd59ba41fab | Python | 5,926 | 115 | import argparse
import pandas as pd
import numpy as np
from direct_tt import direct_tt
from pretrain import pretraining
from fine_tune import fine_tuning
from fusion import fusion
from summary import summary
# 创建参数解析器
parser = argparse.ArgumentParser()
# 添加命令行参数
parser.add_argument("-s", "--seed", type=int, default=... |
e10aeb76c9cdc74ca91dd46bc26d1b9b7ebc7bef83876495affe1aab1d7e98e7 | Python | 5,926 | 155 | from ChipseqReport import *
import Motifs
###########################################################################
###########################################################################
###########################################################################
class MotifsAndTSS(Motifs.Mast):
'''numbe... |
8c631f306de1ec75a071e58c5f69a001402867e1c7f44a4e47c8909b47683043 | Python | 5,928 | 166 | from __future__ import annotations
from typing import TYPE_CHECKING, Any, TypedDict
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import BasePromptTemplate
from langchain_core.runnables import Runnable, RunnablePassth... |
010eba4b3cc7907d29a02f545a0315016386f65c853f92ba25640f73187c5b9b | Python | 5,929 | 126 | '''
For cleaning up the mda files after rejection but before merging
The merging code shouldn't use results from this code
This is just for creating inputs CellExplorer functions right after rejection
'''
import os
from time import time
from copy import deepcopy
import gc
import json
import re
import numpy as np
impor... |
29dcc1521150797dcb63cf3b6e73db1c414c6f1ba97ca9625a8a5c6395af9dcd | Python | 5,938 | 158 | """
From: https://github.com/dariush-bahrami/character-tokenizer/blob/master/charactertokenizer/core.py
CharacterTokenizer for Hugging Face Transformers.
This is heavily inspired from CanineTokenizer in transformers package.
"""
import json
import os
from pathlib import Path
from typing import Dict, List, Optional, Se... |
ac60911e7843ce16ca2feb98ee98fd596267f5401f1ab732aa8e1e4653a67376 | Python | 5,941 | 148 | """
This script summarizes eQTL analysis.
"""
import functools
import pandas as pd
config = {
"genes": "/ceph/projects/v4_phase3_paper/inputs/counts/"+\
"text_files_counts/_m/caudate/gene_annotation.tsv",
"transcripts": "/ceph/projects/v4_phase3_paper/inputs/counts/"+\
"text_files_counts/_m/caudate/tx_... |
b9c34df06a2ed1188513554059f7515b6ec24948a31a849570c29e7b2d99bbbb | Python | 5,942 | 136 | """
Select Drug pairs with high variable synergy across tissues
qualified drug pairs:
1. number of tissues > 3
2. number of cell lines > 5
3. coefficient of variation across tissue (i.e., absolute CV) > 1
"""
import argparse
import pathlib
import numpy as np
import pandas as pd
import seaborn as sns
impor... |
ff3618ec5d7c037d2131f422678c53d09e536e0944d91096dc8df3276a313e59 | Python | 5,942 | 184 | from scipy.stats import pearsonr
import numpy as np
import math
def pearson(data, freq_model):
"""Pearson. Calculate Pearson r correlation for each member of data dict against freq model.
Args:
data (dict): Data dictionary.
freq_model (array): frequency model data in corresponding order
... |
857fa0f1989d47aa4c2390dd24d21c07fce39e2c652b121a9e416d4f8dd7a03b | Python | 5,948 | 164 | """Test MRKL functionality."""
import pytest
from langchain_core.agents import AgentAction
from langchain_core.exceptions import OutputParserException
from langchain_core.prompts import PromptTemplate
from langchain_core.tools import Tool
from langchain_classic.agents.mrkl.base import ZeroShotAgent
from langchain_cla... |
1fc4e9576f7ee24d7321bcf97f9a1519a1fb94e97454a08ebc4a84b6834a8f28 | Python | 5,950 | 133 | from collections.abc import Hashable
from copy import deepcopy
from numbers import Real
from typing import TYPE_CHECKING, Any
import numpy as np
import pandas as pd
from skbase.utils.dependencies import _safe_import
from pgmpy.parameterization._base import BaseParameter, _checked_evidence, _parent_order
from pgmpy.pa... |
846022ce232b69065326cb607b951dc9eae484cf40aa98a3f654f21526136183 | Python | 5,950 | 169 | """
Author: Anna M. Puszkarska
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 writing, software
distri... |
47503c6929d5f39756cbb37499fded62a425a7a0991e192bb52aa3ed78689204 | Python | 5,951 | 146 | import pathlib
import numpy as np
import math, shelve
from torch.utils.data import Dataset
from scipy.integrate import solve_ivp
import torch
import torchdiffeq
from collections import OrderedDict
from torch.distributions.normal import Normal
from typing import Literal
from CEL.utils.register import register
from .me... |
703cf9b6f666deef1195144262026aac2a3088b3b62c2064bc23c6f200620c2f | Python | 5,961 | 155 | """
Modify reference genome as preprocessing step for nanopolish.
"""
import multiprocessing as mp
import pickle
import sys
from itertools import product
import pandas as pd
sys.path.append('..')
from utils.bio import valid_cpg_mc_kmer
from utils.constants.final_analysis import METHYL_BED_COLS
COVERAGE_THRESH = ... |
befc2ee6fa3fe34d0c98f7d8b0428d6baf7687ad70fd14dbab36aca98f1ab065 | Python | 5,961 | 198 | """Test agent trajectory evaluation chain."""
from typing import Any
import pytest
from langchain_core.agents import AgentAction
from langchain_core.callbacks.manager import CallbackManagerForLLMRun
from langchain_core.exceptions import OutputParserException
from langchain_core.messages import BaseMessage
from langch... |
179926ba80c8aacf1905a0ab5d7b0117ea4432a4ab9b6c7f3ec9ad741430a244 | Python | 5,965 | 170 | import torch
from bindsnet.pipeline.environment_pipeline import EnvironmentPipeline
def select_multinomial(pipeline: EnvironmentPipeline, **kwargs) -> int:
# language=rst
"""
Selects an action probabilistically based on spiking activity from a network layer.
:param pipeline: EnvironmentPipeline with... |
72d31ffe19cdae53e0afc28d1a5df12281d92c35f0302ad04b0e4e4cc1eae055 | Python | 5,967 | 169 | # Copyright 2022 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
c09154b9e76fbe5db9d6e2562235531d22f919fa1e4273f389039a647bf16a82 | Python | 5,970 | 189 | #!/usr/bin/env python
#
# MRdataset documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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.
#
# A... |
50638d8636e2cffcc1b1e5056b3fca10a19c871994905304a13fa10c738e93b6 | Python | 5,971 | 151 | """ Import PatternLab Output
PatternLab V allows user to export Excel file with filtered identified
proteins, sample information, biological and technical replicates.
Here, we advise users to export data with at least 1 unique peptide/protein
and protein abundance normalized by XIC.
@author: Reis-de-Oliveira G <gu... |
8e7a225dc3cc23f26436a6e1ab1683ac0d284e781acfd2f0f69ef1272821f50c | Python | 5,971 | 129 | import os
from typing import List, Union, Tuple
import numpy as np
from rdkit import Chem
import torch
import torch.nn as nn
from .dmpnn import DMPNN
from HMSA.args import TrainArgs
from HMSA.features import BatchMolGraph
from HMSA.nn_utils import initialize_weights
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
class HMS... |
7bf0d1814bf42f6ac57ada86cd9403fd838ee91d2a89c82c8bbddb8a763ceace | Python | 5,973 | 138 | import itertools
import sys
import traceback
from pathlib import Path
import yaml
from astrocast.denoising import Network, PyTorchNetwork, SubFrameDataset, SubFrameGenerator
with open("generate_pretrain_models.yaml", "r") as file:
config = yaml.safe_load(file)
params = config["param"]
use_pytorch = params["use_... |
16896777b197f237a6f10a13c82cc1d10d12716de7809a72c87836694f4eca9b | Python | 5,974 | 220 | import numpy as np
def linear(r):
return -r
def thin_plate_spline(r):
if r == 0:
return 0.0
else:
return r**2*np.log(r)
def cubic(r):
return r**3
def quintic(r):
return -r**5
def multiquadric(r):
return -np.sqrt(r**2 + 1)
def inverse_multiquadric(r):
return 1/np.s... |
388aa9f7e3d64eae57dada3283aedaff1fc9429d7c071d6b81b5f95468c75ede | Python | 5,974 | 146 | """Prompt for trajectory evaluation chain."""
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_core.prompts.chat import (
ChatPromptTemplate,
HumanMessagePromptTemplate,
)
EVAL_TEMPLATE = """An AI language model has been given access to the following set of tools to he... |
3f90339f3f76f6171ab30a74f9c0fb716f728502a16da0ef3ccfcf9edac0020f | Python | 5,974 | 189 | # Copyright 2023 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
d6c12d4dd6a215b56790596bf041fe26cf48f434e5902b7bd72f8069e25040b6 | Python | 5,975 | 161 | import os
import sys
sys.path.append(os.getcwd())
import torch_geometric
from src import constants
from src import process_tsv
from src import utils
from src import prepare_data
from src import data_loader
from src import optimize_hyper
from src import model
from src import get_recommendation
import download_galaxy.... |
950034f0328bb5457169215bf2b1329fbbba99aa96de39b481ec8e2ade0092a9 | Python | 5,976 | 147 | """Console script for mrQA."""
import argparse
import sys
from pathlib import Path
from MRdataset import import_dataset, load_mr_dataset, valid_dirs, \
DatasetEmptyException
from mrQA import check_compliance
from mrQA import logger
from mrQA.config import PATH_CONFIG, THIS_DIR
from mrQA.utils import is_writable
... |
78c05a217a5401260bb8aae245f9f72748ef92a7639153a4afa9a341ee4e83a2 | Python | 5,982 | 188 | """Module contains typedefs that are used with `Runnable` objects."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Literal
from typing_extensions import NotRequired, TypedDict
if TYPE_CHECKING:
from collections.abc import Sequence
class EventData(TypedDict, total=False):
"""Da... |
001fff3ad4aed02a3358c67611d78cb2bca67ea59c1e73a3c55fafbb9aafcabb | Python | 5,984 | 140 | # Copyright (c) MONAI Consortium
# 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 writing, so... |
41fd2d027762e42f3b1b25ed39ed3b0709276401b415c6ab803be19a5e794a42 | Python | 5,988 | 160 | import numpy as np
import scipy as sp
def kolmogorov_smirnov_analysis(features_a, features_b, all_data_a, all_data_b, verbose=True,
override_name_check=False):
"""
Calculates Kolmogorov-Smirnov statistic for two distributions.
Parameters
----------
features_a :... |
0529e94900cb41c7b2528922a85479afbec4f8a3a68acff2be314c06058ce85c | Python | 5,991 | 167 | """
##############################################################################
#
# Merge MotEvo results after scanning a given FASTA file with multiple PWMs.
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gmail.com
# ... |
1354fa6da5340a85e1b65254a435775f9f92b751d01479cba4e916e9125e6e9e | Python | 5,995 | 175 | # -*- coding: utf-8 -*-
"""
Created on Wed May 29 23:06:43 2019
@author: Iluva
"""
from sklearn.metrics import confusion_matrix, roc_curve, auc
from sklearn.metrics import precision_recall_curve, average_precision_score
from sklearn.utils.class_weight import compute_class_weight
from scipy import interp
from collection... |
ead971e5c26f064fa7bdfb6ead2a27015f6e63ac598117e10b659cc2a5b2c4c7 | Python | 5,995 | 159 | '''
***************************************************************
Author: LU
Date: Nov 2020
Description:
Class for synthesized contrast segmentation framework.
Uses an MPRAGE (CSF-nulled T1-weighted volume) to first synthesize Wmn-MPRAGE
contrast and predict thalamic nuclei + thalamus on the new represe... |
f7d54a1dd8917c8b4e7b05d6bb7f5edbe09c0f34a38e61c0428640e2bc98dcb2 | Python | 5,996 | 178 | """
Author: Anna M. Puszkarska
SPDX-License-Identifier: Apache-2.0
"""
import pandas as pd
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from pathlib import Path
from typing import List
from peptide_models.peptide import Peptide
def df2fasta(df: pd.DataFrame,
dataset... |
1b74d5678be42dbfc544e839c42f1d540b87d428ea7c88c7e022a39bb0bc7206 | Python | 5,997 | 168 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology and Department of Cognitive Neuroscience, Bielefeld University, Germany
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Mon Dec 12 11:08:00 2022
:VERSION: 0.1
This module contains functions to calculate error measures.
"""
import numpy as np
from s... |
f457b4e85f4a192f8b91cbc69a87d31dc8f588bc863278672fc29904d82dce87 | Python | 5,998 | 166 | """
auto_annotate.py: use ZephOD's feature detection to automatically annotate a frame in a dataset.
Usage:
auto_annotate -h | --help
auto_annotate -v | --version
auto_annotate --dataset=<dataset> [options]
Options:
-h --help show this message and exit.
-v --version ... |
20ba850ed1a07a4988c4c617cb7e2ea516de96c3383b0b9f875601523a41c17c | Python | 5,999 | 199 | BaseDir = "R:/Temp/Threads10/Thread0"
InnCurr = 150
MeanCurr = 150
import sys
file_name = 'Cell'
probeXs = [0] #um
probeYs = [50] #um
frequencies = [140] #Hz
ampltudes = [0.0002, 0] #Hz
DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz
durations = [9900] #ms
stopTime = [10000] #ms
rangesL = [10000] #phase calculation ... |
c45cc23007f6b6ab17038f664b995ada9b62721db088d2e08769293f4961da59 | Python | 5,999 | 199 | BaseDir = "R:/Temp/Threads11/Thread0"
InnCurr = 150
MeanCurr = 150
import sys
file_name = 'Cell'
probeXs = [50] #um
probeYs = [0] #um
frequencies = [140] #Hz
ampltudes = [0.0002, 0] #Hz
DCampltudes = [0.25, 0.35, 0.45, 0.55, 0.65] #Hz
durations = [9900] #ms
stopTime = [10000] #ms
rangesL = [10000] #phase calculation ... |
523cb5b78e462afc8b4fe9d0c08a0ea5f908098650ce5f5ec9b13c24e80daa00 | Python | 6,002 | 158 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import random
from typing import Callable
import numpy as np
import torchdata.datapipes as dp
from torchdata.datapipes.iter import IterableWrapper
import pdearena.data.utils as datautils
from pdearena.configs.config import Config
from pdearena.... |
e7b0bddcceb1f7e346e30e495f67961f84884a56e8e51b85f7ca5c645e34bdbf | Python | 6,002 | 171 | import numpy as np
import torch
import torch.nn.functional as F
from equivariant_diffusion.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked
from qm9.analyze import check_stability
def rotate_chain(z):
assert z.size(0) == 1
z_h = z[:, :, 3:]
n_steps = 30
th... |
8aa3ee3392e961aadb1f4b5a1cb083d28a78f6dbbe24269ccb202aa24b318038 | Python | 6,004 | 160 |
import os
import glob
from PoET.tracking import track_video_list
from PoET.kinematics import extract_tremor
from PoET.preprocessing import construct_data
from PoET.features import extract_tremor_features, assign_hand_time_periods
class POET:
def __init__(self, video_folder=None):
self.video_folder = vid... |
1f389126914ada1178406ccc890ed932a5d39de6a71a046f8fe66d55d06f59be | Python | 6,008 | 152 | import math
import h5py
import nibabel as nib
import numpy as np
import SimpleITK as sitk
import torch
import torch.nn.functional as F
from medpy import metric
from skimage.measure import label
from tqdm import tqdm
def test_single_case(net, image, stride_xy, stride_z, patch_size, num_classes=1):
w, h, d = image... |
8ae26e6402d5953f2a9b62d84421737949e086b5e9953cfec04c03c58f41262b | Python | 6,009 | 205 | import daisy
import numpy as np
import torch.nn.functional as F
import torch
from funlib.learn.torch.models import Vgg3D
import logging
from multiprocessing import Pool, TimeoutError
logger = logging.getLogger(__name__)
def predict(raw_batched,
model):
device = torch.device('cuda' if torch.cuda.is_av... |
2f7f025349c3f0cfb1f5d36d0241ca205043b9a350b072176b9840a3fdecbe25 | Python | 6,012 | 158 | from abc import ABC
from pathlib import Path
from re import search
from MRdataset import logger
from MRdataset.base import BaseDataset
from MRdataset.config import VALID_BIDS_DATATYPES, SUPPORTED_BIDS_DATATYPES
from MRdataset.dicom_utils import is_bids_file
from MRdataset.utils import folders_with_min_files, valid_dir... |
dd936f05d58ca827c8c7f52b9e91b7df5b82082863556bee0e25fb2872bfbc13 | Python | 6,015 | 173 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Dropout
from pnabind.nn.utils import MLP
from pnabind.nn.layers import LocalAttentionPooling, SAModule
from torch.nn import Sequential as Seq
from torch_geometric.nn.aggr import MultiAggregation
# Edge features dimensi... |
5533aa81ca34418716836304d93ccf43348bbc4255c7c7ff3b1c3917d36a7ec8 | Python | 6,019 | 159 | import math
from typing import Optional, Tuple, Union
import torch
import torch.nn.functional as F
from torch import Tensor
from torch_sparse import SparseTensor
import torch.nn as nn
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.typing import Adj, OptTensor, PairTensor
from matformer.models... |
4f1ae51098de5382f1f168e7c54477cef1e0dc88d29ff6d31e4850cc82621a3f | Python | 6,020 | 164 | """**Agent** is a class that uses an LLM to choose a sequence of actions to take.
In Chains, a sequence of actions is hardcoded. In Agents,
a language model is used as a reasoning engine to determine which actions
to take and in which order.
Agents select and use **Tools** and **Toolkits** for actions.
"""
from path... |
592e0ee48a666881e8f92c65d9500a2452b0281c2e953319b6b5117b32fea094 | Python | 6,020 | 108 | """Do multiple passes matter? Is the linear path deterministic? (answers the reviewer/user question)
(A) Deterministic linear backbone (pydeepmapper.linear_baseline): no imagification, single convex fit.
Fit TWICE -> identical top genes (Jaccard 1.0) confirms determinism; report held-out chord AUC.
(B) Torch linea... |
01a084afad90eb1f4a1eb000e016d137f4730fc3380b30e64c8b4977cdde8417 | Python | 6,022 | 147 | # third party modules
import torch
from torch import Tensor
from torch.nn import ReLU, ELU, Identity, Tanh, Dropout, PReLU, GELU, SiLU
from torch_geometric.nn import radius, fps
from pnabind.nn.utils import MLP
ACTIVATION = {
'relu': ReLU,
'elu': ELU,
'tanh': Tanh,
'prelu': PReLU,
'gelu': GELU,
... |
60eac17e73fb72cb05c7a16abb0309e8baad8b68aeb5862791e4fc5f73ec9c21 | Python | 6,031 | 168 | """**Utilities** are the integrations with third-part systems and packages.
Other LangChain classes use **Utilities** to interact with third-part systems
and packages.
"""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.utilitie... |
883d7b137ec4c6d6b082f2b663b21fb5a36833656b587baee8c979e82dbfdcca | Python | 6,032 | 167 | import gc
import os
import argparse
import pandas as pd
import glob
from .featurization import get_contact_map,onehot_encoding,position_encoding,\
hhm_encoding,pssm_encoding,seq2vec_encoding,lm_encoding,feature_concat,build_parse_matrix,build_parse_matrix_multi_lm
def load_mll_seqs(csv_file):
# * load multi-l... |
adad5b672e45df5359cb50fea5d04eb854ceaf2de36bce102de18f25d83b4c48 | Python | 6,035 | 242 | """=====================
MeDIP pipeline - Meta
=====================
:Author:
:Release: $Id$
:Date: |today|
:Tags: Python
Meta pipeline for :doc:`pipeline_medip`. A meta pipeline analysis the
output of multiple runs of the same pipeline.
Methods
=======
Usage
=====
See :ref:`PipelineSettingUp` and :ref:`Pipeline... |
767c0e4b9ffbe3e2655b76ec79cd136eb0336816be107e886a021c45d7e1de5b | Python | 6,040 | 160 | import pandas as pd
import numpy as np
import sys, os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import matplotlib.pyplot as plt
import seaborn as sns
from keras.models import Sequential
from keras.layers.core import Dense, Dropout
from keras.callbacks import EarlyStopping
from keras import regularizers
fro... |
71b02308720e126ecbade96a035a294772a79bd1e485bb789b63becd7a7b89a9 | Python | 6,041 | 171 | import torch
from torch import nn
from utils import RBFExpansion
from transformer import ComformerConv
from torch_scatter import scatter
import math
from e3nn import o3
from typing import Optional, Tuple, Union
import torch.nn.functional as F
from torch import Tensor
from torch_sparse import SparseTensor
import torch... |
fd6e09bd5525c782bc421c655f370a121ca83bcc609ab4346d63fa926af96d42 | Python | 6,046 | 170 |
import matplotlib.pyplot as plt
plt.style.use('classic')
plt.rcParams['svg.fonttype'] = 'none'
import matplotlib as mpl
mpl.rc('font',family='times new roman')
import numpy as np
import pandas as pd
import DAE_params as prms
#################################################
#
# This script finds all training traje... |
0b12111c35f86c096da42461ba7f4e799c74d044f46a04cd69fe3f1b74631519 | Python | 6,054 | 199 | #!/usr/bin/env python3
import argparse
import numpy as np
import nibabel as nib
from time import time
from dipy.io import read_bvals_bvecs
# from dipy.core.sphere import HemiSphere
from dipy.core.gradients import gradient_table
from dipy.sims.voxel import multi_tensor
from odf_utils import true_MD_func
from dipy.re... |
53489530a61201825227aac0943412d0b5070f35b04388a375e62c6e000d8e21 | Python | 6,059 | 128 | import sys
sys.path.append('..')
from src.utils import set_random_seed
import argparse
import torch
from torch import nn
from torch.utils.data import DataLoader
import numpy as np
import random
from src.data.featurizer import Vocab, N_ATOM_TYPES, N_BOND_TYPES
from src.data.finetune_dataset import MoleculeDataset
from ... |
ce1ccd3fa20de3443cffcf7362291a65d9bf33f3ef35878064ac9e2312d98d13 | Python | 6,063 | 171 | from __future__ import annotations
from collections import OrderedDict
from collections.abc import Hashable
import pandas as pd
from skbase.base import BaseObject
from skbase.lookup import all_objects
from pgmpy.utils import build_state_names, get_dataset_type, preprocess_data
class BaseStructureScore(BaseObject):... |
0e6492671f099708de7a864097d83de066468b38f017855738c3e37c7279afc6 | Python | 6,073 | 196 | import json
from typing import Any
import pytest
from pydantic import BaseModel
from langchain_core.exceptions import OutputParserException
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
from langchain_core.output_parsers.openai_functions import (
JsonOutputFunctionsParser,
PydanticO... |
3f606801e15f4a1f68f96db2279303c9dd59ddf2b54059b5f90cd3a80210dd35 | Python | 6,075 | 152 | import pickle
import re
import string
import os
class DataHelper():
def __init__(self):
pass
def clean_text(self, text_doc, new_line_elimination):
punctuations = r')(}{:؟!،؛»«.' + r"/<>?.,:;"
punctuations = '[' + punctuations + string.punctuation + ']'
punctuation... |
6d729453cd99243f9db8bba4ef7adf7c75ad159853a9b8aec957b07cd0c7b81c | Python | 6,076 | 147 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 26 14:13:38 2024
@author: baran
"""
import numpy as np
from matplotlib import pyplot as plt
from pandas import read_csv
siteMap = [27,28,12,29,11,20,7,21,10,1,15,8,26,18,31,23,9,2,14,6,25,17,30,22,0,19,13,24,4,16,3,5,43,32,56,45,60,35,52,40,41,33,... |
6333cf90038717960a3b44441aadae5219c6eba7a33c71044403f7ce0d3de89a | Python | 6,077 | 155 | # builtin modules
import os
# third party modules
try:
import freesasa
freesasa.setVerbosity(freesasa.nowarnings)
class Radius(freesasa.Classifier):
def initialize(self, components=None, radii=None):
if components is None:
components = data.chem_components
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.