...
To learn more about what every function does make sure that you check the required material in the chapter on Training material.
Code Block | ||
---|---|---|
| ||
library(ForestForesight) ff_environment() #after running this line, fill in the details in the interactive window below in Rstudio #fastest is to select a small country with fewer tiles, e.g. #Suriname (SUR) has one, #Laos (LAO) two, #while Brazil has over fifteen tiles. #first download the preprocessed data ff_sync(features = "high", #we only want the most important features date_start = "2023-01-01", date_end = "2023-12-01",# this is an example year download_model = TRUE, #we will download the already pregenerated model download_predictions = TRUE, #we will download the predictions as well download_groundtruth = TRUE #we will also download the groundtruth data since we have no own groundtruth ) # then use ff_run to load the input data, train and predict. # This will automatically plot the accuracy over the four prediction months per 1x1 degree tile # and per month and the importance of individual features for the model. If not, increase the window # size in the bottom right and run again. ff_output <- ff_run(train_dates = ForestForesight::daterange("2023-01-01","2023-03-01"), #train on the first 3 months, normally we recommend at least a year of training data prediction_dates = ForestForesight::daterange("2023-09-01","2023-12-01")) # predict on the last four months to always have a 6 month gap between trianing and predicting # the plot below will show the four rasters for the four months of prediction plot(ff_output$predictions) # the plot below shows the medium, high and very high risk level polygons for december 2023 plot(ff_output$shape) plot(ff_output$risk_zones$`2023-12-01`$medium, col="yellow", border = "yellow", add=TRUE) plot(ff_output$risk_zones$`2023-12-01`$high, col="orange", border = "orange", add=TRUE) plot(ff_output$risk_zones$`2023-12-01`$very_high, col="red", border = "red", add=TRUE) #this shows the first lines of the accuracy dataframe, with precision, recall and F0.5 for every month # and every 1x1 degree head(ff_output$accuracy_dataframe) #this shows the relative importance of the features for the built model head(ff_output$importance_dataframe,10) #in this variable the model is stored. You can save it by setting the model_save_path in ff_run before running. ff_output$model # by setting the parameters for output in ff_run you can export all this information to disk as well |