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 :: scatter plot of a dataframe in python 
Python :: numpy create a matrix of certain value 
Python :: column contains substring python 
Python :: python yaml load_all 
Python :: how to input comma separated int values in python 
Python :: find python version in jupyter notebook 
Python :: initialize array of natural numbers python 
Python :: tkinter window background color 
Python :: facerecognizer python 
Python :: and condition with or in django 
Python :: how to get column names having numeric value in pandas 
Python :: python trace table generator 
Python :: default ordering django 
Python :: root number in python 
Python :: flask mail python 
Python :: python code to remove vowels from a string 
Python :: install nltk in python 
Python :: Python __gt__ magic method 
Python :: make directory python 
Python :: sns palette 
Python :: python font family list 
Python :: learningrate scheduler tensorflow 
Python :: python data frame check if any nan value present 
Python :: matplotlib turn off ticks 
Python :: What happens when you use the built-in function any() on a list? 
Python :: Concat and Append DFs Python 
Python :: error urllib request no attribute 
Python :: renaming multiple columns in pandas 
Python :: pytorch detach 
Python :: with urllib.request.urlopen("https:// 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =