Introduction:

Each year, many people fall ill and sometimes even die from ingesting poisonous, wild mushrooms. Since many mushrooms are very similar to each other in appearance, occasionally even experienced professionals gather poisonous mushrooms. Unlike the identification of harmful plants such as a poison oak or poison ivy, there are no clear rules like “leaves of three, let them be” for identifying whether a wild mushroom is poisonous or edible. Complicating matters, many traditional rules such as “poisonous mushrooms are brightly colored” provide dangerous or misleading information. If simple, clear, and consistent rules were available for identifying poisonous mushrooms, they could save the lives of foragers.

Objective:

As one of the strengths of rule-learning algorithms is the fact that they generate easy to understand rules, they seem like an appropriate fit for this classification task. However, the rules will only be as useful as they are accurate.The major aim is to formulate the associative rules using the algorithms like apriori and eclat and to analyze the various metrics obtained and to predict the physical characteristics whether it is poisonous or edible. #Dataset Information:

This data set includes descriptions of hypothetical samples corresponding to 23 species of gilled mushrooms in the Agaricus and Lepiota Family (pp. 500-525). Each species is identified as definitely edible, definitely poisonous, or of unknown edibility and not recommended. This latter class was combined with the poisonous one.

Dataset consists of transactions as itemMatrix in sparse format with 8124 rows (elements/itemsets/transactions) and 119 columns (items) with 23 variables(labels) and a density of 0.1932773.

Number of Instances: 8124 Number of Attributes: 22 (all nominally valued)

Attribute Information:

  1. cap-shape : bell=b,conical=c,convex=x,flat=f, knobbed=k,sunken=s
  2. cap-surface : fibrous=f,grooves=g,scaly=y,smooth=s
  3. cap-color : brown=n,buff=b,cinnamon=c,gray=g,green=r, pink=p,purple=u,red=e,white=w,yellow=y
  4. bruises : bruises=t,no=f
  5. odor : almond=a,anise=l,creosote=c,fishy=y,foul=f, musty=m,none=n,pungent=p,spicy=s
  6. gill-attachment : attached=a,descending=d,free=f,notched=n
  7. gill-spacing : close=c,crowded=w,distant=d
  8. gill-size : broad=b,narrow=n
  9. gill-color : black=k,brown=n,buff=b,chocolate=h,gray=g, green=r,orange=o,pink=p,purple=u,red=e, white=w,yellow=y
  10. stalk-shape : enlarging=e,tapering=t
  11. stalk-root : bulbous=b,club=c,cup=u,equal=e, rhizomorphs=z,rooted=r,missing=? 12. stalk-surface-above-ring: fibrous=f,scaly=y,silky=k,smooth=s
  12. stalk-surface-below-ring: fibrous=f,scaly=y,silky=k,smooth=s
  13. stalk-color-above-ring : brown=n,buff=b,cinnamon=c,gray=g,orange=o, pink=p,red=e,white=w,yellow=y
  14. stalk-color-below-ring : brown=n,buff=b,cinnamon=c,gray=g,orange=o, pink=p,red=e,white=w,yellow=y
  15. veil-type : partial=p,universal=u
  16. veil-color : brown=n,orange=o,white=w,yellow=y
  17. ring-number : none=n,one=o,two=t
  18. ring-type : cobwebby=c,evanescent=e,flaring=f,large=l, none=n,pendant=p,sheathing=s,zone=z
  19. spore-print-color : black=k,brown=n,buff=b,chocolate=h,green=r, orange=o,purple=u,white=w,yellow=y
  20. population : abundant=a,clustered=c,numerous=n, scattered=s,several=v,solitary=y
  21. habitat : grasses=g,leaves=l,meadows=m,paths=p, urban=u,waste=w,woods=d

Missing Attribute Values:

2480 of them (denoted by “?”), all for attribute #11.

Class Distribution:

edible : 4208 (51.8%) poisonous : 3916 (48.2%)

Total : 8124 instances

Reference Papers:

Schlimmer,J.S. (1987). Concept Acquisition Through Representational Adjustment (Technical Report 87-19). Doctoral disseration, Department of Information and Computer Science, University of California, Irvine. Iba,W., Wogulis,J., & Langley,P. (1988). Trading off Simplicity and Coverage in Incremental Concept Learning. In Proceedings of the 5th International Conference on Machine Learning, 73-79. Ann Arbor, Michigan: Morgan Kaufmann.

Duch W, Adamczak R, Grabczewski K (1996) Extraction of logical rules from training data using backpropagation networks, in: Proc. of the The 1st Online Workshop on Soft Computing, 19-30.Aug.1996, pp. 25-30.

Duch W, Adamczak R, Grabczewski K, Ishikawa M, Ueda H, Extraction of crisp logical rules using constrained backpropagation networks - comparison of two new approaches, in: Proc. of the European Symposium on Artificial Neural Networks (ESANN’97), Bruge, Belgium 16-18.4.1997.

Importing and Reading the dataset - Transaction Summary:

Import the dataset and obtain the summary and structure of the dataset. Frequent set of items is obtained and we analyze using the item frequency plot.

## [1] "C:/Users/lavanyamahadevan/Desktop/Project1"
## transactions as itemMatrix in sparse format with
##  8124 rows (elements/itemsets/transactions) and
##  119 columns (items) and a density of 0.1932773 
## 
## most frequent items:
##       veil.type=p      veil.color=w gill.attachment=f     ring.number=o 
##              8124              7924              7914              7488 
##    gill.spacing=c           (Other) 
##              6812            148590 
## 
## element (itemset/transaction) length distribution:
## sizes
##   23 
## 8124 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      23      23      23      23      23      23 
## 
## includes extended item information - examples:
##        labels variables levels
## 1      EorP=e      EorP      e
## 2      EorP=p      EorP      p
## 3 cap.shape=b cap.shape      b
## 
## includes extended transaction information - examples:
##   transactionID
## 1             1
## 2             2
## 3             3
## Formal class 'transactions' [package "arules"] with 4 slots
##   ..@ transactionInfo:'data.frame':  8124 obs. of  1 variable:
##   .. ..$ transactionID: chr [1:8124] "1" "2" "3" "4" ...
##   ..@ data           :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
##   .. .. ..@ i       : int [1:186852] 1 7 10 16 23 30 34 35 38 43 ...
##   .. .. ..@ p       : int [1:8125] 0 23 46 69 92 115 138 161 184 207 ...
##   .. .. ..@ Dim     : int [1:2] 119 8124
##   .. .. ..@ Dimnames:List of 2
##   .. .. .. ..$ : NULL
##   .. .. .. ..$ : NULL
##   .. .. ..@ factors : list()
##   ..@ itemInfo       :'data.frame':  119 obs. of  3 variables:
##   .. ..$ labels   : chr [1:119] "EorP=e" "EorP=p" "cap.shape=b" "cap.shape=c" ...
##   .. ..$ variables: Factor w/ 23 levels "bruises","cap.color",..: 5 5 3 3 3 3 3 3 4 4 ...
##   .. ..$ levels   : Factor w/ 23 levels "?","a","b","c",..: 6 15 3 4 7 10 17 22 7 8 ...
##   ..@ itemsetInfo    :'data.frame':  8124 obs. of  0 variables

Algorithm1 - Apriori algorithm:

Here the apriori algorithm which employs level-wise search for frequent item sets is used to find the associative rules.This way we find that set of 3315185 rules are formed..

## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport support minlen maxlen
##         0.8    0.1    1 none FALSE            TRUE     0.1      1     10
##  target   ext
##   rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## apriori - find association rules with the apriori algorithm
## version 4.21 (2004.05.09)        (c) 1996-2004   Christian Borgelt
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[119 item(s), 8124 transaction(s)] done [0.02s].
## sorting and recoding items ... [56 item(s)] done [0.00s].
## creating transaction tree ... done [0.01s].
## checking subsets of size 1 2 3 4 5 6 7 8 9 10 done [10.18s].
## writing ... [3315185 rule(s)] done [1.41s].
## creating S4 object  ... done [3.60s].
## set of 3315185 rules
## 
## rule length distribution (lhs + rhs):sizes
##      1      2      3      4      5      6      7      8      9     10 
##      5    354   5580  35965 132340 325154 579505 781023 809297 645962 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   7.000   8.000   8.091   9.000  10.000 
## 
## summary of quality measures:
##     support         confidence        lift       
##  Min.   :0.1002   Min.   :0.80   Min.   :0.8266  
##  1st Qu.:0.1064   1st Qu.:1.00   1st Qu.:1.0849  
##  Median :0.1064   Median :1.00   Median :1.7110  
##  Mean   :0.1238   Mean   :0.99   Mean   :1.8713  
##  3rd Qu.:0.1123   3rd Qu.:1.00   3rd Qu.:2.1815  
##  Max.   :1.0000   Max.   :1.00   Max.   :6.8718  
## 
## mining info:
##          data ntransactions support confidence
##  Mushroomdata          8124     0.1        0.8
##    lhs               rhs                          support   confidence
## 1  {}             => {gill.spacing=c}             0.8385032 0.8385032 
## 2  {}             => {ring.number=o}              0.9217134 0.9217134 
## 3  {}             => {gill.attachment=f}          0.9741507 0.9741507 
## 4  {}             => {veil.color=w}               0.9753816 0.9753816 
## 5  {}             => {veil.type=p}                1.0000000 1.0000000 
## 6  {cap.shape=k}  => {veil.type=p}                0.1019202 1.0000000 
## 7  {habitat=l}    => {bruises=f}                  0.1014279 0.9903846 
## 8  {habitat=l}    => {ring.number=o}              0.1024126 1.0000000 
## 9  {habitat=l}    => {veil.type=p}                0.1024126 1.0000000 
## 10 {cap.color=w}  => {stalk.color.below.ring=w}   0.1280158 1.0000000 
## 11 {cap.color=w}  => {stalk.color.above.ring=w}   0.1280158 1.0000000 
## 12 {cap.color=w}  => {ring.number=o}              0.1073363 0.8384615 
## 13 {cap.color=w}  => {gill.attachment=f}          0.1280158 1.0000000 
## 14 {cap.color=w}  => {veil.color=w}               0.1280158 1.0000000 
## 15 {cap.color=w}  => {veil.type=p}                0.1280158 1.0000000 
## 16 {gill.color=n} => {ring.type=p}                0.1053668 0.8167939 
## 17 {gill.color=n} => {EorP=e}                     0.1152142 0.8931298 
## 18 {gill.color=n} => {stalk.surface.below.ring=s} 0.1093058 0.8473282 
## 19 {gill.color=n} => {stalk.surface.above.ring=s} 0.1171837 0.9083969 
## 20 {gill.color=n} => {gill.size=b}                0.1083210 0.8396947 
##    lift    
## 1  1.000000
## 2  1.000000
## 3  1.000000
## 4  1.000000
## 5  1.000000
## 6  1.000000
## 7  1.694584
## 8  1.084936
## 9  1.000000
## 10 1.853102
## 11 1.819892
## 12 0.909677
## 13 1.026535
## 14 1.025240
## 15 1.000000
## 16 1.672287
## 17 1.724284
## 18 1.394590
## 19 1.425776
## 20 1.215552

From the summary of the rules it is found that for this mushroomdata with 8416 transactions the minimum support and confidence of 0.1 and 0.8 and minimum lift of 0.8303 afterwhich we inspect the rules to get the support,confidence and lift for each of the association rules.

Now we consider the generation of rules with a support of 0.4 and confidence of 0.6 to generate 1625 rules and minlen as 2.

From the rules obtained we generate the subset to infer which are the mushrooms are edible or poisonous by setting rhs=c(“EorP=e”, “EorP=p”) and sort the rules based on the lift.

## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport support minlen maxlen
##         0.6    0.1    1 none FALSE            TRUE     0.4      2     10
##  target   ext
##   rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## apriori - find association rules with the apriori algorithm
## version 4.21 (2004.05.09)        (c) 1996-2004   Christian Borgelt
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[119 item(s), 8124 transaction(s)] done [0.01s].
## sorting and recoding items ... [21 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 7 done [0.00s].
## writing ... [1625 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
## set of 1625 rules
## 
## rule length distribution (lhs + rhs):sizes
##   2   3   4   5   6   7 
## 135 456 598 345  84   7 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   2.000   3.000   4.000   3.882   5.000   7.000 
## 
## summary of quality measures:
##     support         confidence          lift       
##  Min.   :0.4008   Min.   :0.6001   Min.   :0.8751  
##  1st Qu.:0.4185   1st Qu.:0.8685   1st Qu.:1.0000  
##  Median :0.4530   Median :0.9682   Median :1.0252  
##  Mean   :0.4803   Mean   :0.9162   Mean   :1.0838  
##  3rd Qu.:0.4943   3rd Qu.:1.0000   3rd Qu.:1.0613  
##  Max.   :0.9754   Max.   :1.0000   Max.   :1.8649  
## 
## mining info:
##          data ntransactions support confidence
##  Mushroomdata          8124     0.4        0.6
##   lhs                rhs                 support   confidence lift     
## 1 {bruises=t}     => {gill.spacing=c}    0.4027573 0.9691943  1.1558624
## 2 {bruises=t}     => {gill.attachment=f} 0.4155588 1.0000000  1.0265353
## 3 {bruises=t}     => {veil.color=w}      0.4155588 1.0000000  1.0252398
## 4 {bruises=t}     => {veil.type=p}       0.4155588 1.0000000  1.0000000
## 5 {stalk.shape=e} => {gill.attachment=f} 0.4069424 0.9402730  0.9652234
## 6 {stalk.shape=e} => {veil.color=w}      0.4081733 0.9431172  0.9669212
##    lhs                             rhs        support confidence     lift
## 1  {odor=n}                     => {EorP=e} 0.4194978  0.9659864 1.864941
## 2  {odor=n,                                                              
##     veil.type=p}                => {EorP=e} 0.4194978  0.9659864 1.864941
## 3  {gill.size=b,                                                         
##     stalk.surface.above.ring=s} => {EorP=e} 0.4155588  0.9398664 1.814514
## 4  {gill.size=b,                                                         
##     stalk.surface.above.ring=s,                                          
##     veil.type=p}                => {EorP=e} 0.4155588  0.9398664 1.814514
## 5  {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     ring.number=o}              => {EorP=p} 0.4007878  0.7722960 1.602179
## 6  {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     veil.type=p,                                                         
##     ring.number=o}              => {EorP=p} 0.4007878  0.7722960 1.602179
## 7  {bruises=f,                                                           
##     ring.number=o}              => {EorP=p} 0.4007878  0.7386570 1.532393
## 8  {bruises=f,                                                           
##     veil.type=p,                                                         
##     ring.number=o}              => {EorP=p} 0.4007878  0.7386570 1.532393
## 9  {bruises=f,                                                           
##     veil.color=w}               => {EorP=p} 0.4042344  0.7220756 1.497993
## 10 {bruises=f,                                                           
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=p} 0.4042344  0.7220756 1.497993
## 11 {bruises=f,                                                           
##     gill.attachment=f}          => {EorP=p} 0.4030034  0.7214632 1.496723
## 12 {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     veil.type=p}                => {EorP=p} 0.4030034  0.7214632 1.496723
## 13 {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     veil.color=w}               => {EorP=p} 0.4020187  0.7209713 1.495702
## 14 {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=p} 0.4020187  0.7209713 1.495702
## 15 {bruises=f}                  => {EorP=p} 0.4052191  0.6933446 1.438389
## 16 {bruises=f,                                                           
##     veil.type=p}                => {EorP=p} 0.4052191  0.6933446 1.438389
## 17 {stalk.surface.above.ring=s} => {EorP=e} 0.4480551  0.7032457 1.357692
## 18 {stalk.surface.above.ring=s,                                          
##     veil.type=p}                => {EorP=e} 0.4480551  0.7032457 1.357692
## 19 {gill.size=b}                => {EorP=e} 0.4825209  0.6985032 1.348536
## 20 {gill.size=b,                                                         
##     veil.type=p}                => {EorP=e} 0.4825209  0.6985032 1.348536
## 21 {gill.attachment=f,                                                   
##     stalk.surface.above.ring=s} => {EorP=e} 0.4244215  0.6918138 1.335622
## 22 {stalk.surface.above.ring=s,                                          
##     veil.color=w}               => {EorP=e} 0.4244215  0.6918138 1.335622
## 23 {gill.attachment=f,                                                   
##     stalk.surface.above.ring=s,                                          
##     veil.color=w}               => {EorP=e} 0.4244215  0.6918138 1.335622
## 24 {gill.attachment=f,                                                   
##     stalk.surface.above.ring=s,                                          
##     veil.type=p}                => {EorP=e} 0.4244215  0.6918138 1.335622
## 25 {stalk.surface.above.ring=s,                                          
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=e} 0.4244215  0.6918138 1.335622
## 26 {gill.attachment=f,                                                   
##     stalk.surface.above.ring=s,                                          
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=e} 0.4244215  0.6918138 1.335622
## 27 {stalk.surface.above.ring=s,                                          
##     ring.number=o}              => {EorP=e} 0.4027573  0.6908784 1.333816
## 28 {stalk.surface.above.ring=s,                                          
##     veil.type=p,                                                         
##     ring.number=o}              => {EorP=e} 0.4027573  0.6908784 1.333816
## 29 {gill.attachment=f,                                                   
##     gill.size=b}                => {EorP=e} 0.4588872  0.6901148 1.332341
## 30 {gill.attachment=f,                                                   
##     gill.size=b,                                                         
##     veil.color=w}               => {EorP=e} 0.4588872  0.6901148 1.332341
## 31 {gill.attachment=f,                                                   
##     gill.size=b,                                                         
##     veil.type=p}                => {EorP=e} 0.4588872  0.6901148 1.332341
## 32 {gill.attachment=f,                                                   
##     gill.size=b,                                                         
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=e} 0.4588872  0.6901148 1.332341
## 33 {stalk.surface.below.ring=s} => {EorP=e} 0.4185130  0.6888169 1.329836
## 34 {stalk.surface.below.ring=s,                                          
##     veil.type=p}                => {EorP=e} 0.4185130  0.6888169 1.329836
## 35 {gill.size=b,                                                         
##     veil.color=w}               => {EorP=e} 0.4588872  0.6878229 1.327917
## 36 {gill.size=b,                                                         
##     veil.type=p,                                                         
##     veil.color=w}               => {EorP=e} 0.4588872  0.6878229 1.327917
## 37 {gill.size=b,                                                         
##     ring.number=o}              => {EorP=e} 0.4175283  0.6816720 1.316042
## 38 {gill.size=b,                                                         
##     veil.type=p,                                                         
##     ring.number=o}              => {EorP=e} 0.4175283  0.6816720 1.316042

