When using a scaler before inputting numbers to a neural network, should the scaler be…
- User
When using a scaler before inputting numbers to a neural network, should the scaler be fitted on the entire dataset or on the training data?
Assistant
The scaler should be fitted on the training data only, not the entire dataset. This is a critical best practice to avoid data leakage.
Here's why and how to do it correctly:
Why fit only on training data:
- Fitting on the entire dataset would leak information from the test set into your preprocessing step
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.