# 2a. Tutorial: Train a model in Model Studio Before starting this part of the tutorial, you should have completed the [modeling project set up](../tutorial-set-up-project/index.md). In this part of the tutorial, we will train a model using [Model Studio](../../model-studio/overview/index.md). We will cover the following steps: 1. [Create a model studio](#2a1-create-a-model-studio) 2. [Configure a model studio training job](#2a2-configure-a-model-studio-training-job) 3. [Monitor a training job](#2a3-monitor-a-training-job) 4. [View the model and submit it to a modeling objective](#2a4-view-the-model-and-submit-it-to-a-modeling-objective) ## 2a.1 Create a model studio Navigate to the Model Studio application in Foundry. Model Studio is a no-code model development tool. **Action:** In the `code` folder you created during the previous step of this tutorial, select **+ New > Model studio**. Your model studio should be named in relation to the model that you are training. In this case, name the studio `median_house_price_model_studio`. Select **Save** to create and open the studio. ![Create a new model studio dialog.](../../../assets/2a087e0119f3e17ce5fe6ad8f580c97ccc9d6726b04cdb7025e3c65a5842fda7.webp) ## 2a.2 Configure a Model Studio training job Once the model studio is created, you will be presented with options for the type of trainer you would like to use. In this tutorial we will predict the median house price, which is a regression problem. **Action:** Select the [regression](../../model-studio/trainers-regression/index.md) trainer. We need to provide a name and location for storing the output model from the studio, so name the model `regression_model` and set the output location to the `models` folder that was created earlier. Once all the options are set, select **Next** to continue. ![Selecting a trainer and setting the model output in Model Studio.](../../../assets/37167277d6dc127670f1973dc63ff33714b2450de6de0775bcebed63c3d3763f.webp) ### Dataset mapping Model Studio requires users to map datasets to inputs that are predefined by the trainer. Since we only have a single training dataset, we will map that to the **Training dataset** input. Model Studio will automatically do a train-test split, splitting off 20% of the data for validation and testing. **Action:** In the **Training dataset** card, select **Choose dataset** and select the `housing_features_and_labels` dataset in the dialog. **Optional:** Once the dataset is selected, you can use the **Preview** button to open a preview panel at the bottom of the page to preview your dataset, or expand the **Filters** area to define filters to apply to the dataset. Once the dataset is selected, we need to tell the trainer what certain columns mean. In this case, we want to tell the trainer that the `median_house_value` column is the target column. **Action:** In the dropdown to the right of **Target column**, select the `median_house_value` column. ![A model studio with a dataset mapped as input.](../../../assets/b2213909a6ca421ccf2a1398bb76353865e399c9c01a6eca8e239355d27845e2.webp) Once the dataset is properly configured, select **Next** to continue. ### Parameter configuration Model Studio trainers offer a set of configuration parameters that users can optionally change to improve model performance. [Learn more about the regression trainer's parameters](../../model-studio/trainers-regression/index.md#parameters). **Action:** For this tutorial, we are finding the balance between speed and predictive accuracy. To do so, we will set the following parameters: * **Evaluation metric:** Set this to `root_mean_squared_error`. * **Training preset:** Set this to `good_quality`, which will provide advanced ensembling techniques while keeping training speed fast. * **Training and inference limits > Training time limit:** Set this to 300 seconds. * **Prediction column name:** Set this to `prediction`. Leave all other parameters at their default values. ![A model studio with set regression parameters.](../../../assets/0bba37bbd6caabebd250ff18f3e8b3cac7a1580a61f25a2d793f0bfc412f7d48.webp) Once the parameters are properly configured, select **Next** to continue. ### Resource configuration To provide the model studio with adequate resources, we need to increase its resources from the default values. **Action:** Set the **vCPU** value to `2` and the **Memory** value to `8` to provide 2 vCPUs and 8GB of memory to the job. ![A model studio with set resource configurations.](../../../assets/758462e34bae93b497098e41abbabf72cf01da54c713988ced3f5bcd5950811d.webp) Once resources are properly configured, select **Start training run**, which will open a dialog asking you to enter a configuration name and changelog. For the name, enter `Initial` and leave the changelog blank. Then, select **Start training run** to launch the build. ## 2a.3 Monitor a training job After launching the job, you will be redirected to the [Model Studio home page](../../model-studio/navigation/index.md#home-page). There will be one run in the list of **Recent training runs**. **Action:** Select **View build** to navigate to the running job and monitor progress. ![The Model Studio home page with view build highlighted.](../../../assets/b63157b82cc1e8d2dd7b4901f13bf62713eb686f18c07c5261930b451110f48d.webp) ## 2a.4 View the model and submit it to a modeling objective When the job is completed, there will be a green checkmark under the run's **Status** column. From here, you can view the produced model. **Action:** Select the first row of the **Recent training runs** table, then select the model name shown below the run date in the sidebar to view the produced model version. Once you are viewing the model version, select the **+** icon (**Submit to a modeling objective**) in the **Modeling Objectives** section of the left sidebar to submit that model to the modeling objective you created in [step one of this tutorial](../tutorial-set-up-project/index.md#11-how-to-structure-a-foundry-project-for-machine-learning). You will be asked to provide a submission name and submission owner. This metadata is used to track the model uniquely inside the modeling objective. Name the model `regression_model` and mark yourself as the submission owner. ![The Model Studio home page with view model version highlighted.](../../../assets/d9b9659980210a0ea4051dd3f43986708817e134dbf78e39d07c1b1d2cf14453.webp) ## Next steps Now that you have trained a model in Foundry, you can move onto model management, testing, and model evaluation. Here are some examples of additional steps you can take in Modeling Objectives: * [Automatic model evaluation](../../evaluate-models/model-evaluation-automatic/index.md) * [Configure checks for model submissions](../../manage-models/set-up-checks/index.md) * [Live](../../manage-models/set-up-live/index.md) and [batch inference](../../manage-models/set-up-batch/index.md) configuration from a modeling objective * No-code [batch inference](../../pipeline-builder/transforms-trained-model/index.md#getting-started) and [streaming inference](../../pipeline-builder/transforms-trained-model/index.md#streaming-configuration) in Pipeline Builder * [Deploy models with DevOps and Marketplace](../marketplace-models/index.md) [Learn more about Model Studio](../../model-studio/overview/index.md).