public class ClusteringEvaluator extends Evaluator implements HasPredictionCol, HasFeaturesCol, DefaultParamsWritable
Evaluator for clustering results. The metric computes the Silhouette measure using the specified distance measure.
The Silhouette is a measure for the validation of the consistency within clusters. It ranges between 1 and -1, where a value close to 1 means that the points in a cluster are close to the other points in the same cluster and far from the points of the other clusters.
Constructor and Description |
---|
ClusteringEvaluator() |
ClusteringEvaluator(String uid) |
Modifier and Type | Method and Description |
---|---|
static Params |
clear(Param<?> param) |
ClusteringEvaluator |
copy(ParamMap pMap)
Creates a copy of this instance with the same UID and some extra params.
|
Param<String> |
distanceMeasure()
param for distance measure to be used in evaluation
(supports
"squaredEuclidean" (default), "cosine" ) |
double |
evaluate(Dataset<?> dataset)
Evaluates model output and returns a scalar metric.
|
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) |
String |
getDistanceMeasure() |
static String |
getFeaturesCol() |
String |
getMetricName() |
static <T> T |
getOrDefault(Param<T> param) |
static Param<Object> |
getParam(String paramName) |
static String |
getPredictionCol() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(String paramName) |
static boolean |
isDefined(Param<?> param) |
boolean |
isLargerBetter()
Indicates whether the metric returned by
evaluate should be maximized (true, default)
or minimized (false). |
static boolean |
isSet(Param<?> param) |
static ClusteringEvaluator |
load(String path) |
Param<String> |
metricName()
param for metric name in evaluation
(supports
"silhouette" (default)) |
static Param<?>[] |
params() |
static Param<String> |
predictionCol() |
static void |
save(String path) |
static <T> Params |
set(Param<T> param,
T value) |
ClusteringEvaluator |
setDistanceMeasure(String value) |
ClusteringEvaluator |
setFeaturesCol(String value) |
ClusteringEvaluator |
setMetricName(String value) |
ClusteringEvaluator |
setPredictionCol(String value) |
static String |
toString() |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
static MLWriter |
write() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPredictionCol, predictionCol
featuresCol, getFeaturesCol
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString
write
save
public ClusteringEvaluator(String uid)
public ClusteringEvaluator()
public static ClusteringEvaluator load(String path)
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 final Param<String> predictionCol()
public static final String getPredictionCol()
public static final Param<String> featuresCol()
public static final String getFeaturesCol()
public static void save(String path) throws java.io.IOException
java.io.IOException
public static MLWriter write()
public String uid()
Identifiable
uid
in interface Identifiable
public ClusteringEvaluator copy(ParamMap pMap)
Params
defaultCopy()
.public boolean isLargerBetter()
Evaluator
evaluate
should be maximized (true, default)
or minimized (false).
A given evaluator may support multiple metrics which may be maximized or minimized.isLargerBetter
in class Evaluator
public ClusteringEvaluator setPredictionCol(String value)
public ClusteringEvaluator setFeaturesCol(String value)
public Param<String> metricName()
"silhouette"
(default))public String getMetricName()
public ClusteringEvaluator setMetricName(String value)
public Param<String> distanceMeasure()
"squaredEuclidean"
(default), "cosine"
)public String getDistanceMeasure()
public ClusteringEvaluator setDistanceMeasure(String value)