# Learning Module

{% hint style="warning" %}
If this is your first time reading the Learning Module documentation, we suggest starting from the [#overview-videos](#overview-videos "mention").
{% endhint %}

{% hint style="info" %}
The Learning Module is constructed using the open-source Python library [*PyCaret*](https://pycaret.gitbook.io/docs/). You can find valuable information about [*PyCaret*](https://pycaret.gitbook.io/docs/) at the following links:

* [*PyCaret* Gitbook](https://pycaret.gitbook.io/docs/)
* [*PyCaret* ReadTheDocs](https://pycaret.readthedocs.io/en/stable/)
* [*PyCaret* GitHub](https://github.com/pycaret/pycaret)
  {% endhint %}

## The Learning Module's architecture

The Learning Module has been redesigned with an updated architecture that adheres to machine learning practices, introducing external training/testing data separation to support multi-iteration model training. This enhanced approach provides more reliable performance estimation while specifically overcoming PyCaret's limitations in external data splitting. The following diagram presents the new architecture:

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FYg4zosKwZEnOIaquYU1I%2FNewScheme.png?alt=media&#x26;token=a1d31de6-088b-43a3-8d89-67f944265d05" alt=""><figcaption><p>The new Learning Module workflow</p></figcaption></figure>

#### Enhanced external training and validation

The updated workflow introduces flexible dataset partitioning through multiple validation methods (cross-validation, bootstrapping, etc.), resolving PyCaret's limitation in handling external data splitting. For clarity:

* **External splits** divide the learning set into training/testing data
* **Internal splits** further partition training data for hyperparameter tuning

The figure below illustrates this enhanced validation framework.

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FbBHzgcDB3IgqAKPKfcHY%2FExternalVsInternal.png?alt=media&#x26;token=1be7db7c-c11a-424a-a2b6-dc2c9e1744e4" alt=""><figcaption><p>External and Internal splits illustration</p></figcaption></figure>

## What relies on PyCaret, and what does not use it?

{% hint style="info" %}
Refer to [this section](#understand-pycarets-role-within-the-learning-module) for more details on PyCaret's role in the Learning Module.
{% endhint %}

The Learning Module is built on [PyCaret's ](https://pycaret.gitbook.io/docs/)open-source machine learning framework, enhanced with custom-coded components to enable new features, such as external data splitting —a capability not supported in PyCaret. The figure below highlights which elements leverage PyCaret's standard functionality versus our custom extensions, giving you a better understanding of the architecture.

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fjy6z2mqOb57nDvMiRkrV%2FCustomVsPycaret.png?alt=media&#x26;token=f1994a7c-1774-45f9-8b8b-20c884eadcde" alt=""><figcaption><p>Custom-coded and PyCaret based sections of the ML workflow</p></figcaption></figure>

## A new design is here

The learning Module features a new redesigned interface aligned with the new architecture, which offers users a streamlined way to [create their scenes](#how-to-create-a-scene) and experiments. The updated interface is organized into three boxes:

* **Initialization**: Users begin by selecting their machine learning resources and configuring key experiment parameters, including dataset selection, data preprocessing steps, model choices, and more.
* **Training**: This section enables users to define and manage the model training process, encompassing aspects such as hyperparameter tuning, optimization strategies, and additional features.
* **Analysis**: In the final stage, users can visualize and interpret their model’s performance through a variety of result plots and metrics.

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FeyfzSveC7ad6kxq5X7YJ%2FLMnewLook.png?alt=media&#x26;token=cd84db02-f384-4cac-a8a6-3c022ef680b8" alt=""><figcaption><p>The Learning Module: before and after</p></figcaption></figure>

## A new color-code system

The intuitive box-based design simplifies pipeline creation by visually guiding users through each step. A color-coding system works alongside the boxes to prevent errors. For example, as illustrated below, if you accidentally attempt to drag a Train Model node into the Initialization box, both the node and box will turn red, immediately alerting you to the mismatch. Each box only accepts compatible node types, ensuring logical connections and reducing setup mistakes.

<div><figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FPKEgx4vFCZZtqFqFvG27%2FMisplaceTrain.PNG?alt=media&#x26;token=5645c9af-6aa7-438d-b1cf-4a11354eb48b" alt=""><figcaption><p>Misplaced Train Model node</p></figcaption></figure> <figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FbUPGGw0mEISZQcBj8zQ0%2FMisplaceClean.PNG?alt=media&#x26;token=10484011-b961-40dc-a632-cfd3ca90d031" alt=""><figcaption><p>Misplaced Clean Node</p></figcaption></figure></div>

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FKQ7M6LOAFvzPd4AIBLQg%2FMisplaceCleanError.jpg?alt=media&#x26;token=4a32dc55-22b5-4783-9488-69619ebdb630" alt=""><figcaption><p>Error message upon running the experiment</p></figcaption></figure>

In Results or Analysis modes, a different color-coding is used; read more about it [here](https://medomicslab.gitbook.io/medomics-docs/tutorials/development/analysis#highlighting-feature).

## A new scene for experimenting

The learning module includes a new [**Experimental Scene**](https://medomicslab.gitbook.io/medomics-docs/tutorials/development/learning-module/experimental-scene), a minimalistic scene designed for testing machine learning configurations (models, parameters, etc.) before finalizing them in the main production scene.

As shown in the figure below, the Experimental Scene’s minimalistic design focuses attention on core machine learning elements, with all required node types available. The scene serves as a testing ground where users can refine their pipelines before switching to the main scene.

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FNQ1QmjxDuELFKYc5DhmM%2Fimage.png?alt=media&#x26;token=61e4c437-93a0-497c-a360-3b3712510d02" alt=""><figcaption><p>Example of an Experimental scene</p></figcaption></figure>

## A **Redefined Pipeline Structure**

In the previous design, a pipeline was defined as any sequence of connected nodes. The updated architecture now defines a pipeline as a **complete sequence of nodes that starts from an initial node and terminates at the Analysis Box**. This crucial change means that any disconnected node chain or incomplete workflow will not be recognized as a valid pipeline for execution or analysis. By enforcing this complete connection, the platform ensures that users adhere to machine learning best practices and that every pipeline will be analyzed. The figure below illustrates an example of valid and invalid pipelines under this new definition.

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FffmrND422yQmLcZs3gLJ%2FNewPipelineDefinition.png?alt=media&#x26;token=ca2b5fac-059d-4776-9c44-49b1e1b8c248" alt=""><figcaption><p>Example of valid and invalid pipelines</p></figcaption></figure>

## Overview Videos

{% embed url="<https://youtu.be/0PsuT_zXllk>" %}
Learning Module - Scene Creation
{% endembed %}

{% embed url="<https://youtu.be/9vcAkIaAcxE>" %}
Learning Module - Understanding Pipelines and Results
{% endembed %}

***

## How to create a scene

{% stepper %}
{% step %}

### Click on the Learning Module Icon.

On the left sidebar, click on the following icon: <img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FQbGZUfNxlXNNmdTXKeJT%2Ficon.png?alt=media&#x26;token=b9692a2e-f494-40cc-a6d3-d691e3d11848" alt="" data-size="line">
{% endstep %}

{% step %}

### Click on the "Create scene" button

The button can be located on top of the side panel.
{% endstep %}

{% step %}

### Enter a name for the new scene

Type your scene's name in the field "*Enter Page Name*":

&#x20;![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FQmgBoXoNbMEy9vcqRwfq%2Fimage.png?alt=media\&token=6dcf3f24-7978-4829-b0bc-38a405787ea9)
{% endstep %}

{% step %}

### Select whether it's an Experimental scene or not

If you would like to create an Experimental scene, ensure the following switch is on: ![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FPCUh9dxligNiU8jCJHm3%2Fimage.png?alt=media\&token=bc8471d6-f991-4f69-948a-9fcc2ec44188)
{% endstep %}

{% step %}

### Click **Create**.

{% endstep %}
{% endstepper %}

These steps are summarized in the figure below. Once your scene is created, a folder will be generated that includes the following:

* Your scene (.*medml* file): ![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2F6YKgNMg4mAZZzipBph51%2Fimage.png?alt=media\&token=3b897366-95e2-4aff-b6b7-4e6d298d300d)
* A folder for your scene models: ![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FKrT81ZYqBlXaKYn5krOW%2Fimage.png?alt=media\&token=fc8d084c-6067-45ab-a1a6-1a38cb8f0fa0)
* A folder for your scene notebooks: ![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FcyR5ObpgbeYtpOZBifHQ%2Fimage.png?alt=media\&token=ee0dfba8-b218-4e19-b081-5bcaf0a7c3da)

<div data-full-width="true"><figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FfkYBNHPFrKmvhYYrrrAl%2FCreateAScene.png?alt=media&#x26;token=84128472-9c52-43ca-b6cc-3df70f7b0f97" alt=""><figcaption><p>How to create a new scene</p></figcaption></figure></div>

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FzLh06WAaqGVmIVPUIILi%2FNewScene.PNG?alt=media&#x26;token=42bd3118-9df5-4fe0-911b-1f1a9bc2c49c" alt=""><figcaption><p>Your scene's folder in the application's workspace</p></figcaption></figure>

***

## Module Overview

{% hint style="info" %}
Double-click on the .*medml* file to open the scene.
{% endhint %}

The following sections provide a comprehensive overview of the scene and its fundamental components. Each numbered element in the main scene figure corresponds to a detailed explanation in the subsequent subsections.

#### Main scene

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FHRTBz8YoYbhCaOJluj3V%2FBreakdownEmptyScene.png?alt=media&#x26;token=f7668ea5-674c-471f-9675-c4d3ade68015" alt=""><figcaption><p>Empty Main Scene</p></figcaption></figure>

***

### 1. Scene folder breakdown

Every scene folder is organized as follows:

{% hint style="info" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>breast_cancer_analysis             -> Scene folder
</strong>    ├───models                     -> Folder where models are saved
    ├───notebooks                  -> Folder where notebooks are saved
    └───breast_cancer_scene.medml  -> Scene file
</code></pre>

{% endhint %}

### 2. Available Nodes

<figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fvmqav1qpAvFpNe2rhlH2%2FNodeBreakdown.png?alt=media&#x26;token=04d4f2a7-8c47-4d31-adf2-1c16740e2027" alt=""><figcaption><p>General structure of a node</p></figcaption></figure>

{% hint style="info" %}
The *Add options* button opens a panel where you can select additional options. These options are retrieved from the online [ReadTheDocs documentation of *PyCaret*](https://pycaret.readthedocs.io/en/stable/).
{% endhint %}

{% hint style="warning" %}
The links used to explain the *PyCaret-specific* functions refer to the [Classification section of the *PyCaret* documentation](https://pycaret.readthedocs.io/en/latest/api/classification.html). However, these functions are also present in other machine learning types within *PyCaret*. For instance, you can find them in the [Regression documentation of *PyCaret*](https://pycaret.readthedocs.io/en/latest/api/regression.html) as well.
{% endhint %}

#### Available nodes summary table:

<table data-full-width="true"><thead><tr><th width="219">Node</th><th width="396.5">Description</th><th>Designated box</th><th width="135">Input</th><th>Output</th></tr></thead><tbody><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FVR06pqMDngFBbau8FuWX%2Fimage.png?alt=media&#x26;token=34349278-f5ea-4eee-bb88-c913b7531ac0" alt="" data-size="original"></td><td>This acts as the initial point for all experiments and determines the data your pipeline will use. The available options for this node correspond to the <a href="https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.setup"><em>PyCaret</em> <code>setup()</code> function</a> options that are not directly related to data cleaning.</td><td><a href="learning-module/initialization">Initialization</a></td><td>-</td><td>Dataset</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fzq0v6G40KcLxDIRixQ96%2Fclean.png?alt=media&#x26;token=a2176310-9fbd-40c9-b689-32035526a957" alt="" data-size="original"></td><td>This node enables you to clean and improve the quality of your dataset. The available options for this node correspond to the <a href="https://pycaret.readthedocs.io/en/latest/api/classification.html#pycaret.classification.setup"><em>PyCaret</em> <code>setup()</code> function options</a> that are directly related to data cleaning.</td><td><a href="learning-module/initialization">Initialization</a></td><td>Dataset</td><td>Dataset</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FDnzMvELzQkU2rdlAZWQ5%2FSplitNode.PNG?alt=media&#x26;token=15278c25-10de-4c90-9035-060e1d9065a1" alt="" data-size="original"></td><td>This uniquely custom-coded node (distinct from <em>PyCaret</em>’s standard functions) gives you precise control over how your dataset is divided for training and evaluation. It serves as the foundation for reliable model validation by ensuring appropriate data separation.</td><td><a href="learning-module/initialization">Initialization</a></td><td>Dataset</td><td>Dataset</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FeJzQGpLX9docgma4j6OH%2Fmodel.png?alt=media&#x26;token=3ee87363-1090-4b4c-ab59-2c1cfc8edd48" alt="" data-size="original"></td><td>This node allows you to select a machine learning algorithm from <a href="https://pycaret.gitbook.io/docs/get-started/functions/train#model-library">PyCaret's model library</a> and set its associated parameters. It corresponds to the estimator parameter of the <a href="https://pycaret.readthedocs.io/en/latest/api/classification.html#pycaret.classification.create_model"><em>PyCaret</em> <code>create_model()</code> function</a>. </td><td><a href="learning-module/initialization">Initialization</a></td><td>-</td><td>Model_config</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2F2loUSrFKeaIcibH7ZjFg%2Ftrain.png?alt=media&#x26;token=7cbe3c0e-111e-43e2-996d-c827fbefb377" alt="" data-size="original"></td><td>This node allows you to train a model using the selected ML algorithm. The available options for this node correspond to the <a href="https://pycaret.readthedocs.io/en/latest/api/classification.html#pycaret.classification.create_model"><em>PyCaret</em> <code>create_model()</code> function options</a> (except the <em>estimator</em> parameter, which is defined through the Model node).</td><td><a href="learning-module/training">Training</a></td><td><p>Model_config + </p><p>Dataset</p></td><td>Model</td></tr><tr><td><div><figure><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FIrqwtNQ5dQhyz2e6RbsW%2Fimage.png?alt=media&#x26;token=2cf181a6-d4cc-4c2e-99bc-3923b17769a1" alt=""><figcaption></figcaption></figure></div></td><td>This node allows you to combine multiple models using different techniques. It is based on <em>PyCaret</em>'s <a href="https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.blend_models"><code>blend_models()</code></a> and <a href="https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.stack_models"><code>stack_mdoels()</code></a> functions.</td><td><a href="learning-module/training">Training</a></td><td>Model</td><td>Model</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fse8ot4D2K4oxDn05k0Rx%2Fcompare.png?alt=media&#x26;token=d78be2a4-207a-4aa1-9341-d36cdb90e42a" alt="" data-size="original"></td><td>This node allows you to train and evaluate the performance of all estimators available in the <a href="https://pycaret.gitbook.io/docs/get-started/functions/train#model-library"><em>PyCaret</em> model library</a> using cross-validation. The available options for this node correspond to the <a href="https://pycaret.readthedocs.io/en/latest/api/classification.html#pycaret.classification.compare_models"><em>PyCaret</em> <code>compare_models()</code> function options</a>.</td><td><a href="learning-module/training">Training</a></td><td>Dataset</td><td>Model(s)</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2F4M891hiuGfRSr5OWZcRr%2Fload_model.png?alt=media&#x26;token=549580b3-4231-474d-b507-d000d611691c" alt="" data-size="original"></td><td>This node allows you to load a model from a file. It takes as input a model from the ones you saved in your scene, displayed in a dropdown selector. The available options for this node are the ones available in the <a href="https://pycaret.readthedocs.io/en/latest/api/classification.html#pycaret.classification.load_model"><em>PyCaret</em> <code>load_model()</code> function</a>, except the model name, which is replaced by the selected file.</td><td><a href="learning-module/training">Training</a></td><td>Dataset</td><td>Model</td></tr><tr><td><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FeCnj2UCDBYhlW3ebsCVo%2Fimage.png?alt=media&#x26;token=90b505d3-df04-48ee-8575-0ea230a6f116" alt="" data-size="original"></td><td>This box allows you to analyze a model. It gathers the <a href="https://pycaret.gitbook.io/docs/get-started/functions/analyze">analysis and model explainability functions of <em>PyCaret</em></a>. For now, only the <a href="https://pycaret.gitbook.io/docs/get-started/functions/analyze#plot_model"><code>plot_model()</code> function</a> is used in the Learning Module.</td><td>-</td><td>Model</td><td>-</td></tr></tbody></table>

### 3. Analysis Mode

The Analysis Mode button, called See Results in Experimental scenes, is used to view the results of the experiment. It is disabled until you run an experiment. After a successful run, a .*medmlres* file is created in your scene folder, containing the generated results from the experiment. If you quit the app, your generated results will still be available the next time you open the app.

{% hint style="info" %}
Refer to the [Analysis page](https://medomicslab.gitbook.io/medomics-docs/tutorials/development/learning-module/analysis) for more details.
{% endhint %}

### 4. Utils Menu

This menu contains different functionalities that can be used to help you build your scene.

| Element                                                                                                                                                                                                                                                                                         | Description                                                                                                                                       |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Machine Learning type dropdown <img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FJbAdPxeISB6h1BsFxhm9%2Fml_dropdown.png?alt=media&#x26;token=ce45f9d7-4df9-4422-817b-9d45ca90145b" alt="" data-size="original"> | This dropdown allows you to select the type of machine learning you want for your experiment. When changing the type, all settings are reset.     |
| <p>Play </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fd1WQqKYU7G38UqnpYIOe%2Fplay.png?alt=media&#x26;token=ef090fc2-cb52-47ba-8ead-498fb92437ff" alt="" data-size="original"></p>                    | This button allows you to run the experiment. You can find additional information about running the experiment [here](#id-2.-run-the-experiment). |
| <p>Garbage bin</p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fgh09LVVZt6vt7gBuYcQt%2Fbin.png?alt=media&#x26;token=ef389413-d1f3-43b9-8b34-d0c004aa3cc0" alt="" data-size="original"></p>               | This button allows you to delete all nodes in the scene.                                                                                          |
| <p>Save </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FfFKILiplakqRRi3na5tD%2Fsave.png?alt=media&#x26;token=c9aa5534-3e04-4d07-8704-64b1184424eb" alt="" data-size="original"></p>                    | This button allows you to save the scene.                                                                                                         |
| <p>Load </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FekZoQM4X9uNReqFkEupO%2Fload.png?alt=media&#x26;token=578fdd4e-6969-4a0b-8507-220d8b716047" alt="" data-size="original"></p>                    | This button allows you to load a scene from a file.                                                                                               |

### 5. Minimap

This minimap allows you to navigate the scene and visualize the nodes present in it.

### 6. Flow Utils

This menu contains various functionalities that interact with the flow section.

| Element                                                                                                                                                                                                                                                                                 | Description                                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| <p>Plus Button </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fbmqs9lorhs7bkoK2kGpS%2Fplus.png?alt=media&#x26;token=e3236801-e3aa-4b9a-b2d1-d50367c1d831" alt="" data-size="original"></p>     | This button allows you to zoom in the flow section.                                            |
| <p>Minus Button </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FcrUzI8MqV7mtYpmgc4vk%2Fminus.png?alt=media&#x26;token=a46c1072-ef39-45d8-9675-9aa6eaeb5940" alt="" data-size="original"></p>   | This button allows you to zoom out the flow section.                                           |
| <p>Square Button </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FJ32UEGCP9gKM7bQWGKfx%2Fsquare.png?alt=media&#x26;token=2e5c9b75-d0e9-4e3e-97a4-94e03af3a1a0" alt="" data-size="original"></p> | This button allows you to fit the flow section in the view.                                    |
| <p>Lock Button </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FQw3LU6e6AFfo9UzikIBc%2Flock.png?alt=media&#x26;token=f2e78b3d-ba6b-4c11-8218-58a36b45fd80" alt="" data-size="original"></p>     | This button allows you to lock the flow section. When locked, you can't move the flow section. |
| <p>Map Button </p><p><img src="https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FINIe6MYijKyjv0cfwlAo%2Fmap.png?alt=media&#x26;token=b2a76900-0da5-4e06-b2bd-73438981163f" alt="" data-size="original"></p>       | This button allows you to show/hide the minimap.                                               |

### 7. Scene Boxes

In the main scene, these boxes are part of the new design, helping guide the user through creating their scene and reducing errors when dragging and placing nodes. Read more about these boxes in the next sections of the documentation.

***

<details>

<summary>Understand PyCaret's role within the Learning Module</summary>

PyCaret primarily implements functions from the [*scikit-learn* library](https://scikit-learn.org/stable/).

## 1. Initialization

At the beginning of a Machine Learning pipeline, you initialize your data using [*PyCaret*'s setup function](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.setup), corresponding to the Dataset and Clean nodes in our *Learning Module*. The setup function requires a dataset and the name of the target column. *PyCaret* then initializes elements for the pipeline.\\

![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FFWLxlXqc7oPh4XJJfCvJ%2Fpycaret_workflow.png?alt=media\&token=d8e638b9-c8ea-47a0-96d2-fe62d2220754)

### 1.1. Test Data

*PyCaret* divides your dataset into two parts: the training set and the test set (controlled by the `test_data` parameter in the [*PyCaret* setup function](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.setup)). The training data is employed to train and optimize your machine learning model, while the test data is reserved for evaluating the created model. The split is conducted using the [*scikit-learn* train\_test\_split function](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) (useful explanations about this function can be found [here](https://github.com/mGalarnyk/Python_Tutorials/blob/master/Sklearn/Train_Test_Split/TrainTestSplitScikitLearn.ipynb)).

![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Ft5ullGBmc9T6pMaCAx2M%2Fspaces_kkOWBZQGwLyBFteUhl1l_uploads_yJt58khhA0hG9CaObJk1_image.webp?alt=media\&token=4bd527a0-8196-4004-96f1-6e6a8cd7af6d)

\*In the figure, "Full Dataset" refers to our Learning Dataset.

The random sampling step is executed with the aid of a random seed, and each split is linked to a specific seed. By default, *PyCaret* randomly assigns a seed at the start of each pipeline execution. To ensure the replication of the same experiment with a consistent split, you can set this parameter in *PyCaret* (using the `session_id` parameter in the Dataset node), as demonstrated in our experiments in the instructional video. This ensures that your test and train data will remain consistent across all executions.

![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2FXdc5JJubBjwTWDgE0rvp%2Fspaces_kkOWBZQGwLyBFteUhl1l_uploads_7bOPzY5zTlFtL52YewGP_image.webp?alt=media\&token=abf4597a-f30b-4eab-b811-38cb57bb50cf)

Here, you also have the option to define the test data yourself and provide it to *PyCaret*. However, this capability is not currently available in our application when using the MEDomicsLab Standard format.

### 1.2. Folds

Then *PyCaret* will define folds on the train data to use for the Cross-Validation part (which will be executed using the Train or Compare Models box). The definition of the folds will also be done using a random seed, which you can define through the `session_id` parameter of *PyCaret*. By default, *PyCaret* uses the [*StratifiedKFold* method from *sickit-learn*](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.StratifiedKFold.html) to define the folds. The stratified method ensures that each class from the target is represented equally across each fold.

![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2Fl1HcOXbELIFBSlcr3vSK%2Fstratified_cv.png?alt=media\&token=77410015-3dc5-440a-8da9-7aa775dbe528)

## 2. Training

There are two functions related to training in *PyCaret*: [*compare\_models*](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.compare_models) (corresponding to our Compare Models box) and [*create\_model*](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.create_model) (corresponding to our Train node).

### 2.1. Compare Models

The [*compare\_models* ](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.compare_models)function is used to train all the available models from *PyCaret* on the initialized data from the setup function of *PyCaret* (our Dataset and Clean nodes). The resulting table displayed shows you the mean of the Cross-Validation results of all the folds for each model. For example, if we have five folds, for each model, we train the model five times, using a different fold as validation data at each iteration. Then, we apply the trained model to the validation fold and keep the resulting metrics to calculate the mean with the validation results of the four other iterations (purple data from the split in the image shown below).

![](https://4288370141-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUO0RN9PzFLqAgLEwwaSn%2Fuploads%2F18ZikTNCwuP3rk0bdu0G%2Fpycaret_cv.png?alt=media\&token=da0490db-7b96-41ee-a35a-0ea16c285fdc)

The output of the [*compare\_model* ](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.compare_models)function is the best model found using a specified metric (Accuracy by default, AUC as we specified in our instruction video). If we set the `n_select` parameter (as shown in our instruction video), we return the specified number of models from the top of the list.

### 2.2. Create Model

The [*create\_model* ](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.create_model)function takes initialized data as an entry and a model (that you can define through our Model node). It works exactly the same way as the [*compare\_models* ](https://pycaret.readthedocs.io/en/stable/api/classification.html#pycaret.classification.compare_models)function, except that we only test one model, and the results table shows the Cross-Validation results of each fold.

## 3. Analyzing

The analyses made using our Analyze node are showing the metrics resulting from our trained models on the test data defined at the initialization of the experiment.&#x20;

## 4. Finalize

The *finalize* function in *PyCaret* (represented by the Finalize node in our app) trains the model one last time on the entire dataset, which includes both the training data and the test data, without changing its parameters.

</details>
