Review information about MATLAB’s internal dataset “bodyfat_dataset” by typing “help bodyfat_dataset“. Load the dataset by entering: [X,T] = bodyfat_dataset; Find correlation coefficient of each input...

1 answer below »

Review information about MATLAB’s internal dataset “bodyfat_dataset” by typing “help bodyfat_dataset“. Load the dataset by entering:



[X,T] = bodyfat_dataset;



Find correlation coefficient of each input with the output:



corrcoef(X(i,:),T), i=1,2,…13.



Which inputs are more suitable for a multivariate linear regression? Find that linear regression (i.e. the linear mixture coefficients) by using those variables that have better correlation coefficient and report as a baseline: after the aforesaid feature selection, train on the first half, test on the second half, and report the MSE (see your previous assignment/mini project 1).


Now we will use different MLPs onallfeatures and compare their results to those of the best baseline linear model found above.


For each requested task, reset (using the comment ‘init’) and retrain the neural network at hand 10 times and report on both mean and variance on training and validation MSEs as follows:




  1. Create a simple 10 node one hidden layer regression MLP using the command ‘fitnet’. Use the network with its default settings except for training/validation/test data partitioning ratios, which you shall set at 80%, 20%, and 0 % respectively. Find the mean and variance of MSEs for training and validation portions of the dataset from the 10 repetitions.




  1. Change network size to 2 nodes and then to 50 nodes with training and validation ratios set to 30% and 70% and then find the mean and variance of MSEs for training and validation portions of the dataset from the 10 repetitions.




  1. For the 50-node case have regularization (weight decay) set at 0.1 and 0.5 and the find mean and variance of MSEs for training and validation portions of the dataset from the 10 repetitions for each case.



Tabulate and explain your observations. Submit your results as a PowerPoint slide deck. Also, submit along with all your ORIGINAL code. Don't forget to include your linear baseline numbers. Compress and submit ALL your saved neural network objects and programs, but do not include the dataset. Failure to do any of the above steps correctly will reduce your grade proportionally

Answered Same DayOct 21, 2021

Answer To: Review information about MATLAB’s internal dataset “bodyfat_dataset” by typing “help...

Sathishkumar answered on Oct 22 2021
107 Votes
solutions/linear_regression.m
clc
% bodyfat_dataset
[x,t] = bodyfat_dataset;
disp("correlation coefficients:")
for i=1:13
y(:,:,i)=corrcoef(
x(i,:),t)
end
size(x);
X=x';
T=t';
disp("linear Regression Model Training.......")
mdl1 = fitlm(X((1:126),:),T(1:126))
disp("linear Regression Model Training.......")
y_pred=mdl1.predict(X((127:252),:))
errs_t = y_pred - T(127:252)
figure
histogram(errs_t)
title("Histogram of errors - test data")
A=X;
sum1=0;
for i=1:length(A)
sum1=sum1+A(i);
end
disp("Mean")
M=sum1/length(A) %the mean
sum2=0;
for i=1:length(A)
sum2=sum2+ (A(i)-M)^2;
end
disp("Variance")
V=sum2/length(A)%Varaince
solutions/node10.m
clc
clear all
close all
[x,t] = bodyfat_dataset;
for i=1:10
net = fitnet(10,'trainbr');
net = init(net);
% ne = fitnet(10,'trainbr');
net.divideParam.trainRatio = 80/100;
net.divideParam.valRatio = 20/100;
net.divideParam.testRatio = 0/100;
net = train(net,x,t);
y = net(x);
% perf = perform(net,y,t)

perf(i) = mse(net, t, y, 'regularization', 0.01);

end
disp("MSE")
perf
disp("Training Portion:")
A=x(:,1:202);
sum1=0;
for i=1:length(A)
sum1=sum1+A(i);
end
disp("Mean")
M=sum1/length(A) %the mean
sum2=0;
for i=1:length(A)
sum2=sum2+ (A(i)-M)^2;
end
disp("Variance")
V=sum2/length(A)%Varaince
disp("Validation Portion:")
A=x(:,203:252);
sum1=0;
for i=1:length(A)
sum1=sum1+A(i);
end
disp("Mean")
M=sum1/length(A)...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here