> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/bdb-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/bdb-documentation/data-science-lab/various-tabs-to-work-with/notebook/notebook-page/notebook-operations/algorithms.md).

# Algorithms

{% hint style="success" %}
*<mark style="color:green;">Pre-requisite:</mark>*&#x20;

1. **Configure the Algorithms** using the [**Admin module**](/bdb-documentation/core-platform/platform-administration/admin-panel-options/configurations/ds-lab-settings.md) to access them under the [**Data Science Lab Project**](/bdb-documentation/data-science-lab/project/creating-a-project.md) creatio&#x6E;*.*&#x20;
2. The user must select Algorithms while creating a Project to make them accessible for a Notebook within the Project.
   {% endhint %}

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

![Algorithm tab inside the Notebook page](/files/maD8aAZWSzmyiDHRBJr6)

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**](#algorithms-tab-inside-notebook)

### Admin Settings for Algorithms

* Navigate to the ***Admin*** module.
* Open the ***Notebook Settings*** option from the ***Configuration*** section of the ***Admin*** panel.
* The Notebook Settings page opens.
* Select the ***Algorithms*** using the drop-down option.
* Click the ***Save*** option.
* A confirmation message appears to inform about the Notebook details updates.

![](/files/QZ9N8NYW0BWdEocIouYH)

### Project Level Algorithm Selection

Once the Algorithm settings is configured in the Admin module, the user can access the Algorithm within the Data Science Lab.

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

![](/files/DRHhNKWThvqhI4dH77E6)

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

&#x20;    &#x20;

![Selecting Algorithms using the Project page](/files/deGWIdpjUlb5X0jHY1AL)

* The selected Algorithms appear on the field separated by comma.     &#x20;

![Selected Algorithms](/files/fZsPcvxQhh67gfJ5AmT9)

* ***Save*** the project.

![Saving the Project with Algorithms](/files/80i5zF7KtwNBa1uYNNlK)

### Using Algorithms inside a Notebook

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

* Open the ***Notebook tab*** inside the ***same Project.***&#x20;
* ***Create a new Notebook*** or ***Navigate*****&#x20;to a*****n existing Notebook*** under the same Project.

![](/files/2uiS90l9jV1cWt7kkObH)

* You can see ***the selected Algorithms at the project level*** get listed under the right-side panel of the Notebook.

![Accessing the selected Algorithms inside a Notebook](/files/DqmbvaSqBB7zzn0DMIcO)

* Add a code cell with the dataset information.
* Define the ***Dataframe*** using another code cell.  &#x20;

![Code cells with Dataset and Data frames](/files/Rmqd7dGtgNHpPY33tq15)

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

![](/files/K9EfQDvnir5mLbGWNb2t)

{% endhint %}

* Add another code cell below.
* Select an algorithm type by using the checkbox.
* You will get the algorithm script pasted in the intended code cell. &#x20;

![Default script gets added to the Code cell based on the selected Algorithm type](/files/rzsZ6CJ1ujew5NZdUMX4)

* Specify train and test data.
* Run the cell.     &#x20;

![Specifying the train and test data](/files/NOvIUMTo3flIVaRmzHqb)

* You can see the data output below.

![](/files/KrVYFs0IcnwFH3DXVdoG)

* Add a new code cell below.
* Click the ***Save Model*** option.
* Specify the model name and model type in the auto generated code.
* Run the cell.

![Saving the Algorithm based model](/files/B2bZlFscTl18NEF9Hia9)

* The model gets saved and lists under the Models tab (The model will list under the ***Unregistered*** models as it is not registered yet).

![The saved model](/files/JKpfRx4gz1cWQETCgjxY)

* Add new code cell.
* ***Load the model*** in the cell by clicking the checkbox given next to the model.

![The saved model gets loaded in the new cell](/files/IZoXO0hQTLKbb4bPHqoE)

* Specify the model as the loaded model and model type for the loaded model.
* Run the cell.

![Specifying the model and model type for a loaded model](/files/hAbYD1O1RR5K4kshDFXz)

* The data output gets displayed below.

![Output data after running the loaded model](/files/i9CA7KUcRHDkhIC0bk8x)

#### Registering an Algorithm based Model

This section displays the flow on how to register a saved model from a Notebook.

* Click the ***Register*** option for the saved model.

&#x20;     ![](/files/XdyzAX7sxZQohnODWV8y)

* The ***Register Model*** dialog box appears to confirm the action.
* Click the ***Yes*** option.

&#x20;      ![](/files/d7RkQtjTiHahnjgUTwxx)

* A confirmation message appears to inform about the completion of the model registration action.

![](/files/4tKtxx7lzYNDeQmP0OxA)

* The concerned model appears under the ***Registered*** model list.

&#x20;     ![](/files/w4DUWvYpsegCupeXMJdJ)

* Open a Pipeline using the ***Data Pipeline module*** that contains the ***DS Lab Model Runner component***.
* You can see the same model (which was registered from the DS Lab module) listing under the ***Meta Information*** tab of the ***DS Lab Model Runner*** component.

&#x20;    &#x20;

![Accessing the same registered model under the Data Pipeline module](/files/PN43rB7RshKpQJE7cSwC)

{% hint style="info" %} <mark style="color:green;">Please Note</mark>: The model based on an Algorithm script can be registered as an API service. You can refer to the [*<mark style="color:blue;">**Publish a Model as an API Service**</mark>*](/bdb-documentation/data-science-lab/various-tabs-to-work-with/model/register-model-as-an-api-service.md) section for more details.
{% endhint %}
