A new model for calculating the solvation energy of proteins is developed and tested for its ability to identify the native conformation as the global energy minimum among a group of thousands of computationally generated compact non-native conformations for a series of globular proteins. In the model (called the WZS model), solvation preferences for a set of 17 chemically derived molecular fragments of the 20 amino acids are learned by a training algorithm based on maximizing the solvation energy difference between native and non-native conformations for a training set of proteins. The performance of the WZS model confirms the success of this learning approach; the WZS model misrecognizes (as more stable than native) only 7 of 8,200 non-native structures. Possible applications of this model to the prediction of protein structure from sequence are discussed.