Data is available only upon formal request and subject to approval.
Approved users receive a secure institute account and work with the data exclusively in our Trusted Research Environment (TRE) via remote desktop.
Request this datasetHintergrund:
Die Prävalenz von Übergewicht und Adipositas im Kindes- und Jugendalter ist weltweit besorgniserregend. Frühere Studien, darunter auch die PEACHES-Kohorte, zeigen, dass Kinder adipöser Mütter ein signifikant erhöhtes Risiko für die Entwicklung von Übergewicht haben. Der Einfluss mütterlicher Stoffwechselparameter und des Lebensstils auf die spätere kindliche Gesundheit ist jedoch noch nicht abschließend verstanden.
Fragestellung:
Ziel meines Forschungsvorhabens ist es, zu analysieren, welche pränatalen und frühkindlichen Faktoren (u.a. mütterlicher BMI, HbA1c, Rauchen, Ernährung und sozioökonomischer Status) in der PEACHES-Kohorte am stärksten mit der Entwicklung von Adipositas und gestörtem Glukosestoffwechsel bei Kindern assoziiert sind.
Methodik:
Ich plane eine multivariate Analyse, um den Einfluss mütterlicher Biomarker (insb. HbA1c), frühkindlicher Anthropometrie sowie Lebensstilfaktoren auf das Übergewichtsrisiko und metabolische Outcomes im Kindesalter (bis 5 Jahre) zu untersuchen. Zusätzlich sollen mögliche protektive Effekte gezielter Ernährungsberatung evaluiert werden.
Erwarteter Mehrwert:
Die Ergebnisse können helfen, frühe Prädiktoren für kindliche Adipositas besser zu identifizieren und zielgerichtete Präventionsstrategien für Hochrisikokinder zu entwickeln.
Datenschutz:
Die Daten werden ausschließlich pseudonymisiert verarbeitet und nicht an Dritte weitergegeben
id_gravido
ssw1_gravido
gew1_gravido
ssw2_gravido
gew2_gravido
ssw3_gravido
gew3_gravido
id_bd_ss
ssw1_bd_ss
bdsys1_bd_ss
bddia1_bd_ss
ssw2_bd_ss
bdsys2_bd_ss
id_mp
geb_art_mp
gew_vor_ss_mp
gew1_mp
ssw1_mp
gew_letztes_mp
id_fb0
a1_fb0
a2_fb0
bem_a2_fb0
a3_fb0
bem_a3_fb0
a4_fb0
#Python
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, classification_report
import os
def create_sample_csv():
"""
Creates a sample CSV file for demonstration purposes.
The data will have some missing values to show preprocessing.
"""
data = {
'age': [25, 30, 35, 40, 45, 50, 55, 60, 65, np.nan, 75, 80],
'salary': [50000, 55000, 60000, 65000, 70000, np.nan, 80000, 85000, 90000, 95000, 100000, 105000],
'purchased': [0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1]
}
df = pd.DataFrame(data)
df.to_csv('sample_data.csv', index=False)
print("Created 'sample_data.csv'")
def run_ml_pipeline():
"""
Main function to run the machine learning pipeline.
"""
# --- 1. Load Data ---
# We assume 'sample_data.csv' is in the same directory.
try:
df = pd.read_csv('sample_data.csv')
print("\n--- Data Loaded Successfully ---")
print("Original Data Head:")
print(df.head())
except FileNotFoundError:
print("Error: 'sample_data.csv' not found. Please create it first.")
return
# --- 2. Data Preparation ---
print("\n--- Data Preparation ---")
# Handle missing values by filling with the mean of the column
df['age'].fillna(df['age'].mean(), inplace=True)
df['salary'].fillna(df['salary'].mean(), inplace=True)
print("\nData after handling missing values:")
print(df.info())
# Define features (X) and the target (y)
# X contains the independent variables (features) used for prediction.
# y contains the dependent variable (target) that we want to predict.
X = df[['age', 'salary']]
y = df['purchased']
# --- 3. Split Data into Training and Testing sets ---
# We split the data to train the model on one subset and test it on another.
# test_size=0.25 means 25% of the data will be used for testing.
# random_state ensures the split is the same every time we run the code.
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
print(f"\nData split into {len(X_train)} training samples and {len(X_test)} testing samples.")
# --- 4. Feature Scaling ---
# It's important to scale features so that all of them are on a similar scale.
# This helps the logistic regression model converge faster and perform better.
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)
print("\nFeatures have been scaled.")
# --- 5. Train the Machine Learning Model ---
# We will use Logistic Regression, a simple and effective model for binary classification.
print("\n--- Model Training ---")
model = LogisticRegression()
model.fit(X_train_scaled, y_train)
print("Model training complete.")
# --- 6. Make Predictions ---
print("\n--- Prediction ---")
y_pred = model.predict(X_test_scaled)
print("Predictions made on the test set.")
# You can uncomment the line below to see the predictions vs actual values
# print(f"Predictions: {y_pred}, Actual: {y_test.values}")
# --- 7. Evaluate the Model ---
print("\n--- Model Evaluation ---")
accuracy = accuracy_score(y_test, y_pred)
print(f"Model Accuracy: {accuracy:.2f}")
print("\nClassification Report:")
# The classification report gives us precision, recall, and f1-score.
# Precision: Out of all positive predictions, how many were actually positive.
# Recall: Out of all actual positive cases, how many did the model predict correctly.
print(classification_report(y_test, y_pred))
def cleanup():
"""Removes the generated CSV file."""
if os.path.exists('sample_data.csv'):
os.remove('sample_data.csv')
print("\nCleaned up 'sample_data.csv'")
if __name__ == '__main__':
create_sample_csv()
run_ml_pipeline()
cleanup()