Documentation
¶
Overview ¶
Package selectors provides feature selection transformers.
Index ¶
- type RFE
- func (r *RFE) Fit(df *dataframe.DataFrame, target ...string) error
- func (r *RFE) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
- func (r *RFE) GetSelectedFeatures() []string
- func (r *RFE) IsFitted() bool
- func (r *RFE) Transform(df *dataframe.DataFrame) (*dataframe.DataFrame, error)
- type SelectKBest
- func (s *SelectKBest) Fit(df *dataframe.DataFrame, target ...string) error
- func (s *SelectKBest) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
- func (s *SelectKBest) GetScores() map[string]float64
- func (s *SelectKBest) GetSelectedFeatures() []string
- func (s *SelectKBest) IsFitted() bool
- func (s *SelectKBest) Transform(df *dataframe.DataFrame) (*dataframe.DataFrame, error)
- type SelectPercentile
- func (s *SelectPercentile) Fit(df *dataframe.DataFrame, target ...string) error
- func (s *SelectPercentile) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
- func (s *SelectPercentile) GetSelectedFeatures() []string
- func (s *SelectPercentile) IsFitted() bool
- func (s *SelectPercentile) Transform(df *dataframe.DataFrame) (*dataframe.DataFrame, error)
- type VarianceThreshold
- func (v *VarianceThreshold) Fit(df *dataframe.DataFrame, _ ...string) error
- func (v *VarianceThreshold) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
- func (v *VarianceThreshold) GetSelectedFeatures() []string
- func (v *VarianceThreshold) IsFitted() bool
- func (v *VarianceThreshold) Transform(df *dataframe.DataFrame) (*dataframe.DataFrame, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RFE ¶
type RFE struct {
// NFeatures is the number of features to select
NFeatures int
// Step is the number of features to remove at each iteration
Step int
// contains filtered or unexported fields
}
RFE (Recursive Feature Elimination) selects features by recursively removing the least important features. Uses correlation with target and mutual feature redundancy for importance scoring.
func (*RFE) FitTransform ¶
FitTransform fits the selector and transforms the data in one step.
func (*RFE) GetSelectedFeatures ¶
GetSelectedFeatures returns the list of selected feature names.
type SelectKBest ¶
type SelectKBest struct {
// K is the number of features to select
K int
// contains filtered or unexported fields
}
SelectKBest selects the K best features based on a scoring function. This is a simplified implementation using correlation with target.
func NewSelectKBest ¶
func NewSelectKBest(k int) *SelectKBest
NewSelectKBest creates a new SelectKBest selector.
func (*SelectKBest) Fit ¶
func (s *SelectKBest) Fit(df *dataframe.DataFrame, target ...string) error
Fit computes scores for each feature and selects top K.
func (*SelectKBest) FitTransform ¶
func (s *SelectKBest) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
FitTransform fits the selector and transforms the data in one step.
func (*SelectKBest) GetScores ¶
func (s *SelectKBest) GetScores() map[string]float64
GetScores returns the computed scores for each feature.
func (*SelectKBest) GetSelectedFeatures ¶
func (s *SelectKBest) GetSelectedFeatures() []string
GetSelectedFeatures returns the list of selected feature names.
func (*SelectKBest) IsFitted ¶
func (s *SelectKBest) IsFitted() bool
IsFitted returns true if the selector has been fitted.
type SelectPercentile ¶
type SelectPercentile struct {
// Percentile (0-100) of features to keep
Percentile float64
// contains filtered or unexported fields
}
SelectPercentile selects features based on a percentile of the highest scores.
func NewSelectPercentile ¶
func NewSelectPercentile(percentile float64) *SelectPercentile
NewSelectPercentile creates a new SelectPercentile selector.
func (*SelectPercentile) Fit ¶
func (s *SelectPercentile) Fit(df *dataframe.DataFrame, target ...string) error
Fit computes scores and selects features above the percentile threshold.
func (*SelectPercentile) FitTransform ¶
func (s *SelectPercentile) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
FitTransform fits the selector and transforms the data in one step.
func (*SelectPercentile) GetSelectedFeatures ¶
func (s *SelectPercentile) GetSelectedFeatures() []string
GetSelectedFeatures returns the list of selected feature names.
func (*SelectPercentile) IsFitted ¶
func (s *SelectPercentile) IsFitted() bool
IsFitted returns true if the selector has been fitted.
type VarianceThreshold ¶
type VarianceThreshold struct {
// Threshold is the minimum variance required
Threshold float64
// contains filtered or unexported fields
}
VarianceThreshold removes features with variance below a threshold. Features with low variance are typically not useful for prediction.
func NewVarianceThreshold ¶
func NewVarianceThreshold(threshold float64) *VarianceThreshold
NewVarianceThreshold creates a new VarianceThreshold selector.
func (*VarianceThreshold) Fit ¶
func (v *VarianceThreshold) Fit(df *dataframe.DataFrame, _ ...string) error
Fit computes the variance for each numeric column and selects features.
func (*VarianceThreshold) FitTransform ¶
func (v *VarianceThreshold) FitTransform(df *dataframe.DataFrame, target ...string) (*dataframe.DataFrame, error)
FitTransform fits the selector and transforms the data in one step.
func (*VarianceThreshold) GetSelectedFeatures ¶
func (v *VarianceThreshold) GetSelectedFeatures() []string
GetSelectedFeatures returns the list of selected feature names.
func (*VarianceThreshold) IsFitted ¶
func (v *VarianceThreshold) IsFitted() bool
IsFitted returns true if the selector has been fitted.