import tensorflow as tf
from tensorflow import keras
import numpy as np
training_inputs = np.array([[0,0,1],
[1,1,1],
[1,0,1],
[0,1,1]])
training_outputs = np.array([[0,1,1,0]])
model = keras.Sequential([
keras.layers.Flatten(input_shape=(1,3)),
keras.layers.Dense(1,activation="sigmoid")
])
model.compile(optimizer = "rmsprop",
loss = "binary_crossentropy",
metrics = ["accuracy"])
model.fit(training_inputs,training_outputs,epochs=1)
prediction = model.predict(np.array([[1,1,0]]))
print(prediction)
it has these problems
Traceback (most recent call last): File "C:/Users/Αλέξης/Desktop/Youtube/test.py", line 21, in model.fit(training_inputs,training_outputs,epochs=1) File "C:\Users\Αλέξης\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 709, in fit shuffle=shuffle) File "C:\Users\Αλέξης\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 2651, in _standardize_user_data exception_prefix='input') File "C:\Users\Αλέξης\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\training_utils.py", line 376, in standardize_input_data 'with shape ' + str(data_shape)) ValueError: Error when checking input: expected flatten_input to have 3 dimensions, but got array with shape (4, 3)
Can anyone help?