User classification method, device, equipment and storage medium
By extracting the features under multiple travel dimensions from travel data and clustering in the direction of density growth, the problem of poor accuracy and difficulty in distinguishing between multiple dimensions in user classification is solved, and high accuracy and volatility are achieved Awesome user group classification.
Patent Information
- Application Number
- CN202110025609.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-08
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-01-08
AI Technical Summary
The K-Means clustering method has problems with poor accuracy in user classification and the inability to distinguish multiple feature dimensions.
By obtaining the travel data of passengers entering and leaving the traffic station, the travel characteristics under multiple travel dimensions are extracted, and clustering is carried out along the direction of density growth of travel characteristics, and clustering is automatically determined, without presetting the cluster number, so as to achieve different modes Feature analysis and aggregation.
It improves the accuracy and clustering accuracy of user group classification, is highly adaptable and robust, and can effectively mine travel data characteristics in different dimensions, track data changes in real time, and is suitable for multi-dimensional data analysis.
Smart Images

Figure CN112699955B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to user classification technology, and more particularly to a user classification method, apparatus, device and storage medium. Background Art
[0002] With the development of urban rail transit construction, a large amount of travel data of users in the city is usually collected, and the travel data is deeply mined and analyzed to provide users with better travel services, such as real-time road conditions, real-time public transportation, and urban traffic travel forecasts.
[0003] In the process of mining travel big data, the K-Means clustering method is usually used to divide users into different user groups according to their travel characteristics, so that personalized travel services can be further provided to different user groups, such as recommending travel routes, recommending travel time, indicating the congestion level of traffic stations, recommending surrounding facilities of traffic stations, etc.
[0004] However, the K-Means clustering method requires the K value to be set in advance, that is, the number of classifications is artificially limited. The setting of the K value will affect the accuracy of clustering. Therefore, when using the K-Means clustering method to classify users, there will be poor accuracy. At the same time, the K-Means clustering method only clusters all data under the same feature dimension. When the data set to be processed has multiple feature dimensions, K-Means cannot achieve effective distinction. Summary of the invention
[0005] The present invention provides a user classification method, device, equipment and storage medium to solve the problem that the K-Means clustering method has poor accuracy and cannot distinguish multiple feature dimensions in user classification applications.
[0006] In a first aspect, an embodiment of the present invention provides a user classification method, the method comprising:
[0007] Obtain travel data recorded by multiple passengers as they enter and exit transportation stations;
[0008] Extracting features that characterize the travel patterns of the passengers under multiple travel dimensions from the travel data as travel features of the passengers;
[0009] Clustering the travel features along a direction of increasing density of the travel features to determine a plurality of clusters;
[0010] It is determined that the passengers with the travel characteristics in the same cluster are the same user group.
[0011] In a second aspect, an embodiment of the present invention further provides a user classification device, the device comprising:
[0012] A data acquisition module, used to acquire travel data recorded when multiple passengers enter and exit a transportation station;
[0013] A feature extraction module, used to extract features characterizing the travel patterns of the passengers under multiple travel dimensions from the travel data as the travel features of the passengers;
[0014] A clustering module, used for clustering the travel features along the direction of density growth of the travel features to determine a plurality of clusters;
[0015] The user classification module is used to determine that the passengers with the travel characteristics in the same cluster are in the same user group.
[0016] In a third aspect, an embodiment of the present invention further provides a computer device, the computer device comprising:
[0017] one or more processors;
[0018] A memory for storing one or more programs;
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the user classification method as described in the first aspect.
[0020] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the user classification method as described in the first aspect is implemented.
[0021] The present invention obtains travel data recorded when multiple passengers enter and exit a transportation station; extracts features that characterize the travel rules of passengers under multiple travel dimensions from the travel data as the travel features of the passengers; clusters the travel features along the direction of the density growth of the travel features to determine multiple clusters; and determines that the passengers to whom the travel features belong in the same cluster are the same user group. The present invention directly mines travel rules from travel data and extracts travel features under different travel dimensions, which is more objective and reliable. At the same time, clustering travel features along the direction of the density growth of travel features is a gradient search method, which does not require the number of clusters to be set in advance, and can automatically find multiple modes of travel data. Based on different modes, feature analysis is performed on travel data to aggregate travel features belonging to the same category under different modes into the same cluster, and travel features under different dimensions can be tracked in real time. It is insensitive to the dynamic change process of data, has strong adaptability, high robustness, high discrimination, and high clustering accuracy. Compared with the K-Means clustering method, it can realize feature mining of travel data under different dimensions, and has a higher accuracy in user group classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flowchart of a user classification method provided in Embodiment 1 of the present invention;
[0023] Figure 2 A flowchart of a user classification method provided in Embodiment 2 of the present invention;
[0024] Figure 3 A schematic diagram of a data processing architecture provided in Embodiment 2 of the present invention;
[0025] Figure 4 A schematic diagram of mass center movement provided in Embodiment 2 of the present invention;
[0026] Figure 5 A schematic diagram of a travel feature space analysis provided in the second embodiment of the present invention;
[0027] Figure 6 A schematic diagram of the structure of a user classification device provided in Embodiment 3 of the present invention;
[0028] Figure 7 A schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0029] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0030] It should be noted that in the description of the embodiments of the present invention, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0031] Today, with the accelerated development of industrialization and urbanization, millions of people are pouring into large cities, bringing tremendous pressure to urban management and urban transportation. As the backbone of urban transportation, rail transit can effectively alleviate traffic congestion and improve the efficiency of urban transportation. In foreign countries, rail transit has experienced hundreds of years of development and has been proven to play a pivotal role in urban development, taking a major share in public transportation. Whether the existing data can be used to accurately analyze and grasp the rules of urban residents' rail travel is directly related to the rationality and accuracy of the development strategy, planning and policy formulation of urban rail transit. With the development of urban rail transit construction in my country and the rapid advancement of urbanization, how to meet the growing travel needs of residents through reasonable rail transit design has become an urgent issue. The traditional rail travel behavior analysis model and method that directly observes passenger flow and station throughput has been difficult to meet more accurate and refined needs. At the same time, the rules of residents' rail travel can well reflect the changes in urban social space and provide valuable reference for the rational planning of cities.
[0032] With the widespread application of big data technology in my country's intelligent transportation system and the rapid development of traffic data collection technology, many cities have accumulated massive and diverse public transportation data. These data not only record the mode and time sequence of each passenger's choice of public transportation, but also record the spatiotemporal trajectory of public transportation vehicles during operation, providing a reliable data source for studying the travel habits of different groups of people and the spatiotemporal characteristics of passenger flow. In order to maximize the advantages of urban public transportation, it is necessary to deeply understand the travel characteristics of urban public transportation passengers, analyze the travel habits of passengers, and master the spatiotemporal characteristics of passengers' travel.
[0033] Embodiment 1
[0034] Figure 1 This is a flow chart of a user classification method provided in the first embodiment of the present invention. This embodiment can be applied to the case where passengers entering and leaving a transportation station are classified according to travel data. The method can be executed by a user classification device. The user classification device can be implemented by software and / or hardware and can be configured in a computer device, such as a server, a workstation, a personal computer, etc. The method specifically includes the following steps:
[0035] S101. Acquire travel data recorded when multiple passengers enter and exit a transportation station.
[0036] In this embodiment, travel data recorded when multiple passengers enter and exit transportation stations can be obtained from different data sources. Travel data refers to data that characterizes the travel patterns of passengers, and may include travel distance, number of trips, travel time, transportation stations passed through, travel transaction data, etc. Different data sources can be transportation card swiping data, ticket machine selling bus card swiping data, public transportation application transaction data, etc. This embodiment does not impose any limitations on this.
[0037] In a specific implementation of this embodiment, S101 may include the following steps:
[0038] S1011. Obtain at least one of the card swiping data, ticket machine transaction data, application gate data, and QR code gate data recorded when multiple passengers enter and exit a transportation station as the passengers' original travel data.
[0039] S1012. The original travel data is integrated based on the passenger's identity identification to obtain travel data recorded when multiple passengers enter and exit the transportation station.
[0040] Among them, the identity identification includes at least one of ID number, passport number, name, mobile phone number, face data, finger vein data, and palm vein data.
[0041] Specifically, the original travel data from different data sources can be integrated and associated in the following manner: normalize the format of the original travel data; remove the employee card data and dirty data of the transportation station from the original travel data after the format normalization to obtain the candidate travel data; query the identity associated with the candidate travel data, the identity includes at least one of the ID number, passport number, name, mobile phone number, face data, finger vein data, palm vein data, etc.; merge the candidate travel data corresponding to all the identity belonging to the same passenger to obtain the travel data recorded when multiple passengers enter and exit the transportation station. It should be noted that this embodiment does not limit the specific implementation method of integrating the original travel data.
[0042] S102. Extracting features that characterize the travel patterns of passengers in multiple travel dimensions from the travel data as travel features of the passengers.
[0043] Since the travel data of passengers can be quantified in time and space to explore the travel patterns of passengers, for example, in terms of time, factors such as the number of trips, total travel time, and the length of time between two trips can be considered to explore the travel patterns of users in the time dimension; in terms of space, factors such as the longest travel distance, the shortest travel distance, and the total travel distance within a fixed time can be considered to explore the travel patterns of users in the spatial dimension.
[0044] Therefore, specifically, we can start from various factors of the time dimension and various factors of the space dimension, take these factors that characterize the passenger travel behavior as different travel dimensions, and extract the characteristics that characterize the passenger travel rules under multiple travel dimensions from the travel data as the passenger travel characteristics. That is, the travel dimensions in this implementation include different factors that imply the passenger travel behavior, which include time factors and space factors. Time factors include the number of trips, the total travel time, the time interval between two trips, etc., and space factors include the longest travel distance, the shortest travel distance, the total travel distance within a fixed time, etc.
[0045] In this embodiment, the travel data of passengers can be statistically analyzed according to time factors and space factors to extract the travel characteristics of passengers. For example, different weights can be assigned to time factors and space factors, and the travel data belonging to different factors can be linearly fused. The fused data can be uniformly sampled to obtain the travel characteristics of passengers. This embodiment does not limit this.
[0046] In one implementation, the travel dimensions include the number of trips, the travel time, and the travel distance, and S102 may include the following steps:
[0047] S1021. Filter out travel data corresponding to three travel dimensions, namely, number of trips, travel time, and travel distance, from all travel data as target travel data.
[0048] S1022. Within a preset time period, the target travel data belonging to the same passenger is numerically counted based on the number of trips, travel time, and travel distance to obtain characteristics that characterize the passenger's travel patterns as the passenger's travel characteristics.
[0049] As an example, the number of trips belonging to the same passenger can be queried from the target travel data, and the mean of the trip number can be calculated and the extreme values can be filtered out as the first feature to characterize the passenger's travel patterns; the travel time belonging to the same passenger can be queried from the target travel data, and the mean of the travel time can be calculated and the extreme values can be filtered out as the second feature to characterize the passenger's travel patterns; the travel distance belonging to the same passenger can be queried from the target travel data, and the mean of the travel distance can be calculated and the extreme values can be filtered out as the third feature to characterize the passenger's travel patterns; the first feature, the second feature, and the third feature can be used as the passenger's travel characteristics.
[0050] S103 . Cluster the travel features along the direction of increasing density of the travel features to determine a plurality of clusters.
[0051] Clustering is to discover potential correlations in travel data and understand the distribution patterns of travel data so as to group and classify passengers and provide better personalized services for them.
[0052] In this embodiment, the travel characteristics of passengers can be used as samples, and the similarity between samples can be evaluated to divide the samples into multiple clusters, each cluster being a category. Generally, mining the spatial structure between samples can discover the connection between samples, and this connection can be used to evaluate the similarity between samples. The spatial structure between samples can be represented by the compactness of sample distribution, that is, the connectivity between samples can be examined from the perspective of sample density, and clustering clusters can be continuously expanded based on connectable samples to obtain the final clustering results. Therefore, this embodiment can cluster travel characteristics along the direction of density growth of travel characteristics to determine multiple clusters, which is conducive to intuitively mining the distribution law of travel data, finding clusters of arbitrary shapes, retaining the characteristics of travel characteristics under different travel dimensions, and making the clustered clusters more distinguishable and more accurate.
[0053] Specifically, clustering samples from the perspective of sample density mainly includes two parts: one is to determine the core object, and the other is clustering. Among them, the specific way to determine the core object may include: dividing the samples to be clustered in space, such as randomly selecting a single sample to construct the neighborhood space of the sample, dividing the samples in the space into inner points and outer points of the neighborhood space based on the distance between the samples, and calculating the feature vector of the inner point to determine the core object in the neighborhood. The specific way to cluster may include: traversing the core objects in the sample space in turn, clustering all points that can be reached by the core object density into a cluster, and marking the samples that cannot be found as abnormal samples.
[0054] In this embodiment, there are many specific implementation methods for clustering travel features along the direction of travel feature density growth, which are not limited in this embodiment. For example, a method of calculating the mean value by a dynamic sliding window can be used to find the direction of travel feature density growth. The goal is to find the center point of each sliding window, and update the center point of the sliding window by calculating the mean of the inner points of the sliding window. The moving direction of the center point is determined as the direction of travel feature density growth. When the sliding window meets the convergence condition, it is determined that all the inner points visited in the sliding window belong to a cluster. According to the above process, multiple sliding windows are iterated to visit the travel features, so as to find the cluster corresponding to each travel feature. The DBSCAN algorithm, OPTICS algorithm, DENCLUE algorithm, etc. can also be used to cluster travel features.
[0055] In this embodiment, the travel characteristics are clustered along the direction of density growth of the travel characteristics to determine multiple clusters, and also include: classifying the travel characteristics of passengers according to different travel dimensions to obtain a column vector corresponding to each travel dimension; calculating the difference between the maximum value and the minimum value in each column vector as the first difference; calculating the difference between each travel feature and the maximum value in each column vector as the second difference; taking the absolute value of the ratio of the second difference to the first difference to obtain the normalized travel characteristics under multiple travel dimensions.
[0056] S104: Determine that passengers with travel characteristics in the same cluster are the same user group.
[0057] In this embodiment, after the travel characteristics are clustered and multiple clusters are determined, the passengers to whom the travel characteristics belong are classified according to different clusters, and the passengers to whom the travel characteristics belong in the same cluster are determined to be the same user group.
[0058] After classifying the passengers, personalized travel services can be provided for different user groups, including: counting the age groups of the user groups and labeling the user groups according to age groups. If the user groups are office workers, peak timetables and travel routes will be recommended to the user groups to help passengers save commuting time; if the user groups are elderly people, traffic flow heat meters, train travel schedules and train stop times will be provided to the user groups. The traffic flow heat meters are used to indicate the degree of traffic congestion to ensure the travel safety of passengers.
[0059] The embodiment of the present invention obtains travel data recorded when multiple passengers enter and exit a transportation station; extracts features that characterize the travel rules of passengers under multiple travel dimensions from the travel data as the travel features of the passengers; clusters the travel features along the direction of the density growth of the travel features to determine multiple clusters; and determines that the passengers to whom the travel features belong in the same cluster are the same user group. This embodiment directly mines travel rules from travel data and extracts travel features under different travel dimensions, which is more objective and reliable. At the same time, clustering travel features along the direction of the density growth of travel features is a gradient search method, which does not require the number of clusters to be set in advance, and can automatically find multiple modes of travel data. Based on different modes, feature analysis is performed on travel data to aggregate travel features belonging to the same category in different modes into the same cluster, and can track travel features under different dimensions in real time. It is insensitive to the dynamic change process of data, has strong adaptability, high robustness, high discrimination, and high clustering accuracy. Compared with the K-Means clustering method, it can realize feature mining of travel data under different dimensions, and has a higher accuracy in classifying user groups.
[0060] Embodiment 2
[0061] Figure 2 This is a flow chart of a user classification method provided in Embodiment 2 of the present invention. This embodiment is based on the previous embodiment and refines and supplements the user classification method. The method specifically includes the following steps:
[0062] S201. Acquire travel data recorded when multiple passengers enter and exit a transportation station.
[0063] S202. Extracting features that characterize the travel patterns of passengers in multiple travel dimensions from the travel data as travel features of the passengers.
[0064] As an example of this embodiment, a large amount of travel data of a city's subway is obtained from different data sources. By integrating and associating different data sources, valid identity information is identified to build a unified passenger account, and the large amount of travel data obtained is processed using distributed collection and storage computing.
[0065] The overall architecture of this example for processing travel data is as follows Figure 3 As shown, including the following:
[0066] 1. Data source layer
[0067] The data source layer is mainly used to collect travel data from different data sources, including Yangchengtong card swiping data, ticket machine data, subway APP gate data, QR code gate data, etc.
[0068] 2. Data Integration Layer
[0069] The data integration layer mainly includes data integration functional modules, which provide distributed data collection, protocol adaptation and docking, real-time message access and other functions. It is mainly used to complete the adaptation of interface protocols between various data sources, the collection and adaptation of original data, and the scheduling of collection tasks.
[0070] 3. Data storage layer
[0071] The storage layer is used to store historical travel record data and related tables. MySQL mainly stores unified account information data. Hive tables all use the method of creating external tables. Historical data is stored in HDFS, with day as the partition field. Hive is a distributed data warehouse database, and HDFS is a Hadoop distributed file system.
[0072] 4. Data computing layer
[0073] The data computing layer includes data cleaning and data processing. The steps are as follows:
[0074] (1) Unified site number and account ID;
[0075] (2) Remove employee card data and junk data (dirty data);
[0076] (3) Data from different data sources are identified using valid identity information, which includes the ID number, name, mobile phone number, face ID, finger vein ID, palm vein ID, etc. at the time of registration, and are associated and merged through a unified account ID.
[0077] Among them, the unified account table fields are shown in Table 1:
[0078]
[0079]
[0080]
[0081] Table 1 Unified account fields
[0082] 5. Data service layer
[0083] The data service layer is used to extract passengers' travel characteristics, classify passengers, and provide service interfaces for other systems.
[0084] Travel data corresponding to the three dimensions of travel number, travel time and travel distance can be screened out from all travel data as target travel data; within a preset fixed time period, the target travel data belonging to the same passenger are subjected to mean statistics and extreme value screening to obtain characteristics characterizing the travel patterns of the same passenger as the passenger's travel characteristics.
[0085] In this example, a month is used as a fixed time period. In the target travel data, the monthly travel time, monthly travel frequency, and monthly travel distance of passengers with the same identity information entering and exiting the subway station are queried; based on the monthly travel time, the average daily travel time in a month is calculated as the average time; the longest single travel time in a month is determined from the monthly travel time as the maximum time; the shortest single travel time in a month is determined from the monthly travel time as the minimum time; the total number of trips in a month is counted; based on the monthly travel frequency, the average daily number of trips in a month is calculated as the average number; the maximum number of daily trips in a month is determined from the monthly travel frequency. , as the maximum number of times in a single day; determine the minimum number of trips per day in a month from the monthly travel number as the minimum number of times in a single day; based on the monthly travel distance, calculate the average distance of each trip in a month as the average travel distance; determine the maximum single travel distance in a month from the monthly travel distance as the maximum travel distance; determine the minimum single travel distance in a month from the monthly travel distance as the minimum travel distance; for passengers with the same identity information, the average time, maximum time, minimum time, total number of times, average number of times, maximum number of times in a single day, minimum number of times in a single day, average travel distance, maximum travel distance, and minimum travel distance are used as the travel characteristics of the passenger.
[0086] According to Table 2, the travel data of multiple passengers in one month can be counted to determine the travel characteristics of each passenger in different travel dimensions.
[0087]
[0088] Table 2 Travel characteristics
[0089] In Table 2, n represents the total number of trips taken by passengers in a month, d represents the number of days in a month, and t i represents the travel time of a single passenger trip, m i Indicates the number of trips per day by passengers, dist i It represents the travel distance of a passenger in a single trip.
[0090] In this example, the travel characteristics of each passenger can be represented as the following row vector:
[0091] x i =[t mean ,t max ,t min ,n,n mean ,n max ,n min ,dist mean ,dist max ,dist min ]
[0092] Among them, the row vector xi It includes ten categories of characteristic data, each of which corresponds to a specific travel dimension. mean represents the average time, t max represents the maximum time, t min represents the minimum time, n represents the total number of times, n mean Represents the average number of times, n max Indicates the maximum number of times per day, n min Indicates the minimum number of times per day, dist mean Represents the average travel distance, dist max Indicates the maximum travel distance, dist min Represents the minimum travel distance.
[0093] In order to balance the impact of ten types of feature data on travel characteristics, this example uniformly quantifies the features under different travel dimensions and normalizes each type of feature data in all travel characteristics, including: representing all travel characteristics as a row vector x containing multiple rows i The matrix M is divided into column vectors Y = [y1, y2, ..., y n ], each column vector Y corresponds to a specific travel dimension, and the travel characteristics are normalized according to the maximum and minimum values in the column vector Y. The calculation formula is: Among them, y max Y=[y1,y2,…,y n ], y min Y=[y1,y2,…,y n ] is the minimum value. i ′ Replace all original feature data y in column vector Y i , update the matrix M, and then obtain the normalized travel characteristics.
[0094] S203. Set the centroid of the cluster in the unoccupied travel features of the passenger.
[0095] In this embodiment, the unoccupied travel features of the passengers can be mapped in the same spatial dimension, a travel feature is randomly selected as the current initial seed point, and the search radius of the initial seed point is determined to divide the travel features in the space into a neighborhood belonging to the initial seed point; within the neighborhood, the center of mass within the neighborhood is calculated based on the distance between the travel feature and the initial seed point.
[0096] S204, moving the centroid along the direction of increasing density of the travel features to add the travel features adjacent to the centroid to the cluster until the clusters converge.
[0097] The centroid calculated within the neighborhood of the initial seed point is used as the current candidate centroid Update the current candidate centroid to the centroid of the next moment according to the following formula: t represents the current time, and t+1 represents the next time.
[0098] Assume that N(x i ) is the center of mass x i The set of adjacent points whose distance is within a given bandwidth, that is, N(x i ) is the set of travel characteristics within the neighborhood, m(x i ) is the average offset of the centroid in each iteration, indicating the direction of the density growth of the travel feature. The current candidate centroid can be calculated by the following formula Update to the center of mass at the next moment This formula can also be expressed as the mean of travel characteristics within the neighborhood:
[0099]
[0100] in, d is the dimension of x.
[0101] like Figure 4 As shown in FIG. 1 , the travel features are represented by circles, and the neighborhood range is framed by dotted lines. In the first iterative calculation, it is determined whether the distance between the centroid 402 at the current moment and the initial seed point 401 is less than the preset threshold. If so, it means that this iteration has converged, and the travel features adjacent to the centroid 402 are added to the cluster. If not, the next iterative calculation is entered. Specifically, the centroid 402 at the previous moment is used as the current candidate centroid, and the neighborhood range of the candidate centroid is re-determined. The new centroid within the neighborhood range is calculated based on the distance between the travel features within the neighborhood range and the candidate centroid, that is, the formula m(x i ) to update the candidate centroids, calculate the average offset of the candidate centroids moving towards the area with the highest density, move the candidate centroids according to the average offset, and obtain a new centroid 403 as the centroid of this iteration. Calculate the distance between the new centroid 403 and the candidate centroid (i.e., centroid 402), and determine whether the distance is less than a preset threshold. If so, it means that this iteration has converged, and the travel features adjacent to the centroid 403 are added to the cluster. If not, continue to the next iterative calculation. The specific process is as shown in the above steps.
[0102] In one implementation, S204 may include the following specific steps:
[0103] S2041. Add travel features whose distance to the centroid is within the set bandwidth to the cluster.
[0104] In the specific implementation, the estimated value of the estimate_bandwidth function of Sklearn can be used to automatically set the bandwidth. Sklearn: Scikit-learn (sklearn) is a third-party algorithm library commonly used in machine learning, which encapsulates commonly used machine learning methods, including regression, dimensionality reduction, classification, clustering and other methods.
[0105] S2042. Calculate the vector from the centroid to each travel feature in the cluster as the individual travel vector.
[0106] S2043. Add the individual travel vectors to obtain the overall travel vector.
[0107] S2044. Move the centroid along the overall travel vector to obtain a new centroid.
[0108] S2045: Determine whether the preset convergence condition is currently met. If so, execute S2046; if not, return to execute S2041.
[0109] S2046: Determine cluster convergence.
[0110] S205: Determine whether all travel features are added to the cluster.
[0111] If yes, execute S206, if no, execute S207.
[0112] S206: Output multiple valid clusters based on preset clustering conditions.
[0113] In an example of this embodiment, the preset clustering condition may be: for a given travel feature, query the first frequency of each travel feature being accessed by a cluster, and determine that each travel feature belongs to the cluster with the highest first frequency.
[0114] In another example of this embodiment, the preset clustering condition may also be: for a given cluster, counting the second frequencies of clusters appearing during multiple clusterings, and determining that the cluster with the highest second frequency is valid.
[0115] In another example of this embodiment, the preset clustering condition may also be: for a given travel feature, query the first frequency of each travel feature being accessed by the cluster, and determine that each travel feature belongs to the cluster with the highest first frequency. At the same time, for a given cluster, count the second frequency of the cluster appearing during multiple clusterings, and determine that the cluster with the highest second frequency is valid.
[0116] S207 . Mark the travel characteristics in the cluster as occupied, and return to execute S203 .
[0117] S208: Determine that passengers with travel characteristics in the same cluster are the same user group.
[0118] The clustering method used in this embodiment does not need to pre-set the number of clusters, nor does it rely on the parameter bandwidth. It can automatically adjust the bandwidth convergence neighborhood range. When the offset distance of the centroid changes little, it is determined that the centroid has reached the area with the highest density in the travel feature, and the clustering convergence is determined. All the travel features adjacent to the centroid during the movement are added to the cluster, such as Figure 5 As shown, the clustering effect after different random initializations of travel characteristics is demonstrated.
[0119] This embodiment directly mines travel patterns from travel data and extracts travel characteristics under different travel dimensions, which is more objective and reliable. At the same time, clustering travel characteristics along the direction of density growth of travel characteristics is a gradient search method. There is no need to pre-set the number of clusters. It can automatically find multiple modes of travel data and perform feature analysis on travel data based on different modes to aggregate travel characteristics belonging to the same category under different modes into the same cluster. It can track travel characteristics under different dimensions in real time and is insensitive to the dynamic changes of data. It has strong adaptability, high robustness, high discrimination and high clustering accuracy. Compared with the K-Means clustering method, it can realize feature mining of travel data in different dimensions and has higher accuracy in classifying user groups.
[0120] Embodiment 3
[0121] Figure 6 This is a schematic diagram of the structure of a user classification device provided in Embodiment 3 of the present invention. The device may specifically include the following modules:
[0122] The data acquisition module 601 is used to acquire the travel data recorded when multiple passengers enter and exit the transportation station;
[0123] A feature extraction module 602 is used to extract features that characterize the travel patterns of the passengers under multiple travel dimensions from the travel data as travel features of the passengers;
[0124] A clustering module 603, configured to cluster the travel features along a direction of increasing density of the travel features to determine a plurality of clusters;
[0125] The user classification module 604 is used to determine that the passengers with the travel characteristics in the same cluster are in the same user group.
[0126] In one embodiment of the present invention, the data acquisition module 601 includes:
[0127] A data acquisition submodule, used to acquire at least one of the card swiping data, ticket machine transaction data, application gate data, and QR code gate data recorded when multiple passengers enter and exit a transportation station as the original travel data of the passengers;
[0128] The data fusion submodule is used to fuse the original travel data based on the identity identification of the passenger to obtain the travel data recorded when multiple passengers enter and exit the transportation station.
[0129] In one embodiment of the present invention, the data fusion submodule includes:
[0130] A format normalization unit, used for normalizing the format of the original travel data;
[0131] A candidate travel data determination unit, configured to remove employee card data and dirty data of traffic stations from the original travel data after format normalization to obtain candidate travel data;
[0132] An identity identification unit, used to query an identity identification associated with the candidate travel data, wherein the identity identification includes at least one of an ID number, a passport number, a name, a mobile phone number, a face data, a finger vein data, a palm vein data, etc.;
[0133] The travel data determination unit is used to merge the candidate travel data corresponding to all the identity identifiers belonging to the same passenger to obtain the travel data recorded when multiple passengers enter and exit the transportation station.
[0134] In one embodiment of the present invention, the travel dimensions include the number of trips, the travel time, and the travel distance; the feature extraction module 602 includes:
[0135] A data screening submodule, used for screening out travel data corresponding to the three travel dimensions of the number of trips, the travel time and the travel distance from all the travel data as target travel data;
[0136] The numerical statistics submodule is used to perform numerical statistics on the target travel data belonging to the same passenger based on the number of trips, the travel time, and the travel distance within a preset time period, so as to obtain characteristics characterizing the travel patterns of the passenger as the travel characteristics of the passenger.
[0137] In one embodiment of the present invention, the numerical statistics submodule includes:
[0138] A first feature confirmation unit is used to query the number of trips belonging to the same passenger from the target travel data, so as to calculate the mean value and filter the extreme value of the number of trips as the first feature characterizing the travel pattern of the passenger;
[0139] A second feature confirmation unit is used to query the travel time belonging to the same passenger from the target travel data, so as to calculate the mean value and filter the extreme value of the travel time as the second feature characterizing the travel regularity of the passenger;
[0140] A third feature confirmation unit, configured to query the travel distances belonging to the same passenger from the target travel data, so as to calculate a mean value and filter out extreme values of the travel distances as a third feature characterizing the travel regularity of the passenger;
[0141] A travel feature determination unit is used to use the first feature, the second feature, and the third feature as the travel features of the passenger.
[0142] In one embodiment of the present invention, the clustering module 603 includes:
[0143] A centroid setting submodule, used for setting the centroid of a cluster in the unoccupied travel feature of the passenger;
[0144] A cluster generation submodule, configured to move the centroid along a direction in which the density of the travel features increases, so as to add the travel features adjacent to the centroid into the cluster until the cluster converges;
[0145] A judgment submodule, used to judge whether all the travel features are added to the cluster, if so, calling the cluster output submodule, if not, calling the return execution submodule;
[0146] A cluster output submodule, used for outputting a plurality of valid clusters based on preset clustering conditions;
[0147] A return execution submodule is used to mark the travel characteristics in the cluster as occupied, and return to execute the setting of the centroid of the cluster in the unoccupied travel characteristics of the passenger.
[0148] In one embodiment of the present invention, the cluster generation submodule includes:
[0149] A feature adding unit, used for adding the travel features within a set bandwidth from the centroid to the cluster;
[0150] A single travel vector calculation unit, used for calculating a vector from the centroid to each of the travel features in the cluster as a single travel vector;
[0151] an overall travel vector calculation unit, configured to add the individual travel vectors to obtain an overall travel vector;
[0152] A centroid moving unit, used for moving the centroid along the overall travel vector to obtain a new centroid;
[0153] The convergence judgment unit is used to judge whether the preset convergence condition is currently met. If so, the cluster convergence confirmation unit is called; if not, the feature adding unit is called.
[0154] The cluster convergence confirmation unit is used to determine whether the cluster is converged.
[0155] In one embodiment of the present invention, the cluster output submodule includes:
[0156] A first frequency confirmation unit is used to query, for a given travel feature, a first frequency of each travel feature being accessed by the cluster, and determine that each travel feature belongs to the cluster with the highest first frequency;
[0157] and / or,
[0158] The second frequency confirmation unit is used to count the second frequencies of occurrence of the given cluster during multiple clusterings, and determine that the cluster with the highest second frequency is valid.
[0159] In one embodiment of the present invention, the clustering module 603 further includes:
[0160] A column vector generating unit, used for classifying the travel characteristics of the passenger according to different travel dimensions to obtain a column vector corresponding to each travel dimension;
[0161] A first difference calculation unit, used for calculating the difference between the maximum value and the minimum value in each of the column vectors as a first difference;
[0162] A second difference calculation unit, used for calculating the difference between each of the trip characteristics and the maximum value in each of the column vectors as a second difference;
[0163] A normalization calculation unit is used to take the absolute value of the ratio of the second difference to the first difference to obtain the travel characteristics normalized under multiple travel dimensions.
[0164] The user classification device provided in the embodiment of the present invention can execute the user classification method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0165] Embodiment 4
[0166] Figure 7 A schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention is shown in FIG. Figure 7 As shown, the computer device includes a processor 700, a memory 701, a communication module 702, an input device 703 and an output device 704; the number of the processor 700 in the computer device can be one or more. Figure 7A processor 700 is taken as an example; the processor 700, the memory 701, the communication module 702, the input device 703 and the output device 704 in the computer device can be connected through a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0167] The memory 701 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and modules, such as the module corresponding to the user classification method in the embodiment of the present invention (for example, Figure 6 The processor 700 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 701, that is, implementing the above-mentioned user classification method.
[0168] The memory 701 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 701 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 701 may further include a memory remotely arranged relative to the processor 700, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0169] The communication module 702 is used to establish a connection with the display screen and implement data interaction with the display screen.
[0170] The input device 703 may be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the computer device.
[0171] The output device 704 may include a display device such as a display screen.
[0172] It should be noted that the specific composition of the input device 703 and the output device 704 can be set according to actual conditions.
[0173] The computer device provided in this embodiment can execute the user classification method provided in any embodiment of the present invention, and has corresponding functions and beneficial effects.
[0174] Embodiment 5
[0175] Embodiment 5 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the user classification method of any of the above embodiments is implemented.
[0176] The user classification method includes:
[0177] Obtain travel data recorded by multiple passengers as they enter and exit transportation stations;
[0178] Extracting features that characterize the travel patterns of the passengers under multiple travel dimensions from the travel data as travel features of the passengers;
[0179] Clustering the travel features along a direction of increasing density of the travel features to determine a plurality of clusters;
[0180] It is determined that the passengers with the travel characteristics in the same cluster are the same user group.
[0181] Of course, the computer-readable storage medium provided in the embodiment of the present invention and its computer program are not limited to the method operations described above, and can also execute related operations in the user classification method provided in any embodiment of the present invention.
[0182] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0183] It is worth noting that in the embodiment of the above-mentioned user classification device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0184] Note that the above are only preferred embodiments of the present invention and the technical principles used, and the implementation of the present invention is legal use. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A user classification method, characterized in that: include: Obtain travel data recorded by multiple passengers as they enter and exit transportation stations; Extracting features that characterize the travel patterns of the passengers under multiple travel dimensions from the travel data as travel features of the passengers; Clustering the travel features along a direction of increasing density of the travel features to determine a plurality of clusters; Determining that the passengers with the travel characteristics in the same cluster are the same user group; The clustering of the travel features along the direction of density growth of the travel features to determine a plurality of clusters includes: setting a centroid of a cluster in the unoccupied trip features of the passenger; Moving the centroid along a direction in which the density of the travel features increases, so as to add the travel features adjacent to the centroid into the cluster until the clusters converge; Determining whether all of the travel features are added to the cluster; If yes, then based on the preset clustering conditions, output a plurality of valid clusters; If not, marking the travel feature in the cluster as occupied, returning to execute the step of setting the centroid of the cluster in the unoccupied travel feature of the passenger; The step of setting the centroid of a cluster in the unoccupied travel feature of the passenger comprises: Mapping the unoccupied travel features of the passengers in the same spatial dimension, selecting any travel feature as the current initial seed point, determining the search radius of the initial seed point, and dividing the travel features in the space into neighborhoods belonging to the initial seed point; Within the neighborhood, a centroid within the neighborhood is calculated based on a distance between the travel feature and the initial seed point.
2. The method according to claim 1, characterized in that The obtaining of the travel data recorded when multiple passengers enter and exit the transportation station includes: Acquire at least one of card swiping data, ticket machine transaction data, application gate data, and QR code gate data recorded when multiple passengers enter and exit a transportation station as the original travel data of the passengers; The original travel data is fused based on the identity of the passenger to obtain travel data recorded when multiple passengers enter and exit the transportation station.
3. The method according to claim 2, characterized in that The original travel data is merged based on the identity of the passenger to obtain travel data recorded when multiple passengers enter and exit the transportation station, including: Normalizing the format of the original travel data; Eliminate employee card data and dirty data at the transportation station from the original travel data after format normalization to obtain candidate travel data; Querying an identity associated with the candidate travel data, the identity including at least one of an ID number, a passport number, a name, a mobile phone number, facial data, finger vein data, and palm vein data; The candidate travel data corresponding to all the identity identifiers belonging to the same passenger are merged to obtain travel data recorded when multiple passengers enter and exit the transportation station.
4. The method according to claim 1, characterized in that: Travel dimensions include number of trips, travel time, and travel distance; The extracting, from the travel data, features characterizing the travel patterns of the passengers in multiple travel dimensions as the travel features of the passengers includes: Filtering out travel data corresponding to the three travel dimensions of the number of trips, the travel time, and the travel distance from all the travel data as target travel data; Within a preset time period, the target travel data belonging to the same passenger is numerically counted based on the number of trips, the travel time, and the travel distance to obtain characteristics characterizing the passenger's travel patterns as the passenger's travel characteristics.
5. The method according to claim 4, characterized in that The target travel data belonging to the same passenger is numerically counted according to the number of trips, the travel time, and the travel distance to obtain features characterizing the travel pattern of the passenger as the travel features of the passenger, including: Querying the number of trips belonging to the same passenger from the target travel data, so as to calculate the mean value and filter the extreme value of the number of trips as the first feature characterizing the travel pattern of the passenger; Querying the travel time belonging to the same passenger from the target travel data, so as to calculate the mean value and filter the extreme value of the travel time as the second feature characterizing the travel regularity of the passenger; Querying the travel distances belonging to the same passenger from the target travel data, so as to calculate the mean value and filter the extreme value of the travel distances as the third feature characterizing the travel regularity of the passenger; The first feature, the second feature, and the third feature are used as travel features of the passenger.
6. The method according to claim 1, characterized in that The moving the centroid along the direction of density growth of the travel features to add the travel features adjacent to the centroid to the cluster until the cluster converges comprises: Adding the travel features within a set bandwidth from the centroid to the cluster; Calculate a vector from the centroid to each of the travel features in the cluster as a single travel vector; Adding the individual travel vectors to obtain an overall travel vector; Moving the centroid along the overall travel vector to obtain a new centroid; It is determined whether a preset convergence condition is currently met. If so, it is determined that the cluster converges. If not, it is returned to execute the step of adding the travel features within the set bandwidth from the centroid to the cluster.
7. The method according to claim 1, characterized in that The step of determining and outputting a plurality of valid clusters based on a preset clustering condition comprises: For a given travel feature, query the first frequency of each travel feature being accessed by the cluster, and determine that each travel feature belongs to the cluster with the highest first frequency; and / or, For a given cluster, the second frequency of occurrence of the cluster in multiple clusterings is counted, and the cluster with the highest second frequency is determined to be valid.
8. The method according to claim 1, characterized in that The clustering of the travel features along the direction of density growth of the travel features to determine a plurality of clusters further includes: Classify the travel characteristics of the passenger according to different travel dimensions to obtain a column vector corresponding to each travel dimension; Calculate the difference between the maximum value and the minimum value in each of the column vectors as the first difference; Calculate the difference between each of the trip characteristics in each of the column vectors and the maximum value as a second difference; The absolute value of the ratio of the second difference to the first difference is taken to obtain the normalized travel characteristics under the multiple travel dimensions.
9. A user classification device, characterized in that: include: A data acquisition module, used to acquire travel data recorded when multiple passengers enter and exit a transportation station; A feature extraction module, used to extract features characterizing the travel patterns of the passengers under multiple travel dimensions from the travel data as the travel features of the passengers; A clustering module, used for clustering the travel features along the direction of density growth of the travel features to determine a plurality of clusters; A user classification module, used for determining that the passengers with the travel characteristics in the same cluster are the same user group; The clustering module comprises: A centroid setting submodule, used for setting the centroid of a cluster in the unoccupied travel feature of the passenger; A cluster generation submodule, configured to move the centroid along a direction in which the density of the travel features increases, so as to add the travel features adjacent to the centroid into the cluster until the cluster converges; A judgment submodule, used to judge whether all the travel features are added to the cluster, if so, calling the cluster output submodule, if not, calling the return execution submodule; A cluster output submodule, used for outputting a plurality of valid clusters based on preset clustering conditions; A return execution submodule is used to mark the travel characteristics in the cluster as occupied, and return to execute the setting of the centroid of the cluster in the unoccupied travel characteristics of the passenger; The centroid setting submodule is specifically used to map the unoccupied travel features of the passengers in the same spatial dimension, select any travel feature as the current initial seed point, determine the search radius of the initial seed point, and divide the travel features in the space into a neighborhood belonging to the initial seed point; within the neighborhood, calculate the centroid within the neighborhood based on the distance between the travel feature and the initial seed point.
10. A computer device, characterized in that: The computer device comprises: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the user classification method as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the user classification method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Passenger going-out behavior analysis method based on subway card-swiping data
CN105718946A