org.apache.spark.mllib.regression
Class GeneralizedLinearModel

Object
  extended by org.apache.spark.mllib.regression.GeneralizedLinearModel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LassoModel, LinearRegressionModel, LogisticRegressionModel, RidgeRegressionModel, SVMModel

public abstract class GeneralizedLinearModel
extends Object
implements scala.Serializable

:: DeveloperApi :: GeneralizedLinearModel (GLM) represents a model trained using GeneralizedLinearAlgorithm. GLMs consist of a weight vector and an intercept.

param: weights Weights computed for every feature. param: intercept Intercept computed for this model.

See Also:
Serialized Form

Constructor Summary
GeneralizedLinearModel(Vector weights, double intercept)
           
 
Method Summary
 double intercept()
           
 RDD<Object> predict(RDD<Vector> testData)
          Predict values for the given data set using the model trained.
 double predict(Vector testData)
          Predict values for a single data point using the model trained.
 String toString()
          Print a summary of the model.
 Vector weights()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeneralizedLinearModel

public GeneralizedLinearModel(Vector weights,
                              double intercept)
Method Detail

weights

public Vector weights()

intercept

public double intercept()

predict

public RDD<Object> predict(RDD<Vector> testData)
Predict values for the given data set using the model trained.

Parameters:
testData - RDD representing data points to be predicted
Returns:
RDD[Double] where each entry contains the corresponding prediction

predict

public double predict(Vector testData)
Predict values for a single data point using the model trained.

Parameters:
testData - array representing a single data point
Returns:
Double prediction from the trained model

toString

public String toString()
Print a summary of the model.

Overrides:
toString in class Object
Returns:
(undocumented)