Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .binder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This Dockerfile is used to build sktime when launching binder.
# Find out more at: https://mybinder.readthedocs.io/en/latest/index.html

FROM jupyter/scipy-notebook:python-3.11.6
# Set up user to avoid running as root
ARG NB_USER
ARG NB_UID
ENV USER ${NB_USER}
ENV HOME /home/${NB_USER}

# Binder will automatically clone the repo, but we need to make sure the
# contents of our repo are in the ${HOME} directory
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}

# Switch user and directory
USER ${USER}
WORKDIR ${HOME}

# Install extra requirements and sktime based on master branch
RUN pip install --upgrade pip --no-cache-dir && pip install .[binder]
103 changes: 103 additions & 0 deletions examples/getting_started.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Welcome to tsbootstrap\n",
"\n",
"`tsbootstrap` is a `sklearn` and `sktime` compatible library of bootstrapping algorithm for time series.\n",
"This notebook explains how you can start with tsbootstrap. \n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Getting started\n",
"`tsbootsrap` is following the [`sklearn` design principle](https://scikit-learn.org/stable/developers/develop.html). This means that there are mainly three steps of interaction of a bootstrapper:\n",
"1. Initiate the bootrapper\n",
"2. Fitting the bootstrapper\n",
"3. Transforming the data using the fitted bootstrapper"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this example, we use the moving block bootstrapper. Therefore, we instantiate the class. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from tsbootstrap import MovingBlockBootstrap, MovingBlockBootstrapConfig\n",
"\n",
"bootstrapper = MovingBlockBootstrap(block_length=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After the instantiation, we can fit the bootsrapper. Therefore, we load the airline passenger dataset using the dataset loading functionalities of sktime"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sktime.datasets import load_airline\n",
"\n",
"y = load_airline()\n",
"\n",
"bootstrapper.fit(y)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After fitting the bootstrapper, we can use the bootstrapper to transform the data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bootstrapper.transform(y)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Instead of calling first `fit` and `transform` afterwards, we can also use the shortcut: `fit_transform`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bootstrapper.fit_transform(y)"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ dev = [
"pytest-cov",
]

binder = [
"jupyter",
"sktime",
]

[tool.poetry.dev-dependencies]
# Add your dev dependencies here, e.g.
black = "~23.10"
Expand Down