2
$\begingroup$

I've searched around a bit for strategies to approach the problem I'm facing and haven't come up with much.

I'm working with a data set that has many "quasi-continuous" features. That is, the feature will represent continuous variables over on range of it, and then represent categorical data over the rest of it.

for Instance, I have one variable that describes how long in years an observation has belonged to a given organization.

values 0 - 9 are continuous. Zero means they have membership, but have been a member for less than a year. 10 means they've been a member for 10 or more years. 995 means they've never been a member. 999 means the value was missing.

The only real thing I can think of here is to treat the whole thing as categorical. But then you loss information about the relationship between neighbors over the continuous portion.

Any help on how I can better represent the information in features like this would be great. FYI, I plan on using it within a linear regression.

$\endgroup$
2

1 Answer 1

0
$\begingroup$

Basically, you want to find a representation where each variable only holds one type of information. This means that you should use multiple variables that all model a single bit of categorical or continuous information.

In this case I would suggest using the following variables:

  • someone is a member (binary)
  • someone is a member for less than 1 year (binary)
  • someone is a member for longer than 10 years (binary)
  • length of membership (continuous, from 1 to 9)
  • value is missing (binary)

Note that some of the values of "length of membership" are missing, since you do not know the length below 1 year and above 10 years. You should somehow fill these missing values if you want to use linear regression. Common ways are using the mean values or throwing records with missing values away but you can think of more suitable options for your case. Also see: https://en.wikipedia.org/wiki/Missing_data

$\endgroup$
3
  • 1
    $\begingroup$ Exactly, this is usually referred to as decomposition into dummy variables, using one-hot encoding. $\endgroup$ Commented May 16, 2016 at 17:51
  • $\begingroup$ Definitely usefull for @ApeWithPants to read up upon. This case is however a bit more specific since multiple categorical and continuous types of information are encoded in a single variable. $\endgroup$
    – Pieter
    Commented May 16, 2016 at 19:13
  • 1
    $\begingroup$ Why do you need the second variable (member for < 1 year)? Why can't the length of membership be 0..9? $\endgroup$
    – Igor F.
    Commented Mar 11, 2020 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.