title: Cross validation matlab - crossval function
body: <p>I do not understand what the function "<strong><em>crossval</em></strong>" in matlab takes as first parameter, I understand that it is a function for performing a regression, but I don´t get what is intended as "<strong><em>some criterion testval</em></strong>". I need to use it on a K-nn regressor, but the examples are not making everything clear to me.</p>
  
  <pre><code>vals = crossval(fun,X)
  </code></pre>
  
  <blockquote>
    <p>Each time it is called, fun should use XTRAIN to fit a model, then
    return some criterion testval computed on XTEST using that fitted
    model.</p>
  </blockquote>
  
  <p>Here is where I am reading: <a href="http://www.mathworks.se/help/stats/crossval.html" rel="nofollow">Matlab reference</a></p>