Class GeneralizedLinearModel

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

public abstract class GeneralizedLinearModel extends Object implements scala.Serializable
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:
  • Constructor Details

    • GeneralizedLinearModel

      public GeneralizedLinearModel(Vector weights, double intercept)
  • Method Details

    • 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)
    • weights

      public Vector weights()