Orange Forum • View topic - How to find rules with left and hand side defined?

How to find rules with left and hand side defined?

A place to ask questions about methods in Orange and how they are used and other general support.

How to find rules with left and hand side defined?

Postby Hozano » Mon Nov 03, 2008 22:29

Hi. I am using association rules to find patterns in my data. With the example code presented below, i am creating association rules over my data. In this case the rules are formed with differente left and hand sides, containing differente attributes.

According to the data presented below, I need to get only the rules where the left side contains user, hour and (month_day | week_day) attributes and the right side must contain latitude and longitude. How I do it? Below is presented the data base and the code used to list all generated rules.

Thanks.

The data.
Code: Select all
user   hour   month_day   week_day   latitude   longitude
d   d   d   d   d   d

1   3   1   3   12   12
1   3   2   3   12   12
1   3   2   3   12   12
1   4   3   3   12   12
1   5   4   3   12   12
2   5   4   3   12   12
2   5   4   3   12   11
3   5   5   5   12   12


The code used to list all generated rules:
Code: Select all
import orange


data = orange.ExampleTable("user-requests")

data = orange.Preprocessor_discretize(data, \

  method=orange.EquiNDiscretization(numberOfIntervals=3))


rules = orange.AssociationRulesInducer(data, support=0.3)

for rule in rules:
    print rule

Return to Questions & Support