Demand-driven Urban Facility Visit Prediction

Predicting citizens’ visiting behaviors to urban facilities is instrumental for city governors and planners to detect inequalities in urban opportunities and optimize the distribution of facilities and resources. Previous works predict facility visits simply using observed visit behavior, yet citizens’ intrinsic demands for facilities are not characterized explicitly, causing potential incorrect learned relations in the prediction results. In this article, to make up for this deficiency, we present a demand-driven urban facility visit prediction method that decomposes citizens’ visits to facilities into their unobservable demands and their capability to fulfill them. Demands are expressed as the function of regional demographic attributes by a neural network, and the fulfillment capability is determined by the urban region’s spatial accessibility to facilities. Extensive evaluations of datasets of three large cities confirm the efficiency and rationality of our model. Our method outperforms the best state-of-the-art model by 8.28% on average in facility visit prediction tasks. Further analyses demonstrate the reasonableness of recovered facility demands and their relationship with citizen demographics. For instance, senior citizens tend to have higher medical demands but lower shopping demands. Meanwhile, estimated capabilities and accessibilities provide deeper insights into the decaying accessibility with respect to spatial distance and facilities’ diverse functions in the urban environment. Our findings shed light on demand-driven urban data mining and demand-based urban facility planning.


INTRODUCTION
Mobile devices carried by urban citizens sense and record a large amount of their behavior data within the urban environment [17,31].Many previous works in the urban computing community have used this data to discover citizens' mobility patterns and visits around the city [1,11,12,23,30,38,47,48].Some research treats individuals' mobility as a physical process to predict patterns like crowd flows [12] and mobility flows [11], overlooking the semantic information of urban mobility patterns like interactions with different places.One important semantic pattern is citizens' visits to urban facilities that are designed to provide necessary and high-quality services for citizens, e.g., hospitals, public transportation, and schools.Inferring citizens' visit to urban facilities accurately can be leveraged in understanding citizens' behavior, analyzing the inequality of facility demands and supplies [33,62], and optimizing the distribution of facilities in the urban space [10,52].Therefore, it is an important problem to predict citizens' visits to facilities from the existing population and facility distributions, realizing the vision of improving citizens' life experiences through urban computing technology.
Extensive efforts have been made in predicting and evaluating the citizens' visits to various types of urban facilities [8,41,[53][54][55].A common existing problem observed is that they do not explicitly model the potential demands of citizens for urban facilities.Instead, the number of visits is often regarded as a demand for facilities and is used as the basis of downstream tasks such as facility optimization and demand-supply analysis [10].However, demand, as a key factor that determines the number of visits to facilities, is not always fully fulfilled due to the spatial distribution of urban facilities.The lack of demand modeling will cause prediction models to learn incorrect relations, deteriorating the prediction accuracy and robustness.
In this article, we propose a framework to decompose citizens' visits to urban facilities into their intrinsic demands for facilities and the capability to fulfill them.According to existing urban plan theory [18,37], citizens' demands for a specific category of facilities are determined by their demographic attributes, such as gender and age.Further, we model the capability of demand fulfillment as a function of spatial accessibility to facilities to depict the ratio between the number of facility visits and potential demands.The spatial accessibility to a facility is characterized by the distance to it, representing the ability to access it.Based on this framework, with new insights into the fields of supply-demand analysis and urban facility planning, we design a neural network model that explicitly models the facility demands and accessibilities to predict the number of facility visits in the urban space.
We evaluate the prediction performance of the proposed model on datasets covering important facilities in three large cities.The results show that our method significantly outperforms existing statistical learning and deep learning approaches that do not explicitly model facility demands and accessibilities.By further analyzing the prediction model, we draw insightful relations between population attributes and retrieved facility demands.For instance, senior citizens over 60 have higher medical demands but lower shopping demands.By analyzing the function of spatial accessibility over distance, we observe that distant general hospitals are still accessible to citizens, while the accessibility to public schools drops to zero when the distance exceeds the range of school districts.In summary, this work makes the following contributions: -To the best of our knowledge, we are the first to predict urban facility visits following the framework that characterizes the relationship between facility visits, demands, and accessibility.Our proposed neural network model explicitly characterizes facility demands and the capability to fulfill them.-Extensive experiments show that our model achieves better prediction performance on facility visit datasets covering multiple cities and facility categories, improving the performance Demand-driven Urban Facility Visit Prediction 21:3 Notation Description R = {R 1 , . . ., R N } N urban regions.F = {F 1 , . . ., F M } M urban facilities.
Demographic attributes of region i.
Real and predicted personal visits matrix from each region to each facility.v = {v i }, v = { vi } Real and predicted total facility visits of each region, i = 1, . . ., N .D ∈ R N ×M  Distance matrix between each region centroid and each facility.D = {d i } Regional demand for facility, i = 1, . . ., N .
Accessibility from each region to each facility.A = {α i } Capabilities of regional facility demand fulfillment, i = 1, . .The rest of the article is structured as follows.In Section 2, we define preliminaries and formulate the urban facility visit prediction problem.In Section 3, we introduce large-scale facility visit datasets and provide some fundamental analyses.In Section 4, we propose a demand-driven model for the facility visit prediction problem.In Section 5, we evaluate the efficiency and interpretability of our model with in-depth analysis.In Section 6, we discuss related works and our work's implications for the community.Finally, we conclude our work in Section 7.

