Re: Naive Bayes classification module of CPAN



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 <rob.dixon@xxxxxxx> 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



Relevant Pages

  • Re: Betovs notation
    ... >> free from MASM Syntax MAJOR errors. ... The fact is that, in RosAsm Syntax, we do not need to make ... >> Char for Data Labels Declarations, ... allow Labels without Colon... ...
    (alt.lang.asm)
  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... assembler" but rather a low-level assembler which can be "extended" easily ... Well, the simple proposed "extension" is to, instead, make labels ... In one sense, this is just "local labels", like in NASM, with an ... Exactly the same basic idea but a different syntax for getting it...within ...
    (alt.lang.asm)
  • Re: Modifying line parameters in simulink by using matlab commands
    ... "Labels" as shown below ... Can anyone tell me whats wrong with the above syntax and also mention the ... Going through the mdl file in a text editor is not the correct way to go ... completion with get_param(h,'<press TAB key there> and it will show you all ...
    (comp.soft-sys.matlab)
  • Re: Naive Bayes classification module of CPAN
    ... same syntax as given in the docs, and provided attributes in the same ... I get the labels and their corresponding scores, ... 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, ...
    (perl.beginners)
  • Re: create a labels merge document
    ... I am doing a mailing labels merge using an Excel data source. ... Word MVP FAQ site: http://word.mvps.org ... please post all follow-ups to the newsgroup so ... Which what I also did with the syntax you suggested. ...
    (microsoft.public.word.docmanagement)