Skip to content

Conversation

@gbeane
Copy link
Collaborator

@gbeane gbeane commented Jan 3, 2026

Add Training Report Dialog & Window Menu

Summary

Replaces terminal output during classifier training with a non-modal dialog that displays training performance metrics. Training reports are also saved as Markdown files in the project for documentation and comparison purposes. Additionally, adds a Window menu for improved window management across JABS.

Changes

New Features

  • Training Report Dialog (src/jabs/ui/training_report.py)

    • Non-modal dialog using QWebEngineView to display HTML-formatted training reports
    • Can be reused across training sessions, preserving window position and size
    • Copy to Clipboard button to copy Markdown report
    • Shows informational text about report save location
    • Deferred HTML content loading to prevent "Compositor returned null texture" errors
  • Training Report Generation (src/jabs/classifier/training_report.py)

    • TrainingReportData dataclass for structured training information
    • CrossValidationResult dataclass for individual CV iteration results
    • generate_markdown_report() - Creates Markdown-formatted reports with timestamp
    • save_training_report() - Saves reports to disk
  • Window Menu (src/jabs/ui/main_window.py)

    • Standard macOS-style Window menu with:
      • Minimize (⌘M / Ctrl+M)
      • Zoom (toggle maximize/restore)
      • Bring All to Front
    • Dynamic window list showing all open JABS windows:
      • Main Window
      • User Guide (when open)
      • Training Report dialogs (when open)
    • Checkmark (✓) indicates currently active window
    • Click any window to activate and bring to front

Modified Components

  • TrainingThread (src/jabs/ui/training_thread.py)

    • Removed all print() statements
    • Added training_report signal that emits Markdown content
    • Generates and saves training reports to jabs/training_logs/
    • Report filenames include behavior name and timestamp (e.g., Grooming_20260102_143022_training_report.md)
  • CentralWidget (src/jabs/ui/central_widget.py)

    • Connected training_report signal to new _on_training_report() slot
    • Modified _training_thread_complete() to display or update training report dialog
    • Reuses existing dialog when multiple trainings are run
    • Recreates dialog when JABS has focus to ensure proper focus switching
    • Quietly updates existing dialog when JABS doesn't have focus (no focus stealing from other apps)
    • Added get_open_dialogs() public method for Window menu integration
    • Stores Markdown temporarily between report generation and training completion
  • TrainingReportDialog (src/jabs/ui/training_report.py)

    • HTML rendering moved into dialog class as _markdown_to_html() method
    • Added update_content() method to refresh dialog with new training results
    • Proper encapsulation with UI-specific logic contained in UI module
  • UserGuideDialog (src/jabs/ui/user_guide_dialog.py)

    • Removed WindowType.Tool flag to prevent staying on top of other JABS windows
    • Deferred initial content loading to prevent compositor texture errors
    • Now appears in Window menu when open

Documentation Updates

  • gui.md

    • Updated Train Button description to mention training report dialog
    • Added new "Training Reports" section explaining report contents and use cases
    • Added Window menu documentation explaining all menu items and dynamic window list
  • keyboard-shortcuts.md

    • Replaced all occurrences of Cmd+ with symbol
  • project-setup.md

    • Added jabs/training_logs directory documentation

Tests

  • New Test Files:
    • tests/classifier/test_training_report.py - 18 tests for report generation and saving
    • tests/ui/test_training_report_dialog.py - 13 tests for dialog UI components

Training Report Contents

Each training report includes:

  • Training Summary: Behavior name, classifier type, window size, distance unit, training time, timestamp
  • Label Counts: Frame and bout counts for both classes
  • Cross-Validation Results: Performance metrics (accuracy, precision, recall, F1) for each iteration with test video/identity
  • Feature Importance: Top 20 features from the final trained model

Window Management Improvements

The new Window menu provides:

  • Discoverability: Users can see all open JABS windows in one place
  • Keyboard accessible: All window management via keyboard navigation
  • Smart focus handling: Training report only steals focus when user is working in JABS
  • Reusable dialogs: Training report dialog preserves position/size across training sessions

Benefits

  • Better UX: Reports appear automatically in an easy-to-read format
  • Permanent Records: All training sessions are logged to disk with timestamps
  • Comparison: Users can compare different classifier configurations over time
  • Documentation: Training reports serve as analysis workflow documentation
  • Improved Window Management: Easy switching between JABS windows via Window menu
  • Respects User Focus: Doesn't steal focus from other applications
  • Persistent Dialogs: Training report and User Guide remain accessible across sessions

Screenshots

Training Report Dialog

Testing

  • ✅ Tested with cross-validation (k > 0) and without (k = 0)
  • ✅ Verified Markdown files are saved correctly to jabs/training_logs/
  • ✅ Confirmed HTML rendering displays all tables and metrics correctly
  • ✅ Validated dialog appears after training and can be reused
  • ✅ Validated no output printed to Terminal during training
  • ✅ Tested Window menu with multiple open windows
  • ✅ Verified focus behavior when JABS has/doesn't have focus
  • ✅ Tested dialog reuse preserves position and size
  • ✅ Verified User Guide no longer stays on top of other JABS windows

Linked Issues

Closes #140

Copy link
Contributor

Copilot AI left a 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 replaces terminal output during classifier training with a modal dialog that displays formatted training reports. Reports are automatically saved as Markdown files in the project's jabs/training_logs/ directory for documentation and comparison purposes.

Key changes:

  • New training report dialog that displays HTML-formatted performance metrics
  • Training report generation system that creates Markdown and HTML reports
  • Removal of all print statements from the training process

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/jabs/ui/training_thread.py Removed print statements; added report generation and HTML emission
src/jabs/ui/training_report.py New dialog component for displaying training reports
src/jabs/ui/central_widget.py Connected training report signal and displays dialog after training
src/jabs/classifier/training_report.py New module with report generation functions and data structures
src/jabs/classifier/classifier.py Refactored feature importance into reusable getter method
src/jabs/classifier/init.py Exported new training report classes and functions
src/jabs/project/project_paths.py Added training_log_dir property and directory creation
src/jabs/project/session_tracker.py Removed unused fbeta_notbehavior parameter
src/jabs/resources/docs/user_guide/gui.md Documented new training report feature
src/jabs/resources/docs/user_guide/project-setup.md Documented jabs/training_logs directory

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gbeane added 2 commits January 2, 2026 22:58
…rt that have special meaning in Markdown; remove unused parameter
@gbeane gbeane requested a review from Copilot January 3, 2026 04:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gbeane and others added 2 commits January 2, 2026 23:15
@gbeane gbeane requested a review from vivekJax January 3, 2026 14:32
@gbeane gbeane requested a review from Copilot January 4, 2026 00:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gbeane gbeane self-assigned this Jan 4, 2026
@gbeane gbeane merged commit 2970ba5 into main Jan 6, 2026
2 checks passed
@gbeane gbeane deleted the add-training-report-dialog branch January 6, 2026 16:28
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.

Option to save performance report to file

3 participants