The Scientific World Journal / 2014 / Article / Alg 1

Research Article

Aggregated Recommendation through Random Forests

Algorithm 1

Random decision tree.
Input:    , condition attributes , decision attribute
Output:
Method:
(1) if     or     then
(2)  leaf = the distribution of d in the
(3)  return
(4) end if
(5) if  (all d of   are equal)  then
(6)  leaf = the distribution of d in the
(7)  return
(8) end if
(9)   is  a  copy  of  C
(10)   false
(11) while  (not    do
(12)  att = an attribute randomly selected from C
(13)  if    then
(14)     true
(15)   
(16)  end if
(17)  
(18)  if    then
(19)   
(20)  end if
(21) end while
(22) if  (not    then
(23)  leaf = the distribution of d in the
(24)  return
(25) end if
(26) Decision tree attribute for Root = att
(27) for  (each possible value   of att)  do
(28)  Add a new tree branch below Root, corresponding to .
(29)  Let   be the subset of   that have the value
(30)  if    then
(31)   leaf = the distribution of d in the
(32)   return
(33)  else
(34)   , ,
(35)  end if
(36) end for