Selectors
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
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 | |
__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
get_configuration_space(cs=None, **kwargs)
staticmethod
Get the configuration space.
Parameters
cs : ConfigurationSpace or None, optional Base configuration space. **kwargs : Any Additional options.
Returns
ConfigurationSpace The configuration space.
Source code in asf/selectors/abstract_selector.py
get_from_configuration(configuration)
staticmethod
Create an instance from a configuration.
Parameters
configuration : Configuration The configuration object.
Returns
AbstractSelector The initialized selector.
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.
Source code in asf/selectors/abstract_selector.py
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 | |
save(path)
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.
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
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 | |
__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.
Parameters
primary_selector : AbstractSelector or Callable The primary selector model. backup_selector : AbstractSelector or Callable or None, default=None The backup selector model. n_estimators : int, default=100 Number of estimators for the guardian models. guardian_kwargs : dict or None, default=None Additional keyword arguments for guardian models. n_folds : int, default=5 Number of folds for cross-validation. threshold_grid : np.ndarray or None, default=None Grid of thresholds to evaluate. random_state : int, default=42 Random seed. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/cshc.py
CollaborativeFilteringSelector
Bases: ConfigurableMixin, AbstractModelBasedSelector
Collaborative filtering selector using SGD matrix factorization (ALORS-style).
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
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 | |
__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
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
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 | |
__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
ISA
Bases: ConfigurableMixin, AbstractSelector
ISA (Instance-Specific Aspeed) selector.
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
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 | |
__init__(k=10, use_k_tuning=True, n_folds=5, k_candidates=None, aspeed_cutoff=30, 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=True 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).
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
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 | |
__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.
Reference
Ortuzk et al. (2022)
Attributes
model : RankingMLP or Callable or None The model used for ranking.
Source code in asf/selectors/joint_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 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 | |
__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
MultiClassClassifier
Bases: ConfigurableMixin, AbstractModelBasedSelector
Multi-class classification algorithm selector.
Attributes
classifier : AbstractPredictor or None The trained classification model.
Source code in asf/selectors/multi_class.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 | |
__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.
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
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 | |
__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.
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
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 | |
__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
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 | |
__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.
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
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 | |
__init__(model_class=RandomForestRegressorWrapper, use_multi_target=False, normalize=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(). **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
SATzilla
Bases: ConfigurableMixin, AbstractEPMBasedSelector, AbstractModelBasedSelector
SATzilla-like selector using iterative imputation for censored runtimes.
Uses per-algorithm ridge models on expanded features.
Attributes
epms : dict[str, dict[str, EPM]] Mapping from algorithm name to another mapping of label to EPM. label_classifier : AbstractPredictor or None Model trained to predict instance labels (e.g., SAT/UNSAT). labels : list[str] Unique labels used for conditioning EPMs.
Source code in asf/selectors/satzilla.py
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 | |
__init__(model_class=RandomForestClassifierWrapper, **kwargs)
Initialize the SATzilla selector.
Parameters
model_class : type, default=RandomForestClassifierWrapper The class of the model used for label classification. **kwargs : Any Additional keyword arguments.
Source code in asf/selectors/satzilla.py
SNNAP
Bases: ConfigurableMixin, AbstractSelector
SNNAP (Simple Nearest Neighbor Algorithm Portfolio) selector.
Attributes
k : int Number of neighbors to use. metric : str Distance metric for NearestNeighbors. random_state : int or None Random seed for reproducibility. nn_model : NearestNeighbors or None Trained NearestNeighbors model. features_df : pd.DataFrame or None Training features. performance_df : pd.DataFrame or None Training performance.
Source code in asf/selectors/snnap.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 | |
__init__(k=5, metric='euclidean', random_state=None, **kwargs)
Initialize the SNNAP selector.
Parameters
k : int, default=5 Number of neighbors to use. metric : str, default='euclidean' Distance metric for NearestNeighbors. random_state : int or None, default=None Random seed for reproducibility. **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.
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
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 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
__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 | |
__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
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 | |
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
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 | |
__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
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 | |
__init__(budget=None, maximize=False, feature_groups=None, **kwargs)
Initialize the SingleBestSolver.
Parameters
budget : int 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
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
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 | |
__init__(budget=None, maximize=False, feature_groups=None, **kwargs)
Initialize the VirtualBestSolver.
Parameters
budget : int 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
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
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 | |