Skip to content

Conversation

shchur
Copy link
Collaborator

@shchur shchur commented May 20, 2025

Issue #, if available:

Description of changes:

  • With numpy>2.0 the ensemble weights are printed as follows:
    Ensemble weights: {'Chronos[bolt_small]': np.float64(0.74), 'DirectTabular': np.float64(0.04), 'ETS': np.float64(0.02), 'RecursiveTabular': np.float64(0.19)}
    
    This PR ensures that the weights are displayed as floats (and not np.float64 dtype).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@shchur shchur requested a review from abdulfatir May 20, 2025 15:46
@shchur shchur added the module: timeseries related to the timeseries module label May 20, 2025
@shchur shchur added this to the 1.3.1 milestone May 20, 2025
@@ -182,5 +182,5 @@ def _fit(
if weight != 0:
self.model_to_weight[model_name] = weight

weights_for_printing = {model: round(weight, 2) for model, weight in self.model_to_weight.items()}
weights_for_printing = {model: round(float(weight), 2) for model, weight in self.model_to_weight.items()}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nittest of picks: Not sure if weight.item() is better than casting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think float(something) is slightly better here because it will work even if the weight values have type float (and not np.float64).

@shchur shchur merged commit 4e0cfb4 into autogluon:master May 20, 2025
25 checks passed
Copy link

Job PR-5132-16822d3 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-5132/16822d3/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: timeseries related to the timeseries module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants