Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ValueError: Shapes (None, 1) and (None, 11) are incompatible keras

#Sam Ayo answers .. linkedin.com/in/sam-ayo
If you use one-hot-encoded for the label/classes like [0, 0, 0, 0, 0, 0, 1]
you need to use categorical_crossentropy
but if you use sparse label/classes like [1, 2, 3, 4, 5, 6, 7]
you need to use sparse_categorical_crossentropy.
Comment

shapes (none, 1) and (none, 5) are incompatible

Change Categorical Cross Entropy to Binary Cross Entropy since your output label is binary. Also Change Softmax to Sigmoid since Sigmoid is the proper activation function for binary data
Comment

ValueError: Shapes (None, 1) and (None, 3) are incompatible

y_train = to_categorical(y_train, 3)
y_test = to_categorical(y_test, 3)
Comment

PREVIOUS NEXT
Code Example
Python :: python txt to parquet 
Python :: flask session auto logout in 5 mins 
Python :: python image layers 
Python :: matplotlib remove duplicate legend entries from plotting loop 
Python :: range of y & x in scatter 
Python :: python pathlib 
Python :: pytest - parameterizing tests 
Python :: creating a bar plot bar | creating a bar chart 
Python :: delete and start fresh with db django 
Python :: lemmatization 
Python :: pandas series top 5 percent 
Python :: python 2d dictionary 
Python :: what is django 
Python :: python rotate list 
Python :: len(sys.argv) == 2 
Python :: remove element from list by index 
Python :: python matrix 
Python :: python sklearn knn regression example 
Python :: django bootstrap 
Python :: pycharm update python version 
Python :: pandas not a time nat 
Python :: selenium do not open browser window 
Python :: display pandas dataframe with border 
Python :: merge two netcdf files using xarray 
Python :: piecewise linear regression python 
Python :: python string formatting 
Python :: tensorflow inst for python 3.6 
Python :: how to make a variable global in python 
Python :: how to join tables in python 
Python :: python track time 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =