A snapshot of my code: (full version: http://pastebin.com/7ALhSKgX)
var crossvalidation = new CrossValidation(size: data.Rows.Count, folds: 7);
crossvalidation.Fitting =
delegate(int k, int[] indicesTrain, int[] indicesValidation)
{
//omitted declarations for clarity
DecisionTree tree = new DecisionTree(attributes, classCount);
//omitted
double trainingError =
id3learning.ComputeError(trainingInputs, trainingOutputs);
double validationError =
id3learning.ComputeError(validationInputs, validationOutputs);
return new CrossValidationValues<DecisionTree>
(tree, trainingError, validationError);
};
The error is on this line:
return new CrossValidationValues<DecisionTree>
(tree, trainingError, validationError);
and its giving an error : Cannot convert anonymous method to delegate type 'Accord.MachineLearning.CrossValidationFittingFunction' because some of the return types in the block are not implicitly convertible to the delegate return type