Class LinearSVCModel
Object
org.apache.spark.ml.PipelineStage
org.apache.spark.ml.Transformer
org.apache.spark.ml.Model<M>
org.apache.spark.ml.PredictionModel<FeaturesType,M>
org.apache.spark.ml.classification.ClassificationModel<Vector,LinearSVCModel>
org.apache.spark.ml.classification.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
public class LinearSVCModel
extends ClassificationModel<Vector,LinearSVCModel>
implements LinearSVCParams, MLWritable, HasTrainingSummary<LinearSVCTrainingSummary>
Linear SVM Model trained by
LinearSVC- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging
org.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter -
Method Summary
Modifier and TypeMethodDescriptionfinal IntParamParam for suggested depth for treeAggregate (>= 2).Creates a copy of this instance with the same UID and some extra params.Evaluates the model on a test dataset.final BooleanParamParam for whether to fit an intercept term.doublestatic LinearSVCModelfinal DoubleParamParam for Maximum memory in MB for stacking input data into blocks.final IntParammaxIter()Param for maximum number of iterations (>= 0).intNumber of classes (values which the label can take).intReturns the number of features the model was trained on.doublePredict label for the given features.predictRaw(Vector features) Raw prediction for each possible label.static MLReader<LinearSVCModel>read()final DoubleParamregParam()Param for regularization parameter (>= 0).setThreshold(double value) final BooleanParamParam for whether to standardize the training features before fitting the model.summary()Gets summary of model on training set.final DoubleParamParam for threshold in binary classification prediction.final DoubleParamtol()Param for the convergence tolerance for iterative algorithms (>= 0).toString()uid()An immutable unique ID for the object and its derivatives.Param for weight column name.write()Returns anMLWriterinstance for this ML instance.Methods inherited from class org.apache.spark.ml.classification.ClassificationModel
rawPredictionCol, setRawPredictionCol, transform, transformImpl, transformSchemaMethods inherited from class org.apache.spark.ml.PredictionModel
featuresCol, labelCol, predictionCol, setFeaturesCol, setPredictionColMethods inherited from class org.apache.spark.ml.Transformer
transform, transform, transformMethods inherited from class org.apache.spark.ml.PipelineStage
paramsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.spark.ml.classification.ClassifierParams
validateAndTransformSchemaMethods inherited from interface org.apache.spark.ml.param.shared.HasAggregationDepth
getAggregationDepthMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesCol
featuresCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasFitIntercept
getFitInterceptMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelCol
getLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxBlockSizeInMB
getMaxBlockSizeInMBMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxIter
getMaxIterMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionCol
getPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasRawPredictionCol
getRawPredictionCol, rawPredictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasRegParam
getRegParamMethods inherited from interface org.apache.spark.ml.param.shared.HasStandardization
getStandardizationMethods inherited from interface org.apache.spark.ml.param.shared.HasThreshold
getThresholdMethods inherited from interface org.apache.spark.ml.util.HasTrainingSummary
hasSummary, setSummaryMethods inherited from interface org.apache.spark.ml.param.shared.HasWeightCol
getWeightColMethods inherited from interface org.apache.spark.internal.Logging
initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContextMethods inherited from interface org.apache.spark.ml.util.MLWritable
saveMethods inherited from interface org.apache.spark.ml.param.Params
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
-
Method Details
-
read
-
load
-
threshold
Description copied from interface:LinearSVCParamsParam 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:
thresholdin interfaceHasThreshold- Specified by:
thresholdin interfaceLinearSVCParams- Returns:
- (undocumented)
-
maxBlockSizeInMB
Description copied from interface:HasMaxBlockSizeInMBParam 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 >= 0..- Specified by:
maxBlockSizeInMBin interfaceHasMaxBlockSizeInMB- Returns:
- (undocumented)
-
aggregationDepth
Description copied from interface:HasAggregationDepthParam for suggested depth for treeAggregate (>= 2).- Specified by:
aggregationDepthin interfaceHasAggregationDepth- Returns:
- (undocumented)
-
weightCol
Description copied from interface:HasWeightColParam for weight column name. If this is not set or empty, we treat all instance weights as 1.0.- Specified by:
weightColin interfaceHasWeightCol- Returns:
- (undocumented)
-
standardization
Description copied from interface:HasStandardizationParam for whether to standardize the training features before fitting the model.- Specified by:
standardizationin interfaceHasStandardization- Returns:
- (undocumented)
-
tol
Description copied from interface:HasTolParam for the convergence tolerance for iterative algorithms (>= 0). -
fitIntercept
Description copied from interface:HasFitInterceptParam for whether to fit an intercept term.- Specified by:
fitInterceptin interfaceHasFitIntercept- Returns:
- (undocumented)
-
maxIter
Description copied from interface:HasMaxIterParam for maximum number of iterations (>= 0).- Specified by:
maxIterin interfaceHasMaxIter- Returns:
- (undocumented)
-
regParam
Description copied from interface:HasRegParamParam for regularization parameter (>= 0).- Specified by:
regParamin interfaceHasRegParam- Returns:
- (undocumented)
-
uid
Description copied from interface:IdentifiableAn immutable unique ID for the object and its derivatives.- Specified by:
uidin interfaceIdentifiable- Returns:
- (undocumented)
-
coefficients
-
intercept
public double intercept() -
numClasses
public int numClasses()Description copied from class:ClassificationModelNumber of classes (values which the label can take).- Specified by:
numClassesin classClassificationModel<Vector,LinearSVCModel>
-
numFeatures
public int numFeatures()Description copied from class:PredictionModelReturns the number of features the model was trained on. If unknown, returns -1- Overrides:
numFeaturesin classPredictionModel<Vector,LinearSVCModel>
-
setThreshold
-
summary
Gets summary of model on training set. An exception is thrown ifhasSummaryis false.- Specified by:
summaryin interfaceHasTrainingSummary<LinearSVCTrainingSummary>- Returns:
- (undocumented)
-
evaluate
Evaluates the model on a test dataset.- Parameters:
dataset- Test dataset to evaluate model on.- Returns:
- (undocumented)
-
predict
Description copied from class:ClassificationModelPredict label for the given features. This method is used to implementtransform()and outputPredictionModel.predictionCol().This default implementation for classification predicts the index of the maximum value from
predictRaw().- Overrides:
predictin classClassificationModel<Vector,LinearSVCModel> - Parameters:
features- (undocumented)- Returns:
- (undocumented)
-
predictRaw
Description copied from class:ClassificationModelRaw 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 implementtransform()and outputClassificationModel.rawPredictionCol().- Specified by:
predictRawin classClassificationModel<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
Description copied from interface:ParamsCreates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. SeedefaultCopy().- Specified by:
copyin interfaceParams- Specified by:
copyin classModel<LinearSVCModel>- Parameters:
extra- (undocumented)- Returns:
- (undocumented)
-
write
Description copied from interface:MLWritableReturns anMLWriterinstance for this ML instance.- Specified by:
writein interfaceMLWritable- Returns:
- (undocumented)
-
toString
- Specified by:
toStringin interfaceIdentifiable- Overrides:
toStringin classObject
-