CrossValidation in Accord.NET
<p>Suppose we initiate cross validation with 10 folds to train Support Vector Machine, as per theory, every single fold will use a different model and based on the least cross validation error we'll select that Model, now according to Accord.NET framework this is what we use to implement cross validation:</p>

<pre><code>var crossvalidation = new CrossValidation(size: data.Length, folds: 3);


crossvalidation.Fitting = delegate(int k, int[] indicesTrain, int[] indicesValidation)
{

// Lets now grab the training data:
var trainingInputs = data.Submatrix(indicesTrain);
var trainingOutputs = xor.Submatrix(indicesTrain);

// And now the validation data:
var validationInputs = data.Submatrix(indicesValidation);
var validationOutputs = xor.Submatrix(indicesValidation);


// Create a Kernel Support Vector Machine to operate on the set
var svm = new KernelSupportVectorMachine(new Polynomial(2), 2);

// Create a training algorithm and learn the training data
var smo = new SequentialMinimalOptimization(svm, trainingInputs, trainingOutputs);

double trainingError = smo.Run();

// Now we can compute the validation error on the validation data:
double validationError = smo.ComputeError(validationInputs, validationOutputs);

// Return a new information structure containing the model and the errors achieved.
return new CrossValidationValues(svm, trainingError, validationError);
};
</code></pre>

<p>and then we compute:</p>

<pre><code>// Compute the cross-validation
var result = crossvalidation.Compute();
</code></pre>

<p>now how can the best model be extracted from these folds or on what logic the framework is working if not the previously mentioned?</p>