Advanced models, from Python

Advanced models

Strategies 35-39 add what the others lack: an error rate stated before the answer is seen (conformal prediction, 35 and 39), a model that sees each gene's network neighbourhood (graph convolution, 36), one that finds thresholds and interactions (random forest, 37), and one that learns how far to trust each kind of evidence (stacking, 38).

In [1]:
from starplast import strategies as Ssets = S.run('conformal_calls', target='compartment', alpha=0.1)sets.tables['prediction sets'].head(10)
Out[1]:
gene_id product prediction_set set_size
TGME49_311650 leucine rich repeat-containing protein PM - peripheral 2 1
TGME49_311810 hypothetical protein apicoplast 1
TGME49_273100 3'-5' exonuclease domain-containing protein mitochondrion - soluble 1
TGME49_209640 hypothetical protein mitochondrion - soluble 1
TGME49_224760 SAG-related sequence SRS40E PM - peripheral 1 1
TGME49_320250 SAG-related sequence SRS15A PM - peripheral 1 1
TGME49_255370 apicoplast import protein TIC20 apicoplast 1
TGME49_321490 SAG-related sequence SRS12A PM - peripheral 1 1
TGME49_278390 Toxoplasma gondii family A protein PM - peripheral 1 1
TGME49_235920 dynein, axonemal, heavy chain 2 family protein PM - peripheral 2 | endomembrane vesicles 2
In [2]:
t = S.test('conformal_calls', target='compartment'){k: round(v, 3) for k, v in t.numbers.items()}
Out[2]:
{'set_coverage': 0.911, 'promised_coverage': 0.9, 'null_set_coverage': 0.876, 'mean_set_size': 6.597, 'classes': 24, 'singleton_share': 0.002}
In [3]:
sgc = S.run('graph_convolution', target='compartment')sgc.tables['where the model looks']
Out[3]:
block share of model weight
the gene itself 0.634
1-step neighbourhood 0.237
2-step neighbourhood 0.129
In [4]:
rf = S.run('random_forest', target='compartment')rf.tables['what defines the label'].head(10)
Out[4]:
measurement importance sd impurity_importance
is_tm 0.0213 0.00175 0.00717
cellcycle19092_8h_r2 0.0191 0.00197 0.00657
cellcycle19092_blocked_r2 0.0171 0.00702 0.00681
cellcycle19092_7h_r1 0.0168 0.00891 0.0065
cellcycle19092_5h_r1 0.0166 0.00334 0.00698
cellcycle19092_7h_r2 0.0163 0.000579 0.00619
cellcycle19092_3h_r2 0.0161 0.00192 0.00537
n_struct_similar 0.016 0.00275 0.00555
cellcycle19092_4h_r1 0.0153 0.00381 0.00667
cellcycle19092_4h_r2 0.0129 0.00426 0.00626
In [5]:
stack = S.run('stacking', target='compartment')stack.tables['trust by evidence']
Out[5]:
evidence share of meta-model weight
measurements (logistic) 0.422
measurements (kNN) 0.289
networks (vote) 0.289
In [6]:
fit = S.run('conformal_values', target='fit_invitro_hff', alpha=0.1)fit.tables['surprises'].head(10)
Out[6]:
gene_id product measured predicted lower upper distance_outside
TGME49_305160 histone H2Ba -4.96 0.0577 -2.53 2.64 2.43
TGME49_253160 hypothetical protein -4.99 -0.335 -2.92 2.25 2.07
TGME49_312200 serine/threonine protein phosphatase PP5 0.71 -3.93 -6.52 -1.35 2.06
TGME49_267000 hypothetical protein -4.56 0.0755 -2.51 2.66 2.05
TGME49_242580 iron only hydrogenase large subunit, c-terminal domain-containing protein -4.36 0.0834 -2.5 2.67 1.86
TGME49_316330 superoxide dismutase SOD2 -4.09 0.331 -2.25 2.92 1.84
TGME49_228170 dense granule protein GRA44 -3.28 1.13 -1.45 3.72 1.83
TGME49_212270 CLAMP-linked invasion protein CLIP -3.05 1.32 -1.26 3.91 1.79
TGME49_248940 hypothetical protein 2.18 -2.15 -4.73 0.435 1.74
TGME49_268720 Hrf1 family protein -4.94 -0.677 -3.26 1.91 1.68