chasset / pnn

Probabilistic Neural Network
2 stars 1 forks source link

guess {pnn} returns NA #1

Open vinhqdang opened 8 years ago

vinhqdang commented 8 years ago

Hello

I am using pnn to predict a True / False output, but sometimes I see that the function

guess (fit, test)

returns the value NA. For me, it does not make sense at all (even in worst case, given a random value between True / False is better than returns N/A). Why and when the guess function will return NA value?

Thank you very much,

ghost commented 8 years ago

In some samples, PNN doesn't yield any prediction, so PNN returns NA. If you check following part of the code, you can realize this:

Predict the category of a new observation

@param nn A probabilistic neural network already trained

@param X A vector describing a new observation

guess.category <- function(nn, X) { probs <- guess.probabilities.of.each.category(nn, X) if(is.na(probs[1])) return(NA)