Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distances with one hot encodings #11

Open
hiyamgh opened this issue Apr 22, 2020 · 1 comment
Open

Distances with one hot encodings #11

hiyamgh opened this issue Apr 22, 2020 · 1 comment

Comments

@hiyamgh
Copy link

hiyamgh commented Apr 22, 2020

I have a dataset by which I am interest to apply SMOGN/SMOTER to it. The dataset has both numerical and nominal features. I am using machine learning models from sklearn and keras (yes in python, I am using rpy2 to apply SMOGN/SMOTER for communication between R and python) and they expect no strings at all in the data. Thats why I convert my nominal features to one hot encodings. However If I use 'HEOM' distance, noise is added and instead of having vectors of either 1 or 0 I am having 1.00001, 0.999, etc. How can I fix this ?? Please find below a snapshot of a 'SMOGN'-ed dataset:

numericalcategorical

The one hot encoded vectors are from columns service_General Medicine --> mohafaza_NE

@neverfox
Copy link

neverfox commented Jul 2, 2020

SMOGN handles factors so you should just pass the non-one-hot encoded data in and encode it afterwards. Alternatively, you could declare those encoded columns as factors and it won't add noise but that wouldn't guaranteed one hot encoding in the result, as it would regard each column independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants