I would like to add two additional measures as a results of the "inspect" function in arules package. They are Kulczynski and imbalance ratio. Would you help me with info, where to find the code of inspect function and how to modify it.
Thanks
All you need to do is to add additional columns to the quality data.frame. Inspect will automatically pick those up. Here is the example from ? interestMeasure
:
data("Income")
rules <- apriori(Income)
## calculate a single measure and add it to the quality slot
quality(rules) <- cbind(quality(rules),
hyperConfidence = interestMeasure(rules, method = "hyperConfidence",
transactions = Income))
inspect(head(sort(rules, by = "hyperConfidence")))
lhs rhs support confidence lift hyperConfidence
1 {ethnic classification=hispanic} => {education=no college graduate} 0.1096568 0.8636884 1.224731 1
2 {dual incomes=no} => {marital status=married} 0.1400524 0.9441176 2.447871 1
3 {occupation=student} => {marital status=single} 0.1449971 0.8838652 2.160490 1
4 {occupation=student} => {age=14-34} 0.1592496 0.9707447 1.658345 1
5 {occupation=student} => {dual incomes=not married} 0.1535777 0.9361702 1.564683 1
6 {occupation=student} => {income=$0-$40,000} 0.1381617 0.8421986 1.353027 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With