importtensorflowastfimportpandasaspdimportnumpyasnpimportmatplotlib.pyplotaspltdata=pd.read_csv('credit-a.csv', header=None)
print(data.iloc[:, -1].value_counts())
x=data.iloc[:, :-1]
y=data.iloc[:, -1].replace(-1, 0)
model=tf.keras.Sequential()
model.add(tf.keras.layers.Dense(4, input_shape=(15,), activation='relu'))
model.add(tf.keras.layers.Dense(4, activation='relu'))
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
print(model.summary())
model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['acc'])
history=model.fit(x, y, epochs=100)
plt.plot(history.epoch, history.history.get('loss'))
plt.show()
plt.plot(history.epoch, history.history.get('acc'))
plt.show()