Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of protection.
In traffic demand analysis, an OD (Origin-Destination) matrix is usually adopted to represent the spatial distribution of travel demands of urban residents, so that the method is applied to the aspects of urban traffic system planning design, online urban traffic control and the like.
The traditional method for constructing the OD matrix is to perform large-scale OD investigation, including roadside inquiry, home visit, postcard investigation and vehicle license plate investigation, but the method needs to invest much manpower and physical resources and is poor in timeliness.
With the development of communication technology, the calculation and construction of elements of the OD matrix can be performed based on LBS data accumulated in a server by electronic devices such as a mobile phone of a pedestrian and on-board electronic devices of a vehicle. However, the LBS data are generally more discrete, the noise data are more, and there may be a larger gap between the amounts of LBS data collected at different positions, so the OD matrix constructed in this way has a larger error and still cannot reflect the traffic demand well when applied.
To solve the problems of the prior art, embodiments of the present specification provide an OD matrix building method, which may include the following steps, as shown in fig. 1:
s101, determining a plurality of geographical blocks corresponding to a starting point and end point OD matrix to be constructed; and the number of the first and second groups,
the embodiments of the present disclosure do not limit the specific manner of dividing the geographic area, and those skilled in the art may select a suitable dividing manner according to actual requirements.
In one embodiment of the embodiments of the present disclosure, the predetermined area may be divided into a plurality of blocks, for example, the blocks may be divided into 1.5km by 500m, each block is a geographic area according to longitude and latitude or geographic distance.
In addition, each geographical area can also be identified by the GeoHash. The GeoHash can convert longitude and latitude information in a rectangular area with set length and width into a character string code, and all positions in the rectangular area are represented by the character string code, so that each geographical area can be identified by the GeoHash code.
Of course, the geographic area may also be identified in other forms, such as by using a latitude and longitude range, a starting point coordinate in combination with an area length and width distance, and the like, which need not be limited in this specification.
S102, determining a plurality of users staying in each geographic block;
the embodiments of the present disclosure do not limit the specific manner of determining the users staying in each geographic area, and those skilled in the art may select a suitable determination manner according to actual needs.
In a specific implementation manner of the embodiment of this specification, a Location Based Service (LBS) information, such as a user identifier, a longitude and latitude, a timestamp, and the like, reported by an electronic device of a user may be used to determine a Location of the user, so as to correspond to a block where the user stays.
S103, for any block: acquiring function information for the block and attribute information of each user staying in the block; determining the user attribute proportion in the block according to the function information and the attribute information;
the function information of a block may indicate functions that the block can provide, for example, a block includes a school and can provide a teaching function, and for example, a block includes a residential area, an office building, a transportation hub, a hospital, and the like, which may be used as the function information of the block and indicate the functions that the block can provide.
The attribute information of the user may specifically include various information, which is not limited in this description embodiment. For example, the user's age, gender, occupation, consumption representation, job representation, and the like. Correspondingly, the user attribute in the user attribute ratio may also be represented in various forms, for example, it may be an occupation (such as a student, a teacher, a clerk, and the like), or it may be a user representation (specifically, it may include basic information such as age, and other information such as a consumption representation, a work representation, and the like), and the like, which is not limited in this specification.
In addition, in the embodiment of the present specification, the user attribute ratio in the block may be determined according to the function information and the attribute information in various forms, which is not limited in the embodiment of the present specification, and a person skilled in the art may flexibly select an implementation manner according to actual requirements.
In a specific implementation manner of the embodiment of the present specification, a proportion prediction model may be obtained through training of a plurality of samples in advance, and then when an OD matrix is constructed, the proportion prediction model that is constructed in advance is obtained first, and a plurality of block features and a plurality of user features are extracted from the function information of the block and the attribute information of each user staying in the block according to a preset feature extraction rule, so that the extracted features are input into the proportion prediction model, and the user attribute proportion in the block predicted by the model is obtained.
The embodiment of the present specification does not need to limit the specific construction manner of the proportional prediction model, for example, the GBDT regression decision tree may be constructed by using the GBDT algorithm, and the like.
In another specific implementation manner of the embodiments of the present specification, a plurality of preset user attributes and a preset user attribute calculation rule may also be determined; the calculation rule is as follows: calculating a rule of user attributes according to a plurality of preset attribute features, and then aiming at any user staying in the block: determining the characteristic values of the attribute characteristics according to the attribute information of the user; and calculating the user attribute of the user according to the calculation rule and the determined characteristic value, and calculating the proportion of the plurality of user attributes in the block according to the determined user attribute of each user and the function information.
Specifically, the determined user attributes of each user may be accumulated, the initial proportions of the plurality of user attributes in the block are obtained through calculation, and then the preset corresponding relationship between the function information and the set proportions is obtained; the set proportion is the proportion of the plurality of user attributes which are preset, so that the set proportion corresponding to the block is determined according to the function information of the block and the obtained corresponding relation, and the initial proportion is corrected by using the set proportion to obtain the corrected user attribute proportion in the block.
S104, aiming at any user: obtaining a plurality of historical records of the user for each block, wherein the historical records are used for representing the motion track of the user among the blocks and the stay time of the user in each block; determining a plurality of alternative starting point blocks and a plurality of alternative end point blocks of the user according to the historical records; determining the matching degree of the attribute information of the user and the user attribute proportion in each candidate block, and determining a determined starting block and a determined end block of the user according to the matching degree to obtain a block link from the determined starting block to the determined end block corresponding to the user;
the embodiments of the present specification do not limit the specific number of times when obtaining the history of the user. For example, all history records of blocks in a certain day may be obtained; for another example, in order to avoid the accidental behavior of the user becoming noisy data, all the history records of each block over multiple days may be accumulated and the data including noise may be corrected.
In a specific implementation manner of the embodiment of this specification, when obtaining a plurality of times of history records of the user for each block, a preset time interval may be determined, the time history records of the user accumulated in the time interval are obtained, a time sequence of each time of history records is determined according to a time identifier of each time of history records, a corresponding block of each time of history records is determined according to a position identifier of each time of history records, then a motion trajectory of the user between each block is obtained according to the time sequence and the corresponding block, and each staying duration of the user in each block in each time of history records is obtained.
In the embodiments of this specification, a specific implementation manner of determining a plurality of candidate starting blocks and a plurality of candidate ending blocks of the user according to each history is not limited.
In a specific implementation manner of the embodiments of this specification, a plurality of candidate starting point blocks and a plurality of candidate ending point blocks of the user may be determined according to a motion trajectory in each history, and then a probability that each candidate starting point block is a determined starting point block and a probability that each candidate ending point block is a determined ending point block are determined according to a stay time in each history, where the stay time and the probability are positively correlated, that is, the probability is greater as the stay time is longer.
Correspondingly, after the probability that each alternative starting point block is the determined starting point block and the probability that each alternative ending point block is the determined ending point block are determined according to the staying time length in each history record, a plurality of offline payment records of the user can be further obtained, and the offline payment records can be used for indicating the position and the payment behavior type of the corresponding offline payment behavior of the user. For example, the payment behavior type of the payment record may be the commodity purchase, and the position is the position of the commodity purchase; for another example, the payment behavior type of the payment record may be the bus subway taking, and the position is the position when getting on or off the bus or getting on or off the bus; and so on.
Then, aiming at any offline payment record, determining a block corresponding to the record according to the position in the record; and obtaining the corresponding relation between the payment behavior type and the correction value, and determining the correction value corresponding to the payment behavior type in the record, so as to correct the probability of the corresponding alternative starting point block or the alternative ending point block according to the correction value of the offline payment record.
In addition, since the starting point and the ending point of most users may be residential areas, the probability that the block is the starting point or the ending point can be determined by specific time points and stay durations. For example, the time points of 8 am and 22 pm may be selected, the stay time of the user in the corresponding block before 8 am and after 22 pm may be obtained, if the stay time is long, and based on the function information of the block (for example, it is a residential area), the residential area may be considered as the residential area of the user, the block may be used as an alternative starting point and/or ending point block, or the probability of the alternative block may be corrected through this conclusion.
And S105, calculating the values of matrix elements corresponding to the block links according to the obtained block links, and constructing an OD matrix.
The OD matrix construction method provided in the present specification will be described below with reference to a more specific example.
A flow chart for constructing the OD matrix in this example can be as shown in fig. 2.
In fig. 2, the location information, the attribute information, the payment event information, and the like of the user can be obtained through software installed in an electronic device (such as a smart phone and a tablet computer) carried by the user under the condition that the user activates the authority. For example, user location information may be obtained by mapping software; as another example, the user attribute information may be obtained through account registration contents of a plurality of pieces of software; as another example, the payment event information may be obtained through consumption software, payment software; and so on.
In addition, for the geographical area of the OD matrix to be constructed, a plurality of blocks with similar areas may be divided, and each block is identified by Geohash. And function information of the block may be obtained based on a building function, a user mark, etc. within the block.
As shown in fig. 2, from the perspective of a block, a proportion prediction model may be constructed in advance based on preset blocks and crowd samples, features may be extracted from block function information and crowd attribute information, and by inputting the model, preference ranking of the block for crowd attributes may be output, so as to obtain a user attribute proportion in the block.
For example, the main building in the block is a school, and the function is to provide a teaching function. In addition, 5000 users' attribute information, such as professional portraits and consumer portraits of the users, can be obtained. After the features are input into the model, preference ordering for each crowd in the block can be obtained, for example, the main crowd in the block is students, teachers, chefs, cleaners and other employees, so that the user attribute proportion in the block can be calculated, for example, students: a teacher: the staff is 7: 2: 1.
as shown in fig. 2, from the perspective of the user, the movement track of the user in each block every day in a period of time, such as a week, can be obtained according to the position information and the staying time of the user. In addition, the motion trail of the user can be more accurate by means of removing accidental events, increasing daily event weight, supplementing offline payment events and the like, and the probability that one or more blocks are used as the starting point block and/or the ending point block of the user is obtained.
And then, fusing the user attribute proportion obtained based on the block angle and the probability obtained based on the user angle, and finally determining a starting point block and an end point block. For example, the user attribute ratio in block a is student: a teacher: the staff is 7: 2: 1, the user attribute ratio in block B is programmer: and (3) vendor: the students are 9: 0.9: 0.1. for a user with student attributes, the probability of both tile a and tile B being candidate end tiles is 50%, and tile a may be determined as the end tile of the user by comparing the matching degree of the attributes of tile A, B and the user.
After the determined starting point block and the determined end point block of each user are obtained in the above manner, the block link from the determined starting point block to the determined end point block corresponding to the user can be obtained, so that the value of the matrix element corresponding to the block link can be obtained by accumulating the number of users of the same block link, and the OD matrix can be constructed.
Therefore, by applying the scheme, the motion trail of each user is obtained not only based on LBS position data, but also based on functional information of the blocks, basic information of the user, a consumption portrait, a work portrait and other information, the probability of the alternative starting point and the key block is determined, the actual starting point block and the actual end point block of the user are accurately determined through the attribute matching degree of the blocks and the user, the element values in the OD matrix are obtained, and the accurate OD matrix is constructed and obtained.
The more accurate OD matrix constructed based on the scheme can more accurately analyze and predict the traffic demand, thereby carrying out the planning design of the urban traffic system, the online urban traffic control and the like which are more in line with the actual situation.
Corresponding to the above method embodiment, this specification embodiment further provides an OD matrix building apparatus, as shown in fig. 3, the apparatus may include:
the block determining module 110 is configured to determine a plurality of geographic blocks corresponding to a starting point and ending point OD matrix to be constructed; and the number of the first and second groups,
a user determining module 120, configured to determine a number of users staying in each geographic block;
a proportion obtaining module 130, configured to, for any block: acquiring function information for the block and attribute information of each user staying in the block; determining the user attribute proportion in the block according to the function information and the attribute information;
a link obtaining module 140 configured to, for any user: obtaining a plurality of historical records of the user for each block, wherein the historical records are used for representing the motion track of the user among the blocks and the stay time of the user in each block; determining a plurality of alternative starting point blocks and a plurality of alternative end point blocks of the user according to the historical records; determining the matching degree of the attribute information of the user and the user attribute proportion in each candidate block, and determining a determined starting block and a determined end block of the user according to the matching degree to obtain a block link from the determined starting block to the determined end block corresponding to the user;
and a matrix constructing module 150, configured to calculate values of matrix elements corresponding to the block links according to the obtained block links, and construct an OD matrix.
In a specific embodiment provided in this specification, referring to fig. 4, the proportion obtaining module 130 may include:
a model obtaining unit 131, configured to obtain a pre-constructed proportional prediction model;
a feature extraction unit 132, configured to extract, according to a preset feature extraction rule, a plurality of block features and a plurality of user features from the function information of the block and the attribute information of each user staying in the block;
a proportion obtaining unit 133, configured to input the extracted features into the proportion prediction model, so as to obtain the user attribute proportion in the block predicted by the model.
In a specific embodiment provided in this specification, referring to fig. 5, the proportion obtaining module 130 may include:
a rule obtaining unit 134, configured to determine a plurality of preset user attributes and a preset user attribute calculation rule; the calculation rule is as follows: calculating a rule of the user attribute according to a plurality of preset attribute characteristics;
an attribute calculating unit 135, configured to, for any user staying in the block: determining the characteristic values of the attribute characteristics according to the attribute information of the user; calculating the user attribute of the user according to the calculation rule and the determined characteristic value;
a proportion calculating unit 136, configured to calculate, according to the determined user attribute of each user and the function information, a proportion of the plurality of user attributes in the block.
In an embodiment provided in this specification, the proportion calculating unit 136 is specifically configured to:
accumulating the determined user attributes of each user, and calculating to obtain the initial proportion of the plurality of user attributes in the block;
acquiring a preset corresponding relation between the function information and a set proportion; the set proportion is the preset proportion of the plurality of user attributes;
determining a set proportion corresponding to the block according to the functional information of the block and the obtained corresponding relation;
and correcting the initial proportion by using the set proportion to obtain the corrected user attribute proportion in the block.
In a specific embodiment provided in this specification, referring to fig. 6, the link obtaining module 140 may include:
a location obtaining unit 141, configured to determine a preset time interval, and obtain location information of the user accumulated in the time interval;
a data preparation unit 142, configured to determine a time sequence of each piece of location information according to the time identifier of each piece of location information; determining a corresponding block of each position information according to the position identification of each position information;
a record obtaining unit 143, configured to obtain a motion trajectory of the user among the blocks according to the time sequence and the corresponding blocks; and obtaining each staying time length of the user in each block in each position information.
In a specific embodiment provided in this specification, referring to fig. 7, the link obtaining module 140 may include:
a candidate block determining unit 144, configured to determine a plurality of candidate start blocks and a plurality of candidate end blocks of the user according to the motion trajectory in each history;
a probability determining unit 145, configured to determine, according to the stay time in each history record, a probability that each candidate starting block is a determined starting block and a probability that each candidate ending block is a determined ending block; wherein the dwell time is positively correlated with the probability.
In a specific embodiment provided in this specification, referring to fig. 8, the link obtaining module 140 further includes: the probability correction unit 146 is specifically configured to:
after determining the probability of each alternative starting point block as a determined starting point block and the probability of each alternative end point block as a determined end point block according to the stay time in each historical record, obtaining a plurality of offline payment records of the user; the offline payment record is used to indicate: the position and the payment behavior type of the corresponding offline payment behavior of the user are determined;
for any offline payment record: determining a block corresponding to the record according to the position in the record; obtaining the corresponding relation between the payment behavior type and the correction value, and determining the correction value corresponding to the payment behavior type in the record;
and correcting the probability of the corresponding alternative starting point block or the alternative end point block according to the correction value of each offline payment record.
The implementation process of the functions and actions of each module in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
Embodiments of the present specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the OD matrix construction method when executing the program. The method at least comprises the following steps:
an OD matrix construction method, comprising:
determining a plurality of geographical blocks corresponding to a starting point and end point OD matrix to be constructed; and the number of the first and second groups,
determining a plurality of users staying in each geographic block;
for any block: acquiring function information for the block and attribute information of each user staying in the block; determining the user attribute proportion in the block according to the function information and the attribute information;
for any user: obtaining a plurality of historical records of the user for each block, wherein the historical records are used for representing the motion track of the user among the blocks and the stay time of the user in each block; determining a plurality of alternative starting point blocks and a plurality of alternative end point blocks of the user according to the historical records; determining the matching degree of the attribute information of the user and the user attribute proportion in each candidate block, and determining a determined starting block and a determined end block of the user according to the matching degree to obtain a block link from the determined starting block to the determined end block corresponding to the user;
and calculating the value of the matrix element corresponding to each block link according to the obtained block link, and constructing the OD matrix.
Fig. 9 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
Embodiments of the present specification also provide a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the OD matrix construction method described above. The method at least comprises the following steps:
an OD matrix construction method, comprising:
determining a plurality of geographical blocks corresponding to a starting point and end point OD matrix to be constructed; and the number of the first and second groups,
determining a plurality of users staying in each geographic block;
for any block: acquiring function information for the block and attribute information of each user staying in the block; determining the user attribute proportion in the block according to the function information and the attribute information;
for any user: obtaining a plurality of historical records of the user for each block, wherein the historical records are used for representing the motion track of the user among the blocks and the stay time of the user in each block; determining a plurality of alternative starting point blocks and a plurality of alternative end point blocks of the user according to the historical records; determining the matching degree of the attribute information of the user and the user attribute proportion in each candidate block, and determining a determined starting block and a determined end block of the user according to the matching degree to obtain a block link from the determined starting block to the determined end block corresponding to the user;
and calculating the value of the matrix element corresponding to each block link according to the obtained block link, and constructing the OD matrix.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points. The above-described apparatus embodiments are merely illustrative, and the modules described as separate components may or may not be physically separate, and the functions of the modules may be implemented in one or more software and/or hardware when implementing the embodiments of the present disclosure. And part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is only a specific embodiment of the embodiments of the present disclosure, and it should be noted that, for those skilled in the art, a plurality of modifications and decorations can be made without departing from the principle of the embodiments of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the embodiments of the present disclosure.