PRELIMINARIES
In this section, we present definitions of the basic concepts in our work and formally specify the studied problem of urban facility visit prediction.Key notations and their meanings are listed in Table 1.

Urban Regions
Definition 1 (Urban Region).Urban regions R = {R 1 , . . ., R N } are N areas separated by road networks and natural boundaries such as rivers or railroads in the city.Each region serves as a living place or workplace for citizens and provides local services.Each urban region R i has attributes r i .
As defined, regions are living places or workplaces for citizens, making them a complex composition of a population with various demographic backgrounds and different kinds of urban venues.For each urban region, we denote the attributes of people living in it, people working there, and distribution of local venues as its demographic attribute r .

Urban Facilities
Definition 2 (Urban Facilities).Urban facilities F = {F 1 , . . ., F M } are physical facilities or infrastructures located in the urban space that supply essential services to the citizens, e.g., a community park, recreation centers, or general hospitals.Each facility is associated with a facility category according to its function in the city.The properties of a facility j are denoted as f j .
Facilities often possess more properties, including level or function.For instance, hospitals are ranked according to their scale, number of beds, and function.Due to their educational content, public schools are divided into elementary, secondary, and tertiary schools.We denote the facility attributes as f .
Urban facilities are designed to provide service for citizens.Citizens visit facilities to fulfill their typical needs, e.g., medical, entertainment, transport, and education.Mobility data are widely used in urban computing tasks to depict citizens' behaviors in the urban space.Each mobility record that visits an urban facility can be traced back to its origin region.We aggregate visit records at the region level and define them as facility visits.

Facility Visits
Definition 3 (Facility Visits).The total number of visits originating from region i to all facilities in a category during a studied time period is defined as v i .The total number of visits from region i to facility j is calculated as V i , j, j = 1, . . ., M.
In most cases, both facilities and regional populations are not evenly distributed within the urban area.Their spatial distribution and corresponding distances also play a critical role in predicting the region's visits to facilities.We define the geographic distances between each urban region's centroid and each urban facility as a matrix D ∈ R N ×M .

Problem Formulation
Based on the above-introduced concepts and notations of urban factors defined, we define the urban facility visit prediction problem as follows: Definition 4 (Urban Facility Visit Prediction Problem).Given the demographic attributes of each urban region i, i = 1, . . ., N , the properties of each urban facility j, j = 1, . . ., M, and the corresponding spatial distances D i, j 's between each region-facility pair, the problem of urban facility visit prediction is to estimate v i , the total number of facility visits that originate from region i for each region and V i, j , the number of visits from region i to facility j for each region-facility pair.

DATASETS AND OBSERVATIONS
In this section, we introduce the fine-grained facility visit datasets we use in this work and their basic statistics and briefly analyze some statistics of the visit patterns from our datasets, which motivates our proposed visit prediction method.

Data Overview
We collect the facility visit record data from Tencent Map, one of the largest online map application services in China.Datasets are gathered in three large Chinese cities, i.e., Changsha, Zhengzhou, and Chongqing, covering the period from April to July 2021.Basic statistics of three cities' datasets are listed in Table 2. Changsha and Zhengzhou are located in Middle China.They are the capital cities as well as the political and cultural centers of Hunan Province and Henan Province, respectively.Chongqing is one of the four province-level municipalities in Southwestern China.According to the 7th national census of China conducted in 2020, the three cities ranked 17th, 11th, and 1st in household-registered population among all mainland Chinese cities, making them representative of large cities in China.Tencent Map divides each city into thousands of urban regions.Their boundaries are drawn in Figure 1.The boundaries are determined by urban road networks and natural barriers, like the Xiangjiang River that flows through Changsha city, as shown in Figure 1(a).Regions in city centers have smaller sizes than regions in the peripherals because of the higher population density in city centers.
For ethical considerations, the demographic information of citizens is processed and aggregated at the urban region level.The residential and working population with their corresponding gender and age compositions are collected.Ages are binned into eight levels, i.e., 0 to 17 years, 18 to 24 years, 25 to 30 years, 31 to 35 years, 36 to 40 years, 41 to 45 years, 46 to 60 years, and over 60 years.The fractions of sub-populations are illustrated in Figure 2. Male citizens are slightly more common than female citizens in all cities.Citizens aged between 18 and 24 years are the largest age group among Tencent Map users.Children, adolescents, and seniors only make up approximately 15% of the user population.Based on the demographic attributes of urban regions, we filter out regions with a summation of residential and working populations lower than 100.After this preprocessing, Changsha, Zhengzhou, and Chongqing have 1,553, 1,418, and 2,780 urban regions, respectively.The total residential populations covered by our dataset in three cities are 7.86, 9.46, and 16.64 million, covering 78.12%, 74.93%, and 51.84% of their population according to the latest national census.This high proportion of population coverage ensures the effectiveness of our facility visit dataset.
Our work focuses on three important categories of urban facilities, i.e., general hospitals, public schools, and shopping malls.The numbers of these facilities are listed in Table 2, and their spatial distributions are illustrated in Figure 1.Three categories of facilities serve to meet residents' medical, education, and entertainment needs.Their functional disparity brought a large discrepancy in the amount and spatial distribution.Schools denoted as white dots are distributed widely and more evenly across the whole urban space.In comparison, hospitals (red dots) and shopping malls (blue dots) are mostly located in the city center, leaving the peripheral districts with low accessibility to medical and shopping resources.
Among three facility categories, we identify the facility level of hospitals and schools as their attributes.General hospitals are classified into six levels according to China's medical system, which are 3A, 3B, 3C, 2A, 2B, and 2C, decreasing in their scale order.Third-class hospitals have higher medical supply capabilities than second-class hospitals.Public schools are classified into elementary and secondary schools.The distributions of facility levels are listed in Table 2.We aggregate visits to facilities at the urban region level in each month from April to July 2021, according to the user's workplace and resident place.We calculate the average of the total number of visits to each facility category in three cities during the four months, shown in Table 2.There are significant differences in visit patterns among the three cities.For instance, the number of visits to malls per capita in Changsha and Chongqing, which are famous tourist cities, is twice the amount in Zhengzhou, while Chongqing and Zhengzhou citizens visit schools more often than people living in Changsha.This discrepancy in visit patterns exerts the challenge of achieving good prediction performance across all cities and facility categories.For each region, we calculate the average value of the monthly total visits v i and pairwise facility visits V i, j 's from April to July 2021.To summarize, the research datasets in three large cities possess different facility visit patterns while covering a large proportion of the urban population, making them representative and appropriate for the research on facility visit prediction.

