filmov
tv
How to Get AUC Value Under ROC Plot for Factor Data (Not Numeric 0 & 1) in R for Prediction Mapping?

Показать описание
Exercise code is below:
-------------------------------------------------------------------
# Step 3 Plot ROC curves
library(pROC)
# the model is used to predict the test data. However, you should ask for type="prob" here
## Since you have probabilities, use them to get the most-likely class.
# predict class and then attach test class
head(predictions1)
# Now, let's see how to plot the ROC curves. For each class, convert the multi-class problem into a binary problem. Also,
# call the roc() function specifying 2 arguments: i) observed classes and ii) class probability (instead of predicted class).
# 1 ROC curve, Moderate, Good, UHeal vs non Moderate non Good non UHeal
# calculating the values of AUC for ROC curve
print(results)
legend("topleft",c("AUC = 0.85 "),fill=c("red"),inset = (0.42))
-----------------------------------------------------------------------------------------------------------------------------------------------------------
#GIS
#Prediction
#Machine_learning
-------------------------------------------------------------------
# Step 3 Plot ROC curves
library(pROC)
# the model is used to predict the test data. However, you should ask for type="prob" here
## Since you have probabilities, use them to get the most-likely class.
# predict class and then attach test class
head(predictions1)
# Now, let's see how to plot the ROC curves. For each class, convert the multi-class problem into a binary problem. Also,
# call the roc() function specifying 2 arguments: i) observed classes and ii) class probability (instead of predicted class).
# 1 ROC curve, Moderate, Good, UHeal vs non Moderate non Good non UHeal
# calculating the values of AUC for ROC curve
print(results)
legend("topleft",c("AUC = 0.85 "),fill=c("red"),inset = (0.42))
-----------------------------------------------------------------------------------------------------------------------------------------------------------
#GIS
#Prediction
#Machine_learning