linearpredict
Predicts target values for the test data points using parameters computed by linearfit function.
Syntax
predictions = linearpredict(parameters,X)
Inputs
- parameters
- Output of linearfit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
Example
Usage of linearpredict
X = [1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21];
y = [1, 2, 3, 4, 5, 6, 7];
options = struct;
options.to_normalize = true;
options.alpha = 0.3;
parameters = linearfit(X, y, options);
predictions = linearpredict(parameters, [1.5 2.0 3; 8 9 3]);
> predictions
[Matrix] 2 x 1
8.33333
17.33333
Comments
It performs regression by estimating coefficients using Gradient Descent method (linearfit). Once coefficients are estimated, prediction is done.