Ethical Considerations
It is worth noticing the ethical considerations that have been taken into the current research.The visit records are collected with the knowledge and consent of users.Random Gaussian perturbations are added to the coordinates of visit records.Individual identifications are masked before further processing.Then, the individual-level records are aggregated into urban region-level records before being provided to researchers.Under these protocols, researchers do not have access to any individual-level metadata and are regulated by strict non-disclosure agreements.The facility visit datasets are stored on a secure offline server, which is only accessible to permitted researchers.These measures ensure that there are no privacy and security issues in the research.

Preliminary Analysis
To validate the mechanism that both demand and accessibility affect facility visits, We perform preliminary analyses of the correlations between facility visits and regional attributes.Specifically, we investigate the influence of the age distribution, region's population, and travel cost on facilities, which represent demographics and the accessibility to the facility.Without loss of generality, we take Changsha city as an example, and the results are discussed as follows.
First, we compare the coarse-grained hospital visitations of different age groups divided by the percentage of the senior population (over 60 years) and the junior population (under 25 years), which are shown in Figure 3(a) and Figure 3(b), respectively.Red dotted lines represent the linear fits of the population percentage and hospital visits for all 1,553 Changsha regions.The color of a dot represents its kernel density, whereas dense dots have brighter colors.As we can observe in Figure 3(a), the visit frequency to hospitals is positively correlated with the percentage of the senior population, while in Figure 3(b), such frequency is negatively correlated with the percentage of the junior population.The heterogeneous visits among different groups demonstrate that the demand for urban facilities is highly correlated with demographic distributions.Besides, Figure 3(c) shows the negative correlation between senior population percentage and the region's per capita school visits, indicating distinct visit patterns of different facility categories.
Second, we investigate how the cost of travel affects hospital visits, where we leverage the geodesic distance from the region centroid to the hospital as the regional travel cost.An apparent observation in Figure 3(d) is that the visit frequency decays superlinearly with the travel cost.In addition, we take the hospital class into consideration, including second-class hospitals, denoted as orange dots, and third-class hospitals, blue dots.It shows that blue dots are located above orange dots under some travel costs, indicating that third-class hospitals have more visits than second-class hospitals.The red dotted curve acts as a threshold of facility visits for the given spatial distance, because the majority of dots are located below it.
Finally, we examine the correlation between a region's total population and total hospital visits and visualize the results in Figure 3(e).In general, it reveals a positive correlation between the population and visits.However, regions with similar populations do not exhibit similar visit amounts, as the red box illustrates.The high variance suggests potential factors that contribute to hospital visits other than population.
The above analysis suggests the influence of demographics and distance on visits to urban facilities.These observations further motivate us to explicitly characterize demographic-based demand and distance-based accessibility in the demand-driven facility visit prediction model.

