bug with classify_model with nnet

85 views
Skip to first unread message

Patrick Lam

unread,
Oct 1, 2013, 3:01:31 AM10/1/13
to rtextto...@googlegroups.com
Hi,

I believe there is a bug in classify_model() when using the nnet algorithm with a binary classification (maybe not a bug, but just lack of robustness).  The relevant code in the function is

nnet_results <- predict(model,newdata=data.frame(as.matrix(corpus@classification_matrix)),...) #probabilities
nnet_pred <- apply(nnet_results,1,extract_label_from_prob_names) #Extract Highest Probability Score
nnet_prob <- apply(nnet_results,1,extract_maximum_prob) #Extract Probability The nnet output is unique in that when the classifications are binary, "nnet_results" does not give a two column matrix for the probabilities of each class.  It actually by default only outputs the probability of a "1", or whatever the second level is in the factor.  The current code here assumes that the output is a matrix with as many columns as categories, so it breaks down for binary classifications.  The code needs to be modified to take this into account.
Thanks!
Reply all
Reply to author
Forward
0 new messages