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

Two Extractly same rules by RulefitClassifier #80

Closed
Yannahhh opened this issue Jan 25, 2022 · 4 comments
Closed

Two Extractly same rules by RulefitClassifier #80

Yannahhh opened this issue Jan 25, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Yannahhh
Copy link

Yannahhh commented Jan 25, 2022

Hello~

When I use the RulefitClassifier, it will return two exactly same rules but with different coef, whether the inherent structures didn't aggregate the rules? I have tried to use the Rulefit directly, and it seems that it doesn't have the similar problem~

The following image is part of my result
image

@keyan3
Copy link
Collaborator

keyan3 commented Jan 25, 2022

Hi, thanks for bringing this to our attention. Can you provide more details on the code used to produce this result?

@Yannahhh
Copy link
Author

Thanks for your reply, should I provide my data also?

features = X.columns
X = X.values
rulefit = RuleFitClassifier(random_state=2022, tree_size=3, exp_rand_tree_size=False)
rulefit.fit(X, y, feature_names=features)
preds = rulefit.predict(X)
accuracy = round(metrics.accuracy_score(y, preds), 2)
rules = rulefit.get_rules()
rules = rules[rules.coef != 0].sort_values("coef", ascending=False)

@csinva csinva added the bug Something isn't working label Jan 28, 2022
@keyan3
Copy link
Collaborator

keyan3 commented Jan 29, 2022

No need to provide the data — this is caused by a bug in the process of checking for duplicate rules (https://github.com/csinva/imodels/blob/master/imodels/util/extract.py#L97-L107). We will have it fixed shortly!

@keyan3
Copy link
Collaborator

keyan3 commented Feb 8, 2022

Was fixed in #87

@keyan3 keyan3 closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants