Logistic Regression Calculator in Machine Learning

Build, test, and understand logistic regression models with dynamic predictors, CSV training, probability charts, threshold analysis, diagnostics, and exportable evaluation results for practical learning.

Current result

Ready for a prediction

Enter coefficients and feature values, then calculate a probability.

Waiting
Probability
Predicted class
Logit
Odds

Manual Probability Calculator

Calculate the logit, probability, odds, class, and each feature contribution.

0.000.501.00

Predictor Features

Prediction Breakdown

Linear score z
Probability
Odds
Threshold margin
TermValueCoefficientContributionDirection
No calculation yet.
z = β₀ + β₁x₁ + ...

Sigmoid Probability Curve

The selected observation is placed on the logistic curve using its current linear score.

Calculation History

Saved locally in this browser.

TimeProbabilityClassLogitAction
No saved calculations.

Train a Binary Logistic Regression Model

Paste CSV data or upload a file. The target must contain two distinct values.

Rows: 0
Columns: 0
Missing cells: 0
Preview your dataset to configure training.

Training Options

Preview data first.

Model Evaluation

Train a model to view evaluation results.

Not trained
Accuracy
Precision
Recall
F1 score
Specificity
ROC-AUC
Log loss
Brier score

Confusion Matrix

Predicted positive
Predicted negative
Actual positive

True positive

False negative
Actual negative

False positive

True negative

Fit Statistics

No model statistics.

Detailed Classification Metrics

MetricValueInterpretation
No detailed metrics.

Coefficient Estimates

FeatureCoefficientStd. errorZP-valueOdds ratio95% CIDirection
No fitted coefficients.

Diagnostics

Diagnostics appear after training.

Cross-Validation Summary

FoldAccuracyPrecisionRecallF1AUC
No cross-validation results.

Model Visualisations

ROC Curve

Precision–Recall Curve

Calibration Curve

Metric by Threshold

Coefficient Importance

Predicted Probability Distribution

Batch Prediction

Use the latest trained model. The first row must contain feature names matching the trained predictors.

Batch Results

No batch predictions.

One-Predictor Coefficient Explorer

Change the intercept and coefficient to reverse, flatten, or steepen the logistic curve.

Selected probability
Selected class
Decision boundary x
Odds ratio per unit

Formula Used

z = β₀ + β₁x₁ + β₂x₂ + ... + βₙxₙ
P(Y = 1 | x) = 1 / (1 + e−z)
Odds = P / (1 − P)
Odds ratio for βⱼ = eβⱼ

Logistic regression converts a linear score into a probability. The sigmoid function keeps that probability between zero and one. A threshold changes the probability into a class label.

How to Use

  1. Choose manual prediction, model training, batch prediction, or coefficient exploration.
  2. Enter coefficients and feature values, or paste a binary-labelled CSV dataset.
  3. Set a decision threshold, regularisation method, and other training options.
  4. Calculate or train the model, then review probabilities, coefficients, metrics, and diagnostics.
  5. Copy results, export CSV files, or print the report as a PDF.

Worked Example

PredictorValueCoefficientContribution
Intercept1−2.5−2.5
Study hours60.653.9
Attendance rate0.821.81.476

The linear score is 2.876. Its sigmoid probability is approximately 0.9467. At a 0.50 threshold, the positive class is predicted.

Assumptions and Limitations

Frequently Asked Questions

What does logistic regression predict?

It predicts a probability for a binary outcome. The probability can then be converted into a class using a threshold.

Why is the sigmoid function used?

The sigmoid maps any real-valued logit into the zero-to-one range. This makes the result interpretable as a probability.

What does a positive coefficient mean?

A positive coefficient increases the log odds as that feature rises. Its odds ratio is greater than one.

What does an odds ratio below one mean?

It means higher feature values reduce the estimated odds of the positive class, holding other predictors constant.

Should every model use a 0.50 threshold?

No. The threshold should reflect class balance, business costs, safety needs, and acceptable false-positive or false-negative rates.

What is regularisation?

Regularisation penalises large coefficients. It can reduce overfitting and improve stability when predictors are numerous or correlated.

What is ROC-AUC?

ROC-AUC measures ranking performance across many thresholds. A value near one indicates stronger class separation.

Why can training fail to converge?

Causes include extreme scaling, perfect separation, unsuitable learning rates, excessive regularisation, or insufficient iterations.

Can this replace a statistical package?

It is suitable for learning, exploration, and moderate datasets. High-stakes analysis should be verified with established statistical software.

Generated: 2026-08-10 15:34:30

All calculations run in your browser. Uploaded datasets are not sent to a server by this page.

Related Calculators

Linear Regression CalculatorPolynomial Regression CalculatorRidge Regression CalculatorLasso Regression CalculatorElastic Net Regression CalculatorRegression Coefficient CalculatorRegression Prediction CalculatorResidual Error CalculatorMean Squared Error CalculatorMean Absolute Error Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.