Is there anything you have seen someone do in Power BI and have always wondered how? During the UrBizEdge’s Power BI Learning Community on Sunday, our special speaker MVP Leon Gordon gave us a brief look into Machine Learning in Power BI.
Video: Microsoft Excel Office Hour 41: Say Goodbye to Lookups with New Power Query Data Types.
Requirements and availability
You would need to have Microsoft Power BI installed on your laptop and a Premium Per User (PPU) License.
The Premium Per User (PPU) is a new way to license premium features on a per-user basis. It includes all Power BI Pro license capabilities, along with features like paginated reports, AI, and other capabilities that previously were only available with a Premium capacity.
Machine Learning in Power BI
In this session, Leon Gordon made us understand that Machine learning is a branch of artificial intelligence (AI) and computer science which focuses on the use of data and algorithms to imitate the way that humans learn, gradually improving its accuracy. Machine learning is an important component of the growing field of data science. Through the use of statistical methods, algorithms are trained to make classifications or predictions, uncovering key insights within data mining projects. These insights subsequently drive decision-making within applications and businesses, ideally impacting key growth metrics.
Power BI has a powerful feature called Automated Machine Learning (Auto ML): with this feature, one can automate the process of machine learning, and successfully transform tasks like data imputation, feature engineering, model selection, training, testing, and visualizing their results. It is also simple, thus individuals with relatively little or no knowledge of Machine Learning perform the process.
In this session, we will learn how to use Automated Machine Learning to create and apply a binary prediction model in Power BI using Python to quickly classify data.
How it works
First, you need to create a data flow with the input data.
- Go to Power BI Service and navigate to your desired workspace (must be a premium workspace).
- In your workspace, click on Create and click on Dataflow.
- Click on Add entities and from the list of options, select the data source.
- We used a CSV; however, it was from a URL instead of a file path.
- Click on the Next
- A Power Query window will be open; Here you can do your data cleaning and change data types.
- Next, we save and apply all done.
- Provide a name for your data flow and click Save.
Second, It is time to create and train a machine learning model.
- Open the saved entity by clicking on it.
- In Actions, click on Apply ML Model which looks like a brain.
- A small tab will display the Add a Machine Learning Model option, click on it.
- Select Outcome field, this is the field you want to predict, and click on Next.
- MODEL SELECTION: You will be required to choose a model. Power BI will often automatically suggest a Model. Here Power BI suggested a Classification Model, which was the right choice based on the outcome field.
You can however manually select a different model if your dataset requires another. We also select a target outcome.
- Power BI moves into feature selection. Fields are selected based on those you and Power BI think will have a significant correlation with the outcome field. This is so we reach accurate results in a reasonable amount of time. In Machine Learning terms, this is called Feature Engineering.
- Next, we name our model and specify the training time. Followed by “save and train”. The model will start training.
Third, you review your model validation report.
These reports describe how your machine learning model is likely to perform. On the Model Performance page of the report, you can see the Probability Threshold slicer, along with the Precision and Recall for the model.
While the Training Details page shows the different iterations that were run, how features were extracted from the inputs, and hyperparameters detail for the final model used. The other pages of the report describe the statistical performance metrics for the model.
Fourth and Lastly, you apply the model to a dataflow entity.
You can apply the model to incoming data by selecting the Apply model button at the top of the report to invoke this model. In the Apply dialog, you can specify the target entity that has the source data to which the model should be applied. Power BI will keep your predictions up-to-date whenever the dataflow is refreshed.
Once this is done, you can use the scored output from the model in a Power BI report. This can be done by connecting to your dataflow from the Power BI desktop, using the Dataflows connector.