sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7089a34531073e3f3cfe7f0d39a3a38de55f4443510e3e8fb9507214c94c089b | Jupyter | 4,897 | 129 | # %% [markdown]
# # Training a neural network on MNIST with Keras
#
# This simple example demonstrates how to plug TensorFlow Datasets (TFDS) into a Keras model.
# %% [markdown]
# Copyright 2020 The TensorFlow Datasets Authors, Licensed under the Apache License, Version 2.0
# %% [markdown]
# <table class="tfo-notebo... |
8a127fae7f1c4c93c47d11bf7288efa4cbf07c0f861ce4ba536eab47805b2fc5 | Jupyter | 4,913 | 200 | # %% [markdown]
# # Notebook for training a DDPM on the BCI Challenge @ NER 2015
#
# This notebooks trains a DDPM from scratch to generate synthetic EEG trials.
# The generated trials can then be plotted and compared to the real data.
# The data is provided in the `data` folder.
# %%
import logging
import matplotlib... |
1a5f796a8487e827a59a058161302e92af38fcdf9dec1378bb5bff4873ed17ac | Jupyter | 4,938 | 104 | # %%
import numpy as np
import pandas as pd
import scanpy as sc
import anndata as ad
import scdrs.data_loader as dl
# %%
DATA_PATH='/n/holystore01/LABS/price_lab/Users/mjzhang/scDRS_data'
df_hom = pd.read_csv('/n/holystore01/LABS/price_lab/Users/mjzhang/scDRS_data/gene_annotation/'
'mouse_human_h... |
b15f755df174074fb20e1807e39504a723fa45ab87c190751d46dd03321cf955 | Jupyter | 4,950 | 201 | # %% [markdown]
# # Notebook for training a DDPM on the BCI Challenge @ NER 2015
#
# This notebooks trains a DDPM from scratch to generate synthetic EEG trials.
# The generated trials can then be plotted and compared to the real data.
# The data is provided in the `data` folder.
# %%
import logging
import matplotlib... |
7b2f6b0bc0f35f3022dd12a1419546918a22fdd94fba4d484fdd2b342a9f2a93 | Jupyter | 4,954 | 137 | # %% [markdown]
# # GOAL : generate ESM-2 embeddings for each proteins
# ### I. Generate the sequence file
# ### II. The embedding script
# ***
# %% [markdown]
# I.
# %%
# Build the sequence idex file :
import os
from Bio import SeqIO
import pandas as pd
path_millard = "/home/conchae/ML_depolymerase/get_candidate... |
c36fd85df2a67b66faedb3bf2b8bb049e002189511eb8de58a0ec1708fc2510c | Jupyter | 4,963 | 150 | # %% [markdown]
# ## From here, the script determine motif presence in shuffled sequence-assigned .bed files and makes a .tsv to store the info
# %% [markdown]
# ### for TGCATG
# %%
import os
cwd = os.getcwd()
main_dir = cwd
print(main_dir)
# %%
shuffled_dir = main_dir + '/shuffled_confident_clusters/'
# %%
complem... |
96280ded41a08a18b50a3a61ad117a6ceb6e9303994f4a9b37b49cb5eca2401d | Jupyter | 4,976 | 174 | # %%
import pdb
import sys
import argparse
import itertools
import numpy as np
from scipy.stats import norm
sys.path.insert(0, '../network')
from transfer_functions import LIF, ReLU
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1.inset_locator imp... |
b61026ba1c2a2d3a165ce3322a045460f75a0d3e1c5858a4bb7547d2c1ff9975 | Jupyter | 4,980 | 124 | # %%
import lime
import sklearn
import sklearn.ensemble
import sklearn.metrics
# %% [markdown]
# ## Fetching data, training a classifier
# %% [markdown]
# For this tutorial, we'll be using the [20 newsgroups dataset](http://scikit-learn.org/stable/datasets/#the-20-newsgroups-text-dataset). In particular, for simplici... |
90806ed5104ed4554c33373a8e520bd3277f742a67365914e6baa044c099a301 | Jupyter | 4,991 | 121 | # %%
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.pylab as pl
import matplotlib.gridspec as gridspec
import scipy.ndimage as ndimage
from matplotlib.ticker import AutoMinorLocator, FormatStrFormatter
import matplotlib.mlab as mlab
from matplotlib i... |
2dfe9e081a6280fc85524d63a4a50e4e6cfb7e135a10f2ac84ae62204ccb8a53 | Jupyter | 5,015 | 146 | # %%
import os
import numpy as np
import seaborn as sns # for plots
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from scipy import stats as ss # to calcualte confidence intervals, etc
from adjustText import adjust_text # to adjust the text labels in the plots (pip install adjustText)
fro... |
82062c902783ff39231e9b303b4577d8131e3184d93d201a8ea046825b8cf264 | Jupyter | 5,028 | 180 | # %% [markdown]
# > Compute, plot and manipulate EEG power spectra using Morlet Wavelets
#
#
# In this example we will load the fmailiar MNE sample data and compute Morlet Wavelets.
# %%
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
import meeglet
f... |
88b7450949a721472d443cd13fc07aad5aa0b188e2b19fdb41307b7979d2d1e6 | Jupyter | 5,048 | 170 | # %% [markdown]
# # Figure 2
# #### This file reproduces the modeling panels in Figure 2
# %%
from KeyFunctions.TheoryFunctions import *
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt
import matplotlib as mp
# %% [markdown]
# ### Default parameter values
# %%
# Strength and ... |
9cadae1c6b53d9c88188215f8b2732308a4c021092dbd0bf59b120fe6106cca5 | Jupyter | 5,066 | 190 | # %% [markdown]
# ### Copy and compress video files
# %%
from pathlib2 import Path
import pathlib2
import os
# %%
from tqdm import tqdm
# %%
# settings
crf = 15 # 0 = lossless, 51 = worst
# %%
# mirror flip bottom cameras
cameras_to_mirror = []#["FB", "BB"]
# %%
base_path_local = Path("/media/dattalab/starling_r... |
4c02e01fd2ba484413f22154c9bda393e9ee447c990ad87790cb3c754daf6f95 | Jupyter | 5,069 | 202 | # %% [markdown]
# # Training procedure: 3PM-Noise2Void
# %%
# Jupyter-notebook magic
# For the matplotlib
%matplotlib inline
# For reload functions explicitly
%load_ext autoreload
%autoreload 2
# Load the TensorBoard notebook extension
%load_ext tensorboard
# %%
# Imports
## Add the modules to the system path
impo... |
658da7523c9475d155b48a1cd306704f7e496a7e461351392500efb655279857 | Jupyter | 5,081 | 180 | # %%
import pandas as pd
import anndata
from anndata import AnnData
import scanpy as sc
import matplotlib.pyplot as plt
from os.path import join
import os
import numpy as np
# %% [markdown]
# # Curate expression data
# %%
CORTEX_URL = "https://storage.googleapis.com/linnarsson-lab-www-blobs/blobs/cortex/expression_mR... |
02a5b8a6b941f5b0297983850301203666d8a468613c9087e6173576d734cbbf | Jupyter | 5,101 | 154 | # %% [markdown]
# # Run RC: 1D bistable gradient system with white noise
#
# This is a simple sample of learning noise-induced transitions by RC.\
# Following this notebook, you can conveniently use the files `shell/Model.py` and `shell/distribution`.
# ### If you need to run this notebook in Jupyter Notebook, please ... |
a0aa9a00947f355cbcb6f5bbd72cc36e377d638633451a0f3ed7a63d4368cc32 | Jupyter | 5,108 | 144 | # %% [markdown]
# # Uni-Mol Molecular Representation
# %% [markdown]
# **Licenses**
#
# Copyright (c) DP Technology.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# **Citations**
#
# Please cite the following papers if you use this n... |
4d3431ad5d6113f4235f798b6e0f6b1bd2f0071745cf25b7348fe23b2a559749 | Jupyter | 5,116 | 150 | # %%
import scanpy as sc
import pandas as pd
import numpy as np
import scipy as sp
from statsmodels.stats.multitest import multipletests
import matplotlib.pyplot as plt
import seaborn as sns
from anndata import AnnData
import os
import time
from gprofiler import GProfiler
import gzip
# scTRS tools
import scTRS.util as... |
69712f3c9edb2bc2c024bf2dd3b12f4dcc867c2c447e83a9b01b263d0aaa626e | Jupyter | 5,117 | 152 | # %% [markdown]
# # Generate a MSA for each candidate protein
# ***
# ## A. Run mmseqs on the fasta database vs Uniref90
# ## B. Generate an MSA for each proteins
# ## C. Realign the MSAs with clustalo
# ***
# %% [markdown]
# A. Run the mmseqs command
# > Install vmtouch in order to use the db-load option : <br>
# c... |
6c0123beb3cf19c388ef98334144ac0045a81d2048f89cd617fc366388d71c66 | Jupyter | 5,117 | 162 | # %%
# import libaries
import csv
import numpy as np
import pandas as pd
import glob
from collections import Counter
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import pandas as pd
from operator import itemgetter
import s... |
465de1bb57dbcb53c9425e3730d77f480538a1d39414aa3cf6c06710735f98eb | Jupyter | 5,130 | 200 | # %%
using Distributed
addprocs(8);
# %%
@everywhere using PulseInputDDM
# %%
ncells = [3,3];
# %%
ntrials = [100,100];
# %%
#f = [["Softplus" for n in 1:N] for N in ncells]
f = all_Softplus(ncells)
# %%
θ_generative = θneural_choice(θz=θz(σ2_i = 5., B = 15., λ = -0.5, σ2_a = 100., σ2_s = 0.5,
ϕ = 0.4, τ_ϕ... |
0905776f0c0c11fb8f6b239d3fe4b95b80f7cceb702daa73a0bcaa03f4c0ae7b | Jupyter | 5,133 | 238 | # %%
import pandas as pd
# %% [markdown]
# # Read in data
# %%
file_3d_test = pd.read_parquet(
"ccs-prediction/old_metlin_ccsbase_test_3d.parquet"
)
file_3d_train = pd.read_parquet(
"ccs-prediction/old_metlin_ccsbase_train_3d.parquet"
)
# %%
test_data = pd.read_parquet(
"ccs-prediction/combined_metlin_cc... |
30645d507d763728c1360b6fed36c9dd20d74fa02b59b39f76c946cef299f12b | Jupyter | 5,145 | 188 | # %% [markdown]
# # Imports
# %%
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from multisensory import detection_params_search
from sklearn.linear_model import LinearRegression, Lasso
from sklearn.preprocessing import PolynomialFeatures
from sklearn.ensemble import Random... |
a488a7c78054a246b87b993cbf1388fe7e0830af265935c5706dc43b5d0527d5 | Jupyter | 5,146 | 202 | # %%
import sys
sys.path.append('..')
sys.path.append('../..')
sys.path.append('../../..')
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from statsmodels.stats.anova import AnovaRM # perform F test
from scipy.stats import ttest_ind
from scipy.stats import ttest_rel
impo... |
682275c4ef7f5b91b49cebc9460727f92fd805826662a8cbae7a098110c66798 | Jupyter | 5,148 | 128 | # %%
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.pylab as pl
import matplotlib.gridspec as gridspec
import scipy.ndimage as ndimage
from matplotlib.ticker import AutoMinorLocator, FormatStrFormatter
import matplotlib.mlab as mlab
from matplotlib i... |
d244f3b694ee118145885c5806a4c9cbfbb62d888cd00c9b46486f16cb7dee8b | Jupyter | 5,160 | 142 | # %% [markdown]
# # Burst analysis - Fig 4
# %% [markdown]
# ## Define paths and initialize packages
# %%
import numpy as np
paths = np.load('Paths.npy', allow_pickle=True).item();
import numpy as np
import pandas as pd
import matplotlib
import seaborn as sns
from scipy import stats
# %matplotlib inline
%matplotlib... |
6debc934d56480f6233a0e0a89b4abea27a2e22eabf38011b6779373472dfd19 | Jupyter | 5,165 | 166 | # %%
import numpy as np
import plotly.express as px
import plotly.graph_objs as go
import matplotlib.pyplot as plt
import mne
from mne import Epochs, pick_types, events_from_annotations
from mne.channels import make_standard_montage
from mne.io import concatenate_raws, read_raw_edf
from mne.datasets import eegbci
fr... |
42791987c59d0033ddf69888813294e77a2b0bc302e73d39391d50f23cac3840 | Jupyter | 5,188 | 171 | # %%
%load_ext autoreload
%autoreload 2
# %%
%load_ext line_profiler
# %%
from pyk4a import (
PyK4A,
Config,
ColorResolution,
DepthMode,
WiredSyncMode,
)
# %%
from multicamera_acquisition.interfaces.arduino import (
packIntAsLong,
wait_for_serial_confirmation,
)
import struct
import time
... |
e491061bfd1b4b194e8e9d0ff87ce519168a61d08fc5266a91c9b1907889a27e | Jupyter | 5,206 | 212 | # %% [markdown]
# # The goal here is to benchmark the DpoDetection tool with other depolymerase detection tools
# ***
# # I. Load the models :
# #### 77 phages candidates
# >Detected Dpos <br>
# >Missed Dpos <br>
# ***
# # II. Getting the resulting predictions
# #### Pires Dpos
#
# ***
# # III. Make figures
# ***
#... |
c58ae45c970f2011e45d99882a994957a2ba90bbfdf53e8e5cb15d876da7a01d | Jupyter | 5,209 | 129 | # %%
#You need to run the photometry analysis before you are ready for this step
#In this script we will use the deeplabcut data to determine nose-to-nose sniffing, and the angle between
#the test mouse and the target mouse
# %%
import pandas as pd
import numpy as np
# Import DLC data
data = pd.read_csv('Your File P... |
9473ce636f98227048e6a613641f101fdb8e9e224324ec5f0b1455d8c85212c4 | Jupyter | 5,219 | 148 | # %% [markdown]
# # Burst analysis - Fig 4
# %% [markdown]
# ## Define paths and initialize packages
# %%
import numpy as np
paths = np.load('Paths.npy', allow_pickle=True).item();
import numpy as np
import pandas as pd
import matplotlib
import seaborn as sns
from scipy import stats
# %matplotlib inline
%matplotlib... |
db4eb3924e4aed5b0acae3798845fcfc045dae853eb1adf6ae7486993e1d2f99 | Jupyter | 5,219 | 176 | # %%
from transforms import LabelToAffinities, RandomFlip, RandomRotate, RandomRotate90, RandomContrast, Normalize, ElasticDeformation, StandardLabelToBoundary, AdditiveGaussianNoise, AdditivePoissonNoise, LabelToBoundaryAndAffinities, FlyWingBoundary, LabelToBoundaryAndAffinities, Standardize
import matplotlib.pyplot ... |
87b254cb1acda008d24886ce0d5eccf97b1fcb0927464a034b1c8f82afc6b566 | Jupyter | 5,247 | 112 | # %%
import pickle
import numpy as np
import matplotlib.pyplot as plt
# Load the data
with open('../scripts/data.pickle', 'rb') as f:
data = pickle.load(f)
COLOR_MUTANT = '#ff7f0e'
COLOR_SHAM = '#1f77b4'
# %% [markdown]
# ### Figure 4
# %%
# Data on the rate of visting state 1
states_sham = np.concatenate([np.a... |
8c3c9ac353e4ec0209d6f764918031c5d6ee87f966abb38664170cf0e846eb09 | Jupyter | 5,292 | 123 | # %%
import os
import json
import numpy as np
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
import pickle
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
from scipy import stats
#... |
3d59666952014b3e96b30897b9563143136ceeff4d95327157c1351f578fc968 | Jupyter | 5,303 | 182 | # %%
import json
import numpy as np
import torch
from torch.utils.data import DataLoader, TensorDataset
import norse
import matplotlib.pyplot as plt
# %%
### TEST DATA
test_data_path = "data/ds_test.pt"
ds_test = torch.load(test_data_path)
letter_written = ['Space', 'A', 'E', 'I', 'O', 'U', 'Y']
device = "cpu"
### LO... |
5bff91f1612285de619642e799300b84e78fed05d1ca7bd8a4da2f65d19529a9 | Jupyter | 5,322 | 88 | # %%
import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
from nilearn import plotting
import os
import pickle
# %% [markdown]
# #### This notebook demonstrates how to load and visualize Regions of Interest (ROIs) for version B MNI152 space. ROIs defined for version B MNI152 space contain the same... |
9b3385523fba67d1755821f2cc2faa17391f3eee215ff7ac55c285fc22a73448 | Jupyter | 5,343 | 105 | # %% [markdown]
# # Add custom hooks to monitor network properties
#
# As shown in [this how-to](synops_loss_snn.ipynb), Sinabs provides functions to monitor network activities such as synaptic operations and firing rates. For this it uses the hook-mechanism of PyTorch modules. This makes it easy to monitor custom sta... |
2d10c948d901988efd55c3a85f5b440320f592aa8e6c343782b3c9ac904d8d1e | Jupyter | 5,344 | 143 | # %%
import nibabel as nib
import numpy as np
import pandas as pd
import os
# %%
# Read the .txt file into a DataFrame
atlas_data = pd.read_csv("receptors/AAL_90_labels.txt", sep="\t", header=None)
# Assign column names
atlas_data.columns = ["code", "label_name", "roi_label"]
receptor_fnames = [ '5HT2a_cimbi_hc29_bel... |
777f1cb0c5b2993c8148c1f373720532e17943e4128b877565455b354e1aa6ce | Jupyter | 5,353 | 123 | # %% [markdown]
# # Continuous valued detection task
#
# In this version of the task we again have an underlying target variable $M\in\{-1,0,1\}$ and we assume $M\neq 0$ with probability $p_m$ (and $\pm 1$ equally likely in that case). At each time step $t$ we have a latent $E_t$ variable with $p_e=P(E=1|M\neq 0)$ and... |
adc1cd8d2abf10d1d0f4993cb365aa37b403024870362fbb6d587a9cf59f7b25 | Jupyter | 5,368 | 202 | # %%
!pip install -q zarr
# %%
import os
from os.path import join
import anndata
import dask
import dask.array as da
import pandas as pd
import numpy as np
from scipy.sparse import csr_matrix
dask.config.set(scheduler='threads');
# %%
def read_X(path):
return anndata.read_h5ad(path).X
def read_obs(path):
... |
ea7e7019d6a228252e7cb0f0c92555332a5acf2a369b68f56d0c28c42f44898d | Jupyter | 5,389 | 238 | # %% [markdown]
# # Figure 4 (Combined dataset)
# %%
from mol2ccs.utils import performance_evaluation
import pandas as pd
import seaborn as sns
import matplotlib.gridspec as gridspec
from matplotlib import pyplot as plt
import numpy as np
from utils import SeabornFig2Grid
from scipy.stats import linregress
from sklea... |
c3a6ca213b8556a2827601577ee7c37177488d444f19560d9dd0b7e2f0d13765 | Jupyter | 5,401 | 203 | # %%
import numpy as np
import os
import zipfile
import pandas as pd
import shutil
import matplotlib.pyplot as plt
import torch
from sklearn import metrics
import cv2
from collections import Counter as cnt
from torchvision import transforms
from keras import Sequential
from torch import nn
from torchvision import mode... |
23ba4b1aaaeabde4377b457e600f818b812f406873361fb52db6dc75543aa7c1 | Jupyter | 5,438 | 97 | # %% [markdown]
# # DeepCAD-RT training pipeline
# <img src="https://github.com/STAR-811/DeepCAD-RT-old/blob/main/images/logo-new.png?raw=true" width = "650" height = "180" align=right />
#
# This file will demonstrate the basic pipeline for training DeepCAD-RT. A TIFF file will be downloaded automatically... |
33501ff6f3ca98431d7b0b4ca786d526173802dc11d348bea1103adf52481b9b | Jupyter | 5,439 | 172 | # %% [markdown]
# # Analyze the data to evaluate the relative performance of different gene weighting methods
# - Determine the contrast of scores between the control cell-types.
# - Evaluate power using different statistics.
# %%
%load_ext lab_black
import pandas as pd
import itertools
import numpy as np
from statsm... |
50c94cee87d4b9e062eaa4b279bfcab43c520ff4d0c8b58cd91ded17297ff5ef | Jupyter | 5,447 | 102 | # %% [markdown]
# # Step 1: Data Preparation
#
# Here, we explain how to use our code to extract the sub-tomogram pairs $\big\{({\color{red}\mathbf{v}^0_{\color{white}i}}, {\color{blue}\mathbf{v}^1_{\color{white}i}})\big\}_{i=1}^N$ which we use to construct the model inputs and targets for model fitting in Step 2.
# ... |
086fe571090706f01dc5f402925a828c3f13913f1255c7f4b20371ad12ce7e2e | Jupyter | 5,467 | 91 | # %% [markdown]
# # DeepCAD-RT testing pipeline
# <img src="https://github.com/STAR-811/DeepCAD-RT-old/blob/main/images/logo-new.png?raw=true" width = "650" height = "180" align=right />
#
# This file will demonstrate the basic pipeline for denoising specified data using pre-trained DeepCAD-RT models. A TIFF file wil... |
4731f9b54bd506a462638d66129ddff9328f52f0e2e2ca3d59c1ab19c4e0c32b | Jupyter | 5,469 | 155 | # %% [markdown]
# # Quality Control (QC) of Clinical Machine Learning Models
#
# In this notebook, we take a closer look at the model inputs and outputs for a single patient across several different data modalities such as resting and exercise ECGs, and abdominal and brain MRIs.
#
# <div class="alert alert-block aler... |
dce69265cc143f3f1005033510a60b7e85824a83b417edbf504f38ec60e12057 | Jupyter | 5,470 | 191 | # %%
%load_ext autoreload
%autoreload 2
# %%
import platform
import random
import uuid
import os
import os.path
import skimage
import sak
import sak.signal.wavelet
import sak.data
import sak.data.augmentation
import numpy as np
import scipy as sp
import scipy.signal
import pandas as pd
import networkx
import networkx.... |
4de42f0d457586bb535222f45726900219cd4be4d0655de0ea2db9d7d301d247 | Jupyter | 5,472 | 203 | # %%
%load_ext autoreload
%autoreload
# %%
from typing import List, Tuple
import os
import os.path
import sys
import skimage
import skimage.segmentation
import sklearn.preprocessing
import sklearn.model_selection
import math
import shutil
import pathlib
import glob
import shutil
import uuid
import random
import plat... |
9529d4d13ac0668cc7eeeb2956e0e4a0cacfb8796906adb08c69e06381544d4a | Jupyter | 5,472 | 131 | # %% [markdown]
# ## Working with Streaming Datasets with Skorch
# This notebook demonstrates how to train a neural network classifier using streaming data with the skorch library. This approach is useful when working with large datasets that don't fit entirely in memory. This notebook was contributed by [Parag Ekbote]... |
fb52f296323516a5c973027fc0b88c1ce5add7297c9a233eafbffb9dc07a8f48 | Jupyter | 5,472 | 177 | # %%
import seaborn
import matplotlib
import matplotlib.pyplot as plt
import torch
import numpy as np
import pandas
import pathlib
# %% [markdown]
# # Accuracies
# %%
!ls *.npy
# %%
def read_framework(framework, part):
sub = None
zero = None
for f in pathlib.Path().glob(f"{framework.lower()}_*{part}*_sub... |
f578818f0abe796471414bfa7268dabd2e64970224bc30a8a6e0334c58cd1fbb | Jupyter | 5,473 | 163 | # %% [markdown]
# # Generate the a3m and hmm files for the DBv3
# ***
# %% [markdown]
# ## 0. Inspection
# %%
from tqdm import tqdm
import os
path_db = "/home/conchae/databases/depolymerase_building/make_db_try3"
path_fasta = [f"{path_db}/{file}" for file in os.listdir(path_db) if file.count("MSA")<1]
dico_length ... |
bf6ffe45c5390a3ccff970906891b9ebb08e50bbca5365a2ac038f5d3bb55079 | Jupyter | 5,490 | 204 | # %%
%matplotlib inline
from __future__ import division, print_function
import matplotlib as mpl
import seaborn as sns; sns.set_style('white')
import matplotlib.pyplot as plt
import numpy as np
np.seterr(divide='ignore')
import lavaburst
# %%
blues = sns.cubehelix_palette(0.4, gamma=0.5, rot=-0.3, dark=0.1, light=0.9... |
b78eb10f4f88f078f6d9dfa11a78c25267885138fcc2f7ec8da4b07dd4c06e0b | Jupyter | 5,495 | 146 | # %%
%env CUDA_LAUNCH_BLOCKING=1
training_path = 'training_set/'
testing_path = 'testing_set/'
csv_name = 'parameters.csv'
im_suffix = 'HC.png'
n_folds = 5
val_split = 0.1
train_size = 8
test_size = 8
epochs = 50
patience = 50
subjects = sorted([
f for f in os.listdir(training_path)
if f.endswith(im_suffix)
])
... |
4b7a8008a0cff28311b4a56511c6f98148674920e902449a43b3501d4a61a236 | Jupyter | 5,551 | 134 | # %%
"""
@author: Tan Nguyen & Matt Bezdek
"""
import pickle as pkl
import pandas as pd
import numpy as np
import plotly.express as px
import plotly as py
import plotly.graph_objs as go
from plotly.subplots import make_subplots
py.offline.init_notebook_mode(connected = True)
colors = ["lightseagreen", "mediumpurple", ... |
8b8aede54e308a3cd201c8d799006d0fc536822e44c55619fac6b0f980927f16 | Jupyter | 5,551 | 167 | # %%
using Distributed
addprocs(8);
# %%
@everywhere using PulseInputDDM, MAT
import Statistics: mean
# %%
ratnames = ["B068","T034","T036","T063","T030", "T035","T011","B053", "T080","T103","E021"];
dt, n, cross = 1e-2, 53, false
data_path = joinpath(abspath(joinpath(pwd(), "..")), "data/by_session");
# %%
region, ... |
c7378d958ed830fb2909db6e745615a75a4c4f0b705df7a5a56bde9923fca5c9 | Jupyter | 5,575 | 173 | # %%
from datasets import Dataset
from sklearn.model_selection import train_test_split, GroupShuffleSplit
from transformers import AutoModelForTokenClassification,AutoTokenizer, TrainingArguments, Trainer
from transformers import DataCollatorForTokenClassification
from evaluate import load
import numpy as np
import p... |
12cccc4a47a25960f4606d9cfda7a346961fab02ca097a1b71d2ce6e1ec56716 | Jupyter | 5,579 | 161 | # %%
import optuna
from optuna.trial import TrialState
from transformers import IntervalStrategy, AutoTokenizer, AutoModelForTokenClassification, TrainingArguments, Trainer
from transformers import TrainerCallback, TrainerState, TrainerControl
from datasets import Dataset
import logging
import pandas as pd
import numpy... |
be9c1635925f7410a211c5f53b9f51531600f5aaf546cce47e7c55640a8baf41 | Jupyter | 5,582 | 209 | # %%
import pandas as pd
import numpy as np
import dask.dataframe as dd
import dask.array as da
import anndata
import scanpy as sc
import matplotlib.pyplot as plt
import yaml
from os.path import join
# %% [markdown]
# # Read data
# %%
PATH = '/mnt/dssmcmlfs01/merlin_cxg_2023_05_15_sf-log1p'
# %%
ddf = dd.read_parqu... |
aec0bd8f6b011d3edc1f0f387d7d1fafaf3bef7dc3d1b81ad7cbc692e21863d1 | Jupyter | 5,605 | 239 | # %%
%load_ext autoreload
%autoreload 2
# %%
import sys
sys.path.insert(0, '../scripts')
from simulation import *
# %%
N = 80000
p = 0.005
K = N*p
P = 16
tau = 0.01
dt = 1e-3
A = 2
theta = 0
sigma = 0.1
params = {
"N": N,
"p": p,
"K": K,
"P": P,
"A": A,
"tau": tau,
"theta": theta,
"si... |
860a299393efb31d2ba5092e5d3a13ac69106d744d2da3fcd829311d0420d856 | Jupyter | 5,608 | 161 | # %%
# Copyright 2022 NVIDIA Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
1f6476d622c242fc406372b05f069b251d55a33f7574b51ca0b4221ea9892ccd | Jupyter | 5,633 | 120 | # %% [markdown]
# # Load libraries and data for Figure 3
# %%
from library import *
area_dict, active_area_dict = load_area_dicts(session_ids)
path = './files/adjacency_matrices'
G_ccg_dict, offset_dict, duration_dict = load_graphs(path, active_area_dict, weight=True)
measure = 'ccg'
n = 4
S_ccg_dict = add_sign(G_ccg... |
3be78ad5b9ef47f19555dfa397569d2a43e5b0046e321acdc1972eae03539c6f | Jupyter | 5,646 | 198 | # %% [markdown]
# # Evaluate Combined dataset
# %%
from mol2ccs.utils import performance_evaluation
import pandas as pd
import seaborn as sns
import matplotlib.gridspec as gridspec
from matplotlib import pyplot as plt
from matplotlib_venn import venn3
from utils import (
compare_models_by_adduct,
compare_mode... |
e08fe16f6387f709e04d38a9f4c5834eae9b18febbb038e3b37ac421e8647e22 | Jupyter | 5,655 | 183 | # %% [markdown]
# # SP LIME
#
# ## Regression explainer with boston housing prices dataset
# %%
from sklearn.datasets import load_boston
import sklearn.ensemble
import sklearn.linear_model
import sklearn.model_selection
import numpy as np
from sklearn.metrics import r2_score
np.random.seed(1)
#load example dataset
b... |
4540e6e85a0bbed91b1de39fedd896bb4bbc8f02235e7dbda01574b642b9f789 | Jupyter | 5,662 | 201 | # %% [markdown]
# # Evaluate Metlin-CCS train and test
# %%
from mol2ccs.utils import performance_evaluation
import pandas as pd
import seaborn as sns
import matplotlib.gridspec as gridspec
from matplotlib import pyplot as plt
from matplotlib_venn import venn3
from utils import (
compare_models_by_adduct,
com... |
d5f305c27f8e10a2d7899d135d055225a845be79db3e12b2b59eb12da0336c0c | Jupyter | 5,664 | 136 | # %% [markdown]
# ## Mutagenesis analysis for binary annotations
# %%
import autoreload
%load_ext autoreload
%autoreload 1
# %%
import numpy as np
import pandas as pd
import pandas.api.types as pdtypes
import glob
import pickle
import os
from plotnine import *
import utils
# %% [markdown]
# ### Generating the aggreg... |
181ebf3c387887c057d40bd455ffb0efed0442d91c89ec24bb3ff473d0513076 | Jupyter | 5,685 | 158 | # %%
# if necessary, install NeuralGCM and dependencies
! pip install -q -U neuralgcm dinosaur-dycore gcsfs
# %% [markdown]
# # Forecasting quick start
#
# This notebook uses ERA5 data and pretrained NeuralGCM model to make a weather forecast.
#
# The forecast is made in 3 steps:
# 1. Slice of ERA5 data is regridded... |
5deddc95d5d5740d0cb9a9b73fce66e5f5b5c7223790c6bca8a0e6297fb88f7b | Jupyter | 5,705 | 136 | # %% [markdown]
# # U-Net example
# In this notebook we will give a minimal example on how to use U-Net to train/test/predict.
#
# First open up the shell/terminal you used for installation and activate the virtual environment you [installed](https://github.com/CSDGroup/aisegcell#installation). If you want to run this... |
fd7bd5c4a8bb780d4b95c330117776098fd5fea50b6d9ef06aae1d0f64fede7c | Jupyter | 5,719 | 165 | # %% [markdown]
# # GOAL : generate ESMfold prediction for the selected proteins after V3
# ### I. Generate the sequence file
# ### II. The embedding script
# ***
# %% [markdown]
# I.
# %%
# Build the sequence idex file :
import os
from Bio import SeqIO
import pandas as pd
path_millard = "/home/conchae/ML_depolyme... |
41bed161edb5ec363845cac4e9e956811e6c2b68da7fff4c950447a519be68ae | Jupyter | 5,725 | 150 | # %% [markdown]
# # Overview
# The notebook shows how the ```lime_image``` tools can be applied to a slightly larger dataset like the Olivetti Faces. The dataset is very low resolution and allows quite a bit of rapid-iteration.
# %%
import numpy as np
import matplotlib.pyplot as plt
from skimage.color import gray2rgb,... |
478207e3eb1354813742e4e37faee046466fba5c9deb844b37ae61cf1615422c | Jupyter | 5,737 | 204 | # %%
import os
os.chdir('..')
# %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
import datetime
# %%
np.random.seed(12)
# %%
n = 39
start = pd.to_datetime('2023-03-31 09:00:00')
# %%
ts = [50]
for i in range(n - 1):
ts.append(ts[-1] + np.r... |
bd40e483f1b02dc371646432cf7381f37cd060932a92f9de268ecadd93b4aaac | Jupyter | 5,749 | 168 | # %%
import torch
from validation import Validation
from pathlib import Path
import numpy as np
from Environment import Env
import config.config as config
import sys; sys.path.append('../analysis/')
from my_utils import reset_seeds
# %% [markdown]
# # parameters for testing task
# %%
# only change in this cell
# tr... |
85a95850ddae88313e6e2a50cc356fddcb0dad58737cab54ec095b9370b5aa84 | Jupyter | 5,760 | 161 | # %%
#Run in pandas==1.5.3
import gzip
import pickle
import os
import pandas as pd
# Function to save variables as plain text files or CSV
def save_variable_as_txt(name, var):
"""
Save any variable as a plain text file or CSV if it's a DataFrame.
"""
os.makedirs('./db2plaintext', exist_ok=True) # Crea... |
ee7a9cacd298e6e7692e5604d394bab538dc6d30cf8436247d3c0ed0900939b5 | Jupyter | 5,764 | 169 | # %% [markdown]
# # Using Lime with Pytorch
# %% [markdown]
# In this tutorial we will show how to use Lime framework with Pytorch. Specifically, we will use Lime to explain the prediction generated by one of the pretrained ImageNet models.
#
# Let's start with importing our dependencies. This code is tested with Pyt... |
f9496cb95625d0788c7f1e8cfe6235cc0f386130dcb8f7e16abe2713c6a53bb6 | Jupyter | 5,778 | 173 | # %% [markdown]
# # Supplemental Figure 1 (Deterministic model and dynamical regimes)
# #### This file runs the deterministic model and recreates SFig 1B and 1C
# %%
from KeyFunctions.SimulationFunctions import *
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import matplotlib.cm as cm
from m... |
c8b0e7d16b9841a941331dd9f0d28e4503802706f4446128c31cab03d2a7a1bf | Jupyter | 5,781 | 203 | # %% [markdown]
# # Model inference example notebook
# %%
from os.path import join
import anndata
import numpy as np
import pandas as pd
import scanpy as sc
import torch
from tqdm.auto import tqdm
# %% [markdown]
# ## Load example data set
# %%
# Download example data
!wget https://datasets.cellxgene.cziscience.co... |
161ab06793b03522e3a85d4ff04c4a7aec5bc65b80de2df7c14390a8a00048d2 | Jupyter | 5,784 | 158 | # %% [markdown]
# # Import backage
# %%
import sys
sys.path.append("../..")
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import random
%matplotlib inline
# %%
import torch
from torch import nn
from torch import distributions
from torch.nn.parameter import Parameter
from exp.sir.train i... |
afb93aba71991b48e1101c2d3c3674dde20d164f300d9c9691d720165d262ff0 | Jupyter | 5,794 | 154 | # %% [markdown]
# # Mean Field model - Hippocampus CA1
#
#
#
# <br>contact: ftesler@gmail.com and robertamaria.lorenzi01@universitadipavia.it</br>
# %% [markdown]
# ## Mean field model simulations
#
#
# This is a demo code for the second order mean-field model presented in the paper "Multiscale modelling of neuro... |
44e8e5413dc5ca99f915eb00925401dbaa176a6f85202d3e82a55d8d3b281015 | Jupyter | 5,797 | 174 | # %% [markdown]
# # Uni-Mol Pocket Representation
# %% [markdown]
# **Licenses**
#
# Copyright (c) DP Technology.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# **Citations**
#
# Please cite the following papers if you use this note... |
d0ce6a68e79c82210c05dcb31700219ce796767cc9a1d4750da70f1130d41d38 | Jupyter | 5,808 | 232 | # %%
%load_ext autoreload
%autoreload 2
# %%
camera_list = [
{'name': 'top', 'serial': 22181547},
#{'name': 'side1', 'serial': 22181612},
]
# %%
import PySpin
from multicamera_acquisition.interfaces import get_camera
from datetime import datetime
import csv
from multicamera_acquisition.paths import ensure_dir... |
22d6b10ee93b830ef7511c83a3461a2e5689812fe963d950f76754de7bdc4823 | Jupyter | 5,824 | 165 | # %%
import pandas as pd
import seaborn as sns
# IPython imports
%matplotlib inline
import matplotlib.pyplot as plt
# %%
# Get the order of categories from MGH and use for all cohorts
df = pd.read_csv('phewas_mgh_with_mgh_v2022_11_30.csv')
df['AUC_diff'] = df['AUC_with_ECG'] - df['AUC_no_ECG']
ms = dict(df.groupby('ca... |
82e0cecd599dff192051f34821218e4c40709693e8d5f30a4483c1b66033743d | Jupyter | 5,843 | 159 | # %% [markdown]
# > Compare covariances from Morlet Wavelets versus broadband methods for spatial whitening
#
# In this tutorial we will load the fmailiar MNE sample data and compute Morlet wavelets based on [@bomatter2024].
# We then compare the covariances and show how to achieve comparable results for spatial white... |
a865faf8ff8c3f1d3f8fa46b29caf52e2db2d25ce482be4005e9f987383480c6 | Jupyter | 5,855 | 87 | # %% [markdown]
# # Multisession registration with CaImAn
#
# This notebook will help to demonstrate how to use CaImAn on movies recorded in multiple sessions. CaImAn has in-built functions that align movies from two or more sessions and try to recognize components that are imaged in some or all of these recordings.
#... |
7a4cb54a127878ccb57d1e49dd149af88d39897a89bab259d02ec0f9b3ba13c2 | Jupyter | 5,885 | 157 | # %% [markdown]
# # Training an ANN with fewer SynOps
# As described in [Sorbaro et al. 2020](https://www.frontiersin.org/articles/10.3389/fnins.2020.00662/full), it can be beneficial for power consumption and latency in the network to reduce the number of synaptic operations (SynOps). This number is essentially the ou... |
6958d05daa1c38432928202b9f857badfa6aa4216996fc531eb5de5c21acebb9 | Jupyter | 5,899 | 207 | # %% [markdown]
# # Image creation from audio data
#
#
#
# # Image generation process
# - Compute dB scaled mel power spectrum over 5 seconds interval.
# - Use primary label for each of these intervals.
# - Pad to 5 second images if we have a minimal duration.
# - Consider a maximum duration for a maximum number of ... |
bd1841187bd8a9ae633703dbde84accc5d45dbc9898cbff8c7f1726ba20728b9 | Jupyter | 5,911 | 157 | # %% [markdown]
# # Lava
#
# Lava is a Python framework for building neural networks that is developed and maintained by Intel. It offers deployment options to Intel's Loihi chips, particularly the newest Loihi 2 chip.
#
# Lava-dl is an extension of Lava that focuses on deep learning applications and adds more neuro... |
e32e95696ae798f4d096711a70fc5ea45f504674d6647bb23e814fb2f016b0a8 | Jupyter | 5,911 | 136 | # %% [markdown]
# # Using Ray for highly parallelizable tasks
#
# <a id="try-anyscale-quickstart-highly_parallel" href="https://console.anyscale.com/register/ha?render_flow=ray&utm_source=ray_docs&utm_medium=docs&utm_campaign=highly_parallel">
# <img src="../../_static/img/run-on-anyscale.svg" alt="try-anyscale-qu... |
eb2e48ed1a4fd3c673e0bfa3ac14d5fdfa5bf2648cc7317535d7661e2abdb7ef | Jupyter | 5,911 | 231 | # %% [markdown]
# # Test error handling for notebook visualizations
#
# The purpose of this notebook is to cause several error conditions to occur and check whether the error messages returned are useful (and not overwhelming).
# %% [markdown]
# ## Setup
# %% [markdown]
# <div class="alert alert-block alert-warning"... |
61d4540810f4412ae226eef08937946b8ef402d7d2ce8037953ef17fe1ad2c8b | Jupyter | 5,928 | 160 | # %% [markdown]
# # Running Tune experiments with Nevergrad
#
# <a id="try-anyscale-quickstart-ray-tune-nevergrad_example" href="https://console.anyscale.com/register/ha?render_flow=ray&utm_source=ray_docs&utm_medium=docs&utm_campaign=ray-tune-nevergrad_example">
# <img src="../../_static/img/run-on-anyscale.svg" ... |
94897ae37f752e98726fecb70424c919092b26422b1f534292e0d9f5fd2ed9a7 | Jupyter | 5,939 | 233 | # %%
%load_ext autoreload
%autoreload 2
# %%
camera_list = [
{'name': 'top', 'serial': 22181547},
{'name': 'side1', 'serial': 22181612},
]
# %%
import PySpin
from multicamera_acquisition.interfaces import get_camera
from datetime import datetime
import csv
from multicamera_acquisition.paths import ensure_dir
... |
a959ec4ff87ce2e4ea1024a0b510fdeeb71be9bd62090d8e06f9636b95df7608 | Jupyter | 5,947 | 211 | # %%
#import
import logging
import numpy as np
import pandas as pd
import os
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.impute import KNNImputer
from sklearn.neighbors import KNeighborsClassifier
from umap import... |
50f9929e47b01e2dfb11b46a1258c617ca723b6ce173ef549fcad5d67c9ed3ed | Jupyter | 5,948 | 188 | # %% [markdown]
# # Maximally excitatory stimuli from trained models
#
# This notebook illustrates how to compute the stimuli that maximally excite a specific neuron.
# %% [markdown]
# **Select GPU runtime**
#
# To run the notebook on a GPU select Menu -> Runtime -> Change runtime type -> GPU.
# %%
# @markdown **Ch... |
f6f591a10a41bedf215e058dcf71450cda5ae1ba564dd5261d87d1aa85074407 | Jupyter | 5,962 | 199 | # %% [markdown]
# ## This notebook walks through the basics of generating synthetic choice data and fitting the model to that data to recover the paramaters that generated it
# %% [markdown]
# Fitting these models to data to choice data alone can be computational expensive. We fit the model below using 44 cpus.
#
# `... |
7c1471a1793d9b505c38684c3c7c6433c0fc239e6db727ab7925f656e373bacc | Jupyter | 5,990 | 159 | # %% [markdown]
# # Lava
#
# Lava is a Python framework for building neural networks that is developed and maintained by Intel. It offers deployment options to Intel's Loihi chips, particularly the newest Loihi 2 chip.
#
# Lava-dl is an extension of Lava that focuses on deep learning applications and adds more neuro... |
8424713e8fa8c024fa68079450dc58e982df7669fb5e26422c75309e6e5d0a41 | Jupyter | 6,003 | 240 | # %%
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
# %%
def change_state(x, x1, x2):
if np.array_equal(x, x1):
return x2.copy()
elif np.array_equal(x, x2):
return x1.copy()
def get_valence_signal(x, x1, x2, R1, R2):
if np.array_equal(x, x1):
return... |
0e8bccf67eacffe5dfee4f915d0e5cc2f1e6e99830fb38404596b5fd4c56f901 | Jupyter | 6,020 | 116 | # %% [markdown]
# # Load libraries and data for Figure 5
# %%
from library import *
area_dict, active_area_dict = load_area_dicts(session_ids)
path = './files/adjacency_matrices'
G_ccg_dict, offset_dict, duration_dict = load_graphs(path, active_area_dict, weight=True)
measure = 'ccg'
n = 4
S_ccg_dict = add_sign(G_ccg... |
024d6cd49ea6c10e9d059a91741571d84b400c60db5c414c231ad71f7d470ae2 | Jupyter | 6,029 | 176 | # %%
#| hide
from scAnnot.core import *
# %% [markdown]
# # **scAnnot User Documentation**
# %% [markdown]
# > scAnnot is a tool for performing hierarchical multi-level annotation of single-cell datasets using pre-trained SCANVI models.
# >
# > This document will guide you through the installation process, explain t... |
65f0b5b313535aa95111cb91929328de2d9b701b8450e48e246bdce9ce8d2b4a | Jupyter | 6,047 | 175 | # %%
from pybioportal import clinical_data as cd
# %%
data = cd.fetch_all_clinical_data_in_study(study_id="brca_tcga",
attribute_ids=["OS_STATUS", "OS_MONTHS", "RACE"],
clinical_data_type="PATIENT", ret_format="WIDE")
# %%
import pa... |
28caba69b8659d6f77ebde2647b2b074aa8ece6b6d72c8b17cf20e9e0bfb70c7 | Jupyter | 6,054 | 210 | # %%
import pandas as pd
import numpy as np
import wfdb
import ast
from scipy import signal as sgn
import torch
# %%
torch.randn(1)
# %%
x = torch.tensor([1,2,3,1])
(x<2).shape
# %%
def load_raw_data(df, sampling_rate, path):
if sampling_rate == 100:
data = [wfdb.rdsamp(path+f) for f in df.filename_lr]
... |
9e7f78546ee6a64c7caed44756af074fe9a68379d6d4c4b93721eb31c6c8a63e | Jupyter | 6,073 | 223 | # %% [markdown]
# # Inference procedure: 3PM-Noise2Void
# %%
# Jupyter-notebook magic
# For the matplotlib
%matplotlib inline
# For reload functions explicitly
%load_ext autoreload
%autoreload 2
# %%
# Imports
## Add the modules to the system path
import os
import sys
sys.path.append(os.path.join(".."))
## Libs
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.