Selectors
APPS
Bases: AbstractSelector
Automatic Parallel Portfolio Selector based on the approach by Kashgarani and Kotthoff.
This selector predicts performance distributions for each algorithm and selects a parallel portfolio based on the overlap of each algorithm's predicted runtime distribution with the best algorithm's distribution.
The size of the portfolio is controlled by the p_intersection threshold, which determines the minimum overlap required for an algorithm to be included.
References
Kashgarani, H. J., and Kotthoff, L. (2020). "Automatic Parallel Portfolio Construction." https://par.nsf.gov/biblio/10470673
Source code in asf/selectors/parallel_portfolio_selector.py
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 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
__init__(model_class=RandomForestRegressorWrapper, p_intersection=0.82, n_estimators_for_std=10, random_state=42, use_jackknife=True, n_jackknife_folds=None, **kwargs)
Initialize the Parallel Portfolio Selector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_class
|
type[AbstractPredictor]
|
The predictor class to use for performance modeling. |
RandomForestRegressorWrapper
|
p_intersection
|
float
|
Threshold for distribution overlap. Higher values -> smaller portfolios. |
0.82
|
n_estimators_for_std
|
int
|
Number of Jackknife iterations (n_instances) or bootstrap samples. |
10
|
random_state
|
int
|
Random seed for reproducibility. |
42
|
use_jackknife
|
bool
|
If True, use Jackknife method; if False, use bootstrap. |
True
|
n_jackknife_folds
|
int | None
|
Number of folds for Jackknife. If None, uses leave-one-out. E.g., 10 means 10-fold cross-validation (10 models per algorithm). |
None
|
**kwargs
|
Any
|
Additional arguments passed to parent class. |
{}
|
Source code in asf/selectors/parallel_portfolio_selector.py
AbstractFeatureGenerator
Abstract base class for generating additional features.
Subclasses should implement the methods to define specific feature generation logic based on a set of base features.
Source code in asf/selectors/feature_generator.py
__init__(**kwargs)
Initialize the AbstractFeatureGenerator.
Parameters
**kwargs : Any Additional keyword arguments.
fit(features, performance, algorithm_features=None, **kwargs)
Fit the generator to the data.
Parameters
features : pd.DataFrame The input features. performance : pd.DataFrame The algorithm performance data. algorithm_features : pd.DataFrame or None, optional Additional features related to algorithms. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/feature_generator.py
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.
Source code in asf/selectors/feature_generator.py
AbstractModelBasedSelector
Bases: AbstractSelector
Abstract base class for selectors that utilize a machine learning model.
This class provides functionality to initialize with a model class, save the selector to a file, and load it back.
Attributes
model_class : Callable A callable that represents the model class to be used.
Source code in asf/selectors/abstract_model_based_selector.py
__init__(model_class, **kwargs)
Initialize the AbstractModelBasedSelector.
Parameters
model_class : type[AbstractPredictor] or 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. **kwargs : Any Additional keyword arguments passed to the parent class initializer.
Source code in asf/selectors/abstract_model_based_selector.py
load(path)
classmethod
Load a selector instance from the specified file path.
Parameters
----------
path : str or Path
The file path to load the selector from.
Returns
AbstractModelBasedSelector
The loaded selector instance.
Source code in asf/selectors/abstract_model_based_selector.py
save(path)
Save the selector instance to the specified file path.
Parameters
path : str or Path The file path to save the selector.
AbstractSelector
Bases: ABC
Abstract base class for algorithm selectors.
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 : float 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. prediction_mode : str Mode for predictions ('aslib', 'pandas', 'numpy'). algorithms : list[str] List of algorithm names seen during fitting. features : list[str] List of feature names seen during fitting.
Source code in asf/selectors/abstract_selector.py
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 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
__init__(budget=None, maximize=False, feature_groups=None, hierarchical_generator=None, prediction_mode='aslib', **kwargs)
Initialize the AbstractSelector.
Parameters
budget : float or None, default=None The budget for the selector, if applicable. maximize : bool, default=False Indicates whether to maximize the performance metric. feature_groups : list[str] or None, default=None Groups of features to be considered during selection. hierarchical_generator : AbstractFeatureGenerator or None, default=None A generator for hierarchical features, if applicable. prediction_mode : str, default="aslib" Mode for predictions ('aslib', 'pandas', 'numpy'). **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/abstract_selector.py
fit(features, performance, algorithm_features=None, **kwargs)
Fit the selector.
Parameters
features : pd.DataFrame or np.ndarray The input features. performance : pd.DataFrame or np.ndarray The algorithm performance data. algorithm_features : pd.DataFrame or None, optional Additional features related to algorithms. **kwargs : Any Additional keyword arguments for fitting.
Source code in asf/selectors/abstract_selector.py
load(path)
classmethod
Load a selector instance.
Parameters
path : str File path to load from.
Returns
AbstractSelector The loaded selector instance.
Source code in asf/selectors/abstract_selector.py
predict(features, performance=None)
Predict algorithm selections/rankings.
Parameters
features : pd.DataFrame or np.ndarray or None The input features for prediction. performance : pd.DataFrame or None, default=None Partial performance data if available (e.g., for oracle selectors).
Returns
dict or pd.Series or np.ndarray Predicted selections in the specified prediction_mode. For dict return type, each list item is a tuple: - (algorithm_name, budget): algorithm selection with time budget
Source code in asf/selectors/abstract_selector.py
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 | |
save(path)
Save the selector instance.
Parameters
path : str File path to save to.
BaggingSelector
Bases: ConfigurableMixin, AbstractSelector
Bagging ensemble for algorithm selectors.
Trains multiple instances of the same base selector on bootstrap samples of the training data and aggregates predictions via voting.
Attributes
base_selector : AbstractSelector The base selector to bag. n_estimators : int Number of bootstrap samples/selectors to train. sample_fraction : float Fraction of samples to use in each bootstrap sample. random_state : int or None Random state for reproducibility. estimators_ : list[AbstractSelector] Fitted estimators after calling fit().
Source code in asf/selectors/ensembles.py
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 252 253 254 255 256 257 258 259 | |
__init__(base_selector=None, n_estimators=10, sample_fraction=1.0, random_state=None, **kwargs)
Initialize the BaggingSelector.
Parameters
base_selector : AbstractSelector or Callable or None The base selector to bag. Can be an instance or a callable that returns one. n_estimators : int, default=10 Number of bootstrap samples/selectors to train. sample_fraction : float, default=1.0 Fraction of samples to use in each bootstrap sample. random_state : int or None, default=None Random state for reproducibility. **kwargs : Any Additional keyword arguments passed to AbstractSelector.
Source code in asf/selectors/ensembles.py
CSHCSelector
Bases: ConfigurableMixin, AbstractSelector
Confidence-Switching Hybrid Selector.
A meta-selector that uses a primary selector along with guardian models to predict the success probability of the primary's choice.
References
Malitsky, Y., et al. (2021). "Confidence-based Switching Hybrid Solver Construction." https://link.springer.com/chapter/10.1007/978-3-642-44973-4_17
Attributes
primary_selector : AbstractSelector The primary selector model. backup_selector : AbstractSelector or None The backup selector model. n_folds : int Number of folds for cross-validation to find the optimal threshold. random_state : int Random seed for reproducibility. guardian_kwargs : dict[str, Any] Keyword arguments for the guardian models (RandomForestClassifier). threshold_grid : np.ndarray Grid of thresholds to evaluate. guardians : dict[str, RandomForestClassifier] Trained guardian models for each algorithm. threshold : float The learned optimal threshold for switching.
Source code in asf/selectors/cshc.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
__init__(primary_selector, backup_selector=None, n_estimators=100, guardian_kwargs=None, n_folds=5, threshold_grid=None, random_state=42, **kwargs)
Initialize the CSHCSelector.
Source code in asf/selectors/cshc.py
CollaborativeFilteringSelector
Bases: ConfigurableMixin, AbstractModelBasedSelector
Collaborative filtering selector using SGD matrix factorization (ALORS-style).
References
Misir, M., and Sebag, M. (2016). "ALORS: An algorithm recommender system." https://www.sciencedirect.com/science/article/pii/S0004370216301436
Attributes
n_components : int Number of latent factors. n_iter : int Number of iterations for SGD. lr : float Learning rate for SGD. reg : float Regularization strength. random_state : int Random seed for initialization. U : np.ndarray or None Instance latent factors. V : np.ndarray or None Algorithm latent factors. performance_matrix : pd.DataFrame or None The performance data used for training. model : Any or None The regressor model to predict latent factors from features. mu : float or None Global mean of observed performance entries. b_U : np.ndarray or None Instance biases. b_V : np.ndarray or None Algorithm biases.
Source code in asf/selectors/collaborative_filtering_selector.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
__init__(model_class=RidgeRegressorWrapper, n_components=10, n_iter=100, lr=0.001, reg=0.1, random_state=42, **kwargs)
Initialize the CollaborativeFilteringSelector.
Parameters
model_class : type or Callable, default=RidgeRegressorWrapper The regressor wrapper to predict latent factors from features. n_components : int, default=10 Number of latent factors. n_iter : int, default=100 Number of iterations for SGD. lr : float, default=0.001 Learning rate for SGD. reg : float, default=0.1 Regularization strength. random_state : int, default=42 Random seed for initialization. **kwargs : Any Additional keyword arguments for the parent classes.
Source code in asf/selectors/collaborative_filtering_selector.py
CosineSelector
Bases: ConfigurableMixin, AbstractSelector
Algorithm selector based on the AS-LLM architecture.
Uses cosine similarity in a learned latent space to match instances to algorithms. This implementation follows the AS-LLM paper (arXiv:2311.13184) architecture: - Instance features → MLP → instance embedding - Algorithm index → Embedding → LSTM → fused with algorithm_features → algorithm embedding - Cosine similarity + MLP for final compatibility prediction
References
Wu, et al. (2023). "Algorithm Selection with Large Language Model." https://arxiv.org/abs/2311.13184
Attributes
normalize_features : bool If True, standardize instance features. embed_size : int Dimensionality of algorithm embeddings. num_hiddens : int Hidden units in LSTM. num_layers : int Number of LSTM layers. alpha : float Weight for learned LSTM features in fusion. beta : float Weight for algorithm_features in fusion. lr : float Learning rate for training. num_epochs : int Number of training epochs. batch_size : int Batch size for training. device : str Device for PyTorch ('cuda' or 'cpu').
Source code in asf/selectors/cosine_selector.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
__init__(normalize_features=True, embed_size=50, num_hiddens=50, num_layers=2, alpha=0.9, beta=0.1, lr=0.001, num_epochs=100, batch_size=128, device=None, random_state=42, **kwargs)
Initialize the CosineSelector (AS-LLM architecture).
Parameters
normalize_features : bool, default=True If True, standardize instance features. embed_size : int, default=50 Dimensionality of algorithm embeddings. num_hiddens : int, default=50 Hidden units in LSTM. num_layers : int, default=2 Number of LSTM layers. alpha : float, default=0.9 Weight for learned LSTM features in fusion. beta : float, default=0.1 Weight for algorithm_features in fusion. lr : float, default=0.001 Learning rate for training. num_epochs : int, default=100 Number of training epochs. batch_size : int, default=128 Batch size for training. device : str, default=None Device for PyTorch ('cuda', 'cpu'). If None, auto-detect. random_state : int, default=42 Random seed for reproducibility. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/cosine_selector.py
DummyFeatureGenerator
Bases: AbstractFeatureGenerator
Feature generator that does nothing.
Source code in asf/selectors/feature_generator.py
DyadRanking
Bases: ConfigurableMixin, AbstractModelBasedSelector
Dyad Ranking for Algorithm Selection.
Implements the approach from: Tornede et al. (2019) "Algorithm Selection as Recommendation: From Collaborative Filtering to Dyad Ranking"
Reference link: https://ris.uni-paderborn.de/download/15011/17060/ci_workshop_tornede.pdf
Uses XGBoost instead of PLNet for ranking, but the overall approach is the same.
How it works: 1. Create cross-product: instance_features x algorithm_features 2. Sample pairwise comparisons per instance (not full rankings) 3. Train ranker to predict which dyads rank higher 4. For new instance: score all dyads, pick best algorithm
Source code in asf/selectors/dyad_ranking.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
__init__(model_class=XGBoostRankerWrapper, algorithm_features=None, n_pairs_per_instance=10, random_state=42, **kwargs)
Initialize DyadRanking selector.
Parameters
model_class : type[AbstractPredictor], default=XGBoostRankerWrapper The ranking model class to use. algorithm_features : pd.DataFrame or None, default=None Algorithm features representing parameters and structural components. If None, falls back to one-hot encoding (not recommended per paper). Shape: [n_algorithms, n_algo_features] Index: algorithm names n_pairs_per_instance : int, default=10 Number of pairwise comparisons to sample per training instance. random_state : int, default=42 Random seed for pairwise sampling reproducibility. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/dyad_ranking.py
HARRIS
Bases: ConfigurableMixin, AbstractSelector
Hybrid Ranking and Regression Forests for Algorithm Selection.
HARRIS builds an ensemble of decision trees trained with a hybrid loss that combines regression (MSE) and ranking (Spearman correlation) objectives. Each tree makes splits based on both objectives, but returns predictions based on regression labels at leaf nodes.
References
Fehring, et al. (2022). "HARRIS-Hybrid Algorithm Selection using Regression and Ranking." https://arxiv.org/pdf/2210.17341
Source code in asf/selectors/hybrid_decision_tree.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
__init__(n_estimators=100, max_depth=10, min_samples_split=2, lambda_param=0.5, max_features='sqrt', max_thresholds=32, random_state=42, **kwargs)
Initialize HARRIS selector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_estimators
|
int
|
Number of trees in the forest. |
100
|
max_depth
|
int
|
Maximum depth of each tree. |
10
|
min_samples_split
|
int
|
Minimum samples required to split a node. |
2
|
lambda_param
|
float
|
Balance between regression (λ=1) and ranking (λ=0). λ ∈ [0, 1], controls hybrid loss. |
0.5
|
max_features
|
Optional[str]
|
Number of features to consider for splits: - "sqrt": sqrt(n_features) - "log2": log2(n_features) - int: exact number - None: all features |
'sqrt'
|
max_thresholds
|
int
|
Maximum candidate thresholds per feature (quantile sampled) |
32
|
random_state
|
int
|
Random seed. |
42
|
**kwargs
|
Any
|
Additional arguments for parent class. |
{}
|
Source code in asf/selectors/hybrid_decision_tree.py
ISA
Bases: ConfigurableMixin, AbstractSelector
ISA (Instance-Specific Aspeed) selector.
References
Lindauer, M., et al. (2016). "Instance-Specific Algorithm Selection Schedules." https://ml.informatik.uni-freiburg.de/wp-content/uploads/papers/16-LION-ASschedules.pdf
Attributes
k : int Number of neighbors for k-NN. use_k_tuning : bool Whether to tune k using cross-validation. n_folds : int Number of folds for cross-validation when tuning k. k_candidates : list[int] Candidate k values to consider when tuning. aspeed_cutoff : int Time limit for the internal aspeed solver. cores : int Number of cores for the internal aspeed solver. random_state : int Random seed for reproducibility. reduced_features : pd.DataFrame or None Training features after set reduction. reduced_performance : pd.DataFrame or None Training performance after set reduction. knn : NearestNeighbors or None k-NN model.
Source code in asf/selectors/isa.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
__init__(k=10, use_k_tuning=False, n_folds=5, k_candidates=None, aspeed_cutoff=5, cores=1, random_state=42, **kwargs)
Initialize the ISA selector.
Parameters
k : int, default=10 Number of neighbors for k-NN. use_k_tuning : bool, default=False Whether to tune k using cross-validation. n_folds : int, default=5 Number of folds for cross-validation when tuning k. k_candidates : list[int] or None, default=None Candidate k values to consider when tuning. aspeed_cutoff : int, default=30 Time limit for the internal aspeed solver. cores : int, default=1 Number of cores for the internal aspeed solver. random_state : int, default=42 Random seed for reproducibility. **kwargs : Any Additional keyword arguments for the parent class.
Source code in asf/selectors/isa.py
ISAC
Bases: ConfigurableMixin, AbstractSelector
ISAC (Instance-Specific Algorithm Configuration) selector.
Clusters instances in feature space and assigns to each cluster the best algorithm (by mean performance).
References
Kadioglu, S., et al. (2010). "ISAC - Instance-Specific Algorithm Configuration." https://www.researchgate.net/profile/Yuri-Malitsky/publication/220837402_ISAC_-_Instance-Specific_Algorithm_Configuration/links/02e7e52738cb135ccc000000/ISAC-Instance-Specific-Algorithm-Configuration.pdf
Attributes
clusterer : type or Callable or Any The clusterer class, partial, or instance. clusterer_kwargs : dict[str, Any] Arguments for clusterer instantiation. clusterer_instance : Any or None The trained clusterer instance. cluster_to_best_algo : dict[int, str] Mapping from cluster ID to best algorithm name.
Source code in asf/selectors/isac.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 | |
__init__(clusterer=GMeansWrapper, clusterer_kwargs=None, random_state=None, **kwargs)
Initialize the ISAC selector.
Parameters
clusterer : type or Callable or Any, default=GMeansWrapper The clusterer class, partial, or instance. clusterer_kwargs : dict[str, Any] or None, default=None Arguments for clusterer instantiation. random_state : int or None, default=None Random state for the clusterer. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/isac.py
JointRanking
Bases: ConfigurableMixin, AbstractSelector, AbstractFeatureGenerator
Ranking-based algorithm selector.
Combines feature generation and model-based selection to predict algorithm performance.
References
Ozturk, E., et al. (2022). "Joint Ranking for Learning Algorithm Selection." https://arxiv.org/abs/2206.08476
Attributes
model : RankingMLP or Callable or None The model used for ranking.
Source code in asf/selectors/joint_ranking.py
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 | |
__init__(model=None, **kwargs)
Initialize the JointRanking selector.
Parameters
model : RankingMLP or Callable or None, default=None The model to be used for ranking algorithms. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/joint_ranking.py
generate_features(base_features)
Generate predictions for each algorithm.
Parameters
features : pd.DataFrame Input feature matrix.
Returns
pd.DataFrame DataFrame containing the predictions for each algorithm.
Source code in asf/selectors/joint_ranking.py
MetaSelector
Bases: ConfigurableMixin, AbstractSelector
Meta-selector that ensembles multiple base selectors.
Trains multiple base selectors and uses another selector (the meta-selector) to choose among them for each instance based on their out-of-fold performance.
References
Feurer, M., et al. (2021). "Meta-Algorithm Selection." https://arxiv.org/abs/2107.09414
Important: All base selectors and the meta selector must have RETURN_TYPE 'single'
Source code in asf/selectors/meta_selector.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
__init__(base_selectors=None, meta_selector=None, candidate_selectors=None, par_factor=10, n_folds=5, random_state=42, **kwargs)
Initialize the MetaSelector.
Parameters
base_selectors : Sequence[AbstractSelector] or Callable or None, default=None List of base selectors to ensemble, a callable that returns a list of selectors, or None if candidate_selectors is provided. meta_selector : AbstractSelector or Callable or None, default=None The selector to use for choosing among base selectors, or a callable that returns a selector instance. candidate_selectors : list[type] or None, default=None List of selector classes to instantiate as base selectors if base_selectors is None. par_factor : int, default=10 Penalty factor for timeout instances when computing meta-features. Penalty = budget * par_factor. n_folds : int, default=5 Number of folds for cross-validation during meta-selector training. random_state : int, default=42 Random seed for the KFold cross-validation splitter. **kwargs : Any Additional keyword arguments passed to parent class.
Source code in asf/selectors/meta_selector.py
MultiClassClassifier
Bases: ConfigurableMixin, AbstractModelBasedSelector
Multi-class classification algorithm selector.
References
Xu, L., et al. (2013). "SATzilla2012: Improved Algorithm Selection Based on Cost-sensitive Classification Models." https://arxiv.org/abs/1306.1031
Attributes
classifier : AbstractPredictor or None The trained classification model.
Source code in asf/selectors/multi_class.py
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 | |
__init__(model_class=RandomForestClassifierWrapper, **kwargs)
Initialize the MultiClassClassifier.
Parameters
model_class : type[AbstractPredictor], default=RandomForestClassifierWrapper The class of the model to be used for classification. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/multi_class.py
OSLLinearSelector
Bases: ConfigurableMixin, AbstractSelector
Selector using Optimistic Superset Loss (OSL) to predict runtimes.
References
Hanselle, J., et al. (2021). "Superset Learning for Algorithm Selection with Right Censored Data." https://epub.ub.uni-muenchen.de/91670/1/_PAKDD__Superset_Learning_for_Algorithm_Selection_with_Right_Censored_Data.pdf
Attributes
reg : float L2 regularization strength. optimizer_method : str Method for scipy.optimize.minimize. maxiter : int Maximum number of optimizer iterations. tol : float or None Tolerance for the optimizer. thetas : dict[str, np.ndarray] Learned parameters for each algorithm.
Source code in asf/selectors/osl_linear.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
__init__(budget, reg=0.0, optimizer_method='L-BFGS-B', maxiter=1000, tol=None, **kwargs)
Initialize the OSLLinearSelector.
Parameters
budget : float Global cutoff time. reg : float, default=0.0 L2 regularization strength. optimizer_method : str, default="L-BFGS-B" Optimization algorithm name for scipy.optimize.minimize. maxiter : int, default=1000 Maximum number of optimizer iterations. tol : float or None, default=None Tolerance for the optimizer. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/osl_linear.py
PairwiseClassifier
Bases: ConfigurableMixin, AbstractModelBasedSelector, AbstractFeatureGenerator
Selector using pairwise comparison of algorithms.
References
Xu, L., et al. (2012). "SATzilla Solver Description." https://ml.informatik.uni-freiburg.de/wp-content/uploads/papers/12-SATzilla-solver-description.pdf
Attributes
classifiers : list[AbstractPredictor] Trained classifiers for pairwise comparisons. use_weights : bool Whether to use weights based on performance differences.
Source code in asf/selectors/pairwise_classifier.py
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 | |
__init__(model_class=RandomForestClassifierWrapper, use_weights=True, **kwargs)
Initialize the PairwiseClassifier.
Parameters
model_class : type[AbstractPredictor], default=RandomForestClassifierWrapper The classifier model class used for pairwise comparisons. use_weights : bool, default=True Whether to use weights based on performance differences. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/pairwise_classifier.py
generate_features(base_features)
Generate vote counts for each algorithm.
Parameters
----------
base_features : pd.DataFrame
The input features.
Returns
pd.DataFrame
DataFrame of vote counts for each algorithm.
Source code in asf/selectors/pairwise_classifier.py
PairwiseRegressor
Bases: ConfigurableMixin, AbstractModelBasedSelector, AbstractFeatureGenerator
Selector using pairwise regression of algorithms.
Attributes
regressors : list[AbstractPredictor] Trained regressors for pairwise comparisons.
Source code in asf/selectors/pairwise_regressor.py
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 | |
__init__(model_class=RandomForestRegressorWrapper, **kwargs)
Initialize the PairwiseRegressor.
Parameters
model_class : type[AbstractPredictor], default=RandomForestRegressorWrapper The regression model class used for pairwise comparisons. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/pairwise_regressor.py
generate_features(base_features)
Generate pairwise comparisons for each algorithm.
Parameters
----------
features : pd.DataFrame
The input features.
Returns
pd.DataFrame
DataFrame of aggregated regression values for each algorithm.
Source code in asf/selectors/pairwise_regressor.py
PerformanceModel
Bases: ConfigurableMixin, AbstractModelBasedSelector, AbstractFeatureGenerator
PerformanceModel predicts algorithm performance based on instance features.
It can handle both single-target (one model per algorithm) and multi-target regression models.
References
Hutter, F., et al. (2011). "Sequential Model-Based Optimization for General Algorithm Configuration." https://arxiv.org/abs/1111.2249
Attributes
model_class : type The class of the regression model to be used. use_multi_target : bool Whether to use multi-target regression. normalize : AbstractNormalization Method to normalize the performance data. regressors : list or object Trained regression models.
Source code in asf/selectors/performance_model.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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
__init__(model_class=RandomForestRegressorWrapper, use_multi_target=False, normalize=None, init_params=None, **kwargs)
Initialize the PerformanceModel.
Parameters
model_class : type[AbstractPredictor], default=RandomForestRegressorWrapper The class of the regression model to be used. use_multi_target : bool, default=False Indicates whether to use multi-target regression. normalize : AbstractNormalization or None, default=None Method to normalize performance data. If None, defaults to LogNormalization(). init_params : dict[str, Any] or None, default=None Initialization parameters from configuration. **kwargs : Any Additional arguments for the parent classes.
Source code in asf/selectors/performance_model.py
generate_features(base_features)
Generate predictions for each algorithm.
Parameters
features : pd.DataFrame The input features.
Returns
np.ndarray Predicted performance for each algorithm (n_instances x n_algorithms).
Source code in asf/selectors/performance_model.py
RPCSelector
Bases: AbstractSelector
Ranking by Pairwise Comparison (RPC) for Algorithm Selection.
RPC decomposes the k-label ranking problem into m = k(k-1)/2 binary classification tasks (one for each pair of algorithms).
References
Hüllermeier, E., et al. (2008). "Label Ranking by Learning Pairwise Preferences." https://en.cs.uni-paderborn.de/fileadmin-eim/informatik/fg/is/Publications/mpub109.pdf
Source code in asf/selectors/rpc_selector.py
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 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 | |
__init__(classifier_class=RandomForestClassifierWrapper, n_estimators=100, classifier_kwargs=None, random_state=42, top_n=1, **kwargs)
Initialize RPC selector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
classifier_class
|
Type
|
The classifier class to use for pairwise tasks. |
RandomForestClassifierWrapper
|
n_estimators
|
int
|
Number of estimators for ensemble classifiers. |
100
|
classifier_kwargs
|
dict[str, Any] | None
|
Additional kwargs to pass to each classifier. |
None
|
random_state
|
int
|
Random seed for reproducibility. |
42
|
top_n
|
int
|
Number of top algorithms to return. If > 1, selector returns parallel portfolios (list of algorithm names). If 1, returns a single (algorithm, budget) tuple. |
1
|
**kwargs
|
Any
|
Additional arguments for parent class. |
{}
|
Source code in asf/selectors/rpc_selector.py
SATzilla
Bases: ConfigurableMixin, AbstractEPMBasedSelector, AbstractModelBasedSelector
SATzilla-like selector using iterative imputation for censored runtimes.
Uses per-algorithm ridge models on expanded features with optional instance label conditioning.
References
Xu, L., et al. (2008). "SATzilla: Portfolio-based Algorithm Selection for SAT." https://www.jair.org/index.php/jair/article/view/10556
Attributes
epms : dict[str, dict[str, EPM]] Mapping from algorithm name to another mapping of label to EPM. label_classifier_model : type or Callable The classifier class used for the label classifier (only used when labels are provided). epm_regressor_model : type or Callable The regressor class used internally by EPM for per-algorithm performance prediction.
Source code in asf/selectors/satzilla.py
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 | |
__init__(label_classifier_model=RandomForestClassifierWrapper, epm_regressor_model=RidgeRegressorWrapper, **kwargs)
Initialize the SATzilla selector.
Parameters
label_classifier_model : type, default=RandomForestClassifierWrapper The classifier class for predicting instance labels (e.g., SAT/UNSAT). epm_regressor_model : type, default=RidgeRegressorWrapper The regressor class used internally by EPM for per-algorithm runtime prediction. **kwargs : Any Additional keyword arguments passed to parent classes.
Source code in asf/selectors/satzilla.py
SNNAP
Bases: ConfigurableMixin, AbstractSelector
SNNAP (Solver-based Nearest Neighbor for Algorithm Portfolio) selector.
Uses per-algorithm performance prediction models and Jaccard distance on predicted top algorithms to find similar instances, then selects from neighbors' best algorithms.
References
Collautti, M., et al. (2013). "A Solver-Based Nearest Neighbor Method for Portfolio Selection." https://link.springer.com/chapter/10.1007/978-3-642-40994-3_28
Attributes
k : int Number of similar instances (neighbors) to use. top_n : int Number of top algorithms to consider for Jaccard distance calculation. algorithm_models : dict[str, AbstractPredictor] or None Per-algorithm regression models for predicting scaled runtime. scaled_performance_df : pd.DataFrame or None Z-score normalized performance matrix (per instance). original_performance_df : pd.DataFrame or None Original unnormalized performance data. training_top_n_sets : list[set[str]] or None Pre-computed top-n algorithm sets for each training instance. features_df : pd.DataFrame or None Training features.
Source code in asf/selectors/snnap.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
__init__(k=5, top_n=3, random_state=42, **kwargs)
Initialize the SNNAP selector.
Parameters
k : int, default=5 Number of nearest neighbors (similar instances) to consider. top_n : int, default=3 Number of top algorithms to use for Jaccard distance calculation. random_state : int or None, default=42 Random seed for the RandomForest models. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/snnap.py
SUNNY
Bases: ConfigurableMixin, AbstractSelector
SUNNY/SUNNY-AS2 algorithm selector.
This selector uses k-nearest neighbors (k-NN) in feature space to construct a schedule. When SUNNY-AS2 is enabled, k is optimized.
References
Liu, Z., et al. (2022). "SUNNY-AS2: Enhancing SUNNY for Algorithm Selection." https://dl.acm.org/doi/10.1613/jair.1.13116
Attributes
k : int Number of neighbors for k-NN. use_v2 : bool Whether to tune k using cross-validation. n_folds : int Number of folds for cross-validation when tuning. k_candidates : list[int] Candidate k values for tuning. random_state : int Random seed for reproducibility. use_tsunny : bool Whether to tune the maximum number of algorithms. algorithm_limit : int or None Manual cap on the number of algorithms in each schedule. tuned_algorithm_limit : int or None Tuned cap on the number of algorithms. features_df : pd.DataFrame or None Training features. performance_df : pd.DataFrame or None Training performance. knn : NearestNeighbors or None Trained k-NN model.
Source code in asf/selectors/sunny.py
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
__init__(k=10, use_v2=False, n_folds=5, k_candidates=None, random_state=42, use_tsunny=False, algorithm_limit=None, **kwargs)
Initialize the SUNNY selector.
Parameters
k : int, default=10 Number of neighbors for k-NN. use_v2 : bool, default=False Whether to tune k using cross-validation (SUNNY-AS2). n_folds : int, default=5 Number of folds for cross-validation when tuning. k_candidates : list[int] or None, default=None Candidate k values to consider when tuning. random_state : int, default=42 Random seed for reproducibility. use_tsunny : bool, default=False Whether to tune the max number of algorithms via cross-validation. algorithm_limit : int or None, default=None If set, cap the number of algorithms in each schedule. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/sunny.py
SelectorPipeline
Bases: ConfigurableMixin
Sequence of preprocessing, feature selection, and algorithm selection steps.
Attributes
selector : AbstractSelector The main selector model to be used. pre_solving : AbstractPresolver or None A presolver for selecting initial algorithms. feature_selector : Any or None A component for feature selection. algorithm_pre_selector : Any or None A component for algorithm pre-selection. feature_groups : Any or None Feature groups to be used by the selector. max_feature_time : float or None Budget (seconds) to allocate per feature group in predictions. preprocessor : Pipeline The preprocessing pipeline (including SimpleImputer).
Source code in asf/selectors/selector_pipeline.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
__init__(selector, preprocessor=None, pre_solving=None, feature_selector=None, algorithm_pre_selector=None, feature_groups=None, max_feature_time=None)
Initialize the SelectorPipeline.
Parameters
selector : AbstractSelector The main selector model to be used. preprocessor : Any or list or None, default=None Preprocessing steps. SimpleImputer(strategy="mean") is always added first. pre_solving : AbstractPresolver or None, default=None Presolver for initial algorithm selection. feature_selector : Any or None, default=None Component for feature selection. algorithm_pre_selector : Any or None, default=None Component for algorithm pre-selection. feature_groups : dict or list or None, default=None Feature groups configuration. max_feature_time : float or None, default=None Budget (seconds) per feature group.
Source code in asf/selectors/selector_pipeline.py
fit(features, performance, algorithm_features=None, **kwargs)
Fit the pipeline.
Parameters
features : pd.DataFrame The input features. performance : pd.DataFrame The performance data. algorithm_features : pd.DataFrame or None, default=None Optional algorithm features. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/selector_pipeline.py
get_config()
Return configuration details.
Returns
dict Configuration metadata.
Source code in asf/selectors/selector_pipeline.py
get_from_configuration(configuration, pre_prefix='', feature_groups=None, budget=None, max_feature_time=None, **kwargs)
classmethod
Create a SelectorPipeline from a configuration.
Parameters
configuration : Configuration or dict Configuration object. pre_prefix : str, default="" Prefix for nested lookups. feature_groups : dict or None, default=None Feature groups definition. budget : float or None, default=None Total budget. max_feature_time : float or None, default=None Maximum feature computation time. **kwargs : Any Additional keyword arguments.
Returns
partial Partial function for SelectorPipeline.
Source code in asf/selectors/selector_pipeline.py
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | |
load(path)
staticmethod
Load a pipeline from a file.
Parameters
path : str or Path File path to load from.
Returns
SelectorPipeline The loaded pipeline.
Source code in asf/selectors/selector_pipeline.py
predict(features, performance=None, **kwargs)
Make predictions.
Parameters
features : pd.DataFrame The input features. performance : pd.DataFrame or None, default=None Performance data for oracle selectors. **kwargs : Any Additional keyword arguments.
Returns
dict Predictions mapping instance IDs to schedules.
Source code in asf/selectors/selector_pipeline.py
save(path)
Save the pipeline to a file.
Parameters
path : str or Path File path to save the pipeline.
SimpleRanking
Bases: ConfigurableMixin, AbstractModelBasedSelector
Algorithm Selection via Ranking.
Attributes
classifier : AbstractPredictor or None The trained ranking model.
Source code in asf/selectors/simple_ranking.py
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 | |
__init__(model_class=XGBoostRankerWrapper, **kwargs)
Initialize the SimpleRanking.
Parameters
model_class : type[AbstractPredictor], default=XGBoostRankerWrapper The class of the ranking model to be used. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/simple_ranking.py
SingleBestSolver
Bases: ConfigurableMixin, AbstractSelector
Single Best Solver (SBS) selector.
Always selects the algorithm with the best average performance across all training instances. This represents the baseline performance achievable without any instance-specific selection.
Attributes
best_algorithm : str or None The name of the algorithm with the best aggregate performance.
Source code in asf/selectors/baselines.py
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 | |
__init__(budget=None, maximize=False, feature_groups=None, **kwargs)
Initialize the SingleBestSolver.
Parameters
budget : float or None, default=None The budget for the selector. maximize : bool, default=False Indicates whether to maximize the performance metric. feature_groups : list[str] or None, default=None Groups of features to be considered. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/baselines.py
StackingSelector
Bases: ConfigurableMixin, AbstractSelector
Stacking ensemble for algorithm selectors.
Trains base selectors and uses their outputs as features for a meta-selector. For selectors with generate_features(), can optionally use the generated features instead of final predictions.
Attributes
base_selectors : list[AbstractSelector] List of base selectors. meta_selector : AbstractSelector Meta-selector trained on base selector outputs. use_generated_features : bool If True, use generate_features() output for selectors that support it. cv : int Number of cross-validation folds for generating meta-features. use_original_features : bool If True, include original features in meta-features. random_state : int or None Random state for cross-validation. base_selectors_ : list[AbstractSelector] Fitted base selectors. meta_selector_ : AbstractSelector Fitted meta-selector.
Source code in asf/selectors/ensembles.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | |
__init__(base_selectors=None, meta_selector=None, use_generated_features=False, cv=5, use_original_features=True, random_state=None, **kwargs)
Initialize the StackingSelector.
Parameters
base_selectors : list[AbstractSelector] or Callable or None List of base selectors. meta_selector : AbstractSelector or Callable or None Meta-selector for final predictions. use_generated_features : bool, default=False If True, use generate_features() output for selectors that have it. If False, use one-hot encoded final predictions. cv : int, default=5 Number of cross-validation folds. use_original_features : bool, default=True If True, concatenate original features with stacked features. random_state : int or None, default=None Random state for cross-validation. **kwargs : Any Additional keyword arguments passed to AbstractSelector.
Source code in asf/selectors/ensembles.py
VirtualBestSolver
Bases: ConfigurableMixin, AbstractSelector
Virtual Best Solver (VBS) / Oracle selector.
Always selects the best algorithm for each specific instance. This represents the upper bound of performance achievable by any algorithm selector (requires oracle knowledge of true performance).
Note: This selector "cheats" by using the test performance data.
Source code in asf/selectors/baselines.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
__init__(budget=None, maximize=False, feature_groups=None, **kwargs)
Initialize the VirtualBestSolver.
Parameters
budget : float or None, default=None The budget for the selector. maximize : bool, default=False Indicates whether to maximize the performance metric. feature_groups : list[str] or None, default=None Groups of features to be considered. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/baselines.py
VotingSelector
Bases: ConfigurableMixin, AbstractSelector
Voting ensemble for algorithm selectors.
Combines predictions from multiple base selectors using hard voting (majority vote).
Attributes
selectors : list[AbstractSelector] List of base selectors. weights : list[float] or None Weights for each selector's vote. selectors_ : list[AbstractSelector] Fitted selectors after calling fit().
Source code in asf/selectors/ensembles.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
__init__(selectors=None, weights=None, **kwargs)
Initialize the VotingSelector.
Parameters
selectors : list[AbstractSelector] or Callable or None List of base selectors. Can be instances or a callable that returns a list. weights : list[float] or None, default=None Weights for each selector's vote. If None, equal weights. **kwargs : Any Additional keyword arguments passed to AbstractSelector.
Source code in asf/selectors/ensembles.py
tune_selector(X, y, selector_class, features_running_time, algorithm_features=None, selector_kwargs=None, preprocessing_class=None, pre_solving_class=None, feature_selector=None, algorithm_pre_selector=None, max_algorithm_pre_selector=None, budget=None, maximize=False, feature_groups=None, output_dir='./smac_output', smac_metric=running_time_selector_performance, smac_kwargs=None, smac_scenario_kwargs=None, runcount_limit=100, timeout=float('inf'), seed=0, cv=10, groups=None, max_feature_time=None)
Tunes a selector model using SMAC.
Parameters
X : pd.DataFrame Instance feature matrix. y : pd.DataFrame Algorithm performance matrix. selector_class : type or list Selector classes to tune. features_running_time : pd.DataFrame Running times for computing feature groups. algorithm_features : pd.DataFrame or None, optional Features for algorithms. selector_kwargs : dict or None, optional Arguments for selector instantiation. preprocessing_class : list or None, optional List of preprocessor classes. pre_solving_class : list or None, optional List of presolver classes. feature_selector : Any or None, optional Feature selection component. algorithm_pre_selector : Any or None, optional Algorithm pre-selection component. max_algorithm_pre_selector : int or None, optional Constraint for pre-selection. budget : float or None, optional Global cutoff time. maximize : bool, default=False Whether to maximize the performance metric. feature_groups : dict or None, optional Definition of feature groups. output_dir : str, default="./smac_output" SMAC output directory. smac_metric : callable, default=running_time_selector_performance Evaluation metric for SMAC. smac_kwargs : callable or None, optional Additional arguments for SMAC facade. smac_scenario_kwargs : dict or None, optional Additional arguments for SMAC scenario. runcount_limit : int, default=100 Limit for trials. timeout : float, default=inf Wall-clock time limit. seed : int, default=0 Random seed. cv : int, default=10 Number of cross-validation folds. groups : np.ndarray or None, optional Group labels for CV. max_feature_time : float or None, optional Budget per feature group.
Returns
SelectorPipeline Best pipeline found by SMAC.
Source code in asf/selectors/selector_tuner.py
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 | |