GAA-UAM / scikit-fda

Functional Data Analysis Python package
https://fda.readthedocs.io
BSD 3-Clause "New" or "Revised" License
309 stars 58 forks source link

Dose BasisSmoother rely on smoothing_parameter values? #500

Open mikeaalv opened 2 years ago

mikeaalv commented 2 years ago

Describe the bug It seems to me change smoothing_parameter doesn't effect result of BasisSmoother, particularly the score

To Reproduce I'm using something similar to the one used in the docs

t = np.linspace(0, 1, 5)
x = np.sin(2 * np.pi * t) + np.cos(2 * np.pi * t) + 2
fd = skfda.FDataGrid(data_matrix=x, grid_points=t)
basis = skfda.representation.basis.FourierBasis((0, 1), n_basis=3)
smoother = skfda.preprocessing.smoothing.BasisSmoother(basis,smoothing_parameter=100)
fd_smooth = smoother.fit_transform(fd)
fd_smooth.data_matrix.round(2)
smoother.score(fd,fd)

Expected behavior changing smoothing_parameter doesn't seem to affect the score. I'm having the updated github version

Version information

Additional context

vnmabus commented 2 years ago

Thank you for the report! Maybe the documentation is not clear, but you need to specify the type of regularization using the regularization parameter. Otherwise, smoothing_parameter doesn't do anything. In fact, as you can specify a multiplier using the regularization parameter, smoothing_parameter is redundant and will probably be deprecated in the future.

mikeaalv commented 2 years ago

It seems working for me. Thank you so much. Some examples on lambda search with b-spline basis would be super helpful.

mynanshan commented 11 months ago

Thanks for the question and the answer here. It would be great to have more examples on BasisSmoother and the GCV parameter selection. Besides, I think it also helpful to provide an independent introduction to some basic modules such as regularization and operator. For now, one may have to look into the source codes to custom a smoother.