Forum Stats

Keras RNN indexing issue

Hi, Thanks for your reply. I am unable to attach file in that comments. So I created a new thread. I am attaching the data set in this. Can you please inform what the issue is? The same dataset worked with other algorithms like SVM. But not with keras and RNN. I am trying to use Simple RNN with 200 units and a dense layer with 2 units as output has 2 classes in keras model. The label is mentioned as label column in this file. If you are able to get the classification result, please share the XML code.

Answers

Thanks a lot for your response. This fixed the error. I am working on classification. I see that you used dense layer with number of units '1' but the data has 2 classes which needs dense with 2. When I am trying to use 2 in dense layer, its stating that the data coming to dense is (1,) but the dense is expecting (2,). I see that you got performance results as well. Can you inform whether you used any other layers or just a recurrent and dense layer in keras model? Thanks

I have used your data & your Keras model. So its exactly the same.Even the label is classification, but the number of unit in last Dense Layer is 1, because of the value is binominal, only T2 or C. So Keras think that data coming to Dense Layer is only 1.You can see others Keras example in repositories to make sure.

I have used the some model that you make: a recurrent and a dense layer. I didn't make any change or additional. So you can follow the process easy.

You can copy the xml code that I have shared and paste it to your xml panel than apply it. You will find the result will be exactly the same process with yours.

@israel_jimenez Can you explain the issue solved related to our previous discussion?

Also, any idea if we can use cross-validation for keras models (CNN, RNN )? @hermawan_eriadi.

Also, I feel that using 1 in a dense layer is wrong as dense should have the number of units equal to the number of classes in the label. This is the reason the previously accepted solution is predicting only one class(reason for bad results) as the dense is 1 but when I use dense 2 it is throwing an error(stating dense expects input array (2,) but gets (1,)).

I am also attaching the data file for your reference. The data set consists of 9 attributes X1 to X9 and a label column with two Labels H and UH. I will be helpful if you code provide a sample xml for this classification.

@hughesfleming68 any suggestion on this? attached data file in this. Having an error Error when checking target: expected dense_1 to have shape (2,) but got array with shape (1,) But my output classes are two which is the reason I gave dense value as 2.