mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svetlomir Kasabov <skasa...@smail.inf.fh-brs.de>
Subject Logistic Regression + non-CSV examples
Date Thu, 02 Jun 2011 19:55:26 GMT
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.










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