Class LinearRegressionModel

Object
org.apache.spark.mllib.regression.GeneralizedLinearModel
org.apache.spark.mllib.regression.LinearRegressionModel
All Implemented Interfaces:
Serializable, PMMLExportable, RegressionModel, Saveable, scala.Serializable

public class LinearRegressionModel extends GeneralizedLinearModel implements RegressionModel, scala.Serializable, Saveable, PMMLExportable
Regression model trained using LinearRegression.

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

See Also:
  • Constructor Details

    • LinearRegressionModel

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

    • load

      public static LinearRegressionModel load(SparkContext sc, String path)
    • weights

      public Vector weights()
      Overrides:
      weights in class GeneralizedLinearModel
    • intercept

      public double intercept()
      Overrides:
      intercept in class GeneralizedLinearModel
    • save

      public void save(SparkContext sc, String path)
      Description copied from interface: Saveable
      Save this model to the given path.

      This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/

      The model may be loaded using Loader.load.

      Specified by:
      save in interface Saveable
      Parameters:
      sc - Spark context used to save model data.
      path - Path specifying the directory in which to save this model. If the directory already exists, this method throws an exception.