add some notebooks

This commit is contained in:
Антон Скалкин 2024-10-01 12:00:12 +04:00
parent c69b2be56a
commit bb4bc174cb
2 changed files with 94 additions and 3 deletions

View File

@ -6,13 +6,20 @@ scipy
fastapi fastapi
requests requests
pyFTS @ git+https://git.athene.tech/sam/pyFTS.git xgboost-cpu
# pip install -U --force-reinstall --no-deps -e git+https://git.athene.tech/sam/pyFTS.git#egg=pyFTS # pip3 install -U --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
scikit-learn scikit-learn
keras keras
tensorflow 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 influxdb-client
darts

View File

@ -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
}