ROC AUC using R Weka

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ROC AUC using R Weka

simplysmart
Hi,

I have started using weka through R. However, I am having trouble in finding
how to get AUC for any algorithm from within R. Any guidance would be much
appreciated.

# KNN:
(resultIBk <- IBk(postScore~., data_train))

# Naive Bayes:
NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayes")
# Default settings Weka
(resultNB <- NB(postScore~., data_train))

# Decision Tree J48
(resultJ48 <- J48(postScore~., data_train))



--
Sent from: https://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: ROC AUC using R Weka

Michael Hall


On Oct 21, 2019, at 5:09 PM, simplysmart <[hidden email]> wrote:

I have started using weka through R. However, I am having trouble in finding
how to get AUC for any algorithm from within R. Any guidance would be much
appreciated.

You would want to just do that in R wouldn’t you?

You would need the RWeka predictions like…

if (TRUE) {
gc(verbose=FALSE)
print("RF Training...")
rf <- RandomForest(Cover_Type~., data = train, control = Weka_control(I = 110))
print("RF Predicting...")
 p_rf <- c()
for (i in 1:4) {
from_row = (i-1)*(nrow(test)/4)+1  to_row = i*(nrow(test)/4)
 p_rf <- rbind(p_rf,predict(rf,test[from_row:to_row,],"probability"))
}
p_rf_out <- apply(p_rf,1,which.max)
 write.csv(data.frame(Id=ids,Cover_Type=p_rf_out),"rf_submission.csv",row.names=FALSE,quote=FALSE)

Did some looping for memory constraints as I recall.

This from a Kaggle competition if of interest…
Not sure if you have to sign in to see that.

Kaggle is where I have done a little with RWeka. I also tend to use the R Metrics package that originated from Kaggle I think. 
I see that ii has...

> library(Metrics)
> ?auc

Area under the ROC curve (AUC)

Description

auc computes the area under the receiver-operator characteristic curve (AUC).

Usage

auc(actual, predicted)

_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html