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! |