# 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 %}

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 an Algorithm inside a Notebook](https://docs.bdb.ai/data-science-lab-4/repo-sync-project/tabs-for-a-data-science-lab-project/tabs-for-tensorflow-and-pytorch-environment/notebook/notebook-page/operations-for-an-.ipynb-file/algorithms#using-algorithms-inside-a-notebook)

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The first two steps are prerequisites 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="/files/1hNCknE878Tz79siw92r" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/sHEYmCVu5tEToWlxl3MW" alt=""><figcaption></figcaption></figure>

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

* ***Regression & Classification** - Default Algorithm types that Admin will enable for each Data Science Lab module user.*
* ***Forecasting, Unsupervised, Natural Language Processing** - These algorithms will be disabled by default. As per the user's 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*** are 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*** option for Project.

<figure><img src="/files/yokaP6oTcBYm3YmmCGfc" alt=""><figcaption></figcaption></figure>

* The ***Create Project*** page appears.
* Select the algorithms using the given checkboxes from the drop-down menu.

<figure><img src="/files/mQ54g3Y3gqgvXi3UNhvz" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/tM3gcR4mD5XaDIw92gSz" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Provide all the required fields for the Project creation.*
{% endhint %}

## 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>*&#x20;

* *Please activate the Project to access the Notebook functionality inside it.*
* *Do the required Admin level Settings and Project Level settings to access the Algorithms inside a Data Science Lab Notebook.*
  {% endhint %}

{% hint style="success" %}
*Check out the illustration on using an algorithm script inside a Data Science Notebook.*&#x20;
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F3sQaU4w8ybTTt0VMp560%2FUsing%20Algorithm%20inside%20a%20DS%20Notebook.mp4?alt=media&token=dcf17893-57f2-419a-a4e0-e635ddcb7cad>" %}
***Using Algorithm script inside a DS Notebook***
{% endembed %}

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

<figure><img src="/files/GhCOtBQqH7nAGD4TFzFt" alt=""><figcaption></figcaption></figure>

* Click the ***Algorithms*** tab.
* Add a new code cell in the .ipynb file.
* It will display the list of algorithms selected and added at the Project level. Select a sub-category of the Algorithm using a checkbox.
* The pre-defined code for the selected algorithm type gets added to the code cell.

<figure><img src="/files/PloJOSmp0PTAhUF3d0zn" alt=""><figcaption></figcaption></figure>

* Define the necessary variables in the code cell. Define the ***Data*** and ***Target*** column in the auto-generated algorithm code.
* Run the code cell.

<figure><img src="/files/2dB2LlCBjpMIAXMLAJYC" 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="/files/jOGl1zECUsQBJaRoz2AI" alt=""><figcaption></figcaption></figure>

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

* *You can run the cell containing the data frame details to see the output.*

&#x20;      ![](/files/CUlvuMF1eSWaN58XvAtB)&#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***](/data-science-lab-5/tabs-for-a-dsl-project/model/register-a-model-as-an-api-service.md) *section for more details.*
  {% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.bdb.ai/data-science-lab-5/notebook-operations/algorithms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
