lowess_fit() should allow extrapolation

Issue #60 resolved
Thomas Gilgenast created an issue

currently we interpolate between the x-values to which the lowess fit was performed

we could use scipy.interpolate.interp1d(..., fill_value='extrapolate') to get extrapolation for x-values beyond the range of those for which the lowess curve was fitted

the extrapolation could be controlled/disabled using the boundary condition kwargs which are already present

an example implementation is to replace

y_hat = np.interp(new_x, sorted_x, sorted_y_hat)

with

y_hat = scipy.interpolate.interp1d(sorted_x, sorted_y_hat, fill_value='extrapolate', assume_sorted=True)(new_x)

in lib5c.util.lowess.lowess_fit()

Comments (4)

  1. Log in to comment