Skip to content

Conversation

@devin-ai-integration
Copy link

Round probability displays to 3 decimal places in tree output

Summary

Implements ticket UBS-2 by rounding probability values to 3 decimal places in tree string representations for improved readability. The change wraps _compute_posterior_mean() calls with np.round(decimals=3) in the _str() methods of both BasePerpendicularTree and BaseHyperplaneTree classes. This only affects classification trees (gated by if not self.is_regression: check) and does not modify any functional logic—only the display output.

Files modified:

  • bayesian_decision_tree/base_perpendicular.py (line 240)
  • bayesian_decision_tree/base_hyperplane.py (line 177)

Review & Testing Checklist for Human

  • Run a classification tree example (e.g., examples/demo_classification_perpendicular.py) and verify the printed tree output shows probabilities rounded to 3 decimal places
  • Test with multiclass classification to ensure probability array formatting looks reasonable
  • Confirm regression trees are unaffected (their output should remain unchanged)

Notes

  • This is a display-only change with no functional impact on model training or predictions
  • The rounding is hardcoded to 3 decimals as specified in the requirements
  • numpy was already imported in both files, so no new dependencies were added
  • The change is properly scoped to classification trees only via the existing is_regression flag

Linear Ticket: UBS-2
Requested by: Shawn Azman (@ShawnAzman)
Link to Devin run: https://app.devin.ai/sessions/73e72f238ea74ef086a6b1e524655b49

- Modified base_perpendicular.py to round classification tree probabilities
- Modified base_hyperplane.py to round classification tree probabilities
- Wraps _compute_posterior_mean() with np.round(decimals=3) for better readability
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants