Predicting signal peptide cleavage sites with a simple neural network¶
We have a set of proteins where we know where the cut happens. Now we want a model that finds it.
The idea: we slide a small window along the provided sequences and ask a yes/no question at every position: "does the cut happen inside this* window?"*
One protein with a 70 amino acids sequence then gives us ~70 training examples.
The window¶
We use a window of K residues, positioned so that the cut falls after position K-2:
K = 10
1 2 3 4 5 6 7 8 | 9 10
A L A G V T A A | D P
^
the cut
Question 1: Why we want to use a window where the cut takes place at position K-2?
Hint: go back to the wiki page and look at the logo plot of the cleavage site: https://teaching.healthtech.dtu.dk/22111/index.php/Exercise:_Neural_networks
Three datasets, three jobs¶
In this exercise of training artificial neural networks, we are going to use three datasets
Question 2: What are the datasets been used for?
| set | what it is for |
|---|---|
| train | ? |
| validation | ? |
| test | ? |
Things you will change in the exercise¶
| parameter | what it does |
|---|---|
SPLIT |
which file is train / validation / test |
K |
how many residues the network sees |
ENCODING |
"onehot" or "blosum" |
HIDDEN |
no hidden layers, one, two, ... |
#install some libraries
!pip install logomaker
!pip install biopython
import copy, warnings
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import log_loss
from Bio.Align import substitution_matrices
warnings.filterwarnings("ignore") # silence per-epoch convergence warnings
# - DATASET NAMES
A = "EUK_SP_0"
B = "EUK_SP_1"
C = "EUK_SP_2"
# ---- THE PARAMETERS YOU CHANGE ----
SPLIT = {
"train": A,
"validation": B,
"test": C,
} # <-- swap these three splits around and re-run the notebook (A, B, C);(C, B, A);...
K = 10 # window size
ENCODING = "blosum" # "onehot" or "blosum"
HIDDEN = (32,) # () = no hidden layer, (32,) = one, (32,16) = two, ...
DATA_DIR = "/home/projects/22111/ANN" # folder with the .fasta files
# -----------------------------------
#other parameters
UP, DOWN = K - 2, 2
SCALE = 4.0 # blosum only: shrinks the numbers
print(f"Selected Parameters:\n")
for role, f in SPLIT.items():
print(f"{role:>11} : {f}")
print(f"\nK = {K} ({UP} before the cut, {DOWN} after) encoding = {ENCODING}")
1. Load the three datasets¶
The files are in the SignalP 3-line format:
>P12345|EUKARYA|SP|1
MKWVTFISLLLLFSSAYSRGVFRR... <- the protein sequence
SSSSSSSSSSSSSSSSSSOOOOOO... <- S = signal peptide, O = mature protein
The cut is at the last S. 18 S's means the cut is between residue 18 and 19, which we store
as site = 17 (counting from 0): "cut after the residue at index 17".
Question 3: These three files are homology-reduced against each other, what does this mean? Why do we do this?
def load_fasta(path):
"""Return (list of sequences, array of cut positions)."""
lines = [l.strip() for l in open(path) if l.strip()]
if not lines[0].startswith('>'): # tolerate a stray prefix
lines[0] = lines[0][lines[0].index('>'):]
seqs, sites = [], []
for i in range(0, len(lines), 3):
seq, ann = lines[i+1], lines[i+2]
n_S = 0
while n_S < len(ann) and ann[n_S] == 'S': # count the S's at the start
n_S += 1
if 0 < n_S < len(seq):
seqs.append(seq)
sites.append(n_S - 1)
return seqs, np.array(sites)
train_seqs, train_sites = load_fasta(f"{DATA_DIR}/{SPLIT['train']}.fasta")
val_seqs, val_sites = load_fasta(f"{DATA_DIR}/{SPLIT['validation']}.fasta")
test_seqs, test_sites = load_fasta(f"{DATA_DIR}/{SPLIT['test']}.fasta")
for role, (s, _) in zip(SPLIT, [(train_seqs, 0), (val_seqs, 0), (test_seqs, 0)]):
print(f"{role:>11} ({SPLIT[role]}): {len(s)} proteins")
print(f"\n")
print(f"This part of the code 'parses' the fasta files to find where the cutting site is for each protein in each data set.\n")
print(f"For example:\n")
print(" ", train_seqs[0][:40], "...")
print(" cut after index", train_sites[0],
"-> signal peptide =", train_seqs[0][:train_sites[0]+1])
2. Turn letters into numbers¶
A neural network cannot read the amino acid symbols A, L, G. Therefore we need to transform
the letters in the amino acid alphabet into numbers. There are two options.
One-hot. Each amino acid gets its own input vector of 21 numbers, all zeros except one. For example: A = [1,0,0,..,0]; R = [0,1,0,..,0]; N =[0,0,1,..,0] Simple, but it says every amino acid is equally different from every other — swapping leucine for isoleucine (nearly interchangeable) looks as drastic as swapping it for aspartate.
BLOSUM62. Each amino acid is described by how readily it swaps for each of the other 20, counted from real protein alignments. L and I get almost the same row, so what the network learns about one transfers to the other.
Question 4: Which encoding scheme do you think will be more useful for our network? Make your guess now and after solving the full exercise contrast your guessing with results.
other parameters you could change in the first setup (Optional)¶
Why divide by SCALE? Raw BLOSUM runs from -4 to +11. Numbers that big saturate the hidden
neurons and waste the early training undoing it. Dividing brings them into the range where
networks learn well. Try SCALE = 1 later and watch the accuracy drop.
AA = "ACDEFGHIKLMNPQRSTVWY"
TO_N = {a: i for i, a in enumerate(AA)}
PAD = 20 # 21st slot: padding or unknown residue
def to_numbers(seq):
return np.array([TO_N.get(c, PAD) for c in seq])
def build_encoder(kind):
"""Lookup table: row i = the numbers that represent amino acid i."""
if kind == "onehot":
return np.eye(21) # 21 rows x 21 columns
blosum = substitution_matrices.load("BLOSUM62")
M = np.zeros((21, 20)) # 21 rows x 20 columns
for i, a in enumerate(AA):
for j, b in enumerate(AA):
M[i, j] = blosum[a, b]
return M / SCALE # last row (PAD) stays all zeros
ENCODER = build_encoder(ENCODING)
oh, bl = build_encoder("onehot"), build_encoder("blosum")
print("How different are two residues under each encoding?")
oh = build_encoder("onehot")
blosum = substitution_matrices.load("BLOSUM62")
print(f"{'swap':>10} {'one-hot':>9} {'BLOSUM62':>10}")
for a, b in [("L", "L"), ("L", "I"), ("L", "D")]:
print(f"{a} -> {b:<5} {oh[TO_N[a]][TO_N[b]]:>9.0f} {blosum[a, b]:>10.0f}")
print("\n one-hot gives 0 to BOTH swaps - it cannot tell them apart")
print(" BLOSUM gives +2 to L->I (common) and -4 to L->D (rare)")
3. Cut every protein into windows¶
Slide the window along the protein; each position gives one window.
- window landing exactly on the true cut -> label 1
- every other window -> label 0
At the start of the protein the window hangs off the edge, so we pad with the PAD symbol.
def protein_to_windows(seq):
"""All windows of one protein. Row i = the window whose cut would be after residue i."""
nums = to_numbers(seq)
L = len(nums)
padded = np.full(L + UP - 1 + DOWN, PAD)
padded[UP - 1 : UP - 1 + L] = nums
n_windows = L - 1
return padded[np.arange(n_windows)[:, None] + np.arange(K)[None, :]]
def build_dataset(seqs, sites):
"""Stack the windows of all proteins into X (inputs), y (labels), groups (which protein)."""
X, y, groups = [], [], []
for p, (seq, site) in enumerate(zip(seqs, sites)):
w = protein_to_windows(seq)
labels = np.zeros(len(w), dtype=int)
labels[site] = 1 # exactly one positive per protein
X.append(ENCODER[w].reshape(len(w), -1))
y.append(labels)
groups.append(np.full(len(w), p))
return np.vstack(X), np.concatenate(y), np.concatenate(groups)
# --- check it on the first training protein ---
seq, site = train_seqs[0], train_sites[0]
letters = "".join(AA[c] if c < 20 else '-' for c in protein_to_windows(seq)[site])
print("protein:", seq[:30], "... true cut after index", site)
print()
print("the POSITIVE window:", letters[:UP], "|", letters[UP:])
print(" ", " " * (UP - 1) + "^ cut goes here")
X_train, y_train, _ = build_dataset(train_seqs, train_sites)
X_val, y_val, groups_val = build_dataset(val_seqs, val_sites)
print("Here we build the dataset that we will use to train the network:\n")
print("What is the shape fo our dataset after slicing the train and validation sets")
print(f"in all possible windows of size: K \n")
print(f"X_train : {X_train.shape} ({X_train.shape[1]} = {K} x {ENCODER.shape[1]})")
print(f"X_val : {X_val.shape}")
print(f"\ntraining positives: {y_train.sum()} negatives: {(y_train==0).sum()}")
print(f"ratio: 1 positive per {(y_train==0).sum() // y_train.sum()} negatives")
4. Train, and watch the validation set¶
We train one epoch at a time (warm_start=True, max_iter=1) so that after every epoch we can
measure the loss on the validation set as well as on the training set.
We deliberately keep going for 100 iterations, so you can see what happens.
N_EPOCHS = 100
model = MLPClassifier(
hidden_layer_sizes=HIDDEN,
alpha=1e-4, # weak regularisation, so overfitting is visible
learning_rate_init=3e-4,
max_iter=1, # one epoch per .fit() call
warm_start=True, # ...and carry on from where we left off
random_state=0,
)
train_loss, val_loss = [], []
best_loss, best_epoch, best_weights = np.inf, 0, None
for epoch in range(1, N_EPOCHS + 1):
model.fit(X_train, y_train) # one more epoch
train_loss.append(model.loss_)
p_val = model.predict_proba(X_val)[:, 1]
vl = log_loss(y_val, p_val, labels=[0, 1])
val_loss.append(vl)
if vl < best_loss: # remember the best moment
best_loss, best_epoch = vl, epoch
best_weights = (copy.deepcopy(model.coefs_),
copy.deepcopy(model.intercepts_))
print(f"best validation loss at epoch {best_epoch} ({best_loss:.4f})")
print(f"after {N_EPOCHS} epochs: train {train_loss[-1]:.4f}, validation {val_loss[-1]:.4f}")
fig, ax = plt.subplots(figsize=(10, 4.5))
ax.plot(range(1, N_EPOCHS+1), train_loss, color="steelblue", lw=2, label="training loss")
ax.plot(range(1, N_EPOCHS+1), val_loss, color="crimson", lw=2, label="validation loss")
ax.axvline(best_epoch, color="green", ls="--", lw=2, label=f"stop here (epoch {best_epoch})")
ax.axvspan(best_epoch, N_EPOCHS, color="red", alpha=.06)
ax.text((best_epoch + N_EPOCHS)/2, max(val_loss)*0.75,
"training loss keeps falling,\nvalidation loss rises",
ha="center", color="darkred", fontsize=10)
ax.set_xlabel("epoch"); ax.set_ylabel("loss")
ax.set_title("Why we stop early")
ax.legend(); ax.grid(alpha=.3)
plt.tight_layout(); plt.show()
Question 5: Explain the plot with your own words. What is the red curve and the blue curve? What is happening after the green line? Is there a name for this effect?
As an illustrative example of what happens with the model trained on 100 epochs, we are going to continue with that.
#model.coefs_, model.intercepts_ = best_weights # rewind to the best epoch
#print(f"restored the weights from epoch {best_epoch}")
5. Test: scan one protein¶
For a new protein we score every window of size K, and select the window with the highest score. That position is our prediction for the cleavage site.
def predict_site(seq, m=None):
"""Score every window of a protein; return (best position, all scores)."""
m = m or model
w = protein_to_windows(seq)
scores = m.predict_proba(ENCODER[w].reshape(len(w), -1))[:, 1]
return int(np.argmax(scores)), scores
i = 1
pred, scores = predict_site(test_seqs[i])
true = test_sites[i]
plt.figure(figsize=(11, 2.5))
plt.plot(scores, color="steelblue", lw=1.5, label="model score")
plt.axvline(true, color="green", lw=2, label=f"true cut ({true})")
plt.axvline(pred, color="red", ls="--", lw=2, label=f"predicted ({pred})")
plt.xlabel("position in protein"); plt.ylabel("P(cut here)")
plt.title(f"Scanning one protein from the TEST set ({SPLIT['test']})")
plt.legend(); plt.grid(alpha=.3); plt.tight_layout(); plt.show()
print("correct!" if pred == true else f"missed by {abs(pred-true)} positions")
6. How good is it?¶
Scan every protein and count how often the top-scoring window is the right one.
We report train / validation / test side by side. "within 1" and "within 2" tell us whether our mistakes are small slips or real failures.
Question 6: Do you notice something weird about them?
def evaluate(seqs, sites):
preds = np.array([predict_site(s)[0] for s in seqs])
err = np.abs(preds - sites)
return (err == 0).mean(), (err <= 1).mean(), (err <= 2).mean(), preds - sites
results = {}
for role, (s, t) in [("train", (train_seqs, train_sites)),
("validation", (val_seqs, val_sites)),
("test", (test_seqs, test_sites))]:
results[role] = evaluate(s, t)
print(f"K = {K} encoding = {ENCODING}\n")
print(f"{'set':>11} {'file':>10} {'n':>5} {'exact':>8} {'within 1':>9} {'within 2':>9}")
for role in ["train", "validation", "test"]:
e, w1, w2, _ = results[role]
n = len({"train": train_seqs, "validation": val_seqs, "test": test_seqs}[role])
print(f"{role:>11} {SPLIT[role]:>10} {n:>5} {e*100:>7.1f}% {w1*100:>8.1f}% {w2*100:>8.1f}%")
fig, ax = plt.subplots(1, 2, figsize=(13, 4))
roles = ["train", "validation", "test"]
x = np.arange(3)
for j, (lbl, col) in enumerate([("exact", "#2a7"), ("within 1", "#7b4"), ("within 2", "#cc5")]):
vals = [results[r][j]*100 for r in roles]
ax[0].bar(x + (j-1)*0.27, vals, 0.27, color=col, label=lbl)
ax[0].set_xticks(x); ax[0].set_xticklabels([f"{r}\n({SPLIT[r]})" for r in roles])
ax[0].set_ylabel("accuracy (%)"); ax[0].set_ylim(0, 100)
ax[0].set_title("Train vs validation vs test"); ax[0].legend(); ax[0].grid(alpha=.3, axis="y")
errors = results["test"][3]
ax[1].hist(np.clip(errors, -10, 10), bins=np.arange(-10.5, 11.5),
color="steelblue", edgecolor="w")
ax[1].axvline(0, color="green", lw=2)
ax[1].set_xlabel("predicted - true (0 = correct)"); ax[1].set_ylabel("proteins")
ax[1].set_title(f"Test-set mistakes ({SPLIT['test']})")
plt.tight_layout(); plt.show()
Question 7: What happens if we add early stopping? (Remove the # symbols in the next code cell and run again the cells in point 5 and 6. Can you observe any differences? Why?
model.coefs_, model.intercepts_ = best_weights # rewind to the best epoch
print(f"restored the weights from the best epoch {best_epoch}")
7. Choosing K and the encoding — properly (THIS CELL NEEDS EDIT BEFORE RUNNING)¶
Now we use all three sets the way they are meant to be used:
- train many models on the training set
- pick the best one using the validation set
- report that one model's number on the test set, once
This is the whole point of having three files. If we picked the best K by looking at the test
set, the number we report would be flattering and wrong.
(For speed this part uses scikit-learn's built-in early_stopping, which carves a slice out of
the training data, rather than our manual epoch loop.)
def run_experiment(k, encoder):
"""Train on train, return (validation accuracy, test accuracy)."""
global K, UP, ENCODER
keep = (K, UP, ENCODER)
K, UP, ENCODER = k, k - 2, encoder
Xtr, ytr, _ = build_dataset(train_seqs, train_sites)
m = MLPClassifier(hidden_layer_sizes=(32,), alpha=1e-2, max_iter=100,
early_stopping=True, random_state=0).fit(Xtr, ytr)
accs = []
for seqs, sites in [(val_seqs, val_sites), (test_seqs, test_sites)]:
preds = [predict_site(s, m)[0] for s in seqs]
accs.append((np.array(preds) == sites).mean())
K, UP, ENCODER = keep
return accs[0], accs[1]
# GRID SEARCH --------- => EDIT HERE
Ks = [X1, X2, X3, .., XN] # For example to try 4,6,8 and 10 use Ks = [4, 6, 8, 10]
scores = {enc: [run_experiment(k, build_encoder(enc)) for k in Ks]
for enc in ["onehot", "blosum"]}
# ---------
print(f"{'K':>3} {'onehot val':>11} {'onehot test':>12} {'blosum val':>11} {'blosum test':>12}")
for i, k in enumerate(Ks):
ov, ot = scores["onehot"][i]; bv, bt = scores["blosum"][i]
print(f"{k:>3} {ov*100:>10.1f}% {ot*100:>11.1f}% {bv*100:>10.1f}% {bt*100:>11.1f}%")
fig, ax = plt.subplots(1, 2, figsize=(13, 4))
for enc, col in [("onehot", "steelblue"), ("blosum", "darkorange")]:
ax[0].plot(Ks, [v*100 for v, _ in scores[enc]], "o-", color=col, lw=2, label=f"{enc}")
ax[0].set_xlabel("window size K"); ax[0].set_ylabel("VALIDATION accuracy (%)")
ax[0].set_title("Validation set: Choose using validation only"); ax[0].legend(); ax[0].grid(alpha=.3)
# the winner, chosen on validation
best_enc, best_i = max(((e, i) for e in scores for i in range(len(Ks))),
key=lambda t: scores[t[0]][t[1]][0])
best_K = Ks[best_i]
ax[0].plot(best_K, scores[best_enc][best_i][0]*100, "*", ms=22, color="red", zorder=5)
for enc, col in [("onehot", "steelblue"), ("blosum", "darkorange")]:
ax[1].plot(Ks, [t*100 for _, t in scores[enc]], "o--", color=col, lw=2, label=f"{enc}")
ax[1].set_xlabel("window size K"); ax[1].set_ylabel("TEST accuracy (%)")
ax[1].set_title("Test set: Only looked at afterwards"); ax[1].legend(); ax[1].grid(alpha=.3)
plt.tight_layout(); plt.show()
v, t = scores[best_enc][best_i]
print(f"chosen on the validation set the best parameters are: {best_enc}, K = {best_K} (validation {v*100:.1f}%)")
print(f"The honest score ot the TEST SET {t*100:.1f}%")
Question 8: Which parameters were best in your validation set? Was it best using one-hot or Blosum encoding?
TIP: If your best model is in one end of the grid search, consider if you want to add more values in that direction.
8. Playing with hidden layers. (THIS CELL NEEDS EDIT BEFORE RUNNING)¶
Question 9: What do you expect to happen with the ANN if there are no hidden layers?
Question 10: What do you expect to happen with 1, 2, 3 hidden layers? How the number of hidden neurons affects the run time and accuracy?
architectures = [ (), (17,), (4,), (16,), (32,)] # Example ---=> architectures = [(), (4,), (16,), (32,), (64,), (32, 16), (64, 32, 16)]
K, UP, ENCODER = 17, 15, build_encoder(ENCODING)
Xtr, ytr, _ = build_dataset(train_seqs, train_sites)
rows = []
for h in architectures:
m = MLPClassifier(hidden_layer_sizes=h, alpha=1e-2, max_iter=300,
early_stopping=True, random_state=0).fit(Xtr, ytr)
val = np.mean([predict_site(s, m)[0] == t for s, t in zip(val_seqs, val_sites)])
test = np.mean([predict_site(s, m)[0] == t for s, t in zip(test_seqs, test_sites)])
n_par = sum(c.size for c in m.coefs_)
rows.append((h, n_par, val, test))
print(f"{str(h):>14} {n_par:>7} weights val {val*100:5.1f}% test {test*100:5.1f}%")
plt.figure(figsize=(9, 4))
x = np.arange(len(rows))
plt.bar(x - 0.2, [r[2]*100 for r in rows], 0.4, label="validation")
plt.bar(x + 0.2, [r[3]*100 for r in rows], 0.4, label="test")
plt.xticks(x, ["none" if r[0] == () else str(r[0]) for r in rows], rotation=20)
plt.ylabel("accuracy (%)"); plt.xlabel("hidden layers")
plt.legend(); plt.grid(alpha=.3, axis="y"); plt.tight_layout(); plt.show()
9. What did the network learn?¶
Each block of weights in the first layer belongs to one window position. Adding up the size of the weights in each block tells us how much the network relies on each position. To make a simple test we are going to eliminate the hidden layer.
If our story about the biology is right, the positions just before the cut should dominate.
K, UP, ENCODER = 17, 15, build_encoder(ENCODING)
Xtr, ytr, _ = build_dataset(train_seqs, train_sites)
m = MLPClassifier(hidden_layer_sizes=(), alpha=1e-2, max_iter=300,
early_stopping=True, random_state=0).fit(Xtr, ytr)
W = np.abs(m.coefs_[0])
importance = W.reshape(K, ENCODER.shape[1], -1).sum(axis=(1, 2))
importance /= importance.sum()
labels = [str(p) for p in range(-UP, 0)] + [f"+{p}" for p in range(1, DOWN + 1)]
plt.figure(figsize=(11, 4))
plt.bar(range(K), importance, color=["steelblue"]*UP + ["darkorange"]*DOWN)
plt.xticks(range(K), labels)
plt.axvline(UP - 0.5, color="k", lw=2)
plt.xlabel("position relative to the cut (black line = the cut)")
plt.ylabel("how much the network uses it")
plt.title(f"Which positions matter? ({ENCODING})")
plt.tight_layout(); plt.show()
print("most used positions:", [labels[i] for i in np.argsort(-importance)[:3]])
# ---- The cleavage motif in all three datasets ----
import pandas as pd, logomaker
K, UP = 17, 15
def window_freqs(seqs, sites):
"""Amino acid frequencies at each window position."""
C = np.full((K, 21), 0.5)
for seq, s in zip(seqs, sites):
for j, sym in enumerate(protein_to_windows(seq)[min(s, len(seq)-2)]):
C[j, sym] += 1
return C / C.sum(1, keepdims=True)
def logo_data(seqs, sites, n_null=200):
"""Real frequencies, information content, and the null-test floor."""
real = window_freqs(seqs, sites)
# NULL TEST: put the cut in the WRONG place, 200 times. This is also our
# background, so everything that is merely "typical of a signal peptide"
# cancels out and only what marks the cut itself survives.
rng = np.random.default_rng(0)
nulls = np.array([window_freqs(seqs, rng.choice(sites, len(seqs)))
for _ in range(n_null)])
bg = nulls.mean(0)
def info(f):
with np.errstate(divide="ignore", invalid="ignore"):
return np.nansum(np.where(f > 0, f*(np.log2(f)-np.log2(bg)), 0), axis=1)
return real, info(real), np.percentile([info(n) for n in nulls], 95, axis=0)
labels = [str(p) for p in range(-UP, 0)] + [f"+{p}" for p in range(1, DOWN+1)]
sets = [("train", train_seqs, train_sites),
("validation", val_seqs, val_sites),
("test", test_seqs, test_sites)]
fig, axes = plt.subplots(3, 1, figsize=(12, 9), sharex=True)
for ax, (role, seqs, sites) in zip(axes, sets):
real, ic, floor = logo_data(seqs, sites)
heights = pd.DataFrame(real[:, :20] * np.clip(ic, 0, None)[:, None], columns=list(AA))
logomaker.Logo(heights, ax=ax, color_scheme="chemistry", show_spines=False)
ax.plot(range(K), floor, "r--", lw=1.3)
ax.axvline(UP - 0.5, color="k", lw=2)
ax.set_ylabel("bits"); ax.set_ylim(0, 1.35)
ax.set_title(f"{role} ({SPLIT[role]}, n={len(seqs)})", loc="left", fontsize=11)
print(f"{role:>11}: top 3 =", [labels[i] for i in np.argsort(-ic)[:3]])
axes[-1].set_xticks(range(K)); axes[-1].set_xticklabels(labels)
axes[-1].set_xlabel("position relative to the cut "
"(black line = the cut, red dashed = null test)")
fig.suptitle("The cleavage motif, seen in all three datasets", y=0.995)
plt.tight_layout(); plt.show()
Question 11: What can you say about the three splits? Do they look the same? Can you guess what will happen if you select a different split of the one you tried?
If you have extra time, other things you can try¶
- Reframe the problem. "Where is the cut?" In the begining we set K-2 as the optimal. Where can you change this?
- Encoding matters. BLOSUM62 knows leucine and isoleucine are near-interchangeable however the
matrix values are somewhat big and not optimal. You can play with SCALE to change this parameter.
- Set
SCALE = 1and re-run. Why does BLOSUM get worse?
- Set
- Three sets, three jobs. Train fits the weights, validation decides when to stop and which
settings to use, test is opened once at the end. What happens if you change the order?
- Rotate the files in
SPLIT(there are 6 orderings). How much does the test number move? That spread is your real uncertainty — a single split can flatter you by several percent.
- Rotate the files in
- What is alpha?
- Raise
alphato1e-2in the epoch loop. What happens to the red curve?
- Raise