diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 73f248b..7d7c7cf 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -3,34 +3,33 @@ name: deploy-book on: push: branches: - - "*" + - '*' # This job installs dependencies, build the book, and pushes it to `gh-pages` jobs: deploy-book: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - # Install dependencies - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 + # Install dependencies + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 - - name: Install dependencies - run: | - pip install -r requirements.txt + - name: Install dependencies + run: | + pip install -r requirements.txt + # Build the book + - name: Build the book + run: | + jupyter-book build . - # Build the book - - name: Build the book - run: | - jupyter-book build . - - # Push the book's HTML to github-pages - - name: GitHub Pages action - uses: peaceiris/actions-gh-pages@v3.5.9 - with: - github_token: ${{ secrets.ACCESS_TOKEN }} - publish_dir: ./_build/html + # Push the book's HTML to github-pages + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.5.9 + with: + github_token: ${{ secrets.ACCESS_TOKEN }} + publish_dir: ./_build/html diff --git a/book/machinelearning/timeseries.ipynb b/book/machinelearning/timeseries.ipynb index ec94296..16a0af1 100644 --- a/book/machinelearning/timeseries.ipynb +++ b/book/machinelearning/timeseries.ipynb @@ -252,6 +252,61 @@ "sf.fit(df)\n", "sf.predict(h=12, level=[95])" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Time Series with Polars Backend with `functime`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Fast time-series forecasting with `functime`.\n", + "\n", + "`functime` is a Python library for time series forecasting and feature extraction, built with Polars.\n", + "\n", + "Since it uses lazy Polars dataframes, `functime` speeds up forecasting and feature engineering.\n", + "\n", + "Backtesting, cross-validation splitters and metrics are included too.\n", + "\n", + "It even comes with a LLM agent to analyze and describe your forecasts.\n", + "\n", + "Check it out!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip install functime" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import polars as pl\n", + "from functime.cross_validation import train_test_split\n", + "from functime.forecasting import linear_model\n", + "from functime.metrics import mase\n", + "\n", + "y_train, y_test = y.pipe(train_test_split(test_size=3))\n", + "\n", + "forecaster = linear_model(freq=\"1mo\", lags=24)\n", + "forecaster.fit(y=y_train)\n", + "y_pred = forecaster.predict(fh=3)\n", + "\n", + "y_pred = linear_model(freq=\"1mo\", lags=24)(y=y_train, fh=3)\n", + "\n", + "scores = mase(y_true=y_test, y_pred=y_pred, y_train=y_train)" + ] } ], "metadata": {