Since learning Bayesian networks from data is difficult, a new approach is proposed. The particle swarm optimization (PSO) and minimum description length (MDL) are combined to obtain a suitable Bayesian network. MDL is the fitness function in this learning algorithm to evaluate the goodness of the network. By adopting MDL, the balance between simplicity and accuracy is assured, which enables the optimal solution for complex models to be found in reasonable time. Base on the MDL principle, the PSO is used to enhance the structure learning in Bayesian networks. Moreover, conditional probabilities associated with the Bayesian networks are then statistically derived from these data. In the end, the Stroke data set is used for testing the efficiency and effectiveness of the stable network. Experimental results show that the proposed approach has a good accuracy than the comparative methods.