= Train Linear Learner model using MNIST dataset and Amazon EFS file system.
:toc:
:icons:
:linkattrs:
:imagesdir: ../resources/images


== Summary

This section will train Linear Learner model using Amazon EFS file system.


== Duration

NOTE: It will take approximately 10 minutes to complete this section.


== Step-by-step Guide

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::04-run-ml-training.gif[align="left", width=600]

. Open the link:https://console.aws.amazon.com/sagemaker/[Amazon SageMaker] console.
+
TIP: *_Context-click (right-click)_* the link above and open the link in a new tab or window to make it easy to navigate between this github tutorial and the Amazon SageMaker console.
+

. Go to *Notebook* *_Select_* *Notebook instances*.

. *_Click_* *Open Jupyter*.

. In Jupyter notebook window *_Click_* *SageMaker Examples*.

. Scroll down through the sample notebooks and *_Select_* *linear_learner_mnist_with_file_system_data_source.ipynb* then *_Click_* *Use* then *_Click_* *Create copy*

. *Note:* Before proceeding with next step make sure you have the EFS file system ID, SageMaker ML instance security group and subnet ID. This can be found in the Cloudformation Stack Outputs and Parameters 

. Go to *_Prepare File System Input_* cell and update the values for following parameters

+
[cols="3,10"]
|===
| *file_system_id*
a| *_Enter_* *<your_efs_file_system_id>*
| *file_system_directory_path*
a| *_Enter_* - */notebooks/training*
| *file_system_access_mode*
a| *_Enter_* - *ro*
| *file_system_type*
a| *_Enter_* - *EFS*
| *security_groups_ids*
a| *_Enter_* - *<your_security_groups_ids>*
| *subnets*
a| *_Enter_* - *<your_subnets>*
|===
+

. See an example of the input below:
+
[source,bash]
----
# Specify file system id.
file_system_id = 'fs-ba453210'

# Specify directory path associated with the file system. You need to provide normalized and absolute path here.
file_system_directory_path = '/notebooks/training'

# Specify the access mode of the mount of the directory associated with the file system. 
# Directory can be mounted either in 'ro'(read-only) or 'rw' (read-write).
file_system_access_mode = 'ro'

# Specify your file system type, "EFS" or "FSxLustre".
file_system_type = 'EFS'

# Give Amazon SageMaker Training Jobs Access to FileSystem Resources in Your Amazon VPC.
security_groups_ids = ["sg-88533ec8"]
subnets = ["subnet-b41df0e9"]

----
+

. Go to *File* *Save as...* and enter path to save notebook dir as *_./efs/linear_learner_mnist_2020-03-29.ipynb_*. This will save your notebook in notebooks folder which you mounted on ./efs mount path and is now available to be shared with other users.

. Go to beginning of the notebook and *_Click_* *Run* to execute all the notebook cells.


== Next section

Click the button below to go to the next section.

image::05-cleanup-and-resources.png[link=../05-cleanup-and-resources/, align="left",width=420]




