Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arules returning empty LHS

Tags:

r

arules

I have a dataset which looks like this:

"user.get","search_restaurants","cuisines.get"
"user.get","search_restaurants","user.get","search_restaurants"
"order/address/get_user_addresses"
"search_restaurants","search_restaurantssearch_restaurants"
"restaurant.get","search_restaurants","order/menu","restaurant.get","restaurant.get","restaurant.get","order/menu","order/menu","restaurant.get","restaurant.getsearch_restaurantsrestaurant.get","user.get","order/menu","order/menu","get_user_reviews_filtered","order/menu","restaurant.get"

When I run the apriori algorithm on it:

txn1 = read.transactions(file="path", rm.duplicates=TRUE)
basket_rules <- apriori(txn1, parameter = list(sup = 0.01, conf = 0.01,target="rules"))
inspect(basket_rules)

I get blank lhs's. which are:

{} => {cuisines.get}, etc

Any idea why this might be happening? An how to solve this issue?

like image 988
Dawny33 Avatar asked Aug 17 '16 06:08

Dawny33


1 Answers

From help("apriori"):

The default value in APparameter for minlen is 1. This means that rules with only one item (i.e., an empty antecedent/LHS) like

{} => {beer}

will be created. These rules mean that no matter what other items are involved the item in the RHS will appear with the probability given by the rule's confidence (which equals the support). If you want to avoid these rules then use the argument parameter=list(minlen=2).

like image 138
lukeA Avatar answered Oct 05 '22 23:10

lukeA