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

Enanchment in CF Generation #259

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

giandos200
Copy link

Hi, I created this pull request to give some hints on CF generation @gaugup.
Regarding Random, although there is very clear and fast, finding combinations between feature sampling and substitution is unclear. The Loop inside, instead of gradually replacing more features actually in your code, only replaces one feature as :
selected_features = np.random.choice(self.features_to_vary, (sample_size, 1), replace=True)
1 should be replaced by num_features_to_vary and then .loc instead of .at.

This method is slower but certainly more complete and still faster than Genetic/KDtree (I have deliberately left it commented out for you).
If you want to leave a single variation, I suggest changing .at to ._get_value in the replacement for faster access.
As far as genetic is concerned, in the case of datasets with many features, a random initialization is very slow and seems never to end. For this reason, I suggest increasing the population of the KDtree initialization (which is also lowering the initialization time a lot). In addition, I recommend switching to a binary search in the case of requests for a large number of CFs.

@gaugup
Copy link
Collaborator

gaugup commented Jan 13, 2022

Thanks @giandos200 for this PR. I executed all the gates. Could you please examine the failures and re-submit to make all the tests and linting pass? It looks like your PR has a lot of changes which are out of scope of the performance improvement. It will be great if you could clean all this and send out a commit focusing just on the perf improvements.

Regards,

@giandos200
Copy link
Author

It should be ok now, @gaugup . Maybe I have an older version because I have never changed the imports.

@giandos200 giandos200 force-pushed the master branch 14 times, most recently from 19f2e47 to 785bc4a Compare January 14, 2022 13:29
Copy link
Collaborator

@gaugup gaugup left a comment

Choose a reason for hiding this comment

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

Please take a look at the failing gates.

dice_ml/explainer_interfaces/dice_genetic.py Outdated Show resolved Hide resolved
dice_ml/explainer_interfaces/dice_genetic.py Outdated Show resolved Hide resolved
gaugup and others added 5 commits January 24, 2022 14:27
Signed-off-by: giandos200 <[email protected]>
Signed-off-by: giandos200 <[email protected]>
Signed-off-by: giandos200 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants