i get this error while running:
TypeError: predict_classes() takes from 2 to 4 positional arguments but 5 were given
im not that familiar with python so i'm not sure what to do.
this is the relevent code:
X = dataset[:, 0:4]
y = dataset[:, 4]
model = Sequential()
model.add(keras.layers.Dense(12, input_dim=4, activation='relu'))
model.add(keras.layers.Dense(8, activation='relu'))
model.add(keras.layers.Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(X, y, epochs=150, batch_size=10)
accuracy = model.evaluate(X, y)
print(accuracy)
MS = int(input('ms'))
RC = int(input('rc'))
LC = int(input('lc'))
KS = int(input('ks'))
predictions = model.predict_classes(MS, RC, LC, KS)
print(predictions)
You have to pass a numpy array having shape (1, 4)
where 1
is the batch size.
predictions = model.predict_classes(np.array([[MS, RC, LC, KS]]))
print(predictions[0])