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

Refactor main.py for improved logging and modularity #62

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

bhushankhopkarr
Copy link
Contributor

Key optimizations:

  1. Error Handling: Added error handling in critical parts like dataset loading and report generation to avoid abrupt crashes.
  2. Function Decomposition: Split large blocks of logic into reusable functions (load_dataset, split_data, create_models, generate_predictions) for better readability and maintainability.
  3. Logger Setup: Used logging.basicConfig for logger configuration to ensure consistent logging.
  4. User Input Logic: Extracted the prediction loop into generate_predictions to reduce redundancy and improve clarity.
  5. Code Structure: Moved the XAIWrapper initialization and fit logic into a more streamlined flow.

This approach makes the code easier to follow and maintain, while ensuring errors are handled gracefully.

Copy link
Owner

@ombhojane ombhojane left a comment

Choose a reason for hiding this comment

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

Thanks for contributing

@ombhojane ombhojane merged commit 14ca115 into ombhojane:main Oct 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants