Pre-trained ONNX surrogate models for the surfaces library
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 surfaces_surrogates-0.0.1-py3-none-any.whl.
File metadata
- Download URL: surfaces_surrogates-0.0.1-py3-none-any.whl
- Upload date:
- Size: 339.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7991f55f786a28f4114f5e206e2f2038d1df1ac98ddeb03730d27afee962f48
|
|
| MD5 |
95001821c88ec031daa823dfeccec7ee
|
|
| BLAKE2b-256 |
ff94371eb1f06fd5146108edae0cd666cd86f53b73f4cc75a467b4a9519db4ec
|