The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [categorical-encoding]

Representing categorical variables as sets of numerical variables. Necessary in many types of analysis for them to process categorical data. A common example is using a categorical predictor in regression/ANOVA via dummy coding, effect coding, Helmert coding, user-defined contrasts, etc.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

How do you address a key dummy variable if you failed the Hausman test for panel data?

I have a panel model and am primarily interested in the impact of a dummy variable. Unfortunately, my model failed the Hausman test indicating that I should use fixed effect rather than random effect. ...
-1
votes
2answers
30 views

What is the best way to handle ordinal features having numeric values in python? [closed]

What is the best way to encode ordinal feature? Is it by transforming it using OneHotEncoder so values going from 1 to 7 lets say would become head of new field feature. Or by using StandardScaler() ...
4
votes
1answer
67 views

In a multilevel linear regression, how does the reference level affect other levels/factors and which reference level ought to be selected?

In the diagram, Heavy smoker is the reference level as it is not shown with summary. How and what other categorical level should be used instead? Why? ...
2
votes
0answers
11 views

Recursive feature elimination on just the train data or complete dataset

I am using RFE with logistic regression. I will also be doing cross validation with RFE (RFECV in sklearn) to get the optimum number of features. I am not sure whether to use RFECV on just train data ...
0
votes
0answers
54 views

Conditional linear regression with indicator variables (Python)

I have the sample dataset below 20 observations of Y variables and 20 observations of X variables. Both are normalized (z-scored). I have a prior that (i) larger magnitude X values with $abs(X) >= ...
2
votes
1answer
10 views

Can we apply one-hot encoding to clustered continuous value feature?

I am working on a logistic regression problem for offshore rig automation. One of the predictors is time duration reading from a sensor. Due to the nature of the sensor (and the automation system), ...
1
vote
1answer
24 views

How can I assess the strength of the collinearity (if any) between two different sets of categorical dummy variables in an OLS regression?

I ran an OLS regression of 'prices' on two sets of dummy variables and nothing else. The dummy variables in question are 'city', with levels A, B, C and D (each corresponds to a different city). And '...
0
votes
0answers
25 views

Encoding Ordinal categorical data using Python

I am trying to encode ordinal data. I found a post which suggests a way to do it. Where to find a guide to encoding categorical features? This seems to make sense. For nominal data, I would do the one-...
1
vote
1answer
22 views

Feature vector formulation for a Neural Network [closed]

So I'm implementing a simple ANN where I have a massive input data set. The input data contains all kinds of stuffs like eg: categorical values: button,table, image...; binary values: true-false...; ...
2
votes
2answers
83 views

In an OLS regression, will excluding all data for a non-reference category of a dummy variable impact the other dummy level categories?

Say I have an OLS regression with a dummy variable level A, B, C and D, where A is the reference category. Will the estimated coefficient value and/or statistical significance of B or C change or be ...
1
vote
0answers
11 views

Effects coding for deviations from grand mean for every level of variable

Let's say we have a dataset ...
1
vote
1answer
26 views

Is there a point where you wouldn't use dummy variables? I.e., if getting dummy vars would lead to hundreds of variables? [duplicate]

I built a web scraper that drew in a bunch of data and I have more qualitative variables than I expected. Originally there were just a few quantitative variables that I had intended to consider but, ...
1
vote
0answers
36 views

Can I use polynomial regression with categorical variabels? [closed]

I'm trying to learn a polynomial model of degree 2, but apparently it doesn't work well for dummy variables, as they present only 2 possible values (0 or 1) thus not being able to properly create a ...
0
votes
0answers
14 views

Correlation with Pearson possible for Continous - Dummy Variable? Otherwise options?

I assume that I cannot interpret correlation coefficients given by Pearson method for continous - dummy variables. Is this correct? Which options can I pursue otherwise? Its for the decriptive ...
0
votes
1answer
47 views

Isolation forest with categorical data?

I understand how isolation forests can work with numeric data, but I wonder how it can work with categorical data? Also, at least when working with Sci-kit-Learn, the recommendation I saw was to ...
0
votes
0answers
8 views

