How to utilize the Random Forest method with various raster products

I am a basic R user. Could you please help me on how to apply Spatial Cross-Validation using mlr3 or another library such as random forest. I want to use 6 distinct raster data for this study.
I am trying to use random forest algorithm, tune the model parameters, evaluate and predict the result on all data.

  • Landsat 4 tiles as a reference data to train and test my model (expected out put).
  • MODIS surface reflectance 1-7 bands, NDVI, NDWI, DEM as input variables.
  • MODIS land cover for comparison with the model out put.
    I tried the following code lines to define my input data but I did create a regression task.
library(raster)

library(mlr3)

library(mlr3spatiotempcv)

library(mlr3tuning)

v1 <- list.files("C:/Users/CTE/Desktop/variable_1") # Landsat data to train and test RF model

v2 <- list.files("C:/Users/CTE/Desktop/variable_2") # MODIS 1-7 bands

v3 <- list.files("C:/Users/CTE/Desktop/variable_3") # NDVI

v4 <- list.files("C:/Users/CTE/Desktop/variable_4") # NDWI

v5 <- ("C:/Users/CTE/Desktop/variable_5") # DEM

v6 <- list.files("C:/Users/CTE/Desktop/variable_6") # MODIS LC for comparison with the result of RF model


task = mlr3spatiotempcv::as_task_regr_st(dplyr::select( ),

id = "", target = "") #Create a regression task.

I look at some example codes but I did not find any similar code to solve this problem.
Any help is highly appreciated. Looking forward to your kind assistance.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.