Predict Data Using Azure Machine Learning – Transform, Manage, and Prepare Data-1

  1. Log in to the Azure portal at https://portal.azure.com ➢ enter Azure Machine Learning into the Search box ➢ select Azure Machine Learning from the drop down ➢ select the + Create menu item ➢ enter a subscription ➢ enter a resource group ➢ enter a workspace name (I used brainjammer) ➢ choose an appropriate region ➢ click the Review + Create button ➢ and then click Create.
  2. Once provisioned, the resource from step 1 navigate to the AML Overview blade ➢ select the Access Control (AIM) link from the navigation menu ➢ select the + Add menu item ➢ select Add Role Assignment from the drop‐down menu ➢ select Contributor ➢ click Next ➢ select + Select Members ➢ search for the Azure Synapse Analytics workspace you created in Exercise 3.3 (in my case, csharpguitar) ➢ select it from the search results ➢ and then click the Select button. The configuration should resemble Figure 5.44.

FIGURE 5.44 Azure Machine Learning—brainjammer contributor access

  1. Click the Review + Assign button twice ➢ navigate to the Azure Synapse Analytics workspace you created in Exercise 3.3 ➢ on the Overview blade, click the Open link in the Open Synapse Studio tile ➢ select the Manage hub ➢ select Linked Service ➢ select the + New item ➢ select the Azure Machine Learning tile ➢ click the Continue button ➢ enter a name (I used BrainjammerAML) ➢ select the AML workspace you just provisioned ➢ and then click Commit.
  2. Select the Develop hub ➢ create a new notebook ➢ select the version 2.4 Spark pool from the Attach To drop‐down list box ➢ and then enter the following syntax:
    df = spark.read.option(“header”,”true”) \
    .parquet(‘abfss://…@…dfs.core.windows.net/…/transformedBrainwavesV1 .parquet’)
    df = df.select(df.SCENARIO, df.ELECTRODE, df.FREQUENCY, df.VALUE.cast(‘float’))
  3. Add a new cell ➢ click the + Code button at the lower center of the current cell ➢ and then enter the following code snippet. The code is available in the AzureMLBrainwaves.txt file, in the Chapter05/Ch05Ex15 directory, on GitHub. The code snippet shown here is a summary; copy all the code from GitHub.
  4. Execute the code in both cells ➢ after completion, select the Data hub ➢ select the Workspace tab ➢ and then navigate to the table just created, as illustrated in Figure 5.45.

FIGURE 5.45 Azure Machine Learning—brainjammer table

  1. Consider renaming the notebook (for example, Ch05Ex15) ➢ click the Commit button ➢ click the Publish button ➢ right‐click the table ➢ select Machine Learning ➢ select Train a New Model ➢ select Regression ➢ click Continue ➢ select the Azure Machine Learning Workspace from the drop‐down (for example, BrainjammerAML) ➢ select MEDAF3ALPHA from the Target Column drop‐down list box ➢ select your version 2.4 Spark pool ➢ click Continue ➢ leave the defaults ➢ and then click Create Run.

This will take up to the 3 hours.

  1. Navigate to the AML workspace created in step 1 ➢ select Jobs from the navigation pane ➢ and then select the job you just submitted via Azure Synapse Analytics. Once completed, the page should resemble Figure 5.46.

FIGURE 5.46 Azure Machine Learning—brainjammer job

  1. Review the job results, and then select the Models tab to see the Spearman correlation results.

After you provisioned the AML workspace, you granted Contributor access to your Azure Synapse Analytics managed identity. Figure 5.47 shows how this might look. Note that the Azure Synapse identity can be assigned to more than a single role. In this case it is assigned to both Contributor and Owner.
The next step was to create a linked service for the AML that you just provisioned. You have done this many times now, so it shouldn’t have been a problem. It is important to note that the linked service must be committed and published before you can submit the AutoML run to AML for modeling. This is mentioned in step 7, but as this wasn’t the case for the numerous other linked services created so far, it needs to be called out again. The next action was to create a new notebook and attach it to the v2.4 Spark pool. You have seen the first snippet of code in the first cell numerous times. The code loads the brainjammer brain wave data created in Exercise 5.15 into a DataFrame and selects the desired columns.

FIGURE 5.47 Azure Machine Learning—Access Control (IAM)
The next bit of code imports the col(), lit(), and row_number() methods and instantiates a Window() object partitioned and ordered by the VALUE column.

Ileana Pecos

Learn More

Leave a Reply

Your email address will not be published. Required fields are marked *