Hi, I use nnet for my classification problem and have a problem concerning the calculation of the final value for my validation data.(nnet only calculates the final value for the training data). I made my own final value formula (for the training data I get the same value as nnet): # prob-matrix pmatrix <- cat*fittedValues tmp <- rowSums(pmatrix) # -log likelihood finalValue <- sum(-log(tmp)) # add penalty term finalValue + sum(decay * weights^2) where cat is a matrix with cols for each possible category and a row for each data record. The values are 1 for the target categories of a data record and 0 otherwise.
My problem is, that I get Inf-values for some validation data records, because the rowsum of cat*fittedValues gets 0 and the log gets Inf. Has anyone an idea how to deal with that problem properly? How does nnet? I´m thinking of a penalty value for those values. That means if cat*fittedValues == 0 not to calculate the log but add e.g. 100 instead of "-log(tmp)" to the finalValue-sum?? But how to determine the penalty value??? I´m looking forwar for all suggestions, Andrea. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.