Framework of Urban Facility Visits
The logical structure of our proposed framework of urban facility visits is shown in Figure 4.The fundamental idea is to define an urban region i's visits to facilities as the process of fulfilling its population's demands for that category of the facility.Represented as the top branch in the figure, a region's total number of facility visit v i is determined by its facility demand d i and its capability of facility demand fulfillment α i .We assume which denotes that the visit is the product of demand and the capability to be fulfilled.Notice that only the region's number of visits to facilities is observable.Demand d i and demand fulfillment capability alpha i are both undetectable.
Our first observation in Section 3.3 postulates that the preference for facilities is strongly related to regional demographics.Here we define this "preference" as the region's facility demand d i determined by its demographic attributes r i , which maps r i 's to d i 's, revealing the emergence of underlying facility demands.Due to the high variation we observed in Figure 3(e), the facility visits are not determined only by demographic attributes.According to our proposed visit framework, such variation can be attributed to the capability of facility demand fulfillment, which is determined by the region's accessibility to each facility A i, j 's, In addition to original demand derived from demographic attributes, accessibility also affects the distribution of the region's visits to each facility.The total number of visits v i is distributed proportionally to the region's accessibility A i, j to each facility in the right part of Figure 4, where V i, j is the number of pairwise visits from region i to facility j.
Based on former definitions, the accessibility of a facility represents the citizen's preference when choosing a facility to visit.This preference is modeled as a function of spatial distance in the classic gravity model [64], deep gravity model [42], and the Huff model [19].These measures inspire us to construe the accessibility as a function of the region's distance to the facility D i, j and the facility's properties f i , where we split the influence of distance and the influence of facility properties to form a simplified hypothesis that facilities in the same category have the same accessibility decaying pattern.
Our proposed framework of facility visits connects regional demographic attributes, which generate potential demand, distances between regions and facilities that affect pairwise accessibilities, and the spatial distribution of all available facilities that generate a capability of demand fulfillment.It disassembles facility visits into two explainable components: facility demand and capability of demand fulfillment.In this way, the underlying demand and the capability to fulfill it provide deep insight into the pattern of urban facility use as well as a great opportunity to provide better facility service to citizens, making the proposed framework a good leap from the simple characterization of visits as a function of various data sources to a model that embeds meaningful information and knowledge of citizens and facilities.

Facility Visit Prediction Model
To realize the proposed framework, we design a neural network model for facility visit prediction, which is shown in Figure 5.We directly conduct the facility visit prediction task based on the framework by fitting the functions f , д, and h's with Multi-layer Perceptrons (MLPs), a kind of fully connected network, that collectively construct a neural network.Neural networks have been shown to perform well in predicting complex functions in a variety of urban computing tasks [13,47,51], and current deep learning technologies have been well developed to efficiently optimize the goal of prediction tasks.The details of our facility visit prediction model are shown in Figure 5.
We first use MLP f to generate demands from a region's demographic attributes, fitting the function f in Equation (2).Multi-layer Perceptrons are a sequence of feed-forward fully connected network layers, where the input of a layer is the activation of the output of the previous layer.The activation function can be nonlinear, which can make the MLP a complicated nonlinear function.For a given region i, the model calculates its demand d i by feeding its demographic attributes r i and its neighboring regions' attributes r n i 1 , r n i 2 , . . ., r n iK to MLP f and aggregate the outcomes with a learnable parameter w as follows: where n i j is the jth nearest region to i and K is the number of selected neighboring regions.This spatial smoothing can reduce the errors brought by data collection, which is that visits paid by a citizen living in the region n i1 might be counted on region i.The parameter w is confined to the range between 0 and 1, weighting the local facility demand and the average of neighboring demands.
MLP h 1 and MLP h 2 are introduced to model region i's accessibilities to M facilities.For each facility j, MLP h 1 takes the distance from it to region i as its input and generate a scalar value as the region's spatial accessibility to j. MLP h 2 is fed by the properties of each facility f j , generating another scalar value for each facility that represents its empowered accessibility.The accessibility from region i to each facility j is then calculated as the product of two MLP's outputs: Given the region's accessibilities to all facilities, we then use another MLP to fit the function д in Equation ( 3), which generates the region's capability to fulfill its facility demand α i from all accessibilities A i,1 , . . ., A i, M as follows: Because the demand fulfillment capability alpha i represents the fraction of demand realized, the activation of the MLP's last layer д is set to the sigmoid function σ (x ) = 1 1+e −x , which is an activation function with a value domain ranging from 0 to 1.
Finally, the model generates a predicted value of region i's total facility visit vi by multiplying the predicted demand di and capability of demand fulfillment α i .Then it distributes the total number of facility visits in proportion to the region's accessibility to each facility The objective function of the model is to minimize the squared error of the prediction value and true value of visits, where λ is a hyper-parameter that tunes the weight of the loss of pairwise visit predictions in the objective function.Since the pairwise visits and the region's total visits are coupled, selecting the proper λ is necessary to improve the prediction performance.Following the proposed framework, our proposed prediction model learns disentangled representations for two essential considerations: demand and fulfillment.In this way, we are able to model these underlying factors to facilitate the prediction task explicitly.Furthermore, our model supports regional demand recovery, which enables us to sense and infer deeper urban knowledge.

PERFORMANCE EVALUATION
To evaluate the prediction performance of our proposed model and its capability to recover regional facility demand and accessibility, we conduct extensive experiments on three large-scale real-world facility visit datasets, with the aim to answer the following research questions (RQs): RQ1 How does the proposed model perform in facility visit prediction on different datasets compared with baseline models?RQ2 How does an urban region's demographic composition determine citizens' demand for different categories of facilities, and is the facility demand recovered by our model reasonable?
RQ3 How does the accessibility to different categories of urban facilities vary with its distance to citizens, and to what extent are urban regions' demands for facilities fulfilled by current facility allocation?

Experiment Settings
To characterize deterministic functions f , д, h 1 , h 2 , we employ four feed-forward networks.Each MLP has two 16-dimensional hidden layers with the ELU [6] activation function.A ReLU nonlinearity is applied to the outputs of MLP f , MLP h 1 , and MLP h 2 , to ensure non-negative values of demands and accessibilities.A sigmoid function is applied to the output of MLP д to bound the value of α between 0 and 1.The number of selected neighboring regions for spatial smoothing K is set to 5. The weight of pairwise objective function λ in Equation ( 10) is set to 1,000, which is in the same order of magnitude as the number of urban regions.The model is optimized with an Adam optimizer with an initial learning rate of 0.001 [24].We compare our model with several baseline models, which are as follows: -Naive Regression (NR): We naively use the average value of pairwise visits to a facility in the training set as the predicted value of a region to that facility in the test set and then sum the pairwise visit over all facilities to get total facility visits.-Gradient Boosting (GB) [15]: Gradient boosting is a powerful statistical learning method for regression problems.It ensembles prediction results of weak learners to generate its result.We simply feed the concatenation of region attributes, facility attributes, and their spatial distance for each region-facility pair as the input of a GB model to predict its pairwise visit and then sum the pairwise visit over all facilities to get each region's total facility visits.-MLP: MLP is a simple fully connected network model that can fit complicated nonlinear relations.We use an MLP model with two hidden layers as the baseline model.The model inputs and prediction process are the same as GB.-Deep Gravity (DG) [42]: This model uses deep encoder networks to generate a distribution of an urban region's outflow on other regions.We adopt a variant version of Deep Gravity to fit into the facility visit prediction problem.We use neural network encoders to map region attributes, facility attributes, and their spatial distance into hidden spaces.Then the encoded representation is concatenated and fed into a decoder network to predict pairwise visits.Demand and accessibility are not explicitly modeled in this method.-Graph Convolutional Network (GCN) [25]: GCN can efficiently broadcast information on graph structures and is proven to achieve good performance on regression and classification tasks, e.g., urban traffic prediction [5,40].We construct a heterogeneous graph, where neighboring regions are linked, and each region-facility pair is linked with an edge weighted by their distance.Then we conduct graph convolutions on this graph to predict the total number of facility visits for each region.
For the visit dataset of each city, and each facility category, i.e., hospital, school, and mall, we randomly split the urban regions and take 80% of them for training, 10% for validation, and 10% regions for testing.For each training region, the numbers of its pairwise visits to each facility are utilized as ground-truth values to fit the model.We train our model and each of the baseline models on the training set.We adopt the grid search strategy to tune hyper-parameters to achieve the minimum root mean square error of region visits on the validation set.Specifically, we tune the dimension of hidden layers, the activation function, and batch size for our methods, MLP, and DG.We tune the dimension of convolution layers and the method for aggregating node features for GCN.In Figure 6, we demonstrate the training score (square root of Equation ( 10)) and validation score of our method and two baseline methods-MLP and DG.The convergence of an algorithm is determined when the best validation score is stagnant for over 200 batches.As shown in Figure 6(a), our proposed method has faster convergence than baseline models with slightly lower training loss.Validation score curves in Figure 6(b) validate that our method achieves the best validation score.
We then calculate the performance metrics on the same test set for each model.We use three metrics to evaluate the prediction performance, including Normalized Root Mean Square Error (NRMSE), Symmetric Mean Absolute Percentage Error (SMAPE), and Common Part of Commuters (CPC), which are widely used in mobility flow prediction [39,42].Considering the large standard deviation due to outliers, we take the logarithm of the visit number for optimization and evaluation.The mathematical expressions of the three metrics are listed as follows: where v i and vi represent the real and estimated number of visits (region total visit or pairwise visit).

Overall Prediction Performance (RQ1)
Table 3 illustrates the performance of our model and baselines on nine testing sets (three cities and three categories).Based on the results listed in Table 3, we have the following observations: -Our proposed demand-driven urban facility visit prediction model achieves the best performance in 44 of 54 performance metrics on nine visit datasets.Specifically, the CPC metric is consistently higher than baseline models in the pairwise visit prediction task, with an average improvement of 8.28% compared with the best baseline model.This advantage confirms that explicitly modeling demand and accessibility contributes a lot to facility visit prediction while having more explainability compared with MLP and the Deep Gravity model.

-The GCN model achieves the best NRMSE in five of nine regions' total visit prediction tasks.
This advantage may be attributed to the fact that the model only optimizes the L2 distance between predicted and true region total visits, while other models optimize the loss of both the region and pairwise visits.Nevertheless, our proposed model still achieves the best performance in four tasks.-Predicting pairwise visits has worse performance than predicting total visits.This is because the number of region-facility pairs is significantly larger than the number of urban regions.Among the three categories, schools have the highest NRMSE and SMAPE and the lowest CPC, which is consistent with the fact that the number of schools is about 20 times greater than the number of hospitals and shopping malls.However, even though there are more malls than hospitals in all cities, the CPC of the prediction of mall visits for both regional total visits and pairwise visits is higher than the prediction of hospital visits.This observation indicates that the visit patterns to shopping malls are more predictive than hospital visits, because medical demands are more episodic and random than shopping and entertainment demands.-There is a discrepancy in prediction performances across cities. Facility visits prediction tasks in Changsha have slightly better performance than prediction tasks in Zhengzhou, while Chongqing has the worst performance.This may be due to the large number of urban regions in Chongqing, the largest province-level municipality in China, and the lower number of facilities in Changsha.
In summary, our proposed prediction model achieves better overall performance than baselines without deconstructing facility visits into demand and capability of fulfillment in facility visit prediction tasks, which demonstrates its ability to predict urban visit patterns precisely while preserving the latent mechanism of the patterns.

