Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

surfaces_surrogates-0.0.1-py3-none-any.whl (339.8 kB view details)

Uploaded Python 3

File details

Details for the file surfaces_surrogates-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for surfaces_surrogates-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7991f55f786a28f4114f5e206e2f2038d1df1ac98ddeb03730d27afee962f48
MD5 95001821c88ec031daa823dfeccec7ee
BLAKE2b-256 ff94371eb1f06fd5146108edae0cd666cd86f53b73f4cc75a467b4a9519db4ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page