Skip to content
Learning

Obesity risk prediction using machine learning models

Classifying recorded obesity levels

This research example classifies seven recorded weight-status categories from anthropometric and lifestyle variables. It evaluates multiclass errors rather than treating class codes as a continuous regression target.

2,111Source records
20Final input features
422Test observations
0.856Test macro F1

1. Clinical question and intended use

The research question is whether recorded lifestyle and physical characteristics distinguish seven obesity levels. Since height and weight are inputs, this is a classification of current recorded status.

Seven categories

Inspect the complete class-specific confusion matrix.

Recorded measurements

Height and weight help define the classification context.

Research scope

Synthetic records and internal testing limit generalization claims.

Health-data researchPublic healthModel evaluation
Research and planning demonstration. It does not establish clinical validity, diagnosis, treatment or donor eligibility.

2. Cohort, measurements and endpoint

The UCI dataset contains 2,111 records associated with Colombia, Peru and Mexico. The repository states that 77% were generated synthetically and 23% were collected through a web platform. Height and weight are inputs, so this is classification of recorded status rather than prediction of a future health outcome.

The downloadable project, saved report and supplied source CSV define the exact version used here. Repository: original dataset/source record.

SubsetRecords
Training1267
Validation / selection422
Testing422
Unused0
VariableRoleTypeEncodingUnit
genderInputBinaryFemale; MaleAs supplied
ageInputNumericyears
heightInputNumericm
weightInputNumerickg
family_history_with_overweightInputBinaryno; yesAs supplied
caloric_foodInputBinaryno; yesAs supplied
vegetablesInputNumericAs supplied
number_mealsInputNumericAs supplied
food_between_mealsInputNumericAs supplied
smokeInputBinaryno; yesAs supplied
waterInputNumericAs supplied
caloriesInputBinaryno; yesAs supplied
activityInputNumericAs supplied
technologyInputNumericAs supplied
alcoholInputNumericAs supplied
transportationInputCategoricalautomobile; bike; motorbike; public_transportation; walkingAs supplied
obesity_levelTargetCategoricalNormal_weight; Obese_I; Obese_II; Obese_III; Overweight_I; Overweight_II; UnderweightAs supplied

Interactive chart: obesity_level distribution pie chart. Enable JavaScript to explore it.

obesity_level distribution pie chart. Exported with Neural Designer from the saved task report.

Interactive chart: obesity_level Pearson correlations chart. Enable JavaScript to explore it.

obesity_level Pearson correlations chart. Exported with Neural Designer from the saved task report.
The downloadable project, saved report and supplied source CSV define the exact version used here. Repository: original dataset/source record. This is internal validation using the saved record-level split. Grouped or temporal independence has not been established.

3. Model

The final model has 20 encoded input features and 7 outputs. The following dimensions describe the final saved network.

LayerInput shapeOutput shapeActivation
Scaling2020—
Dense203Tanh
Dense37Softmax

Output semantics: one score per class in this order: Normal_weight, Obese_I, Obese_II, Obese_III, Overweight_I, Overweight_II, Underweight. The predicted label is the largest score. Calibration has not been evaluated, so scores are not presented as calibrated probabilities.

Classifying recorded obesity levels: initial Neural Designer architecture
Architecture used for this model; no architecture-selection experiment is recorded. Diagram labels show original variables; categorical expansion and the numeric layer dimensions are documented in the model table.

4. Training strategy

The saved training configuration uses CrossEntropy with QuasiNewton. Training minimizes the recorded objective; the validation subset monitors generalization during fitting. The testing subset is used for the evaluation below.

Interactive chart: Quasi-Newton method error history. Enable JavaScript to explore it.

Quasi-Newton method error history. Exported with Neural Designer from the saved task report.

Quasi-Newton method results

MeasureValue
Epochs number185
Elapsed time00:00:00
Stopping criterionMaximum validation error increases
Training error0.336
Validation error0.343

5. Model selection and baseline

No model selection experiment is recorded in this supplied project. The displayed architecture is the trained model used for testing; earlier article claims about a different selected architecture do not apply to this version.

A transparent test-set comparator is the majority-class rule, with accuracy 17.8%. This is a baseline for interpretation, not an alternative model fitted on the test labels.

6. Clinical validation

The final classifier is evaluated on 422 testing records. The confusion counts below were reproduced from the saved model. Rows are actual classes and columns are predicted classes. The multiclass decision is argmax; no binary threshold is applied.

Test class prevalence is shown by the support counts. Accuracy is 87.4% and macro F1 is 0.856. A multiclass ROC AUC was not reported; the confusion matrix and per-class measures are the available evidence.

Actual / predictedNormal_weightObese_IObese_IIObese_IIIOverweight_IOverweight_IIUnderweightTotal
Normal_weight28000302152
Obese_I0713001075
Obese_II0171000072
Obese_III0006400064
Overweight_I7100417056
Overweight_II0100745053
Underweight1000004950
ClassTest casesSensitivity / recallSpecificityPrecision / PPVF1
Normal_weight5253.8%97.8%77.8%0.636
Obese_I7594.7%99.1%95.9%0.953
Obese_II7298.6%99.1%95.9%0.973
Obese_III64100.0%100.0%100.0%1
Overweight_I5673.2%97.3%80.4%0.766
Overweight_II5384.9%97.8%84.9%0.849
Underweight5098.0%94.4%70.0%0.817
This is internal record-level evidence. Discrimination does not establish calibration, clinical utility or benefit to patients.

7. Workflow and reproducibility

Validated inputs → saved preprocessing → neural network → score or estimate → domain review. The ZIP contains the original project, source CSV, schema, test metrics and standalone interactive chart exports. The project hash in the schema identifies this exact version.

Explore the exported model

This research demonstration runs locally in your browser. Values outside the training range are outside the validated domain and are rejected. A valid input range does not guarantee that a combination is physically or operationally plausible.

This is not a diagnosis and must not guide medical treatment or donor eligibility.

8. Safety, generalizability and governance

Synthetic records and related anthropometric predictors limit interpretation of the internal split. Compare with a transparent BMI-based classification, separate original from synthetic subjects, and obtain external validation. Scores are not calibrated probabilities and must not guide individual diagnosis or treatment; clinician or specialist review is required for medical use.

No external validation or independent calibration study is included. Preprocessing statistics and model choices should be refitted within a prospective or grouped validation design. Correlations and directional responses describe associations, not causes. Human review is required before an operational decision.

Confidence intervals, subgroup performance, calibration curves and decision-cost validation are not established by these tasks. Predictive values apply to the observed test class distribution and may change when prevalence shifts.

Expert review and separate external validation are required before any medical use.

References