Package com.apple.foundationdb.kmeans
Record Class PartitionEvaluator.PartitionStats
java.lang.Object
java.lang.Record
com.apple.foundationdb.kmeans.PartitionEvaluator.PartitionStats
- Record Components:
k- number of clusters in this partitioningsse- total sum of squared distances from each vector to its assigned centroidimbalance- 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.NaNwhenk < 2largestFrac- fraction of all vectors assigned to the largest clustersmallestFrac- fraction of all vectors assigned to the smallest clustermaxRadius95- 95th percentile of assigned distances across all clusters; used as a scale reference for margin thresholdsmedianMargin- 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.NaNwhenk < 2p10Margin- 10th percentile of assignment margins; low values indicate many vectors near cluster boundaries;Double.NaNwhenk < 2lowMarginRate- fraction of vectors whose assignment margin falls below the configured threshold;0.0whenk < 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
ConstructorsConstructorDescriptionPartitionStats(int k, double sse, double imbalance, double separation, double largestFrac, double smallestFrac, double maxRadius95, double medianMargin, double p10Margin, double lowMarginRate) Creates an instance of aPartitionStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of theimbalancerecord component.intk()Returns the value of thekrecord component.doubleReturns the value of thelargestFracrecord component.voidLogs every component of these stats at debug level, prefixed withmessagePrefix.doubleReturns the value of thelowMarginRaterecord component.doubleReturns the value of themaxRadius95record component.doubleReturns the value of themedianMarginrecord component.doubleReturns the value of thep10Marginrecord component.doubleReturns the value of theseparationrecord component.doubleReturns the value of thesmallestFracrecord component.doublesse()Returns the value of thesserecord component.final StringtoString()Returns a string representation of this record class.
-
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 aPartitionStatsrecord class.- Parameters:
k- the value for thekrecord componentsse- the value for thesserecord componentimbalance- the value for theimbalancerecord componentseparation- the value for theseparationrecord componentlargestFrac- the value for thelargestFracrecord componentsmallestFrac- the value for thesmallestFracrecord componentmaxRadius95- the value for themaxRadius95record componentmedianMargin- the value for themedianMarginrecord componentp10Margin- the value for thep10Marginrecord componentlowMarginRate- the value for thelowMarginRaterecord component
-
-
Method Details
-
log
Logs every component of these stats at debug level, prefixed withmessagePrefix. No-op when debug logging is disabled onlogger.- Parameters:
logger- the SLF4J logger to write tomessagePrefix- free-form prefix prepended to the structured log line
-
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. -
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. -
equals
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 '=='. -
k
public int k()Returns the value of thekrecord component.- Returns:
- the value of the
krecord component
-
sse
public double sse()Returns the value of thesserecord component.- Returns:
- the value of the
sserecord component
-
imbalance
public double imbalance()Returns the value of theimbalancerecord component.- Returns:
- the value of the
imbalancerecord component
-
separation
public double separation()Returns the value of theseparationrecord component.- Returns:
- the value of the
separationrecord component
-
largestFrac
public double largestFrac()Returns the value of thelargestFracrecord component.- Returns:
- the value of the
largestFracrecord component
-
smallestFrac
public double smallestFrac()Returns the value of thesmallestFracrecord component.- Returns:
- the value of the
smallestFracrecord component
-
maxRadius95
public double maxRadius95()Returns the value of themaxRadius95record component.- Returns:
- the value of the
maxRadius95record component
-
medianMargin
public double medianMargin()Returns the value of themedianMarginrecord component.- Returns:
- the value of the
medianMarginrecord component
-
p10Margin
public double p10Margin()Returns the value of thep10Marginrecord component.- Returns:
- the value of the
p10Marginrecord component
-
lowMarginRate
public double lowMarginRate()Returns the value of thelowMarginRaterecord component.- Returns:
- the value of the
lowMarginRaterecord component
-