Class ClassificationModel<FeaturesType,M extends ClassificationModel<FeaturesType,M>>  
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<FeaturesType,M> 
- Type Parameters:
- FeaturesType- Type of input features. E.g.,- Vector
- M- Concrete Model type
- All Implemented Interfaces:
- Serializable,- org.apache.spark.internal.Logging,- ClassifierParams,- Params,- HasFeaturesCol,- HasLabelCol,- HasPredictionCol,- HasRawPredictionCol,- PredictorParams,- Identifiable
- Direct Known Subclasses:
- LinearSVCModel,- ProbabilisticClassificationModel
public abstract class ClassificationModel<FeaturesType,M extends ClassificationModel<FeaturesType,M>>  
extends PredictionModel<FeaturesType,M>
implements ClassifierParams 
Model produced by a 
Classifier.
 Classes are indexed {0, 1, ..., numClasses - 1}.
 - See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.spark.internal.Loggingorg.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract intNumber of classes (values which the label can take).doublepredict(FeaturesType features) Predict label for the given features.abstract VectorpredictRaw(FeaturesType features) Raw prediction for each possible label.Param for raw prediction (a.k.a.setRawPredictionCol(String value) Transforms dataset by reading fromPredictionModel.featuresCol(), and appending new columns as specified by parameters: - predicted labels asPredictionModel.predictionCol()of typeDouble- raw predictions (confidences) asrawPredictionCol()of typeVector.transformImpl(Dataset<?> dataset) transformSchema(StructType schema) Check transform validity and derive the output schema from the input schema.Methods inherited from class org.apache.spark.ml.PredictionModelfeaturesCol, labelCol, numFeatures, predictionCol, setFeaturesCol, setPredictionColMethods inherited from class org.apache.spark.ml.Transformertransform, transform, transformMethods inherited from class org.apache.spark.ml.PipelineStageparamsMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.ml.classification.ClassifierParamsvalidateAndTransformSchemaMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesColfeaturesCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelColgetLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionColgetPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasRawPredictionColgetRawPredictionColMethods inherited from interface org.apache.spark.ml.util.IdentifiabletoString, uidMethods inherited from interface org.apache.spark.internal.LogginginitializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logBasedOnLevel, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, MDC, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContextMethods inherited from interface org.apache.spark.ml.param.Paramsclear, copy, copyValues, defaultCopy, defaultParamMap, estimateMatadataSize, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
- 
Constructor Details- 
ClassificationModelpublic ClassificationModel()
 
- 
- 
Method Details- 
numClassespublic abstract int numClasses()Number of classes (values which the label can take).
- 
predictPredict 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().- Specified by:
- predictin class- PredictionModel<FeaturesType,- M extends ClassificationModel<FeaturesType, - M>> 
- Parameters:
- features- (undocumented)
- Returns:
- (undocumented)
 
- 
predictRawRaw 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 outputrawPredictionCol().- 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.
 
- 
rawPredictionColDescription copied from interface:HasRawPredictionColParam for raw prediction (a.k.a. confidence) column name.- Specified by:
- rawPredictionColin interface- HasRawPredictionCol
- Returns:
- (undocumented)
 
- 
setRawPredictionCol
- 
transformTransforms dataset by reading fromPredictionModel.featuresCol(), and appending new columns as specified by parameters: - predicted labels asPredictionModel.predictionCol()of typeDouble- raw predictions (confidences) asrawPredictionCol()of typeVector.- Overrides:
- transformin class- PredictionModel<FeaturesType,- M extends ClassificationModel<FeaturesType, - M>> 
- Parameters:
- dataset- input dataset
- Returns:
- transformed dataset
 
- 
transformImpl
- 
transformSchemaDescription copied from class:PipelineStageCheck transform validity and derive the output schema from the input schema.We check validity for interactions between parameters during transformSchemaand raise an exception if any parameter value is invalid. Parameter value checks which do not depend on other parameters are handled byParam.validate().Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks. - Overrides:
- transformSchemain class- PredictionModel<FeaturesType,- M extends ClassificationModel<FeaturesType, - M>> 
- Parameters:
- schema- (undocumented)
- Returns:
- (undocumented)
 
 
-