# Models

{% hint style="success" %}
*Check-out the walk-through on how to save and load a DSL Model.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FFsvkH9FhB8RUEi1nu0Jg%2FSave%20%26%20Load%20Model.mp4?alt=media&token=4b136ff1-ddcd-4bf5-8292-14b68bd447dd>" %}
Save and load a model
{% endembed %}

Once the Notebook script is executed successfully, the users can save them as a model. The saved model can be loaded into the Notebook.

## Saving a Data Science Lab Model <a href="#saving-a-dsl-model" id="saving-a-dsl-model"></a>

* Navigate to a Notebook.
* Write code using the following sequence:
  * Read DataFrame
  * Define test and train data
  * Create a model
* Execute the script by running the code cell.

<figure><img src="/files/qdPYIfwkkoWqHOUViq0j" alt=""><figcaption><p><em><strong>Sample Script for a Data Science Model</strong></em></p></figcaption></figure>

* Get a new cell.
* Click the ***Save Model*** option.&#x20;

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

* A code gets generated in the newly added code cell.
* Give a model name to specify the model and model type as ***ml.***
* Execute the code cell.

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

* After the code gets executed, the Model gets saved under the ***Models*** tab.

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

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The newly saved model gets saved under the unregistered category given inside the **Models** tab.*
{% endhint %}

### **Function Parameters**

* model - Trained model variable name.
* modelName - Desired name given by user for the trained model.
* modelType - Type in which model can be saved.
* X - This array contains the input features or predictors used to train the model. Each row in the X\_train array represents a sample or observation in the training set, and each column represents a feature or variable.
* Y - This array contains the corresponding output or response variable for each sample in the training set. It is also called the target variable, dependent variable, or label. The Y\_train array has the same number of rows as the X\_train array.
* estimator\_type - The estimator\_type of a data science model refers to the type of estimator use.

<figure><img src="/files/VIr0qqmNjIBAeFqN4hyo" alt=""><figcaption><p><em><strong>Specify a Data Science Lab Model by giving a name</strong></em></p></figcaption></figure>

## Loading a Data Science Lab Model <a href="#loading-a-dsl-model" id="loading-a-dsl-model"></a>

* Open the ***Models*** tab.
* Access the Unregistered category.
* The saved model will be available under the Models tab. Select the model by using the given checkbox to load it.
* The model gets loaded into a new cell.
* Run the cell.

<figure><img src="/files/DpDbCbFi7sVDd9JadGlI" alt=""><figcaption><p><em><strong>Loading a saved Data Science Lab Model</strong></em></p></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Refer the* [***Data Science Lab Quick Start Flow***](https://docs.bdb.ai/data-science-lab-4/data-science-lab-quick-start-flow) *page to get an overview of the **Data Science Lab** module in nutshell.*&#x20;
{% 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-4/project/tabs-for-a-data-science-lab-project/tabs-for-tensorflow-and-pytorch-environment/notebook/notebook-page/notebook-operations/models.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.
