FeaturesType
- Type of input features. E.g., Vector
M
- Concrete Model typepublic abstract class ProbabilisticClassificationModel<FeaturesType,M extends ProbabilisticClassificationModel<FeaturesType,M>> extends ClassificationModel<FeaturesType,M>
Model produced by a ProbabilisticClassifier
.
Classes are indexed {0, 1, ..., numClasses - 1}.
Constructor and Description |
---|
ProbabilisticClassificationModel() |
Modifier and Type | Method and Description |
---|---|
static Params |
clear(Param<?> param) |
abstract static M |
copy(ParamMap extra) |
static String |
explainParam(Param<?> param) |
static String |
explainParams() |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
static Param<String> |
featuresCol() |
static <T> scala.Option<T> |
get(Param<T> param) |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static String |
getFeaturesCol() |
static String |
getLabelCol() |
static <T> T |
getOrDefault(Param<T> param) |
static Param<Object> |
getParam(String paramName) |
static String |
getPredictionCol() |
static String |
getProbabilityCol() |
static String |
getRawPredictionCol() |
static double[] |
getThresholds() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(String paramName) |
static boolean |
hasParent() |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
static Param<String> |
labelCol() |
static void |
normalizeToProbabilitiesInPlace(DenseVector v)
Normalize a vector of raw predictions to be a multinomial probability vector, in place.
|
abstract static int |
numClasses() |
static int |
numFeatures() |
static Param<?>[] |
params() |
static void |
parent_$eq(Estimator<M> x$1) |
static Estimator<M> |
parent() |
static double |
predict(FeaturesType features) |
static Param<String> |
predictionCol() |
static Param<String> |
probabilityCol() |
static Param<String> |
rawPredictionCol() |
static <T> Params |
set(Param<T> param,
T value) |
static M |
setFeaturesCol(String value) |
static M |
setParent(Estimator<M> parent) |
static M |
setPredictionCol(String value) |
M |
setProbabilityCol(String value) |
static M |
setRawPredictionCol(String value) |
M |
setThresholds(double[] value) |
static DoubleArrayParam |
thresholds() |
static String |
toString() |
Dataset<Row> |
transform(Dataset<?> dataset)
Transforms dataset by reading from
featuresCol , and appending new columns as specified by
parameters:
- predicted labels as predictionCol of type Double
- raw predictions (confidences) as rawPredictionCol of type Vector
- probability of each class as probabilityCol of type Vector . |
static StructType |
transformSchema(StructType schema) |
abstract static String |
uid() |
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType) |
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType)
Validates and transforms the input schema with the provided param map.
|
numClasses, predict, setRawPredictionCol
numFeatures, setFeaturesCol, setPredictionCol, transformSchema
transform, transform, transform
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRawPredictionCol, rawPredictionCol
clear, copy, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString, uid
getProbabilityCol, probabilityCol
getThresholds, thresholds
getLabelCol, labelCol
featuresCol, getFeaturesCol
getPredictionCol, predictionCol
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static void normalizeToProbabilitiesInPlace(DenseVector v)
The input raw predictions should be nonnegative. The output vector sums to 1.
NOTE: This is NOT applicable to all models, only ones which effectively use class instance counts for raw predictions.
v
- (undocumented)IllegalArgumentException
- if the input vector is all-0 or including negative valuespublic abstract static String uid()
public static String toString()
public static Param<?>[] params()
public static String explainParam(Param<?> param)
public static String explainParams()
public static final boolean isSet(Param<?> param)
public static final boolean isDefined(Param<?> param)
public static boolean hasParam(String paramName)
public static Param<Object> getParam(String paramName)
public static final <T> scala.Option<T> get(Param<T> param)
public static final <T> T getOrDefault(Param<T> param)
public static final <T> scala.Option<T> getDefault(Param<T> param)
public static final <T> boolean hasDefault(Param<T> param)
public static final ParamMap extractParamMap()
public static Estimator<M> parent()
public static void parent_$eq(Estimator<M> x$1)
public static M setParent(Estimator<M> parent)
public static boolean hasParent()
public abstract static M copy(ParamMap extra)
public static final Param<String> labelCol()
public static final String getLabelCol()
public static final Param<String> featuresCol()
public static final String getFeaturesCol()
public static final Param<String> predictionCol()
public static final String getPredictionCol()
public static M setFeaturesCol(String value)
public static M setPredictionCol(String value)
public static int numFeatures()
public static StructType transformSchema(StructType schema)
public static final Param<String> rawPredictionCol()
public static final String getRawPredictionCol()
public static M setRawPredictionCol(String value)
public abstract static int numClasses()
public static double predict(FeaturesType features)
public static final Param<String> probabilityCol()
public static final String getProbabilityCol()
public static final DoubleArrayParam thresholds()
public static double[] getThresholds()
public M setProbabilityCol(String value)
public M setThresholds(double[] value)
public Dataset<Row> transform(Dataset<?> dataset)
featuresCol
, and appending new columns as specified by
parameters:
- predicted labels as predictionCol
of type Double
- raw predictions (confidences) as rawPredictionCol
of type Vector
- probability of each class as probabilityCol
of type Vector
.
transform
in class ClassificationModel<FeaturesType,M extends ProbabilisticClassificationModel<FeaturesType,M>>
dataset
- input datasetpublic StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
schema
- input schemafitting
- whether this is in fittingfeaturesDataType
- SQL DataType for FeaturesType.
E.g., VectorUDT
for vector features.