I want to predict for each row in the dataframe by iterating through the rows.
I have tried the solution mentioned in Row-wise prediction over Pandas dataframe by passing sklearn.predict to df.apply but this is only for a single row.
Here's a snippet of what I've so far tried.
prediction = X_test.apply(lambda x: model.predict([x])[0],axis=1)
predictions = [round(value) for value in prediction]
accuracy = accuracy_score(Y_test, predictions)
print("Test Accuracy: %.2f%%" % (accuracy * 100.0))
I want to be able to loop this code for all present rows.