Category Archives: PowerApps

Will Joel Be Lazy Today? A PowerApps AI Exploration

In February I got an Apple Watch to hold myself accountable for staying active. After AI Builder was announced at the Business Applications Summit, I decided to use the watch data to see what factors influenced my activity.

Gathering Data

There are a couple ways to get data out of the iPhone’s Health app. I found the appropriate table that tracks data for the Apple Watch Movement ring and threw it in Excel.

The next step was to dream up some factors that might influence my activity on a daily basis. These are intuitions and guesses based on my own personal experience. The factors I came up with were:

  • Climate (weather high and low)
  • Day of the week
  • Goal streak – consecutive days of being active
  • Total hours of meetings

This data gathering and theorizing was by far the most time intensive part of this process – more on that later. Below is the first summary table by day. One field contains the binary class field of whether I hit my daily movement goal.

2019-07-28_13-15-27

Adding Data to PowerApps

Data needs to be stored in a CDS Entity for AI Builder to see it. Creating the Entity is fairly straight forward.

Surprisingly, importing data from an Excel file was a very frustrating processes. This seems a fairly basic requirement, especially for something like AI Builder where quickly iterating is key to success. Some of the issues I encountered include:

  • Cannot create the Entity fields based on the Excel file.
  • Had to create a new Excel file with only one tab.
  • Fields aren’t automatically mapped, even though the field names are identical.
  • Errors are common, and error handling information is complicated to view.
  • When the import is complete, or errors out, there’s no close or back button.
  • There’s no easy function to delete all the records when re-importing, which makes it hard when the data and fields keep evolving.

Once data is ready, building the AI model is dead simple. Next > Next > Finish type stuff.

Improving the AI Model

My initial models were kind of dumb. For example, I hadn’t designed my “Goal streak” data field correctly and it ended up predicting 100% of the time whether I hit my goal, because it was a circular reference.

I went back to Excel and started to investigate the data field by field via Pivot tables to see trends and improve the dataset. For example, below are the trends by day of the week against the binary classification.

Pivot

I found each data point to not be individually super helpful, but there were some minor trends that matched my intuitions – which I would assume AI would take and go do magic AI things.

I also tried to classify the data into more broad groupings – I assumed an AI model might struggle to understand a variety of temperature integers, for example. I’m not a Data Scientist and I was making educated guesses based on my intuitions and some data trends I saw to come up with the classifications and help simplify the predictions.

My intuition, and individual data points, suggested the following:

  • I’m more likely to be active when it’s warmer.
  • I’m more likely to be active when I don’t have a lot of meetings.
  • I’m more likely to be active when I’ve been consistently active prior days.

The counter intuitive data I found was:

  • I’m lazier on the weekend (including Friday). Probably because I’m writing long blogs instead of going outside.

Testing the AI Model

Let’s take Joel’s Laziness for a test drive.

Here’s what the model shows.

Power AI

I used the Excel add-in to put in my data points from yesterday that weren’t included in the training dataset. The predicted result of hitting my Saturday goal:

“No”

Exactly right!!! We’re all living in the future!

20190728_195448376_iOS

Wait…what???

I’m Gonna Need Some Detail Over Here

AI Builder is a preview version of a complicated subject, and I want to have realistic expectations. After all, the AI model did get it right.

The problem is – looking at raw data in Excel gave me actionable information, while AI Builder didn’t. Going forward, I need to know the reasons why the prediction is “Yes” or “No”, so I can change my behavior based on the prediction. Looking at the raw data in Excel informed me that I suck at exercise on the weekend.

It’s Sunday.

I’m going for a walk.