logisticpredict
Predicts target values for the test data points using parameters computed by logisticFit function.
Syntax
predictions = logisticpredict(parameters,X)
[predictions, probability] = logisticpredict(parameters,X)
Inputs
- parameters
- Output of logisticFit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
- probability
- Probability of the test data being in a class.
Example
Usage of logisticpredict
data = dlmread('banknote_authentication.txt', ',');
X = data(:, 1:2);
y = data(:, end);
parameters = logisticfit(X, y);
[predictions, prob] = logisticpredict(parameters, X);
> prob
prob = [Matrix] 1372 x 2
0.99613 0.00387
0.99840 0.00160
0.93926 0.06074
0.99632 0.00368
…
> predictions'
ans = [Matrix] 1372 x 1
0
0
0
1
…