Algorithm selection framework
Project description
Algorithm Selection Framework (ASF)
ASF is a lightweight yet powerful Python library for algorithm selection and empirical performance prediction. It implements various algorithm selection methods, along with algorithm pre-selection, pre-solving schedules and more features to easily create algorithm selection pipeline. ASF is a modular framework that allows easy extensions to tailor made an algorithm selector for every use-case. While ASF includes several built-in machine learning models through scikit-learn and XGBoost, it supports every model that complies with the scikit-learn API. ASF also implements empirical performance prediction, allowing to use different performance scalings.
ASF is written in Python 3 and is intended to use with Python 3.10+. It requires only scikit-learn, NumPy and Pandas as basic requirements. More advanced features (such as hyperparameter optimisation) requires additional dependencies.
You can find full documentation in: https://hadarshavit.github.io/asf/
Installation
ASF is written in Python3 and requires Python version 3.10+. The basic installation is lightweight and requires only NumPy, Pandas and scikit-learn.
ASF is currently tested on Linux machines. Mac and Windows (official) support will be released in the near future.
To install the base version run
pip install asf
Additional options
Additional options include:
- XGBoost model suppot
pip install asf[xgb] - PyTorch-based models
pip install asf[nn] - ASlib scenarios reading
pip install asf[aslib]
Quick start
The first step is to define a the data. It can be either NumPy array or Pandas DataFrame. The data contains of (at least) two matrices. The first defines the instance features with a row for every instance and each column defines one feature. The second is the performance data, for which every row describes an instance and each column the performance of a single algorithm.
Here, we define some toy data on three instances, three features and three algorithms.
data = np.array(
[
[10, 5, 1],
[20, 10, 2],
[15, 8, 1.5],
]
)
features = pd.DataFrame(data, columns=["feature1", "feature2", "feature3"])
performance = np.array(
[
[120, 100, 110],
[140, 150, 130],
[180, 170, 190],
]
)
performance = pd.DataFrame(data, columns=["algo1", "algo2", "algo3"])
We can then define a selector:
from asf.selectors import PairwiseClassifier
from sklearn.ensemble import RandomForestClassifier
selector = PairwiseClassifier(model_class=RandomForestClassifier)
selector.fit(features, performance)
Next, we can use the selector to predict on unseen dta:
selector.predict(features)
Currently, ASF always returns the prediction in the ASlib format: a dictionary which has the instance id (row index, in case of a numpy array or the index of the row for a pandas dataframe) as keys and an array of tuples (predicted algorithm, budget). The selectors has only one tuple in the array, which is the selected algorithm. An example output is:
{
0: [('algo2', None)],
1: [('algo3', None)],
2: [('algo2', None)]
}
The budget is set by default to None. To change the budget, you can pass it as an argument for the selector initialisation.
Similarly, ASF minimises the performance by default. To change it, pass maximize=True to the selector.
Cite Us
If you use ASF, please cite the Zenodo DOI. We are currently working on publishing a paper on ASF, but by then a Zenodo citation will do it.
@software{ASF,
author = {Hadar Shavit and Holger Hoos},
doi = {10.5281/zenodo.15288151},
title = {ASF: Algorithm Selection Framework},
url = {https://doi.org/10.5281/zenodo.15288151},
year = {in progress},
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asf-0.1.4.tar.gz.
File metadata
- Download URL: asf-0.1.4.tar.gz
- Upload date:
- Size: 130.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5f5ef9f3da467ee05c2ad951464723c8c8287331ac69e5740a645369904a07d
|
|
| MD5 |
c5163dd4d643dbe8cfb15a49576382e7
|
|
| BLAKE2b-256 |
63293aedf4575f7e9a13a3447bfbbf4fb68c5a077ad7d2561020d5e1b36962fa
|
Provenance
The following attestation bundles were made for asf-0.1.4.tar.gz:
Publisher:
publish.yml on hadarshavit/asf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asf-0.1.4.tar.gz -
Subject digest:
a5f5ef9f3da467ee05c2ad951464723c8c8287331ac69e5740a645369904a07d - Sigstore transparency entry: 779632180
- Sigstore integration time:
-
Permalink:
hadarshavit/asf@7806e15c670327037500d35f6643f18bfb4595a7 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/hadarshavit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7806e15c670327037500d35f6643f18bfb4595a7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file asf-0.1.4-py3-none-any.whl.
File metadata
- Download URL: asf-0.1.4-py3-none-any.whl
- Upload date:
- Size: 190.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28a80d791f4cc949b87e04ac8788a342d617425f8bbc84b8ad0d61068c1f81dc
|
|
| MD5 |
d331804193657c64d5707ad0e8229af4
|
|
| BLAKE2b-256 |
0d31f32f68384c14872ce2d9280d7e3a1c77ab0ad6a48a44cfd2529f68b2dd74
|
Provenance
The following attestation bundles were made for asf-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on hadarshavit/asf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asf-0.1.4-py3-none-any.whl -
Subject digest:
28a80d791f4cc949b87e04ac8788a342d617425f8bbc84b8ad0d61068c1f81dc - Sigstore transparency entry: 779632182
- Sigstore integration time:
-
Permalink:
hadarshavit/asf@7806e15c670327037500d35f6643f18bfb4595a7 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/hadarshavit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7806e15c670327037500d35f6643f18bfb4595a7 -
Trigger Event:
release
-
Statement type: