Computer Science, asked by shaileshprajapati071, 7 months ago

you have written a script that use the scikit learn framework to train a model which Framework specific estimator should you use to run the script as an experiment​

Answers

Answered by priya61522
0

Answer:

hope that this long answer will help u ....

if u satisfied with my answer then please mark it as brainlist.....

Explanation:

The example scripts in this article are used to classify iris flower images to build a machine learning model based on scikit-learn's iris dataset.

Whether you're training a machine learning scikit-learn model from the ground-up or you're bringing an existing model into the cloud, you can use Azure Machine Learning to scale out open-source training jobs using elastic cloud compute resources. You can build, deploy, version and monitor production-grade models with Azure Machine Learning.

Prerequisites

Run this code on either of these environments:

Azure Machine Learning compute instance - no downloads or installation necessary

Complete the Tutorial: Setup environment and workspace to create a dedicated notebook server pre-loaded with the SDK and the sample repository.

In the samples training folder on the notebook server, find a completed and expanded notebook by navigating to this directory: how-to-use-azureml > ml-frameworks > scikit-learn > training > train-hyperparameter-tune-deploy-with-sklearn folder.

Your own Jupyter Notebook server

Install the Azure Machine Learning SDK.

Create a workspace configuration file.

Download the dataset and sample script file

iris dataset

train_iris.py

You can also find a completed Jupyter Notebook version of this guide on the GitHub samples page. The notebook includes an expanded section covering intelligent hyperparameter tuning and retrieving the best model by primary metrics.

Set up the experiment

This section sets up the training experiment by loading the required python packages, initializing a workspace, creating an experiment, and uploading the training data and training scripts.

Import packages

First, import the necessary Python libraries.

Python

Copy

import os

import urllib

import shutil

import azureml

from azureml.core import Experiment

from azureml.core import Workspace, Run

from azureml.core.compute import ComputeTarget, AmlCompute

from azureml.core.compute_target import ComputeTargetException

Initialize a workspace

The Azure Machine Learning workspace is the top-level resource for the service. It provides you with a centralized place to work with all the artifacts you create. In the Python SDK, you can access the workspace artifacts by creating a workspace object.

Create a workspace object from the config.json file created in the prerequisites section.

Python

Copy

ws = Workspace.from_config()

Create a machine learning experiment

Create an experiment and a folder to hold your training scripts. In this example, create an experiment called "sklearn-iris".

Python

Copy

project_folder = './sklearn-iris'

os.makedirs(project_folder, exist_ok=True)

exp = Experiment(workspace=ws, name='sklearn-iris')

Prepare training script

In this tutorial, the training script train_iris.py is already provided for you. In practice, you should be able to take any custom training script as is and run it with Azure ML without having to modify your code.

To use the Azure ML tracking and metrics capabilities, add a small amount of Azure ML code inside your training script. The training script train_iris.py shows how to log some metrics to your Azure ML run using the Run object within the script.

The provided training script uses example data from the iris = datasets.load_iris() function. For your own data, you may need to use steps such as Upload dataset and scripts to make data available during training.

Copy the training script train_iris.py into your project directory.

Copy

import shutil

shutil.copy('./train_iris.py', project_folder)

Create or get a compute target

Create a compute target for your scikit-learn job to run on. Scikit-learn only supports single node, CPU computing.

The following code, creates an Azure Machine Learning managed compute (AmlCompute) for your remote training compute resource. Creation of AmlCompute takes approximately 5 minutes. If the AmlCompute with that name is already in your workspace, this code will skip the creation process.

Python

Copy

cluster_name = "cpu-cluster"

try:

compute_target = ComputeTarget(workspace=ws, name=cluster_name)

print('Found existing compute target')

except ComputeTargetException:

print('Creating a new compute target...')

compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_D2_V2',

max_nodes=4)

compute_target = ComputeTarget.create(ws, cluster_name, compute_config)

compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)

For more information on compute targets, see the what is a compute target article.

Similar questions