The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Problem on 2D Convolution Neural Networks (channels_first, channels_last not defined)"
Hi,
I have a CSV dataset compost of a 301 attributes and 634336 rows.
After the windowing model, the number of attributes becomes 4816 and the number of rows becomes 39645.
In keras model I would like to pass an array of 16 rows and 301 columns and use a Convolution_2D and MaxPooling_2D.
Input_shape of keras model = (None, 1, 16,301) (batchSize, channel, height, width) following an online example with "channels_first" formatting.
When I launch the process, RapidMiner returns the following error screen:
"The execution of the python script failed. Please check your python script: NameError: name 'channels_first' is not defined (script, line 272)".
If i change the configuration to "channels_last" (None, height, width, channel) the problem 's not solve.
Keras model is compost of: convolution level 2d + maxPooling 2d + Dropout + Flatten + 2 dense levels.
Could you help me solve the problem?
I have attached the .rpm file process.
Thank you so much.
Tagged:
0
Answers
Unfortunately, I do not come with a solution, but a workaround :
You can maybe adapt your process in order to use the operator(s) of the Deep Learning extension (0.9.0) (to install from MarketPlace).
For that, you can inspire yourself of the sample process 04 S&P etc.
I hope it helps,
Regards,
Lionel
Although your problem does not seem to be related to your data, can you share your dataset(s) ?
In deed, how said there is surely a workaround with the Deep Learning extension and/or with a Python script (implemented in
RapidMiner via the Execute Python operator).
Regards,
Lionel
Regards,
Ale
Regards,
Ale
Thanks to share your 2 datasets.
Like said an alternative is to use a Python Script and I'm working on it...
I have just two questions :
- your datasets have no header (names of the attributes) ?
- In this case, how to determine your label ?
Regards,
Lionel
Ok by executing your process, I understood :
Your label is Att301 which is renamed "KP"
Regards,
Lionel
I was not able to reproduce what you observe ('channels first' is not defined...) but in my case,
the Keras model did not produce any output (so in fine RapidMiner raises an error... ).
Anyways, like said previously one workaround is to use a Python script, so I propose you
this process using the Keras library.
To execute this process, you have to set the parameters of the Keras model and the parameters of the layers
at the beginning of the Python script (I planned exactly the same layers you used in your RapidMiner process).
This Python script produces 3 outputs :
- the training set.
- the test set with the "raw" (at the exit of the neural network) confidences for each class of your label + the predicted class :
- the evaluation of the "loss function" and of the "accuracy" (based on your test set which is already labelled) :
I have set 2 sample operators in order to reduce the number of examples to 1000 and 100 for respectively the training set and the test set
(to reduce the computation time) ==> don't forget to remove/disable these 2 operators before executing the process with your whole dataset(s).
.... but be patient with your whole dataset, I think you have to wait many and many hours.....
The process is in attached file.
I hope it helps,
Regards and Merry Christmas.
Lionel
A little improvment of the previous process :
There is a 4th output : an history containing the list of successive "loss" and "accuracy" according to the "epoch" during the training phase :
I hope it helps,
Regards,
Lionel