-
Notifications
You must be signed in to change notification settings - Fork 0
feat: optimizer improvements and backend refactor #40
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
base: main
Are you sure you want to change the base?
Conversation
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
PR Overview
This PR introduces optimizer improvements and backend refactorings to enhance model evaluation and reporting capabilities through added serialization support, refined plotting, and LangChain‐based report generation. Key changes include:
- Addition of pickle-based save_state/load_state methods in both prepare.py and xai.py.
- Enhancements to the get_plot method and new properties for managing test data, predictions, and various evaluation metrics in xai.py.
- Integration of LangChain for comprehensive model evaluation report generation along with dependency updates in pyproject.toml.
Reviewed Changes
| File | Description |
|---|---|
| src/quoptuna/backend/utils/data_utils/prepare.py | Added serialization methods for class state persistence using pickle. |
| src/quoptuna/backend/xai/xai.py | Enhanced properties, plotting functions (returning base64 images), added evaluation metrics, and LangChain-based report generation. |
| pyproject.toml | Introduced new dependencies for LangChain integration. |
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
| return values | ||
| self._handle_plot_error(plot_type, e) | ||
|
|
Copilot
AI
Mar 8, 2025
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.
The 'return values' statement in the exception block prevents the subsequent error handling call from executing. Consider removing or repositioning it to ensure errors are handled appropriately.
| return values | |
| self._handle_plot_error(plot_type, e) | |
| self._handle_plot_error(plot_type, e) | |
| return values |
| def get_classification_report(self): | ||
| """Get the classification report of the model.""" | ||
| return classification_report(self.y_test, self.predictions) | ||
|
|
Copilot
AI
Mar 8, 2025
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.
Duplicate definition of 'get_classification_report' detected. Remove one of the definitions to avoid unintended overrides.
| def get_classification_report(self): | |
| """Get the classification report of the model.""" | |
| return classification_report(self.y_test, self.predictions) |
| """Get the f1 score of the model.""" | ||
| return f1_score(self.y_test, self.predictions) | ||
|
|
||
| def get_average_precision_score(self): |
Copilot
AI
Mar 8, 2025
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.
Duplicate definition of 'get_average_precision_score' found. Consolidate the implementations to maintain consistent behavior.
This pull request includes several significant changes to the
quoptunabackend, focusing on enhancing model evaluation and reporting capabilities. The most important changes include the addition of new dependencies, improvements to data handling and serialization, and the integration of advanced reporting features using LangChain.Dependencies:
pyproject.tomlfor LangChain and related libraries.Data Handling and Serialization:
save_stateandload_statemethods inprepare.pyandxai.pyfor class state serialization using pickle. [1] [2]Model Evaluation Enhancements:
xai.pyfor handling test data and predictions, includingx_test,y_test,predictions, andpredictions_proba.get_plotmethod to support saving plots and returning base64-encoded images. [1] [2]Reporting with LangChain:
These changes collectively improve the functionality and usability of the
quoptunabackend, providing more robust tools for model evaluation and reporting.