> 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/tutorials/simulation/crash-tutorial.md).

# Crash tutorial

{% hint style="info" %}
On this page, we will apply everything we've covered in the previous tutorials. We will start from scratch and guide you through the final steps of viewing and saving the results.
{% endhint %}

## Video tutorial

{% embed url="<https://youtu.be/pFXtTte8BjY?si=6JXBdeW4ge75ccWg>" %}

## Steps&#x20;

### 1. Creating the workspace:&#x20;

When you first open the MedomicsLab application, you see this window where we can view our previously created workspaces. In my case, there is an old workspace, but if you are new to this application, you should click the 'Set workspace' button and choose a folder. It's preferable to choose an empty folder.

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2Fk3JDEPyxK27DUKxkBveG%2FList%20of%20nodes%20(10).png?alt=media&amp;token=45b5a418-3375-45e5-996a-98023d633e9b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FPePu2gqey3KhDYLWB7q7%2Fimage.png?alt=media&amp;token=63e2ff4b-2c05-4373-83a8-a9186630c76d" alt=""><figcaption></figcaption></figure>

### 2. Uploading Datasets:

&#x20;For this experience, we will need a dataset to run the pipelines, so we need to add the datasets to the workspace.

For our example, we will use the [Diabetes dataset](https://drive.google.com/drive/folders/1i3kGKTxq-1XulRQNU7iKksYs2fGGzCAj?usp=sharing). Make sure to download the files, and once you have them, add them to the DATA folder and refresh the workspace.<br>

{% hint style="warning" %}
MEDfl supports numerical tabular datasets. If you want to test your dataset, ensure it is compatible and clean. It's always preferable to start the tutorial with our provided dataset for consistency.
{% endhint %}

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FOfDt8feqiFGO7nobNKwV%2Fimage.png?alt=media&amp;token=9bd5c194-d1fc-4d85-9a12-e02c1db9b553" alt=""><figcaption></figcaption></figure>

### 3. Configuring Database:&#x20;

When you first open MEDfl, you'll see a popup containing instructions on how to create a configuration file. This file will be used to connect to the MySQL database on your local machine.

To get started, create a file named `config.ini` in your workspace and add your connection information, including the username and password.

for more details about configuring the database feel free to check [the configuration tutorial page ](broken://pages/HsAEgzfpFyZkp6tXzGZ8)

```ini
[mysql]
host = localhost
port = 3306
user = YOUR_SQL_USERNAME
password = YOUR_PASSWORD
database = MEDfl
```

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FngQNa4elyvD1vbizYsqd%2Fimage.png?alt=media&amp;token=e817c201-3182-4652-a8f4-ce83e33f698d" alt=""><figcaption></figcaption></figure>

### 4. Optimizing hyperparameters:&#x20;

Before we create the pipeline, we can optimize the model hyperparameters to improve performance.&#x20;

{% hint style="info" %}
After the optimization, we can use the results to initialize the central model hyperparameters.
{% endhint %}

For our example, we will use the Optuna central optimization to optimize the hyperparameters. MEDfl offers various options for optimization, so feel free to check the[ Optimization tutorial page](broken://pages/wq5wC9szXRL3mGefdflq) for more details.

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2F5FKCX1T54TXOLOgE1dVs%2Fimage.png?alt=media&amp;token=752720ec-863a-4b38-b1d6-0d61b4d3485f" alt=""><figcaption></figcaption></figure>

After Having the optimization results we will save them, so we can use them later&#x20;

<br>

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FzfKuth4lenCfwEY1Kitz%2Fimage.png?alt=media&amp;token=1296646b-839e-4f92-a3ae-d3b4ee3f3991" alt=""><figcaption></figcaption></figure>

### 5. Creating and running pipelines&#x20;

for this experience, we will create two configurations and run them simultaneously, each configuration will have a different aggregation algorithm \
for more details on how to create the pipeline and add the different nodes please check [this tutorial page  ](broken://pages/iQkMtTn7igLAkNKwcMni)<br>

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2F43VdFAqVg7F2VawEJsqu%2Fimage.png?alt=media&amp;token=ccf6497c-37cd-4d58-be8a-2d22acccb231" alt=""><figcaption></figcaption></figure>

### 6. Pipeline results&#x20;

After the execution of the pipelines, you will have the option to see results by clicking on the <mark style="color:yellow;">"See results"</mark> button ![](https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2F8pu6Nw8cguYNafYe38TT%2Fimage.png?alt=media\&token=ba35194a-cb3f-4b9a-a3da-8eb8fc63f793).

<figure><img src="https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FFugcvst20CNxGJrbuBS8%2Fimage.png?alt=media&amp;token=f2df612b-89ad-46e3-8dde-ebc3d7f7768c" alt=""><figcaption></figcaption></figure>

&#x20;You can switch between different configuration results and also between different types of results. There are mainly three types of results: <mark style="color:yellow;">Global results, results by node, and compare results</mark>.&#x20;

{% hint style="info" %}
For more details about the results, refer to the [Pipeline Results tutorial page](broken://pages/gzvLi1VZO6RxT18hBugt).
{% endhint %}

To save the results, click on the "Save" button and an input field will appear where you can enter the file name ![](https://2289920470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOpYh7tOQkAu0q6hPpqe9%2Fuploads%2FPHPb9vYhv2GXu2hgKYsC%2Fimage.png?alt=media\&token=c26eb669-9e9f-4443-acd0-455cd5cf69d5). After confirming, two types of files will be created, and you can open them directly by clicking on them.&#x20;

### 7. Merge results&#x20;

In this section, we will merge two different result files into one file containing both sets of results.

&#x20;You have the option to add the "Merge Results" node separately from the pipeline, or you can link it to the pipeline so that the pipeline results will be automatically merged with the specified file.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://medomicslab.gitbook.io/medfl-app-docs/tutorials/simulation/crash-tutorial.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
