Class SVMModel

Object
org.apache.spark.mllib.regression.GeneralizedLinearModel
org.apache.spark.mllib.classification.SVMModel
All Implemented Interfaces:
Serializable, ClassificationModel, PMMLExportable, Saveable

Model for Support Vector Machines (SVMs).

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

See Also:
  • Constructor Details

    • SVMModel

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

    • load

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

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

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

      public SVMModel setThreshold(double threshold)
      Sets the threshold that separates positive predictions from negative predictions. An example with prediction score greater than or equal to this threshold is identified as a positive, and negative otherwise. The default value is 0.0.
      Parameters:
      threshold - (undocumented)
      Returns:
      (undocumented)
    • getThreshold

      public scala.Option<Object> getThreshold()
      Returns the threshold (if any) used for converting raw prediction scores into 0/1 predictions.
      Returns:
      (undocumented)
    • clearThreshold

      public SVMModel clearThreshold()
      Clears the threshold so that predict will output raw prediction scores.
      Returns:
      (undocumented)
    • 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.
    • toString

      public String toString()
      Description copied from class: GeneralizedLinearModel
      Print a summary of the model.
      Overrides:
      toString in class GeneralizedLinearModel
      Returns:
      (undocumented)