File size: 950 Bytes
2baf26e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

from phenotype_inference import PhenotypeClassifier, print_prediction
from phenotype_next_tests import PhenotypeNextTestRecommender, print_next_test_report

MODEL_PATH = "phenotype_tinytransformer_v1_temperature_scaled.pt"
REFERENCE_PATH = "phenotype_reference_distributions.json"

classifier = PhenotypeClassifier(MODEL_PATH)
recommender = PhenotypeNextTestRecommender(classifier, REFERENCE_PATH)

features = {
    "Gram Stain": "Negative",
    "Shape": "Rods",
    "Catalase": "Positive",
    "Oxidase": "Positive",
    "Motility": "Positive",
    "Indole": "Negative",
    "Citrate": "Positive",
    "Urease": "Negative",
    "Growth Temperature": "20//37",
    "Media Grown On": "Blood Agar; MacConkey Agar",
}

prediction = classifier.predict(features, top_k=10)
print_prediction(prediction)

recommendations = recommender.recommend(
    features,
    n_recommendations=5,
    top_competing_genera=5,
)

print_next_test_report(recommendations)