Skip to content

Conversation

@pranjaykumar926
Copy link

No description provided.

@pranjaykumar926
Copy link
Author

Modifications Made in Automotive_XAI Class:

  1. Added Return Values

    • Each method now returns relevant outputs instead of just printing results.
    • Example:
      • do_PFI() returns sorted_importances (list of feature importances).
      • do_IFI() returns ifi_values.
      • do_LIME() returns the LIME explanation object.
      • do_SHAP() returns shap_values, X_sample, and X_background.
      • do_ALE() returns the generated ALE plot.
  2. Fixed LIME Indexing Issue

    • Previously, set_local_index(self.y) attempted to use y directly as an index, which could cause errors.
    • Now, a valid sample index (sample_index = 0) is selected explicitly.
  3. Ensured Proper Handling of feature_name

    • In do_ALE() and do_SHAP(), feature_name is now correctly passed when generating plots.
  4. Improved Docstrings and Method Descriptions

    • Each method now includes a detailed docstring explaining its purpose, how it works, and what it returns.
    • Example:
      def do_SHAP(self):
          """
          Compute and visualize SHAP (SHapley Additive exPlanations) values.
          SHAP explains model predictions by assigning contributions to each feature.
      
          Returns:
          - shap_values: Computed SHAP values.
          - X_sample: Sample input data.
          - X_background: Background dataset for SHAP calculations.
          """
  5. Ensured Consistent Feature Input Handling

    • Used self.X[self.features] uniformly across all methods to avoid input inconsistencies.

Benefits of These Changes:

✅ More modular and reusable code
Better debugging and analysis with return values
Clearer documentation for easier understanding
Avoids potential indexing errors in LIME

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.

1 participant