Analysis #10

diabetes.csv · 768 rows × 9 columns

Classify patients into risk categories.

classification target: Outcome metric: F1 6 models evaluated reasoning: built-in analyst

Objective partially fulfilled

The objective was partially met. F1 of 0.7462 is usable but leaves real room to improve. Success criterion: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.

  • Predictive quality
    F1 of 0.7462 is usable but leaves real room to improve.
  • Beats the naive baseline
    The trivial baseline scores 0.5113 and the chosen model scores 0.7462 - an improvement of 0.2349.
  • Catches the minority class
    It correctly identifies 63.0% of the '1' cases, which is the class the objective cares about.
  • Stable across folds
    5-fold cross-validation gives 0.6956 (± 0.0417) against a test score of 0.7462, so the result is consistent.
Best model
Decision Tree Classifier
of 6 that trained
F1
0.7462
baseline 0.511
Data quality
100/100
before cleaning
Features used
17
14 engineered, 5 removed

Dataset overview

Rows768
Columns9
Numeric columns9
Categorical columns0
Date columns0
Duplicate rows0
Missing cells0 (0.0%)
Size in memory0.05 MB
Distribution of the target variable

Columns the agent found

first 25 shown
ColumnDetected asTypeMissing UniqueExamples
Pregnancies numeric int64 0.0% 17 6, 1, 8
Glucose numeric int64 0.0% 136 148, 85, 183
BloodPressure numeric int64 0.0% 47 72, 66, 64
SkinThickness numeric int64 0.0% 51 35, 29, 0
Insulin numeric int64 0.0% 186 0, 94, 168
BMI numeric float64 0.0% 248 33.6, 26.6, 23.3
DiabetesPedigreeFunction numeric float64 0.0% 517 0.627, 0.351, 0.672
Age numeric int64 0.0% 52 50, 31, 32
Outcome binary int64 0.0% 2 1, 0

Data quality

score 100/100
  • none No significant data quality problems detected.

Cleaning summary

0 action(s) taken

Before cleaning

Rows768
Columns9
Missing cells0
Duplicates0

After cleaning

Rows768
Columns9
Missing cells0
Duplicates0

What was done

  • Nothing needed fixing — the file was already clean.
Remaining missing values are imputed inside the modelling pipeline (numeric columns with the median, categorical columns with the most frequent value). The imputers are fitted on the training split only, so no information from the test set leaks into training.

Problem framing and features

split before engineering, so nothing leaks
Problem type and target
Problem typeclassification
Target columnOutcome
Confidence85%
MetricF1
Training rows614
Test rows154

The target has exactly two distinct values, so this is binary classification.

Using F1 as recommended by the AI analyst for this objective.

Stratified 80/20 split with random_state=42, so both splits keep the same class balance.

Features kept
PregnanciesGlucoseBloodPressureSkinThicknessBMIAgeInsulin_logDiabetesPedigreeFunction_logGlucose_per_BMIGlucose_per_AgeGlucose_per_InsulinBMI_per_AgeBMI_per_InsulinAge_per_InsulinGlucose_minus_AgeBMI_minus_AgeBMI_minus_Insulin

Strongest signal against the target

Glucose1.0
Glucose_minus_Age0.9854
BMI_minus_Insulin0.8431
BMI0.6856
BMI_minus_Age0.3467
Insulin_log0.3466

Engineered features

14
FeatureTypeWhy
Insulin_loglog transform Insulin is right-skewed (skew 2.03); a log transform pulls in the long tail so linear models are not dominated by outliers.
DiabetesPedigreeFunction_loglog transform DiabetesPedigreeFunction is right-skewed (skew 1.82); a log transform pulls in the long tail so linear models are not dominated by outliers.
Glucose_per_BMIratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
Glucose_minus_BMIdifference Gap between Glucose and BMI; differences often matter more than either value alone.
Glucose_per_Ageratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
Glucose_minus_Agedifference Gap between Glucose and Age; differences often matter more than either value alone.
Glucose_per_Insulinratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
Glucose_minus_Insulindifference Gap between Glucose and Insulin; differences often matter more than either value alone.
BMI_per_Ageratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
BMI_minus_Agedifference Gap between BMI and Age; differences often matter more than either value alone.
BMI_per_Insulinratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
BMI_minus_Insulindifference Gap between BMI and Insulin; differences often matter more than either value alone.
Age_per_Insulinratio Ratio of two of the most informative numeric columns. Ratios capture relative size, which raw values on their own cannot.
Age_minus_Insulindifference Gap between Age and Insulin; differences often matter more than either value alone.

Removed features

5
FeatureReason
DiabetesPedigreeFunctionCorrelated 0.988 with DiabetesPedigreeFunction_log, which carries the same information and scores higher against the target.
Glucose_minus_BMICorrelated 0.969 with Glucose, which carries the same information and scores higher against the target.
InsulinCorrelated 0.956 with Glucose_minus_Insulin, which carries the same information and scores higher against the target.
Glucose_minus_InsulinCorrelated 0.957 with BMI_minus_Insulin, which carries the same information and scores higher against the target.
Age_minus_InsulinCorrelated 0.992 with BMI_minus_Insulin, which carries the same information and scores higher against the target.

Models trained and compared

ranked on F1, not on accuracy by default
Model comparison
How the shortlist was chosen

The AI layer suggested model names; the agent resolved each one against a fixed library of hand-written models and refused anything that did not fit.

Logistic RegressionDecision Tree ClassifierRandom Forest ClassifierExtra Trees ClassifierK-Nearest Neighbors ClassifierBaseline (Most Frequent Class)
ModelAccuracyPrecision RecallF1ROC-AUC Time (s)
Logistic Regression 0.7143 0.7065 0.7143 0.7084 0.8369 0.051
Decision Tree Classifier best 0.7468 0.7457 0.7468 0.7462 0.7911 0.03
Random Forest Classifier 0.7208 0.7140 0.7208 0.7158 0.8154 0.582
Extra Trees Classifier 0.7338 0.7275 0.7338 0.7290 0.8072 0.352
K-Nearest Neighbors Classifier 0.7078 0.7005 0.7078 0.7026 0.7244 0.033
Baseline (Most Frequent Class) baseline 0.6494 0.4217 0.6494 0.5113 0.5000 0.022

The selected model

Decision Tree Classifier

F1 0.7462

Decision Tree Classifier achieved the best F1 of 0.7462, ahead of Extra Trees Classifier (0.7290) by 0.0172. F1 was chosen because it matches what the objective is asking for.

Captures non-linear rules and is easy to explain to a non-technical audience.

Accuracy 0.7468
Precision 0.7457
Recall 0.7468
F1 0.7462
Roc Auc 0.7911
Naive baseline 0.5113
5-fold cross-validation 0.6956 ± 0.0417
Confusion matrix

Performance on each class

a high overall score can still hide a class the model never finds
ClassRows in test set Correctly identifiedHow well it is caught
0 100 81.0%
1 54 63.0%

What drives the predictions

Impurity-based importance
Feature importance

How much each feature reduced prediction error across all the splits in the trees. Higher means the model relied on it more.

#FeatureShare
1Glucose 35.21%
2BMI 13.8%
3Glucose_per_Age 7.17%
4BloodPressure 6.45%
5Age 6.41%
6Glucose_minus_Age 5.15%
7BMI_minus_Age 5.08%
8Pregnancies 4.51%
9DiabetesPedigreeFunction_log 4.47%
10Glucose_per_BMI 3.4%

Insights and next steps

Key insights
  • The winning model's decisions are driven mainly by Glucose (35%), BMI (14%), Glucose_per_Age (7%).
  • The objective was partially met. F1 of 0.7462 is usable but leaves real room to improve. Success criterion: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.
Recommended next steps
  1. Collect more data. 768 rows is a small sample, and the score above could move considerably on a larger one.
  2. Try adjusting the decision threshold rather than the model. Moving it away from 0.5 trades precision for recall and often fixes a model that is accurate but never flags the class you care about.
  3. If the classes are imbalanced, resampling the training data or class weighting is usually a bigger win than switching algorithms.
  4. Tune Decision Tree Classifier with a grid or randomised search. This run used sensible defaults with no hyperparameter search, so there is headroom left.
  5. Review the 5 removed feature(s) with a domain expert. Automated selection is statistical; it does not know which columns matter to the business.
  6. Before deploying, re-test on data from a later time period than the training data. A random split cannot tell you whether the pattern holds next quarter.
The built-in analyst's reasoning

'Outcome' scored highest as a target candidate because column name is exactly 'outcome'; last column in the file; two distinct values (binary outcome). The objective wording suggests a classification task. Identifier and constant columns were excluded because they cannot generalise. This recommendation was produced by the built-in rule-based analyst rather than Gemini.

Success criterion it set: A model that clearly beats the naive baseline on F1 and behaves sensibly on the outcome the objective cares about.

Caveats from this run
  • Gemini was not used for this run: google-genai package is not installed.
Correlation between numeric columns

The written report goes further than this dashboard

Executive summary, every decision explained, the full metric tables, limitations and recommended next steps — written for technical and non-technical readers at once.

Open the full report