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.
Type: struct
X
Test data.
Type: double
Dimension: vector | matrix

Outputs

predictions
Predictions for the test data.
Type: double
Dimension: vector | matrix
probability
Probability of the test data being in a class.
Type: double
Dimension: matrix

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
…