-
Couldn't load subscription status.
- Fork 63
Open
Labels
Description
Bug description summary
In the FData class, the mean function is calculated with the sum function, which has a skipna option that ignores NaN values. However, for the division it is assumed that all elements are present, which could not be correct in all cases.
Code to reproduce the bug
from skfda.representation.grid import FDataGrid
data_matrix = np.array([
[1.0, 2.0, 3.0],
[np.nan, 2.0, 3.0],
[1.0, 2.0, np.nan],
])
fd = FDataGrid(data_matrix)
mean_fd = fd.mean(skipna=True)
print("Computed mean with skipna=True:")
print(mean_fd.data_matrix)Expected result
Computed mean with skipna=True:
[ 1.0 2.0 3.0]
Actual result
Computed mean with skipna=True:
[ 0.66 2.0 2.0]
Traceback (if an exception is raised)
No response
Software versions
scikit-fda version: 0.9.2.dev0
OS: Ubuntu 20.04.6 LTS (Focal Fossa)
Additional context
No response