[regression] started to simplify chapter to a 1d problem
This commit is contained in:
@@ -1 +0,0 @@
|
||||
mse = mean((y - y_est).^2);
|
||||
15
regression/code/meansquarederrorline.m
Normal file
15
regression/code/meansquarederrorline.m
Normal 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))
|
||||
Reference in New Issue
Block a user