Abstract
Understanding how the quality of human settlements affects residents' happiness is crucial for sustainable urban planning during rapid urbanization. This study investigates the effects of human settlement quality (HSQ) on residents' happiness using machine learning techniques. Based on the theoretical framework of environmental perception, this study developed an evaluation system consisting of eight dimensions and 54 indicators that capture residents' subjective perceptions of urban spatial, services, and ecological environments. By using an improved gravitational search algorithm (IGSA) to optimize the parameters of a multilayer perceptron neural network (MLPNN) and the GARSON method to assess variable importance, this study built a nonlinear, multi-factor model for predicting happiness. Based on a robust dataset of 10,885 valid questionnaire responses collected in Wuhan, China, the results show that: (1) Healthy & Comfortable (25.6%) and Safety Toughness (17.7%) are the most influential factors of residents' perception of happiness; Proximity to shopping facilities, parking convenience, fire safety, and the adaptive reuse of historic buildings have a strong relationship with residents' happiness. (2) The IGSA-MLPNN model improves predictive performance, reducing the MAE by 22% and increasing the R² by 4.3% compared with conventional approaches. (3) Policy efforts should prioritize enhancing public services, safety infrastructure, and housing affordability, while also supporting strategic investment in cultural heritage conservation and community maintenance. This study expands the theoretical framework of urban happiness research and provides a data-driven basis for evidence-based policy and planning.