better abstraction and error handling/logging

This commit is contained in:
brmnjsh
2023-09-15 19:34:31 +00:00
parent 00ba6f4fc3
commit 64a1011604
4 changed files with 31 additions and 9 deletions

View File

@ -19,5 +19,9 @@ class AbilityEstimation(BaseModel):
}
def calculate(self) -> float:
model = self.IRT_MODELS[self.irt_model]
return model.ability_estimate(self.items)
if self.irt_model in self.IRT_MODELS:
model = self.IRT_MODELS[self.irt_model]
return model.ability_estimate(self.items)
else:
logging.error(f'model of type {self.irt_model} does not exist.')
return None