Пример #1
0
    def test_lag_reg(self):
        log.info("testing: Lagged Regressors")
        df = pd.read_csv(PEYTON_FILE)
        m = NeuralProphet(
            n_forecasts=3,
            n_lags=7,
            ar_sparsity=0.1,
            # num_hidden_layers=2,
            # d_hidden=64,
            # yearly_seasonality=False,
            # weekly_seasonality=False,
            # daily_seasonality=False,
            epochs=EPOCHS,
        )
        if m.n_lags > 0:
            df["A"] = df["y"].rolling(7, min_periods=1).mean()
            df["B"] = df["y"].rolling(30, min_periods=1).mean()
            m = m.add_lagged_regressor(name="A")
            m = m.add_lagged_regressor(name="B", only_last_value=True)

            # m.highlight_nth_step_ahead_of_each_forecast(m.n_forecasts)
        metrics_df = m.fit(df, freq="D", validate_each_epoch=True)
        future = m.make_future_dataframe(df, n_historic_predictions=365)
        forecast = m.predict(future)

        if self.plot:
            # print(forecast.to_string())
            m.plot_last_forecast(forecast, include_previous_forecasts=10)
            m.plot(forecast)
            m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #2
0
 def test_ar_net(self):
     log.info("testing: AR-Net")
     df = pd.read_csv(PEYTON_FILE)
     m = NeuralProphet(
         n_forecasts=7,
         n_lags=14,
         # ar_sparsity=0.01,
         # num_hidden_layers=0,
         num_hidden_layers=2,
         d_hidden=64,
         # yearly_seasonality=False,
         # weekly_seasonality=False,
         # daily_seasonality=False,
         epochs=EPOCHS,
     )
     m.highlight_nth_step_ahead_of_each_forecast(m.n_forecasts)
     metrics_df = m.fit(df, freq="D", validate_each_epoch=True)
     future = m.make_future_dataframe(df,
                                      n_historic_predictions=len(df) -
                                      m.n_lags)
     forecast = m.predict(df=future)
     if self.plot:
         m.plot_last_forecast(forecast, include_previous_forecasts=3)
         m.plot(forecast)
         m.plot_components(forecast)
         m.plot_parameters()
         plt.show()
Пример #3
0
    def test_custom_seasons(self):
        log.info("testing: Custom Seasonality")
        df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
        # m = NeuralProphet(n_lags=60, n_changepoints=10, n_forecasts=30, verbose=True)
        other_seasons = False
        m = NeuralProphet(
            yearly_seasonality=other_seasons,
            weekly_seasonality=other_seasons,
            daily_seasonality=other_seasons,
            seasonality_mode="additive",
            # seasonality_mode="multiplicative",
            seasonality_reg=1,
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )
        m = m.add_seasonality(name="quarterly", period=90, fourier_order=5)
        log.debug("seasonalities: {}".format(m.season_config.periods))
        metrics_df = m.fit(df, freq="D", validate_each_epoch=True)
        future = m.make_future_dataframe(df,
                                         n_historic_predictions=365,
                                         periods=365)
        forecast = m.predict(df=future)
        log.debug("season params: {}".format(m.model.season_params.items()))

        if self.plot:
            m.plot(forecast)
            # m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #4
0
    def test_future_reg(self):
        log.info("testing: Future Regressors")
        df = pd.read_csv(PEYTON_FILE)
        m = NeuralProphet(
            n_forecasts=1,
            n_lags=0,
            epochs=EPOCHS,
        )

        df["A"] = df["y"].rolling(7, min_periods=1).mean()
        df["B"] = df["y"].rolling(30, min_periods=1).mean()

        m = m.add_future_regressor(name="A", regularization=0.5)
        m = m.add_future_regressor(name="B",
                                   mode="multiplicative",
                                   regularization=0.3)

        metrics_df = m.fit(df, freq="D")
        regressors_df = pd.DataFrame(data={
            "A": df["A"][:50],
            "B": df["B"][:50]
        })
        future = m.make_future_dataframe(df=df,
                                         regressors_df=regressors_df,
                                         n_historic_predictions=10,
                                         periods=50)
        forecast = m.predict(df=future)

        if self.plot:
            # print(forecast.to_string())
            # m.plot_last_forecast(forecast, include_previous_forecasts=3)
            m.plot(forecast)
            m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #5
