0
$\begingroup$

I have an unbalanced dataset on which I used SMOTE to even the classes.

I'm using R and the package::function is smotefamily::SMOTE.

Now, this function required numeric variables and some of the columns of the dataset I gave as input where num but actually contained binary 0, 1 values.

In the output I get new rows with values of like 0.23 in these columns. Should I keep it this way or should I round it down/up based on a 0.5 threshold say?

$\endgroup$
2
  • 1
    $\begingroup$ What you should do will depend on your goals, so what do you want to do, and how does SMOTE help you accomplish your goals, given the non-problem that class imbalance typically is? (Perhaps a related question is why class imbalance seems to be a problem for you.) $\endgroup$
    – Dave
    Commented Sep 24, 2022 at 15:04
  • $\begingroup$ Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. $\endgroup$ Commented Sep 24, 2022 at 15:57

1 Answer 1

1
$\begingroup$

To illustrate problems and solutions of SMOTE with categorical variables, let's consider a dataset (imbalanced) where each rows represent an animal and we have following informations:

  • [has_tail] : 1 if the animal has a tail. Binary variable.
  • [weight] : the weight of the animal. Continuous variable.

SMOTE create synthetic observation by interpolation between different data points.

Therefore, has you mentioned, in the [has_tail] column one can have 0.23 as a value for a synthetic observation. Yet this doesn't mean anything ! We are mixing categories and numerical values, it is a problem even when computing distances between vectors to find the $k$ nearest neighbors. Even though we have only numeric values, we lost meaning of the data.

To tackle this issue, two variations of SMOTE were developed :

  1. SMOTE-N : for dataset with only categorical variables
  2. SMOTE-NC : for dataset with categorical and continuous variables

The last one is a good fit for your problem. To get more detail about the two variations check imblearn SMOTE variations for Python, but there must be implementation in R.

$\endgroup$

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.