A text classification method based on machine learning and hyper- particle
By constructing and segmenting hypersquares, the problems of overlap and instability in traditional particle-sphere calculations are solved, achieving efficient and accurate text classification, adapting to the processing needs of high-dimensional and large-scale text data, and improving the performance and efficiency of text analysis technology.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2025-05-13
- Publication Date
- 2026-06-09
Smart Images

Figure CN120492630B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a text classification method based on machine learning and hypergranularity. Background Technology
[0002] In the era of information explosion, text data is growing exponentially. Traditional data processing and analysis techniques have revealed inefficiencies and insufficient robustness when faced with massive amounts of text data. Text data, characterized by high dimensionality, sparsity, and semantic complexity, makes extracting effective information and achieving accurate classification from large amounts of text extremely challenging. Granular computing (GrC), as a method simulating human cognitive processes, offers a new approach to solving complex tasks. By processing data at multiple granular levels, it improves problem-solving efficiency and flexibility. The introduction of the concept of information granulation further facilitates data simplification and efficient analysis. Grain Sphere Computation (GBC), proposed by Xia et al., occupies an important position in the field of granular computing due to its efficiency, robustness, and adaptability. It replaces data points with spheres, reducing data scale, improving algorithm efficiency, and can adaptively generate spheres based on data characteristics, demonstrating significant effectiveness in data dimensionality reduction and multi-domain applications.
[0003] However, in text-based applications, the limitations of GBC (Geometric Grain Computation) become increasingly apparent. During text data processing, the geometric structure of the spheres can have serious consequences: overlap can lead to the misclassification of the same text data, compromising the accuracy of text classification; incomplete coverage may cause key textual information to be overlooked, affecting the integrity of text analysis. Furthermore, the instability of sphere generation can result in significant differences in classification results across different batches of processed text data, failing to guarantee the reliability and repeatability of the text classification model. These shortcomings make GBC unable to meet the demands of the text domain for stable processing and accurate classification of high-dimensional, large-scale text data. Therefore, an innovative granular computation method is urgently needed to adapt to the unique properties of text data, improve the performance and efficiency of text classification, and drive the development of text analysis technology. Summary of the Invention
[0004] To address the problems existing in the background technology, adapt to the unique properties of text data, improve the performance and efficiency of text classification, and promote the development of text analysis technology, one aspect of the present invention provides a text classification method based on machine learning and hypergranularity, comprising:
[0005] S1: Obtain the preprocessed text dataset and use a feature extraction model to extract the feature vectors of the text data;
[0006] S2: Construct the initial hypergranular square based on the feature vectors of all text data in the text dataset;
[0007] S3: Calculate the purity of the initial hyperparticle. If the purity of the initial hyperparticle is lower than the set threshold, divide the initial hyperparticle into multiple non-overlapping hyperparticles. Repeat the above operations of calculating purity and dividing for the newly generated hyperparticles until the purity of all hyperparticles meets the conditions.
[0008] S4: Determine the label of each supergranular square based on the majority principle according to the label of the text data in each supergranular square;
[0009] S5: Output the label of the supersquare to which the text data to be classified belongs as the classification result of the text data to be classified.
[0010] Another aspect of the present invention provides a text classification method based on machine learning and hypergranularity, the system comprising a memory and a processor; the memory is used to store an application program; the processor is used to run the application program and execute the text classification method based on machine learning and hypergranularity.
[0011] Another aspect of the present invention provides a computer storage medium storing a program that, when executed by a processor, implements the aforementioned text classification method based on machine learning and hypergranularity.
[0012] The present invention has at least the following beneficial effects
[0013] This invention replaces traditional granular spheres with hypersquares, utilizing the highly symmetrical geometric properties of n-dimensional hypercubes to avoid data overlap and effectively prevent the same text data from being misclassified, fundamentally ensuring the accuracy of text classification and solving the problem of text classification errors caused by overlap in GBC. Hypersquares can represent data more uniformly, achieving complete coverage of the text data space, ensuring that key text information is not missed, and compensating for the defect of incomplete coverage in GBC affecting the integrity of text analysis, enabling the text classification process to fully capture various types of text information. The hypersquare generation strategy adopted in this invention avoids the problem of randomly selecting center points, effectively eliminating the instability of granular sphere generation, ensuring consistency in the classification results of text data processed in different batches, significantly improving the reliability and repeatability of the text classification model, and overcoming the problem of unstable results in practical applications of GBC. Based on the hypersquare partitioning and generation algorithm, while maintaining comprehensive data coverage, time overhead is reduced. Compared with the traditional GBC method, it can more efficiently process high-dimensional, large-scale text data, meeting the needs of the text domain for efficient processing and powerfully promoting the development of text analysis technology. Attached Figure Description
[0014] Figure 1 This is a schematic diagram of the method flow of the present invention. Detailed Implementation
[0015] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0016] Please see Figure 1 One aspect of the present invention provides a text classification method based on machine learning and hyperparticles, comprising:
[0017] S1: Obtain the preprocessed text dataset and use a feature extraction model to extract the feature vectors of the text data;
[0018] Preferably, the feature extraction model includes: bag-of-words model, TF-IDF model, Word2Vec model, or BERT model.
[0019] In this embodiment, the bag-of-words model, TF-IDF model, Word2Vec model, and BERT model are all classic text feature extraction models, each with its own advantages, providing a diverse selection. The bag-of-words model converts text into vectors by statistically analyzing word frequency, offering a simple, intuitive, and rapid quantification of text. The TF-IDF model, building upon the bag-of-words model, further considers the importance of words within a document, highlighting key text features and helping to differentiate themes across texts. The Word2Vec model, based on neural networks, learns semantic vectors for words, capturing semantic similarities between words and enhancing the semantic representation of text features. The BERT model, as a pre-trained deep bidirectional Transformer model, dynamically understands the semantics of each word based on context, extracting more accurate and richer text semantic features. Through feature extraction models, text data can be transformed into structured feature vectors, effectively reducing the impact of high dimensionality and sparsity in text data, providing a high-quality data foundation for subsequent hypergranularity construction and classification tasks. This not only improves the efficiency of text data processing but also enhances the model's understanding and expression of text semantic information, thereby improving the accuracy and reliability of text classification.
[0020] S2: Construct the initial hypergranular square based on the feature vectors of all text data in the text dataset;
[0021] Preferably, constructing the initial hypergranular square includes: using the feature vectors of the text data processed by the feature extraction model as the coordinates of the text data in n-dimensional space, and calculating the center and side length of the initial hypergranular square based on the coordinates of all text data in n-dimensional space, thereby constructing the initial hypergranular square in n-dimensional space, wherein the center and side length of the initial hypergranular square include:
[0022]
[0023] d0=2·max{d(x ij C 0j )}
[0024] Where D represents the feature vector set corresponding to the text dataset, and m represents the number of text data in the text dataset D; x ij ∈x i C represents the feature value of the feature vector of the i-th text data in the j-th dimension; 0j Let represent the eigenvalue of the central eigenvector C0 of the initial hyperparticle square GH0 in the j-th dimension; d0 represents the side length of the initial hyperparticle square GH0; x i d(x) represents the feature vector of the i-th text data. ij C 0j ) represents x ij and C 0j The Euclidean distance function between them.
[0025] In step S2 of this embodiment, constructing the initial hypergranular square lays the foundation for subsequent text classification. First, the feature vectors of the text data processed by the feature extraction model are used as the coordinates of the text in n-dimensional space, where n depends on the dimension of the feature vectors. The center of the initial hypergranular square is calculated by averaging the feature values of all text data in each dimension. The feature values of the j-th dimension of all text data in the text dataset are summed and then divided by the number of text data, m, to obtain the feature value of the center of the initial hypergranular square in the j-th dimension. When calculating the side length, the maximum value of the Euclidean distance between the feature vectors of all text data and the center is found, and then multiplied by 2 to obtain the side length. Thus, based on the calculated center and side length, the position and size of the initial hypergranular square can be determined in n-dimensional space, completing the construction of the initial hypergranular square. Constructing the initial hypergranular square in this way allows text data to be represented in n-dimensional space in the form of a geometric structure. It provides a basic framework for subsequent partitioning and processing of text data, giving the originally abstract text data an intuitive spatial distribution representation. A reasonably determined center and side length can reflect the distribution characteristics of text data to a certain extent, which helps in subsequent operations such as calculating the purity of supersquares and performing supersquare segmentation, thereby improving the efficiency and accuracy of text classification and making the text classification process more systematic and logical.
[0026] S3: Calculate the purity of the initial hyperparticle. If the purity of the initial hyperparticle is lower than the set threshold, divide the initial hyperparticle into multiple non-overlapping hyperparticles. Repeat the above operations of calculating purity and dividing for the newly generated hyperparticles until the purity of all hyperparticles meets the conditions.
[0027] Preferably, the purity of the ultraparticles includes:
[0028]
[0029] Where P represents the purity of the superparticle-sized GH, and |GH| represents the number of samples within the superparticle-sized GH; n k This represents the number of samples belonging to class k in the superparticle square.
[0030] In this embodiment, calculating the purity of the hyperparticle size distribution is a key criterion for determining whether further fractionation is needed. In the purity formula, |GH| represents the total number of samples within the hyperparticle size distribution, and n... k This represents the number of samples belonging to the k-th class within the hypergranular square. The purity of the hypergranular square is calculated by dividing it by the ratio of the number of samples from the largest class within the hypergranular square to the total number of samples in the hypergranular square. If the initial purity of the hypergranular square is lower than a pre-set threshold, it indicates that the sample classes within the hypergranular square are too mixed, hindering accurate classification. In this case, it needs to be divided into multiple non-overlapping hypergranular squares. After segmentation, the purity of the newly generated hypergranular squares is recalculated. If the condition is still not met, segmentation continues until the purity of all hypergranular squares meets the set condition. Calculating the purity of the hypergranular square and segmenting based on the results makes the sample classes within the hypergranular square more singular and concentrated. This makes subsequent text classification more accurate when determining the text data category based on the hypergranular square's label. It avoids classification errors caused by mixed sample classes within the hypergranular square, improving the accuracy of text classification. Meanwhile, by continuously optimizing the supergranular square structure, the entire text classification system becomes more reasonable and efficient, enhancing the model's ability to process complex text data and helping to address the challenges posed by the high dimensionality, sparsity, and semantic complexity of text data.
[0031] Preferably, when repeating the purity and segmentation operations on the newly generated supersquare, if the newly generated supersquare does not contain any data points, it is called a meaningless supersquare and is deleted.
[0032] In this embodiment, during the process of continuously segmenting the supersquare to meet the purity condition, it is possible that newly generated supersquares may not contain any data points. Such supersquares lack actual data carrying capacity and cannot function in text classification tasks; therefore, they are defined as meaningless supersquares. Deleting them is to streamline the supersquare set and avoid invalid structures consuming computational resources and storage space.
[0033] Removing meaningless supersquares optimizes their overall structure, making subsequent computation and classification processes more efficient. It reduces unnecessary computation, avoids wasting time and resources on meaningless structures, and improves the efficiency of text classification algorithms. Simultaneously, it helps maintain the simplicity and effectiveness of the supersquare system, allowing text classification based on supersquares to focus more on data-supported aspects, further improving accuracy and reliability.
[0034] Preferably, dividing the ultraparticle into multiple non-overlapping ultraparticles includes:
[0035] S31: Using the center C of the superparticle square GH as the reference center, and the side length Construction of reference superparticle GH re ;
[0036] S32: Refer to ultra-fine GH re Taking each vertex as the center point, with the side length as... Construct a new superparticle square to obtain a superparticle square with each vertex as its center point and no overlap between them.
[0037] In this embodiment, the center C of the hyperparticle square is used as the reference center, and a reference hyperparticle square is constructed using half the side length d / 2 of the original hyperparticle square. This step is to determine an intermediate transition structure for the subsequent construction of a new hyperparticle square. By reducing the side length and using the original center as a reference, a relatively small hyperparticle square is obtained as a reference.
[0038] Using each vertex of the reference hypersquare as a new center point, a new hypersquare is constructed again with a side length of d / 2. Since it is constructed with vertices as the center and the side length is fixed, this ensures that the newly generated hypersquares do not overlap, thus dividing the original hypersquare into multiple sub-hypersquares that meet the requirements.
[0039] This segmentation method possesses clear geometric logic and regularity. Spatially, it ensures that newly generated supergranular squares are rationally distributed within the original supergranular square space without interfering with each other, effectively avoiding data overlap and laying the foundation for more accurate text data classification. This ordered segmentation allows each new supergranular square to more purely contain one or several similar classes of text data, helping to improve the purity of the supergranular squares and thus enhancing the accuracy and efficiency of text classification. Simultaneously, the regular segmentation method facilitates algorithm implementation and efficient utilization of computational resources, reducing algorithm complexity and operating costs.
[0040] S4: Determine the label of each supergranular square based on the majority principle according to the label of the text data in each supergranular square;
[0041] In this embodiment, each supergranular square contains several text data items, and these text data items are tagged (e.g., belonging to different text category tags). The "majority rule" refers to counting the number of text data items with different tags within the supergranular square, and determining the tag with the highest number of occurrences as the tag of that supergranular square. For example, if a supergranular square contains 10 text data items, of which 9 text data items are tagged with "technology" and 1 text data item is tagged with "entertainment", according to the majority rule, the tag of this supergranular square will be determined as "technology".
[0042] Determining supergranular square labels using the majority principle ensures that the labels are representative and reflect the dominant text category within each supergranular square. This provides a clear basis for subsequent text classification; when text data to be classified is determined to belong to a certain supergranular square, it can be directly assigned the label of that supergranular square, simplifying the classification process. Simultaneously, this method can, to some extent, offset the interference from a small number of outlier text data within the supergranular square, enhancing the stability and accuracy of the classification and making the classification results more consistent with the overall category tendency of the text data within the supergranular square.
[0043] S5: Output the label of the supersquare to which the text data to be classified belongs as the classification result of the text data to be classified.
[0044] In this embodiment, after the preceding steps, supersquares have been constructed and the labels for each supersquare have been determined. Now, for the text data to be classified, firstly, a feature extraction model is used to process the text data to be classified, extracting its feature vector. This feature vector serves as the coordinates of the text data to be classified in n-dimensional space, thereby determining the supersquare to which the text data to be classified belongs. If a sample point is located on the boundary between two supersquares, the distance from the sample point to the center of the supersquares on both sides of the boundary is calculated, and the sample point is assigned to the nearest supersquare. The label of this supersquare is then used as the classification result.
[0045] Another aspect of the present invention provides a text classification method based on machine learning and hypergranularity, the system comprising a memory and a processor; the memory is used to store an application program; the processor is used to run the application program and execute the text classification method based on machine learning and hypergranularity.
[0046] Another aspect of the present invention provides a computer storage medium storing a program that, when executed by a processor, implements the aforementioned text classification method based on machine learning and hypergranularity.
[0047] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0048] In summary, this invention replaces traditional granular spheres with hypergranular cubes, utilizing the highly symmetrical geometric properties of n-dimensional hypercubes to avoid data overlap and effectively prevent the same text data from being misclassified, fundamentally ensuring the accuracy of text classification and solving the problem of text classification errors caused by overlap in GBC. Hypergranular cubes can represent data more uniformly, achieving complete coverage of the text data space, ensuring that key text information is not missed, and compensating for the defect of incomplete coverage in GBC affecting the integrity of text analysis, enabling the text classification process to fully capture various types of text information. The hypergranular cube generation strategy adopted in this invention avoids the problem of randomly selecting center points, effectively eliminating the instability of granular sphere generation, ensuring consistency in the classification results of text data processed in different batches, significantly improving the reliability and repeatability of the text classification model, and overcoming the problem of unstable results in practical applications of GBC. Based on the hypergranular cube partitioning and generation algorithm, while maintaining comprehensive data coverage, time overhead is reduced. Compared with the traditional GBC method, it can more efficiently process high-dimensional, large-scale text data, meeting the needs of the text domain for efficient processing and powerfully promoting the development of text analysis technology.
[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A text classification method based on machine learning and hypergranularity, characterized in that, include: S1: Obtain the preprocessed text dataset and use a feature extraction model to extract the feature vectors of the text data; S2: Construct the initial hypergranular square based on the feature vectors of all text data in the text dataset; The construction of the initial hypergranular square includes: using the feature vectors of the text data processed by the feature extraction model as the coordinates of the text data in n-dimensional space, and calculating the center and side length of the initial hypergranular square based on the coordinates of all text data in n-dimensional space, thereby constructing the initial hypergranular square in n-dimensional space. The center and side length of the initial hypergranular square include: in, This represents the feature vector set corresponding to the text dataset. Represents a text dataset The amount of Chinese text data; Indicates the first The feature vector of the nth text data in the th... Feature values in each dimension; Indicates the initial superparticle formula central eigenvector In the Feature values in each dimension; Indicates the initial superparticle formula The side length; Indicates the first Feature vectors of text data; express and The Euclidean distance function between them; S3: Calculate the purity of the initial hyperparticle. If the purity of the initial hyperparticle is lower than the set threshold, divide the initial hyperparticle into multiple non-overlapping hyperparticles. Repeat the above operations of calculating purity and dividing for the newly generated hyperparticles until the purity of all hyperparticles meets the conditions. The purity of the ultra-particle formula includes: in, Indicates ultra-fine particles purity, Indicates ultra-fine particles Number of internal samples; This represents the number of samples belonging to class k in the superparticle square; Dividing a superparticle into multiple non-overlapping superparticles includes: S31: Ultra-particle formula Taking the center C as the reference center, with the side length Constructing a reference superparticle formula ; S32: Refer to the ultra-granule formula Taking each vertex as the center point, with the side length as... Construct a new superparticle square to obtain a superparticle square with each vertex as the center point and no overlap between them; S4: Determine the label of each supergranular square based on the majority principle according to the label of the text data in each supergranular square; S5: Output the label of the supersquare to which the text data to be classified belongs as the classification result of the text data to be classified.
2. The text classification method based on machine learning and hypergranularity as described in claim 1, characterized in that, The feature extraction models include: bag-of-words model, TF-IDF model, Word2Vec model, or BERT model.
3. The text classification method based on machine learning and hypergranularity as described in claim 1, characterized in that, When repeating the purity and partitioning operations on the newly generated supersquare, if the newly generated supersquare does not contain any data points, it is called a meaningless supersquare and is deleted.
4. The text classification method based on machine learning and hypergranularity as described in claim 1, characterized in that, The process of determining the labels for each supergranule based on the majority principle using the labels of the text data in each supergranule includes: in, represents the number of samples belonging to class k in the supergranular square; L represents the class label of the supergranular square.
5. A text classification system based on machine learning and hypersquared, characterized in that, The system includes a memory and a processor; the memory is used to store an application program; the processor is used to run the application program and execute a text classification method based on machine learning and hypergranularity as described in any one of claims 1 to 4.
6. A computer storage medium, characterized in that, The computer storage medium stores a program that, when executed by a processor, implements any one of the text classification methods based on machine learning and hypergranularity as described in claims 1 to 4.