# Models

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

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2Fb9vQbnff4mSVi90V6A1h%2FTurn%20your%20Script%20into%20a%20%20Model.gif?alt=media&#x26;token=2528704f-9c6e-4da9-b52c-56835b8b34f4" alt=""><figcaption><p>Saving and loading a model</p></figcaption></figure>

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.

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

* Get a new cell.
* Give a model name to specify the model.
* Execute the cell.
* After the code gets executed, click the ***Save Model*** notebook in a new cell.
* The saved model gets listed under the ***Models*** list.

### **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/eh9HXo5IpVOTX0KSNJdt" 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>

* Click on a new cell and select the model by using the given checkbox to load it.
* The model gets loaded into a new cell.

<figure><img src="/files/2VNTbPbLH9odo4Rx8aNd" 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** page to get an overview of the **Data Science Lab** module in nutshell.* [***Click here***](/data-science-lab-1/data-science-lab-quick-start-flow.md) *to get redirected to the quick start flow page.*
{% 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-1/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.
