mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-16 04:18:07 +00:00
fix(MetaLabeling): previously misinterpreted meta-labeling, now also multiplying base model's prediction with the meta model's prediction (#193)
* fix(MetaLabeling): previously misinterpreted meta-labeling, now also multiplying base model's prediction with the meta model's prediction * fix(Evaluate): print results * fix(Evaluate): make sure we have numerical stability in returns * fix(Inference): only output and print stats in training mode * fix(Evaluate): don't add miniscule amount to result
This commit is contained in:
+12
-8
@@ -9,14 +9,18 @@ def ensemble_weights(
|
||||
forward_returns: ForwardReturnSeries,
|
||||
y: ySeries,
|
||||
no_of_classes: Literal['two', 'three-balanced', 'three-imbalanced'],
|
||||
output_stats: bool
|
||||
) -> EnsembleOutcome:
|
||||
weights = pd.concat(input_weights, axis=1).mean(axis=1)
|
||||
stats = evaluate_predictions(
|
||||
forward_returns = forward_returns,
|
||||
y_pred = weights,
|
||||
y_true = y,
|
||||
no_of_classes = no_of_classes,
|
||||
print_results = False,
|
||||
discretize = True,
|
||||
)
|
||||
if output_stats:
|
||||
stats = evaluate_predictions(
|
||||
forward_returns = forward_returns,
|
||||
y_pred = weights,
|
||||
y_true = y,
|
||||
no_of_classes = no_of_classes,
|
||||
discretize = True,
|
||||
)
|
||||
print(stats)
|
||||
else:
|
||||
stats = None
|
||||
return EnsembleOutcome(weights, stats)
|
||||
|
||||
Reference in New Issue
Block a user