---
description: Saving & loading a Data Science Lab model
---

# 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="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FrpScctD3n7pHcRGU1A2d%2Fimage.png?alt=media&#x26;token=053de84a-f8b8-452b-9eb4-02e5de248915" 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="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FwN0u1uEEfNrAAstjF9BE%2Fimage.png?alt=media&#x26;token=87fed902-be14-4634-8a01-f747507927f7" 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="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FCPLaegnLosHgkbUcv9PP%2Fimage.png?alt=media&#x26;token=503c9763-03e6-453e-aa78-8871efa3915b" 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-quick-start-flow) _to get redirected to the quick start flow page._
{% endhint %}
