Lesson 3,
Topic 1
In Progress
Mapping Slums – Validating the data
The next step in the process is to validate your data. This is very important because thereby you’ll be able to tell how accurate the result can predict a slum in the study site. You will use different kinds of validation on the model in order to have a better accuracy. In detail you will calculate the sensitivity and the specificity of the model as well as the precision of the result.
In case you’re having any trouble during the process you can always use the help section for support, wich will also be briefly described in the lesson.
Code used for this lesson
####### Prediction & Confusion Matrix - train data######
Predit_Train <- predict(Model_Lag_RF, Train_lag)
confusionMatrix(Predit_Train, Train_lag$grid_code)
# # Prediction & Confusion Matrix - Test data (Ref data)######
Predict_Ref <- predict(Model_Lag_RF, Ref_lag)
confusionMatrix(Predict_Ref, Ref_lag$grid_code)
######Diagnostic of predicted probability score
InformationValue::sensitivity(Predict_Ref, Ref_lag$grid_code)
InformationValue::specificity(Predict_Ref, Ref_lag$grid_code)
InformationValue::precision(Predict_Ref, Ref_lag$grid_code)
InformationValue::plotROC(Predict_Ref, Ref_lag$grid_code)
#Export_model to file#######
out.name <- paste0(output_folder,"/RF_model.rds")
saveRDS(Model_Lag_RF,out.name)