How to remove collinearity from a fixed-effects difference-in-difference regression?

I'm doing a difference-in-difference regression with fixed effects. I'm analysing the effect of removing financial incentives from quality indicators, in health clinics. I have a dummy variable for '...
0
votes
0answers
11 views

Binary (dummy-variables) in a Difference-in-Difference Estimation

currently, I am conducting a Difference-in-Difference Analysis for which I designed a treatment Group (1) and a Control Group (0). The Regression for this works just fine, although not with the ...
0
votes
1answer
35 views

Recursive feature elimination and dropping dummy features

Is it advisable to use RFE for linear or logistic regression when we have some dummy features. Reason I am asking this is: in RFE we will eliminate some features which will also include dummy features ...
1
vote
1answer
53 views

Recursive feature elimination and one-hot & dummy encoding?

When using RFE in linear regression and logistic regression, do we one-hot encode the features (K levels and K dummy features) or dummy-encode the features (K levels and K-1 dummy features leaving one ...
0
votes
0answers
14 views

How should new factor levels not present in the model test data be handled?

Let's say I am predicting something using a linear model and have data for the past 11 months only, and I need to predict the following month. I train the model with months as dummy variables in the ...
1
vote
1answer
32 views

Do ordinal variables require one hot encoding?

For categorical variables, one hot encoding is a must if the variable is non-binary . But what about ordinals? These variables are ordered but are mutually exclusive. Do they require the same ...
1
vote
1answer
25 views

How can I compute the standard error and confidence intervals for the base level on a variable?

I'm running a GLM with a tweedie, log-link function. That said, I have a categorical variable that transformed to dummy variables leaving off one of those variables when I modeled. Now that I'm ...
1
vote
1answer
22 views

How to include dummy variables for year? [closed]

I have the following multiple linear regression: reg <- lm(Y ~ x1 + x2 + d1 + d2, df) and in my dataset I have a series called "year" which contains, you ...
0
votes
0answers
10 views

Does the variation in ordinal encoding matter for regression (PLS)?

I have plenty of ordinal categorical variables, and wonder whether the width of the assigned value interval matters. For example: I could rank a variable of cardinality 4 from 1 to 4, but what if ...
0
votes
0answers
15 views

Why can't I feature scale after encoding categorical data

I've read somewhere that feature scaling categorical encodings (with vector mean/variance or median/IQR) is a bad idea and breaks the structure of the encoding - something about orthogonality of ...
2
votes
1answer
57 views

Group level effects (odds ratio) - dummy coding vs. effect

I ran a logistic model in R's brms, with a categorical variable (condition) with two levels as predictor. When interpreting the ...
0
votes
1answer
26 views

Set new reference level for hazard ratios

I run a Cox Regression and afterwards, I predicted the Hazard Ratio (HR) for the predictor values 1 to 10. My data looks something like this: ...
0
votes
0answers
12 views

Generating maps from sprite indexes as one hot vectors

Goal: Use a Autoencoder to allow me generate new maps from the set of sprites from old game boy games. Old games tended to be made out of sprite/tile maps. So you can cut up their maps into 16x16 ...
0
votes
1answer
33 views

Term for the non-reference category for a dummy variable

For a dummy variable, what is a non-reference category called? Is there a general term for these categories other than non-reference categories?
0
votes
0answers
30 views

GLM Logistic regression in R: one category is significant, but others are not. Should I drop the variable? [duplicate]

so I am using GLM for logistic regression in R and I have some variables with many factors. I ran the model and has the result like this: My question is: 1. Is this variable significant? ...
0
votes
0answers
51 views

Vector Auto Regression handling dummy encoded variables

Firstly, apologies if this question is obvious, I am new to Time Series Forecasting & ML in general. I have an application whereby I collect prices from betting exchanges on an interval. This ...
1
vote
0answers
39 views

Logic of forward or backward difference coding

Two systems of contrast coding for ordinal data are forward difference coding and backward difference coding. I will focus on the latter system here because it seems to be more commonly used, but my ...
0
votes
1answer
29 views

Should I treat variables representing level of disease risk as ordinal?

I'm working with a study where we have collected the subjects' genotypes for risk factors for a disease. These can be homozygous non-risk (e.g. AA), homozygous risk (e.g. TT) or heterozygous (e.g. AT) ...
0
votes
1answer
98 views

Gaussian processes with categorical input

Is there a standard way of applying Gaussian processes to regression problems with categorical input? Are they standard kernels that one should apply to this problem?
2
votes
1answer
58 views

What are appropriate methods for preparing categorical features for recurrent networks to ensure efficient backpropagation?

Given a 1D sequential categorical input variable, e.g. [rainy, sunny, rainy, cloudy, cloudy], with a small domain {rain, sunny, cloudy}, what encoding methods (e.g. one-hot, dummy, binary) and what ...
0
votes
0answers
26 views

Ordinal multinomial logistic regression on one-hot encoded data

I have a task I am unable to tackle by principle. I'm working on survey data for one of our clients such that my design matrix is made of one-hot vectors with 15 features (originally 3 variables with ...
0
votes
0answers
8 views

encoding the true labels of radial basis neural network for binary classsification

I am working on a binary classification problem (my class labels are 1 or 0) and I have three layers (input, hidden, output) radial basis neural network. I put two neurons, one per class, in the ...
0
votes
1answer
22 views

One-hot encoding for duplicate words

I'm currently studying NLP and was practicing one-hot encoding for sentences at the word level. My question is, if we have multiple examples of the same word in a sentence, does one-hot encoding ...
0
votes
0answers
39 views

Interpretation of Marginal Effects for Dummy Variable (using mfx package in R)

So, I calculated a negative binomial regression model and I am trying to estimate the mean marginal effects in R. To do this, I used the mfx package and wrote the ...
1
vote
0answers
101 views

Does the isolation forest care about integer-encoded categorical variables?

The isolation forest (initial paper, follow-up paper) as well as the proposed extended isolation forest (paper) seem like very appealing unsupervised anomaly detection techniques. However, the ...
0
votes
1answer
16 views

How to encode categorical variables in a video game predictive model

I'd like to make a model to predict the result of a match in a video game (win or loss). The game is 3 players against 3 players, and each player has a specific character with specific ...
1
vote
1answer
98 views

Which ML Algorithms are affected by dummy variable trap?

My understanding is that regression models are affected by the dummy variable trap. What about other machine learning algorithms e.g. linear svm, logistic regression? Also, if an algorithm is not ...
3
votes
1answer
32 views

Can I remove a dummy variable when it is not significant by itself, but its interaction with another variable is?

I have the following model based on the financial returns of a company as a dependent variable of a stock market index, and a dummy variable interacting with USD exchange rates to my currency. The ...
0
votes
0answers
15 views

Basic question about dummy variables for breakpoint treatment

I am studying basic Econometrics and trying to understand how to deal with breakpoints using dummy variables. I found 3 significant break-points in my data (using 5% confidence) with the Chow ...
2
votes
1answer
154 views

Clear explanation of dummy variable trap [duplicate]

I have a confusion in multiple regression about dummy variable trap, so far I had seen tutorials explaining about dummy variable trap and multicollinearity but I'm unable to understand it fully.
2
votes
3answers
218 views

Standardizing dummy variable in multiple linear regression?

I have a multiple linear regression model with several independent variables in different units. Because some of my data is negative, I am unable to take the log and therefore am standardizing the ...
0
votes
0answers
13 views

Are predictions from an OLS model that only contains categorical covariates biased, if the mean of the residuals does not equal zero?

I understand that the mean of the residuals being zero is a requirement for an OLS model. I also know that when you include the intercept in a regression model, it forces the mean of the residuals to ...
0
votes
1answer
19 views

Using one-hot encoded features along with continuous-valued features?

The task I wanted to do is a prediction task where most of the features are continuous numbers and some of the features are one-hot encoded. I am training a neural network and I wondered that, is it ...