skope-rules
skope-rules copied to clipboard
No rules are generated using single-feature dataset
Hey there,
I wanted to use this package to derive very basic rules for one feature and one label. It works well for more than one feature, but using only one feature, the output is empty. I also tried with the iris dataset and the code looks like this:
from skrules import SkopeRules
dataset = load_iris()
feature_names = ['sepal_length']
clf = SkopeRules(max_depth_duplication=2,
n_estimators=30,
precision_min=0.3,
recall_min=0.1,
feature_names=feature_names)
for idx, species in enumerate(dataset.target_names):
X, y = dataset.data, dataset.target
clf.fit(X[::,0].reshape(-1, 1), y == idx)
rules = clf.rules_[0:3]
print("Rules for iris", species)
for rule in rules:
print(rule)
print()
print(20*'=')
print()```
Thanks for reporting the issue, do you want to open a pull request to fix it?