Tutorial: Power BI integration - Create the predictive model by using automated machine learning (part 1 of 2)
In part 1 of this tutorial, you train and deploy a predictive machine learning model. You use automated machine learning (ML) in Azure Machine Learning Studio. In part 2, you'll use the best-performing model to predict outcomes in Microsoft Power BI.
In this tutorial, you:
- Create an Azure Machine Learning compute cluster.
- Create a dataset.
- Create an automated machine learning run.
- Deploy the best model to a real-time scoring endpoint.
There are three ways to create and deploy the model you'll use in Power BI. This article covers "Option C: Train and deploy models by using automated machine learning in the studio." This option is a no-code authoring experience. It fully automates data preparation and model training.
But you could instead use one of the other options:
- Option A: Train and deploy models by using Jupyter Notebooks. This code-first authoring experience uses Jupyter Notebooks that are hosted in Azure Machine Learning Studio.
- Option B: Train and deploy models by using the Azure Machine Learning designer. This low-code authoring experience uses a drag-and-drop user interface.
- An Azure subscription. If you don't already have a subscription, you can use a free trial.
- An Azure Machine Learning workspace. If you don't already have a workspace, see Create and manage Azure Machine Learning workspaces.
Create a compute cluster
Automated machine learning trains many machine learning models to find the "best" algorithm and parameters. Azure Machine Learning parallelizes the running of the model training over a compute cluster.
To begin, in Azure Machine Learning Studio, in the menu on the left, select Compute. Open the Compute clusters tab. Then select New:
On the Create compute cluster page:
- Select a VM size. For this tutorial, a Standard_D11_v2 machine is fine.
- Select Next.
- Provide a valid compute name.
- Keep Minimum number of nodes at
- Change Maximum number of nodes to
- Select Create.
The status of your cluster changes to Creating.
The new cluster has 0 nodes, so no compute costs are incurred. You incur costs only when the automated machine learning job runs. The cluster scales back to 0 automatically after 120 seconds of idle time.
Create a dataset
To create the dataset, in the menu on the left, select Datasets. Then select Create dataset. You see the following options:
Select From Open Datasets. Then on the Create dataset from Open Datasets page:
- Use the search bar to find diabetes.
- Select Sample: Diabetes.
- Select Next.
- Name your dataset diabetes.
- Select Create.
To explore the data, select the dataset and then select Explore:
The data has 10 baseline input variables, such as age, sex, body mass index, average blood pressure, and six blood serum measurements. It also has one target variable, named Y. This target variable is a quantitative measure of diabetes progression one year after the baseline.
Create an automated machine learning run
In Azure Machine Learning Studio, in the menu on the left, select Automated ML. Then select New Automated ML run:
Next, select the diabetes dataset you created earlier. Then select Next:
On the Configure run page:
- Under Experiment name, select Create new.
- Name the experiment.
- In the Target column field, select Y.
- In the Select compute cluster field, select the compute cluster you created earlier.
Your completed form should look like this:
Finally, select a machine learning task. In this case, the task is Regression:
Automated machine learning takes around 30 minutes to finish training the 100 models.
Deploy the best model
When automated machine learning finishes, you can see all the machine learning models that have been tried by selecting the Models tab. The models are ordered by performance; the best-performing model is shown first. After you select the best model, the Deploy button is enabled:
Select Deploy to open a Deploy a model window:
- Name your model service diabetes-model.
- Select Azure Container Service.
- Select Deploy.
You should see a message that states that the model was deployed successfully.
In this tutorial, you saw how to train and deploy a machine learning model by using automated machine learning. In the next tutorial, you'll learn how to consume (score) this model in Power BI.