{"id":15564042,"url":"https://github.com/eigenein/rust-hyperopt","last_synced_at":"2025-09-08T11:13:14.918Z","repository":{"id":232618258,"uuid":"784426882","full_name":"eigenein/rust-hyperopt","owner":"eigenein","description":"Tree-of-Parzen-estimators hyperparameter optimization","archived":false,"fork":false,"pushed_at":"2025-03-31T23:10:19.000Z","size":117,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-10T20:41:27.312Z","etag":null,"topics":["hyperopt","hyperparameter-optimization","hyperparameter-search","hyperparameter-tuning","kernel-density-estimation","machine-learning","rust-crate","tree-of-parzen-estimator"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/hyperopt","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eigenein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-09T20:39:27.000Z","updated_at":"2025-04-28T03:55:03.000Z","dependencies_parsed_at":"2024-04-15T11:15:59.790Z","dependency_job_id":"d1fb5ef9-a08d-49e3-b7d3-232a53608fe0","html_url":"https://github.com/eigenein/rust-hyperopt","commit_stats":null,"previous_names":["eigenein/rust-hyperopt"],"tags_count":17,"template":false,"template_full_name":"eigenein/rust-template","purl":"pkg:github/eigenein/rust-hyperopt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Frust-hyperopt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Frust-hyperopt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Frust-hyperopt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Frust-hyperopt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eigenein","download_url":"https://codeload.github.com/eigenein/rust-hyperopt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Frust-hyperopt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274174271,"owners_count":25235203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyperopt","hyperparameter-optimization","hyperparameter-search","hyperparameter-tuning","kernel-density-estimation","machine-learning","rust-crate","tree-of-parzen-estimator"],"created_at":"2024-10-02T16:35:00.214Z","updated_at":"2025-09-08T11:13:14.662Z","avatar_url":"https://github.com/eigenein.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `hyperopt`\n\nTree-of-Parzen-estimators hyperparameter optimization for Rust\n\n[![Documentation](https://img.shields.io/docsrs/hyperopt?style=for-the-badge)\n](https://docs.rs/hyperopt)\n[![Check status](https://img.shields.io/github/actions/workflow/status/eigenein/rust-hyperopt/check.yaml?style=for-the-badge)]((https://github.com/eigenein/rust-hyperopt/actions/workflows/check.yaml))\n[![Code coverage](https://img.shields.io/codecov/c/github/eigenein/rust-hyperopt?style=for-the-badge)\n](https://app.codecov.io/gh/eigenein/rust-hyperopt)\n![Maintenance](https://img.shields.io/maintenance/yes/2024?style=for-the-badge)\n\n## Examples\n\n### Continuous\n\n```rust\nuse std::f64::consts::{FRAC_PI_2, PI};\n\nuse approx::assert_abs_diff_eq;\nuse fastrand::Rng;\nuse ordered_float::NotNan;\n\nuse hyperopt::Optimizer;\nuse hyperopt::kernel::continuous::Epanechnikov;\nuse hyperopt::kernel::universal::Uniform;\n\nfn main() {\n    let min = NotNan::new(FRAC_PI_2).unwrap();\n    let max = NotNan::new(PI + FRAC_PI_2).unwrap();\n    let mut optimizer = Optimizer::new(\n        min..=max,                       // parameter search limits\n        Uniform::with_bounds(min..=max), // our initial guess is just as bad\n        Rng::with_seed(42),\n    );\n\n    // Run 50 trials for the cosine function and try to find the point `(π, -1)`:\n    for _ in 0..50 {\n        // Generate new trials using Epanechnikov kernel with `\u003cNotNan\u003cf64\u003e\u003e`\n        // as both parameter and density:\n        let x = optimizer.new_trial::\u003cEpanechnikov\u003cNotNan\u003cf64\u003e\u003e\u003e();\n        \n        // Tell the optimizer the result of evaluation:\n        optimizer.feed_back(x, NotNan::new(x.cos()).unwrap());\n    }\n\n    let best_trial = optimizer.best_trial().unwrap();\n    assert_abs_diff_eq!(best_trial.parameter.into_inner(), PI, epsilon = 0.05);\n    assert_abs_diff_eq!(best_trial.metric.into_inner(), -1.0, epsilon = 0.01);\n}\n```\n\n### Discrete\n\n```rust\nuse fastrand::Rng;\nuse ordered_float::OrderedFloat;\n\nuse hyperopt::Optimizer;\nuse hyperopt::kernel::discrete::Binomial;\nuse hyperopt::kernel::universal::Uniform;\n\nfn main() {\n    let mut optimizer = Optimizer::new(\n        -100..=100,\n        Uniform::with_bounds(-100..=100),\n        Rng::with_seed(42),\n    );\n\n    for _ in 0..30 {\n        // Use the binomial kernel for `i32` as parameter\n        // and `OrderedFloat\u003cf64\u003e` as density:\n        let x = optimizer.new_trial::\u003cBinomial\u003ci32, OrderedFloat\u003cf64\u003e\u003e\u003e();\n        \n        // Optimize the parabola: https://www.wolframalpha.com/input?i=x%5E2+-+4x\n        optimizer.feed_back(x, x * x - 4 * x);\n    }\n\n    let best_trial = optimizer.best_trial().unwrap();\n    assert_eq!(best_trial.parameter, 2);\n    assert_eq!(best_trial.metric, -4);\n}\n```\n\n## Features\n\n- `ordered-float` enables support for `OrderedFloat` and `NotNan` types\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenein%2Frust-hyperopt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feigenein%2Frust-hyperopt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenein%2Frust-hyperopt/lists"}