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 :: colorgram in python 
Python :: Python | Pandas DataFrame.where() 
Python :: python list input print 
Python :: .format python 3 
Python :: how to print out even index in python 
Python :: exclude first value of an array python 
Python :: download unsplash images python no api 
Python :: matplotlib axis labels 
Python :: pd.datetimeindex 
Python :: pandas dataframe any along row 
Python :: python try except: print error 
Python :: netcdf in python 
Python :: python string continue next line 
Python :: wifite2 
Python :: django login 
Python :: how to read json from python 
Python :: random pick between given things python 
Python :: how to remove role from people with a reaction discord bot python 
Python :: python find if strings are anagrams 
Python :: separate words in a text to make a list python 
Python :: python between inheritance and composition 
Python :: pandas resample friday 
Python :: dataframe print column 
Python :: python boolean operators 
Python :: string to list python 
Python :: arrays python 
Python :: sort a dictionary by value then key 
Python :: how to code a trading bot in python 
Python :: qt set focus 
Python :: python condition question 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =