Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions plots/logistic-regression/specification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# logistic-regression: Logistic Regression Curve Plot

## Description

A logistic regression visualization showing the characteristic S-shaped (sigmoid) probability curve for binary classification. The plot displays data points colored by their binary class, the fitted logistic curve representing predicted probabilities, confidence intervals around the curve, and an optional decision threshold line. This visualization is essential for understanding how a logistic model maps continuous input features to class probabilities.

## Applications

- Visualizing credit risk scoring models where the probability of default varies with income or credit score
- Analyzing medical diagnostic thresholds where probability of disease changes with biomarker levels
- Understanding marketing conversion rates as a function of customer engagement metrics or ad spend
- Demonstrating the decision boundary in binary classification problems for educational purposes

## Data

- `x` (numeric) - Continuous independent variable (predictor/feature) plotted on the horizontal axis
- `y` (binary) - Binary outcome variable (0 or 1) plotted as data points
- `probability` (numeric) - Predicted probability from the logistic model (0 to 1) for the fitted curve
- Size: 50-500 data points recommended for clear visualization of both the curve and underlying data
- Example: Binary classification data where the outcome probability follows a sigmoidal relationship with the predictor

## Notes

- Data points should be jittered slightly on the y-axis (around 0 and 1) for visibility when overlapping
- Use distinct colors for the two classes (e.g., blue for class 0, orange for class 1)
- The logistic curve should be smooth and prominently displayed (solid line, ~2px width)
- Include 95% confidence interval band around the fitted curve with semi-transparent shading
- Add a horizontal dashed line at probability = 0.5 to indicate the default decision threshold
- Label axes clearly: x-axis with the predictor name, y-axis as "Probability" (0 to 1)
- Consider displaying model coefficients or accuracy metrics as annotations
- Points should have moderate transparency (alpha ~0.6) to show density patterns
32 changes: 32 additions & 0 deletions plots/logistic-regression/specification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Specification-level metadata for logistic-regression
# Auto-synced to PostgreSQL on push to main

spec_id: logistic-regression
title: Logistic Regression Curve Plot

# Specification tracking
created: 2026-01-09T21:45:54Z
updated: null
issue: 3550
suggested: MarkusNeusinger

# Classification tags (applies to all library implementations)
# See docs/reference/tagging-system.md for detailed guidelines
tags:
plot_type:
- scatter
- line
- regression
data_type:
- numeric
- categorical
- binary
domain:
- statistics
- machine-learning
- model-evaluation
features:
- regression
- probability
- confidence-interval
- threshold