Initialize the weights, evaluate the feature matrix and repeat gradient descent updates until the loss or gradient stabilizes. If includes the intercept, then
A positive step size chosen by a convergence rule or line search gives a practical optimization algorithm. Mini-batch updates or a Newton-type method are alternatives. Fit feature scaling, choose regularization and choose any nonstandard threshold using training or validation data, then freeze the procedure before using the held-out test set.
For held-out examples, set , with unless selected otherwise. The requested classification accuracy is
Always predicting the majority class already gives about 90% accuracy. Report a confusion matrix, classification recall and classification precision as well, especially for the minority class. A precision-recall curve shows the threshold tradeoff without confusing high majority-class accuracy with successful minority-class detection. No numerical test accuracy can be calculated without the held-out predictions and labels.
Precision and recall Created 2026-10-20 Updated 2026-11-05
For a binary classifier, classification precision is , the fraction of predicted positives that are correct, while classification recall is , the fraction of actual positives recovered. If a search returns ten items, six relevant, from a collection containing fifteen relevant items, precision is and recall is . Raising a decision threshold often trades recall for precision, traced by a precision-recall curve, but precision need not improve at every threshold. Zero denominators require an explicit reporting convention. Both measures depend on which class is called positive; precision also depends strongly on prevalence.