I am trying to use sklearn to perform MLP-based regression using a network with 24 inputs mapped to 24 outputs.

The inputs and outputs correspond to to feature vectors corresponding to pairs of samples. My processing pipeline is as follows:

  • Extract features (initial vector size 45)
  • Scale features with sklearn.processing.StandardScaler
  • Perform PCA with decomposition.PCA(n_components=0.90, svd_solver='full')
  • Scale again with MinMaxScaler
  • Train MLPRegressor with input / output pairs (PCA vector size 24)

The process seems to broadly work, and I am achieving low training loss (0.02..0.009) after 20 or so iterations.

However, no matter how I configure the hidden layers for the network (I'm currently using 1 hidden layer with 24 neurons, but I've tried other configurations) or other parameters of the neural net, the actual output always has less variance than the expected output. It is as if the output of the neural net is "smoothed" with respect to the expected.

Here are some examples where I have tested the trained network (predict()) using an input from the training set:

Prediction results 1 Prediction results 2

These are typical in that the details seem to be lost in the actual output compared to the expected. The only thing that seems to improve this is the kind of pre-scaling used prior to training, with the MinMaxScaler giving much better results than e.g. RobustScaler where the expected varies even more with respect to the actual.

Are there any measures to get a closer fit here given my test samples are taken from the training set, or is the behaviour shown above to be expected?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.