Or if it's a binary prediction problem then just use 1 instead (because shape will return error). Author 17laker commented Feb 18, 2019 Thanks! I tried to use 1 instead of Y_train.shape[1] and it worked! Using Y_train.shape[1] would return index error. Anyway, thank you for you...