<jupyter_start><jupyter_text>Setup<jupyter_code>from specific import *<jupyter_output><empty_output><jupyter_text>Get shifted data<jupyter_code>(
    endog_data,
    exog_data,
    master_mask,
    filled_datasets,
    masked_datasets,
    land_mask,
) = get_offset_data()<jupyter_output><empty_output><jupyter_text>Retrieve previous results from the 'model' notebook<jupyter_code>rf = get_model()<jupyter_output><empty_output><jupyter_text>Predict BA<jupyter_code>n_threads = get_ncpus()
rf.n_jobs = n_threads
with parallel_backend("threading", n_jobs=n_threads):
    predicted_ba = get_masked_array(rf.predict(exog_data), master_mask)
target_ba = get_masked_array(endog_data.values, master_mask)
ba_predicted = predicted_ba
ba_data = target_ba

model_name = "RF1"

# Plotting params.
figsize = (5.1, 2.8)
mpl.rcParams["figure.figsize"] = figsize
coast_linewidth = 0.3
date_str = "2010-01 to 2015-01"
boundaries = [1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1]


# Plotting predicted.
fig = cube_plotting(
    ba_predicted,
    cmap="brewer_RdYlBu_11_r",
    title=f"Predicted BA\n{date_str}",
    boundaries=boundaries,
    colorbar_kwargs={"label": "Burned Area Fraction", "format": "%0.0e"},
    coastline_kwargs={"linewidth": coast_linewidth},
)
figure_saver.save_figure(fig, f"predicted_ba_{model_name}", sub_directory="predictions")

# Plotting observed.
fig = cube_plotting(
    ba_data,
    cmap="brewer_RdYlBu_11_r",
    title=f"Observed BA\n{date_str}",
    boundaries=boundaries,
    colorbar_kwargs={"label": "Burned Area Fraction", "format": "%0.0e"},
    coastline_kwargs={"linewidth": coast_linewidth},
)
figure_saver.save_figure(fig, f"observed_ba_{model_name}", sub_directory="predictions")
frac_diffs = (ba_data - ba_predicted) / ba_data
# Plotting differences.
diff_boundaries = [-1e1, -1e0, 0, 1e-1]

fig = cube_plotting(
    frac_diffs,
    cmap="brewer_RdYlBu_11",
    title=f"BA Discrepancy <(Obs. - Pred.) / Obs.> \n{date_str}",
    cmap_midpoint=0,
    boundaries=diff_boundaries,
    colorbar_kwargs={"label": "(Obs. - Pred.) / Obs.", "format": "%0.0e"},
    coastline_kwargs={"linewidth": coast_linewidth},
)
figure_saver.save_figure(
    fig, f"difference_ba_{model_name}", sub_directory="predictions"
)
rel_mse = frac_diffs ** 2
# Plotting differences.
diff_boundaries = [1e-1, 1, 1e1, 1e2, 1e3]

fig = cube_plotting(
    rel_mse,
    cmap="inferno",
    title=r"BA Discrepancy <$\mathrm{((Obs. - Pred.) / Obs.)}^2$>" + f"\n{date_str}",
    boundaries=diff_boundaries,
    colorbar_kwargs={"label": "1", "format": "%0.0e"},
    coastline_kwargs={"linewidth": coast_linewidth},
)
figure_saver.save_figure(
    fig, f"rel_mse_difference_ba_{model_name}", sub_directory="predictions"
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1464572680788897, 'fraction_numerical': 0.024470416362308255, 'mean_word_length': 5.680487804878049, 'pattern_counts': {'":': 12, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '100639', 'license': 'MIT', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1074, 'n_words': 168, 'path': 'analyses/seasonality_paper_nn/vod_only/model_predictions.ipynb', 'repo_name': 'akuhnregnier/fuel-build-up', 'size': '2738'}