public class BisectingKMeansModel extends java.lang.Object implements scala.Serializable, Saveable
BisectingKMeans
.
The prediction is done level-by-level from the root node to a leaf node, and at each node among
its children the closest to the input point is selected.
param: root the root node of the clustering tree
Modifier and Type | Class and Description |
---|---|
static class |
BisectingKMeansModel.SaveLoadV1_0$ |
Modifier and Type | Method and Description |
---|---|
Vector[] |
clusterCenters()
Leaf cluster centers.
|
double |
computeCost(JavaRDD<Vector> data)
Java-friendly version of
computeCost() . |
double |
computeCost(RDD<Vector> data)
Computes the sum of squared distances between the input points and their corresponding cluster
centers.
|
double |
computeCost(Vector point)
Computes the squared distance between the input point and the cluster center it belongs to.
|
protected java.lang.String |
formatVersion()
Current version of model save/load format.
|
protected static void |
initializeLogIfNecessary(boolean isInterpreter) |
protected static boolean |
isTraceEnabled() |
int |
k()
Number of leaf clusters.
|
static BisectingKMeansModel |
load(SparkContext sc,
java.lang.String path) |
protected static org.slf4j.Logger |
log() |
protected static void |
logDebug(scala.Function0<java.lang.String> msg) |
protected static void |
logDebug(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logError(scala.Function0<java.lang.String> msg) |
protected static void |
logError(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg) |
protected static void |
logInfo(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static java.lang.String |
logName() |
protected static void |
logTrace(scala.Function0<java.lang.String> msg) |
protected static void |
logTrace(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg) |
protected static void |
logWarning(scala.Function0<java.lang.String> msg,
java.lang.Throwable throwable) |
JavaRDD<java.lang.Integer> |
predict(JavaRDD<Vector> points)
Java-friendly version of
predict() . |
RDD<java.lang.Object> |
predict(RDD<Vector> points)
Predicts the indices of the clusters that the input points belong to.
|
int |
predict(Vector point)
Predicts the index of the cluster that the input point belongs to.
|
void |
save(SparkContext sc,
java.lang.String path)
Save this model to the given path.
|
public static BisectingKMeansModel load(SparkContext sc, java.lang.String path)
protected static java.lang.String logName()
protected static org.slf4j.Logger log()
protected static void logInfo(scala.Function0<java.lang.String> msg)
protected static void logDebug(scala.Function0<java.lang.String> msg)
protected static void logTrace(scala.Function0<java.lang.String> msg)
protected static void logWarning(scala.Function0<java.lang.String> msg)
protected static void logError(scala.Function0<java.lang.String> msg)
protected static void logInfo(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logDebug(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logTrace(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logWarning(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static void logError(scala.Function0<java.lang.String> msg, java.lang.Throwable throwable)
protected static boolean isTraceEnabled()
protected static void initializeLogIfNecessary(boolean isInterpreter)
public Vector[] clusterCenters()
public int k()
public int predict(Vector point)
point
- (undocumented)public RDD<java.lang.Object> predict(RDD<Vector> points)
points
- (undocumented)public JavaRDD<java.lang.Integer> predict(JavaRDD<Vector> points)
predict()
.points
- (undocumented)public double computeCost(Vector point)
point
- (undocumented)public double computeCost(RDD<Vector> data)
data
- (undocumented)public double computeCost(JavaRDD<Vector> data)
computeCost()
.data
- (undocumented)public void save(SparkContext sc, java.lang.String path)
Saveable
This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load
.
protected java.lang.String formatVersion()
Saveable
formatVersion
in interface Saveable