【发布时间】:2019-03-31 20:07:23
【问题描述】:
我做了什么:
我使用 Keras 实现了以下模型:
train_X, test_X, train_Y, test_Y = train_test_split(X, Y, test_size=0.2, random_state=np.random.seed(7), shuffle=True)
train_X = np.reshape(train_X, (train_X.shape[0], 1, train_X.shape[1]))
test_X = np.reshape(test_X, (test_X.shape[0], 1, test_X.shape[1]))
inp = Input((train_X.shape[1], train_X.shape[2]))
lstm = LSTM(1, return_sequences=False)(inp)
output = Dense(train_Y.shape[1], activation='softmax')(lstm)
model = Model(inputs=inp, outputs=output)
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])
model.fit(train_X, train_Y, validation_split=.20, epochs=2, batch_size=50)
我想要什么:
我想将 SVM 添加到模型的最后一层,但我不知道怎么做?有什么想法吗?
【问题讨论】:
-
@UpasanaMittal 你能给我举个例子吗?不知道怎么弄?
标签: python neural-network keras svm