Record Class PartitionEvaluator.PartitionStats

java.lang.Object
java.lang.Record
com.apple.foundationdb.kmeans.PartitionEvaluator.PartitionStats
Record Components:
k - number of clusters in this partitioning
sse - total sum of squared distances from each vector to its assigned centroid
imbalance - measure of how unevenly vectors are distributed across clusters (0 = perfectly balanced)
separation - average inter-centroid distance normalized by cluster radii; higher values indicate better-separated clusters; Double.NaN when k < 2
largestFrac - fraction of all vectors assigned to the largest cluster
smallestFrac - fraction of all vectors assigned to the smallest cluster
maxRadius95 - 95th percentile of assigned distances across all clusters; used as a scale reference for margin thresholds
medianMargin - median assignment margin across all vectors; the margin is the difference between a vector's distance to its second-nearest centroid and its nearest centroid; Double.NaN when k < 2
p10Margin - 10th percentile of assignment margins; low values indicate many vectors near cluster boundaries; Double.NaN when k < 2
lowMarginRate - fraction of vectors whose assignment margin falls below the configured threshold; 0.0 when k < 2
Enclosing class:
PartitionEvaluator

public static record PartitionEvaluator.PartitionStats(int k, double sse, double imbalance, double separation, double largestFrac, double smallestFrac, double maxRadius95, double medianMargin, double p10Margin, double lowMarginRate) extends Record
Quality statistics computed for a partitioning (current or candidate). Used by the evaluator to decide whether a candidate repartitioning improves upon the current layout.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PartitionStats(int k, double sse, double imbalance, double separation, double largestFrac, double smallestFrac, double maxRadius95, double medianMargin, double p10Margin, double lowMarginRate)
    Creates an instance of a PartitionStats record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the imbalance record component.
    int
    k()
    Returns the value of the k record component.
    double
    Returns the value of the largestFrac record component.
    void
    log(org.slf4j.Logger logger, String messagePrefix)
    Logs every component of these stats at debug level, prefixed with messagePrefix.
    double
    Returns the value of the lowMarginRate record component.
    double
    Returns the value of the maxRadius95 record component.
    double
    Returns the value of the medianMargin record component.
    double
    Returns the value of the p10Margin record component.
    double
    Returns the value of the separation record component.
    double
    Returns the value of the smallestFrac record component.
    double
    sse()
    Returns the value of the sse record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PartitionStats

      public PartitionStats(int k, double sse, double imbalance, double separation, double largestFrac, double smallestFrac, double maxRadius95, double medianMargin, double p10Margin, double lowMarginRate)
      Creates an instance of a PartitionStats record class.
      Parameters:
      k - the value for the k record component
      sse - the value for the sse record component
      imbalance - the value for the imbalance record component
      separation - the value for the separation record component
      largestFrac - the value for the largestFrac record component
      smallestFrac - the value for the smallestFrac record component
      maxRadius95 - the value for the maxRadius95 record component
      medianMargin - the value for the medianMargin record component
      p10Margin - the value for the p10Margin record component
      lowMarginRate - the value for the lowMarginRate record component
  • Method Details

    • log

      public void log(@Nonnull org.slf4j.Logger logger, @Nonnull String messagePrefix)
      Logs every component of these stats at debug level, prefixed with messagePrefix. No-op when debug logging is disabled on logger.
      Parameters:
      logger - the SLF4J logger to write to
      messagePrefix - free-form prefix prepended to the structured log line
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • k

      public int k()
      Returns the value of the k record component.
      Returns:
      the value of the k record component
    • sse

      public double sse()
      Returns the value of the sse record component.
      Returns:
      the value of the sse record component
    • imbalance

      public double imbalance()
      Returns the value of the imbalance record component.
      Returns:
      the value of the imbalance record component
    • separation

      public double separation()
      Returns the value of the separation record component.
      Returns:
      the value of the separation record component
    • largestFrac

      public double largestFrac()
      Returns the value of the largestFrac record component.
      Returns:
      the value of the largestFrac record component
    • smallestFrac

      public double smallestFrac()
      Returns the value of the smallestFrac record component.
      Returns:
      the value of the smallestFrac record component
    • maxRadius95

      public double maxRadius95()
      Returns the value of the maxRadius95 record component.
      Returns:
      the value of the maxRadius95 record component
    • medianMargin

      public double medianMargin()
      Returns the value of the medianMargin record component.
      Returns:
      the value of the medianMargin record component
    • p10Margin

      public double p10Margin()
      Returns the value of the p10Margin record component.
      Returns:
      the value of the p10Margin record component
    • lowMarginRate

      public double lowMarginRate()
      Returns the value of the lowMarginRate record component.
      Returns:
      the value of the lowMarginRate record component