C2W2 Getting Error train_x not defined

Then it might be possible that you have deleted/modified some line of code or cell. Please get a clean copy of your assignment, as described here, and do your code again without changing/deleting the pre-written code and comments.