By the above way we find 38 rules being generated.Further rule 2 provides no extra knowledge in addition to rule 1, since rules 1 tells us that all odor=n species are edible. Generally speaking, when a rule (such as rule 2) is a super rule of another rule (such as rule 1) and the former has the same or a lower lift, the former rule (rule 2) is considered to be redundant.Below we prune redundant rules.

## set of 10 rules
## 
## rule length distribution (lhs + rhs):sizes
## 2 3 4 
## 5 4 1 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     2.0     2.0     2.5     2.6     3.0     4.0 
## 
## summary of quality measures:
##     support         confidence          lift      
##  Min.   :0.4008   Min.   :0.6888   Min.   :1.330  
##  1st Qu.:0.4033   1st Qu.:0.6997   1st Qu.:1.378  
##  Median :0.4104   Median :0.7218   Median :1.497  
##  Mean   :0.4198   Mean   :0.7644   Mean   :1.528  
##  3rd Qu.:0.4193   3rd Qu.:0.7639   3rd Qu.:1.585  
##  Max.   :0.4825   Max.   :0.9660   Max.   :1.865  
## 
## mining info:
##          data ntransactions support confidence
##  Mushroomdata          8124     0.4        0.6
##    lhs                             rhs        support confidence     lift
## 1  {odor=n}                     => {EorP=e} 0.4194978  0.9659864 1.864941
## 2  {gill.size=b,                                                         
##     stalk.surface.above.ring=s} => {EorP=e} 0.4155588  0.9398664 1.814514
## 3  {bruises=f,                                                           
##     gill.attachment=f,                                                   
##     ring.number=o}              => {EorP=p} 0.4007878  0.7722960 1.602179
## 4  {bruises=f,                                                           
##     ring.number=o}              => {EorP=p} 0.4007878  0.7386570 1.532393
## 5  {bruises=f,                                                           
##     veil.color=w}               => {EorP=p} 0.4042344  0.7220756 1.497993
## 6  {bruises=f,                                                           
##     gill.attachment=f}          => {EorP=p} 0.4030034  0.7214632 1.496723
## 7  {bruises=f}                  => {EorP=p} 0.4052191  0.6933446 1.438389
## 8  {stalk.surface.above.ring=s} => {EorP=e} 0.4480551  0.7032457 1.357692
## 9  {gill.size=b}                => {EorP=e} 0.4825209  0.6985032 1.348536
## 10 {stalk.surface.below.ring=s} => {EorP=e} 0.4185130  0.6888169 1.329836

