A method and apparatus for generating a statistical chart feature description
By acquiring and calculating the key data similarity of statistical charts and performing clustering, detailed chart feature descriptions are generated, solving the problems of low efficiency and insufficient coverage in existing technologies and achieving more comprehensive chart feature descriptions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-16
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, statistical chart feature descriptions are inefficient and cover only a limited number of chart features. In particular, when machines generate chart descriptions, they rely only on maximum and minimum values, which cannot fully cover all chart features.
By acquiring key chart data of the target statistical chart, calculating the similarity of distribution data for multiple statistical categories, performing clustering processing, generating detailed distribution interval description information, and finally generating feature descriptions covering more chart features.
It improves the efficiency and coverage of chart descriptions, generating more comprehensive descriptions without the need for human intervention.
Smart Images

Figure CN116501860B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and in particular to a method and apparatus for generating feature descriptions of statistical charts. Background Technology
[0002] Statistical charts are visual aids used to help users understand data and the relationships between it. A typical statistical chart includes a short description of its features, known as a feature description.
[0003] In existing technologies, chart descriptions are typically written manually based on the characteristics of statistical charts. However, manually writing these descriptions is inefficient. Furthermore, in machine-generated chart descriptions, the descriptions are usually simply generated based on the maximum and / or minimum values in the chart. However, this approach covers only a limited range of chart features. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method and apparatus for generating statistical chart feature descriptions, which can enable the generated chart descriptions to cover more chart features and are more efficient.
[0005] In a first aspect, embodiments of this application provide a method for generating feature descriptions of statistical charts, the method comprising:
[0006] Obtain key chart data for the target statistical chart; the key chart data includes distribution data for multiple statistical categories;
[0007] Similarity calculation is performed on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories;
[0008] Clustering is performed on the distribution data for each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data for each statistical category;
[0009] Based on the similarity description information and the distribution interval description information of each statistical category, a feature description of the target statistical chart is generated.
[0010] Optionally, the distribution data of the plurality of statistical categories includes: first distribution data of the first statistical category and second distribution data of the second statistical category;
[0011] The step of calculating the similarity of the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories includes:
[0012] Cosine similarity analysis is performed on the first distribution data and the second distribution data to obtain the cosine similarity.
[0013] Determine whether the obtained cosine similarity is greater than the first similarity threshold;
[0014] If the similarity is greater than the first similarity threshold, then generate first similarity description information indicating that the similarity between the first statistical category and the second statistical category is the first similarity;
[0015] If the similarity is not greater than the first similarity threshold, then determine whether the obtained cosine similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold;
[0016] If the similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold, then generate second similarity description information indicating that the similarity between the first statistical category and the second statistical category is the second similarity.
[0017] If it is less than the second similarity threshold, then generate third similarity description information indicating that the similarity between the first statistical category and the second statistical category is third similarity;
[0018] Wherein, the first similarity is greater than the second similarity, and the second similarity is greater than the third similarity.
[0019] Optionally, the clustering process performed on the distribution data for each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data for each statistical category includes:
[0020] For each statistical category, the distribution data of that statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of that statistical category are clustered; wherein, the distribution data included in the first cluster are clustered with the maximum distribution data of the distribution data of that statistical category as the cluster center, and the distribution data included in the second cluster are clustered with the average distribution data of the distribution data of that statistical category as the cluster center;
[0021] Determine the first error of the first cluster and the second error of the second cluster;
[0022] Compare the magnitudes of the first error and the second error to obtain a comparison result;
[0023] Based on the comparison results, determine the value range corresponding to the main distribution interval of the distribution data of this statistical category;
[0024] Obtain the numerical axis data from the key chart data;
[0025] Based on the obtained value range and the numerical axis data, the distribution interval description information representing the main distribution interval of the distribution data of each statistical category is determined using the mapping relationship.
[0026] Optionally, the step of performing a first clustering process on the distribution data of each statistical category to obtain a first cluster and a second cluster into which the distribution data of that statistical category are clustered includes:
[0027] For each statistical category, the binary K-Means clustering method is used to perform the first clustering process on the distribution data of that statistical category, resulting in the first cluster and the second cluster into which the distribution data of that statistical category are clustered.
[0028] Optionally, the step of performing a first clustering process on the distribution data of each statistical category using the binary K-Means clustering method to obtain the first cluster and the second cluster into which the distribution data of the statistical category are clustered includes:
[0029] For each statistical category, the distribution data of that statistical category are grouped into a set;
[0030] Determine the maximum distribution data and the first mean distribution data of the distribution data of this statistical category;
[0031] The data with the maximum distribution and the data with the first average distribution are respectively used as the first cluster center and the second cluster center;
[0032] Determine the first distance from each data distribution in the set to the first cluster center and the second distance from each data distribution to the second cluster center;
[0033] For each data distribution, determine whether the first distance of the data distribution is less than the second distance;
[0034] If the first distance is less than the second distance, the distribution data is assigned to a predefined first predetermined cluster to obtain a first cluster.
[0035] If the first distance is not less than the second distance, the distributed data is assigned to a predefined second predetermined cluster to obtain a second cluster.
[0036] Optionally, determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the comparison results includes:
[0037] If the comparison result shows that the first error is less than the second error, then the first cluster is determined as the value range corresponding to the main distribution interval of the distribution data of the statistical category;
[0038] If the comparison result shows that the first error is not less than the second error, then the first cluster is subjected to a second clustering process, and the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined based on the result of the second clustering process.
[0039] Optionally, the step of performing a second clustering process on the first cluster, and determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the result of the second clustering process, includes:
[0040] The first cluster is subjected to a second clustering process using the binary K-Means clustering method. Based on the result of the second clustering process, the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined.
[0041] Optionally, the step of performing a second clustering process on the first cluster using the binary K-Means clustering method, and determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the result of the second clustering process, includes:
[0042] Determine the second average distribution data of the distribution data included in the first cluster;
[0043] The second average distribution data is used as the third cluster center;
[0044] Determine the third distance from each distribution data point in the first cluster to the third cluster center;
[0045] For each data distribution, determine whether the first distance of that data distribution is less than the third distance;
[0046] If the first distance is less than the third distance, the distributed data is assigned to a predefined third pre-defined cluster to obtain a third cluster.
[0047] If the first distance is not less than the third distance, the distributed data is assigned to a predefined fourth pre-defined cluster to obtain a fourth cluster.
[0048] The obtained third cluster is determined as the value range corresponding to the main distribution interval of the distribution data of this statistical category.
[0049] Secondly, embodiments of this application provide an apparatus for generating statistical chart feature descriptions, the apparatus comprising:
[0050] The acquisition module is used to acquire key chart data of the target statistical chart; the key chart data includes distribution data of multiple statistical categories;
[0051] The similarity calculation module is used to perform similarity calculation on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories;
[0052] The clustering module is used to perform clustering processing on the distribution data of each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category;
[0053] The generation module is used to generate a feature description of the target statistical chart based on the similarity description information and the distribution interval description information of each statistical category.
[0054] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the generation method described above for statistical chart features are performed.
[0055] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the generation method described above for statistical chart features.
[0056] This application provides a method and apparatus for generating feature descriptions of statistical charts. It combines complete distribution data in the target statistical chart to generate multiple corresponding chart descriptions. Compared with the prior art, which simply generates corresponding chart descriptions based on the maximum and / or minimum values in the chart, this method can cover more chart features in the generated chart descriptions. Moreover, this solution does not require manual intervention, thus improving efficiency.
[0057] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0058] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 A flowchart illustrating a method for generating statistical chart feature descriptions provided by an exemplary embodiment of this application is shown.
[0060] Figure 2 A schematic diagram of a target chart provided by an exemplary embodiment of this application is shown;
[0061] Figure 3 A flowchart illustrating a step for obtaining similarity description information representing the similarity between the plurality of statistical categories, provided by an exemplary embodiment of this application, is shown.
[0062] Figure 4 This document illustrates a flowchart of the steps for performing a first clustering process on any type of distribution data to obtain distribution interval description information of the arbitrary type of distribution data, as provided in an exemplary embodiment of this application.
[0063] Figure 5 This illustration shows a schematic diagram of the structure of a statistical chart feature description generation device provided in an exemplary embodiment of this application;
[0064] Figure 6 A schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this application is shown. Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0066] In existing technologies, chart descriptions are typically written manually based on the characteristics of the statistical charts. However, manually writing these descriptions is inefficient. Furthermore, in machine-generated chart descriptions, the descriptions are usually simply generated based on the maximum and / or minimum values in the chart. However, this approach covers only a limited range of chart features.
[0067] Based on this, embodiments of this application provide a method and apparatus for generating statistical chart feature descriptions, which enables the generated chart descriptions to cover more chart features and are more efficient.
[0068] Please see Figure 1 , Figure 1 A flowchart illustrating a method for generating statistical chart feature descriptions provided in an embodiment of this application is shown.
[0069] like Figure 1As shown, in step S101, key chart data of the target statistical chart is obtained; the key chart data includes distribution data of multiple statistical categories.
[0070] Here, the target statistical chart can be a bar chart or a line chart.
[0071] Specifically, each statistical chart corresponds to a set of chart data, which can be used to visually display that data. However, each statistical chart typically contains a large amount of chart data. In the process of generating the feature description of a statistical chart, not all of the chart data is used; only a portion of it, namely the key chart data, is used.
[0072] As an example, when the target statistical chart is a line chart, the key chart data may include: statistical categories, value axis data, distribution data for each statistical category, chart statistical period, chart title, etc.
[0073] Please see Figure 2 , Figure 2 A schematic diagram of a target graph provided by an exemplary embodiment of this application is shown. Wherein, Figure 2 The target chart shown is a line graph depicting the distribution of charging start times for two different vehicle models.
[0074] like Figure 2 As shown, in a specific example, when the target statistical chart is as follows Figure 2 The statistical charts shown include categories such as "commercial vehicles" and "private vehicles," with the numerical axis being a separate axis from the category axis. Figure 2 In the diagram, the numerical axis is the X-axis, and the numerical axis data are "0h, 1h, ..., 22h, 23h". Among them, the distribution data corresponding to the statistical category "operating vehicles" is "[6.0,2.8,1.9,1.4,1.3,1.9,2.4,2.3,2.6,2.7,3.1,4.5,5.9,4.9,4.5,5.0,4.4,3.9,4.6,5.9,6.1,6.2,7. The distribution data corresponding to the statistical category "private cars" is "[3.6,1.3,0.7,0.5,0.4,0.5,1.2,3.9,6.9,4.4,3.8,4.5,5.1,4.2,4.1,3.9,4.3,6.2,7.2,6.8,6.9,7.4,7.5,4.6]", and the statistical period for the chart can be "February 2023" (not in [the original text]). Figure 2 As shown in the figure, the chart is titled "Charging Start Time Distribution for Model A".
[0075] It should be noted here that the key chart data may also include data other than the key chart data shown above, depending on the actual situation, and this application does not limit this.
[0076] In step S102, similarity calculation is performed on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories.
[0077] As an example, the distribution data of the multiple statistical categories may include: first distribution data of the first statistical category and second distribution data of the second statistical category.
[0078] The following will describe in detail the steps of obtaining similarity description information representing the similarity between the multiple statistical categories, using the distribution data of multiple statistical categories, including the first distribution data of the first statistical category and the second distribution data of the second statistical category, as an example.
[0079] Please see Figure 3 , Figure 3 A flowchart illustrating an exemplary embodiment of this application is provided for a step of obtaining similarity description information representing the similarity between the plurality of statistical categories.
[0080] like Figure 3 As shown, the step of calculating the similarity of the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories may include steps S201 to S206:
[0081] In step S201, cosine similarity analysis is performed on the first distribution data and the second distribution data to obtain a cosine similarity. Then, in step S202, it is determined whether the obtained cosine similarity is greater than a first similarity threshold. Here, the first similarity threshold is predetermined based on practical experience, for example, it can be 0.95. If it is greater than the first similarity threshold, then in step S203, first similarity description information is generated, indicating that the similarity between the first statistical category and the second statistical category is the first similarity. For example, it can generate information such as... Figure 3 The first similarity description information shown is "extremely similar";
[0082] If the cosine similarity is not greater than the first similarity threshold, then in step S204, it is further determined whether the obtained cosine similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold. Here, the second similarity threshold is predetermined based on practical experience; for example, it can be 0.85. If it is greater than the second similarity threshold and less than or equal to the first similarity threshold, then in step S205, second similarity description information representing that the similarity between the first statistical category and the second statistical category is the second similarity is generated. For example, it can generate information such as... Figure 3The second similarity description information shown is "high similarity";
[0083] If the similarity is less than the second similarity threshold, then in step S206, third similarity description information is generated, indicating that the similarity between the first statistical category and the second statistical category is a third similarity. For example, it can generate information such as... Figure 3 The third similarity description information shown is "significantly different".
[0084] Wherein, the first similarity is greater than the second similarity, and the second similarity is greater than the third similarity.
[0085] As an example, in step S201, the first distribution data and the second distribution data can first be vector-transformed to obtain first distribution vector data and second distribution vector data, respectively. Then, based on the first distribution vector data and the second distribution vector data, the following formula is used...
[0086] Equation 1 yields the cosine similarity:
[0087]
[0088] Where _data1 represents the first vector distribution data and _data2 represents the second vector distribution data.
[0089] Here, although this application uses the distribution data of multiple statistical categories, including the first distribution data of the first statistical category and the distribution data of the second statistical category, as an example to describe how to obtain similarity description information representing the similarity between the multiple statistical categories, it is understood that the distribution data of multiple statistical categories described in this application may also include the distribution data of more statistical categories, such as the distribution data of the third statistical category and the distribution data of the fourth statistical category. This application does not limit this. The steps for obtaining similarity description information provided by the exemplary embodiments of this application can be used to perform similarity analysis on the distribution data of the third statistical category and the distribution data of the fourth statistical category, or on the distribution data of the first statistical category and the distribution data of the third statistical category, and so on. This application does not limit this.
[0090] Please refer to it again. Figure 1 In step S103, clustering is performed on the distribution data of each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category.
[0091] Below, we will combine Figure 4The steps for obtaining distribution interval description information representing the main distribution interval of the distribution data of any given statistical category are described in detail below, taking clustering of distribution data for any statistical category as an example. It can be understood that since the distribution data of each statistical category has the same characteristics, it can be processed according to... Figure 4 The steps shown perform clustering on the distribution data for each statistical category.
[0092] Please see Figure 4 , Figure 4 The flowchart illustrates a step provided by an exemplary embodiment of this application to perform a first clustering process on any type of distribution data to obtain distribution interval description information of the arbitrary type of distribution data.
[0093] like Figure 4 As shown, in step S301, for each statistical category, the distribution data of the statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of the statistical category are clustered; wherein, the distribution data included in the first cluster are clustered with the maximum distribution data of the distribution data of the statistical category as the cluster center, and the distribution data included in the second cluster are clustered with the average distribution data of the distribution data of the statistical category as the cluster center.
[0094] As an example, the binary K-Means clustering method can be used to cluster the distribution data of each statistical category.
[0095] Specifically, the binary K-Means clustering algorithm refers to the mathematical process of first randomly selecting two objects as initial cluster centers, then calculating the distance between each object and each initial cluster center, and assigning each object to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster.
[0096] As an example, the steps of using the binary K-Means clustering method to cluster the distribution data of this statistical category and obtain the first and second clusters into which the distribution data of this statistical category are clustered may include:
[0097] For each statistical category, the distribution data of that category are first grouped into a set. Then, the maximum distribution data and the first average distribution data of that statistical category are determined (for example, the average value of the distribution data of that statistical category can be determined as the first average distribution data). Then, the maximum distribution data and the first average distribution data are respectively used as the first cluster center and the second cluster center. Then, the first distance from each distribution data in the set to the first cluster center and the second distance from each distribution data to the second cluster center are determined. Then, for each distribution data, it is determined whether the first distance of the distribution data is less than the second distance. If the first distance is less than the second distance, the distribution data is assigned to a predefined first predetermined cluster to obtain a first cluster. If the first distance is not less than the second distance, the distribution data is assigned to a predefined second predetermined cluster to obtain a second cluster.
[0098] For example, the first distance length1i from each distribution data point in the set to the first cluster center can be determined using the following formula 2:
[0099] length1i=|Mi-cent1|; (i=1...n); Formula 2;
[0100] Where Mi represents the i-th distributed data, cent1 represents the first cluster center, and n represents the number of distributed data in the set;
[0101] The second distance length2i from each distribution data point in the set to the second cluster center is determined using the following formula 3:
[0102] length2i=|Mi-cent2|; (i=1...n); Formula 3;
[0103] Here, cent2 represents the second cluster center.
[0104] Below, we will use Figure 2 The following is a detailed description of the process of using the binary K-Means clustering method to cluster the distribution data of the statistical category "operating vehicles" in the target statistical chart shown, and obtaining the first and second clusters into which the distribution data of the statistical category are clustered.
[0105] Specifically, firstly, the distribution data corresponding to the statistical category "operating vehicles" [6.0, 2.8, 1.9, 1.4, 1.3, 1.9, 2.4, 2.3, 2.6, 2.7, 3.1, 4.5, 5.9, 4.9, 4.5, 5.0, 4.4, 3.9, 4.6, 5.9, 6.1, 6.2, 7.9, 7.7] are grouped into a set A. Then, the maximum distribution data Max = 7.9 is determined in the distribution data corresponding to "operating vehicles". The first average distribution data Ave = 4.1 is then determined based on the average value. 625. Then, the maximum distribution data Max and the first average distribution data Ave are respectively used as the first cluster center cent1 and the second cluster center cent2. Then, according to the subsequent steps, the first cluster cluster cluster1 = [6.1, 6.2, 7.9, 7.7] and the second cluster cluster cluster2 = [6.0, 2.8, 1.9, 1.4, 1.3, 1.9, 2.4, 2.3, 2.6, 2.7, 3.1, 4.5, 5.9, 4.9, 4.5, 5.0, 4.4, 3.9, 4.6, 5.9].
[0106] In step S302, the first error of the first cluster and the second error of the second cluster are determined;
[0107] For example, the first error SSE1 of the first cluster can be determined using the following formula 4:
[0108]
[0109] Where m represents the number of distribution data in the first cluster obtained;
[0110] The second error SSE2 of the second cluster can be determined using the following formula 5:
[0111]
[0112] In step S303, the magnitudes of the first error and the second error are compared to obtain a comparison result;
[0113] In step S304, based on the comparison results, the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined;
[0114] As an example, in this step, if the comparison result is that the first error is less than the second error, then the first cluster is determined as the value range corresponding to the main distribution interval of the distribution data of the statistical category.
[0115] As another example, if the comparison result is that the first error is not less than the second error, then the first cluster is subjected to a second clustering process, and the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined based on the result of the second clustering process.
[0116] Here, the binary K-Means clustering method can be used to perform a second clustering process on the first cluster, and the value range corresponding to the main distribution interval of the distribution data of the statistical category can be determined based on the result of the second clustering process.
[0117] As an example, regarding the second clustering process performed on the first cluster using the binary K-Means clustering method, the step of determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the result of the second clustering process may include:
[0118] First, determine the second average distribution data of the distribution data included in the first cluster (for example, the average value of the distribution data included in the first cluster can be determined as the second average distribution data). Then, use the second average distribution data as the third cluster center. Next, determine the third distance from each distribution data in the first cluster to the third cluster center. Then, for each distribution data, determine whether the first distance of the distribution data is less than the third distance. If the first distance is less than the third distance, the distribution data is assigned to a predefined third predetermined cluster to obtain the third cluster. If the first distance is not less than the third distance, the distribution data is assigned to a predefined fourth predetermined cluster to obtain the fourth cluster. Finally, determine the obtained third cluster as the value range corresponding to the main distribution interval of the distribution data of the statistical category.
[0119] Following the example above, the value range corresponding to the main distribution interval of the statistical category's distribution data is clusterResult = cluster1 = [6.1, 6.2, 7.9, 7.7].
[0120] In step S305, obtain the numerical axis data from the key chart data;
[0121] Following the example above, the obtained numerical axis data is "0h, 1h, ..., 22h, 23h".
[0122] In step S306, based on the obtained value range and the numerical axis data, the distribution interval description information representing the main distribution interval of the distribution data of each statistical category is determined using the mapping relationship.
[0123] As an example, in this step, the main distribution interval of the statistical category's distribution data can be determined first based on the obtained value range using the mapping relationship in the numerical axis data. Then, the main distribution interval is optimized to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category.
[0124] Here, a target mapping relationship can be established in advance between the distribution data, numerical axis data and location number of each statistical category. That is, for a statistical category, a location number corresponds to a numerical axis data and a distribution data corresponding to that statistical category.
[0125] In this context, as an example, the step of determining the main distribution interval of the statistical category's distribution data in the numerical axis data based on the obtained value range and using a pre-established target mapping relationship may include:
[0126] First, based on the obtained value range, the position number corresponding to each value in the obtained value range is determined using the pre-established target mapping relationship. Then, the numerical axis data corresponding to each obtained position number is determined using the pre-established target mapping relationship. Finally, the set of numerical axis data corresponding to each obtained position number is determined as the main distribution interval of the distribution data of this statistical category.
[0127] Following the example above, based on the value range clusterResult = cluster1 = [6.1, 6.2, 7.9, 7.7] corresponding to the obtained main distribution area, the main distribution area mainDistributionAreas = [20, 21, 22, 23] can be obtained.
[0128] As an example, the step of optimizing the information of the main distribution interval to obtain distribution interval description information representing the main distribution interval where the distribution data of each statistical category is located may include:
[0129] A continuity analysis is performed on any two adjacent numerical axis data points within the main distribution interval to obtain the continuity relationship between them. For each obtained continuity relationship, it is determined whether it is a discontinuous continuity relationship. If it is, a delimiter is used to separate the two adjacent numerical axis data points. If it is a continuous continuity relationship, it is determined whether the continuity relationship between the next adjacent numerical axis data point is also a discontinuous continuity relationship. If it is, a delimiter is used to separate the next adjacent numerical axis data point. If a continuous relationship is found, it is determined whether the continuous relationship between the next adjacent numerical axis data is a non-continuous continuous relationship. This process continues until any two adjacent numerical axis data corresponding to a non-continuous continuous relationship are found, or the last pair of adjacent numerical axis data is found. Taking the first of the obtained two adjacent numerical axis data as the starting point, and the first of the two adjacent numerical axis data corresponding to a non-continuous continuous relationship as the ending point, or the last pair of adjacent numerical axis data as the ending point, the starting point and the ending point are connected using a connection symbol to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category.
[0130] Here, the continuity relationship includes any one of the following: "continuous" and "discontinuous", where "continuous" means that two adjacent numerical axis data are mathematically adjacent, such as 1 and 2, and "discontinuous" means that two adjacent numerical axis data are not mathematically adjacent, such as 1 and 3.
[0131] Here, the separators include any one of the following: commas and pauses. It should be noted that the separators are not limited to those listed above; other separators may be used depending on actual needs, and this invention does not impose any limitations on them.
[0132] The connecting symbols include any one of the following: wavy lines and tildes. It should be noted that the connecting symbols are not limited to those listed above; other symbols may be used depending on actual needs, and this invention does not impose any limitations on them.
[0133] In one example, assuming the obtained main distribution interval is "20 21 22 23" (the main distribution interval corresponding to the distribution data of the statistical category "operating vehicles"), then a continuity characteristic analysis is performed on any two adjacent numerical axis data in the main distribution interval to obtain the continuity relationship between any two adjacent numerical axis data in the main distribution interval as "continuous", "continuous", and "continuous". Then, the continuity relationship between the first pair of adjacent numerical axis data "20 21" is analyzed to determine that the continuity relationship is a continuous relationship. Then, the continuity relationship between the next adjacent numerical axis data "21 22" of "2021" is determined to be a continuous relationship, and so on, until the last pair of adjacent numerical axis data 22 23 is found. Then, starting from "20" and ending at "23", the connection symbol "-" is used to connect "20" and "23" to obtain the distribution interval description information "20-23".
[0134] In one example, assuming the obtained main distribution interval is "8 17 18 19 20 21 22" (the main distribution interval corresponding to the distribution data of the statistical category "private cars"), then a continuity analysis is performed on any two adjacent numerical axis data in the main distribution interval. The continuity relationships between any two adjacent numerical axis data in the main distribution interval are obtained as "non-continuous", "continuous", "continuous", "continuous", "continuous", and "continuous". Then, the continuity relationship between the first pair of adjacent numerical axis data "8 17" is analyzed, and it is determined that the continuity relationship is a non-continuous continuity relationship. Therefore, "8 17" is separated by the delimiter ",". Then, the continuity relationship between the second pair of adjacent numerical axis data "17 18" is analyzed, and it is determined that the continuity relationship is a continuous continuity relationship. Therefore, the continuity relationship between the next adjacent numerical axis data "18 19" of "17 18" is analyzed, and it is determined that "18 19" is a non-continuous continuity relationship. The continuous relationship between "19" is a continuous relationship, and so on, until the last pair of adjacent numerical axis data "21 22" is found. Then, starting from "17" and ending at "22", the "17" and "22" are connected by the connection symbol "-" to obtain the distribution interval description information "8, 17-22".
[0135] Please refer to it again. Figure 1 In step S104, based on the similarity description information and the distribution interval description information of each statistical category, a feature description of the target statistical chart is generated.
[0136] As an example, in this step, the feature description of the target statistical chart can be generated based on the similarity description information, the distribution interval description information of each statistical category, and the predefined concatenation statement.
[0137] Here, the concatenated statements can be predefined based on the actual situation. By concatenating statements, the generated feature descriptions can be made more consistent with the logic of everyday language.
[0138] For example, the concatenation statement can be time+title+'Statistical data:'+'\n'+'It can be seen that +legend[0]+' and '+legend[1]+'Charging start time distribution'+similarityDescribe+'. '+legend[0]+title.split(”)[1]+'Mainly concentrated in '+mainDistributionDescribe1+'; '+legend[0]+title.split(”)[1]+'Mainly concentrated in '+mainDistributionDescribe2+'. '.
[0139] Furthermore, in this step, the feature description of the target statistical chart can be generated based on the similarity description information, the distribution interval description information of each statistical category, the predetermined key chart data in the key chart data, and the predefined splicing statement.
[0140] Here, the predetermined key chart data refers to the chart data that the user expects to display in the corresponding position under the target statistical chart. The predetermined key chart data may include statistical category, chart statistical period, chart title, etc.
[0141] Following the example above, in this step, the characteristic description of the generated target statistical chart is: "Statistical data on the distribution of charging start times for vehicle model a in February 2023:"
[0142] It can be seen that the charging start times of commercial vehicles and private cars are quite similar. The charging start time of commercial vehicles is mainly concentrated between 20:00 and 23:00; the charging start time of private cars is mainly concentrated between 8:00 and 17:00-22:00.
[0143] This application provides a method for generating feature descriptions of statistical charts. It combines complete distribution data in the target statistical chart to generate multiple corresponding chart descriptions. Compared with the prior art, which simply generates corresponding chart descriptions based on the maximum and / or minimum values in the chart, this method can cover more chart features in the generated chart descriptions. Moreover, this solution does not require manual intervention, thus improving efficiency.
[0144] Please see Figure 5 , Figure 5 A schematic diagram of the structure of a statistical chart feature description generation device provided by an exemplary embodiment of this application is shown.
[0145] like Figure 5 As shown, the generating apparatus 500 includes:
[0146] The acquisition module 501 is used to acquire key chart data of the target statistical chart; the key chart data includes distribution data of multiple statistical categories;
[0147] The similarity calculation module 502 is used to perform similarity calculation on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories;
[0148] Clustering module 503 is used to perform clustering processing on the distribution data of each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category.
[0149] The generation module 504 is used to generate a feature description of the target statistical chart based on the similarity description information and the distribution interval description information of each statistical category.
[0150] Optionally, the distribution data of the plurality of statistical categories includes: first distribution data of the first statistical category and second distribution data of the second statistical category;
[0151] The similarity calculation module 502 is specifically used for:
[0152] Cosine similarity analysis is performed on the first distribution data and the second distribution data to obtain the cosine similarity.
[0153] Determine whether the obtained cosine similarity is greater than the first similarity threshold;
[0154] If the similarity is greater than the first similarity threshold, then generate first similarity description information indicating that the similarity between the first statistical category and the second statistical category is the first similarity;
[0155] If the similarity is not greater than the first similarity threshold, then determine whether the obtained cosine similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold;
[0156] If the similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold, then generate second similarity description information indicating that the similarity between the first statistical category and the second statistical category is the second similarity.
[0157] If it is less than the second similarity threshold, then generate third similarity description information indicating that the similarity between the first statistical category and the second statistical category is third similarity;
[0158] Wherein, the first similarity is greater than the second similarity, and the second similarity is greater than the third similarity.
[0159] Optionally, the clustering module 503 is specifically used for:
[0160] For each statistical category, the distribution data of that statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of that statistical category are clustered; wherein, the distribution data included in the first cluster are clustered with the maximum distribution data of the distribution data of that statistical category as the cluster center, and the distribution data included in the second cluster are clustered with the average distribution data of the distribution data of that statistical category as the cluster center;
[0161] Determine the first error of the first cluster and the second error of the second cluster;
[0162] Compare the magnitudes of the first error and the second error to obtain a comparison result;
[0163] Based on the comparison results, determine the value range corresponding to the main distribution interval of the distribution data of this statistical category;
[0164] Obtain the numerical axis data from the key chart data;
[0165] Based on the obtained value range and the numerical axis data, the distribution interval description information representing the main distribution interval of the distribution data of each statistical category is determined using the mapping relationship.
[0166] Optionally, the clustering module 503 is specifically used for:
[0167] For each statistical category, the binary K-Means clustering method is used to perform the first clustering process on the distribution data of that statistical category, resulting in the first cluster and the second cluster into which the distribution data of that statistical category are clustered.
[0168] Optionally, the clustering module 503 is specifically used for:
[0169] For each statistical category, the distribution data of that statistical category are grouped into a set;
[0170] Determine the maximum distribution data and the first mean distribution data of the distribution data of this statistical category;
[0171] The data with the maximum distribution and the data with the first average distribution are respectively used as the first cluster center and the second cluster center;
[0172] Determine the first distance from each data distribution in the set to the first cluster center and the second distance from each data distribution to the second cluster center;
[0173] For each data distribution, determine whether the first distance of the data distribution is less than the second distance;
[0174] If the first distance is less than the second distance, the distribution data is assigned to a predefined first predetermined cluster to obtain a first cluster.
[0175] If the first distance is not less than the second distance, the distributed data is assigned to a predefined second predetermined cluster to obtain a second cluster.
[0176] Optionally, the clustering module 503 is specifically used for:
[0177] If the comparison result shows that the first error is less than the second error, then the first cluster is determined as the value range corresponding to the main distribution interval of the distribution data of the statistical category;
[0178] If the comparison result shows that the first error is not less than the second error, then the first cluster is subjected to a second clustering process, and the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined based on the result of the second clustering process.
[0179] Optionally, the clustering module 503 is specifically used for:
[0180] The first cluster is subjected to a second clustering process using the binary K-Means clustering method. Based on the result of the second clustering process, the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined.
[0181] Optionally, the clustering module 503 is specifically used for:
[0182] Determine the second average distribution data of the distribution data included in the first cluster;
[0183] The second average distribution data is used as the third cluster center;
[0184] Determine the third distance from each distribution data point in the first cluster to the third cluster center;
[0185] For each data distribution, determine whether the first distance of that data distribution is less than the third distance;
[0186] If the first distance is less than the third distance, the distributed data is assigned to a predefined third pre-defined cluster to obtain a third cluster.
[0187] If the first distance is not less than the third distance, the distributed data is assigned to a predefined fourth pre-defined cluster to obtain a fourth cluster.
[0188] The obtained third cluster is determined as the value range corresponding to the main distribution interval of the distribution data of this statistical category.
[0189] This application provides a statistical chart feature description generation device that combines complete distribution data in the target statistical chart to generate multiple corresponding chart descriptions. Compared with the prior art that simply generates corresponding chart descriptions based on the maximum and / or minimum values in the chart, this device can generate chart descriptions that cover more chart features, and it does not require manual intervention, thus improving efficiency.
[0190] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 includes a processor 610, a memory 620, and a bus 630.
[0191] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 and the memory 620 communicate via the bus 630. When the machine-readable instructions are executed by the processor 610, the steps of a method for generating a statistical chart feature description as described in the above method embodiment can be executed. For specific implementation details, please refer to the method embodiment, which will not be repeated here.
[0192] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run by a processor, it can execute the steps of a method for generating a statistical chart feature description as described in the above method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0193] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0194] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0195] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0196] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0197] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0198] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating feature descriptions of statistical charts, characterized in that, The generation method includes: Obtain key chart data for the target statistical chart; the key chart data includes distribution data for multiple statistical categories; Similarity calculation is performed on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories; Clustering is performed on the distribution data for each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data for each statistical category; Based on the similarity description information and the distribution interval description information of each statistical category, a feature description of the target statistical chart is generated; The clustering process performed on the distribution data for each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data for each statistical category includes: For each statistical category, the distribution data of that statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of that statistical category are clustered; wherein, the distribution data included in the first cluster are clustered with the maximum distribution data of the distribution data of that statistical category as the cluster center, and the distribution data included in the second cluster are clustered with the average distribution data of the distribution data of that statistical category as the cluster center; Determine the first error of the first cluster and the second error of the second cluster; Compare the magnitudes of the first error and the second error to obtain a comparison result; Based on the comparison results, determine the value range corresponding to the main distribution interval of the distribution data of this statistical category; Obtain the numerical axis data from the key chart data; Based on the obtained value range and the numerical axis data, the distribution interval description information representing the main distribution interval of the distribution data of each statistical category is determined using the mapping relationship.
2. The generation method according to claim 1, characterized in that, The distribution data of the multiple statistical categories include: the first distribution data of the first statistical category and the second distribution data of the second statistical category; The step of calculating the similarity of the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories includes: Cosine similarity analysis is performed on the first distribution data and the second distribution data to obtain the cosine similarity. Determine whether the obtained cosine similarity is greater than the first similarity threshold; If the similarity is greater than the first similarity threshold, then generate first similarity description information indicating that the similarity between the first statistical category and the second statistical category is the first similarity; If the similarity is not greater than the first similarity threshold, then determine whether the obtained cosine similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold; If the similarity is greater than the second similarity threshold and less than or equal to the first similarity threshold, then generate second similarity description information indicating that the similarity between the first statistical category and the second statistical category is the second similarity. If it is less than the second similarity threshold, then generate third similarity description information indicating that the similarity between the first statistical category and the second statistical category is third similarity; Wherein, the first similarity is greater than the second similarity, and the second similarity is greater than the third similarity.
3. The generation method according to claim 1, characterized in that, For each statistical category, the distribution data of that statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of that statistical category is clustered, including: For each statistical category, the binary K-Means clustering method is used to perform the first clustering process on the distribution data of that statistical category, resulting in the first cluster and the second cluster into which the distribution data of that statistical category are clustered.
4. The generation method according to claim 3, characterized in that, The step of performing a first clustering process on the distribution data of each statistical category using the binary K-Means clustering method to obtain the first cluster and the second cluster into which the distribution data of the statistical category are clustered includes: For each statistical category, the distribution data of that statistical category are grouped into a set; Determine the maximum distribution data and the first mean distribution data of the distribution data of this statistical category; The data with the maximum distribution and the data with the first average distribution are respectively used as the first cluster center and the second cluster center; Determine the first distance from each data distribution in the set to the first cluster center and the second distance from each data distribution to the second cluster center; For each data distribution, determine whether the first distance of the data distribution is less than the second distance; If the first distance is less than the second distance, the distribution data is assigned to a predefined first predetermined cluster to obtain a first cluster. If the first distance is not less than the second distance, the distributed data is assigned to a predefined second predetermined cluster to obtain a second cluster.
5. The generation method according to claim 4, characterized in that, The step of determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the comparison results includes: If the comparison result shows that the first error is less than the second error, then the first cluster is determined as the value range corresponding to the main distribution interval of the distribution data of the statistical category; If the comparison result shows that the first error is not less than the second error, then the first cluster is subjected to a second clustering process, and the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined based on the result of the second clustering process.
6. The generation method according to claim 5, characterized in that, The second clustering process applied to the first cluster, and the determination of the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the result of the second clustering process, includes: The first cluster is subjected to a second clustering process using the binary K-Means clustering method. Based on the result of the second clustering process, the value range corresponding to the main distribution interval of the distribution data of the statistical category is determined.
7. The generation method according to claim 6, characterized in that, The steps of performing a second clustering process on the first cluster using the binary K-Means clustering method, and determining the value range corresponding to the main distribution interval of the distribution data of the statistical category based on the result of the second clustering process, include: Determine the second average distribution data of the distribution data included in the first cluster; The second average distribution data is used as the third cluster center; Determine the third distance from each distribution data point in the first cluster to the third cluster center; For each data distribution, determine whether the first distance of that data distribution is less than the third distance; If the first distance is less than the third distance, the distributed data is assigned to a predefined third pre-defined cluster to obtain a third cluster. If the first distance is not less than the third distance, the distributed data is assigned to a predefined fourth pre-defined cluster to obtain a fourth cluster. The obtained third cluster is determined as the value range corresponding to the main distribution interval of the distribution data of this statistical category.
8. A device for generating statistical chart feature descriptions, characterized in that, The generating apparatus includes: The acquisition module is used to acquire key chart data of the target statistical chart; the key chart data includes distribution data of multiple statistical categories; The similarity calculation module is used to perform similarity calculation on the distribution data of the multiple statistical categories to obtain similarity description information representing the similarity between the multiple statistical categories; The clustering module is used to perform clustering processing on the distribution data of each statistical category to obtain distribution interval description information representing the main distribution interval of the distribution data of each statistical category; The generation module is used to generate a feature description of the target statistical chart based on the similarity description information and the distribution interval description information of each statistical category; The clustering module is specifically used for: For each statistical category, the distribution data of that statistical category is subjected to a first clustering process to obtain a first cluster and a second cluster into which the distribution data of that statistical category are clustered; wherein, the distribution data included in the first cluster are clustered with the maximum distribution data of the distribution data of that statistical category as the cluster center, and the distribution data included in the second cluster are clustered with the average distribution data of the distribution data of that statistical category as the cluster center; Determine the first error of the first cluster and the second error of the second cluster; Compare the magnitudes of the first error and the second error to obtain a comparison result; Based on the comparison results, determine the value range corresponding to the main distribution interval of the distribution data of this statistical category; Obtain the numerical axis data from the key chart data; Based on the obtained value range and the numerical axis data, the distribution interval description information representing the main distribution interval of the distribution data of each statistical category is determined using the mapping relationship.
9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. The machine-readable instructions are executed by the processor to perform the steps of the method for generating statistical chart feature descriptions as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method for generating a statistical chart feature description as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Natural language analysis processing method and system
CN115641600A
Automated data extraction from scatter plot images
US20170351708A1