Closed Hongwuliang closed 2 months ago
grid <- expand.grid(committees = c(1, 10, 50, 100), neighbors = c(0, 1, 5, 9))
set.seed(123) caret_grid <- train( x = subset(traindata, select = -SOM), y = traindata$SOM, method = "cubist", tuneGrid = grid, trControl = trainControl(method = "cv")) im <- caret::varImp(caret_grid) cub_Predict <- predict(caret_grid, data2) data_cub <- cbind(data2[,1,drop = FALSE],cub_Predict)
pre_cub <- terra::predict(as.data.frame(Bare_land_image), cubist_model, na.rm = F, overwrite = TRUE, cpkgs = "Cubist", cores = 1, filename = "E:/first_paper/landsat9/Result_new/bareland_CN3.tif")
This site is not for "how to" questions.
cubist
grid <- expand.grid(committees = c(1, 10, 50, 100), neighbors = c(0, 1, 5, 9))
set.seed(123) caret_grid <- train( x = subset(traindata, select = -SOM), y = traindata$SOM, method = "cubist", tuneGrid = grid, trControl = trainControl(method = "cv")) im <- caret::varImp(caret_grid) cub_Predict <- predict(caret_grid, data2) data_cub <- cbind(data2[,1,drop = FALSE],cub_Predict)
pre_cub <- terra::predict(as.data.frame(Bare_land_image), cubist_model, na.rm = F, overwrite = TRUE, cpkgs = "Cubist", cores = 1, filename = "E:/first_paper/landsat9/Result_new/bareland_CN3.tif")