Enhance counterfactual with fixed_features and custom methods #1029#1148
Open
mariam851 wants to merge 2 commits intorasbt:masterfrom
Open
Enhance counterfactual with fixed_features and custom methods #1029#1148mariam851 wants to merge 2 commits intorasbt:masterfrom
mariam851 wants to merge 2 commits intorasbt:masterfrom
Conversation
2d6a7ce to
caade90
Compare
caade90 to
71a612b
Compare
Owner
|
Thanks for the PR(s). I have been busy with other projects lately and didn't quite get the chance to check them. I hope to be able to take a look next in the next 1-2 weeks though. I just fixed the perceptron issue, and the CI should work now. |
Contributor
Author
|
Hi Sebastian,
Thanks a lot for letting me know — really appreciate it.
No worries at all, I totally understand how busy things can get. Thanks as
well for fixing the perceptron issue, and glad to hear the CI is working
now.
Looking forward to your feedback whenever you get the time.
Best,
Mariam
في الاثنين، ٥ يناير ٢٠٢٦، ٥:٥٧ ص Sebastian Raschka ***@***.***>
كتب:
… *rasbt* left a comment (rasbt/mlxtend#1148)
<#1148 (comment)>
Thanks for the PR(s). I have been busy with other projects lately and
didn't quite get the chance to check them. I hope to be able to take a look
next in the next 1-2 weeks though. I just fixed the perceptron issue, and
the CI should work now.
—
Reply to this email directly, view it on GitHub
<#1148 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5QEUUHAG376OOFAUYTZQL34FHHH3AVCNFSM6AAAAACQHTBFPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMBYG43TCMBWG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @rabst,
Description: This PR introduces enhancements to the create_counterfactual function to address performance bottlenecks and improve flexibility, as discussed in issue #1029.
Key Changes:
Feature Masking (fixed_features): Added a new parameter fixed_features (list of indices) that allows users to specify which features should remain constant during the optimization process. This reduces the search space dimensionality, leading to significantly faster convergence in high-dimensional datasets.
Optimization Methods: Exposed the method parameter for scipy.optimize.minimize, allowing users to choose solvers other than the default 'Nelder-Mead' (e.g., 'BFGS' or 'L-BFGS-B').
Improved Convergence: The internal objective function now dynamically handles the feature mask, ensuring that only the relevant features are updated.
API Consistency: Updated init.py and docstrings to ensure the new parameters are properly exposed and documented.
Note on CI Failures: I noticed that the build-linux and conda unit tests are currently failing. After investigating the logs, the failures are located in mlxtend/classifier/tests/test_perceptron.py with the error: TypeError: only 0-dimensional arrays can be converted to Python scalars.
This seems to be an upstream issue related to recent NumPy updates affecting the Perceptron implementation and is unrelated to the changes in this PR. I have verified that all new and existing tests in mlxtend/evaluate/tests/test_counterfactual.py are passing locally and on the CI.
Fixes: #1029