novak-99/MLPP

preformance_function error?

algorithmconquer opened this issue · 1 comments

double Utilities::performance(std::vector<double> y_hat, std::vector<double> outputSet){
    double correct = 0;
    for(int i = 0; i < y_hat.size(); i++){
        if(std::round(y_hat[i]) == outputSet[i]){
            correct++;
        }
    }
    return correct/y_hat.size();
}

problem:std::round(y_hat[i]) == outputSet[i]???

Hello,

The reason I employed rounding is for the fact that it is unlikely that a model outputing discrete values would be able to exactly output, say [1, 0, 1]. Typically, these values are approached if an iterative algorithm is used, and a typical output would be something like [0.99, 0.001, 0.999], etc.. For this reason, rounding them to the nearest integer and then comparing them with the true outputs is more convienent for calcualting accuracy.