in the example there is data of obesity,inactivity,diabetes with 354 datapoints with these data we are going to plot the 3Dgraph data.
test error: this particular method will divide the data into 5 equal parts to get the accurate output.for testing the obesity,inactivity,diabetes data we use this test error method
labelleddata=Partition[Flatten[Riffle[Range[Length[data]],data]],4,4];labelleddata[[1;;5]]
here
L=labelleddata;
n=1;
While[n<=4,sample[n]=RandomSample[L,71];
L=Complement[L,sample[n]];n++];
sample[5]=L;
datasample[n_]:=sample[n][[All,{2,3,4}]]Wenowestablish5setsoftrainingdataandtestdata:Alldatasamples=Table[sample[k],{k,1,5}];
TrainingData[k_]:=Partition[Flatten[Drop[Alldatasamples,{k}]],4,4][[All,{2,3,4}]]TestData[k_]:=datasample[k]