Merged
Conversation
Improve readability and consistency of variable names in the FM loss computation module: - Use _i suffix for indices/iterators (e.g., profile_i, layer_i, val_i) - Use _count suffix for counts/lengths (e.g., children_count, node_val_count) - Add descriptive prefixes for context (e.g., profile_, layer_, node_) - Rename EXTRA_VALUES to EXTRA_SIDX_COUNT for clarity Files modified: - common.py: EXTRA_VALUES -> EXTRA_SIDX_COUNT - compare.py: Updated import - compute_sparse.py: Renamed loop variables and parameters - back_allocation.py: Renamed allocation variables - stream_sparse.py: Renamed stream handling variables - manager.py: Renamed event loop counter
Add module-level docstrings and detailed function comments explaining: - FM computation architecture and algorithm flow - CSR-like sparse storage model for memory efficiency - Bottom-up level traversal with aggregation and back allocation - Profile application (per-layer vs cross-layer) - Back allocation rules and extras handling - Stream I/O format and parsing state machine This improves code maintainability by documenting the complex financial module computation logic.
TECHNICAL.md: - Detailed CSR-inspired sparse storage format - Data structure documentation (nodes, compute_idx, extras) - Complete computation flow with algorithms - Aggregation and back allocation explanations - Stream I/O format specification - Memory management and performance tips - Debugging guidance README.md: - Quick start examples (Python API and CLI) - Configuration options (allocation rules, net loss, memory) - Input file requirements - Output format explanation - Supported financial terms - Performance optimization tips - Troubleshooting guide - Architecture overview
5 tasks
5 tasks
Ha-Ree
approved these changes
Feb 16, 2026
vinulw
approved these changes
Feb 17, 2026
Merged
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.
Refactor fmpy naming conventions and add comprehensive documentation
Summary
This PR improves the readability, maintainability, and documentation of the Financial Module (fmpy) computation code through systematic variable naming refactoring and comprehensive documentation additions.
Changes
1. Variable Naming Convention Refactoring
Established and applied consistent naming patterns across the FM computation module:
_isuffix (e.g.,profile_i,layer_i,val_i)_countsuffix (e.g.,children_count,node_val_count)profile_,layer_,node_)EXTRA_VALUEStoEXTRA_SIDX_COUNTfor better semantic meaningFiles modified:
common.py: Updated constant namingcompare.py: Updated import referencescompute_sparse.py: Refactored loop variables and parametersback_allocation.py: Refactored allocation variablesstream_sparse.py: Refactored stream handling variablesmanager.py: Refactored event loop counter2. Comprehensive Code Documentation
Added extensive inline documentation to improve code maintainability:
3. Technical Documentation (TECHNICAL.md)
Created comprehensive technical documentation covering:
4. User Guide (README.md)
Created user-friendly documentation including:
5. Code Quality
Impact
These changes significantly improve the maintainability and accessibility of the FM computation module without altering its functionality. The consistent naming conventions make the code easier to understand, while the comprehensive documentation provides both technical details for developers and practical guidance for users.