src/FitnessFunctions.cpp
floatBO EchoBay::Comparator::Accuracy(Eigen::Ref<MatrixBO> predict, Eigen::Ref<MatrixBO> actual, int nOutput, Eigen::Ref<MatrixBO> OutputLabel, const std::string rule)
{
    // Determine labels
    MatrixBO label = argmax_label(predict, actual);
    // Compute Confusion Matrix
    Eigen::MatrixXi confusionMat = Eigen::MatrixXi::Zero(nOutput, nOutput);
    ConfusionMatrix(label, actual, nOutput, confusionMat);
    std::cout << "\n" << confusionMat << std::endl;

    floatBO Accuracy = confusionMat.diagonal().sum() / (double)confusionMat.sum();
    return 100 * Accuracy;
}
/**
 * @brief Calculate fitness function as naive classification accuracy
 * 
 * 
 * @param predict Eigen matrix of predicted values
 * @param actual Eigen matrix of actual values
 * @param nOutput Number of output classe
 * @param OutputLabel [deprecated] return the outputLabel
 * @param rule Unused. Necessary to be compliant with external fitness functions 
 * @return floatBO Value of the fitness function
 */
@brief Calculate fitness function as naive classification accuracy


@brief Calculate fitness function as naive classification accuracy
floatBO EchoBay::Comparator::Accuracy(Eigen::Ref<MatrixBO> predict, Eigen::Ref<MatrixBO> actual, int nOutput, Eigen::Ref<MatrixBO> OutputLabel, const std::string rule)
{
    MatrixBO label = argmax_label(predict, actual);
    Eigen::MatrixXi confusionMat = Eigen::MatrixXi::Zero(nOutput, nOutput);
    ConfusionMatrix(label, actual, nOutput, confusionMat);
    std::cout << "\n" << confusionMat << std::endl;
    floatBO Accuracy = confusionMat.diagonal().sum() / (double)confusionMat.sum();
    return 100 * Accuracy;
}
floatBO EchoBay :: Comparator :: Accuracy ( Eigen :: Ref < MatrixBO > predict , Eigen :: Ref < MatrixBO > actual , int nOutput , Eigen :: Ref < MatrixBO > OutputLabel , const std :: string rule ) { MatrixBO label = argmax_label ( predict , actual ) ; Eigen :: MatrixXi confusionMat = Eigen :: MatrixXi :: Zero ( nOutput , nOutput ) ; ConfusionMatrix ( label , actual , nOutput , confusionMat ) ; std :: cout << " \n " << confusionMat << std :: endl ; floatBO Accuracy = confusionMat . diagonal ( ) . sum ( ) / ( double ) confusionMat . sum ( ) ; return 100 * Accuracy ; }
@brief Calculate fitness function as naive classification accuracy
@brief Calculate fitness function as naive classification accuracy
// Determine labels // Compute Confusion Matrix