Prediction algorithm completed, definition of test and train sets as well as the accuracy function