IntroductionHumans spend most of their time in settlements, and the built environment of settlements may affect the residents' sentiments. Research in this field is interdisciplinary, integrating urban planning and public health. However, it has been limited by the difficulty of quantifying subjective sentiments and the small sample size.MethodsThis study uses 147,613 Weibo text check-ins in Xiamen from 2017 to quantify residents' sentiments in 1,096 neighborhoods in the city. A multilevel regression model and gradient boosting decision tree (GBDT) model are used to investigate the multilevel and nonlinear effects of the built environment of neighborhoods and subdistricts on residents' sentiments.ResultsThe results show the following: (1) The multilevel regression model indicates that at the neighborhood level, a high land value, low plot ratio, low population density, and neighborhoods close to water are more likely to improve the residents' sentiments. At the subdistrict level, more green space and commercial land, less industry, higher building density and road density, and a smaller migrant population are more likely to promote positive sentiments. Approximately 19% of the total variance in the sentiments occurred among subdistricts. (2) The proportion of green space and commercial land, and the density of buildings and roads are linearly correlated with residents' sentiments. The land value is a basic need and exhibits a nonlinear correlation with sentiments. The plot ratio, population density, and the proportions of industrial land and the migrant population are advanced needs and are nonlinearly correlated with sentiments.DiscussionThe quantitative analysis of sentiments enables setting a threshold of the influence of the built environment on residents' sentiments in neighborhoods and surrounding areas. Our results provide data support for urban planning and implementing targeted measures to improve the living environment of residents.