org.apache.mahout.classifier.sgd
Class ModelSerializer

java.lang.Object
  extended by org.apache.mahout.classifier.sgd.ModelSerializer

public final class ModelSerializer
extends java.lang.Object

Provides the ability to store SGD model-related objects as JSON.


Method Summary
static double[] asArray(com.google.gson.JsonObject v, java.lang.String name)
           
static com.google.gson.Gson gson()
           
static AbstractVectorClassifier loadJsonFrom(java.io.Reader in, java.lang.Class<? extends AbstractVectorClassifier> clazz)
          Reads a model in JSON format.
static void writeJson(java.lang.String path, OnlineLearner model)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

gson

public static com.google.gson.Gson gson()

writeJson

public static void writeJson(java.lang.String path,
                             OnlineLearner model)
                      throws java.io.IOException
Throws:
java.io.IOException

loadJsonFrom

public static AbstractVectorClassifier loadJsonFrom(java.io.Reader in,
                                                    java.lang.Class<? extends AbstractVectorClassifier> clazz)
Reads a model in JSON format.

Parameters:
in - Where to read the model from.
clazz - The class of the object we expect to read.
Returns:
The LogisticModelParameters object that we read.

asArray

public static double[] asArray(com.google.gson.JsonObject v,
                               java.lang.String name)


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.