Questions tagged [encoding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
22 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
22 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
20 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,...
0
votes
2answers
23 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
16 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 ...
9
votes
1answer
177 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
36 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
45 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
51 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
32 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. ...
0
votes
2answers
235 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
0answers
103 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
24 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
28 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 ...
0
votes
0answers
19 views

Mean encoding and covariate shift

I am working on a binary classification problem whose two main issues are categorical variables with many levels and, since the process, I am modeling is not yet stable, the proportion among the two ...
0
votes
0answers
12 views

How to encode factor predictors in prediction models

The response variable as well as all predictor variables in my dataset are factors. I want to build a model for predicting the response variable. As I understand I have to first encode my predictor ...
0
votes
0answers
6 views

Include or exclude original features after encoding

I have some categorical features and they are encoded by different types of encoding (one-hot, label, target, etc). My question is whether you usually include the original categorical features with ...
1
vote
1answer
41 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 ...
0
votes
0answers
23 views

One hot encoding of continuous floats using keras backend

I am trying to convert a vector of floats into a matrix similar to one hot encoding, but I want this to happen in non-discrete space to retain gradients. Therefore I am only able to use keras backend ...
0
votes
0answers
10 views

How to encode features that encode regular values as well as special categorical values

I was recently playing around with the FICO explainable machine learning challenge dataset. In the dataset, there are a bunch of numerical features which have values values typically in the 0-100 ...
2
votes
0answers
216 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
26 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
254 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 ...
1
vote
3answers
168 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
30 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
11 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 ...
2
votes
0answers
353 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
19 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 ...
2
votes
0answers
37 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
48 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
102 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
389 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
82 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
386 views

How does Byte Pair Encoding work?

I am using this to do some Byte Pair Encoding (BPE). My corpus looks like this. When I run the learn_bpe, I get a vocabulary that looks like this. ...
0
votes
0answers
17 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 ...
4
votes
1answer
70 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
63 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 ...
1
vote
3answers
131 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 ...
2
votes
2answers
928 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 ...
16
votes
2answers
9k views

What is the positional encoding in the 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 ...
3
votes
2answers
32 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
15 views

Does mean/likelihood-encoding work for neural networks?

Or is it something that only works with tree-based models?
1
vote
0answers
32 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
1k 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 ...
4
votes
1answer
418 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
115 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
40 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
1k 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
458 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 "...