Closed Wieske closed 4 months ago
Thanks for letting me know that.
I fixed the issue by setting the argvals to 0 in the case there is only one value for a specific observations. This solution might be temporary as I am considering adding the standardisation for the to_long() function.
You can install the latest version from source (not from pip) and the problem should be solved.
I'm trying to use this package for MFPCA with IrregularFunctionalData (on a fixed grid, but with missing values). However, one issue I have is that I'm getting a lot of warnings, most of them this warning:
...\FDApy\representation\argvals.py:441: RuntimeWarning: invalid value encountered in divide stand_dict[out_key][in_key] = (value - min_x) / (max_x - min_x)
Looking into the code this mostly seems te happen because it is trying to normalize a single 0 value, which has a min_x and max_x of 0 and will lead to division by 0. This is mostly a result of the function to_long in functional_data.py, which loops over each observation in the IrregularFunctionalData and each time this creates a new set of argvals that is then again normalized. Some of my observations only have one data point at 0, which leads to the warning, but in general I'm not sure why normalization is used here?Suggested fix: