Questions tagged [feature-scaling]

Feature scaling is a data pre-processing step where the range of variable values is standardized. Standardization of datasets is a common requirement for many machine learning algorithms. Popular feature scaling types include scaling the data to have zero mean and unit variance, and scaling the data between a given minimum and maximum value.

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

Do I need to encode numerical variables like "year"?

I have a simple time-series dataset. it has a date-time feature column. ...
user avatar
0 votes
1 answer
29 views

Why does log-transforming the target have a huge impact on MSE value?

I am doing linear regression using the Boston Housing data set, and the effect of applying $\log(y)$ has a huge impact on the MSE. Failing to do it gives MSE=34.94 ...
user avatar
  • 109
0 votes
1 answer
58 views

Feature selection before or after scaling and splitting

Should feature scaling/standardization/normalization be done before or after feature selection, and before or after data splitting? I am confused about the order in which the various pre-processing ...
user avatar
  • 109
0 votes
2 answers
36 views

Standardization in combination with scaling

Would it be ok to standardize all the features that exhibit normal distribution (with StandardScaler) and then re-scale all the features in the range 0-1 (with <...
user avatar
  • 109
2 votes
2 answers
54 views

Is it wise to always `StandardScaler()` features? [SOLVED]

My current investigations point to the sklearn.preprocessing.StandardScaler() not always being the right choice for certain types of feature extractions for neural ...
user avatar
0 votes
0 answers
37 views

Clustering observations vs clustering features

suppose I want to apply a clustering method of my choice (K-means, hierarchical, ...) to a matrix of observations $X \in \mathbb{R}^{n \times p}$, where $n$ is the number of observations and $p$ the ...
user avatar
0 votes
1 answer
14 views

Scaled-input-trained ML Models

I have input data, the magnitudes vary quite a lot between features. I have scaled them using sklearn's StandardScaler(), then used keras to train a NN on this data to predict my target. I have ...
user avatar
  • 21
0 votes
1 answer
134 views

__init__() takes 1 positional argument but 4 were given sklearn standard scaler error

I defined a class like below: ...
user avatar
0 votes
1 answer
9 views

Is It Okay To Do 0-1 Scaling Then Divide By The Standard Deviation?

If am understanding stuff correctly, if I have a df I can first do 0-1 scaling on it to get equal ranges while preserving the data series's original means and standard deviations and then once I ...
user avatar
0 votes
1 answer
28 views

Feature scaling on null values

How to handle null values in dataset for performing feature scaling on a particular column? i.e.Should we keep the null value as it is or impute some other value? Is there any tutorial on how to ...
user avatar
1 vote
0 answers
11 views

Feature Scaling + Selection when target is imbalanced

If my target is imbalanced, when should I do target balancing in preparation for modeling? Before feature scaling and selection? After feature scaling and selection? If I am doing backward elimination,...
user avatar
  • 11
0 votes
0 answers
9 views

sampling fall on which category of data mining

I have a question regrading the steps of data mining. After searched on Google I came to know that Data mining have 7 key steps ...
user avatar
  • 137
0 votes
0 answers
34 views

Scaling columns pandas DataFrame

For a dataset having different numeric columns, they usually have different range and distributions. As an example, I have used the Iris dataset. The distributions of it's 4 columns are shown: My ...
user avatar
  • 121
2 votes
1 answer
90 views

Standardization vs min-max scaling

In the book Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow 2nd Edition by Aurélien Géron, the author quoting: Unlike min-max scaling, standardization does not bind values to a ...
user avatar
0 votes
1 answer
114 views

Should outliers be removed only from the target variable or from any variable where they are found?

What I often do is that I check boxplots and histograms for target/dependent variable and after much caution, treat/remove the outliers. But this is what I do only for the target variable. I.e., if ...
user avatar
2 votes
0 answers
61 views

Can I rescale TF matrix or TF-IDF matrix using StandardScaler prior to Logisitc Lasso regression?

I am trying to use Logistic Lasso to classify documents as 1 or 0. I've tried using both the TF matrix and TF-IDF matrix representations of the documents as my predictors. I've found that if I use the ...
user avatar
1 vote
1 answer
40 views

Correct approach to scale (min-max scaler) both input and output signal data for unsupervised learning?

I am working on a denoising autoencoder problem with noisy and clean signals. Before I pass the signals to my model I want to apply min-max normalization and am unsure of the correct way to apply this....
user avatar
  • 13
0 votes
1 answer
97 views

For sklearn ML algorithms, is it possible to use boolean data alongside continuous data for the predictive data, and if so how can the data be scaled?

I have a medium size data set (7K) of patient age, sex, and pre-existing conditions. Age of course is from 0-101, sex is 1 for male, 2 for female, and -1 for diverse. All the pre-conditions are ...
user avatar
  • 103
0 votes
1 answer
103 views

What does Keras image generators do with input images samplewise_std_normalization= True?

I have trained a a convolutional network samplewise_std_normalization=True. Now I want to check my model in real-time using Opencv. Therefore I would like to perform the same preprocessing on the ...
user avatar
0 votes
0 answers
9 views

How to treat outliers for a composite indicator?

I have a dataset with each row representing a country and each column is an indicator. I am building a composite indicator and I need each column to be scaled between 0 and 1. I am using the MinMax ...
user avatar
1 vote
1 answer
34 views

How are the values for the `sex` feature in sklearn Diabetes dataset obtained?

I'm just starting out with using sklearn for my own Machine Learning project and I'm using sklearn's built-in "Diabetes&...
user avatar
0 votes
1 answer
36 views

how to choose between data normalization or standadization?

I have been studying about data scaling. Two common methods for it are the StandardScaler and MinMaxScaler. As I understood, StandardScaler expects the data to be normally distributed, but I have seem ...
user avatar
0 votes
0 answers
29 views

Predicting labels greater than those in training set

I have to use a neural network to predict the value of a certain stock on the next day. I'm using an lstm net, feeding it with 7 days worth of data and using the 8th day price as target. I split the ...
user avatar
0 votes
0 answers
14 views

Fit StandardScaler API with training data and only transform the test set with the same parameters (losing model generalization)

If the standard scaler is better than the min max normalizer in terms of model generalization, since the standard deviation and mean are not the same for every attribute and can vary for different ...
user avatar
0 votes
1 answer
135 views

Scaling multi input LSTM

I have a single layer LSTM model with 300 time series which try to predict the next value for one time series, based on past 12 values of the 300 time series. 56 is the number of slices of length 12 ...
user avatar
3 votes
3 answers
433 views

Model performance worsens after Cross Validation

I am training a logistic regression model on a dataset with only numerical features. I performed the following steps:- 1.) heatmap to remove collinearity between variables 2.) scaling using ...
user avatar
  • 1,241
3 votes
0 answers
35 views

How can - and why does - Random Forest over-forecast? [closed]

My understanding of Random Forest Regression is that each leaf node contains one or multiple examples from the training data. When predicting, each tree finds the most appropriate leaf and takes the ...
user avatar
  • 131
0 votes
1 answer
62 views

Standardizing giving worse results

I am training a Decision tree regressor on the famous Boston House Price dataset. I read that tree based models are fairly immune to scaling so I tried to see practically. Before scaling I was getting ...
user avatar
  • 1,241
0 votes
1 answer
517 views

sklearn MinMaxScaler: Inverse does not equal original

I am using MinMaxScaler on a large dataset (2201887, 3) to normalize features. Inversed values does not match originals. I tested with the target column, first (a), I applied the scaler on 10 values, ...
user avatar
2 votes
1 answer
294 views

When and how to use StandardScaler with target data for pre-processing

I am trying to figure out when and how to use scikit-learn's StandardScaler transformer, and how I can apply it to the target variable as well. I've read this post ...
user avatar
  • 85
0 votes
1 answer
227 views

Why does min-max scaler result in lower accuracy with regression tree?

I have a dataset that contains 7 features. Values are not too large. I trained scikit-learn's RandomForestRegressor for predicting the target variable. The $R^2$ ...
user avatar
0 votes
1 answer
32 views

Preprocess multi-sample time series data: encode each sample separately or in aggregate?

Let's say I have 3 dense sequences of uniform length. Should I fit a scaler on them separately or together? ...
user avatar
  • 476
0 votes
0 answers
442 views

Reversing the Feature Scaling of scale( ) in R

Short Question How to revers or revert the feature scaling done in R using scale() or is there any other suitable feature scaling method. Long Question Feature ...
user avatar
0 votes
0 answers
20 views

Data scaling for time series forecasting

I am doing a time series forecasting project, where I make one step ahead forecasts meaning that my test set is only a single observation. Should I scale the test data as well as my training set and ...
user avatar
1 vote
1 answer
211 views

Should I scale or normalise my dataset before clustering? [closed]

So i have a dataset with variables with unit of measurement as milligrams, kgs and quintals. Should i use standard scaler or minmaxscaler to scale the dataset.
user avatar
0 votes
0 answers
35 views

Predicting Y Values Properly in a Regression Task using Scaled Values (Random Forest & MLP)

I have a supervised learning regression task: I am trying to forecast demand for a product based on sales in past years. Data description: Samples (rows) - Demand for a certain product (at a certain ...
user avatar
  • 1
1 vote
1 answer
47 views

Do I have to scale/normalize my training data for LSTM Classification, even if I only have one feature?

I have a time-series data as follows: ...
user avatar
  • 171
1 vote
1 answer
44 views

Categorical encoded variables in scikit-learn diabetes dataset [closed]

When using sklearn.datasets import load_diabetes, the sex variable which is categorical, is scaled to continuous values. Is it even legal to scale such variables?
user avatar
0 votes
1 answer
52 views

Data Selection according to Feature Values

I am given a dataset consisting of 10 million molecules. Each row contains: The average value predicted by an ensemble of regression models trained to predict a certain property about chemicals (...
user avatar
1 vote
1 answer
26 views

Standardizing mixed type data

Hope you are doing well. I have some problem with mixed. For the classification problem, can we standardize categorical and numerical variables together or just standardise numerical variable or don't ...
user avatar
1 vote
1 answer
80 views

What is the difference between normalization and re-scaling?

This site does not describe the nature of the normalization tag. How does it differ from re-scaling? Many authors use the two terms interchangeably. I can not understand normalization's operational ...
user avatar
0 votes
1 answer
62 views

How important is outcome variable scaling in SVM regression?

Should I scale outcome variable for SVM regression? What is the magnitude of impact of outcome variable scaling in SVM regression?
user avatar
  • 157
0 votes
0 answers
43 views

Data scaling for convolutional neural networks and other issues

My project involves deep learning on physiological data gathered from a wearable device. I aim to evaluate the potential CNN usefulness in classifying data collected from the wearable. The wearable ...
user avatar
0 votes
0 answers
41 views

Which PreProcessing method should be used?

I have a dataset that consists of a poisson distribution, a exponential distribution, categorical variables, and my target variable is a numerical bimodal variable. This is a regression model. I ...
user avatar
0 votes
0 answers
14 views

estimate user's satisfaction of a video based on how much of it they watched - normalization

I am trying to estimate how much a user liked a video using how much of the video they watched. Let's say, on the scale of 1 to 10, 1 means that the user didn't like it at all, and 10 means they ...
user avatar
3 votes
1 answer
45 views

How best to use the resale transaction year in predicting housing prices?

I'm looking into the classic problem of predicting apartment prices (resale market) based on the their type, size, location, etc. Pretty straightforward and Linear Regression or Regression Trees give ...
user avatar
  • 131
0 votes
2 answers
61 views

StandardScaler's mean and standard deviation for real-life data?

I've heard that we should use train dataset's scale for that of test data so they are in line with each other in terms of scale. And I know we use transform() ...
user avatar
0 votes
1 answer
356 views

K-Fold cross validation and data leakage

I want to do K-Fold cross validation and also I want to do normalization or feature scaling for each fold. So let's say we have k folds. At each step we take one fold as validation set and the ...
user avatar
1 vote
1 answer
191 views

Scaling the activation function

It is obvious that I have to scale the output data if the range of values is between say [-10;10] and the activation function of the output layer takes values in the interval [-1;1]. But I could also ...
user avatar
  • 13
-1 votes
2 answers
434 views

Using MinMaxScaler on Training Set... Do I need to scale the input for a prediction as well?

I know this is a rookie question, but I'm having trouble with getting predictions out of a model. I use a MinMaxScaler() function on the training set as seen below... ...
user avatar

1
2 3 4 5