Package smile.feature.selection
Record Class SignalNoiseRatio
java.lang.Object
java.lang.Record
smile.feature.selection.SignalNoiseRatio
- Record Components:
feature
- The feature name.ratio
- Signal noise ratio.
- All Implemented Interfaces:
Comparable<SignalNoiseRatio>
public record SignalNoiseRatio(String feature, double ratio)
extends Record
implements Comparable<SignalNoiseRatio>
The signal-to-noise (S2N) metric ratio is a univariate feature ranking metric,
which can be used as a feature selection criterion for binary classification
problems. S2N is defined as |μ1 - μ2| / (σ1 + σ2),
where μ1 and μ2 are the mean value of the variable
in classes 1 and 2, respectively, and σ1 and σ2
are the standard deviations of the variable in classes 1 and 2, respectively.
Clearly, features with larger S2N ratios are better for classification.
References
- M. Shipp, et al. Diffuse large B-cell lymphoma outcome prediction by gene-expression profiling and supervised machine learning. Nature Medicine, 2002.
-
Constructor Summary
ConstructorDescriptionSignalNoiseRatio
(String feature, double ratio) Creates an instance of aSignalNoiseRatio
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(SignalNoiseRatio other) final boolean
Indicates whether some other object is "equal to" this one.feature()
Returns the value of thefeature
record component.static SignalNoiseRatio[]
Calculates the signal noise 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<SignalNoiseRatio>
-
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 signal noise ratio of numeric variables.- Parameters:
data
- the data frame of the explanatory and response variables.clazz
- the column name of binary class labels.- Returns:
- the signal noise 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
-