---
title: "Discussion on \"Why 88% Accuracy Wasn’t Good Enough: Building an End-to-End Machine Learning Pipeline for 30-Day Diabetes Readmission Prediction\" | Hashnode"
description: "Discussion on \"Why 88% Accuracy Wasn’t Good Enough: Building an End-to-End Machine Learning Pipeline for 30-Day Diabetes Readmission Prediction\". From class imbalance and model tuning to PySpark distributed learning, K-Means subgroup discovery, and global-vs-local classification."
url: "https://hashnode.com/posts/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission/6ac449437351aaee0d33bbe3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why 88% Accuracy Wasn’t Good Enough: Building an End-to-End Machine Learning Pipeline for 30-Day Diabetes Readmission Prediction](https://sayankhan.hashnode.dev/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission?utm_source=hashnode&utm_medium=feed)

From class imbalance and model tuning to PySpark distributed learning, K-Means subgroup discovery, and global-vs-local classification.

Oct 6 · 21 min read · sayankhan.hashnode.dev  
Read the article

-   [#machine-learning](https://hashnode.com/tag/machine-learning)
-   [#data-science](https://hashnode.com/tag/data-science)
-   [#python](https://hashnode.com/tag/python)
-   [#pyspark](https://hashnode.com/tag/pyspark)
-   [#healthcare](https://hashnode.com/tag/healthcare)

## Written by

[Sayan Khan](https://hashnode.com/@sayan313)

@sayan313 · London, UK

  
[View profile](https://hashnode.com/@sayan313)

## Responses 4

Markdown supported · ⌘↵ to post

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Oct 6](https://hashnode.com/posts/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission/6ac449437351aaee0d33bbe3/comment/6ac54dbb9505d828f19fcb31)

The Dummy Classifier scoring 88.66% accuracy with zero recall shows the accuracy trap in one row. After rebalancing I check calibration before picking a cutoff, since the probabilities stop matching the 11% base rate. Did you sweep the decision threshold on a validation split?

[Sayan Khan](https://hashnode.com/@sayan313)

[Oct 6](https://hashnode.com/posts/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission/6ac449437351aaee0d33bbe3/comment/6ac54dbb9505d828f19fcb31#reply-6ac583c78b956286cbb02f15)

Thanks for the suggestion — that’s a really useful point. I didn’t do an explicit threshold sweep in this iteration. I focused on stratified validation, training-only undersampling, and comparing tuned models using recall, F1 and ROC-AUC. Your point about calibration after rebalancing is important, and threshold tuning on a validation set would be a strong next step. My background is mainly in full-stack development, so this project pushed me into ML and taught me a lot about imbalance, evaluation, tuning and model validation.

[indiainfranotes](https://hashnode.com/@indiainfranotes)

[Oct 6](https://hashnode.com/posts/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission/6ac449437351aaee0d33bbe3/comment/6ac474ba0b92d34d45dba1b3)

88% accuracy on an imbalanced readmission set is a majority-class score, not a useful decision rule. If almost all encounters are not readmitted, a model that always says no already clears that bar. Which metric did you use once the classes were split: precision on the rare class, or overall accuracy?

[Sayan Khan](https://hashnode.com/@sayan313)

[Oct 6](https://hashnode.com/posts/why-88-percent-accuracy-wasnt-good-enough-diabetes-readmission/6ac449437351aaee0d33bbe3/comment/6ac474ba0b92d34d45dba1b3#reply-6ac4775aff56ddc2c7aee4e8)

I did not use overall accuracy as the main metric after identifying the imbalance. I evaluated the positive 30-day readmission class primarily using recall and F1 score, while also reporting precision and ROC-AUC. Precision alone was not the deciding metric either. I applied random undersampling only to the training set and kept the test set at its original distribution. The tuned Random Forest + RUS achieved 17.10% precision, 63.06% recall, 26.90% F1, and 65.90% ROC-AUC. My background is primarily in full-stack development, so this project was also my way of stepping outside my usual stack and understanding the ML workflow through implementation as deeply as I could — from preprocessing and class imbalance handling to model evaluation, PySpark, and clustering. The main shift for me was from asking “how high is the accuracy?” to “is the model actually detecting the minority-class cases that matter?”
