Mar-05-2017, 05:33 PM
Hi
I am attempting to print the values returned from the function, defined as follows:
Thanks
I am attempting to print the values returned from the function, defined as follows:
def calc_accuracy(p_RDD, model): correct = p_RDD.map( lambda lp: 1 if model.predict(lp.features) == lp.label else 0).sum() count = p_RDD.count() accuracy = correct/count return correct, count, accuracybut I get the following error:
---> 27 print('train set correct: {}, of total: {}, accuracy: {}'.format(calc_accuracy(train_RDD, model)) ) IndexError: tuple index out of rangeCan anybody suggest a way I can call the function within a print ?
Thanks