Analyze output#

Once the prediction is stored into a file, we can analyze it. Once again it’s recommand to put the analyze in a separate function in order to call them on demand.

We can start by loading data, and prediction:

def analyze():
    # get the data
    (train_inputs, train_targets, train_timestamps), (test_inputs, test_targets, test_timestamps) = split_data()
    prediction = utils.read_output()

Then, you only have to pass the data to the function of the hibou.stats module. Three functions are available:

  1. a month-by-month diurnal cycle to see which month’s estimations are best:

    # month-by-month diurnal cycle
    stats.plot_daily_mean(
        test_targets,
        prediction,
        np.vectorize(pd.Timestamp)(ts_test[:, 0]),
        fluxes_names=TARGETS_VAR
    )
    
  2. a test of sensibility on each inputs variable, the results are print in a table:

    # show a table of the sensibility of the models to each inputs variable.
    stats.sensibility_test(model_set, test_inputs, INPUTS_VAR, TARGETS_VAR)
    
  3. a correlation plot between observed and estimated fluxed, the RMSE, PCC and p-value are calculated for each given bin of fluxes:

    # correlation and error per flux bin
    stats.stats.plot_correlation_per_bin(
        test_targets,
        prediction,
        fluxes_names=TARGETS_VAR,
        bins=[
            [-100, 0, 100, 200, 300, 400],  # H bins
            [0, 100, 200, 300, 400, 500],   # LE bins
        ]
    )
    

All the plotted figures are saved into my_output_dir/output.