Thanks a lot Rob. That makes things clear. Also, there is one thing that I didn't understand about this. If I use Frequence based or Gaussian based models, I do not get correct results. As in, the prediction is always the same label, though weights are a little differenct each time.
However, thngs work pretty well if I use Discrete model. So what's the reason behind this?? I looked at AI::Categorizer and could not understand how to use it for a similar case as this, so if someone could explain that, it'd be great. thanks Saurabh On 11/1/06, Rob Dixon <[EMAIL PROTECTED]> wrote:
Saurabh Singhvi wrote: > > Hi all, > > I used the Algorithm::NaiveBayes from CPAN. Now it's all working fine > on the syntax. The problem is that I cannot get the 'result'. I trained the > algorithm with some attributes and provided the labels alongwith using > add_instance. And then trained it with train(). Now, to predict I used the > same syntax as given in the docs, and provided attributes in the same > manner as I used with add_instance. Now If i do > > print %$result > > I get the labels and their corresponding scores, which is probably what > it should be, seeing from the docs. So, what I cannot understand is, where > is the result / predicted value stored??? and how do i get it?? There is no single result Surabh, the hash tells you how well each of the category labels applies to the attribute set you specified in the call to predict(). The nearer the key value is to 1 the better the category corresponds with the attributes. You could choose one of the labels returned byt simply picking the one with the highest key value, but you really need to look at the whole data set as even the best match may be a very bad one, or there may be several very good ones. Display your results with printf "%s => %s\n" $_, $result->{$_} foreach keys %$result; HTH, Rob