Predicting Health Outcomes
Correlation Matrices
What are the indicators of healthy hearts?
How is machine learning different from statistics?
How are machine learning and artificial intelligence similar to each other? How are they different?
What does Machine Learning do?
In what everyday scenarios can machine learning be used?
Streaming Platforms
Marketing and Advertising
Transportation
Banking and Finance
Historical Research
Music
Natural Language Processing
Biology Research
Medicine
“Cardiovascular disease - like heart attacks and stroke - may seem like an elderly disease. But studies have shown that cardiovascular events are happening more and more frequently in people as young as 20.”
P100 wellness study correlations
Framingham dataset correlations
Correlation or Causation?
Liam collected data on the sales of ice cream cones and air conditioners in his hometown. He found that when ice cream sales were low, air conditioner sales tended to be low and that when ice cream sales were high, air conditioner sales tended to be high.
Correlation or Causation?
Correlation: there is a relationship or pattern between the values of two variables.
Example: Liam found that when ice cream sales were low, air conditioner sales tended to be low and that when ice cream sales were high, air conditioner sales tended to be high.�
Causation: one event causes another event to occur. Causation can only be determined from an appropriately designed experiment. In such experiments, similar groups receive different treatments, and the outcomes of each group are studied. We can only conclude that a treatment causes an effect if the groups have noticeably different outcomes
Example: Liam did another study and found that when ice cream sales were low, temperature was low and that when temperatures were high, ice cream sales were high, and air conditioner sales tended to be high.
3 types of correlation:
Positive correlation
As x increases, y tends to increase.
Negative correlation
As x increases, y tends to decrease.
No correlation
As x increases, y tends to stay the same or have no clear pattern
By the end of this activity, you’ll create something like this!
Feature vs. Variable
Definition:
The Framingham Heart Study Background
How can machine learning be used to accurately predict a patient’s risk of developing CVD?
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
1
2
3
4
5
Classify variables
1
Classify variables
1
Your turn:
Classify the variables in your
Framingham dataset
Systems Medicine, 2019
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
✔
2
3
4
5
Address “null variables”
2
Address “null variables”
2
Address “null variables”
Your turn:
Find and address null values in your dataset.
2
Systems Medicine, 2019
Address “outliers”
2
Address “outliers”
2
Address “outliers”
2
Address “outliers”
2
Continuous variables only!
Input this formula into D:19
=OR(MAX(D2:D11)>D17, MIN(D2:D11)<D15)
Address “outliers”
Your turn:
Find and address outliers in your dataset.
2
Systems Medicine, 2019
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
✔
✔
3
4
5
Calculate correlation
Positive correlation
As x increases, y tends to increase.
Negative correlation
As x increases, y tends to decrease.
No correlation
As x increases, y tends to stay the same or have no clear pattern
Pearson’s correlation coefficient closer to 1
Pearson’s correlation coefficient closer to -1
Pearson’s correlation coefficient closer to 0
3
Calculate correlation
3
Pearson’s Correlation formula
Calculate correlation
3
Sum of squared deviations (x)
Sum of squared deviations (y)
Codeviance
Calculate correlation
What is the purpose of the Pearson’s correlation formula? It tells us how closely our data aligns with the average x and y values, or how well x and y are correlated.
How does it mathematically achieve that purpose? We add all the differences from the average values of x and y in a standardized way.
3
Pearson Correlation
3
r = +1.0
r = +0.7
r = 0
r = -0.46
Calculate correlation
Your turn:
Create two scatter plots with your dataset. What do you notice?
3
Systems Medicine, 2019
Calculate correlation
3
Calculate correlation
Your turn:
Calculate correlation using Pearson’s Correlation Coefficient with your dataset.
3
Systems Medicine, 2019
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
✔
✔
✔
4
5
Visualize your data
4
Visualize your data
Your turn:
Create a heat map of your data correlation matrices.
4
Systems Medicine, 2019
Visualize your data
4
Bias, Errors, and/or Pitfalls
We’ve found a correlation that fits the above data… but will it hold up for a larger dataset like the one on the right?
Let’s apply what we’ve learned to an even larger dataset!
Your turn:
Create a correlation matrix using a larger dataset. �Then visualize the data.
Systems Medicine, 2019
Calculate correlation
3
Our outcome of CVD
So what?
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
✔
✔
✔
✔
5
Select features
5
Select features
5
Select features
Orange sections: A features contribution in explaining the outcome
Red section: Mutual information provided by both features.
5
Select features
Weight
Age
BMI
Model
Weight
Age
5
Select features
5
Select features
5
Select features
5
Select features
5
Select features
Your turn:
Write down features correlated with each other (feature to feature) and features that are not correlated with CVD (feature to outcome).
5
Systems Medicine, 2019
Select features
5
Select features
Your turn:
Remove variables correlated with one another. And create a Circos plot.
5
Systems Medicine, 2019
Circos Plot Visualization
What are the indicators of healthy hearts?
Address “null variables” and “outliers”
Classify variables
Select features
Visualize your data
Calculate correlation
Correlation Roadmap
✔
✔
✔
✔
✔
Logistic Regression!
Next step…
What are the indicators of healthy hearts?