You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Xiaobo Gu <gu...@gmail.com> on 2011/06/29 18:26:08 UTC

L2 seems does not work

Hi,

I am testing AdaptiveLogisticRegression with L2, but the result seems
L2 cause the whole training process useless, the result is as
following:
With prior =  L2 then

       400  0 AdaptiveLogisticRegression has not found a good model ......
800	NaN	0.00
1200	NaN	0.00
......

40000	NaN	0.00
100
color ~ NaN*x + NaN*y
                   x NaN
                   y NaN
            NaN             NaN             NaN             NaN
     NaN             NaN             NaN             NaN
NaN             NaN             NaN             NaN             NaN
         NaN             NaN             NaN             NaN
  NaN             NaN             NaN             NaN             NaN
           NaN             NaN             NaN             NaN
    NaN             NaN             NaN             NaN
NaN             NaN             NaN             NaN             NaN
         NaN             NaN             NaN             NaN
  NaN             NaN             NaN             NaN             NaN
           NaN             NaN             NaN             NaN
    NaN             NaN             NaN             NaN
NaN             NaN             NaN             NaN             NaN
         NaN             NaN             NaN             NaN
  NaN             NaN             NaN             NaN             NaN
           NaN             NaN             NaN             NaN
    NaN             NaN             NaN             NaN
NaN             NaN             NaN             NaN             NaN
         NaN             NaN             NaN             NaN
  NaN             NaN             NaN             NaN             NaN
           NaN             NaN             NaN             NaN
    NaN             NaN             NaN             NaN
NaN             NaN             NaN             NaN

Regards,

Xiaobo Gu

Re: L2 seems does not work

Posted by Ted Dunning <te...@gmail.com>.
That's me.

Yes.  I ahve patches to review from Hector and two bugs like this.

On Wed, Jun 29, 2011 at 6:40 PM, Xiaobo Gu <gu...@gmail.com> wrote:

> Can the author of L2 and AdaptiveLogisticRegression help with this?
>
> Regards,
>
> Xiaobo Gu
>
> On Thu, Jun 30, 2011 at 1:39 AM, Hector Yee <he...@gmail.com> wrote:
> > The nans in logistic regression usually occur at the Math.exp.
> >
> > Try adding a breakpoint or assert not nan there to see what the input is.
> >
> > If its an overflow you can fix it by clamping. The argument to exp maxes
> out
> > around 50 for floats before NaN ing.
> >
> > On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com>
> wrote:
> >
> >> You will get this using the following command, with the latest 696
> >> patch https://issues.apache.org/jira/browse/MAHOUT-696
> >>
> >> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
> >> --target color --categories 2 --predictors x y --types numeric
> >> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
> >> --prior L2
> >>
> >>
> >>
> >> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> >> > Hi,
> >> >
> >> > I am testing AdaptiveLogisticRegression with L2, but the result seems
> >> > L2 cause the whole training process useless, the result is as
> >> > following:
> >> > With prior =  L2 then
> >> >
> >> >       400  0 AdaptiveLogisticRegression has not found a good model
> ......
> >> > 800     NaN     0.00
> >> > 1200    NaN     0.00
> >> > ......
> >> >
> >> > 40000   NaN     0.00
> >> > 100
> >> > color ~ NaN*x + NaN*y
> >> >                   x NaN
> >> >                   y NaN
> >> >            NaN             NaN             NaN             NaN
> >> >     NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN
> >> >
> >> > Regards,
> >> >
> >> > Xiaobo Gu
> >> >
> >>
> >
> >
> >
> > --
> > Yee Yang Li Hector
> > http://hectorgon.blogspot.com/ (tech + travel)
> > http://hectorgon.com (book reviews)
> >
>

Re: L2 seems does not work

Posted by Ted Dunning <te...@gmail.com>.
That's me.

Yes.  I ahve patches to review from Hector and two bugs like this.

On Wed, Jun 29, 2011 at 6:40 PM, Xiaobo Gu <gu...@gmail.com> wrote:

