How to handle columns with categorical data and many unique values The 2019 Stack Overflow Developer Survey Results Are Indecision trees on mix of categorical and real value parametersPandas categorical variables encoding for regression (one-hot encoding vs dummy encoding)Imputation of missing values and dealing with categorical valuesHow to deal with categorical variablesOne hot encoding error “sort.list(y)…”One hot encoding vs Word embeddingHow to implement feature selection for categorical variables (especially with many categories)?ML Models: How to handle categorical feature with over 1000 unique values“Binary Encoding” in “Decision Tree” / “Random Forest” AlgorithmsDealing with multiple distinct-value categorical variables
How to deal with fear of taking dependencies
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
What does "rabbited" mean/imply in this sentence?
"To split hairs" vs "To be pedantic"
Access elements in std::string where positon of string is greater than its size
Spanish for "widget"
Idiomatic way to prevent slicing?
Extreme, unacceptable situation and I can't attend work tomorrow morning
Why could you hear an Amstrad CPC working?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
What is a mixture ratio of propellant?
Dual Citizen. Exited the US on Italian passport recently
Should I use my personal or workplace e-mail when registering to external websites for work purpose?
Why Did Howard Stark Use All The Vibranium They Had On A Prototype Shield?
What does Linus Torvalds means when he says that git "never ever" tracks a file?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
How to make payment on the internet without leaving a money trail?
Time travel alters history but people keep saying nothing's changed
I looked up a future colleague on LinkedIn before I started a job. I told my colleague about it and he seemed surprised. Should I apologize?
Carnot-Caratheodory metric
Is this food a bread or a loaf?
How are circuits which use complex ICs normally simulated?
What do the Banks children have against barley water?
Output the Arecibo Message
How to handle columns with categorical data and many unique values
The 2019 Stack Overflow Developer Survey Results Are Indecision trees on mix of categorical and real value parametersPandas categorical variables encoding for regression (one-hot encoding vs dummy encoding)Imputation of missing values and dealing with categorical valuesHow to deal with categorical variablesOne hot encoding error “sort.list(y)…”One hot encoding vs Word embeddingHow to implement feature selection for categorical variables (especially with many categories)?ML Models: How to handle categorical feature with over 1000 unique values“Binary Encoding” in “Decision Tree” / “Random Forest” AlgorithmsDealing with multiple distinct-value categorical variables
$begingroup$
I have a column with categorical data with nunique 3349 values, in a 18000k row dataset, which represent cities of the world.
I also have another column with 145 nunique values that I could also use in my model that represents product category.
Can I use one hot encoding to these columns or there's a problem with that solution?
Like which is the max number of unique values to use one hot encoding so there's not gonna be any problem ?
Can you point me to the right direction if I should use another encoding also?
machine-learning data categorical-data encoding
$endgroup$
add a comment |
$begingroup$
I have a column with categorical data with nunique 3349 values, in a 18000k row dataset, which represent cities of the world.
I also have another column with 145 nunique values that I could also use in my model that represents product category.
Can I use one hot encoding to these columns or there's a problem with that solution?
Like which is the max number of unique values to use one hot encoding so there's not gonna be any problem ?
Can you point me to the right direction if I should use another encoding also?
machine-learning data categorical-data encoding
$endgroup$
add a comment |
$begingroup$
I have a column with categorical data with nunique 3349 values, in a 18000k row dataset, which represent cities of the world.
I also have another column with 145 nunique values that I could also use in my model that represents product category.
Can I use one hot encoding to these columns or there's a problem with that solution?
Like which is the max number of unique values to use one hot encoding so there's not gonna be any problem ?
Can you point me to the right direction if I should use another encoding also?
machine-learning data categorical-data encoding
$endgroup$
I have a column with categorical data with nunique 3349 values, in a 18000k row dataset, which represent cities of the world.
I also have another column with 145 nunique values that I could also use in my model that represents product category.
Can I use one hot encoding to these columns or there's a problem with that solution?
Like which is the max number of unique values to use one hot encoding so there's not gonna be any problem ?
Can you point me to the right direction if I should use another encoding also?
machine-learning data categorical-data encoding
machine-learning data categorical-data encoding
asked yesterday
dungeondungeon
293
293
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
For categorical columns, you have two options :
- Entity Embeddings
- One Hot Vector
For a column with 145 values, I would use one hot encoding and Embedding for ~3k values. This decision might change depending on overall number of features.
Embeddings map feature values into a 1D vector so that model knows NYC, Paris, London are similar cities in one aspect (size) and very different in other aspects. So, instead of using ~3k column of features, model will have ~50 columns of vector representation.
Articles that explain Embeddings :
An Overview of Categorical Input Handling for Neural Networks
On learning embeddings for categorical data using Keras
Google Developers > Machine Learning > Embeddings: Categorical Input Data
Exploring Embeddings for Categorical Variables with Keras by Florian Teschner
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48875%2fhow-to-handle-columns-with-categorical-data-and-many-unique-values%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
For categorical columns, you have two options :
- Entity Embeddings
- One Hot Vector
For a column with 145 values, I would use one hot encoding and Embedding for ~3k values. This decision might change depending on overall number of features.
Embeddings map feature values into a 1D vector so that model knows NYC, Paris, London are similar cities in one aspect (size) and very different in other aspects. So, instead of using ~3k column of features, model will have ~50 columns of vector representation.
Articles that explain Embeddings :
An Overview of Categorical Input Handling for Neural Networks
On learning embeddings for categorical data using Keras
Google Developers > Machine Learning > Embeddings: Categorical Input Data
Exploring Embeddings for Categorical Variables with Keras by Florian Teschner
$endgroup$
add a comment |
$begingroup$
For categorical columns, you have two options :
- Entity Embeddings
- One Hot Vector
For a column with 145 values, I would use one hot encoding and Embedding for ~3k values. This decision might change depending on overall number of features.
Embeddings map feature values into a 1D vector so that model knows NYC, Paris, London are similar cities in one aspect (size) and very different in other aspects. So, instead of using ~3k column of features, model will have ~50 columns of vector representation.
Articles that explain Embeddings :
An Overview of Categorical Input Handling for Neural Networks
On learning embeddings for categorical data using Keras
Google Developers > Machine Learning > Embeddings: Categorical Input Data
Exploring Embeddings for Categorical Variables with Keras by Florian Teschner
$endgroup$
add a comment |
$begingroup$
For categorical columns, you have two options :
- Entity Embeddings
- One Hot Vector
For a column with 145 values, I would use one hot encoding and Embedding for ~3k values. This decision might change depending on overall number of features.
Embeddings map feature values into a 1D vector so that model knows NYC, Paris, London are similar cities in one aspect (size) and very different in other aspects. So, instead of using ~3k column of features, model will have ~50 columns of vector representation.
Articles that explain Embeddings :
An Overview of Categorical Input Handling for Neural Networks
On learning embeddings for categorical data using Keras
Google Developers > Machine Learning > Embeddings: Categorical Input Data
Exploring Embeddings for Categorical Variables with Keras by Florian Teschner
$endgroup$
For categorical columns, you have two options :
- Entity Embeddings
- One Hot Vector
For a column with 145 values, I would use one hot encoding and Embedding for ~3k values. This decision might change depending on overall number of features.
Embeddings map feature values into a 1D vector so that model knows NYC, Paris, London are similar cities in one aspect (size) and very different in other aspects. So, instead of using ~3k column of features, model will have ~50 columns of vector representation.
Articles that explain Embeddings :
An Overview of Categorical Input Handling for Neural Networks
On learning embeddings for categorical data using Keras
Google Developers > Machine Learning > Embeddings: Categorical Input Data
Exploring Embeddings for Categorical Variables with Keras by Florian Teschner
edited yesterday
answered yesterday
Shamit VermaShamit Verma
1,4941314
1,4941314
add a comment |
add a comment |
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48875%2fhow-to-handle-columns-with-categorical-data-and-many-unique-values%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown