You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Zheyi RONG <ro...@gmail.com> on 2013/03/08 15:04:58 UTC

Fwd: Category 0 in Model dissection

Dear all,

I would like to ask how I can retrieve the category 0 on which a feature
has a most impact?

Specifically, now I am doing classification on several categories (labels),
say, Positive and Negative using AdaptiveLogisticRegression.

When dissecting this model, to get the category on which a feature has a
most impact,
I followed the codes from org.apache.mahout.classifier.sgd.SGDHelper, Line
74 (mahout-examples 0.7):
    ngNames.get(w.getMaxImpact() + 1).
where ngNames is the label list (i.e. ["Positive", "Negative"]), and w is
the Weight instance of a feature.

However, the Weight class internally represents n labels using a vector
with n-1 positions ( am I correct?) ,
so it seems impossible to retrieve category 0, if a feature has a most
impact on it.

Could anyone tell me how to correctly retrieve category 0, if a feature has
a most impact on it?

Thanks in advance.

Regards,
Zheyi.

Re: Category 0 in Model dissection

Posted by Zheyi RONG <ro...@gmail.com>.
Thank you for this in time reply.

However, I am not sure that if weights calculated by 'classifyNoLink' would
sum to 1, and did not dig into it.
Though the weights from the function 'classify' will.

So instead of using 'classifyNoLink' in ModelDissector.update, I use
'classifyFull', which gives a vector containing all possibilities for all
categories.

Thank you.

Zheyi.

On Sat, Mar 9, 2013 at 1:00 AM, Ted Dunning <te...@gmail.com> wrote:

> The weights will sum to 1.  You can get the missing one by subtracting all
> the rest from that (I think)
>
> On Fri, Mar 8, 2013 at 9:04 AM, Zheyi RONG <ro...@gmail.com> wrote:
>
> > Dear all,
> >
> > I would like to ask how I can retrieve the category 0 on which a feature
> > has a most impact?
> >
> > Specifically, now I am doing classification on several categories
> (labels),
> > say, Positive and Negative using AdaptiveLogisticRegression.
> >
> > When dissecting this model, to get the category on which a feature has a
> > most impact,
> > I followed the codes from org.apache.mahout.classifier.sgd.SGDHelper,
> Line
> > 74 (mahout-examples 0.7):
> >     ngNames.get(w.getMaxImpact() + 1).
> > where ngNames is the label list (i.e. ["Positive", "Negative"]), and w is
> > the Weight instance of a feature.
> >
> > However, the Weight class internally represents n labels using a vector
> > with n-1 positions ( am I correct?) ,
> > so it seems impossible to retrieve category 0, if a feature has a most
> > impact on it.
> >
> > Could anyone tell me how to correctly retrieve category 0, if a feature
> has
> > a most impact on it?
> >
> > Thanks in advance.
> >
> > Regards,
> > Zheyi.
> >
>

Re: Category 0 in Model dissection

Posted by Ted Dunning <te...@gmail.com>.
The weights will sum to 1.  You can get the missing one by subtracting all
the rest from that (I think)

On Fri, Mar 8, 2013 at 9:04 AM, Zheyi RONG <ro...@gmail.com> wrote:

> Dear all,
>
> I would like to ask how I can retrieve the category 0 on which a feature
> has a most impact?
>
> Specifically, now I am doing classification on several categories (labels),
> say, Positive and Negative using AdaptiveLogisticRegression.
>
> When dissecting this model, to get the category on which a feature has a
> most impact,
> I followed the codes from org.apache.mahout.classifier.sgd.SGDHelper, Line
> 74 (mahout-examples 0.7):
>     ngNames.get(w.getMaxImpact() + 1).
> where ngNames is the label list (i.e. ["Positive", "Negative"]), and w is
> the Weight instance of a feature.
>
> However, the Weight class internally represents n labels using a vector
> with n-1 positions ( am I correct?) ,
> so it seems impossible to retrieve category 0, if a feature has a most
> impact on it.
>
> Could anyone tell me how to correctly retrieve category 0, if a feature has
> a most impact on it?
>
> Thanks in advance.
>
> Regards,
> Zheyi.
>