Evaluation of Demands for Urban Facilities (RQ2)
The framework that decomposes facility visits into facility demands and the capability to fulfill these demands can help predict urban facility visits more accurately.Given the improvement in prediction metrics, one important question is to evaluate the rationality of estimated facility demands and α's in the prediction model.In this part, we take Changsha as an example and examine its recovered demands.
We observe that the total number of regional visits to facilities v i is positively correlated with the region's population but is highly deviated, as illustrated in Figure 3(e).The large range of deviation is attributed to the spatial heterogeneity in accessibility to facilities.Now that we model demand and accessibility separately, the region's demand should have a smaller deviation than the observed visits.This is corroborated by facility demands recovered from our prediction model.We draw the relation between estimated regional hospital demands and the regional population in Figure 7(a).We also illustrate the spatial distribution of normalized logarithm facility demands and normalized logarithm population in Figure 8.The Pearson correlation coefficient is 0.9316 with a relatively lower deviation compared with 0.5726, the correlation coefficient between hospital visits and the population.The correlation coefficients for school and mall demands are 0.8925 and 0.8759, respectively.The spatial distributions in Figure 8 show the high similarity between normalized demands and normalized populations.This smaller deviation is in line with the mechanism that demand is an intrinsic factor of the population.
The deviation in demands and the difference in the spatial distributions of demands for three facility categories are attributed to regional demographics.To study how demographic composition determines a region's demand for facilities, we calculate the correlation between a region's per capita estimated demand and the percentages of each demographic group.From the results shown in Figure 7(b), we observe several insightful patterns.First, male and female citizens possess different levels of demands on three facility categories.Male citizens have higher demands for schools and malls, while female citizens have higher demands for hospitals.This observation can explain some gender inequalities in urban spaces where women need to carry more medical and healthcare burdens while lacking education opportunities [2,16].Second, the percentage of the age group from 0 to 17 years is negatively correlated with demands for all categories.This may be attributed to the fact that students should not carry mobile phones to school.Therefore, these visits are not sensed in the datasets, which causes the model to learn a negative correlation between the percentage of non-adult citizens and school demands.In contrast, the age group with a positive correlation with school demands (25 to 30, 31 to 35, and 41 to 45) could be parents picking their children up from school.Third, senior citizens over 60 have high demands for hospitals and low demands for schools and malls.This is consistent with the preliminary analysis in Section 3.3.The elderly population's demand for education and entertainment falls sharply, while their age brings increased medical demands.The well-explained heterogeneity in facility demands across demographic groups reinforces the rationality of estimated demands in our model, providing deeper insights into urban facility planning with demographic and demand factors taken into account.
To summarize, compared with number of visits, facility demands estimated by the model are highly correlated with region population, restoring citizens' intrinsic attributes.Correlation analyses on facility demands and population composition demonstrate the heterogeneity in facility demands among different demographic groups.These observations consolidate the rationality of the facility demands recovered by our model.

Evaluation of Accessibility to Urban Facilities (RQ3)
Urban facilities are key infrastructure for the survival and life of citizens living in the city.An unbalanced facility distribution will deprive some citizens of the opportunity to fulfill their specific demands by depositing spatial barriers.Numerous works in the field of transportation and urban planning have studied the accessibility to urban places and its relation to spatial distance [37,57].In our proposed framework of facility visits, we model the capability of an urban region's citizens to fulfill their facility demands as a function of the region's accessibility to all urban facilities, while accessibility is measured by geodesic distances from the region to facilities.The capability of fulfilling demand α and accessibilities to facilities can be explicitly retrieved from learned prediction models.To answer RQ3, we examine the spatial distribution of α's and the function to calculate accessibility from distance.

Spatial Distribution of α's.
We first illustrate the distribution of estimated α i 's for three facility categories.Each region is colored by its capability to fulfill facility demand α i in Figure 9, and facilities are marked as red dots in the city.Several interesting findings can be observed from the illustrations.First, α's show strong spatial correlations, especially for hospitals and malls.We calculate the global Moran's I Index, which is a statistic to measure the spatial autocorrelation of the spatial distribution of a given variable [34].It can be calculated as follows: where w i, j is the weight assigned between region i and region j.Here we take the inverse of the distance between i and j as w i, j .The Moran's I Indices of α's to hospitals, schools, and shopping malls are 0.5996, 0.1955, and 0.5025, respectively.The positive Moran's I Indices indicate that the capability to fulfill facility demands is presenting a clustering phenomenon in the urban space, which follows Tobler's first law of geography that "near things are more related than distant things" [46].An urban region's ability to fulfill its facility demand is similar to its proximity.Second, regions that are close to the city center, where hospitals and malls gather, have a higher capability to fulfill their medical and shopping demands.This result is reasonable and is consistent with our common sense that closer places are easier to visit.It emphasizes the consequence of unbalanced facility distribution: keeping a group of the population having a relatively low level of the opportunity to realize their demands for medical treatment and entertainment, which may lead to more deteriorating results of lower life expectations and life satisfaction.The average α of malls is 0.67, which is slightly higher than a hospital (0.51).This implies the important role of more facilities in the urban space to enhance demand fulfillment capacity, since malls are located farther from hospitals.
Third, as shown in Figure 9(a), public schools are distributed more evenly in the city compared with the other two categories.Under this scenario, α's for education demand stays at a high value in all regions (0.95 on average).This observation indicates that the education demands, which are mandatory to be realized for students under ninth grade, are sufficiently fulfilled by the current allocation of public schools.There are still some regions with slightly lower α's in Ningxiang district (the westernmost part) and Changsha county (the central-eastern part), where schools are less clustered compared with the central district and Liuyang district (the easternmost part).

Relation between Accessibility and Spatial Distance.
In our model, a region's visits to facilities are assigned proportionally to its accessibility to each facility.One element of the accessibility is fitted by MLP h 1 , which takes the distance from the region to the facility as input.A universal consensus is that accessibility is a function that decays with distance, so distant places are less accessible.To demonstrate the rationality of accessibility assessed in our model, we draw the functions fitted by MLP h 1 for three facility categories in Figure 10.
At first glance, all curves validate the accessibility decays with distance, which is consistent with previous studies [19,52].The decaying curves of accessibility for the three facility categories have distinctly different patterns, which can be explained by their functions in the urban space.
The curve for hospitals presents a super-linear decaying pattern.It drops fast in the range from 0 to 10 km and then drops slower in longer distances, converging to an accessibility of 2.0 in extreme distances.The super-linearity implies the high preference of citizens for visiting local hospitals [44].Besides, the convergence to a nonzero value indicates that citizens can realize their mandatory medical demands even if they are far from medical service suppliers.
The decaying curve of accessibility to shopping malls can be clearly divided into two linearly declining stages.It drops faster within 0 to 20 km than in the range of over 20 km.Malls in the city are commercial infrastructures designed to meet citizens' non-mandatory demands for shopping, entertainment, and social activities, which are more high-level and intangible demands than the physiological and safety demands for hospitals.Therefore, accessibility will drop to zero in the long-distance stage.Another point is that citizens seeking to fulfill their demands for shopping malls may be less affected by their spatial distance to malls when they reach a specific threshold [4].For these citizens, the increase in their travel costs to distant malls is not worth it compared to their demands, which explains the slower drop in the long-distance stage.
The accessibility to public schools drops linearly and reaches zero when the distance is more than about 40 km.This fast-decaying property is in line with the attribute of school as public service and the policy that in China, elementary school and secondary school students are assigned to school districts close to their residential area during the compulsory education stage [49].
In summary, we demonstrate the efficiency of our proposed urban facility prediction method, which outperforms baseline models in most prediction tasks.We take Changsha as an example to prove the rationality of the recovered demands and accessibilities.Recovered demands are highly correlated with the region's population while capturing the heterogeneity in the demands of various demographic groups.Senior citizens have higher hospital demands but lower mall demands compared with juniors.Men have higher school and mall demand while women have higher medical demand.The region's capability to fulfill its facility demand is highly autocorrelated in the urban space, presenting high values in the city center where facilities are denser.The functions of accessibility on spatial distance provide interesting insights into citizens' visit patterns to different facility categories.Discussions on the implications and potential applications of these findings are elaborated in the following sections.

Urban Mobility Prediction
Due to the pervasiveness of mobile phones, researchers can efficiently sense large-scale human mobility data in urban spaces.A growing area of research is concerned with the predictions of citizens' mobility, ranging from collective mobility flow to individual mobility behavior, by leveraging diverse sources of sensed signals in the urban environment.One topic is to predict the mobility flows between a given origin and a given destination (OD flow prediction).The gravity model [27,64] is a fundamental physical mechanism that assumes the flows are proportional to the population of source and destination regions and the negative quadratic of the distance between them.The radiation model [43] assumes that an origin region distributes its outward mobility flow based on the attractiveness of other regions to it.Modern methods that embed deep learning technology for OD prediction have been developed based on these theories, such as Deep Gravity [42] and Gravity Neural Network [35].Compared with classic theories, they also collect abundant urban data sources, including user demographics and urban venues, to generate more accurate predictions [21,38,58,59].Other mobility prediction problems that consider this urban semantic information include predicting a user's next destination based on individual behavior [20,23,48], the spread of epidemic [26], and traffic flows [5,28,29,40,50,60,61].Recent state-of-the-art methods predict urban mobility such as traffic flows based on graph neural networks that can adequately model spatial relationships in cities by edges in the graph structure based on historical data [5,28,40,60,61].These studies enlighten the current work on predicting mobility patterns with various urban data by methods conserving the spatial structure of urban regions.Compared with the literature on urban mobility prediction, this article mainly focuses on the semantics of citizens' pairwise visit patterns to urban facility venues without historical mobility information, which differs from pointwise traffic prediction tasks.

