{ "cells": [ { "cell_type": "markdown", "id": "5aacb872", "metadata": {}, "source": [ "# Outliers\n", "\n", "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/etna-team/etna/master?filepath=examples/204-outliers.ipynb)" ] }, { "cell_type": "markdown", "id": "1417fe98", "metadata": {}, "source": [ "This notebook contains the simple examples of outliers handling using ETNA library.\n", "\n", "**Table of contents**\n", "\n", "* [Loading dataset](#chapter1) \n", "* [Point outliers](#chapter2)\n", " * [Median method](#section_2_1)\n", " * [Density method](#section_2_2)\n", " * [Prediction interval method](#section_2_3)\n", " * [Histogram method](#section_2_4)\n", "* [Interactive visualization](#chapter3)\n", "* [Outliers imputation](#chapter4)" ] }, { "cell_type": "code", "execution_count": 1, "id": "1f0cb110", "metadata": {}, "outputs": [], "source": [ "!pip install \"etna[prophet]\" -q" ] }, { "cell_type": "code", "execution_count": 2, "id": "92c89670", "metadata": {}, "outputs": [], "source": [ "import warnings\n", "\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "id": "e7d6ade6", "metadata": {}, "source": [ "## 1. Loading dataset " ] }, { "cell_type": "code", "execution_count": 3, "id": "e4f62424", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from etna.datasets import TSDataset\n", "from etna.metrics import MAE\n", "from etna.metrics import MSE\n", "from etna.metrics import SMAPE\n", "from etna.models import MovingAverageModel\n", "from etna.models import ProphetModel\n", "from etna.pipeline import Pipeline" ] }, { "cell_type": "markdown", "id": "6125c3c0", "metadata": {}, "source": [ "Let's load and look at the dataset" ] }, { "cell_type": "code", "execution_count": 4, "id": "83a744a2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
segment | \n", "segment_a | \n", "segment_b | \n", "segment_c | \n", "segment_d | \n", "
---|---|---|---|---|
feature | \n", "target | \n", "target | \n", "target | \n", "target | \n", "
timestamp | \n", "\n", " | \n", " | \n", " | \n", " |
2019-01-01 | \n", "170 | \n", "102 | \n", "92 | \n", "238 | \n", "
2019-01-02 | \n", "243 | \n", "123 | \n", "107 | \n", "358 | \n", "
2019-01-03 | \n", "267 | \n", "130 | \n", "103 | \n", "366 | \n", "
2019-01-04 | \n", "287 | \n", "138 | \n", "103 | \n", "385 | \n", "
2019-01-05 | \n", "279 | \n", "137 | \n", "104 | \n", "384 | \n", "