【问题标题】:Training Multiclass input output in keras在 keras 中训练多类输入输出
【发布时间】:2019-10-18 01:15:47
【问题描述】:

我正在尝试使用 Keras 为 ANN 训练 16 位二进制输入和 16 位二进制输出。问题是训练准确率仅达到 15%。什么是训练数据类型的最佳方法,例如

Xtrain                       Ytrain
1,0,1,0,1,1,1,0,0,0,0,0=1,0,1,0,1,0,1,1,1,1
1,1,1,0,0,0,0,1,1,1,1,1=0,0,0,0,1,1,1,1,1,1

Xtest
1,1,1,1,0,1,0,1,0,1,0,1

X = dataset[:,0:16]
Y = dataset[:,16:32]



x_train,x_test,y_train,y_test = train_test_split(X,Y,test_size = 0.15, random_state = 0)

clf_ann_ad = Sequential()
clf_ann_ad.add(Dense(32, activation = 'relu', input_dim = 16))
clf_ann_ad.add(Dense(16,activation='relu'))
clf_ann_ad.add(Dense(16,activation='sigmoid'))
clf_ann_ad.compile(optimizer = 'adam', loss = 'mean_squared_error', metrics = ['accuracy'])
history = clf_ann_ad.fit(x_train,y_train,batch_size = 100, nb_epoch = 200, validation_split = 0.1)
print(history.history.keys())

【问题讨论】:

    标签: python tensorflow keras training-data


    【解决方案1】:

    第一个:

    我认为您的问题是序列到序列的问题 所以我认为您需要具有单向 RNN 的递归神经网络来获得我们如何编码数字并对其进行转换的模式:
    Binaray Classification Using Recurrent

    第二点: 您在分类问题中使用 mean_square_error 错误函数,该函数用于告诉您回归线与一组点有多接近。 所以我会使用二元交叉熵,该损失函数用于涉及是/否(二元)决策的问题。

    对于您的问题没有明确而明确的答案,我深表歉意,因为您没有给我们足够的信息,所以我无法确定

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-22
      • 1970-01-01
      • 2017-09-05
      相关资源
      最近更新 更多