Home > Software design >  validation accuracy is rounding to 3dp
validation accuracy is rounding to 3dp

Time:06-14

This is my first time with perceptron, ave perceptron and pegasos models. I've written functions which have worked for various test cases thus far. But when I come to check accuracy, my validation accuracy values are all rounding down to 3 dp.

Could this part of my code be the problem?

pred = np.where(decision > np.finfo(float).eps, 1.0, -1.0)

Edit:

changed that line to the following but it made no impact on the validation accuracy output.

pred = np.where(decision >= 1e-16, 1.0, -1.0)

CodePudding user response:

Turns out that all of the answers should have been 3dp because was dividing by 500. The actual problem for why my answers didn't match the online grader for this project, was that something had gone wrong with my Pycharm/plugins/encoding. I didn't have time to look into it too much because of deadlines, but basically it was fixed by reinstalling everything. Apparently other people had the same incorrect results by not correctly specifying the filepath to some files we needed to read in.

  • Related