Package smile.feature.selection
Record Class SumSquaresRatio
java.lang.Object
java.lang.Record
smile.feature.selection.SumSquaresRatio
- Record Components:
feature
- The feature name.ratio
- Sum squares ratio.
- All Implemented Interfaces:
Comparable<SumSquaresRatio>
public record SumSquaresRatio(String feature, double ratio)
extends Record
implements Comparable<SumSquaresRatio>
The ratio of between-groups to within-groups sum of squares is a univariate
feature ranking metric, which can be used as a feature selection criterion
for multi-class classification problems. For each variable j, this ratio is
BSS(j) / WSS(j) = ΣI(yi = k)(xkj - x·j)2 / ΣI(yi = k)(xij - xkj)2;
where x·j denotes the average of variable j across all
samples, xkj denotes the average of variable j across samples
belonging to class k, and xij is the value of variable j of sample i.
Clearly, features with larger sum squares ratios are better for classification.
References
- S. Dudoit, J. Fridlyand and T. Speed. Comparison of discrimination methods for the classification of tumors using gene expression data. J Am Stat Assoc, 97:77-87, 2002.
-
Constructor Summary
ConstructorDescriptionSumSquaresRatio
(String feature, double ratio) Creates an instance of aSumSquaresRatio
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(SumSquaresRatio other) final boolean
Indicates whether some other object is "equal to" this one.feature()
Returns the value of thefeature
record component.static SumSquaresRatio[]
Calculates the sum squares ratio of numeric variables.final int
hashCode()
Returns a hash code value for this object.double
ratio()
Returns the value of theratio
record component.toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<SumSquaresRatio>
-
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. -
fit
Calculates the sum squares ratio of numeric variables.- Parameters:
data
- the data frame of the explanatory and response variables.clazz
- the column name of class labels.- Returns:
- the sum squares ratio.
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
feature
Returns the value of thefeature
record component.- Returns:
- the value of the
feature
record component
-
ratio
public double ratio()Returns the value of theratio
record component.- Returns:
- the value of the
ratio
record component
-