<jupyter_start><jupyter_text>Extracting Decision Tree Rules<jupyter_code>from sklearn_model.utils import JMLM<jupyter_output><empty_output><jupyter_text>1. From Model<jupyter_code>jmlm = JMLM.fromModel(mdl)
jmlm.extractRules()<jupyter_output><empty_output><jupyter_text>2. From JMLM String<jupyter_code>jmlm_string = mdl.exportJSON()
jmlm = JMLM.fromString(jmlm_string)
jmlm.extractRules()<jupyter_output><empty_output><jupyter_text>3. From JMLM File<jupyter_code>jmlm = JMLM.fromFile("tree.json")
jmlm.extractRules()<jupyter_output><empty_output><jupyter_text>Rules with Numerical to Categorical Transformation for Categorical Variables<jupyter_code>jmlm.extractRules(numericalToCategorical = True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10699588477366255, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 13.6, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '17946', 'license': 'MIT', 'n_tokens_mistral': 295, 'n_tokens_neox': 290, 'n_words': 32, 'path': 'examples/03-DecisionTreeClassifier-model.ipynb', 'repo_name': 'animator/sklearn-model', 'size': '729'}