0
    def test_lag_reg(self):
        log.info("testing: Lagged Regressors")
        df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
        m = NeuralProphet(
            n_forecasts=2,
            n_lags=3,
            weekly_seasonality=False,
            daily_seasonality=False,
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )
        df["A"] = df["y"].rolling(7, min_periods=1).mean()
        df["B"] = df["y"].rolling(30, min_periods=1).mean()
        m = m.add_lagged_regressor(names="A")
        m = m.add_lagged_regressor(names="B", only_last_value=True)
        metrics_df = m.fit(df, freq="D", validate_each_epoch=True)
        future = m.make_future_dataframe(df, n_historic_predictions=10)
        forecast = m.predict(future)

        if self.plot:
            print(forecast.to_string())
            m.plot_last_forecast(forecast, include_previous_forecasts=5)
            m.plot(forecast)
            m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #6
0
    def test_future_reg(self):
        log.info("testing: Future Regressors")
        df = pd.read_csv(PEYTON_FILE, nrows=NROWS + 50)
        m = NeuralProphet(
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )

        df["A"] = df["y"].rolling(7, min_periods=1).mean()
        df["B"] = df["y"].rolling(30, min_periods=1).mean()
        regressors_df_future = pd.DataFrame(data={
            "A": df["A"][-50:],
            "B": df["B"][-50:]
        })
        df = df[:-50]
        m = m.add_future_regressor(name="A")
        m = m.add_future_regressor(name="B", mode="multiplicative")
        metrics_df = m.fit(df, freq="D")
        future = m.make_future_dataframe(df=df,
                                         regressors_df=regressors_df_future,
                                         n_historic_predictions=10,
                                         periods=50)
        forecast = m.predict(df=future)

        if self.plot:
            m.plot(forecast)
            m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #7
0
    def test_plot(self):
        log.info("testing: Plotting")
        df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
        m = NeuralProphet(
            n_forecasts=7,
            n_lags=14,
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )
        metrics_df = m.fit(df, freq="D")

        m.highlight_nth_step_ahead_of_each_forecast(7)
        future = m.make_future_dataframe(df, n_historic_predictions=10)
        forecast = m.predict(future)
        m.plot(forecast)
        m.plot_last_forecast(forecast, include_previous_forecasts=10)
        m.plot_components(forecast)
        m.plot_parameters()

        m.highlight_nth_step_ahead_of_each_forecast(None)
        future = m.make_future_dataframe(df, n_historic_predictions=10)
        forecast = m.predict(future)
        m.plot(forecast)
        m.plot_last_forecast(forecast)
        m.plot_components(forecast)
        m.plot_parameters()
        if self.plot:
            plt.show()
Пример #8
0
    def test_seasons(self):
        log.info("testing: Seasonality")
        df = pd.read_csv(PEYTON_FILE, nrows=512)
        # m = NeuralProphet(n_lags=60, n_changepoints=10, n_forecasts=30, verbose=True)
        m = NeuralProphet(
            yearly_seasonality=8,
            weekly_seasonality=4,
            # daily_seasonality=False,
            seasonality_mode="additive",
            # seasonality_mode="multiplicative",
            seasonality_reg=1,
            epochs=EPOCHS,
        )
        metrics_df = m.fit(df, freq="D", validate_each_epoch=True)
        future = m.make_future_dataframe(df,
                                         n_historic_predictions=len(df),
                                         periods=365)
        forecast = m.predict(df=future)
        log.debug("SUM of yearly season params: {}".format(
            sum(abs(m.model.season_params["yearly"].data.numpy()))))
        log.debug("SUM of weekly season params: {}".format(
            sum(abs(m.model.season_params["weekly"].data.numpy()))))
        log.debug("season params: {}".format(m.model.season_params.items()))

        if self.plot:
            m.plot(forecast)
            # m.plot_components(forecast)
            m.plot_parameters()
            plt.show()
Пример #9
0
 def test_trend(self):
     log.info("testing: Trend")
     df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
     m = NeuralProphet(
         growth="linear",
         n_changepoints=10,
         changepoints_range=0.9,
         trend_reg=1,
         trend_reg_threshold=False,
         yearly_seasonality=False,
         weekly_seasonality=False,
         daily_seasonality=False,
         epochs=EPOCHS,
         batch_size=BATCH_SIZE,
     )
     # print(m.config_trend)
     metrics_df = m.fit(df, freq="D")
     future = m.make_future_dataframe(df,
                                      periods=60,
                                      n_historic_predictions=60)
     forecast = m.predict(df=future)
     if self.plot:
         m.plot(forecast)
         # m.plot_components(forecast)
         m.plot_parameters()
         plt.show()
Пример #10
0
    def test_events(self):
        log.info("testing: Events")
        df = pd.read_csv(PEYTON_FILE)[-NROWS:]
        playoffs = pd.DataFrame(
            {
                "event": "playoff",
                "ds": pd.to_datetime(
                    [
                        "2008-01-13",
                        "2009-01-03",
                        "2010-01-16",
                        "2010-01-24",
                        "2010-02-07",
                        "2011-01-08",
                        "2013-01-12",
                        "2014-01-12",
                        "2014-01-19",
                        "2014-02-02",
                        "2015-01-11",
                        "2016-01-17",
                        "2016-01-24",
                        "2016-02-07",
                    ]
                ),
            }
        )
        superbowls = pd.DataFrame(
            {
                "event": "superbowl",
                "ds": pd.to_datetime(["2010-02-07", "2014-02-02", "2016-02-07"]),
            }
        )
        events_df = pd.concat((playoffs, superbowls))

        m = NeuralProphet(
            n_lags=2,
            n_forecasts=30,
            daily_seasonality=False,
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )
        # set event windows
        m = m.add_events(
            ["superbowl", "playoff"], lower_window=-1, upper_window=1, mode="multiplicative", regularization=0.5
        )
        # add the country specific holidays
        m = m.add_country_holidays("US", mode="additive", regularization=0.5)

        history_df = m.create_df_with_events(df, events_df)
        metrics_df = m.fit(history_df, freq="D")
        future = m.make_future_dataframe(df=history_df, events_df=events_df, periods=30, n_historic_predictions=90)
        forecast = m.predict(df=future)
        log.debug("Event Parameters:: {}".format(m.model.event_params))
        if self.plot:
            m.plot_components(forecast)
            m.plot(forecast)
            m.plot_parameters()
            plt.show()
Пример #11
0
 def test_predict(self):
     log.info("testing: Predict")
     df = pd.read_csv(PEYTON_FILE, nrows=512)
     m = NeuralProphet(
         n_forecasts=3,
         n_lags=5,
         epochs=1,
     )
     metrics_df = m.fit(df, freq="D")
     future = m.make_future_dataframe(df, periods=None, n_historic_predictions=len(df) - m.n_lags)
     forecast = m.predict(future)
     if self.plot:
         m.plot_last_forecast(forecast, include_previous_forecasts=10)
         m.plot(forecast)
         m.plot_components(forecast)
         m.plot_parameters()
         plt.show()
Пример #12
0
    def test_yosemite(self):
        log.info("TEST Yosemite Temps")
        df = pd.read_csv(YOS_FILE, nrows=NROWS)
        m = NeuralProphet(
            changepoints_range=0.95,
            n_changepoints=15,
            weekly_seasonality=False,
            epochs=EPOCHS,
            batch_size=BATCH_SIZE,
        )
        metrics = m.fit(df, freq="5min")
        future = m.make_future_dataframe(df, periods=12 * 24, n_historic_predictions=12 * 24)
        forecast = m.predict(future)

        if self.plot:
            m.plot(forecast)
            m.plot_parameters()
            plt.show()
Пример #13
0
 def test_air_data(self):
     log.info("TEST air_passengers.csv")
     df = pd.read_csv(AIR_FILE)
     m = NeuralProphet(
         n_changepoints=0,
         # trend_reg=1,
         yearly_seasonality=2,
         # seasonality_reg=1,
         # seasonality_mode="additive",
         seasonality_mode="multiplicative",
     )
     metrics = m.fit(df, freq="MS")
     future = m.make_future_dataframe(df, periods=48, n_historic_predictions=len(df) - m.n_lags)
     forecast = m.predict(future)
     m.plot(forecast)
     # m.plot_components(forecast)
     m.plot_parameters()
     if self.plot:
         plt.show()
def test_seasons():
    log.info("testing: Seasonality: additive")
    df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
    # m = NeuralProphet(n_lags=60, n_changepoints=10, n_forecasts=30, verbose=True)
    m = NeuralProphet(
        yearly_seasonality=8,
        weekly_seasonality=4,
        seasonality_mode="additive",
        seasonality_reg=1,
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
    )
    metrics_df = m.fit(df, freq="D")
    future = m.make_future_dataframe(df,
                                     n_historic_predictions=365,
                                     periods=365)
    forecast = m.predict(df=future)
    log.debug("SUM of yearly season params: {}".format(
        sum(abs(m.model.season_params["yearly"].data.numpy()))))
    log.debug("SUM of weekly season params: {}".format(
        sum(abs(m.model.season_params["weekly"].data.numpy()))))
    log.debug("season params: {}".format(m.model.season_params.items()))
    if PLOT:
        m.plot(forecast)
        # m.plot_components(forecast)
        m.plot_parameters()
        plt.show()
    log.info("testing: Seasonality: multiplicative")
    df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
    # m = NeuralProphet(n_lags=60, n_changepoints=10, n_forecasts=30, verbose=True)
    m = NeuralProphet(
        yearly_seasonality=8,
        weekly_seasonality=4,
        seasonality_mode="multiplicative",
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
    )
    metrics_df = m.fit(df, freq="D")
    future = m.make_future_dataframe(df,
                                     n_historic_predictions=365,
                                     periods=365)
    forecast = m.predict(df=future)
Пример #15
0
 def test_ar(self):
     log.info("testing: AR")
     df = pd.read_csv(PEYTON_FILE, nrows=NROWS)
     m = NeuralProphet(
         n_forecasts=7,
         n_lags=7,
         yearly_seasonality=False,
         epochs=EPOCHS,
         # batch_size=BATCH_SIZE,
     )
     m.highlight_nth_step_ahead_of_each_forecast(m.n_forecasts)
     metrics_df = m.fit(df, freq="D")
     future = m.make_future_dataframe(df, n_historic_predictions=90)
     forecast = m.predict(df=future)
     if self.plot:
         m.plot_last_forecast(forecast, include_previous_forecasts=3)
         m.plot(forecast)
         m.plot_components(forecast)
         m.plot_parameters()
         plt.show()
def test_no_trend():
    log.info("testing: No-Trend")
    df = pd.read_csv(PEYTON_FILE, nrows=512)
    m = NeuralProphet(
        growth="off",
        yearly_seasonality=False,
        weekly_seasonality=False,
        daily_seasonality=False,
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
    )
    # m.highlight_nth_step_ahead_of_each_forecast(m.n_forecasts)
    metrics_df = m.fit(df, freq="D")
    future = m.make_future_dataframe(df, periods=60, n_historic_predictions=60)
    forecast = m.predict(df=future)
    if PLOT:
        m.plot(forecast)
        m.plot_components(forecast)
        m.plot_parameters()
        plt.show()
def test_air_data():
    log.info("TEST air_passengers.csv")
    df = pd.read_csv(AIR_FILE)
    m = NeuralProphet(
        n_changepoints=0,
        yearly_seasonality=2,
        seasonality_mode="multiplicative",
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
    )
    metrics = m.fit(df, freq="MS")
    future = m.make_future_dataframe(df,
                                     periods=48,
                                     n_historic_predictions=len(df) - m.n_lags)
    forecast = m.predict(future)
    if PLOT:
        m.plot(forecast)
        m.plot_components(forecast)
        m.plot_parameters()
        plt.show()
