简体   繁体   English

在 keras 中训练多类输入 output

[英]Training Multiclass input output in keras

I am trying to train 16-bit binary input and 16-bit binary output for ANN using Keras.我正在尝试使用 Keras 为 ANN 训练 16 位二进制输入和 16 位二进制 output。 the problem is traing accuracy merely reaches 15%.问题是训练准确率仅达到 15%。 What could be the best way to train datatypes like什么可能是训练数据类型的最佳方法,例如

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())

First One:第一:

I'm thinking that your problem is a Sequence to a Sequence problem so i Think you need Recurrent Neural Network with uni Directional RNN to get the pattern how we encoding number and convert it:我认为您的问题是序列到序列的问题,所以我认为您需要具有单向 RNN 的递归神经网络来获取我们如何编码数字并对其进行转换的模式:
Binaray Classification Using Recurrent 使用循环的二进制分类

Second point: you use mean_square_error error function in classification problem that's not right that function used for telling you how close a regression line is to a set of points.第二点:您在分类问题中使用 mean_square_error 错误 function 是不对的,function 用于告诉您回归线与一组点的接近程度。 so i you would use binary cross entropy which loss function used on problems involving yes/no (binary) decisions.所以我会使用二进制交叉熵,它会损失 function 用于涉及是/否(二进制)决策的问题。

I apologize for the lack of an explicit and clear answer about your problem, I can not identify because you did not give us enough information对于您的问题没有明确而明确的答案,我深表歉意,我无法确定,因为您没有给我们足够的信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何格式化Keras上的训练输入和输出数据 - How to format training input and output data on Keras Keras:使用数组作为输入进行训练 - Keras : training with an array as an input Keras 多类训练准确度没有提高,也没有损失报告 - Keras multiclass training accuracy does not improve and no loss is reported TF.Keras 自定义 Scratch 训练中的多输出-多类分类 - Multioutput-Multiclass Classification in Custom Scratch Training in TF.Keras Keras中的输入整形和模型训练 - Input shaping in Keras and model training 如何让多类 Keras 模型输出字符串而不是 OHE? - How to get multiclass Keras model to output string instead of OHE? Keras output 层用于多类分类问题,值范围 -128 到 127 - Keras output layer for multiclass classification problem with value range -128 to 127 Training Multiple Input and Output Keras Model (ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list)) - Training Multiple Input and Output Keras Model (ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list)) 在训练TensorFlow模型(,?不是Keras模型)时,如何获取模型中间层(op)的输入输出? - During training the TensorFlow model(!!Not the Keras model), How to get the input and output of the intermediate layer(op) of the model? Keras输入/输出 - Keras Input/Output
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM