diff --git a/petab_select/analyze.py b/petab_select/analyze.py index d7841eb..0acc13d 100644 --- a/petab_select/analyze.py +++ b/petab_select/analyze.py @@ -181,21 +181,19 @@ def get_relative_criterion_values( def get_weights( - models: list[Model], criterion: Criterion + models: list[Model], + criterion: Criterion, ) -> dict[ModelHash, float]: """Calculate weights for a model based on different criteria. - Parameters - ---------- - model: - The calibrated petab-select model. - criterion: - Criterion to calculate weights of. - - Returns - ------- - dict: - Dictionary with model hashes as keys and weights as values. + Args: + model: + The calibrated petab-select model. + criterion: + Criterion to calculate weights of. + + Returns: + Keys are model hashes, values are weights. """ weights = {} criterion_values = [model.get_criterion(criterion) for model in models] @@ -210,6 +208,6 @@ def get_weights( weight = np.exp( -0.5 * (criterion_values[i] - np.min(criterion_values)) ) / np.sum(np.exp(-0.5 * delta_criterion_values)) - weights[model.get_hash()] = weight + weights[model.hash] = weight return weights