diff --git a/requirements.txt b/requirements.txt index 91804d4..0a85469 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,13 +6,20 @@ scipy fastapi requests -pyFTS @ git+https://git.athene.tech/sam/pyFTS.git -# pip install -U --force-reinstall --no-deps -e git+https://git.athene.tech/sam/pyFTS.git#egg=pyFTS +xgboost-cpu +# pip3 install -U --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu scikit-learn keras tensorflow +darts + +pyFTS @ git+https://git.athene.tech/sam/pyFTS.git +# pip install -U --force-reinstall --no-deps -e git+https://git.athene.tech/sam/pyFTS.git#egg=pyFTS + + + influxdb-client -darts \ No newline at end of file + diff --git a/tutorial/darts/anomaly.ipynb b/tutorial/darts/anomaly.ipynb new file mode 100644 index 0000000..b21a2bc --- /dev/null +++ b/tutorial/darts/anomaly.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Anomaly Detection" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Darts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Загрузите многомерный ряд, обрежьте его, сохраните 2 компонента, разделите поезд и наборы проверки:\n", + "\n", + "from darts.datasets import ETTh2Dataset\n", + "\n", + "series = ETTh2Dataset().load()[:10000][[\"MUFL\", \"LULL\"]]\n", + "train, val = series.split_before(0.6)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Создайте систему оценки аномалий k-средних, \n", + "# обучите ее на наборе поездов и используйте в проверочном наборе для получения оценок аномалий:\n", + "\n", + "from darts.ad import KMeansScorer\n", + "\n", + "scorer = KMeansScorer(k=2, window=5)\n", + "scorer.fit(train)\n", + "anom_score = scorer.score(val)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Создайте детектор бинарных аномалий и обучите его на основе оценок поезда, а затем используйте его на результатах проверки, чтобы получить классификацию бинарных аномалий:\n", + "\n", + "from darts.ad import QuantileDetector\n", + "\n", + "detector = QuantileDetector(high_quantile=0.99)\n", + "detector.fit(scorer.score(train))\n", + "binary_anom = detector.detect(anom_score)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}