Training, validating, and testing model.
Hi,
I have written three linear regression models and would like to know how to train, validate, and thest them with a random 60 20 20 split. any help would be much appreciated. here is the code.
PTT = filtered_BP_Data(:, 1);
systolicBP = filtered_BP_Data(:, 2);
diastolicBP = filtered_BP_Data(:, 3);
avgBP = filtered_BP_Data(:, 4);
lm1 = fitlm(PTT, systolicBP);
disp(lm1);
% plot PTT vs systolic BP
figure;
scatter(PTT, systolicBP, ‘x’);
hold on;
regressionLine1 = lm1.Coefficients.Estimate(1) + lm1.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine1, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Systolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Systolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm2 = fitlm(PTT, diastolicBP);
disp(lm2);
% plot PTT vs diastolic BP
figure;
scatter(PTT, diastolicBP, ‘x’);
hold on;
regressionLine2 = lm2.Coefficients.Estimate(1) + lm2.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine2, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Diastolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Diastolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm3 = fitlm(PTT, avgBP);
disp(lm3);
% plot PTT vs avg BP
figure;
scatter(PTT, avgBP, ‘x’);
hold on;
regressionLine3 = lm3.Coefficients.Estimate(1) + lm3.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine3, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Avg Blood Pressure (mmHg)’);
title(‘Average PTT vs Avg BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;Hi,
I have written three linear regression models and would like to know how to train, validate, and thest them with a random 60 20 20 split. any help would be much appreciated. here is the code.
PTT = filtered_BP_Data(:, 1);
systolicBP = filtered_BP_Data(:, 2);
diastolicBP = filtered_BP_Data(:, 3);
avgBP = filtered_BP_Data(:, 4);
lm1 = fitlm(PTT, systolicBP);
disp(lm1);
% plot PTT vs systolic BP
figure;
scatter(PTT, systolicBP, ‘x’);
hold on;
regressionLine1 = lm1.Coefficients.Estimate(1) + lm1.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine1, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Systolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Systolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm2 = fitlm(PTT, diastolicBP);
disp(lm2);
% plot PTT vs diastolic BP
figure;
scatter(PTT, diastolicBP, ‘x’);
hold on;
regressionLine2 = lm2.Coefficients.Estimate(1) + lm2.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine2, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Diastolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Diastolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm3 = fitlm(PTT, avgBP);
disp(lm3);
% plot PTT vs avg BP
figure;
scatter(PTT, avgBP, ‘x’);
hold on;
regressionLine3 = lm3.Coefficients.Estimate(1) + lm3.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine3, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Avg Blood Pressure (mmHg)’);
title(‘Average PTT vs Avg BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off; Hi,
I have written three linear regression models and would like to know how to train, validate, and thest them with a random 60 20 20 split. any help would be much appreciated. here is the code.
PTT = filtered_BP_Data(:, 1);
systolicBP = filtered_BP_Data(:, 2);
diastolicBP = filtered_BP_Data(:, 3);
avgBP = filtered_BP_Data(:, 4);
lm1 = fitlm(PTT, systolicBP);
disp(lm1);
% plot PTT vs systolic BP
figure;
scatter(PTT, systolicBP, ‘x’);
hold on;
regressionLine1 = lm1.Coefficients.Estimate(1) + lm1.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine1, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Systolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Systolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm2 = fitlm(PTT, diastolicBP);
disp(lm2);
% plot PTT vs diastolic BP
figure;
scatter(PTT, diastolicBP, ‘x’);
hold on;
regressionLine2 = lm2.Coefficients.Estimate(1) + lm2.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine2, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Diastolic Blood Pressure (mmHg)’);
title(‘Average PTT vs Diastolic BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off;
lm3 = fitlm(PTT, avgBP);
disp(lm3);
% plot PTT vs avg BP
figure;
scatter(PTT, avgBP, ‘x’);
hold on;
regressionLine3 = lm3.Coefficients.Estimate(1) + lm3.Coefficients.Estimate(2) * PTT;
plot(PTT, regressionLine3, ‘-r’);
xlabel(‘PTT (ms)’);
ylabel(‘Avg Blood Pressure (mmHg)’);
title(‘Average PTT vs Avg BP’);
legend(‘Data Points’, ‘Location’, ‘best’);
grid on;
hold off; linear regression, machine learning, statistics, data-analysis MATLAB Answers — New Questions