Instructions to use abir71/maternal-fetal-risk-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use abir71/maternal-fetal-risk-models with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("abir71/maternal-fetal-risk-models", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Maternal and fetal health risk level classifiers (research models)
Research use only, not a medical device. These models must not be used for diagnosis, treatment or any clinical decision. They were trained on 100 patient records and are wrong about one time in four.
These models accompany the paper "Artificial Intelligence and Neural Network Based Maternal and Fetal Health Risk Level Prediction and Sensitivity Analysis During Pregnancy" (Z. Tanzim, M. A. R. Khan, I. Ahammad, A. Hosen, M. M. Rahman, M. T. Tazwar, N. Jahan; Cloud Computing and Data Science 7(2), 2026, doi:10.37256/ccds.7220269481).
Each model assigns a pregnancy record to low, mid or high risk from 19 clinical measurements.
- Interactive demo: https://huggingface.co/spaces/abir71/maternal-fetal-risk-demo
Models
| File | Model | Settings |
|---|---|---|
random_forest.joblib |
Random forest | 100 trees, at least 3 records per leaf |
decision_tree.joblib |
Decision tree (for explanation) | depth 3, at least 3 records per leaf |
Each file is a scikit-learn Pipeline that first fills a missing value with the training median and then applies the
classifier. metadata.json lists the features, the medians, the settings and the cross-validation results of every
candidate model. Requires scikit-learn 1.9.1.
Inputs
Nineteen features, in this order:
| Feature | Meaning | Unit / coding |
|---|---|---|
Age |
age | years |
bp_sys, bp_dias |
systolic / diastolic blood pressure | mm Hg |
fever |
fever, cough or cold | 0 = no, 1 = yes |
temp_fah, temp_cel |
body temperature | °F, °C |
MHR |
maternal heart rate | bpm |
FM_2h |
fetal movements in 2 hours | count |
obesity |
obese | 0 = no, 1 = yes |
BMI |
body mass index | kg/m² |
random_BG, fasting_BG |
2-hour and fasting blood glucose | mmol/L |
HbA1C_BG |
HbA1c | as recorded |
HBsAg |
hepatitis B surface antigen | 0 = negative, 1 = positive |
TSH |
thyroid-stimulating hormone | mIU/L |
ALT |
ALT / SGPT | U/L |
uric_acid |
serum uric acid | as recorded |
FHR |
fetal heart rate | bpm |
amniotic_fluid |
amniotic fluid index | cm |
Output classes: 0 = low risk, 1 = mid risk, 2 = high risk.
Usage
import joblib, pandas as pd
from huggingface_hub import hf_hub_download
model = joblib.load(hf_hub_download("abir71/maternal-fetal-risk-models", "random_forest.joblib"))
x = pd.DataFrame([{"Age": 28, "bp_sys": 140, "bp_dias": 90, "fever": 0, "temp_fah": 98.6, "temp_cel": 37.0,
"MHR": 88, "FM_2h": 10, "obesity": 0, "BMI": 24.0, "random_BG": 7.5, "fasting_BG": 5.5,
"HbA1C_BG": 35, "HBsAg": 0, "TSH": 2.1, "ALT": 25, "uric_acid": 250, "FHR": 150,
"amniotic_fluid": 12}])
print(model.predict_proba(x)) # [[p_low, p_mid, p_high]]
Evaluation
The study's data file has 930 rows but only 100 unique patient records: 86 records appear 10 times, 7 appear 9 times and 7 appear once. With a random 67/33 split, 305 of the 307 test rows have an identical copy in the training set, which is why the paper reports 100 % accuracy for several models. These models were therefore trained and evaluated on the 100 unique records only, with repeated stratified 5-fold cross-validation (20 repeats; median imputation fitted inside each training fold).
| Model | Accuracy | Macro F1 | Recall: low | Recall: mid | Recall: high |
|---|---|---|---|---|---|
| Random forest | 75.6 % ± 8.2 | 74.3 % | 94 % | 60 % | 69 % |
| Decision tree (depth 3) | 63.0 % ± 10.2 | 61.1 % | 76 % | 51 % | 60 % |
The final models were then fitted on all 100 records. Class counts: low 37, mid 30, high 33.
Limitations
- Small, local sample. Only 100 records from five hospitals in one district (Noakhali, Bangladesh), collected over three months (January–March 2024). Results may not transfer to other hospitals or populations.
- Imitated labels, not outcomes. The risk labels were assigned by clinical threshold rules with clinician review. The models learn to imitate this labelling, not to predict real pregnancy outcomes.
- Mid risk is the hardest class. Its recall is about 60 %.
- Mixed units. Some laboratory values (HbA1c, uric acid) use mixed units in the source records.
- Wide uncertainty. The accuracy estimates vary by about ±8–10 percentage points between folds.
Data and ethics
The data were collected with ethical approval from the Institutional Review Committee of Noakhali Science and Technology University (NSTU-IRC-2024-01) and with informed consent, and were anonymised before analysis. The patient data are not published here; they are available from the corresponding author (ashik@nstu.edu.bd) on reasonable request. To limit how much any single patient influences the models, every leaf holds at least 3 training records.
Citation
Tanzim Z, Khan MAR, Ahammad I, Hosen A, Rahman MM, Tazwar MT, Jahan N. Artificial intelligence and neural network based maternal and fetal health risk level prediction and sensitivity analysis during pregnancy. Cloud Computing and Data Science. 2026;7(2). doi:10.37256/ccds.7220269481
- Downloads last month
- -