Skip to content
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

model evaluation bug fixes #5166

Merged
merged 3 commits into from
Nov 20, 2024
Merged

model evaluation bug fixes #5166

merged 3 commits into from
Nov 20, 2024

Conversation

imanjra
Copy link
Contributor

@imanjra imanjra commented Nov 20, 2024

What changes are proposed in this pull request?

(Please fill in changes proposed in this fix)

How is this patch tested? If it is not, please explain why.

(Details)

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features

    • Enhanced dialog functionalities for configuring class performance and confusion matrix settings.
    • Added a text input field for capturing evaluation notes.
  • Bug Fixes

    • Improved handling of pending evaluations in the evaluation panel to ensure accurate storage.

These updates aim to streamline user interactions and improve the overall evaluation management experience.

Copy link
Contributor

coderabbitai bot commented Nov 20, 2024

Walkthrough

The changes in this pull request focus on enhancing the Evaluation component in Evaluation.tsx by introducing new dialog functionalities for configuring class performance and confusion matrix settings. The handling of pending evaluations in the EvaluationPanel class is also updated to ensure correct storage of evaluation data. Overall, these modifications improve user interaction and data management within the evaluation framework.

Changes

File Change Summary
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx Added new dialog functionalities for class performance and confusion matrix settings; updated dialog management and input handling for evaluation notes.
fiftyone/operators/builtins/panels/model_evaluation/init.py Modified load_pending_evaluations method to correctly store pending evaluations in the evaluation panel.

Possibly related PRs

  • various model evaluation fixes and enhancements #5123: This PR directly modifies the Evaluation component in Evaluation.tsx, adding new state variables and updating dialog components, which aligns closely with the changes made in the main PR regarding dialog functionalities and configuration options.

Suggested reviewers

  • Br2850

🐰 In the meadow, changes bloom bright,
Dialogs dancing, a joyful sight.
Configs for classes, notes in a field,
With every update, new magic revealed.
Hopping along, we cheer and play,
Enhancements abound, hip-hip-hooray! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@imanjra imanjra changed the title Bugfix/model eval x2 model evaluation bug fixes Nov 20, 2024
@imanjra imanjra marked this pull request as ready for review November 20, 2024 22:25
@imanjra imanjra requested a review from a team November 20, 2024 22:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (2)

Line range hint 1472-1476: Consider enhancing type safety for configuration objects

While the type definitions are good, consider making the configuration object properties more strictly typed by using literal types for the sort options.

 type PLOT_CONFIG_TYPE = {
-  sortBy?: string;
+  sortBy?: 'default' | 'az' | 'za' | 'best' | 'worst' | 'mc' | 'lc';
   limit?: number;
   log?: boolean;
 };

Line range hint 39-46: Consider optimizing state management

The component uses multiple separate useState hooks for dialog configurations. Consider combining related states to reduce potential re-renders and improve maintainability.

-  const [classPerformanceConfig, setClassPerformanceConfig] =
-    useState<PLOT_CONFIG_TYPE>({});
-  const [classPerformanceDialogConfig, setClassPerformanceDialogConfig] =
-    useState<PLOT_CONFIG_DIALOG_TYPE>(DEFAULT_BAR_CONFIG);
-  const [confusionMatrixConfig, setConfusionMatrixConfig] =
-    useState<PLOT_CONFIG_TYPE>({ log: true });
-  const [confusionMatrixDialogConfig, setConfusionMatrixDialogConfig] =
-    useState<PLOT_CONFIG_DIALOG_TYPE>(DEFAULT_BAR_CONFIG);
+  const [configs, setConfigs] = useState({
+    classPerformance: {
+      current: {} as PLOT_CONFIG_TYPE,
+      dialog: DEFAULT_BAR_CONFIG as PLOT_CONFIG_DIALOG_TYPE
+    },
+    confusionMatrix: {
+      current: { log: true } as PLOT_CONFIG_TYPE,
+      dialog: DEFAULT_BAR_CONFIG as PLOT_CONFIG_DIALOG_TYPE
+    }
+  });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2ae21fe and d04b046.

⛔ Files ignored due to path filters (3)
  • app/packages/components/package.json is excluded by !**/*.json
  • app/packages/core/package.json is excluded by !**/*.json
  • app/yarn.lock is excluded by !**/yarn.lock, !**/*.lock, !**/*.lock
📒 Files selected for processing (2)
  • app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1 hunks)
  • fiftyone/operators/builtins/panels/model_evaluation/__init__.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (2)
fiftyone/operators/builtins/panels/model_evaluation/__init__.py (1)

357-357: LGTM: Bug fix for storing pending evaluations

The change correctly uses pending_evaluations_in_store instead of pending_evaluations, ensuring that the updated state of pending evaluations is properly stored. This fixes a bug where pending evaluation updates might have been lost.

Let's verify the usage of these variables in the method:

✅ Verification successful

LGTM: Correct usage of pending evaluations store variable

The change correctly uses pending_evaluations_in_store to store the updated state. The code search confirms that:

  • The variable is properly initialized from the store at the start of the method
  • It maintains a per-dataset mapping of pending evaluations
  • The same pattern of using pending_evaluations_in_store is consistently used throughout the codebase
  • The fix ensures that updates to pending evaluations are properly persisted
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of pending evaluations handling
# Look for other places where pending evaluations are stored
rg -A 5 "pending_evaluations.*store\.set" 

Length of output: 43


Script:

#!/bin/bash
# Let's try a broader search to understand the context of pending evaluations
rg -B 5 -A 5 "pending_evaluations_in_store"

Length of output: 3029


Script:

#!/bin/bash
# Let's also look for the method definition to understand the full context
ast-grep --pattern 'def load_pending_evaluations($$$)'

Length of output: 56


Script:

#!/bin/bash
# Search for any store operations related to pending evaluations with a broader pattern
rg -B 5 -A 5 'store.*pending_evaluations'

Length of output: 4018

app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx (1)

1353-1353: LGTM: Dialog cancel handler implementation is correct

The cancel button's onClick handler properly calls the close function and follows React best practices.

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.

3 participants