> For the complete documentation index, see [llms.txt](https://medomicslab.gitbook.io/medfl-app-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://medomicslab.gitbook.io/medfl-app-docs/medfl-review/medfl-package-review/simulation.md).

# Simulation

### Overview

The **Simulation Mode** of MEDfl allows federated learning experiments to be executed within a single controlled environment.

In this mode:

* No physical client machines are required
* No real network orchestration is needed
* Multiple clients are programmatically simulated
* All components run within the same runtime context

Client behavior is emulated internally, enabling reproducible and controlled federated learning experiments.

### Purpose of This Review

The objective of this review is to validate the correctness, stability, and usability of the MEDfl Python package when operating in simulation mode.

Specifically, this review aims to:

* Verify that simulation pipelines can be configured and executed end-to-end
* Ensure datasets are correctly partitioned across simulated clients
* Validate client initialization, local training, aggregation, and evaluation steps
* Confirm that metrics, logs, and artifacts are generated consistently
* Assess robustness under different configuration settings

{% hint style="info" %}
This review does **not** aim to benchmark model performance, but rather to ensure that the simulation mode behaves as expected and produces reliable outputs suitable for further experimentation or real-world deployment.
{% endhint %}

### Documentation

The following resources describe how simulation mode is implemented and used in MEDfl.

<table data-card-size="large" data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://medfl.readthedocs.io/en/latest/simulation_tutorials.html">Simulation mode documentation</a></td></tr></tbody></table>

### Getting Started with the Tutorial

To start testing MEDfl using this tutorial, simply visit this [**GitHub repository** ](https://github.com/ouaelesi/MEDfl-package-review)and download the **tutorial notebook along with the provided datasets**.

The GitHub repository used for this review is organized into four main folders:

`/models :` Contains the pretrained model used for transfer learning experiments.\
This model is loaded during training to initialize the federated learning process when transfer learning is enabled.

`/data :` Contains the dataset files already partitioned across multiple clients.\
Each file represents the local dataset of a specific client, simulating decentralized data ownership.

`/simulation :` Contains the Jupyter notebook used for the **Simulation Mode review**.\
This notebook runs the full federated learning workflow in a single controlled environment.

`/rw :` Contains the notebooks used for the **Real-World Mode review**.\
These notebooks are intended to be executed separately by the server and each client on different machines.

Once downloaded, you can run the notebook inside `/simulation` locally and follow the tutorial to reproduce the results and experiment with different configurations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://medomicslab.gitbook.io/medfl-app-docs/medfl-review/medfl-package-review/simulation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
