surfaces-surrogates
Pre-trained ONNX surrogate models for the surfaces library.
Surrogate models approximate computationally expensive ML hyperparameter optimization test functions. Instead of running real cross-validation (seconds to minutes per evaluation), the surrogate returns a prediction in under a millisecond via ONNX inference.
Installation
pip install surfaces-surrogates
For use with the surfaces library, install the surrogates extra which includes onnxruntime:
pip install surfaces[surrogates]
Usage
Surrogates are used transparently through the surfaces library:
from surfaces.test_functions.machine_learning import KNeighborsClassifierFunction
func = KNeighborsClassifierFunction(use_surrogate=True)
score = func({"n_neighbors": 5, "algorithm": "auto"})
The surrogate models can also be loaded directly:
from surfaces_surrogates.models import get_model_path
path = get_model_path("k_neighbors_classifier")
Available Models
| Model | R2 | Fidelity-Aware |
|---|---|---|
| decision_tree_classifier | 0.995 | Yes |
| k_neighbors_regressor | 0.988 | Yes |
| k_neighbors_classifier | 0.966 | Yes |
| gradient_boosting_regressor | n/a | No |
| svm_regressor | 0.351 | Yes |
Training New Models
To retrain or extend surrogate models, install the training dependencies:
pip install surfaces-surrogates[train]
Then use the training script:
python scripts/train_surrogates.py --status # show current state
python scripts/train_surrogates.py # train new/stale models
python scripts/train_surrogates.py --force # retrain everything
License
MIT
Metadata
Release files for surfaces-surrogates 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| surfaces_surrogates-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / surfaces_surrogates-0.0.1-py3-none-any.whl
| Download URL | surfaces_surrogates-0.0.1-py3-none-any.whl |
|---|---|
| Size | 339.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7991f55f786a28f4114f5e206e2f2038d1df1ac98ddeb03730d27afee962f48
|
|
BLAKE2b-256 checksum How to use checksums |
ff94371eb1f06fd5146108edae0cd666cd86f53b73f4cc75a467b4a9519db4ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|