[英]How to increase the accuracy of this CNN Model?
I have tried many combinations in the values for this model.我在这个 model 的值中尝试了很多组合。
shape of original dataset: (343889, 80)原始数据集的形状:(343889, 80)
shape of - training dataset: (257916, 80)训练数据集的形状:(257916, 80)
shape of - training Labels: (257916,) shape of - training 标签:(257916,)
shape of - testing dataset: (85973, 80)形状 - 测试数据集:(85973, 80)
shape of - testing Labels: (85973,)形状 - 测试标签:(85973,)
The model is model 是
inputShape = (80,1,)
model = Sequential()
model.add(Input(shape=inputShape))
model.add(Conv1D(filters=80, kernel_size=30, activation='relu'))
model.add(MaxPooling1D(40))
model.add(Dense(60))
model.add(Dense(9))
model.compile(optimizer='adam', loss='binary_crossentropy',
metrics=['accuracy'])
Model's summary模型的总结
Model: "sequential_11"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv1d_11 (Conv1D) (None, 51, 80) 2480
max_pooling1d_9 (MaxPooling (None, 1, 80) 0
1D)
dense_8 (Dense) (None, 1, 60) 4860
dense_9 (Dense) (None, 1, 9) 549
=================================================================
Total params: 7,889
Trainable params: 7,889
Non-trainable params: 0
_________________________________________________________________
The training is given below.培训如下。
Epoch 1/5
8060/8060 [==============================] - 56s 7ms/step - loss: -25.7724 - accuracy: 0.0015
Epoch 2/5
8060/8060 [==============================] - 44s 5ms/step - loss: -26.7578 - accuracy: 0.0011
Epoch 3/5
8060/8060 [==============================] - 43s 5ms/step - loss: -26.7578 - accuracy: 0.0011
You can try a couple of things to adjust your model performance.您可以尝试一些方法来调整您的 model 性能。
Since you want to classify something, your model is not doing so (at least not directly).既然你要分类,你的 model 并没有这样做(至少没有直接这样做)。
The problems I can see at first sight are:我第一眼看到的问题是:
First of all, in your shoes, I would revise the classification problems with neural.network.首先,站在你的立场上,我会用 neural.network 修改分类问题。
About your model, a starting point could be this edit关于您的 model,起点可能是此编辑
inputShape = (80,1,)
model = Sequential()
model.add(Conv1D(filters=80, kernel_size=30, activation='relu', input_shape = inputShape))
model.add(MaxPooling1D(40))
model.add(Dense(60), activation='relu') # note activation function
model.add(Dense(9), activation='softmax') # note activation function
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',
metrics=['accuracy']) # note the loss function
I am not saying this is going to solve your problem (without knowing data it is impossible) but it is a start, then you have to work on fighting overfitting, hyperparameters tuning, etc.我并不是说这会解决你的问题(不知道数据是不可能的)但这是一个开始,然后你必须努力解决过度拟合、超参数调整等问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.