You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Svetlomir Kasabov <sk...@smail.inf.fh-brs.de> on 2011/06/03 02:01:23 UTC

LogisticModelParameters#saveTo(OutputStream) generates an empty file

Hello,

since I updated my trunk version of Mahout today, I get an empty file 
for the model when executing this code:

/    OutputStream modelOutput = new FileOutputStream(LOGISTIC_MODEL);
      try {
            this.lmp.saveTo(modelOutput);
      } finally {
            modelOutput.close();
      }

Do you know what can be the problem?

Many thanks,

Svetlomir.
/



Re: LogisticModelParameters#saveTo(OutputStream) generates an empty file

Posted by Lance Norskog <go...@gmail.com>.
However, it would be great to have a browser program that poked around
a Sequence file and summarized the types etc.

On Mon, Jun 6, 2011 at 7:50 AM, Svetlomir Kasabov
<sk...@smail.inf.fh-brs.de> wrote:
> Now I understand, why the model is persisted this way :).
>
> Thanks.
>
>
> Am 06.06.2011 16:45, schrieb Ted Dunning:
>>
>> No.  That only works for toy-sized models.
>>
>> For production scale models, the XML representation can reach hundreds of
>> megabytes.  That isn't human readable in any case, XML or no.  That also
>> utterly kills reload performance.
>>
>> On Mon, Jun 6, 2011 at 7:34 AM, Svetlomir Kasabov<
>> skasab2s@smail.inf.fh-brs.de>  wrote:
>>
>>> Can't we simply use XML encoder to persist the model as XML? :
>>>
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: LogisticModelParameters#saveTo(OutputStream) generates an empty file

Posted by Svetlomir Kasabov <sk...@smail.inf.fh-brs.de>.
Now I understand, why the model is persisted this way :).

Thanks.


Am 06.06.2011 16:45, schrieb Ted Dunning:
> No.  That only works for toy-sized models.
>
> For production scale models, the XML representation can reach hundreds of
> megabytes.  That isn't human readable in any case, XML or no.  That also
> utterly kills reload performance.
>
> On Mon, Jun 6, 2011 at 7:34 AM, Svetlomir Kasabov<
> skasab2s@smail.inf.fh-brs.de>  wrote:
>
>> Can't we simply use XML encoder to persist the model as XML? :
>>


Re: LogisticModelParameters#saveTo(OutputStream) generates an empty file

Posted by Ted Dunning <te...@gmail.com>.
No.  That only works for toy-sized models.

For production scale models, the XML representation can reach hundreds of
megabytes.  That isn't human readable in any case, XML or no.  That also
utterly kills reload performance.

On Mon, Jun 6, 2011 at 7:34 AM, Svetlomir Kasabov <
skasab2s@smail.inf.fh-brs.de> wrote:

> Can't we simply use XML encoder to persist the model as XML? :
>

Re: LogisticModelParameters#saveTo(OutputStream) generates an empty file

Posted by Svetlomir Kasabov <sk...@smail.inf.fh-brs.de>.
Thanks for the reply Ted,

my application is a test application which  predicts the probability 
that a patient has a cancer. I use only two predictors and have only 12 
training examples.

It seems to me that LogisticModelparameters persists the logistic 
regression model as a binary file (sometimes the model consists of many 
unreadable charachters). I also tried ModelSerializer.writeBinary() with 
the same result.

The persisted model for the donut-example looks like this (seems to be 
binary too):

colorynumericxnumeric21?6��C-@I@I?�����+
ic��b��Z����#org.apache.mahout.classifier.sgd.L1@4@4@4@4@4@4@4@4@4@4@�h@4@4@�h@4@4@4@�h@4@4@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B@�B

Can't we simply use XML encoder to persist the model as XML? :
/
FileOutputStream os = new FileOutputStream(LOGISTIC_MODEL+".xml");
XMLEncoder encoder = new XMLEncoder(os);
encoder.writeObject(myLogisticModel)/

This would be much more human-readable :).

Many thanks,

Svetlomir.



Am 06.06.2011 13:57, schrieb Ted Dunning:
> Svetlomir,
>
> Can you say more about your application?
>
> Would it be possible to move to using the ModelSerialization style?  The
> LogisticModelParameters style is fairly limited insofar as what it can do.
>
> On Thu, Jun 2, 2011 at 5:01 PM, Svetlomir Kasabov<
> skasab2s@smail.inf.fh-brs.de>  wrote:
>
>> Hello,
>>
>> since I updated my trunk version of Mahout today, I get an empty file for
>> the model when executing this code:
>>
>> /    OutputStream modelOutput = new FileOutputStream(LOGISTIC_MODEL);
>>      try {
>>            this.lmp.saveTo(modelOutput);
>>      } finally {
>>            modelOutput.close();
>>      }
>>
>> Do you know what can be the problem?
>>
>> Many thanks,
>>
>> Svetlomir.
>> /
>>
>>
>>


Re: LogisticModelParameters#saveTo(OutputStream) generates an empty file

Posted by Ted Dunning <te...@gmail.com>.
Svetlomir,

Can you say more about your application?

Would it be possible to move to using the ModelSerialization style?  The
LogisticModelParameters style is fairly limited insofar as what it can do.

On Thu, Jun 2, 2011 at 5:01 PM, Svetlomir Kasabov <
skasab2s@smail.inf.fh-brs.de> wrote:

> Hello,
>
> since I updated my trunk version of Mahout today, I get an empty file for
> the model when executing this code:
>
> /    OutputStream modelOutput = new FileOutputStream(LOGISTIC_MODEL);
>     try {
>           this.lmp.saveTo(modelOutput);
>     } finally {
>           modelOutput.close();
>     }
>
> Do you know what can be the problem?
>
> Many thanks,
>
> Svetlomir.
> /
>
>
>