refactor: Refactor algorithm trait#196
Merged
Merged
Conversation
To be more idiomatic Rust
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the algorithm trait to make the API more intuitive by renaming methods to be more consistent and adding comprehensive documentation. It also simplifies the algorithm execution flow by replacing manual cycle iteration with a dedicated fit() method.
- Renamed module from
evaluationtoestimationand updated corresponding method names - Added extensive documentation to the
Algorithmstrait methods - Simplified the execution flow by consolidating the fit logic into a single method
Reviewed Changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routines/mod.rs | Updated module name from evaluation to estimation |
| src/algorithms/postprob.rs | Updated imports and method names, simplified convergence handling |
| src/algorithms/npod.rs | Updated imports and method names, removed converged field |
| src/algorithms/npag.rs | Updated imports and method names, removed converged field, improved error messages |
| src/algorithms/mod.rs | Major trait refactoring with documentation and simplified execution flow |
| examples/*.rs | Simplified example usage by replacing manual cycle iteration with fit() method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Contributor
|
| Branch | refactor-algorithm-trait |
| Testbed | rust-loki |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) |
|---|---|---|---|
| bimodal_ke_npag | 📈 view plot 🚷 view threshold | 35.06 s(+2.60%)Baseline: 34.17 s | 35.65 s (98.34%) |
| bimodal_ke_npod | 📈 view plot 🚷 view threshold | 44.32 s(+0.11%)Baseline: 44.27 s | 44.78 s (98.98%) |
| bimodal_ke_postprob | 📈 view plot 🚷 view threshold | 15.39 s(+0.22%)Baseline: 15.36 s | 15.61 s (98.56%) |
mhovd
commented
Oct 21, 2025
A little more idiomatic and a little less idiotic
Siel
approved these changes
Nov 3, 2025
Contributor
|
| Branch | refactor-algorithm-trait |
| Testbed | rust-moan |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) |
|---|---|---|---|
| bimodal_ke_npag | 📈 view plot 🚷 view threshold | 25.32 s(-0.51%)Baseline: 25.45 s | 26.30 s (96.28%) |
| bimodal_ke_npod | 📈 view plot 🚷 view threshold | 10.43 s(-0.73%)Baseline: 10.50 s | 10.78 s (96.72%) |
| bimodal_ke_postprob | 📈 view plot 🚷 view threshold | 3.47 s(-0.35%)Baseline: 3.48 s | 3.56 s (97.41%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempts to make the API a little more intuitive, and adding documentation to the trait.