MATLAB Answers

I need help about the imbalanced data

17 views (last 30 days)
aslan kaya
aslan kaya on 21 Sep 2021
Commented: aslan kaya on 21 Sep 2021
i have a data set , but i couldn't manage to get a good solution . I will be apprecite if you help me to handle imbalanced data. Thanks a lot

Accepted Answer

KSSV
KSSV on 21 Sep 2021
Edited: KSSV on 21 Sep 2021
Read about readtable.
After reading you can access the rspective columns using T.T1, T.T2 etc... or T.(1), T.(2) etc.
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/744984/data.xlsx')
T = 500×9 table
T1 T2 T3 T4 T5 T6 T7 T8 RESULT ____ ____ ____ ____ ____ ____ ____ ____ ______ 12.5 6.25 1.05 11 3 1.3 1.75 1.6 3 2.7 2.7 2.2 3.35 1.75 2.8 1.55 1.8 2 2.5 2.9 2.2 3.2 1.75 3 1.65 1.7 3 2.5 2.9 2.2 3.05 1.85 2.8 1.45 1.95 3 2.7 3 2 3.5 1.8 2.8 1.65 1.7 2 2.5 3.1 2.1 3.05 2 2.8 1.3 2.3 2 9 4 1.2 7.5 2.35 1.6 1.85 1.5 1 3.4 3.3 1.65 3.75 2.2 2.15 1.5 1.85 2 3.2 3 1.8 3.75 1.8 2.55 1.7 1.65 3 8 4.3 1.2 7 2.5 1.5 1.6 1.75 3 5.5 3.6 1.35 5.25 2.3 1.75 1.7 1.65 3 2.5 3.1 2.1 3.2 1.95 2.7 1.55 1.8 3 2.5 2.7 2.3 3.2 1.7 3.05 1.65 1.7 3 5.5 4.6 1.25 5 2.6 1.6 1.55 1.8 3 6.25 3.75 1.3 5.25 2.4 1.65 1.55 1.8 3 4 3.6 1.5 4.25 2.4 1.9 1.35 2.15 3
  5 Comments
aslan kaya
aslan kaya on 21 Sep 2021
clear all;
close all;
clc
data=xlsread('data.xlsx');
input=data(:,1:8);
output=data(:,end);
x=input';
t=output';
trainFcn='trainlm';
hiddenLayerSize=[10 8 3];
net=feedforwardnet(hiddenLayerSize, trainFcn);
net.layers(1).transferFcn='tansig';
net.layers(2).transferFcn='tansig';
net.layers(3).transferFcn='tansig';
net.input.processFcns={'removeconstantrows', 'mapminmax'};
net.output.processFcns={'removeconstantrows', 'mapminmax'};
net.divideFcn='dividerand';
net.divideMode='sample';
net.divideParam.trainRatio=70/100;
net.divideParam.valRatio=20/100;
net.divideParam.testRatio=10/100;
net.trainParam.show=25;
net.trainParam.lr=0.001;
net.trainParam.epochs=100;
net.trainParam.goal=0;
net.trainParam.max_fail=50;
net.trainParam.mc=0.9;
net.trainParam.min_grad=0;
net.performFcn='mse';
net.plotFcns={'plotform', 'plottrainstate','ploterrhist','plotregression', 'plotfit'};
[net,tr]=train(net,x,t);
y=net(x);
e=gsubtract(t,y);
performance=perform(net,t,y);
trainTargets=t.*tr.trainMask(1);
valTargets=t.*tr.valnMask(1);
testTargets=t.*tr.testMask(1);
trainPerformance=perform(net,trainTargets,y);
valPerformance=perform(net,valTargets,y);
testPerformance=perform(net,testTargets,y);
a=trainFcn;
b=hiddenLayerSize;
f1=net.layers(1).transferFcn;
f2=net.layers(2).transferFcn;
f3=net.layers(3).transferFcn;
f=trainPerformance;
g=valPerformance;
k=testPerformance;
result=[a,',',num2str(b),',',f1,',',f2,',',f3,',', num2str(f),',',num2str(g),',',num2str(k)];
disp(result)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!