Prediction Problem on a regression Problem

1 visualización (últimos 30 días)
Kuno Bruswachtl
Kuno Bruswachtl el 17 de Feb. de 2022
Respondida: arushi el 5 de Sept. de 2024
Hi,
I have got a problem regarding finding out what my acutual accuracy of the test data is. A short briefing: I have an input of 6570x1x1x7500 for the training data set and a 500x1x1x7500 for as the response training-data set. The reason this being a 4-d array is because I used the function cat to convert it from a cell to an array.
In my layers I only use, fullyConnectedLayer and a BatchNormalization as well as a resize2d to match the output accordingly.
I train the network with the trainNetwork function and get a result of 3.571 as RSME.
Now I want to use the predict function to go and test my test dataset, I do this as follows:
Voxelpred = predict(net, arrTestB );
predictionError = arrTestV - Voxelpred;
numCorrect = sum(abs(predictionError)<10);
numImagesValidation = numel(arrTestV);
accuracy = numCorrect/numImagesValidation;
rmse = sqrt(mean(predictionError.^2))
My problem now is the following:
I do get results, but in the form of 4-D single or if I convert them into double. 4-D double. However I want to know what this would be percentage wise? As well as my Voxelpred should be in the same form as my target Data I trained it with, because as said, I get a 4-D single as response from the predict function. Any ideas?
thanks in advance

Respuestas (1)

arushi
arushi el 5 de Sept. de 2024
Hi,
I understand that you want to calculate accuracy in percentage and ensure that ‘Voxelpred’ has same format as target data. You can use the “reshape” function to change dimensions of “voxelpred” and to get accuracy you can modify your code as follows:
Voxelpred = predict(net, arrTestB);
Voxelpred = reshape(Voxelpred, size(arrTestV)); % Reshape Voxelpred to match the target data size
predictionError = arrTestV - Voxelpred;
numCorrect = sum(abs(predictionError) < 10);
numImagesValidation = numel(arrTestV);
accuracy = (numCorrect / numImagesValidation) * 100; % Calculate accuracy in percentage
rmse = sqrt(mean(predictionError(:).^2));
I have assumed that “Voxelpred” and “arrTestV” have same number of elements. \
Find below the documentation of “reshape” function.
Hope this helps!

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by