Skip to content

Conversation

@shahedahmed2023
Copy link

Title: Update KFDA implementation to address deprecated features and numerical stability issues

Description:
This PR updates the Kernel Fisher Discriminant Analysis (KFDA) implementation to address several issues:

  1. Fixes deprecated features:

    • Updates OneHotEncoder usage to specify sparse_output parameter
    • Replaces scipy.sparse.eye with numpy.eye for better compatibility
  2. Improves numerical stability:

    • Adds proper handling of edge cases in n_components calculation
    • Prevents division by zero in class mean calculations
    • Adds regularization to matrices for better conditioning
    • Implements custom prediction to avoid NearestCentroid warnings
  3. Enhances robustness:

    • Handles broadcasting issues in mean centering
    • Adds appropriate jitter to centroids when needed
    • Updates attribute checks for better compatibility with scikit-learn

These changes maintain the same mathematical approach while making the implementation more robust across a wider range of datasets and making it compatible with newer versions of scikit-learn and scipy.

Tests have been run on various datasets to ensure the accuracy is maintained while eliminating warnings.

fix deprecated lib
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