Closed pburger112 closed 4 months ago
Thank you @pburger112 . I am happy to consider this for merging, however we need to test this more thoroughly first, to avoid breaking backwards compatibility. First of all, let's work on the files changed: instead of adding a completely new file, can you please modify (the latest version of) cosmopower_NN
? In addition, could you please provide an example of the new feature in action (e.g. in a notebook), to showcase its benefit? I am asking as we would also need to add this to the documentation and notebooks, if it gets merged eventually.
Dear Alessio,
yes, I am happy to modify the current version of cosmopower_NN
and also make a note to show its benefits.
All the best
Pierre
Dear Alessio, Davide and Ian, As you probably know, I use cosmopower to train arbitrary summary statistics. However, these can also be negative, so taking the log10 is impossible as you do it for the power spectrum. Furthermore, although you internally normalize the input features, you are computing the loss function with the unnormalized features. This results in the fact that those features with larger values are weighted higher than those with smaller values. To improve the performance (even for power spectra), I had to normalize the features before passing them on the train(). This has the disadvantage that when calling cosmopower later on, the user needs to know how I normalized the features to rescale them.
To avoid this, I modified the cosmopower_NN module so that the user can specify how the features are internally scaled by passing the arguments scaling_subtraction and scaling_divison to the train(). Furthermore, I added the functions rescaled_predictions_np/tf and ten_to_rescaled_predictions_np/tf, which allows the user to call the rescaled features without forcing the user to know what scaling_subtraction and scaling_divison were used in the training.
I might not have modified the latest version of cosmopower_NN, but if you think my modifications are helpful, I will be happy to update the current version of cosmopower_NN.
All the best Pierre