{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "70a32352-80c9-40b7-8f68-1aeecfc52658", "metadata": { "ExecuteTime": { "end_time": "2024-04-27T10:05:25.636065Z", "start_time": "2024-04-27T10:05:25.632244Z" }, "execution": { "iopub.execute_input": "2025-01-06T14:54:51.218123Z", "iopub.status.busy": "2025-01-06T14:54:51.217792Z", "iopub.status.idle": "2025-01-06T14:54:51.226882Z", "shell.execute_reply": "2025-01-06T14:54:51.225419Z" }, "papermill": { "duration": 0.017633, "end_time": "2025-01-06T14:54:51.228549", "exception": false, "start_time": "2025-01-06T14:54:51.210916", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# Import to be able to import python package from src\n", "import sys\n", "sys.path.insert(0, '../src')" ] }, { "cell_type": "code", "execution_count": 2, "id": "f8a26d78-229f-47f7-9f66-d0c245dbc096", "metadata": { "ExecuteTime": { "end_time": "2024-04-27T10:05:29.654652Z", "start_time": "2024-04-27T10:05:25.635956Z" }, "execution": { "iopub.execute_input": "2025-01-06T14:54:51.239921Z", "iopub.status.busy": "2025-01-06T14:54:51.239602Z", "iopub.status.idle": "2025-01-06T14:55:01.447783Z", "shell.execute_reply": "2025-01-06T14:55:01.446539Z" }, "papermill": { "duration": 10.215408, "end_time": "2025-01-06T14:55:01.449362", "exception": false, "start_time": "2025-01-06T14:54:51.233954", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "import ontime as on\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "9f94ac2b-bc8a-4757-affb-6e570a024804", "metadata": { "papermill": { "duration": 0.003865, "end_time": "2025-01-06T14:55:01.457052", "exception": false, "start_time": "2025-01-06T14:55:01.453187", "status": "completed" }, "tags": [] }, "source": [ "# Getting Started\n", "\n", "The library is divided in three parts : \n", "\n", "1. `core` for all basic features\n", "2. `module` for all features using core features. E.g. benchmarking, ml preprocessing, etc.\n", "3. `context` for all features related to the usage of onTime in an applied scenario" ] }, { "cell_type": "markdown", "id": "c0271c7d-d9b4-414e-b7be-83adeafcc741", "metadata": { "papermill": { "duration": 0.00426, "end_time": "2025-01-06T14:55:01.465369", "exception": false, "start_time": "2025-01-06T14:55:01.461109", "status": "completed" }, "tags": [] }, "source": [ "## `core` Features\n", "\n", "This is a low level API. Most objects and functions are accessible in the base object : \n", " \n", " ontime\n", " ├── detectors\n", " ├── generators\n", " ├── Model\n", " ├── plots\n", " ├── processors\n", " └── TimeSeries\n", "\n", "For instance : " ] }, { "cell_type": "code", "execution_count": 3, "id": "bcbdae2b-2833-43d6-9bf7-16caef87cf75", "metadata": { "ExecuteTime": { "end_time": "2024-04-27T10:05:29.670567Z", "start_time": "2024-04-27T10:05:29.659699Z" }, "execution": { "iopub.execute_input": "2025-01-06T14:55:01.474817Z", "iopub.status.busy": "2025-01-06T14:55:01.474325Z", "iopub.status.idle": "2025-01-06T14:55:01.502154Z", "shell.execute_reply": "2025-01-06T14:55:01.501007Z" }, "papermill": { "duration": 0.034002, "end_time": "2025-01-06T14:55:01.503475", "exception": false, "start_time": "2025-01-06T14:55:01.469473", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<TimeSeries (DataArray) (time: 5, component: 1, sample: 1)> Size: 40B\n",
       "array([[[ 0.8042713 ]],\n",
       "\n",
       "       [[ 1.58685749]],\n",
       "\n",
       "       [[ 0.88496745]],\n",
       "\n",
       "       [[ 1.07890811]],\n",
       "\n",
       "       [[-0.41554812]]])\n",
       "Coordinates:\n",
       "  * time       (time) datetime64[ns] 40B 2023-01-01 2023-01-02 ... 2023-01-05\n",
       "  * component  (component) object 8B 'random_walk'\n",
       "Dimensions without coordinates: sample\n",
       "Attributes:\n",
       "    static_covariates:  None\n",
       "    hierarchy:          None
" ], "text/plain": [ " Size: 40B\n", "array([[[ 0.8042713 ]],\n", "\n", " [[ 1.58685749]],\n", "\n", " [[ 0.88496745]],\n", "\n", " [[ 1.07890811]],\n", "\n", " [[-0.41554812]]])\n", "Coordinates:\n", " * time (time) datetime64[ns] 40B 2023-01-01 2023-01-02 ... 2023-01-05\n", " * component (component) object 8B 'random_walk'\n", "Dimensions without coordinates: sample\n", "Attributes:\n", " static_covariates: None\n", " hierarchy: None" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ts = on.generators.random_walk().generate(start=pd.Timestamp('01-01-2023'), end=pd.Timestamp('12-31-2023'))\n", "ts[0:5]" ] }, { "cell_type": "code", "execution_count": 4, "id": "6b9959a6-489a-4c80-a53e-e65cad57fe62", "metadata": { "ExecuteTime": { "end_time": "2024-04-27T10:05:32.472025Z", "start_time": "2024-04-27T10:05:32.234524Z" }, "execution": { "iopub.execute_input": "2025-01-06T14:55:01.514035Z", "iopub.status.busy": "2025-01-06T14:55:01.513737Z", "iopub.status.idle": "2025-01-06T14:55:02.324878Z", "shell.execute_reply": "2025-01-06T14:55:02.323545Z" }, "papermill": { "duration": 0.818872, "end_time": "2025-01-06T14:55:02.326710", "exception": false, "start_time": "2025-01-06T14:55:01.507838", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ts.plot()" ] }, { "cell_type": "markdown", "id": "2487b267-ec4a-49bc-9bda-33e4bc39194c", "metadata": { "papermill": { "duration": 0.006113, "end_time": "2025-01-06T14:55:02.337993", "exception": false, "start_time": "2025-01-06T14:55:02.331880", "status": "completed" }, "tags": [] }, "source": [ "## `module` and `context` features" ] }, { "cell_type": "markdown", "id": "0904039a-4cb4-4795-9656-8c48a919dfee", "metadata": { "papermill": { "duration": 0.005795, "end_time": "2025-01-06T14:55:02.349321", "exception": false, "start_time": "2025-01-06T14:55:02.343526", "status": "completed" }, "tags": [] }, "source": [ "High level API with various features. Let's load some data for an example :" ] }, { "cell_type": "code", "execution_count": 5, "id": "4c906526-20c4-47b5-8023-8216c6af18d1", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.361266Z", "iopub.status.busy": "2025-01-06T14:55:02.360919Z", "iopub.status.idle": "2025-01-06T14:55:02.494547Z", "shell.execute_reply": "2025-01-06T14:55:02.493325Z" }, "papermill": { "duration": 0.142101, "end_time": "2025-01-06T14:55:02.496411", "exception": false, "start_time": "2025-01-06T14:55:02.354310", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "from darts.datasets import EnergyDataset\n", "ts = EnergyDataset().load()" ] }, { "cell_type": "code", "execution_count": 6, "id": "15724cb7-d0d6-40ab-a240-57df7e8f3c21", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.509380Z", "iopub.status.busy": "2025-01-06T14:55:02.509048Z", "iopub.status.idle": "2025-01-06T14:55:02.536066Z", "shell.execute_reply": "2025-01-06T14:55:02.534966Z" }, "papermill": { "duration": 0.035638, "end_time": "2025-01-06T14:55:02.538050", "exception": false, "start_time": "2025-01-06T14:55:02.502412", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "df = ts.pd_dataframe()\n", "df = df.interpolate()\n", "cols = ['generation biomass', 'generation solar', 'generation nuclear']\n", "df = df[cols]" ] }, { "cell_type": "code", "execution_count": 7, "id": "401cf66e-f0eb-48e0-ac7c-adf2bef92a3c", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.552242Z", "iopub.status.busy": "2025-01-06T14:55:02.551909Z", "iopub.status.idle": "2025-01-06T14:55:02.561579Z", "shell.execute_reply": "2025-01-06T14:55:02.560224Z" }, "papermill": { "duration": 0.018558, "end_time": "2025-01-06T14:55:02.563072", "exception": false, "start_time": "2025-01-06T14:55:02.544514", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "ts = on.TimeSeries.from_dataframe(df)" ] }, { "cell_type": "code", "execution_count": 8, "id": "3013d9e8-d7cd-4caf-be3f-607eab84647e", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.575058Z", "iopub.status.busy": "2025-01-06T14:55:02.574739Z", "iopub.status.idle": "2025-01-06T14:55:02.587100Z", "shell.execute_reply": "2025-01-06T14:55:02.586052Z" }, "papermill": { "duration": 0.020382, "end_time": "2025-01-06T14:55:02.588677", "exception": false, "start_time": "2025-01-06T14:55:02.568295", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "ts_uni = ts['generation solar'].slice(pd.Timestamp('2015'), pd.Timestamp('2016'))\n", "ts_multi = ts.slice(pd.Timestamp('2015'), pd.Timestamp('2016'))" ] }, { "cell_type": "markdown", "id": "a1a81ffb-dca7-4ee5-93e9-836223ae6956", "metadata": { "papermill": { "duration": 0.005689, "end_time": "2025-01-06T14:55:02.599846", "exception": false, "start_time": "2025-01-06T14:55:02.594157", "status": "completed" }, "tags": [] }, "source": [ "### `module` Features" ] }, { "cell_type": "markdown", "id": "adb031b1-74bc-4ed2-ae54-bc16681f0363", "metadata": { "papermill": { "duration": 0.005222, "end_time": "2025-01-06T14:55:02.610856", "exception": false, "start_time": "2025-01-06T14:55:02.605634", "status": "completed" }, "tags": [] }, "source": [ "High level API with features related to data processing, ML/AI, etc." ] }, { "cell_type": "code", "execution_count": 9, "id": "79fd0990-dac4-461e-98b0-29f1e579b11a", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.623734Z", "iopub.status.busy": "2025-01-06T14:55:02.623401Z", "iopub.status.idle": "2025-01-06T14:55:02.631002Z", "shell.execute_reply": "2025-01-06T14:55:02.629810Z" }, "papermill": { "duration": 0.016223, "end_time": "2025-01-06T14:55:02.632157", "exception": false, "start_time": "2025-01-06T14:55:02.615934", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "train, test = on.module.processing.common.train_test_split(ts_uni, test_split=0.3)" ] }, { "cell_type": "markdown", "id": "0641d9e6-c5b8-49a1-a3db-9df1927d62be", "metadata": { "papermill": { "duration": 0.005184, "end_time": "2025-01-06T14:55:02.642940", "exception": false, "start_time": "2025-01-06T14:55:02.637756", "status": "completed" }, "tags": [] }, "source": [ "### `context` Features" ] }, { "cell_type": "markdown", "id": "2982c551-1607-40c8-911d-154a3493e4b1", "metadata": { "papermill": { "duration": 0.005269, "end_time": "2025-01-06T14:55:02.655220", "exception": false, "start_time": "2025-01-06T14:55:02.649951", "status": "completed" }, "tags": [] }, "source": [ "High level API with features related to a physical machine or process." ] }, { "cell_type": "markdown", "id": "f7fe172e-588a-4f7e-aa0e-1cdc07dd8aca", "metadata": { "papermill": { "duration": 0.006665, "end_time": "2025-01-06T14:55:02.713726", "exception": false, "start_time": "2025-01-06T14:55:02.707061", "status": "completed" }, "tags": [] }, "source": [ "#### Profiler" ] }, { "cell_type": "code", "execution_count": 10, "id": "ad40696c-c5fa-4b5f-8f49-92c4fc0a9941", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.728647Z", "iopub.status.busy": "2025-01-06T14:55:02.728270Z", "iopub.status.idle": "2025-01-06T14:55:02.733718Z", "shell.execute_reply": "2025-01-06T14:55:02.732394Z" }, "papermill": { "duration": 0.014858, "end_time": "2025-01-06T14:55:02.735410", "exception": false, "start_time": "2025-01-06T14:55:02.720552", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "profiler = on.context.common.Profiler()" ] }, { "cell_type": "markdown", "id": "0a304607-7ccb-4d2b-9796-dd80bce76b6c", "metadata": { "papermill": { "duration": 0.007953, "end_time": "2025-01-06T14:55:02.750564", "exception": false, "start_time": "2025-01-06T14:55:02.742611", "status": "completed" }, "tags": [] }, "source": [ "What does the common week looks like ?" ] }, { "cell_type": "code", "execution_count": 11, "id": "bac9e224-c12a-4d7a-b7ca-db2a9acff278", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:02.766674Z", "iopub.status.busy": "2025-01-06T14:55:02.765558Z", "iopub.status.idle": "2025-01-06T14:55:03.265891Z", "shell.execute_reply": "2025-01-06T14:55:03.264434Z" }, "papermill": { "duration": 0.510698, "end_time": "2025-01-06T14:55:03.267737", "exception": false, "start_time": "2025-01-06T14:55:02.757039", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "week_mean = profiler.profile(ts_uni, profiler.Period.WEEKLY, profiler.Aggregation.MEAN).rename({\"value\": \"week_mean\"})\n", "week_median = profiler.profile(ts_uni, profiler.Period.WEEKLY, profiler.Aggregation.MEDIAN).rename({\"value\": \"week_median\"}) # variable is renamed cause error raises when set to \"value\" " ] }, { "cell_type": "code", "execution_count": 12, "id": "e8474db3-5e1e-4d08-bdc1-30f88bfd5f28", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:03.284113Z", "iopub.status.busy": "2025-01-06T14:55:03.283294Z", "iopub.status.idle": "2025-01-06T14:55:03.378595Z", "shell.execute_reply": "2025-01-06T14:55:03.377389Z" }, "papermill": { "duration": 0.106033, "end_time": "2025-01-06T14:55:03.380586", "exception": false, "start_time": "2025-01-06T14:55:03.274553", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(\n", " on.Plot()\n", " .add(on.marks.line, week_mean)\n", " .add(on.marks.line, week_median)\n", " .show()\n", ")" ] }, { "cell_type": "markdown", "id": "3abbc2e7-a631-40b0-878c-36a552f95dc8", "metadata": { "papermill": { "duration": 0.007541, "end_time": "2025-01-06T14:55:03.395631", "exception": false, "start_time": "2025-01-06T14:55:03.388090", "status": "completed" }, "tags": [] }, "source": [ "#### Generic Predictor" ] }, { "cell_type": "code", "execution_count": 13, "id": "c775b740-fe78-4c0c-87fe-a51af3d42993", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:03.414483Z", "iopub.status.busy": "2025-01-06T14:55:03.413617Z", "iopub.status.idle": "2025-01-06T14:55:03.419310Z", "shell.execute_reply": "2025-01-06T14:55:03.417690Z" }, "papermill": { "duration": 0.018607, "end_time": "2025-01-06T14:55:03.421196", "exception": false, "start_time": "2025-01-06T14:55:03.402589", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "model = on.context.common.GenericPredictor()" ] }, { "cell_type": "code", "execution_count": 14, "id": "a633dce3-27d8-4deb-bb0f-d40e3af96f8a", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:03.438597Z", "iopub.status.busy": "2025-01-06T14:55:03.438209Z", "iopub.status.idle": "2025-01-06T14:55:06.521349Z", "shell.execute_reply": "2025-01-06T14:55:06.520059Z" }, "papermill": { "duration": 3.095267, "end_time": "2025-01-06T14:55:06.523602", "exception": false, "start_time": "2025-01-06T14:55:03.428335", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model.fit(train)" ] }, { "cell_type": "markdown", "id": "6943aa60-c757-4f54-bf63-854beecfab80", "metadata": { "papermill": { "duration": 0.009776, "end_time": "2025-01-06T14:55:06.543932", "exception": false, "start_time": "2025-01-06T14:55:06.534156", "status": "completed" }, "tags": [] }, "source": [ "What does the future looks like ?" ] }, { "cell_type": "code", "execution_count": 15, "id": "04dfe189-f736-4fe3-b27c-467c154b2c42", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:06.565871Z", "iopub.status.busy": "2025-01-06T14:55:06.565370Z", "iopub.status.idle": "2025-01-06T14:55:06.621667Z", "shell.execute_reply": "2025-01-06T14:55:06.620024Z" }, "papermill": { "duration": 0.070216, "end_time": "2025-01-06T14:55:06.624072", "exception": false, "start_time": "2025-01-06T14:55:06.553856", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "pred = model.predict(48)" ] }, { "cell_type": "code", "execution_count": 16, "id": "67da9001-1e2a-4578-9436-8db8151190dc", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:06.646726Z", "iopub.status.busy": "2025-01-06T14:55:06.646189Z", "iopub.status.idle": "2025-01-06T14:55:06.893283Z", "shell.execute_reply": "2025-01-06T14:55:06.891342Z" }, "papermill": { "duration": 0.262114, "end_time": "2025-01-06T14:55:06.896031", "exception": false, "start_time": "2025-01-06T14:55:06.633917", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(\n", " on.Plot()\n", " .add(on.marks.line, train[-96:].rename({\"generation solar\": \"Training set\"}))\n", " .add(on.marks.line, pred.rename({\"generation solar\": \"Prediction\"}))\n", " .add(on.marks.line, test[:48].rename({\"generation solar\": \"Truth\"}), type=\"dashed\")\n", " .properties(width=600, height=300)\n", " .show()\n", ")" ] }, { "cell_type": "markdown", "id": "dc965c95-1b5c-43e4-9c4b-57ff73c275c1", "metadata": { "papermill": { "duration": 0.011266, "end_time": "2025-01-06T14:55:06.920028", "exception": false, "start_time": "2025-01-06T14:55:06.908762", "status": "completed" }, "tags": [] }, "source": [ "## Generic Detector" ] }, { "cell_type": "code", "execution_count": 17, "id": "9751b373-97d3-45e9-9969-2b4ba224f815", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:06.944400Z", "iopub.status.busy": "2025-01-06T14:55:06.943014Z", "iopub.status.idle": "2025-01-06T14:55:06.950757Z", "shell.execute_reply": "2025-01-06T14:55:06.948864Z" }, "papermill": { "duration": 0.022549, "end_time": "2025-01-06T14:55:06.953310", "exception": false, "start_time": "2025-01-06T14:55:06.930761", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "model = on.context.common.GenericDetector()" ] }, { "cell_type": "code", "execution_count": 18, "id": "89be0c48-0ab6-42b4-ab64-611b95d2a76f", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:06.976981Z", "iopub.status.busy": "2025-01-06T14:55:06.976465Z", "iopub.status.idle": "2025-01-06T14:55:10.229866Z", "shell.execute_reply": "2025-01-06T14:55:10.227977Z" }, "papermill": { "duration": 3.267734, "end_time": "2025-01-06T14:55:10.232234", "exception": false, "start_time": "2025-01-06T14:55:06.964500", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "model.fit(train)" ] }, { "cell_type": "markdown", "id": "06be738b-8bfd-4c95-8dec-ed52803e5ff9", "metadata": { "papermill": { "duration": 0.010556, "end_time": "2025-01-06T14:55:10.253171", "exception": false, "start_time": "2025-01-06T14:55:10.242615", "status": "completed" }, "tags": [] }, "source": [ "Does the current signal has problem ? " ] }, { "cell_type": "code", "execution_count": 19, "id": "4650f34a-9cdb-4ea6-9dfe-2c66109b2627", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:10.276112Z", "iopub.status.busy": "2025-01-06T14:55:10.275619Z", "iopub.status.idle": "2025-01-06T14:55:10.303002Z", "shell.execute_reply": "2025-01-06T14:55:10.301094Z" }, "papermill": { "duration": 0.042027, "end_time": "2025-01-06T14:55:10.305378", "exception": false, "start_time": "2025-01-06T14:55:10.263351", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "detected_test = model.detect(test)" ] }, { "cell_type": "code", "execution_count": 20, "id": "49e09caa-37f1-4201-b79a-4d1d65d86a8c", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:10.329853Z", "iopub.status.busy": "2025-01-06T14:55:10.329086Z", "iopub.status.idle": "2025-01-06T14:55:10.484409Z", "shell.execute_reply": "2025-01-06T14:55:10.480765Z" }, "papermill": { "duration": 0.171051, "end_time": "2025-01-06T14:55:10.486803", "exception": false, "start_time": "2025-01-06T14:55:10.315752", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(\n", " on.Plot(test[:72])\n", " .add(on.marks.line)\n", " .add(on.marks.mark, data=detected_test[:72].rename({\"generation solar\": \"Anomalies\"}), type=\"dot\")\n", " .properties(width=600, height=300)\n", " .show()\n", ")" ] }, { "cell_type": "markdown", "id": "2af5c7ba-1617-46f0-9551-67cc51ac1884", "metadata": { "papermill": { "duration": 0.012013, "end_time": "2025-01-06T14:55:10.510372", "exception": false, "start_time": "2025-01-06T14:55:10.498359", "status": "completed" }, "tags": [] }, "source": [ "What if we want to have an idea about the future problems ?" ] }, { "cell_type": "code", "execution_count": 21, "id": "866533ed-bdab-4b29-bc91-50ed0043e84a", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:10.535003Z", "iopub.status.busy": "2025-01-06T14:55:10.534354Z", "iopub.status.idle": "2025-01-06T14:55:10.620752Z", "shell.execute_reply": "2025-01-06T14:55:10.619203Z" }, "papermill": { "duration": 0.101827, "end_time": "2025-01-06T14:55:10.623227", "exception": false, "start_time": "2025-01-06T14:55:10.521400", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "predetected = model.predetect(72)" ] }, { "cell_type": "code", "execution_count": 22, "id": "44bff6ea-f249-48b6-816f-c49e0d264520", "metadata": { "execution": { "iopub.execute_input": "2025-01-06T14:55:10.650248Z", "iopub.status.busy": "2025-01-06T14:55:10.649240Z", "iopub.status.idle": "2025-01-06T14:55:10.802101Z", "shell.execute_reply": "2025-01-06T14:55:10.800190Z" }, "papermill": { "duration": 0.167982, "end_time": "2025-01-06T14:55:10.804710", "exception": false, "start_time": "2025-01-06T14:55:10.636728", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(\n", " on.Plot(test[:72])\n", " .add(on.marks.line)\n", " .add(on.marks.mark, data=predetected[:72].rename({\"generation solar\": \"Anomalies\"}), type=\"dot\")\n", " .properties(width=600, height=300)\n", " .show()\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "ontime-2OQVvbNf-py3.10", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" }, "papermill": { "default_parameters": {}, "duration": 23.469424, "end_time": "2025-01-06T14:55:13.473916", "environment_variables": {}, "exception": null, "input_path": "docs/getting_started.ipynb", "output_path": "docs/getting_started.ipynb", "parameters": {}, "start_time": "2025-01-06T14:54:50.004492", "version": "2.5.0" } }, "nbformat": 4, "nbformat_minor": 5 }