keras-损失:nan和准确性为0.000

时间:2019-02-12 13:33:05

标签: keras

dataset = data.values
dataset[:, [0,2,3,4,5,6,7,8,9]]
Y = dataset[:, 1]
X_train, X_test, y_train, y_test = train_test_split(X, Y, stratify=Y, random_state=0)

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train_scaled = scaler.fit(X_train).transform(X_train)
X_test_scaled = scaler.fit(X_test).transform(X_test)

model = Sequential()
model.add(Dense(50, input_dim = 9, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='mean_squared_error', optimizer='Adam', metrics=['accuracy'])
model.summary()

model.fit(X_train_scaled, y_train, epochs=50)
print('\n accuracy : {:.4f}'.format(model.evaluate(X_test_scaled, y_test)[1]))

enter image description here

我认为问题出在洁牙机..但我不知道我在做什么...

为什么损失函数具有nan输出,为什么精度为0?

0 个答案:

没有答案