From 3a6df05a3653a48a139b0db61786a1f794f086e1 Mon Sep 17 00:00:00 2001 From: John Huddleston Date: Thu, 21 Nov 2024 11:46:27 -0800 Subject: [PATCH] Fix type error in titer model cross-validation 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. --- augur/titer_model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/augur/titer_model.py b/augur/titer_model.py index 92b213be0..734cc2675 100644 --- a/augur/titer_model.py +++ b/augur/titer_model.py @@ -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 @@ -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] @@ -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