Data Science Desktop Survival Guide
by Graham Williams |
|||||
Risk Variable |
20180723 With some knowledge of the data we observe risk_mm captures the amount of rain recorded tomorrow. We refer to this as a risk variable, being a measure of the impact or risk of the target we are predicting (rain tomorrow). The risk is an output variable and should not be used as an input to the modelling—it is not an independent variable. In other circumstances it might actually be treated as the target variable.
# Note the risk variable - measures the severity of the outcome.
risk <- "risk_mm"
For this risk variable note that we expect it to have a value of 0 for all observations when the target variable has the value No.
|
# Review the distribution of the risk variable for non-targets.
ds %>% filter(rain_tomorrow == "No") %>% select(risk_mm) %>% summary()
Interestingly, even a little rain (defined as 1mm or less) is regarded as no rain. That is useful to keep in mind and is a discovery of the data that we might not have expected. As data scientists we should be expecting to find the unexpected. A similar analysis for the target observations is more in line with expectations.
|
# Review the distribution of the risk variable for targets.
ds %>% filter(rain_tomorrow == "Yes") %>% select(risk_mm) %>% summary()
|