You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Toni Cebrián <an...@gmail.com> on 2013/04/24 08:54:45 UTC

Problem when reading serialized model

Hi,

    I'm training a logistic model with the command line utility. Here you
can see that command line:

$MAHOUT_DIR/bin/mahout trainlogistic --input train_data.txt --output
model.out --target offer_installed --categories 2 --predictors country
browser_language os_version --types word --rate 1 --features 10000 --lambda
0.003

The training goes smoothly and then I try to read the model.out using
ModelSerializer with these two lines of code:

        FileInputStream fis = new
FileInputStream("src/test/resources/utils/model.out");
        OnlineLogisticRegression model = ModelSerializer.readBinary(fis,
OnlineLogisticRegression.class);

But then, I get a Java exception saying that it doesn't know which class
offer_installed is (the predicted variable).

Here you have the stack trace as reference:

    java.lang.IllegalStateException: java.lang.ClassNotFoundException:
offer_installed
    at org.apache.mahout.common.ClassUtils.instantiateAs(ClassUtils.java:30)
    at
org.apache.mahout.classifier.sgd.PolymorphicWritable.read(PolymorphicWritable.java:42)
    at
org.apache.mahout.classifier.sgd.ModelSerializer.readBinary(ModelSerializer.java:69)
    at
com.softonic.sd.LogisticProxyTest.testCreateFeatures(LogisticProxyTest.java:106)
     ........

Am I missing some extra step or configuration?
Thanks