Package ann4j
Class ModelEvaluator
java.lang.Object
ann4j.ModelEvaluator
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
It returns the accuracy of the player as a percentagedouble
This function returns the testing accuracy of the modeldouble
This function returns the training accuracy of the modelvoid
initializeList
(int size) Initialize the confusion matrix to all zerosvoid
printConfusionMatrix
(InputFileReader fileReader) It prints the confusion matrixvoid
reset()
This function resets the confusion matrix, the correct counter, and the turns countervoid
void
setTestingaccuracy
(double accuracy) This function sets the testing accuracy of the modelvoid
setTrainingaccuracy
(double accuracy) This function sets the training accuracy of the modelvoid
updateConfusionMatrix
(ArrayList<Double> expectedOutputArray, int predictedNeuronNum) This function updates the confusion matrix by comparing the expected output array with the predicted output arrayvoid
updateConfusionMatrix
(ArrayList<Double> expectedOutputArray, ArrayList<Double> actualOutputArray) This function takes in two arrays, one of expected outputs and one of actual outputs, and updates the confusion matrix accordingly __ __ __ __ |TP FP | 0 1 |FN TN | 2 3void
updatePredictionData
(double prediction, double label, double confidance) This function updates the prediction data
-
Field Details
-
confusionMatrix
-
-
Constructor Details
-
ModelEvaluator
public ModelEvaluator()
-
-
Method Details
-
updateConfusionMatrix
This function updates the confusion matrix by comparing the expected output array with the predicted output array- Parameters:
expectedOutputArray
- The expected output of the neural network.predictedNeuronNum
- The index of the neuron that was predicted to be the correct one.
-
updateConfusionMatrix
public void updateConfusionMatrix(ArrayList<Double> expectedOutputArray, ArrayList<Double> actualOutputArray) This function takes in two arrays, one of expected outputs and one of actual outputs, and updates the confusion matrix accordingly __ __ __ __ |TP FP | 0 1 |FN TN | 2 3- Parameters:
expectedOutputArray
- The expected output of the neural networkactualOutputArray
- The actual output of the neural network
-
initializeList
public void initializeList(int size) Initialize the confusion matrix to all zeros- Parameters:
size
- The number of classes in the dataset.
-
updatePredictionData
public void updatePredictionData(double prediction, double label, double confidance) This function updates the prediction data- Parameters:
prediction
- The prediction of the model.label
- The actual label of the data.confidance
- The confidance of the prediction.
-
reset
public void reset()This function resets the confusion matrix, the correct counter, and the turns counter -
resetConfusionMatrix
public void resetConfusionMatrix() -
getAccuracy
public double getAccuracy()It returns the accuracy of the player as a percentage- Returns:
- The accuracy of the player.
-
setTrainingaccuracy
public void setTrainingaccuracy(double accuracy) This function sets the training accuracy of the model- Parameters:
accuracy
- The accuracy of the model on the training data.
-
getTrainingAccuracy
public double getTrainingAccuracy()This function returns the training accuracy of the model- Returns:
- The training accuracy of the model.
-
setTestingaccuracy
public void setTestingaccuracy(double accuracy) This function sets the testing accuracy of the model- Parameters:
accuracy
- The accuracy of the model on the test data.
-
getTestingAccuracy
public double getTestingAccuracy()This function returns the testing accuracy of the model- Returns:
- The testing accuracy of the model.
-
printConfusionMatrix
It prints the confusion matrix- Parameters:
fileReader
- This is the object of the InputFileReader class.
-