I'm trying to do customer segmentation by using PCA to reduce dimensionality and then feeding the resulting principal components into a K-means algo to get at the final segments. Some of my variables are percentages. For example, conditional on arrive on a particular section of the site, what percentage when on to purchase something. The problem with these percentage variables is that they are not define for people who never navigated to that section of the site; so for those people, I forced their percentage to be 0.
pr(purchase|landing on section A) = ifelse(#times landing on section A > 0,
#purchases/#times landing on section A*100,
0)
Is this the right way to treat a percentage variable in clustering/unsupervised learning if some values are undefined? One problem in forcing the undefined value to be 0 is that I'm basically telling the algorithm that these people are the same as those who landed on section A but did not make any purchases.
Another solution that I thought is to include the complement of the above probability so that the people who did not land on section A are identified by when these two percentages are both 0, i.e. include both
pr(purchase|landing on section A) = ifelse(#times landing on section A > 0,
#purchases/#times landing on section A*100,
0)
and
pr(did not purchase|landing on section A) = ifelse(#times landing on section A > 0,
100-pr(purchase|landing on section A),
0)
Note that if everyone landed on section A then I would only need to include one of them because then pr(purchase|landing on section A) = 100 - pr(did not purchase|landing on section A)
; but this relationship doesn't hold if I'm forcing these percentages to take on 0 when they are not defined (for customers who never landed on section A).