sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b132cde2470cdb961f68ce9e5b96f86cabd5dd99b7c0687f08e6894755d67d92 | Python | 3,217 | 109 | # -*- coding: utf-8 -*-
"""
This file contains utility methods that many be useful to several dataset
classes.
check_split_ration, stratify, rationed_split, randomshuffler
were all copy-pasted from torchtext because torchtext is not yet packaged
for anaconda and is therefore not yet a reasonable dependency.
See https:/... |
0be4d1d356a6a4aeda2ed8312328f9622010c1c6715db02365e3401c5622d214 | Python | 3,219 | 108 | """
:AUTHORS: Martin M. Müller
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: martin.mueller@uni-bielefeld.de
:SINCE: Fri Dec 10 11:04:58 2021
"""
import numpy as np
from scipy.stats import chi2
def calc_aic(log_likelihood, n_params, sample_size):
"""
Calculate the Akaike informatio... |
23992710db0503a3a862cad42057b335500c6076407b5860354aa4ae5f1b5fd2 | Python | 3,219 | 116 | """**LangSmith** utilities.
This module provides utilities for connecting to
[LangSmith](https://docs.langchain.com/langsmith/home).
**Evaluation**
LangSmith helps you evaluate Chains and other language model application components
using a number of LangChain evaluators.
An example of this is shown below, assuming y... |
a402d3b9abc29b5984060f71ff688c81fced09f835109f8d92f1361a69b52af2 | Python | 3,219 | 109 | # PrairieLink
# Lloyd Russell 2017
import os
import numpy as np
import time
import tkinter as tk
from tkinter import filedialog
def ReadRawFile(movie_path=None, start=1, stop=np.Inf, num_frames=np.Inf, verbose=False) -> np.ndarray:
"""
Read raw file created by PrairieView into array.
Input
-----
movie_path : s... |
666200ce5a64461780df941e9582f242d2d476a401ede632e6a2036cffcc9770 | Python | 3,220 | 95 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import pandas as pd
import ptitprince as pt
import seaborn as sns
from configs.configs import get_config_dict
from helpers.figures import set_size
def plot_optimal_window_lengths(
config_dict: dict,
optimal_window_lengths_df: ... |
c4daf6772c0f9e5fc71c7590ec9e280d2ecc0541600d3ee387d4b7b64306d117 | Python | 3,220 | 90 | """Optimizes hyperparameters using Bayesian optimization."""
from copy import deepcopy
import json
from typing import Dict, Union
import os
from hyperopt import fmin, hp, tpe
import numpy as np
from HMSA.args import HyperoptArgs
from HMSA.constants import HYPEROPT_LOGGER_NAME
from HMSA.models import HMSAModel
from H... |
e14211bda590a47802ccf1c8bbe6bb79f9ec14d0c99a34583d501bd28f2b0c9b | Python | 3,220 | 104 | import numpy as np
import torch
import torch.nn as nn
from torch_geometric.nn.acts import swish
from torch_geometric.nn.inits import glorot_orthogonal
class ST_Net_Exp(nn.Module):
def __init__(self, input_dim, output_dim, hid_dim=64, num_layers=2, bias=True):
super(ST_Net_Exp, self).__init__()
self... |
9d67c89c367a7778c0f2ac66e0be891342446e6cb9f29c6e910f3fe9262a260a | Python | 3,222 | 123 |
# simple sequences to test output of model and model LCs
# varying female position, size, and rotation
import numpy as np
import zipfile
import pickle
from tensorflow.keras.preprocessing import image
from PIL import Image
import scipy.ndimage as ndimage
import os
class StimulusClass:
def __init__(self, st... |
367b73339f8a56d2c81f492632ba8719a572e50bc508d5ea2b43fa2131be81eb | Python | 3,225 | 92 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
4991f5bc8772e3d7c7fe7b130ea559cbc2890aa4e0322963ca3c6cdc0c8329fb | Python | 3,227 | 69 | # -- coding: utf-8 --
# @Time : 2023/7/23 17:57
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : transform_adata.py
# @Description: This file is used to ...
import anndata
import scanpy as sc
from pathlib import Path
from scipy import io
import os
if __name__ == '__main__':
output_for_R_path = ... |
c835ed66b29d83950e46d84d3b80649f02e5a43da8baf22ec6e01eec4d8885eb | Python | 3,227 | 104 | import uuid
from io import StringIO
from typing import TYPE_CHECKING
from nglview.base_adaptor import Structure, Trajectory
if TYPE_CHECKING:
from openff.toolkit import Molecule, Topology
MOLECULE_DEFAULT_REPS = [dict(type="licorice", params=dict(radius=0.25, multipleBond=True))]
class MoleculeNGLViewTrajector... |
e276403860ac1a65e1be80f3ef1f23db7902ac4fa6823b10678a574db89748b6 | Python | 3,227 | 88 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 7 18:10:46 2022
@author: vandadim
# The path to the data file is specified by Data_Path variable.
# The script reads the data using NumPy's genfromtxt function and separates the data into input
features (Data_X) and output labels (Label).
# The objective of the ... |
dc6da71420c6b6d7f04040bd453f6107bfc92bba0783360ce3047fef24b05442 | Python | 3,230 | 84 | # srun --nodes=1 --ntasks=1 --cpus-per-task=8 --gpus=1 --mem=100g --time=06:00:00 --pty bash -i
# Sconda conda activate ghmc1; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/GhmCN/reviewer_questions/distribution_of_genes_and_distances_activ72B; python
import pandas as pd
import numpy as np... |
4aef554dc3108a94510a54a2b6683fe63d17e89d0ea22937419b96a1243b8058 | Python | 3,232 | 115 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
a6cf3d7d7a3335536cd88c9810ee6547f81f3b3c9f2eedba4a769f7cfbe67438 | Python | 3,232 | 79 | import sys
import os
import numpy as np
import torch
import torch.utils.data as du
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import util
from util import *
from DrugGene_Network import *
import argparse
from sklearn.preprocessing import MinMaxScaler
def predict_cnvBox(p... |
17a15683263f6b4fb0286421f91371ebb8e9142c857df9f42abf6697797caea7 | Python | 3,233 | 91 | import pandas as pd
import numpy as np
import h5py
import torch
from torchvision import transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader,Dataset
from engine import utils
from constants import ILD_DIS
from constants import MEAN_STD
from dataloaders import data_tfms
class R... |
1508d72c9a54a15bd8208dc572b682d0e2739583534db66cc731e738194ba186 | Python | 3,234 | 73 | class AminoAcid:
def __init__(self,
letter: str,
index: int,
electrostatic: bool,
hydrophobic_e: float,
pka: float,
charge: float,
hydrophobic_kd: float,
iso_point: float,
... |
6747f16d74f4e284f463ab999456a0f77df8477784867d531462f820f5269060 | Python | 3,234 | 99 | import pytest
from langchain_core.agents import (
AgentActionMessageLog,
AgentFinish,
)
from langchain_core.exceptions import OutputParserException
from langchain_core.messages import AIMessage, SystemMessage
from langchain_classic.agents.output_parsers.openai_functions import (
OpenAIFunctionsAgentOutputP... |
253825ed19c64757579e8f1f173c982421cee3661bebf4c6338034b90dff02df | Python | 3,236 | 92 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 6 21:08:57 2021
@author: athanasiadis
"""
from sklearn.neighbors import NearestNeighbors
import numpy as np
from joblib import Parallel, delayed
import multiprocessing
import mkl
def sorter(indexer,distancer,r_start,r_stop):
"""
sorte... |
5234886c3ecda05b2b2970425393f82be2aba00cacd39405a694766285a771f6 | Python | 3,237 | 101 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 5 12:03:01 2021
@author: athanasiadis
"""
"""
relevance
______________________
This is a script that identifies the highly task relevant patterns.
Input:
- several functions needed for the relevance test and the results of the adversar... |
54f3dff53d547a650871f4821ef03e91713fb86dd8a2c57a3800e95a92805d60 | Python | 3,237 | 105 | # 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... |
75851a40582c3558d793d3523f1cc77c821e1d3359751e0cf703643c23a4a508 | Python | 3,237 | 85 | # 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... |
c5dd6e78b1aba8136b37d131d628387a426a0d9bd3d8b71c3b6674268644c2f5 | Python | 3,237 | 87 | import numpy as np
import cv2
from tiatoolbox.wsicore.wsireader import WSIReader
import h5py
def mask2epithmask(img, color_dict, labels=[2,3,4]):
for l in color_dict:
# if l < 2:
if l not in labels:
img[np.where(np.all(img==color_dict[l], axis=2))] = (0,0,0)
else:
im... |
35052698cb98763d39d6d43dded81d190a4ac93159b896753d6494909658d051 | Python | 3,239 | 97 | """Toolkit for interacting with a vector store."""
from langchain_core.language_models import BaseLanguageModel
from langchain_core.tools import BaseTool
from langchain_core.tools.base import BaseToolkit
from langchain_core.vectorstores import VectorStore
from pydantic import BaseModel, ConfigDict, Field
class Vecto... |
57be8e4eb241d4d4dacb43c6fcadebbcf11bd4b3bae3dc860e7ffd91338bda60 | Python | 3,239 | 95 | import pyqtgraph as pg
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal, QThread
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
import socket,os
NB_NRN = 512
DATAWIDTH_BIT = 32
DATAWIDTH_BYTE = int(DATAWIDTH_BIT/8)
NB_REGS_SPK ... |
34a4665f365d7c103f0c2e77e134ec57dde79058c4d484503b9df5d4b1082de3 | Python | 3,240 | 97 | """
A "serverless" Python client for reading and writing arbitrarily large
Neuroglancer Precomputed volumes both locally and on cloud services.
Precomputed volumes consist of chunked numpy arrays, meshes, and
skeletons and can be visualized using Neuroglancer. Typically these
volumes represent one or three channel ... |
40b4deeba77402aab43290ca1f5aab22a6ba5ad0f1fc0435168966a7849fe78b | Python | 3,241 | 113 | from langchain_core.messages import HumanMessage
from langchain_core.messages import content as types
from langchain_core.messages.block_translators.langchain_v0 import (
_convert_legacy_v0_content_block_to_v1,
)
from tests.unit_tests.language_models.chat_models.test_base import (
_content_blocks_equal_ignore_i... |
202742c4d52a30a774e9e2e4b9bcc086bedf53a98e40e27e8f3c29557867a43d | Python | 3,242 | 92 | import math
from typing import List, Union
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from tqdm import tqdm
from HMSA.data import MoleculeDataLoader, MoleculeDataset
def param_count(model: nn.Module) -> int:
return su... |
e20e5e56273de9d8d1ad8704fc967e8417739869bcf2cbdaa1c3b63e3109a8ae | Python | 3,242 | 85 | import os
import argparse
import pandas as pd
import random
random.seed(49297)
from tqdm import tqdm
def process_partition(args, partition, eps=1e-6, n_hours=48):
output_dir = os.path.join(args.output_path, partition)
if not os.path.exists(output_dir):
os.mkdir(output_dir)
xy_pairs = []
patie... |
ca584f50cdfa7ec1fd79af77fb92e0a6201d60fabbc807455cd69b19c4a0ecf3 | Python | 3,243 | 87 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Dense(nn.Module):
def __init__(self, dims, num_dense_blocks=3, num_dense_filters=16, num_dense_convs=4):
super().__init__()
self.modules = []
in_feats = dims[0]
out_feats = 32
self.data_enc_init_p... |
add376a8632d9cb1452890938cd630a0d99e38e8ccad8d9610a6d690bfba6796 | Python | 3,244 | 94 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 4 16:37:06 2021
@author: athanasiadis
"""
import numpy as np
import time
from joblib import Parallel, delayed
import multiprocessing
import mkl
import tqdm
num_cores = multiprocessing.cpu_count()
mkl.set_num_threads(num_cores)
import significan... |
edb6df1d214f74ea0f0f84df680f8fce795c83c7bb4ecb1e066a6be4df473c2e | Python | 3,244 | 135 | import os
import sys
import re
import types
import itertools
import math
import numpy
from PeakcallingReport import *
class PeakCallingStatus(DefaultTracker, Status):
'''status information for mapping stage.'''
def testCalling(self, track):
'''number of peaks called. The number of peaks expected in... |
1b3111c36ad7daa5eb4bdce1e302d3e6c6a071364896e725bddbb5fd6a1c0090 | Python | 3,245 | 95 | import pyqtgraph as pg
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal, QThread
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
import socket,os
NB_NRN = 512
DATAWIDTH_BIT = 32
DATAWIDTH_BYTE = int(DATAWIDTH_BIT/8)
NB_REGS_SPK ... |
e4d74dd240c79ce78ee90ae496d5e7750d94e73d4cb2ba1649fb46ecf6e21497 | Python | 3,245 | 99 | import warnings
from collections import OrderedDict
import torch
from torch import nn
from torch.nn.init import xavier_normal
class MLP(nn.Module):
def __init__(
self, neurons, input_channels=3, hidden_channels=10, layers=2, bias=True, n_parameters_to_modulate=1, **kwargs
):
super().__init__(... |
ad5726649630712b60b5b45e52aa3a215bf2ca285c6786acef1f69a910e7f9b8 | Python | 3,246 | 77 | # Copyright (c) <2024> <University of Paderborn>
# Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/
# https://github.com/SSTGroup/relationship_structure_identification
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and as... |
ec43dd2e842496f9496d9aa479fe3c237f10deae8bb6fca1b698806582853518 | Python | 3,246 | 88 | """
"""
import tensorflow as tf
import tensorflow_probability as tfp
from paths import MODEL_PATH
def median_error_fraction(y_true, y_pred):
error = abs((y_true - y_pred) / y_true)
return tfp.stats.percentile(error, 50.0, interpolation='midpoint')
def get_model():
model = tf.keras.models.Sequential()
... |
4cdda3b21a8922c00a3250c2c45010e4c63b30f0e86117b0dc54b05141b6beea | Python | 3,247 | 90 | import numpy as np
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA, FastICA
from sklearn.manifold import TSNE
from matplotlib import pyplot as plt
from fancyimpute import SoftImpute
def apply_dim_red(dim_red, data, correlation):
"""
Apply dimensionality reduction... |
5e9a88d5195cc351feb33db0e7fc565dd60bb8a46df8cccdd1d2a7a748fdc286 | Python | 3,247 | 89 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
0ccb1feb525999bfd372192aae33d18e9265070cd5e2380e6eccb19b4b47f333 | Python | 3,249 | 105 | from torch.utils.data import DataLoader
import torch
import numpy as np
from torch import nn,optim
from bestmodel import MyModule
from Dataset import MyDataset
import sklearn.metrics as m
from numba import njit
import pandas as pd
import os
import warnings
warnings.filterwarnings('ignore')
def RMSE(y_true... |
d9510214cb086d9ff3579d60f78e3a3d6125a5a3d6c6a8619f6e1ed91e36e31e | Python | 3,249 | 89 | import os
import pickle
import numpy as np
import torch
from torchvision import transforms as tf
import scipy.io as sio
import torch.nn as nn
def train_valid_test_split(x, y, train_ratio=0.8, valid_ratio=0.1):
split_train_index = int(x.shape[0] * train_ratio)
split_valid_index = int(x.shape[0] * valid_ratio)... |
eb987991ea88aa37ad30cea893930bb14cdf511fa6011780517fdfc6f634a652 | Python | 3,250 | 103 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
3a602c4d5be1fd7fe4837c36e1179c7c720ae3403122d013c3c64b8ed69d899d | Python | 3,251 | 92 | """ Import Progenesis Output
Progenesis QI for proteomics allows user to export proteomic
quantitative data as .csv.
@author: Reis-de-Oliveira G <guioliveirareis@gmail.com>
"""
import numpy as np
import pandas as pd
class Input:
def __init__(self, Table, **kwargs):
""" Progenesis output for OmicSco... |
99987b72dbfbafeaca208b10e3d6727542fa3e8c5ad497fee088ab3bc0d38962 | Python | 3,251 | 78 | #!/bin/env python
"""
Filter CDD export for main medicinal chemistry series
https://app.collaborativedrug.com/vaults/5549/searches/11042338-xOBBXlC_s3dSQsHW3UaO2Q#search_results
Header:
Molecule Name,Canonical PostEra ID,suspected_SMILES,ProteaseAssay_Fluorescence_Dose-Response_Weizmann: IC50 (µM),ProteaseAssay_Fluor... |
fe1c054b3e73d778268a6b7838f95e9c3442cfe299d9e2711a083109d0019a99 | Python | 3,252 | 102 | # 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... |
1a33fb1d84ee40d612d32823fd4e37ae5164ac2084f029e8378a7379d0de3b74 | Python | 3,253 | 88 | # This file aggregates and plots the results from the experiment
# One figure for r2, one for mse
# Label with linear/poly scaling_type linear/ffnn
# Load all files in directory
from os import walk
import pandas as pd
import matplotlib.pyplot as plt
import pdb
SMALL_SIZE = 16
MEDIUM_SIZE = 20
BIGGER_SIZE = 20
plt.... |
649cbf464a6f2b83739599c9563975ff67e5dd5c21d060231d8115ea85850572 | Python | 3,254 | 98 | import logging
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model, Sequential
from tensorflow.keras.layers import BatchNormalization, Conv2D, Conv3D, Dense
from tensorflow.keras.models import clone_model
from typing import Union
from ...utils import infer_graph_structure
logformat = '%(asc... |
34a9fa584316499ed7feae6a8b77ecdc308c49d2685fbe425d8159a63edf3298 | Python | 3,255 | 93 | from __future__ import annotations
import numpy as np
from libs.common.metrics import Metrics
from libs.dataset.naturalimage import NaturalImage
from libs.function.function import Scaling, Tanh
from libs.function.info import MI_matrics, TE_matrics
from libs.model.model import Model
from libs.optimizer import SubNormH... |
73a8ac64d66a47f61ba649fc827933cf93025caf25593dd681b93e31a30d060f | Python | 3,255 | 114 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: py:percent,ipynb
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.15.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# -... |
8012738b83e2e2fabcd3a992f0c1c4ec0e42590ec2e5fe4f3a095aa22578b23b | Python | 3,255 | 82 | """Tests for pydeepmapper.earlystop.EarlyStopper (plateau early-stopping).
Reproduces Keras EarlyStopping(monitor, patience, min_delta, restore_best).
Stdlib + pytest + hypothesis only, no torch."""
from __future__ import annotations
import os
import sys
from hypothesis import given
from hypothesis import strategies ... |
79c6112dd9750047e2f23c2ba927458cf63dc0fdaa357524d15f75af8d183554 | Python | 3,258 | 89 | from unittest import TestCase
import numpy as np
import pytest
import torch
from chroma import constants
from chroma.data import Protein
from chroma.layers.structure import backbone, sidechain
class TestSideChain(TestCase):
def setUp(self):
self.builder = sidechain.SideChainBuilder()
self.chi_an... |
371cf4c9cdca38c7484e221dc7518fa622ff82789b1b1e05e3f9c10a14a1b514 | Python | 3,259 | 113 | """Test PandasDataframeParser."""
from typing import Any
import pandas as pd
import pytest
from langchain_core.exceptions import OutputParserException
from langchain_classic.output_parsers.pandas_dataframe import (
PandasDataFrameOutputParser,
)
df = pd.DataFrame(
{
"chicken": [1, 2, 3, 4],
... |
c992c914851756f1b8627510e3073d78545f70b14c8b0344aa658d8ebc8d14d6 | Python | 3,260 | 102 | #! /usr/local/bin/python
#'#################################################################################
#'#################################################################################
#' Train autoencoder from CNN network
#'#################################################################################
#'#... |
e4f5ebf6507c74ba5b7a66ce3fb73b7670cd18d41d6d103f1232257de550d845 | Python | 3,260 | 96 | import os
import sys
import img3
import argparse
import matplotlib.pyplot as plt
import numpy as np
import skimage.io
from numpy.ma import masked_array
from matplotlib import cm
# group details
group1 = [4834, 4836, 4844, 4849, 4851, 4858, 4864, 4868]
group2 = [4837, 4840, 4847, 4848, 4850, 4871, 4873]
group3 = [4838... |
084a58a3a4e990bcdc52a1be28e1923078f8de60315fe728f5930cdef817cda6 | Python | 3,261 | 74 | from torch.utils.data import Dataset
import os
import pandas as pd
import numpy as np
from dgl.data.utils import load_graphs
import torch
import dgl.backend as F
import scipy.sparse as sps
SPLIT_TO_ID = {'train':0, 'val':1, 'test':2}
class MoleculeDataset(Dataset):
def __init__(self, root_path, dataset, dataset_ty... |
deb26a859e18df2b5e9471f8709fe8d2f865718a105de38b118eb6c9df9c60a5 | Python | 3,261 | 97 | from typing import Any
from langchain_core.utils.json import parse_json_markdown
from typing_extensions import override
from langchain_classic.evaluation.schema import StringEvaluator
class JsonSchemaEvaluator(StringEvaluator):
"""An evaluator that validates a JSON prediction against a JSON schema reference.
... |
440e49a73cba0c2f821c42d6d49bfd5fab369a6d3bf3965ea74421e76d9bd15c | Python | 3,264 | 81 | import logging
import os
import socket
from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples
import numpy as np
import pandas as pd
import pingouin
from configs.configs import get_config_dict
if __name__ == "__main__":
data_split = 'LEOO' # leave-every-other-out
pp_pipeline = ... |
c6e7dec6165f75e8d8e9cff78efea8ad6aa3bb7281fdbf3dd1e6d7e06cea09d0 | Python | 3,264 | 108 | # 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... |
b5b9de907ebb6519bd28fb05beac034d27927f7aa280bffa17535db421923f84 | Python | 3,265 | 82 | import logging
import os
import socket
import sys
from fcest.models.mgarch import MGARCH
import pandas as pd
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.rockland import get_rockland_subjects, load_rockland_data
if __name__ == "__main__":
p... |
30e509a9470e96462eae1f5076e547789f1c3611a4e50cba4b9c2e3f4210d8b8 | Python | 3,266 | 82 | import sys
import os
import numpy as np
import torch
import torch.utils.data as du
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import util
from util import *
from DrugGene_Network import *
import argparse
from sklearn.preprocessing import MinMaxScaler
def predict_expBox(p... |
402b1817d5704f3a1ae2b981ec35c7dc4d3d24be6ecabeaa43c3f71176c2fe6b | Python | 3,266 | 107 | # 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... |
959a290628abc867bea63ef575201d537d4e19f175239dba191ebfa4427b0804 | Python | 3,267 | 58 | import mne
import numpy as np
import pandas as pd
import os.path as op
from config_FaceName import MEG_data_path,group_name,Ids,bids_root,MRI_data_path,conditions_encode,conditions_recall,eq_conditions_encode,eq_conditions_recall
from mne.preprocessing import read_ica
from mne_bids import BIDSPath
from mne.minimum_norm... |
a0870a6dd33ad98ce19875a53461b101ae27856b69f70b75e09dfe6ac2b26bd1 | Python | 3,267 | 86 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
from pointnet_utils import STN3d, STNkd, feature_transform_reguliarzer
class get_model(nn.Module):
def __init__(self, part_num=50, normal_channel=True):
super(get_model, self).__init__()
... |
b6e99b8f7b90452f757adf69c2669eca183fea48cd0d6648e37b9cb284758f7c | Python | 3,267 | 90 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
7f3126ce297ffefd4d1b23255f539a27c8c2eb896bc24c182f6585c4d07d6922 | Python | 3,268 | 79 | # Loads in weights and evaluates model (ECE, MCE, error rate) and saves logits.
import keras
import numpy as np
from keras import optimizers
from keras.datasets import cifar10, cifar100
from keras.models import Sequential
from keras.layers import Conv2D, Dense, Flatten, MaxPooling2D
from keras.callbacks import Learnin... |
a610159bca83ef3bfa05f541a4604e14348b9b9353bc5a92677729afaffcf668 | Python | 3,268 | 90 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
5e610942f39e6f71ab0a5f2868e15ddf4346e0c08c38a196ecccbf793d9098fc | Python | 3,269 | 109 | from __future__ import annotations
import numpy as np
from libs.function.function import Tanh
from libs.function.utils import sparse_matrix
class NN:
def forward(self, data: np.ndarray) -> np.ndarray:
return data
def __call__(self, data: np.ndarray) -> np.ndarray:
return self.forward(data)... |
3b9839de9667171672329a5e5b89f83f14834937b5628d26f936ea6d426503b2 | Python | 3,270 | 105 | """
Write TIP3P-EW parameters into a SMIRNOFF force field. Based on
https://github.com/openmm/openmm/blob/116aed3927066b0a53eba929110d73f3daew64bd/wrappers/python/openmm/app/data/tip4pew.xml
"""
from pathlib import Path
from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField
from openff.toolkit.typin... |
3278d696b8263fce14718c51eed9652d09b55765548ea40d8c5b6118a75ff03d | Python | 3,271 | 85 | #!/usr/bin/env python
import argparse
import requests
import json
from string import Template
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("query_file")
arg_parser.add_argument("chain_ids")
arg_parser.add_argument("--output_uniprot", action="store_true")
arg_parser.add_argument("--chain_ids_format", ... |
45221a754df11c7038a67d7c501c0caab5dc6ffe1e0d5b6cef091ebb064ef436 | Python | 3,271 | 98 | import imp
from locale import normalize
from random import shuffle
import cv2
import numpy as np
from torch.utils.data import Dataset,DataLoader
from engine import utils
from torchvision import transforms
from torchvision.utils import save_image
from PIL import Image
class Randomize(object):
"""Shuffles pixels of... |
87f52eb502829e4cb8d8c3393fefe186b5aafa5b504db55fe86b2cc14244e786 | Python | 3,273 | 104 | # Training procedure for SVHN using ResNet 152 (SD)
import os
os.environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import collections
import pickle
from sklearn.model_selection import train_test_split
from keras.optimizers import SGD
from keras.preprocessing.image import ImageDataGenerator
from keras.utils i... |
35de6184a4fa10bf19117cd552385f7918cc7c4d861c6b7179ae85d0e7cb9932 | Python | 3,275 | 88 | import numpy as np
from edNEGmodel.edNEGmodel import *
from functions.initial_values import *
from functions.solve_edNEGmodel import *
import os
print('*************************************************')
print('* Convergence analysis starting *')
print('*******************************************... |
1a03b932d1e0af567d9fd7395204de8b2c7cad7ba620d9e3c708d37419fdecee | Python | 3,278 | 83 | import pandas as pd
import sys
from mantis_ml.modules.pre_processing.data_compilation.process_generic_features import ProcessGenericFeatures
from mantis_ml.config_class import Config
class ProcessCKDSpecificFeatures(ProcessGenericFeatures):
def __init__(self, cfg):
ProcessGenericFeatures.__init__(self, ... |
3a465113681d9dc734a608cd2dcbcac09494361e94fbbe6a4f63e3e79b0c9336 | Python | 3,281 | 82 | # 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... |
169dcb2465324f20675275dfd0b8a2809a250daa7d29d70f8eb9673bf05fe339 | Python | 3,282 | 74 | import cv2
import os
import matplotlib.pyplot as plt
import numpy as np
from PIL import ImageDraw, ImageFont, Image
"""
Script pour la génération de mosaïques pour le contole qualité de la classification de cellules mortes et vivantes
"""
def generate_mosa_raw_images(folder):
images_folder = os.path.join(folder... |
78c2fc5ad83d9b89ce23b445768c975b183149face0845099fe8a9a116e424e7 | Python | 3,283 | 104 | """In memory document index."""
import operator
import uuid
from collections.abc import Sequence
from typing import Any, cast
from pydantic import Field
from typing_extensions import override
from langchain_core._api import beta
from langchain_core.callbacks import CallbackManagerForRetrieverRun
from langchain_core.... |
fe223af0e72e902117e55f50c28136bede10b26a6d6e8d56eebb2759d1e66d91 | Python | 3,284 | 82 | import requests
import os
import time
import tqdm
from src import constants
from src import utils
def init_repositories():
# First, we need to download the list of repositories from the Galaxy ToolShed
if os.path.exists(constants.PROCESSED_REPOSITORIES):
processed_repositories = utils.load_json(consta... |
cae07abdeab7af8cacea7db791ccdb4c53de13173767ae6d8819b98fc504854e | Python | 3,285 | 80 | import torch
from torch import nn
from neuralpredictors.layers.activations import Elu1
from .base import GeneralizedEncoderBase
class GaussianEncoder(GeneralizedEncoderBase):
def __init__(self, core, readout, shifter=None, modulator=None, eps=1.0e-6):
nonlinearity_type_list = [nn.Identity(), Elu1()]
... |
5421584ae5da3871c08cc358182a811d19fd00597868a1d2a8c47b42b3a30aaf | Python | 3,286 | 84 | #!/usr/bin/env python3
"""
Run the enrichM annotate → enrichment pipeline in sequence.
Usage:
pixi run pipeline --genome_dir <dir> --metadata <tsv> [options]
Options:
--genome_dir Directory of genome .fna files (required)
--metadata Genome-to-group TSV file (required)
--output Output di... |
6b8aa8f116eab83c5396f8d4adaf948bb3b9974250785131285c6c0c207eeb91 | Python | 3,286 | 113 | import math
import matplotlib.pyplot as plt
from matplotlib import gridspec, cm
from torch.utils.tensorboard import SummaryWriter
import torch
from data import generate_recog_data
from net_utils import load_from_file
from plotting import maxval, maxabs, plot_W, plot_B, ticks_off, plot_train_perf, plot_recog_... |
66b7b29782c98735ce0446904a391182ba1aab7f915e4ce16ff706bcf4c14209 | Python | 3,287 | 87 | import logging
import os
import socket
import sys
from fcest.models.sliding_windows import SlidingWindows
import pandas as pd
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.rockland import get_rockland_subjects, load_rockland_data
if __name__ == "... |
0db4978e0bf2a6a36dcf7677fc04b678cd6926018d44c365fafe9b50030dd1d8 | Python | 3,288 | 85 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class AttentionConv(nn.Module):
"""
Implementation adapted from https://github.com/leaderj1001/Stand-Alone-Self-Attention
"""
def __init__(
self,
in_channels,
out_channels,
... |
96bb209db31f63d529e4be234ae7aa98b1baa106cf2e11127dbabbd556cc0c97 | Python | 3,288 | 101 | import tensorflow as tf
from abc import ABC, abstractmethod
from tensorflow.keras.layers import Layer
from typing import List
class LRPLayer(Layer, ABC):
def get_weights(self, *args, **kwargs):
bias = self.layer.bias if self.layer.use_bias else None
return bias, self.layer.weights[0]
def __in... |
3bf5d369a744920d4b9c990dc6098242c3563ada9278afdec2ef5acfb2f957e3 | Python | 3,290 | 110 | import pandas as pd
import pathlib
import yaml
import json
import gzip
def read(filename):
try:
data = pd.read_csv(filename, usecols=["GENE NAME"]).squeeze()
except ValueError:
data = pd.read_csv(filename, usecols=[0], header=None).squeeze()
return data
def main():
files = pd.Series(... |
9251472c6f49fe07302432d44e67fe810c8b811f0623c2f943d1d9eb4ca9981c | Python | 3,290 | 91 | """
Created on Thu Jul 7 18:10:46 2022
@author: vandadim
# This script loads a dataset from a CSV file, where the last column is assumed to be the dependent
variable (Y) and the other columns are assumed to be independent variables (X).
# The path to the data file is specified by Data_Path variable.
# The s... |
945722de0dfcf0fe3ba9b9b6214455a9b052dc73ac01b11537822d2669a54864 | Python | 3,290 | 124 | """
Django settings for tffp project.
Generated by 'django-admin startproject' using Django 1.11.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... |
301deaa543b466bd8ac19b9bc2ac020ca3942e865b71c8d6b240ff1697114f4a | Python | 3,293 | 80 | import sys
import os
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], '../../../../'))
import Articles.Sequential_Learning_Striatum.Figures.cfg_pdf as cfg
experimentalist, neuron = ('Elodie', 'MSN_In_Vitro')
name_exp = '20190107_1_AP_1'
path_read =... |
d3502626de86d7eb683a8e4be0fd567fa891b954bc48d1cb01737d32a8a567db | Python | 3,294 | 71 | """Checked extraction shared by atlas data and source-dependency preparation."""
import json
from pathlib import Path, PurePosixPath
import re
import shutil
import tarfile
from utils.files import sha256_file
ASSETS = Path(__file__).resolve().parents[1] / 'assets'
def extract(archive, destination, root_name, max_byt... |
e617c21d06c8d7577a85d0f67ef5a43ec0d26f29f3f3d2ec6795ce3a5ea41fdd | Python | 3,295 | 112 | import hashlib
import os
import pickle
from abc import ABC, abstractmethod
import torch
class AbstractPreprocessor(ABC):
# language=rst
"""
Abstract base class for Preprocessor.
"""
def process(
self,
csvfile: str,
use_cache: bool = True,
cachedfile: str = "./proc... |
60aef28a37e597bf5b8aea523444619dc277cafc55a15616e22b697adc4bd0d8 | Python | 3,296 | 81 | """
Created on Thu Jul 7 18:10:46 2022
@author: vandadim
# This script loads a dataset from a CSV file, where the last column is assumed to be the dependent
variable (Y) and the other columns are assumed to be independent variables (X).
# The path to the data file is specified by Data_Path variable.
# The scr... |
79a402fd9bb23c914eb03cc928a0a0ad663dde85964f0dadf40a3365b76ffd34 | Python | 3,296 | 88 | def compute_functional_timeseries(
func_mask_path,
binary_roi_path,
mod_conf_path,
roi_name,
confound_vars="Default",
save_path=None,
verbose=True
):
'''
Input Parameters
----------------
func_mask_path : str
Full path to the 4D functional image (e.g., preprocessed BO... |
d32d923229468d5e5ddaf119e81665040733748c1d8d19036a23de49067d1bd5 | Python | 3,298 | 76 | import numpy as np
from dival import Dataset
from dliplib.utils.helper import ReorderedDataset
class CachedDataset(Dataset):
"""Dataset that allows to use cached elements of a dataset
"""
def __init__(self, dataset, space, cache_files, size_part=1.0):
"""
Parameters
----------
... |
7f3c40554142778e98d826127a4287e3c5715eb319dff2b6078280ecb4e78995 | Python | 3,301 | 70 | """
%Copyright (C) 2020, Manel Vila-Vidal, for the translation from Matlab to Python
Contact details: m@vila-vidal.com
%Copyright (C) 2019, Adria Tauste Campo, for the original Matlab code (https://github.com/AdTau/DI-Inference)
%Contact details: adria.tauste@gmail.com
%This program is free software; you can redistrib... |
dd58f8963684e1f7620f75a782095268a73a0e13fa24512092b7d8db64aa890a | Python | 3,301 | 110 | #
#
# Export SWC XTension
#
# @Biswanath Saha
#
# <CustomTools>
# <Menu>
# <Item name="SWC Exporter 1.0" icon="Python3" tooltip="Calls the Imaris To export SWC">
# <Command>Python3XT::XTExportSWC(%i)</Command>
# </Item>
# </Menu>
# </CustomTools>
import ImarisLi... |
f92d5d9fe7b65448d8ab6206533f66dfb9d999c5428d12989cf8db00971b6b9a | Python | 3,302 | 92 | from omegaconf import OmegaConf
from pathlib import Path
import mlflow.pytorch
import torch
import torch.nn.functional as F
from monai.utils import set_determinism
import numpy as np
from util import get_training_data_loader
def main(args):
set_determinism(seed=args.seed)
output_dir = Path("/project/outputs... |
fbeb804de75ea6e4fa499a6b0c9c14e1135e42d0948469fb0d5bb0085737aded | Python | 3,303 | 95 | import argparse
import gcsfs
import pandas as pd
from tqdm import tqdm
# This script generates replicate to sample mapping file to interpret the qc report. It
# was developed as an alternative to extract_rep_names_from_encode.sh which might not
# work if the pipeline run_dir had outputs for a specific condition in m... |
22a077f30f3a09b3b40c01a1317bf6728f06ec5bb86cf803c3cad356de291413 | Python | 3,304 | 101 | from collections import namedtuple
from enum import Enum
from functools import cached_property
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Tuple
import numpy as np
import torch
from torch.utils.data import Dataset
from .cache import ImageCache
from .params impo... |
8d0c924366658e8b00b738c96a6f42a7a836671f1c1a91a1b5db65430f5384c8 | Python | 3,304 | 102 | from collections.abc import Callable
from typing import Any
import pytest
from langchain_core.runnables.base import RunnableLambda
from langchain_core.runnables.utils import (
AddableDict,
get_function_nonlocals,
get_lambda_source,
indent_lines_after_first,
)
@pytest.mark.parametrize(
("func", "... |
a1e71453bfd108ddd60a19023de49d63d327d7ee10c1ff06e3ff62949ffe2caf | Python | 3,304 | 102 | """
Calculate relative poly(A) site position within terminal exon
"""
__date__ = "2016-07-07"
__author__ = "Ralf Schmidt"
__email__ = "ralf.schmidt@unibas.ch"
__license__ = "GPL"
# imports
import sys
import time
from argparse import ArgumentParser, RawTextHelpFormatter
parser = ArgumentParser(description=__doc__, fo... |
a836bb183f62e6627386d2c48e27f46cda6d18442425011eb600d68f1c5d5411 | Python | 3,304 | 90 | import torch
"""
For gradient methods, we do not backpropogate rotation if y component of
the unit vector of relative position is very close to `_ROTATION_MASK_THRESHOLD`.
"""
_ROTATION_MASK_THRESHOLD = 0.999999
def init_edge_rot_mat(edge_distance_vec, use_rotation_mask=False):
edge_vec_0 = ... |
5ad125990f8e5452ba804a41639bb21101cc01f4049644a6d8e626d08ed4092e | Python | 3,305 | 104 | """
This script calculates trial success and failure percentages for acquisition
stage, by day. Includes a breakdown of different failed trial categories
(i.e. undershot, overshot, held too long)
@author: Cameron
"""
import numpy as np
from time import mktime, strptime
stats = {'04':0, '13':0, '14':0, '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.