Re: Naive Bayes classification module of CPAN
- From: rob.dixon@xxxxxxx (Rob Dixon)
- Date: Wed, 01 Nov 2006 00:05:26 +0000
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
.
- Follow-Ups:
- Re: Naive Bayes classification module of CPAN
- From: Saurabh Singhvi
- Re: Naive Bayes classification module of CPAN
- References:
- Naive Bayes classification module of CPAN
- From: Saurabh Singhvi
- Naive Bayes classification module of CPAN
- Prev by Date: Re: matching the end of an array element
- Next by Date: Re: matching the end of an array element
- Previous by thread: Naive Bayes classification module of CPAN
- Next by thread: Re: Naive Bayes classification module of CPAN
- Index(es):
Relevant Pages
|