> Can the author of L2 and AdaptiveLogisticRegression help with this?
>
> Regards,
>
> Xiaobo Gu
>
> On Thu, Jun 30, 2011 at 1:39 AM, Hector Yee <he...@gmail.com> wrote:
> > The nans in logistic regression usually occur at the Math.exp.
> >
> > Try adding a breakpoint or assert not nan there to see what the input is.
> >
> > If its an overflow you can fix it by clamping. The argument to exp maxes
> out
> > around 50 for floats before NaN ing.
> >
> > On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com>
> wrote:
> >
> >> You will get this using the following command, with the latest 696
> >> patch https://issues.apache.org/jira/browse/MAHOUT-696
> >>
> >> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
> >> --target color --categories 2 --predictors x y --types numeric
> >> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
> >> --prior L2
> >>
> >>
> >>
> >> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> >> > Hi,
> >> >
> >> > I am testing AdaptiveLogisticRegression with L2, but the result seems
> >> > L2 cause the whole training process useless, the result is as
> >> > following:
> >> > With prior =  L2 then
> >> >
> >> >       400  0 AdaptiveLogisticRegression has not found a good model
> ......
> >> > 800     NaN     0.00
> >> > 1200    NaN     0.00
> >> > ......
> >> >
> >> > 40000   NaN     0.00
> >> > 100
> >> > color ~ NaN*x + NaN*y
> >> >                   x NaN
> >> >                   y NaN
> >> >            NaN             NaN             NaN             NaN
> >> >     NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN             NaN
> >> >         NaN             NaN             NaN             NaN
> >> >  NaN             NaN             NaN             NaN             NaN
> >> >           NaN             NaN             NaN             NaN
> >> >    NaN             NaN             NaN             NaN
> >> > NaN             NaN             NaN             NaN
> >> >
> >> > Regards,
> >> >
> >> > Xiaobo Gu
> >> >
> >>
> >
> >
> >
> > --
> > Yee Yang Li Hector
> > http://hectorgon.blogspot.com/ (tech + travel)
> > http://hectorgon.com (book reviews)
> >
>

Re: L2 seems does not work

Posted by Xiaobo Gu <gu...@gmail.com>.
Can the author of L2 and AdaptiveLogisticRegression help with this?

Regards,

Xiaobo Gu

On Thu, Jun 30, 2011 at 1:39 AM, Hector Yee <he...@gmail.com> wrote:
> The nans in logistic regression usually occur at the Math.exp.
>
> Try adding a breakpoint or assert not nan there to see what the input is.
>
> If its an overflow you can fix it by clamping. The argument to exp maxes out
> around 50 for floats before NaN ing.
>
> On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com> wrote:
>
>> You will get this using the following command, with the latest 696
>> patch https://issues.apache.org/jira/browse/MAHOUT-696
>>
>> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
>> --target color --categories 2 --predictors x y --types numeric
>> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
>> --prior L2
>>
>>
>>
>> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
>> > Hi,
>> >
>> > I am testing AdaptiveLogisticRegression with L2, but the result seems
>> > L2 cause the whole training process useless, the result is as
>> > following:
>> > With prior =  L2 then
>> >
>> >       400  0 AdaptiveLogisticRegression has not found a good model ......
>> > 800     NaN     0.00
>> > 1200    NaN     0.00
>> > ......
>> >
>> > 40000   NaN     0.00
>> > 100
>> > color ~ NaN*x + NaN*y
>> >                   x NaN
>> >                   y NaN
>> >            NaN             NaN             NaN             NaN
>> >     NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN
>> >
>> > Regards,
>> >
>> > Xiaobo Gu
>> >
>>
>
>
>
> --
> Yee Yang Li Hector
> http://hectorgon.blogspot.com/ (tech + travel)
> http://hectorgon.com (book reviews)
>

Re: L2 seems does not work

Posted by Xiaobo Gu <gu...@gmail.com>.
Can the author of L2 and AdaptiveLogisticRegression help with this?

Regards,

Xiaobo Gu

On Thu, Jun 30, 2011 at 1:39 AM, Hector Yee <he...@gmail.com> wrote:
> The nans in logistic regression usually occur at the Math.exp.
>
> Try adding a breakpoint or assert not nan there to see what the input is.
>
> If its an overflow you can fix it by clamping. The argument to exp maxes out
> around 50 for floats before NaN ing.
>
> On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com> wrote:
>
>> You will get this using the following command, with the latest 696
>> patch https://issues.apache.org/jira/browse/MAHOUT-696
>>
>> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
>> --target color --categories 2 --predictors x y --types numeric
>> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
>> --prior L2
>>
>>
>>
>> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
>> > Hi,
>> >
>> > I am testing AdaptiveLogisticRegression with L2, but the result seems
>> > L2 cause the whole training process useless, the result is as
>> > following:
>> > With prior =  L2 then
>> >
>> >       400  0 AdaptiveLogisticRegression has not found a good model ......
>> > 800     NaN     0.00
>> > 1200    NaN     0.00
>> > ......
>> >
>> > 40000   NaN     0.00
>> > 100
>> > color ~ NaN*x + NaN*y
>> >                   x NaN
>> >                   y NaN
>> >            NaN             NaN             NaN             NaN
>> >     NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN             NaN
>> >         NaN             NaN             NaN             NaN
>> >  NaN             NaN             NaN             NaN             NaN
>> >           NaN             NaN             NaN             NaN
>> >    NaN             NaN             NaN             NaN
>> > NaN             NaN             NaN             NaN
>> >
>> > Regards,
>> >
>> > Xiaobo Gu
>> >
>>
>
>
>
> --
> Yee Yang Li Hector
> http://hectorgon.blogspot.com/ (tech + travel)
> http://hectorgon.com (book reviews)
>

Re: L2 seems does not work

Posted by Hector Yee <he...@gmail.com>.
The nans in logistic regression usually occur at the Math.exp.

Try adding a breakpoint or assert not nan there to see what the input is.

