Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
11 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 ...
0
votes
0answers
13 views

What's the effect of using TF-IDF encoded instead of one-hot encoded categorical data as input to a neural network?

As input into a simple neural network multi-class classifier, I am considering using a variation of the standard one-hot sparse matrix to represent categorical variables. Instead of each element ...
2
votes
2answers
17 views

Linear model with binary variable VS create two linear models

Let's say, there is a variable sex in the data set. I could either: Build one model on the whole data and encode the sex into <...
2
votes
1answer
30 views

Problems from having too many interactions in a regression?

Excluding the 'dummy variable trap', are the problems from including too many interaction terms in a regression any different from the problems of including too many continuous or binary variables in ...
0
votes
1answer
29 views

Should I convert a target variable with StandardScaler?

For a multiple linear regression model, I have done two things to preprocess my data: I have scaled continuous variables with StandardScaler I have encoded categorical variables with OneHotEncoder ...
1
vote
1answer
56 views

Encoding of categorical variables with high cardinality

For unsupervised anomaly detection / fraud analytics on credit card data (where I don't have labeled fraudulent cases), there are a lot of variables to consider. The data is of mixed type with ...
0
votes
0answers
11 views

Dummy coding, ranking of categorical variables

I need to rank categorical variables (top 5 reasons for staying married, top five reasons for divorce). I need to find a method for dummy coding these variables, and then ranking/weighting them (for ...
0
votes
0answers
42 views

Should we penalize dummy variables?

Using glmnet we run the following regression cvfit = cv.glmnet(x,y, alpha = 0, intercept = FALSE) where $y$ is the response variable and $x$ is the input matrix....
1
vote
3answers
55 views

How many dummy variables should we include in our multiple linear regression analysis?

I am building a multiple linear regression model and wonder how many dummy variables can be included. I have 2 categorical variables: 1 with 13 levels and the second with 20 levels. Can I include ...
1
vote
2answers
83 views

How to calculate Helmert Coding

I am trying to understand how Helmert Coding works I know it compares levels of a variable with the mean of the subsequent levels of the variable, but what are these levels and how can I calculate ...
0
votes
0answers
5 views

Label encoding vs Dummy variable/one hot encoding - correctness?

i understand that when label encoding is used, the numeric number can be interpreted to have an order and a model could assume a linear relationship. However shouldn't this be a problem when there are ...
0
votes
0answers
18 views

Collinearity when regressing against three sets of dummies

I would like to regress price of food products against three sets of dummy variables: 1. the food product itself (13 products) 2. the country where the food product was priced (119 countries) 3. the ...
0
votes
0answers
33 views

How to interpret coefficients obtained from an ordinal variable in a linear regression?

I'm following this example https://stats.idre.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/ I was wondering what is the correct interpretation of the coefficients ...
0
votes
0answers
4 views

Categorical control variables PROCESS

At the moment I want to perform a mediated regression analysis using PROCESS. My Independent value (IV), Dependent value (DV) and Mediator (M) are all numerical data. I analyze a simple mediation and ...
0
votes
1answer
24 views

Interpreting dummy variable interaction terms

I am attempting to model monthly retail electricity sales. To account for both the effects of seasonality and weather, I created an interaction term by multiplying 12 monthly dummy variables by the ...
1
vote
1answer
31 views

Inputting playing card values to aneural network

I am trying to create a NN to play a card game wherein each state is represented by the hands of 4 players. Every round, the hand of each player is decreased by 1 (discarded). Each player starts with ...
0
votes
0answers
22 views

What does the intercept represent in a model matrix?

I am making a KNN algorithm to predict close_price with about 80,000 rows of this data. ...
0
votes
0answers
6 views

Dummy code interaction among categorical variables

Do you know if there is a way of dummy coding the interactions among three independent categorical variables using SPSS? (with two levels each) thanks a lot!
3
votes
1answer
73 views

Is it valid to have all zeroes in a One-Hot Encoded categorical feature?

I'm building an MLP classification model and one of my features is the name of certain products. These names can be anything and in theory there could be an infinite number of different names in the ...
1
vote
1answer
52 views

How to calculate the coefficient of a dummy variable reference category?

I am currently building a regression model with numerous continuous, categorical (employing dummies) and interaction variables. I understand we must use k-1 dummies with one variable becoming the ...
0
votes
0answers
15 views

Condensing values of categorical data

Beginner ML question here. I have a dataframe with a categorical column, a lot of the values are slightly different but essentially mean the same thing. Here's an example of such values: ...
0
votes
1answer
34 views

Replacing CNNs with Random Forests

Suppose I have a sequence like "ADTGESW". Each character in this sequence can attain a number of possible values, let's say 10. I can then one-hot encode this sequence and obtain a matrix with shape ...
0
votes
1answer
23 views

For Matching on a categorical variable with N categories, will it suffice to create (N-1) binary features and match on them?

I have data on patients who received different amounts of Occupational therapy (High Dose vs Low Dose) after a stroke. We are investigating if there are differences in recovery between patients from ...
0
votes
0answers
18 views

Multiple linear regression with dependent as a dummy predictor

I have a model $Y = \alpha + \beta_1X_1 + \beta_2X_2$. $Y$ has a bimodal normal(ish) distribution, so I'm looking to see if the relationship between the predictors and the response is different for ...
0
votes
1answer
27 views

Do we need a reference dummy variable for non-mutually exclusive groups?

I am trying to build a GLMM and have converted a group of factors to dummy variables. Many have multiple groups and I would like to test the interactions between them as well. Do I need a reference ...
1
vote
0answers
25 views

Can I include an 'industry dummy' in my Relative Weight analysis? Bootstrapping produces error message!

I am analyzing the impact of 7 different employee satisfaction variables(x1, x2,...,x7) on financial performance in 200 companies over 3 years. Since these 7 predictor variables are highly correlated ...
0
votes
0answers
42 views

Interpretation of logit model without reference category

I have developed a logit model with binary dependent variable in R using the glm function. Overall, the independent variables include seven nominal, 23 ordinal, and two numeric variables. The nominal ...
1
vote
1answer
26 views

Multiple regression with a odd-numbered Likert items

In the questionnaire, individuals were asked to pick from an odd number of options (5 or 7) how much they agree with the statement (from completely agree to completely disagree). Now, if there where ...
0
votes
0answers
13 views

WoE of test dataset

How to encode the categorical data to Weight of Evidence in the test dataset? I am interested to know about how to handle the categories which are not present in the training set.Or should we combine ...
1
vote
1answer
19 views

Transforming categorical variables

Can someone explain me in which cases is a good idea to convert a categorical variable to numerical in order to used it in our model (either regression or classification). I have seen cases where even ...
0
votes
1answer
36 views

Linear Regression in R: factor or z-standardise dichotomous variables

How should one handle dichotomous variables in a linear regression? Is it better to z-standardise or is it better to use factors? For example I have data of an Experiment with a 2x2 Design in which ...
0
votes
1answer
39 views

General Linear Model applied to binary data

So here I am studying regression analysis. As an assignment, I have been asked to obtain some binary data, simulate its behavior from some sample of it and apply the resulting general linear model to ...
2
votes
1answer
30 views

Does dummy code a variable affect the intercept in a linear regression model

My colleague and I were both using R to fit a linear regression with the same dataset and same variables. The outcome variable is test grade while the independent variables are gender, age, and times ...
4
votes
1answer
82 views

“Joint” dummy variables for two different variables

I am supposed to show the hazard ratio (HR) stratified by gender (1= female vs. 2= male) and age groups (quartiles, 1-4)*. The combination "female" and "first quartile of age" is supposed to be the ...
0
votes
0answers
14 views

Should one hot encoding be done on Likert scale ratings?

This seems like an easy question but I haven't been able to find a definitive source for this or questions that address this topic directly. When applying a classification algorithm, should you apply ...
0
votes
1answer
45 views

h2o glm tweedie for categorical variables

To build a tweedie glm for categorical variables, the document suggested that I can use data['variable_name'].asfactor(). However, in the model output, there is no reference level, i.e., if I have ...
0
votes
0answers
21 views

Interpreting findings of moderation using PROCESS Macro

I have recently conducted a moderation analysis using the PROCESS Macro plug-in for SPSS. I have tested the moderation effect of W (categorical using dummy variables) on the relationship between X (...
0
votes
3answers
125 views

Does Categorical Variable need normalization/standardization?

since we do normalize as 10kg >>> 10 grams or 1000 >> 10. so incase of one hot encoding eg male=0 and female =1, are we giving more weight to female as 1>0 for training our models?
1
vote
0answers
25 views

Dummy variable reference category

As part of my thesis, I am exploring the effect of firm owner type on research and development, which is a ratio. I have a dummy variable of company owner type with 10 categories e.g. Bank, ...
1
vote
0answers
34 views

Is there a theoretical basis for using partial least squares with categorical responses

I am using what is called PLS-DA in JMP to find a model for predicting a categorical (Positive/Negative) response. The documentation says that the responses are simply coded as 0/1, thereby ...
0
votes
0answers
26 views

How to deal with a potentially multiple categorical variable

I'm building a model that has, as inputs, some categorical variables. I had already dealt with this sort of data before, and applied different techniques as creation of dummy variables and factor ...
1
vote
1answer
25 views

In the summary of output of the regression analysis in R, is there a way to display categorical variable with just one coefficient [closed]

I am doing a linear regression analysis in R with logarithmic dependent variable. One of the control variables is categorical and describes an industry. There are 6 industries and thereby R ...
0
votes
0answers
43 views

How do you run a regression when categorical variables may be involved, using R?

I have a data set with several categorical and quantitative variables. Say A, B, and C are categorical with several levels, X and Y are quantitative. I know that X ~ A will basically just be a ...
0
votes
2answers
28 views

Can a dummy variable be used to correct ARCH?

Is it possible to use a dummy variable to allow for a structural break, in order to correct Autoregressive Conditional Heteroscedasticity?
0
votes
0answers
36 views

Linear Regression and High Dimensional Categorical Data

I've read that mean encoding is useful for classification tasks with high dimensional categorical data. My question: What kinds of encodings are effective for high dimensional categorical data in ...
0
votes
0answers
71 views

Dropping One-hot-encoded columns in Pandas/Sklearn

When one-hot-encoding categorial features in python with pandas or sklearn, when should I drop one of the resulting columns? I recall something about having all columns present being a problem for ...
0
votes
0answers
18 views

Finding the fitted probability for an aliased constraint in a binomial model?

For a binomial model, with probit link function: model = glm(response~A+B+C, family = binomial("probit"), na.action = na.omit) where A and B are continuous, C is ...
0
votes
1answer
33 views

Can you use two dummy variables?

Is it possible to use two dummy variables for breakpoints in a linear regression? In EViews I've created the following: ls log(consumption) c log(gdp) log(gdp(-1)) log(consumption(-1)) @year>1989 @...
0
votes
0answers
71 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,...
2
votes
0answers
9 views

estimation inter rater reliability for strings of characters (i.e. URLs)

I have multiple raters extracting URLs from the internet based on search terms. The core issue is that a URL amounts to a string wherein two raters might come to the same URL but one string is a ...