The following code was written in python to generate a scatter plot of the test data after splitting it into test and train data. The data being read from a sample file was converted to matrix to be able to use the data for the the linear regression algorithm.
But using the same data for the scatter plot generated the following error.
This is because we are passing X_test and Y_test and matrices to scatter plot but which actually are one dimensional arrays. Thus to get around the problem we can cast the data into an numpy array.
The above modification should stop the error from being thrown. The modified code will be.
But using the same data for the scatter plot generated the following error.
This is because we are passing X_test and Y_test and matrices to scatter plot but which actually are one dimensional arrays. Thus to get around the problem we can cast the data into an numpy array.
The above modification should stop the error from being thrown. The modified code will be.