[regression] started to simplify chapter to a 1d problem

This commit is contained in:
2020-12-15 23:18:12 +01:00
parent a097b10024
commit be79d450df
7 changed files with 246 additions and 115 deletions

View File

@@ -1 +0,0 @@
mse = mean((y - y_est).^2);

View File

@@ -0,0 +1,15 @@
n = 40;
xmin = 2.2;
xmax = 3.9;
c = 6.0;
noise = 50.0;
% generate data:
x = rand(n, 1) * (xmax-xmin) + xmin;
yest = c * x.^3;
y = yest + noise*randn(n, 1);
% compute mean squared error:
mse = mean((y - y_est).^2);
fprintf('the mean squared error is %g kg^2\n', mse))