Class BisectingKMeansModel

All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, BisectingKMeansParams, Params, HasDistanceMeasure, HasFeaturesCol, HasMaxIter, HasPredictionCol, HasSeed, HasWeightCol, HasTrainingSummary<BisectingKMeansSummary>, Identifiable, MLWritable

Model fitted by BisectingKMeans.

param: parentModel a model trained by BisectingKMeans.

See Also:
  • Method Details

    • read

      public static MLReader<BisectingKMeansModel> read()
    • load

      public static BisectingKMeansModel load(String path)
    • k

      public final IntParam k()
      Description copied from interface: BisectingKMeansParams
      The desired number of leaf clusters. Must be &gt; 1. Default: 4. The actual number could be smaller if there are no divisible leaf clusters.
      Specified by:
      k in interface BisectingKMeansParams
      Returns:
      (undocumented)
    • minDivisibleClusterSize

      public final DoubleParam minDivisibleClusterSize()
      Description copied from interface: BisectingKMeansParams
      The minimum number of points (if greater than or equal to 1.0) or the minimum proportion of points (if less than 1.0) of a divisible cluster (default: 1.0).
      Specified by:
      minDivisibleClusterSize in interface BisectingKMeansParams
      Returns:
      (undocumented)
    • weightCol

      public final Param<String> weightCol()
      Description copied from interface: HasWeightCol
      Param for weight column name. If this is not set or empty, we treat all instance weights as 1.0.
      Specified by:
      weightCol in interface HasWeightCol
      Returns:
      (undocumented)
    • distanceMeasure

      public final Param<String> distanceMeasure()
      Description copied from interface: HasDistanceMeasure
      Param for The distance measure. Supported options: 'euclidean' and 'cosine'.
      Specified by:
      distanceMeasure in interface HasDistanceMeasure
      Returns:
      (undocumented)
    • predictionCol

      public final Param<String> predictionCol()
      Description copied from interface: HasPredictionCol
      Param for prediction column name.
      Specified by:
      predictionCol in interface HasPredictionCol
      Returns:
      (undocumented)
    • seed

      public final LongParam seed()
      Description copied from interface: HasSeed
      Param for random seed.
      Specified by:
      seed in interface HasSeed
      Returns:
      (undocumented)
    • featuresCol

      public final Param<String> featuresCol()
      Description copied from interface: HasFeaturesCol
      Param for features column name.
      Specified by:
      featuresCol in interface HasFeaturesCol
      Returns:
      (undocumented)
    • maxIter

      public final IntParam maxIter()
      Description copied from interface: HasMaxIter
      Param for maximum number of iterations (&gt;= 0).
      Specified by:
      maxIter in interface HasMaxIter
      Returns:
      (undocumented)
    • uid

      public String uid()
      Description copied from interface: Identifiable
      An immutable unique ID for the object and its derivatives.
      Specified by:
      uid in interface Identifiable
      Returns:
      (undocumented)
    • numFeatures

      public int numFeatures()
    • copy

      public BisectingKMeansModel copy(ParamMap extra)
      Description copied from interface: Params
      Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. See defaultCopy().
      Specified by:
      copy in interface Params
      Specified by:
      copy in class Model<BisectingKMeansModel>
      Parameters:
      extra - (undocumented)
      Returns:
      (undocumented)
    • setFeaturesCol

      public BisectingKMeansModel setFeaturesCol(String value)
    • setPredictionCol

      public BisectingKMeansModel setPredictionCol(String value)
    • transform

      public Dataset<Row> transform(Dataset<?> dataset)
      Description copied from class: Transformer
      Transforms the input dataset.
      Specified by:
      transform in class Transformer
      Parameters:
      dataset - (undocumented)
      Returns:
      (undocumented)
    • transformSchema

      public StructType transformSchema(StructType schema)
      Description copied from class: PipelineStage
      Check transform validity and derive the output schema from the input schema.

      We check validity for interactions between parameters during transformSchema and raise an exception if any parameter value is invalid. Parameter value checks which do not depend on other parameters are handled by Param.validate().

      Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.

      Specified by:
      transformSchema in class PipelineStage
      Parameters:
      schema - (undocumented)
      Returns:
      (undocumented)
    • predict

      public int predict(Vector features)
    • clusterCenters

      public Vector[] clusterCenters()
    • computeCost

      public double computeCost(Dataset<?> dataset)
      Deprecated.
      This method is deprecated and will be removed in future versions. Use ClusteringEvaluator instead. You can also get the cost on the training dataset in the summary.
      Computes the sum of squared distances between the input points and their corresponding cluster centers.

      Parameters:
      dataset - (undocumented)
      Returns:
      (undocumented)
    • write

      public MLWriter write()
      Description copied from interface: MLWritable
      Returns an MLWriter instance for this ML instance.
      Specified by:
      write in interface MLWritable
      Returns:
      (undocumented)
    • toString

      public String toString()
      Specified by:
      toString in interface Identifiable
      Overrides:
      toString in class Object
    • summary

      public BisectingKMeansSummary summary()
      Gets summary of model on training set. An exception is thrown if hasSummary is false.
      Specified by:
      summary in interface HasTrainingSummary<BisectingKMeansSummary>
      Returns:
      (undocumented)