-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add BeliefVisualizer for belief evolution visualization and seaborn dependency #35
Conversation
- Add confidence dampening to prevent saturation at high values - Implement time-based decay factor for long-term uncertainty - Increase sensitivity to divergent evidence (threshold 0.7) - Cap maximum confidence at 0.95 - Add confidence decay factor of 0.995 per update System now shows more realistic belief evolution: - Better handles contradictory evidence - Maintains appropriate uncertainty - Prevents overconfidence - Shows natural confidence erosion over time Testing shows smooth confidence transitions from 0.5→0.92→0.45 over 10 updates with mixed evidence.
- Add seaborn to requirements.txt to include it as a dependency - Implement BeliefVisualizer class in belief_visualizer.py to create multi-panel visualizations of belief evolution - Update bayes_updating.py to import BeliefVisualizer and use it to plot belief evolution for a given topic
Reviewer's Guide by SourceryThis PR implements a Bayesian belief updating system with visualization capabilities. The implementation includes a new BeliefVisualizer class for creating multi-panel visualizations of belief evolution over time, and updates to the Bayesian updating system to integrate with this visualization component. The system uses seaborn for enhanced plotting capabilities. Sequence diagram for belief updating and visualizationsequenceDiagram
actor User
participant BayesianBeliefUpdater
participant BeliefVisualizer
User->>BayesianBeliefUpdater: initialize_belief_state(topic)
BayesianBeliefUpdater->>BayesianBeliefUpdater: generate_embedding(topic)
BayesianBeliefUpdater->>BayesianBeliefUpdater: create BeliefState
User->>BayesianBeliefUpdater: update_belief(topic, new_evidence)
BayesianBeliefUpdater->>BayesianBeliefUpdater: generate_embedding(new_evidence)
BayesianBeliefUpdater->>BayesianBeliefUpdater: calculate likelihood
BayesianBeliefUpdater->>BayesianBeliefUpdater: update belief vector
User->>BayesianBeliefUpdater: analyze_belief_shift(topic)
BayesianBeliefUpdater->>User: return analysis
User->>BeliefVisualizer: plot_belief_evolution(analysis, evidence_list, topic)
BeliefVisualizer->>BeliefVisualizer: create visualization
Class diagram for Bayesian belief updating systemclassDiagram
class BeliefState {
np.ndarray belief_vector
float confidence
List~Tuple~np.ndarray, float~~ prior_states
List~str~ themes
}
class BayesianBeliefUpdater {
-LanguageModel llm
-Dict~str, BeliefState~ belief_states
-Dict theme_weights
-Logger logger
+initialize_belief_state(topic: str) BeliefState
+update_belief(topic: str, new_evidence: str) BeliefState
+analyze_belief_shift(topic: str) Dict
}
class BeliefVisualizer {
-Path output_dir
+plot_belief_evolution(analysis: Dict, evidence_list: List~str~, topic: str)
}
BayesianBeliefUpdater --> BeliefState
BayesianBeliefUpdater --> BeliefVisualizer
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @leonvanbokhorst - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding error handling for file operations in BeliefVisualizer, particularly around directory creation and file saving. This would prevent silent failures due to permission issues.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Add adaptive B-spline interpolation based on available data points - Implement fallback to direct line plotting for sparse data - Fix matplotlib style configuration - Ensure graceful handling of different data densities The visualization now automatically adjusts its smoothing approach based on the number of data points, preventing interpolation errors while maintaining an aesthetically pleasing appearance.
Summary by Sourcery
Introduce a new BeliefVisualizer class for visualizing belief evolution and update the Bayesian belief updating process to include visualization capabilities. Add seaborn as a dependency to support these visualizations.
New Features:
Enhancements:
Build: