There are two types of modern portfolio theory: narrow and broad. A narrowly conceived portfolio theory is often referred to by the name Markowitz portfolio theory. Often generalized portfolio theory, in addition to classical portfolio theory, and various alternative portfolio theories, include the capital asset pricing model and an effective securities market theory of capital markets. At the same time, because the traditional EMH cannot explain market anomalies, the various portfolio theories are have been challenged by behavioral financial theory. This study uses pattern recognition algorithms to improve the traditional portfolio optimization models. By utilizing improved particle swarm optimization algorithms, a hybrid optimization model based on this would be the result of the experiment, compared with that based on the traditional neural network model for quantitative model effect. Particle swarm optimization algorithms were originally generated to produce graphical simulations of flocks of birds and other such unpredictable movements. The developmental basis of the algorithms used in this experiment are observations of animal social behavior, demonstrating that sharing of information society provides groups with an evolutionary advantage. By joining near the speed of matching, taking multidimensional search into account, and according to speeds and distances, we can thus form the original version of particle swarm optimization. After introducing the parameters of inertia weight to better control the development of swarm behavior, we have produced the standard version. This study will focus on analysis to improve the process of generating particle swarm optimization models.