python apriori library how to get frequent itemset (frozenset) column name?

Viewed 63

I'm trying to find out the associate rules in my dataset. The issue is that I'm not sure what the values are mapping to. For instance my output would look like

RelationRecord(items=frozenset({'no', 'high'}), support=0.2857142857142857, ordered_statistics=[OrderedStatistic(items_base=frozenset({'high'}), items_add=frozenset({'no'}), confidence=0.5714285714285714, lift=1.5999999999999999), OrderedStatistic(items_base=frozenset({'no'}), items_add=frozenset({'high'}), confidence=0.7999999999999999, lift=1.5999999999999999)])

but I'm not sure what column name is for "no" and "high" in my frozenset. In my original dataset I have multiple column like "married", "has kids", etc that has the value no. How do I change it so that I can get the column value?

I'm using the follow apriori libary from python

from apyori import apriori

I'm reading my data like

all_data = pd.read_csv("health_information.csv")

and getting the rules like

rules = apriori(transactions, min_support = 0.1, min_confidence = 0.4)

I have tried the following below. But the value still do not map the value "no" to column names like "has kids"

rules = apriori(transactions, min_support = 0.1, min_confidence = 0.4,colname = [list of values])
0 Answers
Related