def test_global_modeling_no_exogenous_variable():
    ### GLOBAL MODELLING - NO EXOGENOUS VARIABLE
    log.info("Global Modeling - No exogenous variables")
    df = pd.read_csv(PEYTON_FILE, nrows=512)
    df1_0 = df.iloc[:128, :].copy(deep=True)
    df2_0 = df.iloc[128:256, :].copy(deep=True)
    df3_0 = df.iloc[256:384, :].copy(deep=True)
    df4_0 = df.iloc[384:, :].copy(deep=True)
    train_input = {
        0: df1_0,
        1: {
            "df1": df1_0,
            "df2": df2_0
        },
        2: {
            "df1": df1_0,
            "df2": df2_0
        }
    }
    test_input = {0: df3_0, 1: {"df1": df3_0}, 2: {"df1": df3_0, "df2": df4_0}}
    info_input = {
        0: "Testing df train / df test - no events, no regressors",
        1: "Testing dict df train / df test - no events, no regressors",
        2: "Testing dict df train / dict df test - no events, no regressors",
    }
    for i in range(0, 3):
        log.info(info_input[i])
        m = NeuralProphet(n_forecasts=2,
                          n_lags=10,
                          epochs=EPOCHS,
                          batch_size=BATCH_SIZE)
        metrics = m.fit(train_input[i], freq="D")
        forecast = m.predict(df=test_input[i])
        forecast_trend = m.predict_trend(df=test_input[i])
        forecast_seasonal_componets = m.predict_seasonal_components(
            df=test_input[i])
        if PLOT:
            forecast = forecast if isinstance(forecast, list) else [forecast]
            for key in forecast:
                fig1 = m.plot(forecast[key])
                fig2 = m.plot(forecast[key])
    with pytest.raises(ValueError):
        forecast = m.predict({"df4": df4_0})
    log.info(
        "Error - dict with names not provided in the train dict (not in the data params dict)"
    )
    with pytest.raises(ValueError):
        metrics = m.test({"df4": df4_0})
    log.info(
        "Error - dict with names not provided in the train dict (not in the data params dict)"
    )
    m = NeuralProphet(
        n_forecasts=2,
        n_lags=10,
        epochs=EPOCHS,
        batch_size=BATCH_SIZE,
    )
    m.fit({"df1": df1_0, "df2": df2_0}, freq="D")
    with pytest.raises(ValueError):
        forecast = m.predict({"df4": df4_0})
    # log.info("unknown_data_normalization was not set to True")
    with pytest.raises(ValueError):
        metrics = m.test({"df4": df4_0})
    # log.info("unknown_data_normalization was not set to True")
    with pytest.raises(ValueError):
        forecast_trend = m.predict_trend({"df4": df4_0})
    # log.info("unknown_data_normalization was not set to True")
    with pytest.raises(ValueError):
        forecast_seasonal_componets = m.predict_seasonal_components(
            {"df4": df4_0})
    # log.info("unknown_data_normalization was not set to True")
    # Set unknown_data_normalization to True - now there should be no errors
    m.config_normalization.unknown_data_normalization = True
    forecast = m.predict({"df4": df4_0})
    metrics = m.test({"df4": df4_0})
    forecast_trend = m.predict_trend({"df4": df4_0})
    forecast_seasonal_componets = m.predict_seasonal_components({"df4": df4_0})
    m.plot_parameters(df_name="df1")
    m.plot_parameters()
    epochs=40,
    loss_func="Huber",
    normalize=
    "auto",  # Type of normalization ('minmax', 'standardize', 'soft', 'off')
    impute_missing=True,
    log_level=None,  # Determines the logging level of the logger object
)

metrics = model.fit(df, validate_each_epoch=True, freq="D")
future = model.make_future_dataframe(df,
                                     periods=365,
                                     n_historic_predictions=len(df))
forecast = model.predict(future)

