I'm currently working on preditive models with the 'randomForest' package.
Fitting my model as follow
rf <- foreach(ntree=rep(10, 3), .combine= combine, .packages='randomForest') %dopar% {
randomForest(bou~.,data=train, trees=50, importance=TRUE)}
When using 'confusionMatrix' from the 'caret' package, I've got the results below :
I'd like to know if it's possible to set the positive class to 1 in the model. I searched in the package description but couldn't find anything about it.
Thank you very much.
Edit : I've found it. It's an option in the 'confusionMatrix' command from the 'caret' package. I was lokking at the wrong place. Here an example if needed.
confusionMatrix(predicted,true_values,positive='1')
Should I leave my post or delete it ?
Changing the positive Class: One of the proficient way of doing this is through re-leveling of the target variable. To change the Positive Class to "Malignant" can be done using the relevel() function. The relevel() changes the reference level of the variable.
A confusion matrix in R is a table that will categorize the predictions against the actual values. It includes two dimensions, among them one will indicate the predicted values and another one will represent the actual values.
Positive class is the class that is related to your objective function. For example, if you want to classify whether the objects are present or not in a given scenario. So for all the data samples where objects are present will be considered in the positive class.
I've found it. It's an option in the confusionMatrix
command from the caret
package. I was looking at the wrong place. Here an example if needed:
confusionMatrix(predicted,true_values,positive='1')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With