IPO underpricing has become one of the most famous market anomalies in the modern financial market. This phenomenon, called the "New Issue Puzzle," stimulated a hot debate among economists. Many of them focused on explaining the cause of this anomaly using the classical economics models. It is relatively novel to explain this anomaly based on behavioral economics theories. This paper took a comprehensive perspective, considered two possible stages that the underpricing derived from: the pricing stage and the trading stage. For each stage, the paper proposed two hypotheses based on the behavioral economics theory and examined the hypotheses with the OLS regression model and the most up-to-date machine learning techniques (KNN, Decision Tree, Random Forests, and Gradient Boosting). The results demonstrate that the underpricing level of IPO is positively correlated to managerial confidence. This furtherly implies that the underpricing of IPOs is partially derived from the behaviors in the pricing stage. Besides, the result of four classification models validates that investor sentiments would contribute to the underpricing. Using company features and investor sentiments extracted from the online discussion could classify whether the IPO will be underpriced or not at a precision level of about 74%.