I am trying to learn Keras and rather than starting with a large dataset I dont understand, I figured it would be better to create a simple dataset that in theory should be abe to have a 100% succesful prediction rate, but it only predicts 16.67% correct (?).
I tried to adjust some of the the epoc and batch_size values, but nothing works. What should I do here. Thanks in advance.
X = [0,1,2,3,4,5,6,7,8,9,10,11,12]
Y = [0,0,0,0,0,0,0,1,1,1,1,1,1]
le = 1
encoder = LabelEncoder()
encoder.fit(Y)
encoded_Y = encoder.transform(Y)
def create_baseline():
model = Sequential()
model.add(Dense(le, input_dim=le, kernel_initializer='normal', activation='relu'))
model.add(Dense(1, kernel_initializer='normal', activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
estimator = KerasClassifier(build_fn=create_baseline, epochs=1, batch_size=12, verbose=0)
kfold = StratifiedKFold(n_splits=2, shuffle=True, random_state=seed)
results = cross_val_score(estimator, X, Y)
print("Results: %.2f%% (%.2f%%)" % (results.mean()*100, results.std()*100))