Code Monkey home page Code Monkey logo

Comments (4)

jmoralez avatar jmoralez commented on May 26, 2024

Hey @nelsoncardenas, thanks for using mlforecast and for the detailed report. I think the easiest way to achieve this is with a scikit-learn pipeline. Here's an example:

import pandas as pd
from mlforecast import MLForecast
from mlforecast.utils import generate_daily_series
from sklearn.compose import ColumnTransformer
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import OneHotEncoder

series = generate_daily_series(1, min_length=7, max_length=7)
model = make_pipeline(
    ColumnTransformer(
        [('encoder', OneHotEncoder(drop='first'), ['dayofweek'])],
        remainder='passthrough'
    ),
    LinearRegression()
)
fcst = MLForecast(models={'lr': model}, freq="D", date_features=["dayofweek"])
fcst.fit(series)
print(fcst.models_['lr'].named_steps['linearregression'].n_features_in_)  # 6

The available attributes are:

  • pandas: the ones listed under the "Attributes" section here.
  • polars: most of the ones here.

If you have time and would like to do it we'd appreciate a PR that explicitly lists the supported ones.

from mlforecast.

nelsoncardenas avatar nelsoncardenas commented on May 26, 2024

Thank you @jmoralez I'd like to help with that PR.

What would be the suggested steps?

from mlforecast.

jmoralez avatar jmoralez commented on May 26, 2024

I think you could add two lists (one for pandas and one for polars) in the nbs/core.ipynb notebook. We have this file with some contributing guidelines, but the first step should be to fork this repository and work on your fork instead (I'll fix that soon). Let me know if you have any questions.

from mlforecast.

nelsoncardenas avatar nelsoncardenas commented on May 26, 2024

@jmoralez Thank you. During the week I will dedicate some free time to it.

from mlforecast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.