Skip to content

Commit

Permalink
Fix type error in titer model cross-validation
Browse files Browse the repository at this point in the history
Fixes type errors in titer model code that is only accessible through
the developer's Python API but which prevented me from running
cross-validation of titer models with that API. It looks like these were
the only references to the dictionary methods of keys and values that
didn't get updated in the past.
  • Loading branch information
huddlej committed Nov 21, 2024
1 parent e90383b commit 3a6df05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions augur/titer_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def __init__(self, titers, **kwargs):
else:
self.titers = titers
strain_counts = type(self).count_strains(titers)
self.strains = strain_counts.keys()
self.strains = list(strain_counts.keys())

def read_titers(self, fname):
self.titer_fname = fname
Expand Down Expand Up @@ -504,7 +504,7 @@ def validate(self, plot=False, cutoff=0.0, validation_set = None, fname=None):
pred_titer = self.predict_titer(key[0], key[1], cutoff=cutoff)
validation[key] = (val, pred_titer)

validation_array = np.array(validation.values())
validation_array = np.array(list(validation.values()))
actual = validation_array[:,0]
predicted = validation_array[:,1]

Expand All @@ -517,7 +517,7 @@ def validate(self, plot=False, cutoff=0.0, validation_set = None, fname=None):
'rms_error': np.sqrt(np.mean((actual-predicted)**2)),
}
pprint(model_performance)
model_performance['values'] = validation.values()
model_performance['values'] = list(validation.values())

self.validation = model_performance

Expand Down

0 comments on commit 3a6df05

Please sign in to comment.