# Прямая визуализация во время обучения

```python
if "google.colab" in str(get_ipython()):
    # Удаление предустановленных пакетов из Colab для избежания конфликтов
    !pip uninstall -y torch notebook notebook_shim tensorflow tensorflow-datasets prophet torchaudio torchdata torchtext torchvision
    !pip install git+https://github.com/ourownstory/neural_prophet.git['live'] # может занять некоторое время
    #!pip install neuralprophet # намного быстрее, но может не иметь последних обновлений/исправлений ошибок

import pandas as pd
from neuralprophet import NeuralProphet
```

```python
data_location = "https://raw.githubusercontent.com/ourownstory/neuralprophet-data/main/datasets/"
df = pd.read_csv(data_location + "retail_sales.csv")  # Чтение CSV-файла с данными о розничных продажах и загрузка в DataFrame
```

```python
# Используем метод split_df() из библиотеки NeuralProphet для разделения DataFrame на обучающий и валидационный наборы данных
# valid_p - процент данных, которые будут использоваться для валидации
df_train, df_val = NeuralProphet().split_df(df, valid_p=0.2)
```

{% code overflow="wrap" fullWidth="false" %}

```
INFO - (NP.df_utils._infer_frequency) - Major frequency MS corresponds to [99.659]% of the data.
INFO - (NP.df_utils._infer_frequency) - Dataframe freq automatically defined as MS
INFO - (NP.df_utils.return_df_in_original_format) - Returning df with no ID column
INFO - (NP.df_utils.return_df_in_original_format) - Returning df with no ID column
```

{% endcode %}

```python
# Создаем объект модели NeuralProphet
m = NeuralProphet()

# Обучаем модель на обучающем наборе данных с использованием валидационного набора данных
# Параметр progress устанавливает отображение прогресса обучения в виде графика
metrics = m.fit(df_train, validation_df=df_val, progress="plot")
```

```
WARNING - (NP.forecaster.fit) - When Global modeling with local normalization, metrics are displayed in normalized scale.
INFO - (NP.df_utils._infer_frequency) - Major frequency MS corresponds to [99.574]% of the data.
INFO - (NP.df_utils._infer_frequency) - Dataframe freq automatically defined as MS
INFO - (NP.config.init_data_params) - Setting normalization to global as only one dataframe provided for training.
INFO - (NP.utils.set_auto_seasonalities) - Disabling weekly seasonality. Run NeuralProphet with weekly_seasonality=True to override this.
INFO - (NP.utils.set_auto_seasonalities) - Disabling daily seasonality. Run NeuralProphet with daily_seasonality=True to override this.
INFO - (NP.config.set_auto_batch_epoch) - Auto-set batch_size to 16
INFO - (NP.config.set_auto_batch_epoch) - Auto-set epochs to 338
WARNING - (NP.config.set_lr_finder_args) - Learning rate finder: The number of batches (15) is too small than the required number for the learning rate finder (213). The results might not be optimal.
```

```python
m = NeuralProphet()
metrics = m.fit(df_train, validation_df=df_val, progress="plot-all")
```

```
WARNING - (NP.forecaster.fit) - When Global modeling with local normalization, metrics are displayed in normalized scale.
INFO - (NP.df_utils._infer_frequency) - Major frequency MS corresponds to [99.574]% of the data.
INFO - (NP.df_utils._infer_frequency) - Dataframe freq automatically defined as MS
INFO - (NP.config.init_data_params) - Setting normalization to global as only one dataframe provided for training.
INFO - (NP.utils.set_auto_seasonalities) - Disabling weekly seasonality. Run NeuralProphet with weekly_seasonality=True to override this.
INFO - (NP.utils.set_auto_seasonalities) - Disabling daily seasonality. Run NeuralProphet with daily_seasonality=True to override this.
INFO - (NP.config.set_auto_batch_epoch) - Auto-set batch_size to 16
INFO - (NP.config.set_auto_batch_epoch) - Auto-set epochs to 338
WARNING - (NP.config.set_lr_finder_args) - Learning rate finder: The number of batches (15) is too small than the required number for the learning rate finder (213). The results might not be optimal.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bemind.gitbook.io/neural/neuralprophet/rukovodstva-po-funkciyam/pryamaya-vizualizaciya-vo-vremya-obucheniya.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
