Print X_train shape. What do you see? I’d bet X_train
is 2d (matrix with a single column), while y_train
1d (vector). In turn you get different sizes.
I think using X_train[:,0]
for plotting (which is from where the error originates) should solve the problem
Related Posts:
- ImportError: DLL load failed: The specified module could not be found
- ImportError: DLL load failed: The specified module could not be found
- Plotting a 2D heatmap with Matplotlib
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- TypeError: ‘DataFrame’ object is not callable
- load csv into 2D matrix with numpy for plotting
- Dump a NumPy array into a csv file
- Overcome ValueError for empty array
- What is the difference between np.mean and tf.reduce_mean?
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- Linear regression with matplotlib / numpy
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- How to plot an array in python?
- IndexError: index 2 is out of bounds for axis 0 with size 2
- How to implement the ReLU function in Numpy
- TypeError: zip argument #2 must support iteration
- numpy/scipy/ipython:Failed to interpret file as a pickle
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- TypeError: list indices must be integers or slices, not str
- Import Error: No module named numpy
- Purpose of “%matplotlib inline”
- ValueError: setting an array element with a sequence
- Writing a pandas DataFrame to CSV file
- Purpose of “%matplotlib inline”
- numpy max vs amax vs maximum
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Showing an image with pylab.imshow()
- Writing a pandas DataFrame to CSV file
- What exactly does numpy.exp() do? [closed]
- Difference between import numpy and import numpy as np
- How do you change the size of figures drawn with Matplotlib?
- What is the purpose of meshgrid in Python / NumPy?
- why numpy.ndarray is object is not callable in my simple for python loop
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- RuntimeWarning: invalid value encountered in divide
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- numpy: Invalid value encountered in true_divide
- Is “from matplotlib import pyplot as plt” == “import matplotlib.pyplot as plt”?
- python numpy ValueError: operands could not be broadcast together with shapes
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- How to fix ‘Object arrays cannot be loaded when allow_pickle=False’ for imdb.load_data() function?
- How do I create an empty array/matrix in NumPy?
- Most efficient way to find mode in numpy array
- ValueError: operands could not be broadcast together with shapes (5,) (30,)
- ValueError: Unknown label type: ‘continuous’
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ImportError: No module named matplotlib.pyplot
- TypeError: unhashable type: ‘numpy.ndarray’
- How to fix IndexError: invalid index to scalar variable
- matplotlib savefig() plots different from show()
- Could not install packages due to a “Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py'”
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- How does numpy.newaxis work and when to use it?
- numpy matrix vector multiplication
- Converting list to numpy array
- How do I read CSV data into a record array in NumPy?
- IndexError: too many indices for array
- data type not understood
- How do you do natural logs (e.g. “ln()”) with numpy in Python?
- ValueError : I/O operation on closed file
- How do I read CSV data into a record array in NumPy?
- How to normalize a NumPy array to a unit vector?
- Save plot to image file instead of displaying it using Matplotlib
- Should I use np.absolute or np.abs?
- What does numpy.random.seed(0) do?
- ImportError: numpy.core.multiarray failed to import
- Factorial in numpy and scipy
- No handles with labels found to put in legend
- How to plot a histogram using Matplotlib in Python with a list of data?
- What does the c underscore expression `c_` do exactly?
- Convert pandas dataframe to NumPy array
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- ImportError: Missing required dependencies [‘numpy’]
- How can I plot a confusion matrix? [duplicate]
- Error: all the input array dimensions except for the concatenation axis must match exactly
- Expected 2D array, got 1D array instead error
- matplotlib error – no module named tkinter
- ImportError: numpy.core.multiarray failed to import
- How to count the occurrence of certain item in an ndarray?
- size of NumPy array
- Singular matrix issue with Numpy
- Python Pandas – Missing required dependencies [‘numpy’] 1
- numpy array concatenate: “ValueError: all the input arrays must have same number of dimensions”
- Pandas: ValueError: cannot convert float NaN to integer
- Error in Python script “Expected 2D array, got 1D array instead:”?
- How to find all occurrences of an element in a list
- csv.Error: iterator should return strings, not bytes
- pandas DataFrame “no numeric data to plot” error
- TypeError: ‘numpy.float64’ object is not callable
- TypeError: ‘numpy.float64’ object is not callable
- ‘DataFrame’ object has no attribute ‘sort’
- Convert a tensor to numpy array in Tensorflow?
- What’s the difference between torch.stack() and torch.cat() functions?
- ‘DataFrame’ object has no attribute ‘sort’
- Convert a tensor to numpy array in Tensorflow?
- ValueError: all the input arrays must have same number of dimensions
- How to change the font size on a matplotlib plot
- Permission denied error by installing matplotlib
- TypeError: cannot unpack non-iterable int objec
- Updating matplotlib in virtualenv with pip