abstractqqq / polars_ds_extension

Polars extension for general data science use cases
MIT License
261 stars 17 forks source link

Implement a rolling least squares method. #193

Open Mateuscvieira opened 2 days ago

Mateuscvieira commented 2 days ago

In the example notebook we see rolling OLS done in the .rolling() context, and the text itself says it's a little slow. Well, polars_ols has an optimized version of least squares regression using an updating algorithm instead of reestimating at every window.

I know from reading previous issues that work on OLS is low priority, but this seems like a pretty straight forward job of porting the algorithm to this module's structure, so maybe we should give it a go? For economics and finance work, rolling OLS is one of the most used models, so it would be a very nice feature to have integrated here.

abstractqqq commented 2 days ago

Of course! Hands are tied on KNN right now unfortunately...

Just curious, what is in polars_ds that is not in polars_ols? And what makes you want to port polars_ols's functionality over? Do you think some consolidation will be great for the polars + data science community?