functime-org / functime

Time-series machine learning at scale. Built with Polars for embarrassingly parallel feature extraction and forecasts on panel data.
https://docs.functime.ai
Apache License 2.0
975 stars 52 forks source link

Fractional Differentiation #97

Closed ngriffiths13 closed 8 months ago

ngriffiths13 commented 8 months ago

Would there be any interest in adding fraction differencing as a function to the library? This is talked about in M. L. Prado, "Advances in Financial Machine Learning". I have an implementation already in polars I could clean up and make a PR for if there is any interest.

You can also see this repo for a numpy example

topher-lo commented 8 months ago

Absolutely. Big fan of this technique. Would you have a recipe for the inverse operation?

ngriffiths13 commented 8 months ago

I don't believe you can calculate the inverse because it requires a dot product.

abstractqqq commented 8 months ago

@ngriffiths13 Is your implementation pure Polars expressions? Or it requires NumPy/SciPy under the hood?

ngriffiths13 commented 8 months ago

@abstractqqq i use numpy to calculate the weights before doing anything to the frame. But everything that happens to the frame is pure polars. Could remove numpy completely pretty easily if needed.

ngriffiths13 commented 8 months ago

@topher-lo I actually have been implementing most of the functions in the book referenced above. If any other ones interest you I would be happy to contribute more of them. (If you aren't familiar with the book I can put together a list)

topher-lo commented 8 months ago

Let's do it. I'm super excited to see this in action.

topher-lo commented 8 months ago

If you haven't already, please join our discord! We can then add you to the (very active) private contributors channel and take it from there.