@Test public void testClassification() { final double[] ACTUAL = {0.0, 1.0, 0.0, 0.0}; final List<BasicData> training = BasicData.convertArrays(TEST_INPUT, TEST_IDEAL); final ScoreClassificationData score = new ScoreClassificationData(training); final SimpleAlgo simple = new SimpleAlgo(ACTUAL); final double s = score.calculateScore(simple); assertEquals(0.25, s, AIFH.DEFAULT_PRECISION); }
@Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTrainingData.getInput()); if (output != (int) aTrainingData.getIdeal()[0]) { incorrectCount++; } } return (double) incorrectCount / (double) totalCount; }
ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTrainingData.getInput()); if (output != (int) aTrainingData.getIdeal()[0]) { incorrectCount++; } } return (double) incorrectCount / (double) totalCount; } }
ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTrainingData.getInput()); if (output != (int) aTrainingData.getIdeal()[0]) { incorrectCount++; } } return (double) incorrectCount / (double) totalCount; } ScoreClassificationData(final List<BasicData> theTrainingData); }
ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTrainingData.getInput()); if (output != (int) aTrainingData.getIdeal()[0]) { incorrectCount++; } } return (double) incorrectCount / (double) totalCount; } ScoreClassificationData(final List<BasicData> theTrainingData); @Override double calculateScore(final MachineLearningAlgorithm algo); }
ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTrainingData.getInput()); if (output != (int) aTrainingData.getIdeal()[0]) { incorrectCount++; } } return (double) incorrectCount / (double) totalCount; } ScoreClassificationData(final List<BasicData> theTrainingData); @Override double calculateScore(final MachineLearningAlgorithm algo);  }