Metrics:

The metrics are formulated based on the rules formed by using the interestMeasure. We have considered the following metrics for the mushroom data.

##    implicationIndex conviction     leverage   jaccard
## 1        -18.895801  5.2424346  0.054309847 0.4731058
## 2         -9.341700         NA  0.010741920 0.4265858
## 3         -9.116566         NA  0.010230400 0.4260475
## 4                NA         NA  0.000000000 0.4155588
## 5         12.494323  0.4327917 -0.014661957 0.4069424
## 6         12.193211  0.4327917 -0.013963768 0.4081733
## 7                NA         NA  0.000000000 0.4327917
## 8        -38.328375 14.1716396  0.194558930 0.7874307
## 9        -32.395014  2.9757459  0.194558930 0.7874307
## 10       -25.762076  4.5453471  0.104736990 0.5618592
## 11        10.555695  0.4749815 -0.012408117 0.4115470
## 12        12.140757  0.4342688 -0.013927404 0.4096504
## 13               NA         NA  0.000000000 0.4342688
## 14        -5.568989  1.4907065  0.011597201 0.4510417
## 15        -4.166608  1.7500957  0.004985865 0.4520582

Plots:

Now we consider the plots related to rules formed by apriori with a support of 0.4 and confidence of 0.6 and minlen as 2 corresponding to the methods like grouped and matrix based for those rules formed after soring and pruning.

After selecting the subrules from the rules using lift>1.5 we plot them using matrix method.

