sigma-py/smoothfit

How to calculate values with the fitted curve?

Opened this issue · 0 comments

reox commented

I would like to use the fitted curve to calculate values on it, for example, to calculate RMSE or to predict the y-value for some other given x-values:

import numpy as np
import smoothfit

x0 = np.linspace(-1.0, 1.0, 21)
y0 = 1 / (1 + 25 * x0 ** 2)

basis, coeffs = smoothfit.fit1d(x0, y0, -1.5, 1.5, 1000, degree=1, lmbda=1.0e-6)

# Calculate the fitted value for the given x values
y_fitted = basis.????(x0)
# Calculte the y value for some other x values
y_new = basis.????([1.2, 0.5, 1.333])

There is a method interpolator on the CellBasis object, but I have no idea how that works, as I have to give it some y-values?