Hi,
I'm new to mahout. And learning how to use naiveBayes included in
mahout 0.7.
And when I read the code in *
org.apache.mahout.classifier.naivebayes.training.WeightsMapper*, I found a
confuse variable "cardinality" of RandomAccessSparseVector which actually
is the property "size" in AbstractVector.
In map() function, the code "weightsPerFeature = new
RandomAccessSparseVector(instance.size(),
instance.getNumNondefaultElements());" implies that cardinality of
weightsPerFeature is instance.size(). And this code invoked just one time
at the first time the mapper works what may cause the latter on
code,"weightsPerFeature.assign(instance, Functions.PLUS);",
throws CardinalityException if a record read by mapper has different
"index" and with different vector.size from the first loaded record.
So, I hope I could make it clear about the code whether maybe I
mis-read the code or not.
May somebody help me ? Thanks a lot!