## set of 34 rules
## Itemsets in Antecedent (LHS)
##  [1] "{odor=n}"                                                                             
##  [2] "{EorP=e}"                                                                             
##  [3] "{odor=n,veil.type=p}"                                                                 
##  [4] "{EorP=e,veil.type=p}"                                                                 
##  [5] "{gill.spacing=c,gill.size=b}"                                                         
##  [6] "{bruises=f,ring.number=o}"                                                            
##  [7] "{stalk.surface.below.ring=s,ring.type=p}"                                             
##  [8] "{stalk.surface.above.ring=s,stalk.surface.below.ring=s}"                              
##  [9] "{gill.spacing=c,stalk.surface.above.ring=s}"                                          
## [10] "{ring.number=o,ring.type=p}"                                                          
## [11] "{gill.size=b,stalk.surface.above.ring=s}"                                             
## [12] "{gill.spacing=c,gill.size=b,ring.number=o}"                                           
## [13] "{gill.attachment=f,gill.spacing=c,gill.size=b}"                                       
## [14] "{gill.spacing=c,gill.size=b,veil.color=w}"                                            
## [15] "{gill.spacing=c,gill.size=b,veil.type=p}"                                             
## [16] "{bruises=f,gill.attachment=f,ring.number=o}"                                          
## [17] "{bruises=f,veil.type=p,ring.number=o}"                                                
## [18] "{stalk.surface.below.ring=s,veil.type=p,ring.type=p}"                                 
## [19] "{stalk.surface.above.ring=s,stalk.surface.below.ring=s,veil.type=p}"                  
## [20] "{gill.spacing=c,stalk.surface.above.ring=s,veil.type=p}"                              
## [21] "{veil.type=p,ring.number=o,ring.type=p}"                                              
## [22] "{gill.size=b,stalk.surface.above.ring=s,veil.type=p}"                                 
## [23] "{gill.attachment=f,gill.spacing=c,gill.size=b,ring.number=o}"                         
## [24] "{gill.spacing=c,gill.size=b,veil.color=w,ring.number=o}"                              
## [25] "{gill.spacing=c,gill.size=b,veil.type=p,ring.number=o}"                               
## [26] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.color=w}"                          
## [27] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.type=p}"                           
## [28] "{gill.spacing=c,gill.size=b,veil.type=p,veil.color=w}"                                
## [29] "{bruises=f,gill.attachment=f,veil.type=p,ring.number=o}"                              
## [30] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.color=w,ring.number=o}"            
## [31] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.type=p,ring.number=o}"             
## [32] "{gill.spacing=c,gill.size=b,veil.type=p,veil.color=w,ring.number=o}"                  
## [33] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.type=p,veil.color=w}"              
## [34] "{gill.attachment=f,gill.spacing=c,gill.size=b,veil.type=p,veil.color=w,ring.number=o}"
## Itemsets in Consequent (RHS)
## [1] "{EorP=e}"                     "{odor=n}"                    
## [3] "{stalk.root=b}"               "{EorP=p}"                    
## [5] "{stalk.surface.above.ring=s}" "{ring.type=p}"

Next we plot those rules obtained as a result of pruning using grouped and paracoord methods.

Inference:

There are 10 rules formed by above method where the above combination of bruises=f,gill.attachment=f,ring.number=o,veil.color=w are considered to be poisonous and odor=n,gill.size=b,stalk.surface.below.ring=s and stalk.surface.above.ring=s species are considered as edible.It means that mushroom species which are considered either poisonous or edible can be highly associated with these kinds of attributes.

Algorithm2 - Eclat Algorithm:

Here the eclat algorithm which employs uses simple intersection operations for equivalence class clustering along with bottom-up lattice traversal is used to find the frequent itemsets.In that way we find that a set of 565 itemsets are formed.