If its an overflow you can fix it by clamping. The argument to exp maxes out
around 50 for floats before NaN ing.

On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com> wrote:

> You will get this using the following command, with the latest 696
> patch https://issues.apache.org/jira/browse/MAHOUT-696
>
> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
> --target color --categories 2 --predictors x y --types numeric
> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
> --prior L2
>
>
>
> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> > Hi,
> >
> > I am testing AdaptiveLogisticRegression with L2, but the result seems
> > L2 cause the whole training process useless, the result is as
> > following:
> > With prior =  L2 then
> >
> >       400  0 AdaptiveLogisticRegression has not found a good model ......
> > 800     NaN     0.00
> > 1200    NaN     0.00
> > ......
> >
> > 40000   NaN     0.00
> > 100
> > color ~ NaN*x + NaN*y
> >                   x NaN
> >                   y NaN
> >            NaN             NaN             NaN             NaN
> >     NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN
> >
> > Regards,
> >
> > Xiaobo Gu
> >
>



-- 
Yee Yang Li Hector
http://hectorgon.blogspot.com/ (tech + travel)
http://hectorgon.com (book reviews)

Re: L2 seems does not work

Posted by Hector Yee <he...@gmail.com>.
The nans in logistic regression usually occur at the Math.exp.

Try adding a breakpoint or assert not nan there to see what the input is.

If its an overflow you can fix it by clamping. The argument to exp maxes out
around 50 for floats before NaN ing.

On Wed, Jun 29, 2011 at 9:38 AM, Xiaobo Gu <gu...@gmail.com> wrote:

> You will get this using the following command, with the latest 696
> patch https://issues.apache.org/jira/browse/MAHOUT-696
>
> mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
> --target color --categories 2 --predictors x y --types numeric
> --threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
> --prior L2
>
>
>
> 2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> > Hi,
> >
> > I am testing AdaptiveLogisticRegression with L2, but the result seems
> > L2 cause the whole training process useless, the result is as
> > following:
> > With prior =  L2 then
> >
> >       400  0 AdaptiveLogisticRegression has not found a good model ......
> > 800     NaN     0.00
> > 1200    NaN     0.00
> > ......
> >
> > 40000   NaN     0.00
> > 100
> > color ~ NaN*x + NaN*y
> >                   x NaN
> >                   y NaN
> >            NaN             NaN             NaN             NaN
> >     NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN             NaN
> >         NaN             NaN             NaN             NaN
> >  NaN             NaN             NaN             NaN             NaN
> >           NaN             NaN             NaN             NaN
> >    NaN             NaN             NaN             NaN
> > NaN             NaN             NaN             NaN
> >
> > Regards,
> >
> > Xiaobo Gu
> >
>



-- 
Yee Yang Li Hector
http://hectorgon.blogspot.com/ (tech + travel)
http://hectorgon.com (book reviews)

Re: L2 seems does not work

Posted by Xiaobo Gu <gu...@gmail.com>.
You will get this using the following command, with the latest 696
patch https://issues.apache.org/jira/browse/MAHOUT-696

mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
--target color --categories 2 --predictors x y --types numeric
--threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
--prior L2



2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> Hi,
>
> I am testing AdaptiveLogisticRegression with L2, but the result seems
> L2 cause the whole training process useless, the result is as
> following:
> With prior =  L2 then
>
>       400  0 AdaptiveLogisticRegression has not found a good model ......
> 800     NaN     0.00
> 1200    NaN     0.00
> ......
>
> 40000   NaN     0.00
> 100
> color ~ NaN*x + NaN*y
>                   x NaN
>                   y NaN
>            NaN             NaN             NaN             NaN
>     NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN
>
> Regards,
>
> Xiaobo Gu
>

Re: L2 seems does not work

Posted by Xiaobo Gu <gu...@gmail.com>.
You will get this using the following command, with the latest 696
patch https://issues.apache.org/jira/browse/MAHOUT-696

mahout trainAdaptiveLogistic --input donut.csv --output d:\\model1
--target color --categories 2 --predictors x y --types numeric
--threads 8 --passes 1000 --showperf --features 100 --skipperfnum 399
--prior L2



2011/6/30 Xiaobo Gu <gu...@gmail.com>:
> Hi,
>
> I am testing AdaptiveLogisticRegression with L2, but the result seems
> L2 cause the whole training process useless, the result is as
> following:
> With prior =  L2 then
>
>       400  0 AdaptiveLogisticRegression has not found a good model ......
> 800     NaN     0.00
> 1200    NaN     0.00
> ......
>
> 40000   NaN     0.00
> 100
> color ~ NaN*x + NaN*y
>                   x NaN
>                   y NaN
>            NaN             NaN             NaN             NaN
>     NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN             NaN
>         NaN             NaN             NaN             NaN
>  NaN             NaN             NaN             NaN             NaN
>           NaN             NaN             NaN             NaN
>    NaN             NaN             NaN             NaN
> NaN             NaN             NaN             NaN
>
> Regards,
>
> Xiaobo Gu
>