Prediction of material property is a key problem because of its significance to material design and screening. Here, we present a general machine-learning method for polymer compatibility. Specifically, we mine data from related literature to build a specific database and give a prediction based on the basic molecular structures of blending polymers and, as auxiliary, the blending composition. Our model obtains at least 75% accuracy on the dataset consisting of thousands of entries. We demonstrate that the relationship between structure and properties can be learned and simulated by a machine-learning method.