Discover how MediNet enables researchers to train and validate deep learning models for predicting mortality caused by heart failure while maintaining data privacy across healthcare institutions.
End-to-end deep learning workflow for predicting mortality caused by heart failure
This use case demonstrates how to train a federated learning model for heart failure mortality prediction using MediNet's platform. You'll learn:
MediNet Hub is accessible through a web interface at:
https://medinet-hub.isglobal.org
(Platform is currently in controlled access for research institutions)
Request credentials:
juanr.gonzalez@isglobal.org
ramon.mateo@isglobal.org
ISGlobal - Barcelona Institute for Global Health
Before you begin, familiarize yourself with three essential concepts. We'll explain them visually and simply.
The key principle: Instead of bringing data to the model, we bring the model to the data.
Privacy violation, slow transfers, expensive storage
Data stays at source, privacy preserved
Clinical data is extremely sensitive. Federated learning allows collaboration between hospitals without exchanging actual data, complying with privacy regulations and respecting patient security. This way, you can collaborate with other centers without sharing sensitive information.
To further protect privacy, a small level of mathematical "noise" is added to model updates. This works like reinforced anonymization: it's impossible to identify a specific patient even if someone observes the model updates.
The epsilon (ε) parameter controls how much anonymization is added to protect patient privacy.
Scenario: A hospital wants to publish average doctor salaries without revealing individual salaries.
Without Differential Privacy: If you know all salaries except one, you can calculate the missing one exactly.
With Differential Privacy: Add random noise to the average (e.g., ±$2,000). Now even if you know all other salaries, you cannot determine the exact missing salary—only approximate it within a range.
In federated learning: The same principle applies to model weights. Noise is added so that individual patient contributions cannot be extracted from the trained model.
A neural network works like a set of layers that process information step by step:
They're well-suited for clinical problems because they can learn complex relationships between variables.
What is a neuron? A neuron is the basic processing unit in a neural network. Similar to neurons in the brain, artificial neurons receive inputs (like patient data), process them using mathematical operations, and produce an output. Multiple neurons work together in layers to detect increasingly complex patterns in the data.
Input Layer
Patient features
Hidden Layer 1
64 neurons (ReLU)
Hidden Layer 2
32 neurons (ReLU)
Output Layer
1 neuron (Sigmoid)
Neural networks learn by adjusting connection weights between neurons. During training, the network makes predictions, calculates how wrong they are (loss), and updates weights to improve. This process repeats thousands of times (epochs) until the network learns accurate patterns in the data.
The training process follows a structured workflow from authentication to final model validation:
Let's begin our journey with MediNet. We'll start by accessing the platform and authenticating.
Don't have credentials yet? See how to request access at the beginning of this guide.
This is our essential first step before continuing with the federated learning workflow.
Figure 1: MediNet login screen - enter your credentials to access the platform
In the screenshot above (Figure 1), observe:
✅ After successful login: You'll be redirected to the main dashboard showing "Welcome, [your name]" and navigation menu on the left.
Now that we've successfully logged in and accessed the main dashboard, our next step is to connect to the data node where the clinical records are stored. Remember: in federated learning, the data never leaves its original location.
Understanding the Power of Federated Learning: In a real federated deployment, this type of clinical data exists at multiple hospitals. Instead of centralizing data (privacy violation), MediNet enables collaborative training where the model travels to the data.
Imagine three hospitals collaborating:
Model learns from all 1,900 patients while data never leaves each hospital
This dataset demonstrates a typical healthcare prediction task: binary classification with mixed features. The workflow you'll learn applies to any medical prediction problem: disease diagnosis, treatment response, patient risk stratification, readmission prediction, etc.
Figure 2: Dataset explorer - validate your data is ready for training
In the dataset explorer (Figure 2), you should observe:
✅ Validation check: If you see "Added to training" with a green indicator, the dataset has been properly added on the configuration and you can proceed to model design.
Now that we've selected our dataset, it's time to create the neural network architecture. But first, we need to navigate to Model Studio—MediNet's workspace for managing and designing AI models.
What is Model Studio? This workspace lets you browse existing models, create new architectures, compare model performance, and import pre-trained models. Think of it as your model library and design center.
Once in Model Studio, we'll see the model management interface. Since this is our first model, the workspace will be empty with a message: "No models found - Create your first model to get started."
Ready to design! Clicking "Sequential Model" opens the visual Model Designer where we'll build our architecture layer by layer.
Figure 3a: Model Studio - your workspace for managing AI models
In the Model Studio interface (Figure 3a), observe:
Figure 3b: Model type selection - choosing Sequential Model for our use case
In the model creation dialog (Figure 3b), observe:
✅ Selection confirmed: Click "Sequential Model" to proceed to the visual Model Designer interface.
Now that we've selected and explored our dataset, let's move to the exciting part: designing the neural network architecture. With MediNet's visual Model Designer, we can build sequential models without writing a single line of code.
After building the architecture, we need to configure how the model will learn. In the Model Configuration panel, we set:
Model Configuration Panel: Setting optimizer and loss function
Want to learn more? For detailed explanations about optimizers, loss functions, and other training parameters, see Step 5: Training Parameters Explained. You can also explore other optimizer options in the PyTorch documentation.
The model is now ready to be trained.
Architecture:
Input Layer: Matches dataset features (automatically configured)
Hidden Layer 1: 64 neurons with ReLU activation
Hidden Layer 2: 32 neurons with ReLU activation
Output Layer: 1 neuron with Sigmoid activation (binary classification)
Training Configuration:
Optimizer: Adam (adaptive learning with momentum)
Learning Rate: 0.001
Loss Function: Binary Cross-Entropy with Logits
Click "Add Layers" button to build neural network architecture without coding
Define activation functions, neuron counts, and connections between layers
Click "Save" to store your model - you can modify it later
This architecture demonstrates MediNet's capabilities, not clinical optimization. The simple 64→32 structure is intentionally chosen to show how easy it is to design neural networks visually.
In real research: You would iterate on architecture, try different sizes, add regularization (dropout), experiment with depths—all visually through MediNet's interface without coding.
Figure 4: Visual Model Designer - build your AI architecture with drag-and-drop
In the Model Designer interface (Figure 4), you should observe:
✅ Architecture confirmation: When saved successfully, you'll see "Model architecture saved" with a green checkmark and the model name will appear in your Models list.
With our model architecture defined, we now need to configure how it will learn. This is where we set the training hyperparameters that control the learning process. MediNet provides explanatory tooltips for each parameter as we configure them.
As you configure each parameter, you'll see an explanatory panel that helps you understand its effect.
What it controls: The magnitude of weight updates during training. It determines how aggressively the model adjusts its parameters after seeing each batch of data.
Too Low: The model takes tiny steps towards the optimal solution. Training is very slow, requiring many iterations to converge. May get stuck in local minima.
Just Right: The model efficiently navigates toward the optimal solution with appropriate step sizes. Balances speed and stability.
Too High: The model takes overly large steps, overshooting the optimal solution and bouncing around. Training becomes unstable and may diverge entirely.
Common starting points: Standard learning rates like 0.01 or 0.001 are typically good starting values. These provide a balance between convergence speed and stability for most problems. In practice, you monitor training curves and adjust if the loss oscillates (too high) or converges too slowly (too low).
What it controls: How many complete passes the model makes through the local dataset at each participating hospital in federated learning.
In this use case: We'll use 20 local epochs per federation round.
Trade-off: More epochs allow better local learning, but excessive epochs risk overfitting to local data before global aggregation.
In federated learning: We typically use fewer local epochs (10-20) than centralized training because the model gets updated multiple times through federation rounds.
Recommended range: 10-20 epochs per round for most federated learning tasks
What it controls: The number of times the global model is distributed to participating sites, trained locally, and aggregated back. This is the key parameter that distinguishes federated learning from centralized training.
Round 1:
Round 2:
... continues for N rounds
Total training: 10 rounds × 20 local epochs = 200 total epochs of learning at each site, but with cross-hospital knowledge sharing after every 20 epochs
Trade-offs:
In this use case: We'll configure 10 federation rounds.
What it controls: The mathematical function used to quantify how far the model's predictions are from the true values. The training process minimizes this loss.
In this use case: Binary Cross-Entropy is used because we're predicting a binary outcome (death event: yes/no).
Binary Cross-Entropy: For binary classification (death/survival). Measures the difference between predicted probabilities and actual binary outcomes.
Categorical Cross-Entropy: For multi-class classification (3+ categories). Generalizes binary cross-entropy to multiple classes.
Mean Squared Error (MSE): For regression tasks (predicting continuous values). Penalizes larger errors more heavily than smaller ones.
What it controls: How many samples the model processes before updating its weights. The dataset is divided into batches, and weights are updated after each batch.
Understanding the visualization: The diagram above shows a dataset with 1000 total samples (e.g., 1000 patient records). The batch size determines how these samples are divided for processing.
Batch Size = 1000 (entire dataset): All 1000 samples processed together = 1 iteration per epoch. This is like setting batch size equal to your entire dataset size. Fast computation but only one weight update per epoch, which means very slow learning.
Batch Size = 500 (half dataset): 1000 samples ÷ 500 batch size = 2 iterations per epoch. Two weight updates per epoch provides more learning opportunities while maintaining computational efficiency.
Batch Size = 100 (1/10th dataset): 1000 samples ÷ 100 batch size = 10 iterations per epoch. Many weight updates provide frequent learning opportunities but with noisier gradients. Often leads to better generalization.
Memory Consideration: Larger batches require more GPU/CPU memory. If you encounter out-of-memory errors, reduce the batch size.
Practical tip: Common batch sizes are 16, 32, 64, 128, or 256. The choice depends on your dataset size and available memory. For our heart failure dataset, the batch size was selected to balance training speed, memory constraints, and gradient quality.
What it controls: The optimization algorithm that adjusts the model's weights based on the computed loss. The optimizer determines how the model learns from its mistakes.
In this use case: We use Adam (Adaptive Moment Estimation) because it adapts the learning rate for each parameter automatically and works well across a wide range of problems without extensive tuning.
Adam advantages:
Other available optimizers:
Learn more: For detailed information about these optimizers and their parameters, see the PyTorch documentation:
Adam optimizer
SGD optimizer
RMSprop optimizer
The researcher configured the following parameters for federated training:
Total training computation: 10 rounds × 20 epochs = 200 total local epochs per participating hospital
Note: These parameters may require adjustment based on your specific dataset, computational resources, and model architecture.
Figure 5: Training configuration panel - set your learning parameters with recommended values
In the Training Configuration panel (Figure 5), you should observe:
✅ Configuration ready: When all parameters are set, the "Start Training" button turns green, indicating we can proceed to training execution.
Now comes the moment we've been building toward: launching the federated training process. With our configuration set, we're ready to start training across multiple hospital nodes simultaneously. This is where we witness federated learning in action.
Interpreting the metrics:
Training and validation loss curves
Model prediction accuracy over epochs
Additional performance measurements
Comparison of model accuracy across different batch sizes:
| Configuration | Batch Size | Accuracy | Status |
|---|---|---|---|
| Initial Model | 16 | 53.64% | 📊 Baseline |
| Optimized Model | 32 | 54.30% | ✅ Improved |
⚠️ If your values diverge significantly:
• Loss oscillating wildly? Learning rate may be too high (reduce to 0.0005)
• Validation loss increasing? Possible overfitting (reduce local epochs or add regularization)
• Accuracy stuck below 70%? Model may need more complexity or different architecture
Figure 6: Real-time monitoring dashboard with loss, accuracy, and performance metrics
In the real-time training dashboard (Figure 6), you should observe:
✅ Training complete: When all 10 rounds finish, you'll see "Training completed successfully" with a green checkmark. The final model is automatically saved and ready for evaluation or deployment.
With our first training complete and metrics in hand, we now enter the iterative optimization phase. This is where we refine our model by analyzing results and making informed adjustments to improve performance.
This fine-tuning process is key to improving model quality.
Loss Curve Analysis: If loss decreases steadily and plateaus, training is progressing well. If it oscillates wildly, learning rate may be too high.
Training vs Validation Gap: Large gap indicates overfitting - model memorizes training data but doesn't generalize. Consider reducing epochs or model complexity.
Training Speed: If each epoch takes too long, consider increasing batch size (if memory allows) or simplifying the architecture.
In this example: The researcher analyzes the metrics from initial training and decides to adjust the batch size to optimize convergence behavior.
Why Adjust Parameters? Based on the analysis, the researcher identifies that modifying the batch size could improve training behavior - either speeding up convergence or improving generalization.
Rationale: Adjust the trade-off between training speed and gradient noise. The new value was selected to optimize convergence behavior for this specific dataset size.
Next Step: Launch a new training cycle with the adjusted hyperparameters and compare the resulting metrics against the previous run.
The model is retrained with batch size set to 32. MediNet monitors the training process and generates updated performance metrics.
Figure 7: Performance comparison: initial training vs. optimized training with batch size 32
When we're satisfied with the performance after our optimization iterations, we perform final validation checks:
The model is ready for clinical use or additional validation.
Validated Deep Learning Model for cardiac risk prediction, ready for deployment or further clinical validation.
Throughout this tutorial, MediNet has been generating a JSON configuration file in the background. This file captures your entire workflow—model architecture, training parameters, dataset references—and can be exported for reproducibility or sharing with colleagues.
{
"metadata": {
"version": "1.0",
"created_at": "2025-11-20T11:50:16.211Z",
"model_type": "dl_linear",
"framework": "pytorch"
},
"basic_info": {
"name": "Model1",
"description": ""
},
"architecture": {
"layers": [
{
"name": "Input Layer",
"type": "input",
"params": {
"features": 52
},
"readonly": true
},
{
"name": "Linear",
"type": "Linear",
"params": {
"in_features": 52,
"out_features": 64,
"bias": true,
"features": 64
}
},
{
"name": "ReLU",
"type": "ReLU",
"params": {
"features": 64
}
},
{
"name": "Linear",
"type": "Linear",
"params": {
"in_features": 64,
"out_features": 1,
"bias": true,
"features": 1
}
},
{
"name": "Output Layer",
"type": "output",
"params": {
"features": 1
},
"readonly": true
}
]
},
"training": {
"optimizer": {
"type": "adam",
"learning_rate": 0.001,
"weight_decay": 0,
"differential_privacy": {
"noise_multiplier": 1,
"max_grad_norm": 1,
"random_seed": 42
}
},
"loss_function": "bce_with_logits",
"metrics": [],
"epochs": 5,
"batch_size": 32,
"rounds": 10,
"flower_version": "1.6"
},
"dataset": {
"selected_datasets": [
{
"dataset_id": "2",
"dataset_name": "Hearth Atack Risk ",
"features_info": {
"input_features": 52,
"feature_types": {
"numeric": 23,
"categorical": 30
}
},
"target_info": {
"name": "Heart Attack Risk",
"type": "classification",
"task_subtype": "binary_classification",
"data_type": "numeric",
"num_classes": 2,
"classes": [
0,
1
],
"output_neurons": 1,
"recommended_activation": "sigmoid",
"recommended_loss": "BCEWithLogitsLoss"
},
"num_columns": 53,
"num_rows": 8762,
"size": 2526628,
"connection": {
"name": "can ruti",
"ip": "127.0.0.1",
"port": "5001"
}
}
]
},
"federated": {
"name": "FedAvg",
"parameters": {
"fraction_fit": 1,
"fraction_eval": 0.3,
"min_fit_clients": 1,
"min_eval_clients": 1,
"min_available_clients": 1
}
},
"job_config": {
"job_name": "Model1_1246",
"job_description": "",
"save_frequency": 0
}
}
How to Export:
heart_failure_predictor_config.jsonFuture capability: In upcoming MediNet versions, you'll be able to directly import and edit JSON configuration files to quickly recreate or modify training experiments.
Complete workflow from dataset to validated model
Secure access to pre-processed medical datasets with metadata validation and exploration capabilities.
Intuitive drag-and-drop interface for designing deep learning architectures without coding.
Comprehensive control over training parameters including learning rate, epochs, loss functions, and batch size.
Automated training workflow with real-time monitoring and performance tracking.
Detailed metrics visualization including loss curves, accuracy charts, and error measurements.
Support for multiple training cycles with hyperparameter tuning and performance comparison.
Medical data remains at Hospital X while enabling model training through federated learning architecture.
Researchers can design and train complex deep learning models using visual interfaces without programming knowledge.
Quick iteration cycles enable researchers to optimize models efficiently through hyperparameter tuning.
Structured workflow from training to validation ensures models meet clinical requirements before deployment.
Ensuring transparent, verifiable, and replicable research
MediNet v0.1.x
Released: November 2025
heart_attack_prediction_dataset
Preprocessed & validated
Raw: 8764 samples | Preprocessed: one-hot encoded
The exported JSON configuration (shown in Step 6) contains all parameters needed to reproduce this experiment. Combined with the platform and dataset versions listed above, any researcher can replicate these results exactly.
For complete installation instructions and environment setup, refer to our comprehensive guide:
MediNet Installation GuideMediNet makes cardiac risk prediction and medical AI research accessible to healthcare professionals