Questions tagged [categorical-encoding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
3answers
56 views

Dealing with Extra Categories in Test Set

Suppose I have a data set which consists a dependent variable y and independent variables X. Suppose that there is a specific ...
0
votes
1answer
14 views

What are the options/best practices for encoding categorical features for multilabel classification?

I am working on a multilabel classification problem with both continuous and categorical features. For a single label problem, I might make use of a supervised encoder for my categorical features such ...
1
vote
1answer
43 views

Decision Trees and Categorical Feature Labelling

I am working on a decision tree model and trying to decide how best to handle categorical features. The features in my dataset are generally high in cardinality and I have found that ordinal labeling ...
0
votes
0answers
13 views

What is the recommended embedding for a categorical variable with more than 40000 thousand categories?

I have a feature called Planning_id with more than 40000 categories. What is the recommended embedding size? I read that: embedding_dimension = # categories * 0.25 is a good rule of thumb, but I still ...
0
votes
0answers
13 views

How to treat a column that contains a list of categorical, high cardinality values for a classification problem?

The list cannot be exploded into several columns because this will result in very high dimensionality. I would like to know the following: How to treat this kind of column in a dataframe? Can I keep ...
2
votes
1answer
42 views

Two questions about one-hot encoding: drop first? and features with thousands of categories [closed]

I have two questions about one-hot feature encoding: (1) Is it considered a "best practice" to drop the first (or at least one) one-hot encoded feature when one-hot encoding, like you would ...
0
votes
1answer
54 views

What is the best practice to normalize/standardize imbalanced data for outlier detection or binary classification task?

I'm researching Anomaly/outlier/fraud detection, and I'm looking for the best practice to pre-process the synthetic data for imbalanced data. I have checked all methodology for normalizing/...
0
votes
0answers
17 views

How to encode high dimensional dynamic categorical data?

Example: Facebook newsfeed ranking. This is typically done by relevance scoring each post using a regression model based on a number of features. Typical features might include information from the ...
0
votes
1answer
21 views

Handling categorical data with more over 100 unique classes

I am working with a pure categorical data set. And some classes have more than 100 unique values. I could not find any appropriate encoding possibility. So I created a SQL table, where each value got ...
1
vote
1answer
28 views

Categorical encoded variables in scikit-learn diabetes dataset [closed]

When using sklearn.datasets import load_diabetes, the sex variable which is categorical, is scaled to continuous values. Is it even legal to scale such variables?
2
votes
2answers
46 views

Is it acceptable to use label encoding for nominal categorical data when one hot encoding would create too many features?

I'm working on a short data science project to compare the accuracy of different classification methods. The groups decided to use and compare Random Forest, Naive Bayes and SVM. The dataset we are ...
0
votes
0answers
43 views

Cluster images labels in some given categories using word embeddings

Given: set of images Labels in string format each one. Also I've given a set of Categories, also in string. ($Images \neq Categories $) Goal: I need to map given labels to given categories to "...
0
votes
0answers
38 views

Embedding a categorical variable and concatenating with a numerical variable, in a many-to-one sequence problem with multiple features

I have a small data set where I track 4 variables across 4 time periods, 1 categorical and 1 numerical variable. Below is picture of data set that I am using: cat1 - Categorical variable encoded num1 ...
1
vote
2answers
42 views

Different number of features in train vs test when using Label Encoding

This is not a duplicate of Different number of features in train vs test There are some categorical columns in my data, and the cardinality for each of them is large, so I chose to use LabelEncoding ...
2
votes
1answer
91 views

kNN for non-ordinal variables

kNN is a distance-based method, so it requires the input to be in numerical form. I was wondering if it is possible to use kNN imputer for non-ordinal categorical variables (like color). Since the ...
0
votes
0answers
14 views

k-1 vs. k categories for categorical features in decision trees

I have a model with only categorical features. The outcome is binary. I am training binary classifiers. Most of them are coded already as 0/1 . Some have increased cardinality (ie 4 categories). For ...
0
votes
0answers
18 views

How to convert the categorical features into one-hot encoded dense vectors before applying the min-max scaler of sklearn?

like the question says I am trying to figure out how to convert one-hot encoded vectors into dense vectors, because my data-set contains both continuous and categorical features, I used the ...
2
votes
1answer
39 views

Using the curse of dimensionality for encoding non-ordered (nominal) categorical variables of high cardinality

When the dimension is high, all data are approximately at the same distance away from each other. This makes distance-based methods such as k-nearest neighbors less useful if the data are more or less ...
0
votes
0answers
199 views

Tensorflow - I don't get the right shapes - `ValueError: Shapes (9, 1) and (8, 9) are incompatible`

I want to train a Sequential Neural Net (NN) with Tensorflow. ...
0
votes
0answers
34 views

How to make a Label Encoder trained on a training dataset transform an unseen value of a test dataset?

During the data preprocessing stage, I decided to apply the Label Encoding on one of the columns because it contained data points in string format. Suppose the column contains the following distinct ...
3
votes
1answer
44 views

One hot encoding of target variable containing classes 1 to 9 not including zero

While predicting a solution for a sudoku puzzle using CNN, the target variable should predict values from 1 to 9 for all the 81(9*9) values in the puzzle. Hence the target value shape is (81,9). Using ...
7
votes
5answers
644 views

How do I encode the categorical columns if there are more than 15 unique values?

I'm trying to use this data to make a data analysis report using regression. Since regression only allows for numerical types, I then need to encode the categorical data. However, most of these have ...
0
votes
0answers
54 views

What's the best method to merge N categorical features into one and keep it as categorical

I'm training a Transformer model and it requires one input sentence and N optional labels, not classes cause it's a multi-label and multi-class problem so the unique classes turned into labels. I have ...
0
votes
0answers
26 views

Normalization of encoded feature?

I am a beginner in ML, and I am working on a classification problem on big data (its shape is (8921483, 52)) which its features are mostly categorical. One of the features has 175365 different ...
0
votes
1answer
161 views

why should i do target encoding within cv loop?

i wish to use target encoding, using the category encoders sklearn library. I don't really understand why it is necessary to include this as a step in a sklearn pipeline WITHIN the cross validation ...
0
votes
1answer
26 views

How to Present All Categories in All Samples

I have a data contains many categorical columns. When I sampled this data randomly a few times and applied one-hot encoding to categorical columns I noticed that it ended up with datasets with ...
2
votes
2answers
340 views

Choose-many categorical features: alternatives to one-hot encoding?

I'm building a model to predict the lifetime value of a client based on the relational data we have on them. The user table has a bunch of one-to-many child tables that might be predictive. Grossly ...
0
votes
0answers
49 views

Which is the best way to select categorical features with Autoencoders in Python?

I have a dataset containing both categorical and numerical features. I am trying to work with Autoencoders for feature selection, so the first thing I do is to normalise the numerical features. For ...
0
votes
1answer
27 views

Handling encoding of a dataset which has more than total 2000 columns

Whenever we have a dataset to be pre processed, before feeding it to the model we convert the categorical values to numerical values for which we generally use LabelEncoding, One Hot encoding etc ...
0
votes
1answer
49 views

Encoding of high cardinality multi-label categorical feature?

This is the problem of binary classification: "1" - the subscriber is a driver (belongs to the segment of drivers), "0" - the subscriber is not a driver (does not belong to the ...
1
vote
1answer
186 views

Should one-hot encoded categorical features needs to be scaled when used along with text feature while deriving semantic similarity?

My aim is to derive textual similarity using multiple features. Some of the features are textual for which I am using (Tfhub 2.0) Universal Sentence encoder. There are other categorical features which ...
1
vote
0answers
143 views

Cat2Vec implementation X = categorical and y = categorical

I am trying to convert categorical values (zipcodes) with Cat2Vec into a matrix which can be used as an input shape for categorical prediction of a target with binary values. After reading several ...
0
votes
2answers
703 views

Encoding categorical data with pre-determined dictionary

in case feature encoding, if I'd like to encode my values based on my pre-determined dictionary, how do I do that? For instance, say, I've values as ...
4
votes
1answer
1k views

Target encoding with KFold cross-validation - how to transform test set?

Let's say I have a categorical feature (cat): ...
3
votes
0answers
43 views

What is the concept behind the categorical-encoding used in the CatBoost benchmark problems?

I'm working through CatBoost quality benchmark problems (here). I'm particularly intrigued by the methodology adopted to convert categorical features to numerical values as described in the ...
2
votes
1answer
89 views

One-hot & interaction one-hot on multiple categorical

I was wondering if there is any value to creating combined features out of multiple categorical variables when the individual categorical variables are already one-hot encoded? Simple example: there ...
3
votes
1answer
377 views

Encoding and cross-validation

Recently I've been thinking about the proper use of encoding within cross-validation scheme. The customarily advised way of encoding features is: Split the data into train and test (hold-out) set Fit ...
3
votes
1answer
163 views

On gradient boosting and types of encodings

I am having a look at this material and I have found the following statement: For this class of models [Gradient Boosting Machine algorithms] [...] it is both safe and significantly more ...
1
vote
1answer
437 views

What is sum encoding?

I've heard sum encoding mentioned as a method of encoding categorical variables, but I haven't been able to find a clear explanation of what it actually is. I found the following explanation on ...
2
votes
2answers
705 views

Why is count encoding effective in improving accuracy? [duplicate]

Can someone please explain why/how Count encoding of categorical features improve accuracy in classification when compared to simply label encoding them ? I found one explanation in kaggle " ...
0
votes
1answer
69 views

Is this attribute numeric or categorical (ordinal)? Help!

So I have this dataset I need to perform several techniques on as part of a data mining/machine learning project of some sort in PYTHON. There are a couple of features however, that have me very ...
0
votes
2answers
80 views

Categorical and non-categorical data in the same column

I have a unique dataset that has many columns and most columns contain both categorical and non-categorical data. For example, let's say that one column is attribute_1 and for observations that have ...
1
vote
1answer
301 views

sklearn serialize label encoder for multiple categorical columns

I have a model with several categorical features that need to be converted to numeric format. I am using a combination of LabelEncoder and OneHotEncoder to achieve this. Once in production, I need to ...
0
votes
1answer
36 views

Categorical data - how to handle [closed]

Few questions on categorical data. Need suggestions / pointers: How can we check for correlation between categorical features and target or between the features themselves? How about correlation ...
0
votes
1answer
162 views

Implementing sklearn's FeatureHasher on Unseen Data

For a little bit of background I have been working on a binary classification of health insurance claims and am implementing sklearn's FeatureHasher to vectorize categorical features, many of which ...
1
vote
1answer
27 views

Which ML classifier is appropriate for me if all of my features are categorical?

My dataset contains four features. All of the features are categorical. There are 150 categories in the value of 1st and 2nd features. There are 8 categories in the value of 3rd and 4th feature. I ...
1
vote
2answers
2k views

what should i do if my target variable is categorical when using decision tree? (many categorical variables)

all, i'm trying to classify a set of features to belong to a particular company (my dependent variable). my independent variables are a mixture of continuous and categorical features. my data-set ...
2
votes
1answer
194 views

Categories with the same mean in target encoding

While doing target encoding it can happen that two categories have the same target mean. This is bad because there will be no difference in the new feature in it and we will lose some information. ...
1
vote
0answers
155 views

Implementing Scikit Learn's FeatureHasher for High Cardinality Categorical Data

Background: I am working on a binary classification of health insurance claims. The data I am working with has approximately 1 million rows and a mix of numeric features and categorical features (all ...
1
vote
1answer
91 views

How to do target encoding when data has repeated rows?

How can I do encoding for a category when data has repeated rows? Can I do target encoding? Or Is there another encoding I can use? I want to figure how to include a categorical variable in a model ...