- I don’t understand the different classes you have in a wind speed dataset. If the X_train_n is [50 10500] where each row is a 50-length vector containing wind speeds (numbers) and you’re trying to predict the 51st wind speed, I would expect Y_train to be of shape [1 10500].
- You say Y_train is a categorical matrix of [13 10500] but it’s unclear to me what the categories are and why they didn’t exist for the preceeding 50 samples.
1d CNN with classification layer for prediction
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm working on a thesis work in which i have to predict the wind speeds every 30 minutes with a convolutional neural network.
We have used a dataset of one year of wind speeds every 30 mnutes (around 15000 data), divided in training set (70%) and testing set(30%)
Our aim is to use as input 50 wind speeds to forecast the 51th wind speed ( X_train_n is a matrix [50 10500]), and this is done for the entire dataset, by using cnn with classification layer. The number of classes are 13, so Y_train is a categorical matrix [ 13 10500].
where n_input=50, n_output= 13
X_train_n is reshaped in a 4d matrix: the first column contains the wind speed from 1 to 50, the second one the wind speeds from 2 to 51 and so on.
Y_train is a categorical matrix: 13 classes for each column, where the columns represent the 51th, 52th ecc.. wind speed.
The problem is that matlab gives us the error in the figure.
The Y_train can't be a matrix? it has to be only a vector? how can i solve it?
댓글 수: 0
답변 (1개)
Asvin Kumar
2021년 1월 8일
A couple of details are unclear to me.
Nevertheless, you could try the following suggestions:
Option 1:
If you’re working with categorical data, as the error message says, Y_train must be a categorical vector of shape [1 10500]. Each element of this categorical vector could then represent one of 13 categories.
Have a look at this example of a 5x1 categorical vector where each category is 1 of 3 possibilities.
For a deep learning specific usage, have a look at the digit classification example. Run the example and try the following commands:
net.Layers(end)
Notice that it says classificationOutputLayer with 10 outputs. This represents the 10 possible categories it can take. Try this next:
im = read(imdsValidation);
classify(net, im)
Notice that the output is a categorical scalar and not a 10-length array. If what you’re having is a one-hot encoding of the 13 different classes, use the onehotencode function to convert it into a suitable catergorical array. You could adapt your understanding from this example to suit your use case.
Option 2:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!