• You're one step from joining Machine Learning Forums | AI Research, Deep Learning, and Neural Networks Discussions.
    Create a free account to post, follow threads, and never miss an update.  Sign up free →

Why only fit training data and not testing data?

travis1

New member
Joined
Jan 12, 2026
Messages
1
I'm trying to understand how exactly the standard scaler works. Currently I'm having trouble understanding exactly why we only fit/transform the training data and not testing. From the research that I've done, apparently we dont want the model to learn any information about the testing data, but I'm not at all understanding how those 2 are connected. Why does fitting the testing data affect the model at all. For reference I'm practicing building an MLP model with the load_digits dataset from sklearn.

Also any clarifications about the fit, transform adn fit_transform functions would be great since I'm still trying to wrap my head around these concepts.

Thank you
 
The purpose of training the model is to make it as general as possible so that it can work (in practice) when it's given new unexpected variables. So the training data is just to prepare the model for that job, the testing data MUST not be touched in the training process (simulating the real problem)
 
We fit the model only on training data so it learns patterns, then use test data to check how well it generalizes to unseen data. Training on test data would cause overfitting and give misleading performance results.
 
Back
Top