R understanding {caret} train(tuneLength = ) and SVM methods from {kernlab}
<p>Trying to better understand how <code>train(tuneLength = )</code> works in <code>{caret}</code>. My confusion happened when trying to understand some of the differences between the SVM methods from <code>{kernlab}</code> I've reviewed the documentation (<a href="https://cran.r-project.org/web/packages/caret/caret.pdf" rel="noreferrer">here</a>) and the caret training page (<a href="http://topepo.github.io/caret/training.html" rel="noreferrer">here</a>). </p>

<p>My toy example was creating five models using the <code>iris</code> dataset. Results are <a href="http://rpubs.com/mgilbert/SVM_Toy_Example" rel="noreferrer">here</a>, and reproducible code is <a href="https://github.com/jmichaelgilbert/mspaScripts/blob/master/SVM_Toy_Example.R" rel="noreferrer">here</a> (they're rather long so I didn't copy and paste them into the post).</p>

<p>From the <code>{caret}</code> documentation:</p>

<blockquote>
  <p><strong>tuneLength</strong><br>
  an integer denoting the amount of granularity in the tuning parameter grid. By default, this argument is the number of levels for each tuning parameters that should be generated by train. If trainControl has the option search = "random", this is the maximum number of tuning parameter combinations that will be generated by the random search. (NOTE: If given, this argument must be named.)</p>
</blockquote>

<p>In <a href="http://topepo.github.io/caret/random.html" rel="noreferrer">this example</a>, <code>trainControl(search = "random")</code> and <code>train(tuneLength = 30)</code>, but there appears to be 67 results, not 30 (the maximum number of tuning parameter combinations)? I tried playing around to see if maybe there were 30 unique <code>ROC</code> values, or even <code>ydim</code> values, but by my count they're not.   </p>

<p>For the toy example, I created the following table:</p>

<p><a href="https://i.stack.imgur.com/OHpO4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OHpO4.png" alt="caret_SVM"></a></p>

<p>Is there a way to see what's going on "under the hood"? For instance, <code>M1</code> (<code>svmRadial</code>) and <code>M3</code> (<code>svmRadialSigma</code>) both take, and are given, the same tune parameters, but based on calling <code>$results</code> appear to use them differently? </p>

<p>My understanding of <code>train(tuneLength = 9)</code> was that both models would produce results of <code>sigma</code> and <code>C</code> each with <code>9 values, 9 times</code> since <code>9</code> is the number of levels for each tuning parameter (the exception being random search)? Similarly, <code>M4</code> would be <code>9^3</code> since <code>train(tuneLength = 9)</code> and there are <code>3</code> tuning parameters?</p>

<p>Michael</p>