Skip to content

Commit

Permalink
Add functime
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Dec 24, 2023
1 parent e440eb7 commit 56997dd
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 21 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
publish_dir: ./_build/html
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
publish_dir: ./_build/html
55 changes: 55 additions & 0 deletions book/machinelearning/timeseries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 56997dd

Please sign in to comment.