Skip to content

Update get_started section in README #569

Merged
merged 15 commits into from
Mar 4, 2022
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
- Rename `_SARIMAXModel` and `_ProphetModel`, make `SARIMAXModel` and `ProphetModel` inherit from `PerSegmentPredictionIntervalModel` ([#549](https://github.com/tinkoff-ai/etna/pull/549))
-
-
- Update get_started section in README ([#569](https://github.com/tinkoff-ai/etna/pull/569))
-
- Make `LabelEncoderTransform` and `OneHotEncoderTransform` multi-segment ([#554](https://github.com/tinkoff-ai/etna/pull/554))
### Fixed
Expand Down
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,23 @@ ETNA supports configuration files. It means that library will check that all the

To set up a configuration for your project you should create a `.etna` file at the project's root. To see the available options look at [`Settings`](https://github.com/tinkoff-ai/etna/blob/master/etna/settings.py#L68). There is an [example](https://github.com/tinkoff-ai/etna/tree/master/examples/configs/.etna) of configuration file.

## Get started
## Get started

Here's some example code for a quick start.
```python
import pandas as pd

from etna.datasets.tsdataset import TSDataset
from etna.models import ProphetModel
from etna.metrics import SMAPE
from etna.models import CatBoostModelMultiSegment
from etna.pipeline import Pipeline
from etna.transforms import DateFlagsTransform
from etna.transforms import DensityOutliersTransform
from etna.transforms import FourierTransform
from etna.transforms import LagTransform
from etna.transforms import LinearTrendTransform
from etna.transforms import SegmentEncoderTransform
from etna.transforms import TimeSeriesImputerTransform
iKintosh marked this conversation as resolved.
Show resolved Hide resolved

# Read the data
df = pd.read_csv("examples/data/example_dataset.csv")
Expand All @@ -99,15 +109,40 @@ ts = TSDataset(df, freq="D")
# Choose a horizon
HORIZON = 8

# Make train_test_split
train_ts, test_ts = ts.train_test_split(test_size=HORIZON)

# prepare transforms
transforms = [
DensityOutliersTransform(in_column="target", distance_coef=1.0),
TimeSeriesImputerTransform(in_column="target", strategy="forward_fill"),
LinearTrendTransform(in_column="target"),
LagTransform(in_column="target", lags=list(range(HORIZON, 21)), out_column="target_lag"),
DateFlagsTransform(
day_number_in_week=True,
day_number_in_month=True,
is_weekend=True,
week_number_in_month=True,
out_column="date_flag",
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DateFlagsTransform(
day_number_in_week=True,
day_number_in_month=True,
is_weekend=True,
week_number_in_month=True,
out_column="date_flag",
),
DateFlagsTransform(is_weekend=True, week_number_in_month=True, out_column="date_flag"),

FourierTransform(period=360.25, order=20, out_column="fourier"),
SegmentEncoderTransform(),
]

# Fit the pipeline
pipeline = Pipeline(model=ProphetModel(), horizon=HORIZON)
pipeline.fit(ts)
pipeline = Pipeline(model=CatBoostModelMultiSegment(), transforms=transforms, horizon=HORIZON)
pipeline.fit(train_ts)

# Make the forecast
forecast_ts = pipeline.forecast()

metric = SMAPE(mode="macro")
metric_value = metric(y_true=test_ts, y_pred=forecast_ts)
print(f"SMAPE = {metric_value:.3f}")
```

## Tutorials

We have also prepared a set of tutorials for an easy introduction:

| Notebook | Interactive launch |
Expand All @@ -121,6 +156,7 @@ We have also prepared a set of tutorials for an easy introduction:
| [Ensembles](https://github.com/tinkoff-ai/etna/tree/master/examples/ensembles.ipynb) | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/tinkoff-ai/etna/master?filepath=examples/ensembles.ipynb) |

## Documentation

ETNA documentation is available [here](https://etna-docs.netlify.app/).

## Resources
Expand All @@ -134,6 +170,7 @@ ETNA documentation is available [here](https://etna-docs.netlify.app/).
## Acknowledgments

### ETNA.Team

[Andrey Alekseev](https://github.com/iKintosh),
[Nikita Barinov](https://github.com/diadorer),
[Dmitriy Bunin](https://github.com/Mr-Geekman),
Expand All @@ -148,6 +185,7 @@ ETNA documentation is available [here](https://etna-docs.netlify.app/).
[Julia Shenshina](https://github.com/julia-shenshina)

### ETNA.Contributors

[Artem Levashov](https://github.com/soft1q),
[Aleksey Podkidyshev](https://github.com/alekseyen),
[Carlosbogo](https://github.com/Carlosbogo)
Expand Down