title: R: How to read ada's AdaBoost tree rules in 'if-else' conditions?
body: <p>Does anyone know how to transform the AdaBoost trees (results in R) into if-else conditions?</p>
  
  <p>I have used the <strong><code>caret</code></strong> package in R, along with the <strong><code>train</code></strong> function and <strong><code>method="ada"</code></strong> to obtain some predictions on my dataset. </p>
  
  <p>Afterwards I used the function <strong><code>listTreesAda</code></strong> in the <strong><code>rattle</code></strong> package to see their structure (sample below):</p>
  
  <pre><code>n= 45211
  node), split, n, loss, yval, (yprob)
  * denotes terminal node
  1) root 45211 5280 no (0.88321426 0.11678574)
  2) duration&lt; 551.5 40743 3245 no (0.92035442 0.07964558)
  4) poutcome=failure,other,unknown 39451 2431 no (0.93837926 0.06162074) *
  5) poutcome=success 1292 478 yes (0.36996904 0.63003096)
  10) duration=132.5 1066 300 yes (0.28142589 0.71857411) *
  3) duration&gt;=551.5 4468 2035 no (0.54453894 0.45546106)
  6) duration=835.5 1688 697 yes (0.41291469 0.58708531) *
  </code></pre>
  
  <p>How do you read it in if-else conditions?
  If you wanted to calculate the final function of the AdaBoost model yourself, how would you do it?
  Having a weight per tree <code>{w(1), w(2), ..., w(n)}</code>, what would you multiply this weight with exactly?
  The rule corresponding to the final leaves where the response variable is YES? ... where the response variable is NO? ... with each if-else rule of the tree?</p>
  
  <p>As you can see I am a little bit lost.</p>
  
  <p>(This post is related to: 
  <a href="https://stats.stackexchange.com/questions/133088/use-adaboost-results-in-r-to-make-future-predictions-by-hand">https://stats.stackexchange.com/questions/133088/use-adaboost-results-in-r-to-make-future-predictions-by-hand</a>
  and 
  <a href="https://stackoverflow.com/questions/27857619/r-error-using-drawtreesada-to-draw-an-ada-tree">https://stackoverflow.com/questions/27857619/r-error-using-drawtreesada-to-draw-an-ada-tree</a>)</p>