Last active
June 24, 2021 11:33
-
-
Save ogyalcin/ad0b796b4a43b0a56db34705a2eaea39 to your computer and use it in GitHub Desktop.
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
pd.set_option('display.max_colwidth', 400) # Adjust row width to read the entire rule | |
pd.options.display.float_format = '{:.2f}'.format # Round decimals to 2 decimal places | |
rules = rulefit.get_rules() # Get the rules | |
rules = rules[rules['type']!='linear'] # Eliminate the existing explanatory variables | |
rules = rules[rules['coef'] != 0] # eliminate the insignificant rules | |
rules = rules.sort_values('support', ascending=False) # Sort the rules based on "support" value | |
rules = rules[rules['rule'].str.len()>30] # optional: To see more complex rules, filter the long rules | |
rules.iloc[0:5] # Show the first 5 rules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment