Wednesday, February 16, 2011

Prescription Finder Demo

This really isn’t a blog post – it’s just a post so you can find the related materials for the Prescription Finder demo that will appear in video links any time now.
Without a lot of additional explanations, just in case you’ve stumbled upon this accidentally, this is what the demo looks like.
image
You can access the demo files from the SkyDrive folder below.  To run the entire demo, you will need to import the included model into your Predixion Insight account (get a free trial if you don’t have one!)

Enjoy!

Tuesday, February 8, 2011

Data Preparation Webinar Slide Deck

Here’s the deck that I presented at today’s webinar complete with the DAX formulas I added to the PracticeFusion PowerPivot workbook.  You can get the data from the Azure Marketplace or download one of my preloaded copies.
Included in the deck is the coupon code for 50% off the Predixion Insight Cloud service for 3 months – expires 3/15/2011!

Drop me a line or post a comment if you have any questions!  (I’ll update this post when the video is posted)
EDIT:  Webinar replay is available here

Sunday, February 6, 2011

The Full Data Profile - Azure Marketplace Data with PowerPivot and Predixion Insight Part 3

image
In the first post of the series I gave a screenshot of a basic Profile Data report from Predixion Insight, leaving creating the remaining reports as “an exercise for the reader.”  Of course, if you don’t currently have Excel 2010 installed on your system, you may worried that you wouldn’t be able to complete the assignment and might get a bad grade on the pop quiz that’s coming up after the next few posts.  (Just kidding).
Since I got permission to go ahead and post the data and results for my last post, I put the work-in-progress files up on SkyDrive.  To make it easier to see what Profile Data in Predixion Insight really does I embedded the results here for you to explore interactively.    If you want to feel like Gulliver in Lilliput poking through the castle windows you can click around in this interface, otherwise you can click on the “View full size workbook”image button for better access.

This workbook was created by downloading the Practice Fusion data as described here and running the Profile Data tool from Predixion Insight on each table in PowerPivot.  I ran Profile Data twice on each table so you can see the difference imagebetween the “Basic” and “Advanced” profile reports.  Then I just edited the names on  the worksheet tabs and the report titles.  The Insight Index is automatically created and updated to create a nice guide to the workbook – it also updates automatically as you change worksheet names and report titles, so it’s convenient as well.  If you delete rows in your index, or delete the whole page, or somehow do something irreversible to the worksheet (it is in an Excel worksheet, after all), you can regenerate the Insight Index from the Options dialog available under the Predixion menu button.
One more thing I had to do to host the workbook interactively in SkyDrive is to drop all the PowerPivot tables after creating the reports.  The Excel file was between 9 and 10 MB which is too large for viewing in the browser.

Advanced Data Profile

I explained a bit about the basic data profile at the start of this series, so I’ll just explain briefly the difference.  Essentially the difference is that you just get more stats with “Advanced” than you do with “Basic”, plus the report takes slightly longer to execute as it has more to compute.
For numerical columns, Advanced adds measures such as Kurtosis and Skewness which measure the “normality” of the data – that is – how well the data conforms to a bell curve, an approximate median, the mode, and the confidence interval.  For those who aren’t familiar with these terms, they are defined with links to appropriate Wikipedia articles in the column headers.
The Advanced Profile Data report also contains correlation and covariance matrices for numerical columns.  Looking at the correlation matrix for the SyncChart table, for example, shows a clear correlation between Weight and BMI, and a negative correlation between Height and BMI.
image
For categorical columns, the Advanced report adds the top and bottom 3 states present in the column, as well as a number representing the top 80% of the states in the data.  This number tells you how many values of the column cover 80% of the data.  Using the SyncChart example again, you can see that although there are 39 different physician specialties represented in the data, 80% of the visits are to only 3 types of physicians.
imageimage
A good use of the top and bottom states is to let you know if the data is particularly useful.  For instance the PhysicianSpecialty row above shows that the bottom three states appear only once in the data.  This indicates that, for Predictive Analytics at least, you will not find any patterns regarding Naturopathy-Acupuncture, Dermatology, or Physical Medicine & Rehabilitation using this data.  A good practice to deal with data that shows up with way is to use the Clean Data/Outliers tool to rename such states to “Other”.  (Personally, with this data, I would also use Clean Data/Relabel to change blank states in this columns to “Unknown”).

How do get this stuff

Just to recap for those who haven’t read the other posts, the you can get the tools used to create these reports from the following locations:

Friday, February 4, 2011

Azure Marketplace Data with PowerPivot and Predixion Insight Part 2 - How tall am I anyway?

This post follows from my previous post on Cleaning Azure Marketplace Data.  I recommend skimming that post prior to reading this one and possibly following through the steps.  However, I did meet Matt Douglass of Practice Fusion at the Strata conference in Santa Clara, CA this week, and he graciously gave me permission to post my workbooks containing the practice fusion data as I progress so you can shortcut the steps and jump in at any time in this series.

image

Looking more into the Practice Fusion data, I took some more interest in considering the Height column that I cleaned up there. It got me thinking about what I could learn more about “Height” of these patients. 

First, here’s what you need to follow along with this post:

Part 1 – What is height?

I want to see trends on height over time, so I:

  • Create a Pivot Table from the PowerPivot ribbon
  • Add my “Height with Outliers Removed” column from the SyncChart table (that I created last post) to the Values well
  • Set the “Summarize By” property on the value to “Average”
  • Add the “YearOfBirth” column from the SyncPatients table to the Axis Fields well

At this point PowerPivot prompts me that a relationship may be needed, so I allow PowerPivot to create the relationship, which it does correctly, and with some formatting I have a nice chart that looks like this:

image

Wow – how simple was that!  We took the cleansed data and easily created a chart allowing PowerPivot to automatically create relationships among multiple tables that were downloaded from a public cloud source.  Pretty cool – except that it’s wrong.

Well, “wrong” may be a bit harsh - “misleading” may be a better term.  You see, we didn’t create a chart showing the Heights of Patients by the year they were born, we created a chart showing the height measurements taken by doctors averaged by the birth year of the patient.  I’m not exactly sure why that would be useful.  The impact of that is, for example, if there were two patients born in 1920, and one was 60 inches tall and the other was 70 inches, but the shorter patient went to the doctor 4 times and the taller only once, we would see the average for 1920 to be 62 inches ( (60*4 + 70*1)/5 ) rather than what we might expect at 65 inches ( (60 + 70)/2 ).

Understanding Height

So what we need do to is to define what “Height” means for a Patient rather than a Visit (each row in the SyncChart table represents a doctor’s visit).  This type of attribute creation is very common when performing analyses – particularly for predictive analytics.    To create a “Height” attribute we have to decide what “Hieght” means in terms of our data – this generally requires business understanding of the data, making assumptions of the data, or both.  With the PracticeFusion data cleaned from the previous we have 0 or more measurements of height for each patient with extreme values removed.  In this case, I’m going to use the average of all the height measurements.  Realize that this assumes that any particular individual’s height didn’t change significantly – which is generally true if the patients are adults.

Given that the patients being adults is a hypothesis rather than a known fact, means that I should verify through experimentation.  I went to the PowerPivot window and added a calculated column to the SyncChart table with this expression:

=SyncChart[VisitYear]-RELATED(SyncPatient[YearOfBirth])

I named that column “Age at Visit Time” and created the table below showing that out of almost 60,000 visits, only a handful had a potential to have an unexpected growth spurt.  (Note that this was only possible because of the relationship between SyncChart and SyncPatient that was created at the beginning of this blog post.)  To me, this validates that using the average height measurement across visits is a reasonable value for an individual patient’s height.

Age Count of ChartGuid
14 2
16 9
17 140
18 331
19 482
20 479
21 459
… …

 

Defining Height

Now that I’m convinced I know what “Height” is, I added another calculated column in the PowerPivot window to the SyncPatient table with the expression:

=AVERAGEX(RELATEDTABLE(SyncChart),
          SyncChart[Height with Outliers Removed])

and named it simply “Height”.  Creating a PivotTable and measuring the difference shows that in just the first few rows you have a difference of almost 3 inches – clearly showing the problems with the initial “naive” approach.

YearOfBirth Patient Height Chart Height Diff
1920 62.0 61.1 0.87
1921 62.9 60.2 2.77
1922 64.1 64.1 0.02
1923 63.7 63.7 0.06
1924 63.8 64.9 1.16
… … … …

FYI – due to the way PivotTables in Excel work, in order to make the “Diff” column I had to create a separate column outside of the PivotTable.  Also, I couldn’t simply click in the cells like “=” click “-“ click and drag down since Excel generates a call to GETPIVOTDATA that has embedded strings that don’t change when you drag down.  So I typed direct cell references (e.g. =ABS(C28-D28) ) and dragged the expression down along the PivotTable.

Part 2 – Pedantic Disclaimer

Now as a side note, I do want to apologize for maybe being overly pedantic about this process.  I am trying to make sure I don’t have any of those moments where it’s very clear how you get from A to B and from C to D, but the path from B to C is a complete mystery, so I’m being liberal with throwing in all the side streets that come to mind, so pardon the stream of consciousness approach.

Part 3 – Back To the Topic – How tall am I anyway?

So now that I have determined the meaning and semantic of “Height” – I can inspect its value for each patient – so exciting!

PatientGuid Height
{0003CBB3-40EF-493F-9906-B8EF9F7E7B11} 63.3
{000D7634-7A8C-4CAD-895F-C241F19669DA} 60.0
{0016F7D0-EABF-4D55-BEA7-B08F7F8567FD} 70.7
{002FC25B-A761-4039-8507-E6FE59B19833} 66.0
… …

However, the problem with this “Height” metric is that although I have a measure, I still don’t really understand how “tall” they are.  This is because our idea of “tallness” is purely based on how their height relates to other people’s heights.  To use some five-syllable words, the values shows how tall they are quantitatively, but not qualitatively.  In order to understand an individual’s “tallness” we need another metric.

The way we create this metric is to use Predixion Insight’s data preparation tools to normalize the Height data.  Normalization is a process in which numeric data is transformed so that values can be more easily compared.  Predixion Insight supports three types of normalization – Z-Score, Min-Max, and Log.  While Min-Max and Log normalization are fascinating topics in their own right, in this case we will be using Z-Score normalization.

In short, Z-Score normalization transforms a value by first subtracting the average of all values and then dividing the result by the standard deviation of the values.  Assuming a normal bell-curve style distribution, the resulting value has some interesting properties.

The chart below from wikipedia shows that if, after normalization, a value has a Z-Score of 0, the value is perfectly average, whereas if the value is 1, it is larger than 84.1% of all values.  Therefore, if a person has a Height that has a Z-Score of 1, we can confidently say that person is “tall”, and if the Z-Score of their Height is –1, they most definitely are “short.”

File:Normal distribution and scales.gif

So walking through the normalization wizard in Predixion Insight is straightforward.  First you click on the Clean Data menu button in the Prepare Data chunk of the Insight Analytics ribbon.

image

Next you read the very helpful and instructive text on the introductory page and advance to the data selection page where you choose that you want PowerPivot data and the SyncPatient table.

image

Then you choose which columns to normalize.  Good thing to remember for future use is that you can normalize all  the numeric columns in a table at once, which is a great time saver.  In this case, there’s only a single column that is useful to normalize, so I ensure that only the Height column in selected.

image

Finally, we choose “Normalization Options” which is the normalization type and some grouping options.  Grouping Options we will get back to, but you can select the different types of normalization to read the fun and informative descriptive text.  Alternatively, you can leave the defaults as they are and just click “Finish”.

image

The effect of the wizard is to add a new “Height Normalized” column to your workbook with the following expression:

=IF(ISBLANK('SyncPatient'[Height]), BLANK(),
   IFERROR(('SyncPatient'[Height]-
    AVERAGE('SyncPatient'[Height]))/SQRT(
     SUMX('SyncPatient', IF(
        ISBLANK('SyncPatient'[Height]),0,
          ('SyncPatient'[Height]-
           AVERAGE('SyncPatient'[Height]))^2))
   /(COUNT('SyncPatient'[Height])-1)), 0))

You might want to copy and paste that somewhere for safe-keeping so you can do a search and replace whenever you want to use it in PowerPivot, or you can just use Predixion Insight and let the wizard do it for you.

Taking the table from above of patients and heights and adding the new “Height Normalized” column, you now have some qualitative information

PatientGuid Height Height Normalized
{0003CBB3-40EF-493F-9906-B8EF9F7E7B11} 63.3 -0.7
{000D7634-7A8C-4CAD-895F-C241F19669DA} 60.0 -1.5
{0016F7D0-EABF-4D55-BEA7-B08F7F8567FD} 70.7 1.1
{002FC25B-A761-4039-8507-E6FE59B19833} 66.0 0.0
{0032D035-1A8C-40FC-B4A7-6A5B8DA93D06} 70.0 1.0
{00453E13-85AD-45B9-9D93-C5BCF0ABEA54} 56.6 -2.3
{005B6A30-C5CE-4588-B77B-2550174D6CE1} 66.0 0.0
… … …

You can now tell that the first two patients are “short” and the third is quite “tall”.  However, and you knew this was coming, and not just because of my effective foreshadowing above, the data can still play tricks on you.

If I go and add an additional feature to the report – Gender – we see that there is more interpretation of the data to be done.  Basically we see that the normalized values are telling us that women are “short” (they have mostly negative Z-Scores) and men are “tall” (they have mostly positive Z-Scores).  Since our “business knowledge” of the world around us tells us “duh” we need to do a little more work.  Wouldn’t it be nice if we could normalize women separately from men?

PatientGuid Gender Height Height Normalized
{0003CBB3-40EF-493F-9906-B8EF9F7E7B11} F 63.3 -0.7
{000D7634-7A8C-4CAD-895F-C241F19669DA} F 60.0 -1.5
{0016F7D0-EABF-4D55-BEA7-B08F7F8567FD} M 70.7 1.1
{002FC25B-A761-4039-8507-E6FE59B19833} M 66.0 0.0
{0032D035-1A8C-40FC-B4A7-6A5B8DA93D06} M 70.0 1.0
{00453E13-85AD-45B9-9D93-C5BCF0ABEA54} F 56.6 -2.3
{005B6A30-C5CE-4588-B77B-2550174D6CE1} M 66.0 0.0

Well as we have it, we can.  Run through the Normalization Wizard just as above but stop on the Normalization Options page.  This time choose the Grouping Option “Group By” and select “Gender.”  This does just what we want.  Women’s heights will be normalized among women, and men’s against men.

image

Again, Predixion Insight updates the PowerPivot table by adding a calculated column – this time entitled “Height Normalized By Gender”.  I’m not going to put the expression here – it’s basically the same as the one above but with several CALCULATE and ALLEXCEPT expressions thrown in for good measure – besides, the curious can see the expression by downloading the resulting workbook and taking a look for yourself.

This time the results look a little different

PatientGuid Gender Height Height Normalized Height NormalizedByGender
{0003CBB3-… F 63.3 -0.7 -0.1
{000D7634-… F 60.0 -1.5 -1.3
{0016F7D0-… M 70.7 1.1 0.5
{002FC25B- … M 66.0 0.0 -1.0
{0032D035-… M 70.0 1.0 0.3
{00453E13-… F 56.6 -2.3 -2.5
{005B6A30-… M 66.0 0.0 -1.0
… … … … …

This time we see that that first woman isn’t really all that short – just a hair under average, and the first man isn’t quite as tall as we thought.  With this information we now have an accurate understanding of the “tallness” of each individual that makes sense in terms of how we comprehend the real world.

Hey – to make it even nicer, we can add some quick conditional formatting to the normalized by gender column to get a quick heatmap of gender relative tallness – something you simply could not do without this technique.

image

Although this example is on a sample dataset, you can easily apply this technique to a variety of applications.  For example, if you were looking at mean time to failure of a common mechanical part, you could normalize by the device in which it was installed.  Or if you were interested in housing prices, you may normalize by zip code. 

For your convenience, I put the end result of this experiment on SkyDrive as well.,

In case anyone is interested, my current “tallness” is between 0.1 and 0.2, so I guess I’m “tall-ish”, but not particularly so :).

Monday, January 24, 2011

Cleaning Azure Marketplace Data with PowerPivot and Predixion Insight

image
Thanks to some connections at Microsoft I was made aware of some very interesting data that was published on the Windows Azure Data Marketplace by Practice Fusion – deidentified medical records of 5000 patients.  Of course, I had to take a look.  What I found was a very compelling and interesting set of data, that was more interesting when looked through the lens of Predixion Insight.  Of course, as with any data that you may get from anywhere, there are first some issues in the data itself that need to be “corrected” before used for any analysis.
In this post I’ll show you how to get that data, explore a little bit of it, and clean up one particular part.  There’s lots more to do, but this is just getting your feet wet.
In order to follow along at home, you will need Excel 2010, PowerPivot (get here), Predixion Insight for Excel (get here).

Step 1 – Loading the data

After you have all that software installed and running on your machine, you will want to go to the Practice Fusion Data page on Windows Azure and subscribe to their feed.  If you haven’t subscribed to any the data market before, you will first have to agree to the MS terms of service to subscribe to the data market.  After that you will have to agree to Practice Fusion’s terms of service and that will give you access to the data.  Ignore the button there that allows you to load data directly into PowerPivot.
The most efficient way to get all of the data is to go directly into PowerPivot, so launch Excel (or just create a new workbook since you probably already have Excel running anyway) and click on the PowerPivot button to get to the PowerPivot window.
Get External Data
PowerPivot Ribbon Section
Inside the PowerPivot window you will need to click the “From Azure Marketplace” button in the Get External Data chunk of the ribbon shown below.  If you’re saying “Hey! I don’t have that button!” don’t be afraid.  Microsoft quietly updated PowerPivot at least twice since it was released – go and download the latest release and try again – trust me – it will be there.
The From Azure Marketplace Button launches the import wizard where you want to paste in the root URL for the data feed which is: https://api.datamarket.azure.com/Data.ashx/PracticeFusion/MedicalResearchData/
Also you will need to enter your account key, which, up to this point, you probably didn’t know you have.  However clicking on the Find button will launch a web page displaying your unreadable key that you can copy and paste here.
Specifying Data Feed
Table Import Wizard – Specifying the Data Feed
After that, select all the tables and click finish.  Loading the data from the marketplace takes a little longer than you would expect – not “come back tomorrow” kind of long, but definitely the “I can’t be late for my daughter’s junior high school recital and if I take the laptop, I’ll lose my wireless connection” kind of long.  So click finish and go to lunch, or get a coffee, or catch up on reading the Predixion Insight documentation or something.
Selecting Tables
Table Import Wizard – Selecting all the Practice Fusion Tables

Step 2 – Initial Data Exploration

One of the somewhat interesting things about loading data from an unknown source is that you have absolutely no idea what you’re looking at.  This is where you can leverage the awesomeness of Predixion Insight’s Profile Data tool.  This tool provides a quick summary of the data in an Excel worksheet or PowerPivot table so you can at a very minimum determine if the data makes any sense at all.
imageProfile Data Command in Predixion Insight 
To run Profile Data, switch back to the Excel interface, click on the Insight Analytics ribbon and choose Profile Data under the Explore Data menu button.  In the Profile Data Wizard, you just need to select that you are choosing PowerPivot and the source of the data and which table you want – in this case, let’s use the SyncChart table which documents the basic patient measurements over a series of doctor’s visits.
Profile Data Select DataProfile Data Select Data Page
Next you choose the type of statistics – I really like using “advanced” statistics because it makes me feel smarter ;), but for initial exploration the default “basic” stats will suffice, so stick with the default and just click “Finish”
Profile Data Options
Profile Data Options
As a result, Predixion Insight will scan the table and produce a report on all of the columns in the PowerPivot table, as well as a handy index sheet to easily find the report in your workbook (which at this point should contain the report, the index, and three blank sheets, so it’s no biggie, but you know it will get more populated as you go on…).  I can’t recommend strongly enough that, for your own sanity, you go ahead and run Profile Data on all of the tables in PowerPivot (see, that index will come in handy very quickly….)
In any case, let’s have a look at what Profile Data discovered.
image
Results of Profile Data on the SyncChart table
First of all, Profile data did us a great service by simply telling us how many rows and columns are in the table – since we just randomly (well, not quite) pulled some data from the internet we had no idea what was in there, Profile Data let us know that we have 59,193 rows and 12 columns, and that the column ChartGuid is likely a key since it uniquely identifies each row (i.e, there are 59,193 unique values of ChartGuid).
Next the Profile Data report breaks the results down into a Continuous section and a Discrete section.  The Continuous section contains information on columns that contain numerical data.  The Discrete section contains information on columns that contain non-numerical data, or numerical data that “look like” they could be considered categorical, such as a column that contains just 0’s and 1’s.
One thing that stands out fairly immediately is that there is a lot of missing data in this table.  All the continuous columns, save VisitYear, have over 23,000 blanks, and the HeartRate column is completely empty – i.e. it has 59,193 blanks in 59,193 rows.
Feel free to examine the resulting report for interesting pieces of information but for expediency’s sake, I want to point out some data that just looks wrong.  Take a look at the ranges of values for Height, Weight, and BMI
image
Focus on Height, Weight, BMI
Now, not having any background in the data, we don’t know what units height and weight are measured in, but regardless of the units, the ranges are simply too extreme – given inches, feet, or centimeters, you simply don’t have the range of heights from 5 to 120 in human existence!  Similarly with weight!  BMI is unitless, but still with the range from 0.07 to 5511 you have quite the unnatural Jack Sprat situation going on here.
Looking at the results for the height column a little further indicates that there is a mean of 65 and standard deviation of about 5.  This would indicate (to me, at least) that the intended units are inches, since the average height of humans is around 65 inches and not 65 centimeters or 65 feet or miles or whatever.  So I’ll go ahead and decide that it’s inches.  It would make sense that the weight would be in pounds since the height measurement is not using the metric system either, but looking at the average weight of 180 indicates that the value, while still high (this is America, anyway) isn’t likely to be kilograms or stone or other values.
Still, we need to figure out what is going on with those other values, so let’s move on to Step 3.

Step 3 – Cleaning up the data

Cleaning up data like this is never automatic – you need to use tools and apply your judgment.  Just like we were able to use the Profile Data tool to help us understand the nature and deduce the units of the data, we need to apply the same common sense treatment to cleaning the data.
The first question to ask is what do you really want to do with the erroneous data?  Since these are medical records recording actual values of patients, the safest thing to do may be simply to null out the data for values that are out of range.  However, since there are several rows for each patient, and people (once fully grown) generally don’t change in height too much, it may be OK to simply take a height measurement from another chart reading for the same patient.  It really depends on how you’re going to use the data, so I’ll perform both methods.
Let’s take the “whack the bad data” approach first.  To do this, I’m going to use the Outliers tool from Predixion Insight which is under the Clean Data menu button on the Insight Analytics ribbon.
image
Clean Data/Outliers
Selecting this tool brings up the Remove Outliers ribbon which allows you to truncate the extreme ranges of numerical values or remove categorical values that occur infrequently (or even too frequently) from your data.  First you need to select that you are interested in the PowerPivot table called SyncChart (as above) and then you select the column from which you want to remove the outliers.  You can select via the drop down or by clicking on the column preview.
image
Outliers Column Selection
Next this brings up a chart of the values in the Height column.  The higher the curve the more values are in that range.  Personally, I like to increase the resolution of the chart to the maximum (100) so I can get the best view of the data – this sometimes doesn’t work well if there are a small number of data points, but this data set is sufficient.  As you can see most of the data lies in the middle of the range with extreme values tapering off quickly.  You can mouse over any point on the cart to see the range that point represents and how many rows have values in that range.
image
Remove Outliers Chart
To remove the outliers you simply drag the thumbs on the slider above the chart to whatever cutoff point you wish, or type in the limits into the text boxes directly.  When you click next you get to the “what do I do with this?” screen.  Again, the answer really depends on your application.  For some problem spaces, it may be OK to set the extreme values to the limits or to the mean.  In this case, we’re simply going to null out the value – the default option – and click next.
Remove Outliers Options
What do we do with a drunken data entry operator?
Which leads us to the final screen  - name the result column – it’s good to pick a descriptive name.  Finishing the wizard creates a calculated column in PowerPivot that nulls out any data that’s out of range.  This has an added benefit in that if you refresh the table with new data, any new out of range data will automatically be set to null.
Select Destination
Finishing the Remove Outlier Wizard
Inspecting PowerPivot, we see that Predixion Insight injected the following DAX expression:
     =IF(AND('SyncChart'[Height]>= 48.99, 'SyncChart'[Height]
      <85.28),'SyncChart'[Height],BLANK())

This expression simply copies the in-range values and replaces the out of range values with blanks.
Before looking at the results, I want to try the other method of removing outliers I proposed – using the average of a patient’s other visits.  To do this I used the following custom DAX expression:
   CALCULATE(AVERAGEX(SyncChart, SyncChart[Height]),
       ALLEXCEPT(SyncChart, SyncChart[PatientGuid]),
       SyncChart[Height]>48.99,
       SyncChart[Height]<85.28)

This expression basically says, calculate the average of the Height column by first removing all filters except for a filter on the current rows PatientGuid Column, and also exclude any rows where the Height is out of range.  I copied the IF expression created by Predixion Insight and replaced the part that says “BLANK()” with this custom expression.  I renamed the new column “Height with Outliers Replaced”
The next thing I want to do before looking further is calculating the BMI.  The BMI was included with the data, but is really a derived column.  The formula for BMI using inches and pounds is BMI=Weight * 703/Height^2.  In order to protect against divide by zero errors, I put an IF in the DAX expression to check for blanks and created two columns like this:
     =IF(ISBLANK(SyncChart[Height with Outliers Removed]),
            BLANK(),
           SyncChart[Weight]*703/POWER(SyncChart[Height with Outliers Removed],2))

(Obviously one had the Outliers Replaced version of the column).
To see the impact of the results, I re-ran Profile Data against the SyncChart table with the new columns. Here are the results:
Profile Data Results
The first thing I noticed is that the Height with Outliers Replaced column has no blanks – this means two things – one, that every patient has at least one doctor’s visit where they have a height measurement, and two, I should have checked for ISBLANK in my expression to calculate that Height value!
The other things to notice is that the fixed height values are much more in line with reality  - we’ve eliminated the pixies and the hill giants (frost giants are much taller).  Also, the recomputed BMI values are starting to be more realistic as well.  In fact we reduced the maximum BMI from over 5500 to 250 by only removing 317 values from 59193 rows – about 1/2%! 
To complete the exercise and ensure that the BMI values were reasonable we would have to clean the Weight column as well, which we do by running through the Remove Outliers wizard again.  However, there’s actually one more trick.  When looking at the outliers for the Weight column, we get a chart that looks like this:
Specify Thresholds
This occurs when you have a range of outliers that includes extremely large outliers that obscures the resolution of the data.  To get a better view of the data, you can click the logarithm button – circled below – and get a much more usable visual – I also increased the resolution:
Specify Thresholds Log
I removed the extreme outliers (rather arbitrarily choosing a range of about 33 – 510 lbs, which is still probably pretty extreme) replacing them with nulls.  I didn’t try to do the “replace with other visits” trick, since people’s weight can fluctuate quote a bit from visit to visit.
Creating a new BMI column and re-running the Profile Data gave me results like this (other rows hidden):
Profile Data
You can see the range of BMI values went from an original 5511 to a more reasonable 78.  It’s very likely (pretty much guaranteed) that I could have more tightly truncated both the height and weight variables to make them more inline with reality, but this is a good start. 
Some deeper inspection of the data may be necessary to find the correct boundaries, and of course it always depends on how you are going to use the data.  For predictive purposes, it generally is better to eliminate extreme values even if they are valid since they can skew the results.  For traditional BI reporting – e.g. “how many visits were by people over 9 feet tall” – you generally want to keep any valid value, no matter how extreme.  In either case, however, you do want to eliminate invalid values.  Luckily with this data set, by combining common sense with the tools at hand we’re able to carve away at the bad data to make the remaining data useful for analysis.
That just may happen in a future post… ;)

Thursday, December 9, 2010

Predixion Insight Update

image

 

We just launched a new, incremental version of Predixion Insight with a whole bucket load of new features – some subtle, some more obvious and in your face.  Actually – many you shouldn’t even notice – just have a feeling of the product being “better” all around.

In this posting I’ll just give a quick overview of some of the new additions and later I’ll get around to providing details on all the goodies.  It’s better if you just try them our for yourself anyway – if you are a current user, just log in and you’ll be prompted to update, and if not what are you waiting for?  (One great new “feature” is that we’ve extended the free trial to 30-days, to give you ample time to check everything out!)

So I’m going to tell you about new features in my trademark stream of consciousness – no particular order kind of way.

Normalization

image

The Normalization allows you to normalize data in Excel or PowerPivot by Z-Score, Min-Max, or Logarithm.  It’s actually really cool because you can normalize all the data at the same time instead of column per column.    Also, if you’re normalizing PowerPivot data, you can conditionally normalize so you can get Z-scores by group.  Way cool.

 

 

 

Explore Data

image

We added additional data exploration options so the “Explore Data” button became the “Explore Data” menu and the previous “Explore Data Wizard” became the “Explore Column Wizard”.

Profile Data provides descriptive statistics about your Excel or PowerPivot data.  I won’t say too much about it here since Bogdan already wrote up an excellent post just on this feature! 

Also, Explore Column has an added button to allow you to look at your data (and bin it!) in log space.  All your data scrunched up on the side?  Click the “log” button and see it spread out with a nicer, friendlier distribution.  This button also shows up in the Clean Data/Outliers Wizard as well.

Getting Started

image

I guess I really should have put this one first, despite this being stream of consciousness.  Anyway, noting that customers were having a hard time finding our sample data, help and our support forums, among other things, we added a handy (and pretty) Getting Started page.

 

PMML Support

image

In the Manage My Stuff dialog you can import models from SAS, SPSS, R, and any other PMML source.  You can then use all of the model validation tools and the query wizard to score and validate against data in Excel and PowerPivot.  Way to leverage your extend investment in predictive analytics tools to the Excel BI user base!

Insight Index and Insight Log

image The Insight Index is an automatically created guide to all of the predictive insights and results you create with Predixion Insight.  This guide provides descriptions of every generated report along with links to each report worksheet that are automatically updated when you rename worksheets and change report titles.  The Insight Log automatically maintains a trace of all Predixion Insight operations that generate Visual Macros.  These operations can be re-executed individually or copied to additional worksheets to easily create custom predictive workflows.  Both of these features can be turned on or off in the options dialog.

VBA Connexion

Predixion Insight now supports VBA programming interfaces allowing you to create custom predictive applications inside Excel.  It’s like super hard – for example, look at this excerpt I wrote for a demo that applies new data to an existing time series model so you can forecast off of a short series:

image

Oh, wait – it’s not hard – it’s easy!

Visual Macros

image

While we’re on the topic of Visual Macros, I should mention that Visual Macros now support all of the Insight Now tasks as well as the Insight Analytics tasks.  This means that you can easily encapsulate any operation we perform on the server in a macro and use it to string together your own workflows.

Other stuff working better

There are always little things here and there that are better as well that you don’t notice until you get there – the Query Wizard is cleaner and easier to use.  Exceptions – even ones caused by data entry – give you an immediate way to provide feedback directly to the dev team.  And I can’t even begin to talk about how much better our website is!  (Mostly because I’m out of time to write this post – HA!)

Really – try it out and let me know what you think.  If you’ve tried it before go check out what’s new – if not, now is a wonderful time to do so, it’s lookin’ pretty good.

Tuesday, September 14, 2010

And launched! (plus some secrets)

Yesterday we officially launched our first  offering from  Predixion Software – titled “Predixion Insight”.  For those who haven’t been following along, Predixion Insight is a cloud predictive analytics service access through an embedded Exceyippeel client (Predixion Insight for Excel) that has absolutely no infrastructure or procurement friction and works with Excel 2007 and botht he 32-bit and 64-bit versions on Microsoft Excel.  Oh – and it’s also directly integrated with Microsoft’s new PowerPivot offering allowing powerful analytics, business modeling and now, predictive analytics, right in the Excel working environment.

We actually closed down the beta and turned on Insight’s lights a week ago today.  Coming from a “packaged software” background it was interesting that shipping software in a cloud environment all boils down to switching a DNS entry on GoDaddy.com and we’re up and running.  We actually had one customer forego the free trial and become our first paying customer on day one!  A lot of our beta customers came back to take advantage of the free trial (sign up here if you haven’t already) and our service has been humming along making predictive magic for everyone quite nicely.  I do thank all of our beta customers for helping out and finding issues based on configurations and connection performance that would have been difficult for us to find out on our own – we also managed to incorporate quite a bit of feedback from the beta into the product.

On Friday we celebrated the launch in the dev offices with a toast of Pyrat Rum and then heads down to keep the Predixion train going.  Personally I’ve been busy with Simon, our CEO, demonstrating the product to industry analysts – 20 so far, and many more to come – and getting great feedback and some exciting responses (first published notes here, here, and here), while designing elements of our Enterprise offering as well as some exciting incremental functionality.

One interesting thing about any product release is always what is the last feature to make the cut.  What is that last piece of functionality that you just need to put in or that you want so badly that it gets in no matter what.  In our case it’s all in the task pane of Predixion Insight for Excel – the task pane was definitely the runaway surprise success story for the beta – one participant even responded “I wish all software worked that way.”  Given how happy people were with this feature, and we always wanted to add a little more functionality, we made sure that search and filter made it into v1.

image With this feature you can type arbitrary text and Predixion Insight for Excel will search all fields (including extended info) of each task and only display the results, or you can filter based on task type or items that are expiring soon.  Neat, huh?  Ok, maybe just “ok”.  Anyway, since you’ve already downloaded, installed the software, and signed up for a free trial, you may have noticed that if you select one of those filtering options it actually places something in the search box like this:imageThis is totally meant to imply that there can be other things you could “type” into the search box to filter your tasks, and as of today, this is the only place you’ll ever find out about what they are.  Search tags usage is simply “tag:value”  if the engine finds the “tag:” starting the search string it uses it – plain and simple – it’s not even case-sensitive.  The super-secret Predixion Insight for Excel search tags are:

Tag Value Description Example
tasktype InsightNow
Modeling
Test
Query
Management
Returns tasks of the specified task tasktype:Query
expires integer hours Returns tasks expiring within the specified number of hours expires:48
created integer hours Returns tasks created within the specified number of hours created:2
duration integer minutes Returns tasks with a duration less than the specified minutes duration:1
completed (optional)
true
false
Returns tasks that have completed, or not completed:
results (optional)
true
false
Returns tasks that have results to download, or not results:
status succeeded
failed
pending
Returns tasks with the specified status status:pending
tag any string Searched only the “tag” field of the task – i.e. the large bolded text tag:Profit Chart

You can add a bang (!) to the beginning of the tag to return any results not specified by the filter – for example you can get all the tasks created in the last hour by using the string “created:1”, and you can return all the tasks not created in the last hour by using the string “!created:1” – very handy indeed.

Oh, and just for a bonus, you can edit the “tag” (large bolded text) of any task for  your own personal edification – that is, you can change “Profit Chart” into “My Superbad Market Mayhem Chart” and then find it with the search “tag:Superbad”

Anyway, that’s what is there for now – who knows what may come as Predixion Insight grows…..