koaning / scikit-lego

Extra blocks for scikit-learn pipelines.
https://koaning.github.io/scikit-lego/
MIT License
1.27k stars 117 forks source link

feature request: loess/lowess regression #3

Closed koaning closed 5 years ago

koaning commented 5 years ago

I've always wanted to have loess regression in python. R has a cool version of it but it has always been missing. This would be a great model to host here.

koaning commented 5 years ago

The easiest way to explain what it needs to do:

dvanamstel commented 5 years ago

DIBS

tsuhina commented 5 years ago

Second that

koaning commented 5 years ago
library(tidyverse)

df <- data_frame(xs=1:120, ys=10*sin(xs/10) + rnorm(120, 0, xs/10)) %>% 
  filter(ifelse((xs < 100) & (xs > 75), FALSE, TRUE))

ggplot() + 
  geom_point(data=df, aes(xs, ys)) + 
  geom_smooth(data=df, aes(xs, ys), span=0.5)

image

koaning commented 5 years ago
ggplot() + 
  geom_point(data=df, aes(xs, ys)) + 
  geom_smooth(data=df, aes(xs, ys), span=0.1)

image

koaning commented 5 years ago
ggplot() + 
  geom_point(data=df, aes(xs, ys)) + 
  geom_smooth(data=df, aes(xs, ys), span=1)

image

koaning commented 5 years ago

http://web.ipac.caltech.edu/staff/fmasci/home/astro_refs/LocalRegressionBook_1999.pdf

dvanamstel commented 5 years ago

Nice book, thanks!

I expect to have a few hours next week to finish up what we started.

koaning commented 5 years ago

It seems to be in statsmodels. Maybe it is not a right fit.