Nowadays, a large number of reputation systems have been deployed in practical applications or investigated in the literature to protect buyers from deception and malicious behaviors in online transactions. As an efficient Bayesian analysis tool, Hidden Markov Model (HMM) has been used into e-commerce to describe the dynamic behavior of sellers. Traditional solutions adopt Baum-Welch algorithm to train model parameters which is unstable due to its inability to find a globally optimal solution. Consequently, this paper presents a reputation evaluation mechanism based on the optimized Hidden Markov Model, which is called PSOHMM. The algorithm takes full advantage of the search mechanism in Particle Swarm Optimization (PSO) algorithm to strengthen the learning ability of HMM and PSO has been modified to guarantee interval and normalization constraints in HMM. Furthermore, a simplified reputation evaluation framework based on HMM is developed and applied to analyze the specific behaviors of sellers. The simulation experiments demonstrate that the proposed PSOHMM has better performance to search optimal model parameters than BWHMM, has faster convergence speed, and is more stable than BWHMM. Compared with Average and Beta reputation evaluation mechanism, PSOHMM can reflect the behavior changes of sellers more quickly in e-commerce systems.