Facility Visit Prediction
Among the studies probing the mobility prediction, many efforts have been made to predict visits or use of urban facilities and resources for its critical implication on urban design and planning [8,9,32,41,53,56,63].In Reference [8], researchers extract temporal signatures of visit patterns to venues and use the similarities between places to predict the popularity of new cultural venues.Ruan et al. [41] predict the crowd's dynamic use of mobile public agents to allocate them efficiently with lower energy costs in a theme park.Yu et al. [53] leverage cellular data, Point of Interest data, satellite images, and geographic data to predict regional demands for different categories of facilities.Liu et al. [32] use a latent factor model based on region-specific demographics and facility properties to estimate facility visits from sparse taxi trip data.Visit patterns to cultural facilities are studied in Reference [63] by a Dirichlet allocation model based on social media check-in data.These studies achieve good performance in predicting visits to urban facilities by miscellaneous approaches.
Our prediction model mainly differs from previous work in three aspects.First, our method can be applied to all facility categories, instead of one specific category like cultural or sports venues [8,63].Second, we not only focus on the number of visits originating from one region and the number of visits to one facility but simultaneously predict pairwise visits.Finally, previous works do not consider or model citizens' heterogeneous demands for facilities.By contrast, we explicitly model demands facilities and accessibility to them in our method to enhance the prediction accuracy and model interpretability.Despite the fact that some studies define "demand" in their methods [32,53], it is either visited rather than hidden demand or is not supported by rigorous analysis.

Demand and Accessibility Modeling
Citizens' demands for urban facilities are intrinsic attributes that cannot be directly sensed.The urban planning literature usually uses pre-defined functions of the composition of a region's local residents as its demand for urban facilities, e.g., transportation, public parks, or entertainment [18,37].In Reference [37], the authors select population groups with low mobility levels, such as the unemployed and people under the poverty line, and use a linear combination of each group's percentage in a region to form an index of demand for transportation.The National Recreation and Park Association [3] conducts a survey on American households' demand for different outdoor facilities and activities across various demographic groups.Hong et al. [18] adopt consumer expenditure survey data to evaluate the demand for entertainment facilities and analyze their temporal changes.Compared with classic modeling of facility demands, we use a neural network model to fit a nonlinear deterministic function of population composition to their demands, requiring little prior knowledge of potential demands.
Given citizens' demands for facilities, the number of fulfilled visits to each facility is determined by their accessibility to it.Huff [19] models choosing places to visit as a probability distribution determined by corresponding distances and attractiveness between regions.This model is widely used in planning the sites of new facility [14,45].We adopt the idea of modeling accessibility as a function of distance and facility properties.Moreover, we further propose a facility demand fulfillment ratio that aggregates the accessibility to all facilities to determine total facility visits.In contrast, previous works usually use accessibility to distribute a given number of total mobility flows or visits [42].

Research Implications and Limitations
To enhance the efficiency and interpretability of urban facility visit prediction problems, we embed the framework of treating citizens' visits to urban facilities as the process of realizing their demands for them in a prediction model.Extensive experiments demonstrate that the proposed model can perform better than baseline models that do not dissect facility visits.Meanwhile, the prediction model can recover reasonable regional facility demands and identify places where demands are insufficiently fulfilled by current facility allocation.Implications for various aspects and disciplines can be drawn from the findings in the article.
The recovered regional facility demands can provide important guidance for urban facility planning.Take the problem of optimizing facility distribution as an example.Classic methods usually attempt to minimize the average distance to the nearest facility for the whole urban population [52].This objective simply assumes a homogeneous facility demand across demographic groups.Our analysis has shown that citizens of different age or gender groups have heterogeneous facility demands.Substituting regional population by regional facility demand in the objective of facility optimization problems can better cater to groups with higher demands.For instance, regions with a more senior population will be allocated closer to hospitals if their high medical demands are valued.
Our method also sheds light on the assessment of current facility placement.Traditional supplydemand analysis methods are often based on pre-assumed functions of facility accessibility to evaluate the deprivation of facilities in cities [7,22,36].By contrast, our method explicitly models each region's capability to fulfill its facility demand and its accessibility to all facilities.The estimated fulfillment capability can act as a proxy of the supply-demand ratio in larger urban districts.

Fig. 1 .
Fig. 1.Division of urban regions and distributions of urban facilities in the three studied Chinese cities.

Fig. 2 .
Fig. 2. Gender distribution and age distribution in three studied cities.

Fig. 4 .
Fig. 4. The proposed framework of urban facility visits.

Fig. 5 .
Fig. 5.The proposed demand-driven neural network model for urban facility visit prediction.

Fig. 6 .
Fig. 6.Training and validation scores along epochs of Changsha hospital visit prediction task.

Fig. 8 .
Fig. 8. Spatial distribution of normalized logarithm facility demands to three facility categories and normalized logarithm region population.Red markers represent the locations of corresponding facilities.

Fig. 9 .
Fig. 9. Spatial distribution of the capability to fulfill demand α on three facility categories.

Fig. 10 .
Fig. 10.The function of spatial distance on facility accessibility.

Table 1 .
The List of Commonly Used Notations

Table 2 .
Basic Statistics of the Facility Visit Datasets in Three Large Cities

Table 3 .
Comparison of Prediction Metrics on Nine Datasets