## set of 565 itemsets
## 
## most frequent items:
##       veil.type=p gill.attachment=f      veil.color=w     ring.number=o 
##               283               270               268               222 
##    gill.spacing=c           (Other) 
##               190               694 
## 
## element (itemset/transaction) length distribution:sizes
##   1   2   3   4   5   6   7 
##  21  97 185 170  76  15   1 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   3.000   3.000   3.411   4.000   7.000 
## 
## summary of quality measures:
##     support      
##  Min.   :0.4008  
##  1st Qu.:0.4205  
##  Median :0.4609  
##  Mean   :0.4906  
##  3rd Qu.:0.5180  
##  Max.   :1.0000  
## 
## includes transaction ID lists: FALSE 
## 
## mining info:
##          data ntransactions support
##  Mushroomdata          8124     0.4
##    items                 support
## 1  {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f,          
##     veil.type=p,                
##     ring.number=o}     0.4007878
## 2  {EorP=p,                     
##     bruises=f,                  
##     veil.type=p,                
##     ring.number=o}     0.4007878
## 3  {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f,          
##     ring.number=o}     0.4007878
## 4  {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f,          
##     veil.type=p,                
##     veil.color=w}      0.4020187
## 5  {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f,          
##     veil.type=p}       0.4030034
## 6  {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f,          
##     veil.color=w}      0.4020187
## 7  {EorP=p,                     
##     bruises=f,                  
##     veil.type=p,                
##     veil.color=w}      0.4042344
## 8  {EorP=p,                     
##     bruises=f,                  
##     veil.type=p}       0.4052191
## 9  {EorP=p,                     
##     bruises=f,                  
##     veil.color=w}      0.4042344
## 10 {EorP=p,                     
##     bruises=f,                  
##     gill.attachment=f} 0.4030034
## 11 {EorP=p,                     
##     bruises=f,                  
##     ring.number=o}     0.4007878
## 12 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.type=p,                
##     veil.color=w,               
##     ring.number=o}     0.4549483
## 13 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.type=p,                
##     ring.number=o}     0.4549483
## 14 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.color=w,               
##     ring.number=o}     0.4549483
## 15 {EorP=p,                     
##     gill.spacing=c,             
##     veil.type=p,                
##     veil.color=w,               
##     ring.number=o}     0.4549483
## 16 {EorP=p,                     
##     gill.spacing=c,             
##     veil.type=p,                
##     ring.number=o}     0.4549483
## 17 {EorP=p,                     
##     gill.spacing=c,             
##     veil.color=w,               
##     ring.number=o}     0.4549483
## 18 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     ring.number=o}     0.4549483
## 19 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.type=p,                
##     veil.color=w}      0.4660266
## 20 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.type=p}       0.4660266
## 21 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c,             
##     veil.color=w}      0.4660266
## 22 {EorP=p,                     
##     gill.spacing=c,             
##     veil.type=p,                
##     veil.color=w}      0.4682422
## 23 {EorP=p,                     
##     gill.spacing=c,             
##     veil.type=p}       0.4682422
## 24 {EorP=p,                     
##     gill.spacing=c,             
##     veil.color=w}      0.4682422
## 25 {EorP=p,                     
##     gill.attachment=f,          
##     gill.spacing=c}    0.4660266
## 26 {EorP=p,                     
##     gill.spacing=c,             
##     ring.number=o}     0.4549483
## 27 {EorP=p,                     
##     gill.attachment=f,          
##     veil.type=p,                
##     veil.color=w,               
##     ring.number=o}     0.4677499
## 28 {EorP=p,                     
##     gill.attachment=f,          
##     veil.type=p,                
##     ring.number=o}     0.4687346
## 29 {EorP=p,                     
##     gill.attachment=f,          
##     veil.color=w,               
##     ring.number=o}     0.4677499
## 30 {EorP=p,                     
##     veil.type=p,                
##     veil.color=w,               
##     ring.number=o}     0.4677499
## 31 {EorP=p,                     
##     veil.type=p,                
##     ring.number=o}     0.4687346
## 32 {EorP=p,                     
##     veil.color=w,               
##     ring.number=o}     0.4677499
## 33 {EorP=p,                     
##     gill.attachment=f,          
##     ring.number=o}     0.4687346
## 34 {EorP=p,                     
##     gill.attachment=f,          
##     veil.type=p,                
##     veil.color=w}      0.4788282
## 35 {EorP=p,                     
##     gill.attachment=f,          
##     veil.type=p}       0.4798129
## 36 {EorP=p,                     
##     gill.attachment=f,          
##     veil.color=w}      0.4788282
## 37 {EorP=p,                     
##     veil.type=p,                
##     veil.color=w}      0.4810438
## 38 {EorP=p,                     
##     veil.type=p}       0.4820286
## 39 {EorP=p,                     
##     veil.color=w}      0.4810438
## 40 {EorP=p,                     
##     gill.attachment=f} 0.4798129
## 41 {EorP=p,                     
##     ring.number=o}     0.4687346
## 42 {EorP=p,                     
##     gill.spacing=c}    0.4682422
## 43 {EorP=p,                     
##     bruises=f}         0.4052191
## 44 {EorP=p}            0.4820286

Plots:

Here we represent the itemsets as plots using the graph and paracoord methods as below.

These are considered for itemsets after considering the subset using EorP.

Inference:

On the basis of the above eclat algorithm ,the resulting itemsets show that the Mushroom species is poisonous is highly associated with bruises=f,gill.attachment=f,gill.spacing=c,veil.type=p,veil.color=w,ring.number=o as the attributes.

Conclusion:

Hence we were able predict the mushroom species which are edible or poisonous based on associative rules algorithm.