fig, ax = plt.subplots(figsize=(14, 10))
model.plot(forecast, xlabel="Date", ylabel="Gold Price", ax=ax)
ax.set_title("Gold Price Predictions", fontsize=28, fontweight="bold")
plt.show()

forecast[(forecast.ds > '2021-01-07') & (forecast.ds < '2021-01-12')]

# ### SPLITTING THE TRAIN AND THE TEST ####
# filter_date = str(int(datetime.today().strftime('%Y'))) + '-'  + datetime.today().strftime('%m') + '-' + '01'
# train = gold_prices[gold_prices['date'] < filter_date]
# test = gold_prices[gold_prices['date'] >= filter_date]

# train = train.reset_index().rename(columns={"date":"ds", "adj_close":"y"})
# test = test.reset_index().rename(columns={"date":"ds", "adj_close":"y"})

# model = Prophet(growth="linear", changepoints=None,
#                 n_changepoints=25,
# print(df.head())

m = NeuralProphet(
    n_lags=12,
    changepoints_range=0.95,
    n_changepoints=30,
    weekly_seasonality=False,
    batch_size=64,
    epochs=10,
    learning_rate=1.0,
)
metrics = m.fit(df, freq='5min')

future = m.make_future_dataframe(df, n_historic_predictions=True)
forecast = m.predict(future)
fig = m.plot(forecast)

plt.show()
'''
Multi-step forecast
To predict multiple steps into the future, we could 'unroll' our single-step model, by predicting a step ahead, adding the forecasted value to our data, and then forecasting the next step until we reach the horizon we are interested in. However, there is a better way to do this: We can directly forecast multiple steps ahead with NeuralProphet.

We can set n_forecasts to the desired number of steps we would like to forecast (also known as 'forecast horizon'). NeuralProphet will forecast n_forecasts steps into the future, at every single step. Thus, we have n_forecasts overlapping predictions of vaying age at every historic point.

When icreasing the forecast horizon n_forecasts, we should also increase the number of past observations n_lags to at least the same value.

Here, we forecast the next 3 hours based on the last observed 6 hours, in 5-minute steps:
'''
m = NeuralProphet(
    n_lags=6 * 12,
    n_forecasts=3 * 12,
Пример #21
0
    regressors_df=df_test[["x1", "x2"]],
    periods=df_test.shape[0],
)
df_pred_nprophet = model_nprophet.predict(future_nprophet)
t4 = process_time() - t3
print(t2, t4)

# df_pred_nprophet.set_index('ds')['yhat1'].plot()

# fig1 = model_nprophet.plot(df_pred_nprophet)

# %%
t1 = process_time()
model_nprophet = NeuralProphet(n_lags=100, n_forecasts=10)
model_nprophet.fit(df_train[["ds", "y"]], freq="D")
t2 = process_time() - t1

t3 = process_time()
future_nprophet = model_nprophet.make_future_dataframe(
    df=df_train[["ds", "y"]])
df_pred_nprophet = model_nprophet.predict(future_nprophet)

t4 = process_time() - t3
print(t2, t4)

# df_pred_nprophet.set_index('ds')['yhat1'].plot()

fig1 = model_nprophet.plot(df_pred_nprophet)

# %%
Пример #22
0
    m = NeuralProphet(
        normalize='standardize',
        num_hidden_layers = 1,
        n_forecasts=60,
        n_lags=2,
        
        #seasonality_mode="multiplicative",
        epochs=10
    )


    m.fit(Product_1766, freq='D')

    future = m.make_future_dataframe(Product_1766, 
                                     periods=60,
                                     n_historic_predictions=len(Product_1766))
    forecast = m.predict(future)  
    m.plot(forecast)
    plt.show()
    
    # print(df.index)
    # print(Product_1766.index)
    
    # df_train, df_val = m.split_df(Product_1766, valid_p=0.2, freq='D')
    # train_metrics = m.fit(df_train, freq='D')
    # val_metrics = m.test(df_val)
    # print(train_metrics)
    # print(val_metrics)
    metrics = m.fit(Product_1766, validate_each_epoch=True, valid_p=0.2, freq='D')
    print(metrics)