How to generate the IMetric(Double[]) parameter? I need to calculate the Cosine distance
My input is double[][]
output is int []
it works fine when I use
KNearestNeighbors knn = new KNearestNeighbors(k: 10, classes: 3, inputs: inputs, outputs: outputs);
but when I want to change the distance as you showed in the example like that
KNearestNeighbors knn = new KNearestNeighbors(k: 10, classes: 3, inputs: inputs, outputs: outputs,distance: Distance.Cosine);
it shows me the following error:
Error 1 The best overloaded method match for 'Accord.MachineLearning.KNearestNeighbors.KNearestNeighbors(int, int, double[][], int[], Accord.Math.Distances.IMetric<double[]>)' has some invalid arguments
Error 2 Argument 5: cannot convert from 'method group' to 'Accord.Math.Distances.IMetric<double[]>'
What can I do to solve this and change the default Euclidean distance to Cosine?
p.s. I also tried the example you used with classifying the strings, it also showed error