The recently released chest X-ray dataset, ChestX-ray14, has attracted more and more attention on automatic detection of thoracic diseases. In this work, we use deep learning techniques to develop a multi-class classifier. Given a chest X-ray image as input, the classifier outputs a vector of probability values, of which each component corresponds to the probability of having one specific thoracic disease. The merit of our proposed solution is based on several major observations of the ChestX-ray14 data. First, the diversity in ChestX-ray14 is much smaller than that in other natural image datasets such as ImageNet due to very similar global outlines of chest X-ray images. Second, ChestX-ray14 is much more imbalanced than the datasets considered in most existing studies. The size of the largest class is 87.57 times larger than that of the smallest class. Third, from the application perspective, the task is not really cost-sensitive to misclassifications, thus it is difficult to manually fix weights for different misclassifications. To deal with these difficulties, we propose an adaptive sampling method that monitors the performance of the model during training and automatically increase the weight of relatively poorly performed classes. Extensive experiments demonstrate that our proposed method outperforms the state-of-the-art algorithms.