At present, Bayesian networks lack consistent algorithms that support structure establishment, parameter learning, and knowledge reasoning, making it impossible to connect knowledge establishment and application processes. In view of this situation, by designing a genetic algorithm coding method suitable for Bayesian network learning, crossover and mutation operators with adjustment strategies, the fitness function for reasoning error feedback can be carried out. Experimental results show that the new algorithm not only simultaneously optimizes the network structure and parameters, but also can adaptively learn and correct inference errors, and has a more satisfactory knowledge inference accuracy rate.