Class LinearSVCModel

All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, ClassifierParams, LinearSVCParams, Params, HasAggregationDepth, HasFeaturesCol, HasFitIntercept, HasLabelCol, HasMaxBlockSizeInMB, HasMaxIter, HasPredictionCol, HasRawPredictionCol, HasRegParam, HasStandardization, HasThreshold, HasTol, HasWeightCol, PredictorParams, HasTrainingSummary<LinearSVCTrainingSummary>, Identifiable, MLWritable, scala.Serializable

Linear SVM Model trained by LinearSVC
See Also:
  • Method Details

    • read

      public static MLReader<LinearSVCModel> read()
    • load

      public static LinearSVCModel load(String path)
    • threshold

      public final DoubleParam threshold()
      Description copied from interface: LinearSVCParams
      Param for threshold in binary classification prediction. For LinearSVC, this threshold is applied to the rawPrediction, rather than a probability. This threshold can be any real number, where Inf will make all predictions 0.0 and -Inf will make all predictions 1.0. Default: 0.0

      Specified by:
      threshold in interface HasThreshold
      Specified by:
      threshold in interface LinearSVCParams
      Returns:
      (undocumented)
    • maxBlockSizeInMB

      public final DoubleParam maxBlockSizeInMB()
      Description copied from interface: HasMaxBlockSizeInMB
      Param for Maximum memory in MB for stacking input data into blocks. Data is stacked within partitions. If more than remaining data size in a partition then it is adjusted to the data size. Default 0.0 represents choosing optimal value, depends on specific algorithm. Must be &gt;= 0..
      Specified by:
      maxBlockSizeInMB in interface HasMaxBlockSizeInMB
      Returns:
      (undocumented)
    • aggregationDepth

      public final IntParam aggregationDepth()
      Description copied from interface: HasAggregationDepth
      Param for suggested depth for treeAggregate (&gt;= 2).
      Specified by:
      aggregationDepth in interface HasAggregationDepth
      Returns:
      (undocumented)
    • weightCol

      public final Param<String> weightCol()
      Description copied from interface: HasWeightCol
      Param for weight column name. If this is not set or empty, we treat all instance weights as 1.0.
      Specified by:
      weightCol in interface HasWeightCol
      Returns:
      (undocumented)
    • standardization

      public final BooleanParam standardization()
      Description copied from interface: HasStandardization
      Param for whether to standardize the training features before fitting the model.
      Specified by:
      standardization in interface HasStandardization
      Returns:
      (undocumented)
    • tol

      public final DoubleParam tol()
      Description copied from interface: HasTol
      Param for the convergence tolerance for iterative algorithms (&gt;= 0).
      Specified by:
      tol in interface HasTol
      Returns:
      (undocumented)
    • fitIntercept

      public final BooleanParam fitIntercept()
      Description copied from interface: HasFitIntercept
      Param for whether to fit an intercept term.
      Specified by:
      fitIntercept in interface HasFitIntercept
      Returns:
      (undocumented)
    • maxIter

      public final IntParam maxIter()
      Description copied from interface: HasMaxIter
      Param for maximum number of iterations (&gt;= 0).
      Specified by:
      maxIter in interface HasMaxIter
      Returns:
      (undocumented)
    • regParam

      public final DoubleParam regParam()
      Description copied from interface: HasRegParam
      Param for regularization parameter (&gt;= 0).
      Specified by:
      regParam in interface HasRegParam
      Returns:
      (undocumented)
    • uid

      public String uid()
      Description copied from interface: Identifiable
      An immutable unique ID for the object and its derivatives.
      Specified by:
      uid in interface Identifiable
      Returns:
      (undocumented)
    • coefficients

      public Vector coefficients()
    • intercept

      public double intercept()
    • numClasses

      public int numClasses()
      Description copied from class: ClassificationModel
      Number of classes (values which the label can take).
      Specified by:
      numClasses in class ClassificationModel<Vector,LinearSVCModel>
    • numFeatures

      public int numFeatures()
      Description copied from class: PredictionModel
      Returns the number of features the model was trained on. If unknown, returns -1
      Overrides:
      numFeatures in class PredictionModel<Vector,LinearSVCModel>
    • setThreshold

      public LinearSVCModel setThreshold(double value)
    • summary

      public LinearSVCTrainingSummary summary()
      Gets summary of model on training set. An exception is thrown if hasSummary is false.
      Specified by:
      summary in interface HasTrainingSummary<LinearSVCTrainingSummary>
      Returns:
      (undocumented)
    • evaluate

      public LinearSVCSummary evaluate(Dataset<?> dataset)
      Evaluates the model on a test dataset.

      Parameters:
      dataset - Test dataset to evaluate model on.
      Returns:
      (undocumented)
    • predict

      public double predict(Vector features)
      Description copied from class: ClassificationModel
      Predict label for the given features. This method is used to implement transform() and output PredictionModel.predictionCol().

      This default implementation for classification predicts the index of the maximum value from predictRaw().

      Overrides:
      predict in class ClassificationModel<Vector,LinearSVCModel>
      Parameters:
      features - (undocumented)
      Returns:
      (undocumented)
    • predictRaw

      public Vector predictRaw(Vector features)
      Description copied from class: ClassificationModel
      Raw prediction for each possible label. The meaning of a "raw" prediction may vary between algorithms, but it intuitively gives a measure of confidence in each possible label (where larger = more confident). This internal method is used to implement transform() and output ClassificationModel.rawPredictionCol().

      Specified by:
      predictRaw in class ClassificationModel<Vector,LinearSVCModel>
      Parameters:
      features - (undocumented)
      Returns:
      vector where element i is the raw prediction for label i. This raw prediction may be any real number, where a larger value indicates greater confidence for that label.
    • copy

      public LinearSVCModel copy(ParamMap extra)
      Description copied from interface: Params
      Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. See defaultCopy().
      Specified by:
      copy in interface Params
      Specified by:
      copy in class Model<LinearSVCModel>
      Parameters:
      extra - (undocumented)
      Returns:
      (undocumented)
    • write

      public MLWriter write()
      Description copied from interface: MLWritable
      Returns an MLWriter instance for this ML instance.
      Specified by:
      write in interface MLWritable
      Returns:
      (undocumented)
    • toString

      public String toString()
      Specified by:
      toString in interface Identifiable
      Overrides:
      toString in class Object