Data Mining for the Masses



Yüklə 4,8 Kb.
Pdf görüntüsü
səhifə24/65
tarix08.10.2017
ölçüsü4,8 Kb.
#3815
1   ...   20   21   22   23   24   25   26   27   ...   65

Chapter 5: Association Rules 
79 
 
Figure 5-3.  Selection of attributes to include  
in the association rules model. 
 
5)
 
One other step is needed in our data preparation.  This is to change the data types of our 
selected  attributes  from  integer  to  binominal.    As  previously  mentioned,  the  association 
rules operators need this data type in order to function properly.  In the search box on the 
Operators tab in design view, type ‘Numerical to’ (without the single quotes) to locate the 
operators that will change attributes with a numeric data type to some other data type.  The 
one we will use is Numerical to Binominal.  Drag this operator into your stream. 


 
Data Mining for the Masses 
80 
 
Figure 5-4.  Adding a data type converstion operator to a data mining model. 
 
6)
 
For  our  purposes,  all  attributes  which  remain  after  application  of  the  Select  Attributes 
operator need to be converted from numeric to binominal, so as the black arrow indicates 
in  Figure  5-4,  we  will  convert  ‘all’  from  the  former  data  type  to  the  latter.    We  could 
convert a subset or a single attribute, by selecting one of those options in the attribute filter 
type dropdown menu.  We have done this in the past, but in this example, we can accept 
the  default  and  covert  all  attributes  at  once.    You  should  also  observe  that  within 
RapidMiner,  the  data  type  binominal  is  used  instead  of  binomial,  a  term  many  data 
analysts are more used to.  There is an important distinction.  Binomial means one of two 
numbers (usually 0 and 1), so the basic underlying data type is still numeric.  Binominal on 
the other hand, means one of two values which may be numeric or character based.  Click 
the play button to run your model and see how this conversion has taken place in our data 
set.  In results perspective, you should see the transformation, as depicted in Figure 5-5. 


Chapter 5: Association Rules 
81 
 
Figure 5-5.  The results of a data type transformation. 
 
7)
 
For each attribute in our data set, the values of 1 or 0 that existed in our source data set 
now are reflected as either ‘true’ or ‘false’.  Our data preparation phase is now complete 
and we are ready for… 
 
MODELING 
 
8)
 
Switch back to design perspective.  We will use two specific operators in order to generate 
our association rule data mining model.  Understand that there are many other operators 
offered  in  RapidMiner  that  can  be  used  in  association  rule  models.    At  the  outset,  we 
established  that  this  book  is  not  a  RapidMiner  training  manual  and  thus,  will  not  cover 
every possible operator that could be used in a given model.  Thus, please do not assume 
that this chapter’s example is demonstrating the one and only way to mine for association 
rules.  This is one of several possible approaches, and you are encouraged to explore other 
operators and their functionality. 
 
To  proceed  with  the  example,  use  the  search  field  in  the  operators  tab  to  look  for  an 
operator called FP-Growth.  Note that you might find one called W-FPGrowth.  This is 
simply a slightly different implementation of the FP-Growth algorithm that will look for 
associations in our data, so do not be confused by the two very similar names.  For this 
chapter’s example, select the operator that is just called FP-Growth.  Go ahead and drag it 
into  your  stream.    The  FP  in  FP-Growth  stands  for  Frequency  Pattern.    Frequency 
pattern analysis is handy for many kinds of data mining, and is a necessary component of 
association rule mining.  Without having frequencies of attribute combinations, we cannot 
determine  whether  any  of  the  patterns  in  the  data  occur  often  enough  to  be  considered 
rules.  Your stream should now look like Figure 5-6. 


 
Data Mining for the Masses 
82 
 
Figure 5-6.  Addition of an FP-Growth operator to an association rule model. 
 
9)
 
Take note of the min support parameter on the right hand side.  We will come back to this 
parameter during the evaluation portion of this chapter’s example.  Also, be sure that both 
your exa port and your fre port are connected to res ports.  The exa port will generate a tab 
of  your  examples  (your  data  set’s  observations  and  meta  data),  while  the  fre  port  will 
generate a matrix of any frequent patterns the operator might find in your data set.  Run 
your model to switch to results perspective. 
 
Figure 5-7.  Results of an FP-Growth operator. 


Chapter 5: Association Rules 
83 
 
10)
 
In  results  perspective,  we  see  that  some  of  our  attributes  appear  to  have  some  frequent 
patterns in them, and in fact, we begin to see that three attributes look like they might have 
some association with one another.  The black arrows point to areas where it seems that 
Religious  organizations  might  have  some  natural  connections  with  Family  and  Hobby 
organizations.    We  can  investigate  this  possible  connection  further  by  adding  one  final 
operator to our model.  Return to design perspective, and in the operators search box, look 
for  ‘Create  Association’  (again,  without  the  single  quotes).    Drag  the  Create  Association 
Rules operator over and drop it into the spline that connects the  fre port to the  res port.  
This operator takes in frequent pattern matrix data and seeks out any patterns that occur so 
frequently that they could be considered rules.  Your model should now look like Figure 5-
8. 
 
Figure 5-8.  Addition of Create Association Rules operator. 
 
11)
 
The  Create  Association  Rules  operator  can  generate  both  a  set  of  rules  (through  the  rul 
port) and a set of associated items (through the ite port).  We will simply generate rules, and 
for now, accept the default parameters for the Create Association Rules, though note the 
min confidence parameter, which we will address in the evaluation phase of our mining.  Run 
your model. 
 
Figure 5-9.  The results of our association rule model. 


Yüklə 4,8 Kb.

Dostları ilə paylaş:
1   ...   20   21   22   23   24   25   26   27   ...   65




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə