Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Taking Models to the Next Level With Azure Mach...

Henk Boelman
May 28, 2020
83

Taking Models to the Next Level With Azure Machine Learning

Artificial Intelligence and Machine Learning can be used in many ways to increase productivity of business processes and gather meaningful insights, by analyzing images, texts and trends within unstructured flows of data. While many tasks can be solved using existing models, in some cases it is also required to train your own model for more specific tasks, or for increased accuracy. In this session, we will explore the complete path of integrating text analysis intelligent services into the business processes of Tailwind Traders, starting from pre-build models available as cognitive services, up to training a third-party neural custom model for Aspect-Based Sentiment Analysis available as part of Intel NLP Architect using Azure Machine Learning Service. We will talk about cases when one needs a custom model and show how to fine-tune model hyperparameters using HyperDrive

Henk Boelman

May 28, 2020
Tweet

Transcript

  1. aka.ms/AIML40 Henk Boelman (@hboelman) The Story Existing pre-built models for

    text analytics Custom models trained on specific data
  2. aka.ms/AIML40 Henk Boelman (@hboelman) What is Azure Machine Learning? Set

    of Azure Cloud Services Azure CLI Extension ✓Prepare Data ✓Build Models ✓Train Models ✓Manage Models ✓Track Experiments ✓Deploy Models That enables you to: Python SDK Web interface
  3. aka.ms/AIML40 Henk Boelman (@hboelman) Challenges of distributed training  Dependencies

    and Containers Provision clusters of VMs Schedule jobs Distribute data Gather results Handle failures Scale resources Secure Access
  4. aka.ms/AIML40 Henk Boelman (@hboelman) Azure Machine Learning Typical end to

    end ML process … Prepare Experiment Deploy Orchestrate
  5. aka.ms/AIML40 Henk Boelman (@hboelman) Create a workspace ws = Workspace.create(

    name='<NAME>', subscription_id='<SUBSCRIPTION ID>', resource_group='<RESOURCE GROUP>', location='westeurope') ws.write_config() ws = Workspace.from_config() Create a workspace
  6. aka.ms/AIML40 Henk Boelman (@hboelman) Create Compute cfg = AmlCompute.provisioning_configuration( vm_size='STANDARD_NC6',

    min_nodes=0, max_nodes=6) cc = ComputeTarget.create(ws, '<NAME>', cfg) Create a workspace Create compute
  7. aka.ms/AIML40 Henk Boelman (@hboelman) Attach storage ds = ws.get_default_datastore() ds

    = Datastore.register_azure_blob_container( workspace = ws, datastore_name = ‘<datastore name>', container_name = ‘<blob container name>', account_name = ‘<storage account name>’, account_key = ‘<storage account name>', Create a workspace Create compute Setup storage
  8. aka.ms/AIML40 Henk Boelman (@hboelman) Create an estimator params = {'--data-folder':

    ws.get_default_datastore().as_mount()} estimator = Estimator( source_directory = script_folder, script_params = params, compute_target = computeCluster, entry_script = 'train.py’, conda_packages = ['scikit-learn','keras','opencv’]) Create an Experiment Create a training file Create an estimator
  9. aka.ms/AIML40 Henk Boelman (@hboelman) Submit the experiment to the cluster

    run = exp.submit(estimator) RunDetails(run).show() Create an Experiment Create a training file Submit to the AI cluster Create an estimator
  10. aka.ms/AIML40 Henk Boelman (@hboelman) Create an Experiment Create a training

    file Submit to the AI cluster Create an estimator Demo: Creating and run an experiment
  11. aka.ms/AIML40 Henk Boelman (@hboelman) Notebook VM Compute Target Experiment Docker

    Image Data store 1. Snapshot folder and send to experiment 2. create docker image 3. Deploy docker and snapshot to compute 4. Mount datastore to compute 6. Stream stdout, logs, metrics 5. Launch the script 7. Copy over outputs
  12. aka.ms/AIML40 Henk Boelman (@hboelman) Register the model model = run.register_model(

    model_name='MyAwesomeModel', model_path='outputs') Create an Experiment Create a training file Submit to the AI cluster Create an estimator Register the model
  13. aka.ms/AIML40 Henk Boelman (@hboelman) Create an Experiment Create a training

    file Submit to the AI cluster Create an estimator Register the model Demo: Register and test the model
  14. aka.ms/AIML40 Henk Boelman (@hboelman) What are Hyperparameters? { “learning_rate”: uniform(0,

    1), “num_layers”: choice(2, 4, 8) … } Config1= {“learning_rate”: 0.2, “num_layers”: 2, …} Config2= {“learning_rate”: 0.5, “num_layers”: 4, …} Config3= {“learning_rate”: 0.9, “num_layers”: 8, …} …
  15. aka.ms/AIML40 Henk Boelman (@hboelman) Typical ‘manual’ approach to hyperparameter tuning

    Dataset Training Algorithm 1 Hyperparameter Values – config 1 Model 1 Hyperparameter Values – config 2 Model 2 Hyperparameter Values – config 3 Model 3 Model Training Infrastructure Training Algorithm 2 Hyperparameter Values – config 4 Model 4 Complex Tedious Repetitive Time consuming Expensive
  16. aka.ms/AIML40 Henk Boelman (@hboelman) Automated Hyperparameter Tuning Manage Active Jobs

    Evaluate training runs for specified primary metric Early terminate poor performing training runs. Early termination policies include: Early terminate poorly performing runs