Machine learning seems to only classify one category
Mostrar comentarios más antiguos
I am currently working on trying to implement a machine learning network in a project I have been working on. The issue I have is that I have a lot of different data points (18 different categories) with varried values (some go from 0 - 300, some go from 1 - 4, etc.) and use that to categorize each set as either "healthy" or "afflicted". All of my inputs are integers and the outputs are those two categories. I am running into an issue where, when I train the network, it always comes to the conclusion that the data is that of an afflicted individual. I have 66 training data points, 53 of which are for "afflicted" data sets and 13 are for "healthy" data sets. The accuracy freezes at 72.73% every time I run the code. This isn't 53/66... so I really don't know what's going on here. I've included my code below, in case it helps. I'm relatively new to machine learning and also know I have some lazy coding tendencies, so any feedback to help out with this bug would be very greatly appreciated!
Controls_temp = xlsread('CCGB_Trainer.xlsx',3);
Subject_temp = xlsread('CCGB_Trainer.xlsx',4);
CRC_Patients_temp = [Controls_temp, Subject_temp];
CRC_Patients = mat2cell(CRC_Patients_temp,[size(CRC_Patients_temp,1)],ones(size(CRC_Patients_temp,2),1))';
Diagnoses = {};
for i = 1:size(CRC_Patients_temp,2)
if(i > size(Controls_temp))
Diagnoses(i,1) = {'Afflicted'};
else
Diagnoses(i,1) = {'Healthy'};
end
end
Diagnoses = categorical(Diagnoses);
CtrlNum = size(Controls_temp, 1);
TierSizes = [0.7 0.4];
Tiers = TierSizes .* CtrlNum - mod(TierSizes*CtrlNum,1);
layers = [ ...
sequenceInputLayer(CtrlNum)
lstmLayer(300,'OutputMode','last')
fullyConnectedLayer(Tiers(1))
lstmLayer(300,'OutputMode','last')
fullyConnectedLayer(Tiers(2))
lstmLayer(300,'OutputMode','last')
fullyConnectedLayer(2)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm',...
'MaxEpochs', 65,...
'Shuffle', 'Never',...
'Plots', 'training-progress');
rng('default');
net = trainNetwork(CRC_Patients,Diagnoses,layers,options);
1 comentario
Jong-hwan Kim
el 5 de Dic. de 2020
I'm also curious about this, but no one answered... Did you find the answer?
Respuestas (0)
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!