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

No rules are generated using single-feature dataset #25

Open
TKlerx opened this issue Jun 2, 2019 · 1 comment
Open

No rules are generated using single-feature dataset #25

TKlerx opened this issue Jun 2, 2019 · 1 comment

Comments

@TKlerx
Copy link

TKlerx commented Jun 2, 2019

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()```
@TKlerx TKlerx changed the title No rules are generated No rules are generated using single-feature dataset Jun 2, 2019
@ngoix
Copy link
Member

ngoix commented Jun 8, 2019

Thanks for reporting the issue, do you want to open a pull request to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants