How do I calculate posterior probabilities from the results of linear discriminant analysis in Accord.NET?

49 views Asked by At

I am currently porting an image processing project from R to C#. At the end of the pipeline there is a binary classifier for which I have used linear discriminant analysis as the input vector consists just of two doubles. In R I have used the lda function from the MASS package, in C# I am using LinearDiscriminantAnalysis class from Accord.NET. The classifier itself works just fine, but apart from the prediction itself I also have to extract a probability or confidence. In MASS posterior probabilities are conveniently part of the return value of the predict.lda function, but in Accord.NET there seems to be no easy way to get probabilities. I have tried computing probabilities from the result of the Scores method in the LinearDiscriminantAnalysis.Pipeline class using the softmax function, but since the scores are in the range between -0.01 and -0.08 the probabilities hover around 50%, which is out of line with the results I get in R and with the fact that the separation achieved with the classifier is excellent. Is there a simple way of computing the posterior probabilities I get in R from the output of the LinearDiscriminantAnalysis.Pipeline classifier?

0

There are 0 answers