Open ToryDeng opened 3 months ago
This looks wrong and I have reproduced it. I will look into it.
Any updates?
For 1D loess, R and python agree. For 2D (and probably more), they disagree. So far, I have been unable to find out why.
The original loess implementation is dloess from netlib.org and both implementations are derived from that and the core code is mostly the same.
Now, that original code includes tests for 2D loess together with expected results. We use the same tests and get the exact (presumably correct) results. R has different results for the same 2D fit, yet as this issue shows, R's 2D fit looks like it is the correct one, if any one of them is!
I suspected something with row-major vs column-major order, but it didn't seem to be. I'll have to look a lot more closely.
Thanks a lot for your efforts! It seems like this issue is pretty tricky to solve. I'll switch to the R implementation for now but will keep an eye out for any updates on this issue.
For 1D loess, R and python agree. For 2D (and probably more), they disagree. So far, I have been unable to find out why.
The original loess implementation is dloess from netlib.org and both implementations are derived from that and the core code is mostly the same.
Now, that original code includes tests for 2D loess together with expected results. We use the same tests and get the exact (presumably correct) results. R has different results for the same 2D fit, yet as this issue shows, R's 2D fit looks like it is the correct one, if any one of them is!
I suspected something with row-major vs column-major order, but it didn't seem to be. I'll have to look a lot more closely.
Thank you for your excellent package! It works great for smoothing lines.
I recently wanted to use
loess
to smooth a surface with two variables. I have some sample data here: sample_data.csv. The two independent variables arecoord1
andcoord2
, and the response variable isexpression
.In R, my code using the
loess()
function from thestats
package produces reasonable results:The resulting plot in R looks like this:
However, when I attempt to perform
loess
smoothing in Python, I get quite different results. Here is my Python code:The resulting plot in Python looks like this:
Some information that might be useful:
The results are quite different from those in R. Although I've spent a lot of time on this, I still can't pinpoint the issue or determine if there's a bug in the package.
Could you please help me figure out what might be going wrong? Any insights or suggestions would be appreciated!