Questions tagged [encoding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
0answers
21 views

Target mean encoding worse than ordinal encoding with GBDT ( XGBoost, CatBoost )

I have a dataset of 23k rows of an unbalanced dataset 85/15 ratio, 10 variables ( 9 of which are categorical ) , i'm using CatBoost and XGBoost for a binary classification. I applied cv (5 iteration ...
0
votes
0answers
7 views

Using OrdinalEncoder on entire Dataframe and Avoiding Header transformation?

I want to encode the string in a dataframe which also has float values (which I don't want to change). The each feature column has several different unique strings. ...
1
vote
1answer
27 views

String handling by OneHotEncoder

I am reading everywhere on new questions and blogs that since version 0.20, OneHotEncoder is able to handle string features. Moreover, the documentation is what looks more ambiguous. Here are the ...
0
votes
2answers
42 views

One hot encoding with too many features (~ 10,000)

I am building a model to predict time off and sick leave for a specific employee. Each of the employees has one row per day from 01/01/2013 to 31/12/2018 in the dataset flagged with 0 or 1 (if that ...
2
votes
1answer
23 views

How can I count the number of occurrences of a category in dataset as part of an Sklearn Pipeline

Let us say we have a dataset with a feature such as Surname. arr['Surname'] = ['Smith', 'Jones', 'Johnson', 'Smith'] And I want to encode this categorical info ...
0
votes
0answers
8 views

Not able to sentence encode a list of sentences using multiprocessing technique - pool.map() function in python

I am trying to embed a text data which is in the form of list, since its a huge data I wanted to embed it using the multiprocessing Pool map() function. The embedding technique I'm using is google's ...
1
vote
0answers
52 views

In a Transformer model, why does one sum positional encoding to the embedding rather than concatenate it?

While reviewing the Transformer architecture, I realized something I didn't expect, which is that : the positional encoding is summed to the word embeddings rather than concatenated to it. ...
0
votes
0answers
15 views

Is random forest a kind of spatial feature encoding?

From the book "Deep Learning and Convolutional Neural Networks for Medical Image Computing" On the other hand, CNN models have been proved to have much higher modeling capacity, compared to the ...
3
votes
0answers
22 views

Why don't Target/LeaveOneOut Encoders work well for Regression Tasks?

In this review of categorical encoding, it states early on that For regression tasks, Target and LeaveOneOut probably won’t work well and later repeats that Target/LeaveOneOut (Owen Zhang's ...
2
votes
1answer
36 views

Mapping of categorical features into binary indicator features

I am currently reading an introductory machine learning book by Daumé (ch. 03, p. 30) and when discussing the mapping of categorical features with "n" possible values into "n" binary indicator ...
0
votes
1answer
22 views

String indices must be integers

I was trying to encode the string values of the feature 'ProductCategory' into integer values but I got this error. Kindly help. And I would also like to ask if label-encoding this feature would not ...
0
votes
0answers
96 views

Semantic Similarity in Universal Sentence Encoder

I am currently using Universal Sentence Encoder to embed certain sentences which I would then feed to a deep learning model to do some prediction, but just to test whether the universal sentence ...
0
votes
0answers
32 views

Pre-processing data to make predictions on deployed Sklearn model

I am new to Machine Learning. I have trained a ML model on the Diamond Prices Dataset to predict the price of a diamond given it's features (carat, cut color, clarity, etc...) I have used pickle to ...
0
votes
1answer
93 views

How does Byte Pair Encoding work?

I am using https://github.com/rsennrich/subword-nmt to do some Byte Pair Encoding (BPE). My corpus looks like: https://gist.github.com/shamoons/4bf9e78cd92624bcb120644fb995454a When I run the ...
0
votes
0answers
13 views

Looking for an alternative for prefix codes like Huffman coding, how to code empty space efficiently without prefix codes?

I'm experimenting with some coding mechanics using prime numbers and quantum mechanics. My problem is that those are no more prefix codes and I'm lacking of ideas on how to encode empty space between ...
3
votes
1answer
59 views

How to automate the encoding process?

I am working on the Boston challenge hosted on Kaggle and I'm still refining my features. Looking at the dataset, I realize that some columns need to be encoded in binary, some encoded in decimals (...
0
votes
1answer
51 views

Binary Encoding of Ordinal Categories

I have a data frame in which one of my columns is the target value and there are lots of ordinal categories in columns of data frame. I want to encode these ordinal categories in columns with this ...
0
votes
2answers
38 views

Is it right to impute Train and Test set?

I am experimenting with a dataset and I have a couple of columns with high cardinality. So, I performed mean target encoding (given that my dataset had more than 50000 observations). But, before doing ...
1
vote
2answers
240 views

Applying mean encoding before or after splitting into train and test set

I have a dataset of 50000 observations with columns of high cardinality. The best way to encode them is with mean encoding, then to use regularization. I will use CV rather than smoothing. But when I ...
6
votes
2answers
2k views

What is positional encoding in Transformer model?

I'm new to ML and this is my first question here, so sorry if my question is silly. I'm trying to read and understand the paper Attention is all you need and in it, there is a picture: I don't know ...
2
votes
2answers
20 views

why One-Hot Encoder can avoid the situation that the model will misunderstand the data to be in some kind of order if the data has been Label Encoding

We know that we prefer to using One-Hot Encoding not Label Encoding when processing with non-ordinal data. And I real a blog which give the difference between Label Encoding and One-Hot Encoding. So ...
0
votes
0answers
12 views

Does mean/likelihood-encoding work for neural networks?

Or is it something that only works with tree-based models?
1
vote
0answers
22 views

Aggregating target-encoded array-like categorical features?

I am trying find commonly used techniques when dealing with high cardinality multi-valued categorical variables for machine learning classification algorithms. One-hot encoding leads to very high ...
4
votes
1answer
549 views

How to handle columns with categorical data and many unique values

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 ...
2
votes
1answer
94 views

In which cases shouldn't we drop the first level of categorical variables?

Beginner in machine learning, I'm looking into the one-hot encoding concept. Unlike in statistics when you always want to drop the first level to have k-1 dummies (...
1
vote
0answers
69 views

Target Encoding: missing value imputation before or after encoding

I want to perform a target encoding for my categorical features although I am not sure when to perform the data imputation if any of them has missing values. Let's say I have a few continuous features,...
0
votes
1answer
36 views

How to deal with name strings in large data sets for ML?

My data set contains multiple columns with first name, last name, etc. I want to use a classifier model such as Isolation Forest later. Some word embedding techniques were used for longer text ...
3
votes
1answer
737 views

One-hot encode multi-class multi-label sequences

Suppose I want to build a timeseries where each timestep is represented by a categorical array: the encoded sequences look like [[2, 0, 5],[3, 1, 4],..] and each ...
2
votes
1answer
283 views

For a multi-class classification problem, how to transform the target variable to a form that is usable by sklearn algorithms?

I recently tried to create a model for predicting what class a sample belongs to out of 160 possible classes. These classes of the target variable are just simple strings describing workouts like "...
1
vote
1answer
310 views

Target encoding with cross validation

I am trying to understand this way of target (mean/impact/likelihood) encoding using (two-level) cross validation. It's taking mean value of y. But not plain mean, but in cross-validation within ...
1
vote
0answers
63 views

How to encode H3 geohash in regression model

I'm trying to train a random forest regression model based on a number of features, including location. I know that raw lat/long can't be used directly, so I've bucketed them using H3. I'm struggling ...
2
votes
0answers
83 views

how to extract the Top contributing labels/words in universal-sentence-encoder-large - TransformerModel?

I'm using the universal-sentence-encoder-large (Transformer Model) encoding process for embedding and then using the embedding for Clustering - Basically for unsupervised learning. I want to get the ...
1
vote
1answer
281 views

Scaling label encoded values for Linear Algorithms

I have encoded categorical variables to numerical values. As we know that for feeding values to Linear Algorithms like SVM or KNN, we scale the values for columns having large variations. I have ...
0
votes
0answers
125 views

Expanding mean (target) encoding utilized by CatBoost to deal with high cardinal categorical variables?

Could someone explain the nuance of expanding mean used encoding used by CatBoost to deal with high cardinality (2000+) categorical variables?
1
vote
1answer
87 views

Encoding multiple observations from the same feature space

My data contains multiple observations of categorical feature.The feature space is medical symptoms, so the data for this feature is like : ['fever','pain','yellow skin' .... ] .The amount of symptoms ...
3
votes
1answer
726 views

How to use one hot encoding of string categorical features in keras?

I am dealing with a binary classification problem. The output column of my dataset is already encoded in 0/1. The problem is that I have many categorical features (columns), which are strings and I ...
0
votes
0answers
17 views

Modelling a card game

This is a reasonably abstract question, it could be any card game that uses the suits and the values of the cards. My question is simply what is the best way to encode the cards into the model. Now I ...
1
vote
1answer
98 views

One Hot Encoding of Age

My task is to predict how many years a person has left to live using an MLP. There is one specific feature I'd like to discuss: current age. Statistically, it's a conditional probability. Example: ...
12
votes
2answers
6k views

Sparse_categorical_crossentropy vs categorical_crossentropy (keras, accuracy)

Which is better for accuracy or are they the same? Of course, if you use categorical_crossentropy you use one hot encoding, and if you use sparse_categorical_crossentropy you encode as normal integers....
0
votes
2answers
90 views

Transformation of categorical variables (binary vs numerical)

When using categorical encoding, I see some authors use arbitrary numerical transformation while others use binary transformation. For example, if I have a feature vector with values A, B and c. The ...
6
votes
1answer
2k views

Difference between OrdinalEncoder and LabelEncoder

I was going through the official documentation of scikit-learn learn after going through a book on ML and came across the following thing: In the Documentation it is given about ...
0
votes
1answer
437 views

Should I use pandas get_dummies and create additional columns or use my own encoding code that keeps 1 column?

I am running the Kaggle Video Games sales dataset through an XGboost algo. I want to encode the categorical column of "Game Rating" from E, M, etc. to 0-5 when I use: data = pd.get_dummies(data=...
1
vote
4answers
51 views

Equivalent of numeric encoding when rows can contain multiple values

If we have a column like: Name 0 Alice 1 Bob 2 Dave then, after numeric encoding, it becomes: ...
2
votes
0answers
68 views

“Binary Encoding” in “Decision Tree” / “Random Forest” Algorithms

Is it OK to use Binary Encoding in a dataset containing categorical columns with very high cardinalities? Some facts about my dataset: My dataset has ~170000 rows One of the categoric variables has ...
1
vote
0answers
10 views

What happens if I do not encode the lables or classifiers in the data? [closed]

I have a data where the three variables are numerical and one variable is a string. I am using the simple decision tree algorithm. Read somewhere that the data in strings must be encoded with one hot ...
3
votes
2answers
777 views

Muti-hot encoding vs Label-Encoding

I am learning about different input-vector representations for Neural Networks One of the alternatives to sparse One-Hot encoded vector is the Multi-Hot encoding. Do I understand correctly that a ...
0
votes
1answer
23 views

How to transform dictionary data into a string vector?

I have key,value data where each record is in a Python string. An example record looks like this: ...
-1
votes
1answer
609 views

How to use same encode label with same value used in training

I did save my model and using that model I want to predict the data. I am using Flask HTTP server for prediction endpoint. I have training data like this. I did save my model and using that model I ...
2
votes
2answers
73 views

How to encode data with a feature having multidimensional features (colors)?

My dataset has around 20 features, one of which is colors(in string format). There are around 50 different colors. I have converted them to RGB, but now I want to encode the data in such a way that ...
0
votes
1answer
315 views

How to use multiple encoders(one-hot and numerical) together for PCA

I want to implement PCA on a dataset(retail) but the data is categorical. One-hot encoding on some columns like Gender, Fabric, Brand makes sense but on other features like price range, size, I would ...