Questions tagged [encoding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
50 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
7 views

Pearson Product Moment Correlation vs Cosine Similarity For Encoded Text Comparison

I've seen a few different examples of the implementation of Google's Sentence Encoders. Many of these use different methods to find the similarity between sentences. For example, the standard ...
0
votes
1answer
24 views

How would I approach training a model and encoding this categorical data

So I have the following data: I have one series where each word has a value that describes the average review score that would get. For example, if the word "excellent" showed up in reviews ...
1
vote
1answer
14 views

Encoding Tags for Random Forest

I have the following data set: I want to use attributes Tags and Authors to classify each record into their respective Rating. In order to do so I want to use a random forest classifier. My concern ...
0
votes
1answer
20 views

Is label-encoded data quantitative or qualitative?

If you label-encode something which is qualitative, like brand of toothpaste or colour of hair, would you describe the resulting data as quantitative since it is now expressed in numbers? Or would you ...
0
votes
1answer
19 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
0answers
30 views

ML Code throws value error when transforming data

Data source can be found here. I've hit a stumbling block in some code I'm writing because the fit_transform method continuously fails. It throws this error: ...
1
vote
0answers
24 views

How does the R implementation of RandomForest split nodes on categorical data?

The R implementation of RandomForest can take in categorical features as factors and train and predict on these features without encoding. Normally, I use the python implementation from scikit-learn ...
0
votes
2answers
21 views

Is there a RandomForest implementation that handles categorical data without encoding in python?

I am working on a binary classification project with both continuous and categorical features. I know that the R implementation of RandomForest can handle categorical data passed in as factor type ...
0
votes
1answer
16 views

How to encode high cardinality categorical data?

I have a dataset of 1600 rows and 28 columns. Only one column is partially complete with 1300 records. The rest is NaN. I did a value count of this columns and it has 84 different categories that are ...
1
vote
2answers
39 views

is it better to correlate and encode or encode and correlate?

I have one doubt like is it better to perform label encoding and check for the correlation or should I 1st perform correlation and do label encoding? Because when I tried it both ways I'm getting ...
0
votes
1answer
59 views

What is multi-hot encoding?

I was read and paper for machine learning, and i found this term "multi-hot encoding" without explanation. Can you help me please? the paper: https://arxiv.org/abs/2001.06917
0
votes
1answer
29 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 ...
0
votes
1answer
31 views

Variables for SVM [closed]

I would like to predict if an email is spam or not spam based on the information that I have, i.e. date, email address, subject and text. Three of these parameters are text data, so they would need to ...
0
votes
1answer
24 views

How keras.layers.embedding learn word embeddings?

I was trying some tensorflow tutorials and see that in all of them they use layers.embedding to learn these word embeddings, but how are these learned? , with a NN? which arquitecture? , or word2vec? ...
2
votes
1answer
41 views

Explanation about i//2 in positional encoding in tensorflow tutorial about transformers

I was implementing the transformer architecture in tensorflow. I was following the tutorial : https://www.tensorflow.org/tutorials/text/transformer#setup_input_pipeline They implement the positional ...
1
vote
1answer
22 views

How to encode ordinal data before applying linear regression in STATA?

I have a data set that has student performance marks (continuous and dependent variable), Teacher Qualification (Ordinal and independent variable containing categories: Masters, Bachelors, High School)...
3
votes
1answer
52 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 ...
3
votes
2answers
136 views

Is Label Encoding with arbitrary numbers ever useful at all?

From what I read online, there seems to be some confusion regarding the taxonomy and the terms used, so to avoid misunderstanding I'm going to define them here: Label Encoding - encoding a nominal ...
3
votes
1answer
25 views

How to work with different Encoding for Foreign Languages

I've got a Word Embedding File called model.txt. This contains 100 Dimensional vectors for over a million French words. These words contain accented characters such ...
1
vote
1answer
33 views

File path encoding to feature

I am trying to find some sort of encoding algorithm that would allow to transform system file paths eg. "c:/users/file1/subfile2/targetfile" into a feature that I could use in machine ...
0
votes
1answer
33 views

ELMo - How does the model transfer its learning/weights on new sentences

Word2vec and Glove embeddings have the same vector representation for every word in the corpus and does not take context into consideration. For eg: The dog does bark at people The bark of the tree ...
0
votes
3answers
58 views

How do i get dummies for this dataset

I am using an udemy course for MachineLearning and I am trying to form a dummy for my variable the column is Country I want to change to France Germany Spain France ...
1
vote
1answer
235 views

Encoding with OrdinalEncoder : how to give levels as user input?

I am trying to do ordinal encoding using: from sklearn.preprocessing import OrdinalEncoder I will try to explain my problem with a simple dataset. ...
0
votes
0answers
108 views

What is “position” in CNN (im2latex) for Positional Encoding?

I'm trying to build a model that maps images of math formulas into LaTeX markup. I found an acticle (https://arxiv.org/ftp/arxiv/papers/1908/1908.11415.pdf) that proposes an encoder-decoder ...
0
votes
0answers
26 views

Target Encoding and Feature Scaling

I am using Support Vector Classification which performs well when we have done Feature Scaling, however, I am using Target Encoding on my categorical variables. Is it advisable to do Feature Scaling ...
0
votes
1answer
213 views

Mean encoding With KFold regularization

I just learned that regularizing the mean encoding reduce the leakage hence generalize better than mean encoding without it but I made 2 submissions with XGB in <...
0
votes
1answer
117 views

Aggregating multiple encoded categorical values

I am trying find commonly used techniques when dealing with high cardinality multi-valued categorical variables. I am currently using a dataset with a feature CATEGORY which has a cardinality of ~20,...
0
votes
1answer
50 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 ...
0
votes
0answers
37 views

One Hot Encoding where all sequences don't have all values

Is there a way (other than manually creating dictionaries) to one hot encode sequences in which not all values can be present in a sequence? sklearn's OneHotEncoder ...
0
votes
0answers
9 views

Can i use different types of encodings for categorical variables in one dataset

Should I mix encodings. For example for features age and income i have one type of encoding and for features typeOfPerson i have another?
2
votes
1answer
19 views

Memory efficient encoding logic for group categories

I have a huge dataset with categorical data. It is comprised of alerts having multiple properties. Each alert belongs to a group, and some even belong to multiple groups. It looks somewhat like this: ...
1
vote
1answer
23 views

LabelEncoder with a Multi-Layer Perceptron?

So we're working on a machine learning project at work and it's the first time I'm working with an actual team on this. I got pretty good results with a model that uses the following SKLearn pipeline: ...
1
vote
1answer
34 views

How to encode a column containing both string and numbers

I have a column in my dataset which contains both number and strings as the value. I want to encode the string variable so to use it for predicting. What is the best way to do this?
2
votes
1answer
27 views

Magnifying or reducing the size of input groups into a neural network

Say you've got two inputs (X1 and X2) that you want to use to predict Y. You're not sure how important X1 and X2 are for predicting Y, but you assume about even. One-hot encoding is a good strategy ...
0
votes
1answer
248 views

splitting into train test by train_test_split of float values?

How to split into train test by train_test_split of float values ? I used LabelEncoder but I have about 300K lines and when I used the cross_val I saw ...
2
votes
1answer
35 views

Different encoders applied to a dataset

I have a dataset which have both categorical features with high cardinality (>8000) and low cardinality (4 or 5). Would that be ok to encode the high cardinality ones with one encoder (target encoder,...
1
vote
2answers
169 views

Unsupervised encoding of categorical features

I have multiple log records with discrete categorical features. Shape of my dataset is (100k, 24) My aim is to look for anomalies in these records. I am planning to cluster the data after encoding. ...
1
vote
1answer
35 views

Validity of PU learning while using character-level encoding using CNNs for classifying text data

I'm trying to classify a large set of documents (~100M) as valid or invalid, based upon a small given set of labeled valid documents (~3k). I'd like to know if the PU learning approach described in ...
10
votes
1answer
589 views

Why does frequency encoding work?

Frequency encoding is a widely used technique in Kaggle competitions, and many times proves to be a very reasonable way of dealing with categorical features with high cardinality. I really don't ...
0
votes
2answers
845 views

Binary Classification - One Hot Encoding preventing me using Test Set [duplicate]

I have a preprocessing pipeline that includes replacing missing values and onehotencoding for the categorical variables. When I try to use my model on the test set, it explains that the number of ...
0
votes
2answers
66 views

Encoding Categorical Data Without Increasing the Dimension

I've been exploring methods for encoding categorical data. I was hoping to find a good method that does not increase the dimension of the dataset, similar to the one used on this dataset about drug ...
2
votes
1answer
53 views

Could I add a one hot encoding to each feature representing “has data” versus “has no data”

I have a data set that has some holes in it. I was wondering if I could add two columns for each feature representing this feature has data and ...
1
vote
2answers
181 views

Is it possible to know the output vectors of MLP Classifier of scikit learn?

I'm a beginner with scikiti-learn library. I have an ANN with 3 input, 2 hidden layers and 3 output. ...
1
vote
2answers
1k views

What is the advantage of positional encoding over one hot encoding in a transformer model?

I'm trying to read and understand the paper Attention is all you need and in it, they used positional encoding with sin for even indices and cos for odd indices. In the paper (Section 3.5), they ...
0
votes
1answer
583 views

Frequency/Count encoding

How do I perform frequency/count encoding for a train and test set? The implementations of this encoding I've seen simply frequency encode the categorical variables on a particular dataset (no ...
0
votes
1answer
180 views

Target encoding before split on skewed data

Hi My data is distributed like follow: And I only have categorical variables on many many levels. As I need to make a regression task I thought about doing leave one out encoding on my categories. ...
1
vote
2answers
42 views

Does the predict function in machine learning understand categorical data

I understand that before feature engineering one has to split the dataset into train and test data, so as to avoid bias in the analysis. I also understand that the machine learning model does not ...
1
vote
1answer
107 views

Encode missing data and unseen data

Let's assume that I have a classification problem and all my features are categorical data. I have missing data (and I do not want to do any imputation). Also, I know that I will have some unseen ...
3
votes
0answers
483 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 ...