[Objective]The purpose of this study is to improve the overall diversity of the recommendation results. The proposed algorithm reduces errors caused by the uneven distribution and sparsity of user rating data, and then improves the recommendation accuracy and diversity. [Methods] We first generated the relative similarity index based on the number of common ratings and individual weights. Second, we modified the similarity calculation method, and the rating prediction algorithm. The proposed model improved the aggregated diversity and maintained the recommendation accuracy, which improved the marketing effects. [Results] The aggregated diversity index increased 114, the accuracy improved 6.5% on the MovieLens data compared with results generated by the traditional cosine similarity calculation, (the rating threshold was 3.5 and number of KNN is 20). [Limitations] This method was only applicable to collaborative filtering based on the nearest neighbor, and it did not include other recommendation techniques. [Conclusions] The proposed method effectively improves the diversity and accuracy of recommendation results, which significantly improves the user experience.