Skip to main content
34 votes
Accepted

Encoding features like month and hour as categorial or numeric?

Have you considered adding the (sine, cosine) transformation of the time of day variable? This will ensure that the 0 and 23 hour for example are close to each other, thus allowing the cyclical nature ...
Pablo O's user avatar
  • 476
24 votes
Accepted

Feature selection vs Feature extraction. Which to use when?

Adding to The answer given by Toros, These(see below bullets) three are quite similar but with a subtle differences-:(concise and easy to remember) feature extraction and feature engineering: ...
Aditya's user avatar
  • 2,470
22 votes

Feature Transformation on Input data

We love the normal form In most cases we try to make them act like normal. Its not classifiers point of view but its feature extraction view! Which Transformation? The main criterion in choosing a ...
Hadi Gharibi's user avatar
20 votes

What is difference between one hot encoding and leave one out encoding?

They are probably using "leave one out encoding" to refer to Owen Zhang's strategy. From here The encoded column is not a conventional dummy variable, but instead is the mean response over ...
Dex Groves's user avatar
20 votes

How to perform feature engineering on unknown features?

You do not need domain knowledge (the knowledge of what your data mean) in order to do feature engineering (finding more expressive ways of framing your data). As Tu N. explained, you can find "...
Winks's user avatar
  • 1,366
20 votes
Accepted

Why do we convert skewed data into a normal distribution

You might want to interpret your coefficients. That is, to be able to say things like "if I increase my variable $X_1$ by 1, then, on average and all else being equal, $Y$ should increase by $\beta_1$"...
Ricardo Cruz's user avatar
  • 3,420
18 votes

Encoding features like month and hour as categorial or numeric?

The answer depends on the kind of relationships that you want to represent between the time feature, and the target variable. If you encode time as numeric, then you are imposing certain restrictions ...
raghu's user avatar
  • 641
14 votes
Accepted

Is (manual) feature extraction outdated?

In the general case, this is by no means true. Let's break down the case for different data scenarios: For discriminative image models (e.g. image classification/labeling) this is true for some ...
noe's user avatar
  • 26.7k
13 votes

List of feature engineering techniques

Missing Data Imputation: Complete case analysis Mean / Median / Mode imputation Random Sample Imputation Replacement by Arbitrary Value Missing Value Indicator Multivariate imputation ...
Sole G's user avatar
  • 281
11 votes

Is (manual) feature extraction outdated?

No, manual feature extraction is not outdated. In addition, manual feature extraction is hard to do-away, given, a data scientist needs business and domain logic to build a robust model to replicate ...
DataFramed's user avatar
10 votes

List of feature engineering techniques

There is no definite source on how to do feature engineering. It is often dependent on the problem you are trying to solve. Some say it is more of an art than it is science. But I would go through ...
phiver's user avatar
  • 718
9 votes
Accepted

How to get spike values from a value sequence?

This is very simple. Let's say your data in Panda format (named data_df), and extracting peaks/spikes over a certain threshold (e.g. 15000 here) is simply: ...
TwinPenguins's user avatar
  • 4,259
8 votes

Are there any tools for feature engineering?

Featuretools is a recently released python library for automated feature engineering. It's based on an algorithm called Deep Feature Synthesis originally developed in 2015 MIT and tested on public ...
Max Kanter's user avatar
8 votes

How to deal with categorical feature of very high cardinality?

This is an old question. I am surprised that I don't see anyone mentioned Mean Encoding (a.k.a Target Encoding). It is very popular in supervised learning problems. Besides, I have seen people use ...
Diansheng's user avatar
  • 181
8 votes

Encoding features like month and hour as categorial or numeric?

I recommend using numerical features. Using categorical features essentially means that you don't consider distance between two categories as relevant (e.g. category 1 is as close to category 2 as it ...
Tanguy Coatalem's user avatar
8 votes
Accepted

Feature agglomeration: Is it testing interactions?

From the documentation: Similar to AgglomerativeClustering, but recursively merges features instead of samples. In standard agglomerative clustering you receive a matrix $M^{n \times m}$ ...
Dani Mesejo's user avatar
  • 2,226
7 votes
Accepted

How to deal with categorical feature of very high cardinality?

One-hot-encoded ZIP codes shouldn't present a problem with modern tools, where features can be much wider (millions, billions even), but if you really want you could aggregate area codes into regions, ...
Emre's user avatar
  • 10.5k
7 votes

What is the rationale for discretization of continuous features and when should it be done?

One reason to discretize continuous features is to improve the signal-to-noise ratio. Fitting a model using features that have been binned reduces the impact that small fluctuations in the data have ...
Brian Spiering's user avatar
7 votes
Accepted

Why is duplicating inputs bad?

The issue with building a regression model on all 3 of these is that you are potentially introducing multicollinearity into the model. Although log(input) and sqrt(input) are not linear functions of ...
bnorm's user avatar
  • 533
6 votes

Boruta feature selection in R with custom importance (xgboost feature importance)

Boruta is by universal reputation dog-slow and not very good. Boruta runs take many hours or days. VIF feature-selection algorithm is not objective, anyway. You can program your own feature-selection ...
smci's user avatar
  • 331
6 votes

Can GPS coordinates (latitude and longitude) be used as features in a linear model?

You cannot use them directly, as it is unlikely there is a true linear relationship unless you're looking to predict "how far east or north" someone is. As mentioned in the comments, you need to ...
CalZ's user avatar
  • 1,663
6 votes

What is the ideal database that allows fast cosine distance?

If you need to scale beyond 1000 entries in the future, a brute-force approach to find the exact neighbors will become increasingly prohibitive from a computational standpoint. To future-proof your ...
Addison Klinke's user avatar
6 votes
Accepted

To remove Chinese characters as features -

If you want to remove non-English characters then this regex will work, by selecting characters not in a given ASCII range (0 to 122, you can adjust this since it will allow some special characters): ...
Dan Carter's user avatar
  • 1,732
5 votes

Unsupervised feature learning for NER

In this 2014 paper (GitHub), the authors compared multiple strategies of incorporating word embeddings in a CRF-based NER system, including dense embedding, binerized embedding, cluster embedding, and ...
user2404894's user avatar
5 votes

How to use GAN for unsupervised feature extraction from images?

Typically to extract features, you can use the top layer of the network before the output. The intuition is that these features are linearly separable because the top layer is just a logistic ...
kenny's user avatar
  • 435
5 votes

Encoding features like month and hour as categorial or numeric?

It depends on which algorithm you're using. If you're using tree-based algorithms like random forest, just pass this question. Categorical encoding isn't necessary for tree-based algorithms. For ...
Icyblade's user avatar
  • 4,326
5 votes
Accepted

How to transform raw data to fixed-frequency time series?

This sort of effect can be achieved with pandas.DataFrame.resample() combined with Resampler.aggregate() like: Code: ...
Stephen Rauch's user avatar
  • 1,783
5 votes
Accepted

What are the best ways to use a time series data for binary classification

From your comment, I understand that you are trying to solve the binary classification problem using your aggregated data and you are getting very poor results when you simply use the mean. ...
aivanov's user avatar
  • 1,510
5 votes
Accepted

Convolutional Neural networks

Why don't we convolve our images against the last convolution layer and see how many of these complex feature filters get activated? The answer is that all the layers are fully dependent on the exact ...
Neil Slater's user avatar
  • 28.9k
5 votes

Feature selection vs Feature extraction. Which to use when?

As Aditya said, there are 3 feature-related terms that sometimes are confused with each other. I will try and give summary explanation to each one of them: Feature extraction: Generation of features ...
missrg's user avatar
  • 578

Only top scored, non community-wiki answers of a minimum length are eligible