Skip to content

Commit

Permalink
Predict using model fitted on historical period for mw model
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed Jun 13, 2024
1 parent 9328fa8 commit fd7de21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions riskmapjnr/benchmark/defrate_per_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ class is created (see ``tab_file_defrate``).
data_for = defor_cat_data[fcc_data > 0]
data_defor = defor_cat_data[np.isin(fcc_data, [1, 2])]
# nfor_per_cat
cat_for = pd.Categorical(data_for.flatten(), categories=cat)
cat_for = pd.Categorical(data_for.flatten(),
categories=cat)
df["nfor"] += cat_for.value_counts().values
# ndefor_per_cat
cat_defor = pd.Categorical(data_defor.flatten(), categories=cat)
cat_defor = pd.Categorical(data_defor.flatten(),
categories=cat)
df["ndefor"] += cat_defor.value_counts().values

# Remove classes with no forest
Expand Down
4 changes: 2 additions & 2 deletions riskmapjnr/defrate_per_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ def defrate_per_cat(fcc_file, riskmap_file, time_interval,
if period == "calibration":
data_for = defor_cat_data[fcc_data > 0]
data_defor = defor_cat_data[fcc_data == 1]
elif period in ["validation", "confirmation"]:
elif period == "validation":
data_for = defor_cat_data[fcc_data > 1]
data_defor = defor_cat_data[fcc_data == 2]
elif period == "historical":
elif period in ["historical", "forecast"]:
data_for = defor_cat_data[fcc_data > 0]
data_defor = defor_cat_data[np.isin(fcc_data, [1, 2])]
# nfor_per_cat
Expand Down

0 comments on commit fd7de21

Please sign in to comment.