0
Hello,
I’m trying to make my first ANN code to predict the price of homes. I have separated the datasets into training and testing, however, I am finding some problems when compiling my code below:
x_train = train[col]
y_train = train['price']
x_test = test[col]
y_test = test['price']
model = Sequential([
Dense(32, activation='relu', input_dim=(11,)),
Dense(32, activation='relu'),
Dense(1, activation='sigmoid')
])
model.compile(
optimizer='sgd',
loss='binary_crossentropy',
metrics= ['accuracy']
)
hist = model.fit(
x_train,
x_train,
batch_size=32,
epochs=100,
validation_data=(x_test, y_test)
)
Which returns the second error:
ValueError: Error when checking target: expected dense_31 to have shape (1,) but got array with shape (11,)
Because x_train is repeated in model.fit()?
– virtualdvid