SelectKBest
#include <Skigen/FeatureSelection>
template <typename Scalar = double, typename ScoreFn = feature_selection::FClassif<Scalar>>
class Skigen::SelectKBest(score_func=ScoreFn{}, k=10)
Select features according to the k highest scores.
Mirrors sklearn.feature_selection.SelectKBest.
Attributes:
-
k : int
-
scores : RowVectorType
-
pvalues : RowVectorType
-
get_support_mask : BoolMaskType
-
get_support_indices : Eigen::VectorXi
Methods
get_support()
fit(X, y)
Fit using a classification target (integer labels).
fit(X, y)
Fit using a regression target (continuous values).
fit(X, y)
Fit using a sparse design matrix and a classification target.
Only compiles when the configured ScoreFn provides a sparse operator() overload — currently Chi2 (and any user-supplied score function with the same shape). For FClassif and FRegression, the sparse path is a not implemented and a compile error.
transform(X)
Transform a sparse design matrix to keep only the top-k columns.