Accord.Math.Random.Generator.Seed = 0; int[][] inputs = new int[][] { new int[] { 0,1,1,0 }, new int[] { 0,0,1,0 }, new int[] { 0,1,1,1,0 }, new int[] { 0,1,1,1,0 }, new int[] { 0,1,1,0 }, new int[] { 0,0,0,0,0 }, new int[] { 0,0,0,1,0 }, new int[] { 0,0,0,0,0 }, new int[] { 0,0,0 }, new int[] { 0,0,0,0 }, new int[] { 1,0,0,1 }, new int[] { 1,1,0,1 }, new int[] { 1,0,0,0,1 }, new int[] { 1,0,1 }, new int[] { 1,1,0,1 }, }; int[] outputs = new int[] { 0,0,0,0,0, 1,1,1,1,1, 2,2,2,2,2, }; var crossvalidation = new CrossValidation<HiddenMarkovClassifier, int[]>() { K = 3, Learner = (s) => new HiddenMarkovClassifierLearning() { Learner = (p) => new BaumWelchLearning() { NumberOfStates = 3 } }, Loss = (expected, actual, p) => { var cm = new GeneralConfusionMatrix(classes: p.Model.NumberOfClasses, expected: expected, predicted: actual); p.Variance = cm.Variance; return p.Value = cm.Kappa; }, Stratify = false, }; crossvalidation.ParallelOptions.MaxDegreeOfParallelism = 1; var result = crossvalidation.Learn(inputs, outputs); GeneralConfusionMatrix gcm = result.ToConfusionMatrix(inputs, outputs); double trainingErrors = result.Training.Mean; double validationErrors = result.Validation.Mean; double trainingErrorVar = result.Training.Variance; double validationErrorVar = result.Validation.Variance; double trainingErrorPooledVar = result.Training.PooledVariance; double validationErrorPooledVar = result.Validation.PooledVariance;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4