This paper proposes a feature selection algorithm based on particle swarm optimization (PSO) combined with machine learning methods to improve the accuracy of breast cancer diagnosis. The PSO feature selection algorithm is used to reduce the number of features while maintaining or improving classification accuracy. The method was evaluated on three common breast cancer datasets from the University of California, Irvine (UCI) repository: Coimbra, Wisconsin Diagnostic Breast Cancer (WDBC), and Wisconsin Prognostic Breast Cancer (WPBC) datasets. The results show that the PSO feature selection algorithm can significantly improve the accuracy of breast cancer diagnosis by selecting fewer and more effective features. For example, in the Coimbra dataset, the accuracy increased from 87% to 91% with the PSO feature selection algorithm, and the number of features was reduced from 9 to 4. Similarly, in the WDBC dataset, the accuracy increased from 99% to 100%, and the number of features was reduced from 30 to 19. In the WPBC dataset, the accuracy increased from 94% to 96%, and the number of features was reduced from 33 to 17. The study concludes that the proposed PSO feature selection algorithm can effectively improve the accuracy of breast cancer diagnosis by selecting the most relevant features.This paper proposes a feature selection algorithm based on particle swarm optimization (PSO) combined with machine learning methods to improve the accuracy of breast cancer diagnosis. The PSO feature selection algorithm is used to reduce the number of features while maintaining or improving classification accuracy. The method was evaluated on three common breast cancer datasets from the University of California, Irvine (UCI) repository: Coimbra, Wisconsin Diagnostic Breast Cancer (WDBC), and Wisconsin Prognostic Breast Cancer (WPBC) datasets. The results show that the PSO feature selection algorithm can significantly improve the accuracy of breast cancer diagnosis by selecting fewer and more effective features. For example, in the Coimbra dataset, the accuracy increased from 87% to 91% with the PSO feature selection algorithm, and the number of features was reduced from 9 to 4. Similarly, in the WDBC dataset, the accuracy increased from 99% to 100%, and the number of features was reduced from 30 to 19. In the WPBC dataset, the accuracy increased from 94% to 96%, and the number of features was reduced from 33 to 17. The study concludes that the proposed PSO feature selection algorithm can effectively improve the accuracy of breast cancer diagnosis by selecting the most relevant features.