Selectors
AbstractFeatureGenerator
AbstractFeatureGenerator is a base class for generating additional features based on a set of base features. Subclasses should implement the methods to define specific feature generation logic.
Source code in asf/selectors/feature_generator.py
__init__()
generate_features(base_features)
Generate additional features based on the provided base features.
Parameters
base_features : pd.DataFrame The input DataFrame containing the base features.
Returns
pd.DataFrame A DataFrame containing the generated features.
Raises
NotImplementedError If the method is not implemented in a subclass.
Source code in asf/selectors/feature_generator.py
AbstractModelBasedSelector
Bases: AbstractSelector
An abstract base class for selectors that utilize a machine learning model for selection purposes. This class provides functionality to initialize with a model class, save the selector to a file, and load it back.
Attributes:
Name | Type | Description |
---|---|---|
model_class |
Callable
|
A callable that represents the model class to
be used. If the provided model_class is a subclass of
|
Methods:
Name | Description |
---|---|
save |
Union[str, Path]) -> None: Saves the current instance of the selector to the specified file path. |
load |
Union[str, Path]) -> "AbstractModelBasedSelector": Loads a previously saved instance of the selector from the specified file path. |
Source code in asf/selectors/abstract_model_based_selector.py
__init__(model_class, **kwargs)
Initializes the AbstractModelBasedSelector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
Union[Type, Callable]
|
The model class or a callable that returns a model instance. If a scikit-learn compatible class is provided, it's wrapped with SklearnWrapper. |
required |
**kwargs
|
Any
|
Additional keyword arguments passed to the parent class initializer. |
{}
|
Source code in asf/selectors/abstract_model_based_selector.py
load(path)
staticmethod
Loads a selector instance from the specified file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The file path to load the selector from. |
required |
Returns:
Name | Type | Description |
---|---|---|
AbstractModelBasedSelector |
AbstractModelBasedSelector
|
The loaded selector instance. |
Source code in asf/selectors/abstract_model_based_selector.py
save(path)
Saves the selector instance to the specified file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The file path to save the selector. |
required |
AbstractSelector
AbstractSelector is a base class for implementing feature selection algorithms. It provides a framework for fitting, predicting, and managing hierarchical feature generators and configuration spaces.
Attributes
maximize : bool Indicates whether the objective is to maximize or minimize the performance metric. budget : int or None The budget for the selector, if applicable. feature_groups : list[str] or None Groups of features to be considered during selection. hierarchical_generator : AbstractFeatureGenerator or None A generator for hierarchical features, if applicable. algorithm_features : pd.DataFrame or None Additional features related to algorithms, if provided.
Source code in asf/selectors/abstract_selector.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
__init__(budget=None, maximize=False, feature_groups=None, hierarchical_generator=None)
Initialize the AbstractSelector.
Parameters
budget : int or None, optional The budget for the selector, if applicable. Defaults to None. maximize : bool, optional Indicates whether to maximize the performance metric. Defaults to False. feature_groups : list[str] or None, optional Groups of features to be considered during selection. Defaults to None. hierarchical_generator : AbstractFeatureGenerator or None, optional A generator for hierarchical features, if applicable. Defaults to None.
Source code in asf/selectors/abstract_selector.py
fit(features, performance, algorithm_features=None, **kwargs)
Fit the selector to the given features and performance data.
Parameters
features : pd.DataFrame The input features for the selector. performance : pd.DataFrame The performance data corresponding to the features. algorithm_features : pd.DataFrame or None, optional Additional features related to algorithms, if provided. Defaults to None. **kwargs : dict Additional keyword arguments for fitting.
Source code in asf/selectors/abstract_selector.py
get_configuration_space(cs=None, **kwargs)
staticmethod
Get the configuration space for the selector.
Parameters
cs : ConfigurationSpace or None, optional The configuration space to use. If None, a new one will be created. **kwargs : dict Additional keyword arguments for configuration space creation.
Returns
ConfigurationSpace The configuration space for the selector.
Raises
NotImplementedError If the method is not implemented in a subclass.
Source code in asf/selectors/abstract_selector.py
get_from_configuration(configuration)
staticmethod
Create a selector instance from a configuration.
Parameters
configuration : Configuration The configuration object.
Returns
AbstractSelector The selector instance.
Raises
NotImplementedError If the method is not implemented in a subclass.
Source code in asf/selectors/abstract_selector.py
load(path)
Load the selector's state from the specified path.
Parameters
path : str The file path from which the selector's state will be loaded.
predict(features)
Predict the ranking or selection of features for the given input features.
Parameters
features : pd.DataFrame The input features for prediction.
Returns
dict[str, list[tuple[str, float]]] A dictionary where keys are algorithm names and values are lists of tuples containing feature names and their corresponding scores.
Source code in asf/selectors/abstract_selector.py
save(path)
Save the selector's state to the specified path.
Parameters
path : str The file path where the selector's state will be saved.
JointRanking
Bases: AbstractSelector
, AbstractFeatureGenerator
JointRanking implements a ranking-based approach for selecting the best-performing algorithms for a given set of features. It combines feature generation and model-based selection to predict algorithm performance.
Reference
Ortuzk et al. (2022)
Source code in asf/selectors/joint_ranking.py
__init__(model=None, **kwargs)
Initializes the JointRanking selector with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
RankingMLP
|
The regression model to be used for ranking. |
None
|
**kwargs
|
Additional arguments passed to the AbstractSelector. |
{}
|
Source code in asf/selectors/joint_ranking.py
generate_features(features)
Generates predictions for the given features using the trained models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features
|
DataFrame
|
DataFrame containing the feature data. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame containing the predictions for each algorithm. |
Source code in asf/selectors/joint_ranking.py
MultiClassClassifier
Bases: AbstractModelBasedSelector
A selector that uses a multi-class classification model to predict the best algorithm for a given set of features and performance data.
Source code in asf/selectors/mutli_class.py
__init__(model_class, **kwargs)
Initializes the MultiClassClassifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
Type[AbstractPredictor]
|
The class of the model to be used for classification. |
required |
**kwargs
|
Additional keyword arguments to be passed to the parent class. |
{}
|
Source code in asf/selectors/mutli_class.py
PairwiseClassifier
Bases: AbstractModelBasedSelector
, AbstractFeatureGenerator
Source code in asf/selectors/pairwise_classifier.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
PREFIX = 'pairwise_classifier'
class-attribute
instance-attribute
PairwiseClassifier is a selector that uses pairwise comparison of algorithms to predict the best algorithm for a given instance.
Attributes:
Name | Type | Description |
---|---|---|
PREFIX |
str
|
Prefix used for configuration space parameters. |
classifiers |
List[AbstractPredictor]
|
List of trained classifiers for pairwise comparisons. |
use_weights |
bool
|
Whether to use weights based on performance differences. |
__init__(model_class, use_weights=True, **kwargs)
Initializes the PairwiseClassifier with a given model class and hierarchical feature generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
type[AbstractPredictor]
|
The classifier model to be used for pairwise comparisons. |
required |
use_weights
|
bool
|
Whether to use weights based on performance differences. Defaults to True. |
True
|
**kwargs
|
Additional keyword arguments for the parent class. |
{}
|
Source code in asf/selectors/pairwise_classifier.py
generate_features(features)
Generates features for the pairwise classifiers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features
|
DataFrame
|
The feature data for the instances. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: A DataFrame of predictions for each instance and algorithm pair. |
Source code in asf/selectors/pairwise_classifier.py
get_configuration_space(cs=None, cs_transform=None, model_class=[RandomForestClassifierWrapper, XGBoostClassifierWrapper], pre_prefix='', parent_param=None, parent_value=None, **kwargs)
staticmethod
Get the configuration space for the predictor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cs
|
Optional[ConfigurationSpace]
|
The configuration space to use. If None, a new one will be created. |
None
|
cs_transform
|
Optional[Dict[str, dict]]
|
A dictionary for transforming configuration space parameters. |
None
|
model_class
|
List[type[AbstractPredictor]]
|
The list of model classes to use. Defaults to [RandomForestClassifierWrapper, XGBoostClassifierWrapper]. |
[RandomForestClassifierWrapper, XGBoostClassifierWrapper]
|
hierarchical_generator
|
Optional[List[AbstractFeatureGenerator]]
|
List of hierarchical feature generators. |
required |
**kwargs
|
Additional keyword arguments to pass to the model class. |
{}
|
Returns:
Type | Description |
---|---|
Tuple[ConfigurationSpace, Dict[str, dict]]
|
Tuple[ConfigurationSpace, Dict[str, dict]]: The configuration space and its transformation dictionary. |
Source code in asf/selectors/pairwise_classifier.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
get_from_configuration(configuration, cs_transform, pre_prefix='', **kwargs)
staticmethod
Get the predictor from a given configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configuration
|
Configuration
|
The configuration object. |
required |
cs_transform
|
Dict[str, dict]
|
The transformation dictionary for the configuration space. |
required |
Returns:
Name | Type | Description |
---|---|---|
partial |
partial
|
A partial function to initialize the PairwiseClassifier with the given configuration. |
Source code in asf/selectors/pairwise_classifier.py
PairwiseRegressor
Bases: AbstractModelBasedSelector
, AbstractFeatureGenerator
Source code in asf/selectors/pairwise_regressor.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
PREFIX = 'pairwise_regressor'
class-attribute
instance-attribute
PairwiseRegressor is a selector that uses pairwise regression of algorithms to predict the best algorithm for a given instance.
Attributes:
Name | Type | Description |
---|---|---|
model_class |
type
|
The regression model class to be used for pairwise comparisons. |
regressors |
List[AbstractPredictor]
|
List of trained regressors for pairwise comparisons. |
__init__(model_class, **kwargs)
Initializes the PairwiseRegressor with a given model class and hierarchical feature generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
type
|
The regression model class to be used for pairwise comparisons. |
required |
kwargs
|
Additional keyword arguments for the parent classes. |
{}
|
Source code in asf/selectors/pairwise_regressor.py
generate_features(features)
Generates features for the pairwise regressors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features
|
DataFrame
|
The feature data for the instances. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: A DataFrame of predictions for each instance and algorithm pair. |
Source code in asf/selectors/pairwise_regressor.py
get_configuration_space(cs=None, cs_transform=None, model_class=[RandomForestRegressorWrapper, XGBoostRegressorWrapper], pre_prefix='', parent_param=None, parent_value=None, **kwargs)
staticmethod
Get the configuration space for the predictor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cs
|
Optional[ConfigurationSpace]
|
The configuration space to use. If None, a new one will be created. |
None
|
cs_transform
|
Optional[Dict[str, Dict[str, type]]]
|
A dictionary for transforming configuration space values. |
None
|
model_class
|
List[type]
|
The list of model classes to use. Defaults to [RandomForestRegressorWrapper, XGBoostRegressorWrapper]. |
[RandomForestRegressorWrapper, XGBoostRegressorWrapper]
|
hierarchical_generator
|
Optional[List[AbstractFeatureGenerator]]
|
List of hierarchical feature generators. |
required |
kwargs
|
Additional keyword arguments to pass to the model class. |
{}
|
Returns:
Type | Description |
---|---|
Tuple[ConfigurationSpace, Dict[str, Dict[str, type]]]
|
Tuple[ConfigurationSpace, Dict[str, Dict[str, type]]]: The configuration space and its transformation dictionary. |
Source code in asf/selectors/pairwise_regressor.py
get_from_configuration(configuration, cs_transform, pre_prefix='', **kwargs)
staticmethod
Get the configuration space for the predictor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
configuration
|
Configuration
|
The configuration object. |
required |
cs_transform
|
Dict[str, Dict[str, type]]
|
The transformation dictionary for the configuration space. |
required |
Returns:
Name | Type | Description |
---|---|---|
partial |
partial
|
A partial function to initialize the PairwiseRegressor with the given configuration. |
Source code in asf/selectors/pairwise_regressor.py
PerformanceModel
Bases: AbstractModelBasedSelector
, AbstractFeatureGenerator
PerformanceModel is a class that predicts the performance of algorithms based on given features. It can handle both single-target and multi-target regression models.
Attributes:
Name | Type | Description |
---|---|---|
model_class |
Type
|
The class of the regression model to be used. |
use_multi_target |
bool
|
Indicates whether to use multi-target regression. |
normalize |
str
|
Method to normalize the performance data. Default is "log". |
regressors |
Union[List, object]
|
List of trained regression models or a single model for multi-target regression. |
algorithm_features |
Optional[DataFrame]
|
Features specific to each algorithm, if applicable. |
algorithms |
List[str]
|
List of algorithm names. |
maximize |
bool
|
Whether to maximize or minimize the performance metric. |
budget |
float
|
Budget associated with the predictions. |
Source code in asf/selectors/performance_model.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
__init__(model_class, use_multi_target=False, normalize='log', **kwargs)
Initializes the PerformanceModel with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
Type
|
The class of the regression model to be used. |
required |
use_multi_target
|
bool
|
Indicates whether to use multi-target regression. |
False
|
normalize
|
str
|
Method to normalize the performance data. Default is "log". |
'log'
|
**kwargs
|
Additional arguments for the parent classes. |
{}
|
Source code in asf/selectors/performance_model.py
generate_features(features)
Generates predictions for the given features using the trained models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features
|
DataFrame
|
DataFrame containing the feature data. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Array containing the predictions for each algorithm. |
Source code in asf/selectors/performance_model.py
SelectorPipeline
A pipeline for applying a sequence of preprocessing, feature selection, and algorithm selection steps before fitting a final selector model.
Attributes:
Name | Type | Description |
---|---|---|
selector |
AbstractSelector
|
The main selector model to be used. |
preprocessor |
Optional[Callable]
|
A callable for preprocessing the input data. |
pre_solving |
Optional[Callable]
|
A callable for pre-solving steps. |
feature_selector |
Optional[Callable]
|
A callable for feature selection. |
algorithm_pre_selector |
Optional[Callable]
|
A callable for algorithm pre-selection. |
budget |
Optional[Any]
|
The budget constraint for the selector. |
maximize |
bool
|
Whether to maximize the objective function. |
feature_groups |
Optional[Any]
|
Feature groups to be used by the selector. |
Source code in asf/selectors/selector_pipeline.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
__init__(selector, preprocessor=None, pre_solving=None, feature_selector=None, algorithm_pre_selector=None, budget=None, maximize=False, feature_groups=None)
Initializes the SelectorPipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selector
|
AbstractSelector
|
The main selector model to be used. |
required |
preprocessor
|
Optional[Callable]
|
A callable for preprocessing the input data. Defaults to None. |
None
|
pre_solving
|
Optional[Callable]
|
A callable for pre-solving steps. Defaults to None. |
None
|
feature_selector
|
Optional[Callable]
|
A callable for feature selection. Defaults to None. |
None
|
algorithm_pre_selector
|
Optional[Callable]
|
A callable for algorithm pre-selection. Defaults to None. |
None
|
budget
|
Optional[Any]
|
The budget constraint for the selector. Defaults to None. |
None
|
maximize
|
bool
|
Whether to maximize the objective function. Defaults to False. |
False
|
feature_groups
|
Optional[Any]
|
Feature groups to be used by the selector. Defaults to None. |
None
|
Source code in asf/selectors/selector_pipeline.py
fit(X, y)
Fits the pipeline to the input data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Any
|
The input features. |
required |
y
|
Any
|
The target labels. |
required |
Source code in asf/selectors/selector_pipeline.py
load(path)
staticmethod
Loads a pipeline from a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The file path from which the pipeline will be loaded. |
required |
Returns:
Name | Type | Description |
---|---|---|
SelectorPipeline |
SelectorPipeline
|
The loaded pipeline. |
Source code in asf/selectors/selector_pipeline.py
predict(X)
Makes predictions using the fitted pipeline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Any
|
The input features. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The predictions made by the selector. |
Source code in asf/selectors/selector_pipeline.py
save(path)
Saves the pipeline to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The file path where the pipeline will be saved. |
required |
SimpleRanking
Bases: AbstractModelBasedSelector
Algorithm Selection via Ranking (Oentaryo et al.) + algo features (optional). Attributes: model_class: The class of the classification model to be used. metadata: Metadata containing information about the algorithms. classifier: The trained classification model.
Source code in asf/selectors/simple_ranking.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
__init__(model_class, **kwargs)
Initializes the MultiClassClassifier with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class
|
AbstractPredictor
|
The class of the classification model to be used. Assumes XGBoost API. |
required |
metadata
|
Metadata containing information about the algorithms. |
required | |
hierarchical_generator
|
Feature generator to be used. |
required |
Source code in asf/selectors/simple_ranking.py
tune_selector(X, y, selector_class, selector_kwargs={}, preprocessing_class=None, pre_solving=None, feature_selector=None, algorithm_pre_selector=None, budget=None, maximize=False, feature_groups=None, output_dir='./smac_output', smac_metric=running_time_selector_performance, smac_kwargs={}, smac_scenario_kwargs={}, runcount_limit=100, timeout=np.inf, seed=0, cv=10, groups=None)
Tunes a selector model using SMAC for hyperparameter optimization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
DataFrame
|
Feature matrix for training and testing. |
required |
y
|
DataFrame
|
Target matrix for training and testing. |
required |
selector_class
|
list[AbstractSelector]
|
List of selector classes to tune. Defaults to [PairwiseClassifier, PairwiseRegressor]. |
required |
selector_space_kwargs
|
dict
|
Additional arguments for the selector's configuration space. |
required |
selector_kwargs
|
dict
|
Additional arguments for the selector's instantiation. |
{}
|
preprocessing_class
|
AbstractPreprocessor
|
Preprocessing class to apply before selector. Defaults to None. |
None
|
pre_solving
|
object
|
Pre-solving strategy to use. Defaults to None. |
None
|
feature_selector
|
object
|
Feature selector to use. Defaults to None. |
None
|
algorithm_pre_selector
|
object
|
Algorithm pre-selector to use. Defaults to None. |
None
|
budget
|
float
|
Budget for the selector. Defaults to None. |
None
|
maximize
|
bool
|
Whether to maximize the metric. Defaults to False. |
False
|
feature_groups
|
list
|
Feature groups to consider. Defaults to None. |
None
|
output_dir
|
str
|
Directory to store SMAC output. Defaults to "./smac_output". |
'./smac_output'
|
smac_metric
|
callable
|
Metric function to evaluate the selector's performance. Defaults to |
running_time_selector_performance
|
smac_kwargs
|
dict
|
Additional arguments for SMAC's optimization facade. |
{}
|
smac_scenario_kwargs
|
dict
|
Additional arguments for SMAC's scenario configuration. |
{}
|
runcount_limit
|
int
|
Maximum number of function evaluations. Defaults to 100. |
100
|
timeout
|
float
|
Maximum wall-clock time for optimization. Defaults to np.inf. |
inf
|
seed
|
int
|
Random seed for reproducibility. Defaults to None. |
0
|
cv
|
int
|
Number of cross-validation splits. Defaults to 10. |
10
|
groups
|
ndarray
|
Group labels for cross-validation. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
SelectorPipeline |
SelectorPipeline
|
A pipeline with the best-tuned selector and preprocessing steps. |
Source code in asf/selectors/selector_tuner.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|