mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hector Yee <hector....@gmail.com>
Subject Re: Logistic Regression + non-CSV examples
Date Thu, 02 Jun 2011 19:57:03 GMT
You can look at the unit test to see how it does it and create a Matrix
object directly for training.

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

> Hello,
>
> I have looked at the donut-example for Logistic Regression and have
> noticed, that a CSV file is used for the training and the test examples. My
> problem is, that my test examples are usually POJOs ( Plain Old Java
> Objects, which have usually nothing to do with the CSV format). In other
> words, I need to simulate this code for probability calculation without
> using CSV:
>
> /LogisticModelParameters lmp = LogisticModelParameters.loadFrom(new
> File(LOGISTIC_MODEL_PATH));
> CsvRecordFactory csv = lmp.getCsvRecordFactory();
> OnlineLogisticRegression lr = lmp.createRegression();
> ...
> Vector v = new SequentialAccessSparseVector(lmp.getNumFeatures());
> int target = csv.processLine(line, v); //here 'line is the entry from the
> CSV file'
> double score = lr.classifyScalar(v);
> /
>
> Is there a way to do this? Can you please provide some sample code?
>
> Thanks a lot and best regards.
>
> Svetlomir.
>
>
>
>
>
>
>
>
>
>


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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message