This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import curve_fit | |
def logistic_fit(alpha, Q, b, v, alpha_N): | |
# Implements a more general logistic function (solution of Richards's DE with K=1) | |
return 1 / ((1 + Q * np.exp(-b*v*(alpha - alpha_N))) ** (1/v)) | |
def generalized_logistic_threshold(alpha_N, b, Q, v): | |
# Calculate the threshold value of alpha_N given as the argument where the above generalized logistic function equals 0.5 | |
correction_term = (np.log(2**v - 1) - np.log(Q)) / (-b*v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract installed pip packages, export conda environment without builds, and then append pip packages | |
pip_packages=$(conda env export | grep -A9999 ".*- pip:" | grep -v "^prefix: ") && conda env export --from-history | grep -v "^prefix: " > environment.yml && echo "$pip_packages" >> environment.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir coco | |
cd coco | |
mkdir images | |
cd images | |
wget http://images.cocodataset.org/zips/train2017.zip | |
wget http://images.cocodataset.org/zips/val2017.zip | |
wget http://images.cocodataset.org/zips/test2017.zip | |
wget http://images.cocodataset.org/zips/unlabeled2017.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by .ignore support plugin (hsz.mobi) | |
### Python template | |
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AttendDiagnose(nn.Module): | |
def __init__(self, number_measurements, filter_number): | |
super().__init__() | |
self.d_model = filter_number*number_measurements | |
self.embedding_conv = nn.Conv1d(number_measurements, filter_number*number_measurements, 1) | |
self.pe = PositionalEncoding(filter_number*number_measurements) | |
# embed_dim and attention_heads | |
self.masked_attn = nn.modules.activation.MultiheadAttention(filter_number*number_measurements, 8) | |
self.norm = nn.modules.normalization.LayerNorm(self.d_model) | |
self.final_layer = nn.Linear(self.d_model, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://medium.com/@acpanjan/download-google-drive-files-using-wget-3c2c025a8b99 | |
# change FILEID | |
# https://drive.google.com/file/d/1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA | |
# FILEID = 1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA | |
# tools | |
https://gdrive-wget.glitch.me/ | |
# small file |