# Algorithms

{% hint style="info" %}
*<mark style="color:green;">Pre-requisite:</mark>*

1. ***Configure the Algorithms** using the **Data Science Lab Settings** from the **Admin module** to access them under the **Data Science Lab Project** creation.*
2. *The user must select Algorithms while creating a Project to make them accessible for a Notebook within the Project.*
   {% endhint %}

{% hint style="success" %}
*Check-out the walk through on how to apply Algorithms inside Notebook.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FQWxsv68o6GvJd6W21vXp%2FAlgorithms.mp4?alt=media&token=421bd9d1-cb72-4356-ac6d-e41f4abc36cf>" %}
***Using Algorithms in Notebook***
{% endembed %}

The entire process to access the Algorithms option inside the DS Lab and actually create a model based on the Algorithm is a three-step process:

1. ​[**Admin Settings for Algorithms​**](#admin-settings-for-algorithms)
2. [**​Project Level Algorithm Selection​**](#project-level-algorithm-selection)
3. **​**[**Using Algorithm inside a Notebook​**](#using-algorithms-inside-a-notebook)

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The first two steps are pre-requisites for the user to avail desired Algorithms inside their DS Lab Projects.*
{% endhint %}

## Admin Settings for Algorithms <a href="#admin-settings-for-algorithms" id="admin-settings-for-algorithms"></a>

* Navigate to the ***Admin*** module.
* Open the ***Data Science Settings*** option from the ***Configuration*** section of the ***Admin*** panel.
* The ***Data Science Settings Information*** page opens.
* Select the ***Algorithms*** using the drop-down option.
* Click the ***Save*** option.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fyis05VkFsZMCYxPaJWjO%2Fimage.png?alt=media&#x26;token=ba4db79b-7a15-49d5-b86d-ee3fcd0be48c" alt=""><figcaption></figcaption></figure>

* A confirmation message appears to inform about the Notebook details updates.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FvqhLTlQGRLIPpT1d1jgo%2Fimage.png?alt=media&#x26;token=14465db2-7814-47de-aee7-768de3265da8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*

* ***Regression & Classification** - Default Algorithm types that will be enabled by Admin for each Data Science Lab module user.*
* ***Forecasting, Unsupervised, Natural Language Processing** - These algorithms will be disabled by default. As per user request, they will be enabled by the Admin.*
  {% endhint %}

## Project Level Algorithm Selection <a href="#project-level-algorithm-selection" id="project-level-algorithm-selection"></a>

Once the ***Algorithm settings*** is configured in the ***Admin module***, and the required Algorithms are selected while creating a Data Science Project, the user can access those Algorithms within a Notebook created under the same DSL Project.

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Once the Algorithm configuration is completed from the Admin and Project level the same set of Algorithms will be available for all the Notebooks which are part of that DSL Project.*
{% endhint %}

* Navigate to the ***Data Science Lab***.
* Click the ***Create Project*** option.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fnzrly9IhLOLkBV0tabMj%2Fimage.png?alt=media&#x26;token=c97d3aaa-8f71-40d0-9604-9498f3c7f7e7" alt=""><figcaption></figcaption></figure>

* Together with the other required fields select the algorithms using the given checkboxes from the drop-down menu.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fd2F8eMLhwoQldMYza3MH%2Fimage.png?alt=media&#x26;token=ba68a448-ae14-40ae-af8d-36183c72f558" alt=""><figcaption></figcaption></figure>

* The selected Algorithms appear on the field separated by comma.
* ***Save*** the project.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fh4omlTCxGR6TQ2bFkT0q%2Fimage.png?alt=media&#x26;token=f13e37b0-a553-435a-ab4a-d8ce86e7508f" alt=""><figcaption></figcaption></figure>

## Using Algorithms inside a .ipynb File <a href="#using-algorithms-inside-a-notebook" id="using-algorithms-inside-a-notebook"></a>

Once the Algorithms are selected while creating a Project, those algorithms will be available for all the Notebooks created inside that project.&#x20;

{% hint style="warning" %}
*<mark style="color:orange;">Prerequisite</mark><mark style="color:green;">:</mark> Please activate the Project to access the Notebook functionality inside it.*
{% endhint %}

{% hint style="success" %}
*Check out the given illustration on how to use Algorithm inside a .ipynb file under a repo sync project.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2F97iqfmFKqxcQUtSHJThO%2FAlgorithm_RSP.mp4?alt=media&token=05f1e41f-378a-460b-9ea9-e0f24a46bd0d>" %}
***Using Algorithm inside a .ipynb file***
{% endembed %}

* Navigate to the ***Notebook tab*** inside the same ***Project.***
* Add a dataset and run it.&#x20;
* Click the ***Algorithms*** tab.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FtDralfbUADhEdbvN25eF%2Fimage.png?alt=media&#x26;token=9176e5df-3c1e-45a6-a4b7-600a5ea0e5eb" alt=""><figcaption></figcaption></figure>

* Use a click on the Algorithms tab.
* It will display the algorithm selected and added at the Project level.&#x20;

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FzDma83K0yxtS4mmnYUgv%2Fimage.png?alt=media&#x26;token=f47cf33c-9fa3-4e0c-b117-598e677a79f3" alt=""><figcaption></figcaption></figure>

* Add a new code cell in the .ipynb file.
* Select a sub-algorithm by using the checkbox.
* The pre-defined code for the selected algorithm type gets added to the code cell.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FA7Y9QpbUlEysOs9P4l6D%2Fimage.png?alt=media&#x26;token=88d638c0-66b1-40db-8747-c82fa11b1e5f" alt=""><figcaption></figcaption></figure>

* Define the ***DataFrame*** using another code cell.
* Run the code cell.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2F0paZtDNimiUPUVV6Tq96%2Fimage.png?alt=media&#x26;token=6fe3bf82-cd79-4cec-8075-65158c40e8fa" alt=""><figcaption></figcaption></figure>

* After the code cell run is completed.
* The test data predictions based on the train data appear below.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FdS856CPlmPsSPLLgRde1%2Fimage.png?alt=media&#x26;token=a3b3db4d-8fda-4722-9c04-e69ef5325029" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> You can run the cell containing the data frame details to see the output below.*

![](https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/78EZenIjAeDC5xioqRDC/image.png)
{% endhint %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The model based on the **Algorithm** can be saved under the **Models** tab.*&#x20;
* *The algorithm-based models can be **registered** to be accessed inside the **Data Pipeline** module.*
* *The model based on an Algorithm script can be registered as an API service. Refer to the **Register a Model as an API Service** section for more details.*
* *Refer to the* [***Data Science Lab Quick Start Flow***](https://docs.bdb.ai/data-science-lab-4/data-science-lab-quick-start-flow) *page for the overview of the **Data Science Lab** module.*&#x20;
  {% endhint %}
