Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyloess does not work properly for X with more than one dimensions #1

Open
yjiangnan opened this issue May 23, 2018 · 0 comments
Open

Comments

@yjiangnan
Copy link
Owner

Currently, pyloess only works for fitting vectors x vs. y. It does not work properly for Matrix X with more than 1 dimensions vs. vector y. To reproduce the problem,

from numpy import *
from pyloess import loess
x = random.randn(403, 2)
y = sum(x, axis=1) + sum(random.randn(403, 2)/2, axis=1)
lo = loess(x, y)
lo.fit()
yfit = lo.outputs.fitted_values.tolist()
from mpl_toolkits.mplot3d import Axes3D
from pylab import *
fig = figure()
ion()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x[:,0], x[:,1], y)
ax.scatter(x[:,0], x[:,1], yfit, 'r')
show()

One can clearly see that the data points of y increase with the sum of x[:,0] and x[:,1], but yfit seems to be almost unaffected by the change of x. The problem seems to lie in file loessf.f in regarding to how the data is fitted (e.g. subroutine ehg127), but the Fortran code proved extremely difficult for me to understand or debug.

Not sure if someone can fix this ancient code or completely re-implement it in C/C++. It would be usefully if we can fit a dependent variable to more than one independent variables. The implementation should also correctly calculate the standard error of the fitting, since it is important in library rosely for biomedical research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant