nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook
https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition
MIT License
6.23k stars 2.41k forks source link

DNN Linear regression #143

Closed wtingsam closed 6 years ago

wtingsam commented 6 years ago

Nick, the cookbook and your website are very nice. I learned a lot from it. I think you are very familiar to machine learning. So I have no way to contact you but here.

I have been doing deep learning CNN regression for about half year. I tried many ways from selecting/normalisation of targets and feature/making sure the labels are uniform distribution to scanning of all sorts of hyper parameters and optimiser.

I realised the model is always giving me the mean value of the target distribution. For example, the target distribution is from [0.5, 0.1] , with a mean at around 0.8 and r.m.s. around 0.3. The trained model always gives me the mean value around 0.8.

and if the target distribution is double peaks with mean values at -0.5 and 0.5, the trained model will predict near 0.

From your experience, do you have any suggestion?? I am sorry to talk to you in this way

nfmcclure commented 6 years ago

Hi @wtingsam , Thanks for the message. I'm glad you find the book/site useful.

I've had some similar problems with modeling in the past. There are a few things to consider, when the predictions cluster around the mean/median too much.

  1. What does the distribution of targets for the training data look like? If the training data tends to be clustered, then the predictions will be as well. Not much to do here except maybe collect more data or filter out duplicates (or near duplicates).
  2. What does the distribution of the x-data for the training look like? (i.e. features)? If there isn't much variation in the features, all models will have problems differentiating between them. If you find you have very little variation, you may try things like normalization, standardization, or even PCA on the numerical features to extract more information from them.
  3. Do you have a class representation problem? If you are doing classification (and it appears you are not, so this bullet point is probably for other readers) your training set should represent all classes equally (or as expected).

Also, I highly encourage you to look at benchmarks and simpler models and see how they perform first. E.g.

I've found that looking at the data distributions, clusters, and benchmarks (and other models), helps me understand where I went wrong or what I should do with the data.

But unless we can see an example with actual data and code, there's not much else I can do. Good luck!