-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: Refactor algorithm trait #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
To be more idiomatic Rust
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
| 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%) |
A little more idiomatic and a little less idiotic
|
| 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%) |
Attempts to make the API a little more intuitive, and adding documentation to the trait.