You are running into that error because your X and Y don't have the same length verify with: X.shape Y.shape