Training method of feature extraction model and feature extraction method
By acquiring and combining word segmentation features and classification features to train a large language model, the problems of single and subjective feature extraction in text classification are solved, achieving more comprehensive feature extraction and improved text classification efficiency.
Patent Information
- Application Number
- CN202410781102.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-06-17
AI Technical Summary
Existing technologies in text classification suffer from problems of limited and subjective feature extraction, making it difficult to effectively utilize large-scale text data for deep learning.
By acquiring initial training samples, determining word segmentation features and classification features, supervising training is performed using a large language model to generate a feature extraction model, and combining word segmentation features and classification features to improve the depth and breadth of feature mining.
It improves the comprehensiveness and accuracy of feature extraction, enhances the efficiency and effectiveness of text classification, and is suitable for large-scale text data processing.
Smart Images

Figure CN118690169B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, specifically to the fields of natural language processing, deep learning, smart finance, and large models, and particularly to a training method for a feature extraction model and a feature extraction method. Background Technology
[0002] In recent years, with the rapid iteration of internet and computer technologies, massive amounts of text-based data have been generated online. Text classification, which involves automatically assigning text to predefined categories based on its specific content, is a fundamental and crucial task in the field of natural language processing (NLP). NLP is a subfield of artificial intelligence that aims to enable computers to understand human language. Using NLP and deep learning methods for text classification can avoid the problems of singularity and subjectivity encountered when extracting features through feature engineering. Summary of the Invention
[0003] This disclosure provides a method for training a feature extraction model and a feature extraction method.
[0004] According to a first aspect of this disclosure, a method for training a feature extraction model is provided, comprising: acquiring initial training samples; determining target features of the initial training samples, wherein the target features include word segmentation features and classification features, the word segmentation features being used to characterize the feature information of the words corresponding to the initial training samples, and the classification features being used to characterize the feature information of the initial training samples corresponding to a preset classification category; and training an initial model using the target features of the initial training samples to obtain a trained feature extraction model.
[0005] According to a second aspect of this disclosure, a feature extraction method is provided, comprising: acquiring a text to be extracted; inputting the text to be extracted into a feature extraction model, and outputting target features of the text to be extracted, wherein the feature extraction model is trained according to the method described in any implementation of the first aspect.
[0006] According to a third aspect of this disclosure, a training apparatus for a feature extraction model is provided, comprising: a sample acquisition module configured to acquire initial training samples; a feature determination module configured to determine target features of the initial training samples, wherein the target features include word segmentation features and classification features, the word segmentation features being used to characterize the feature information of the words corresponding to the initial training samples, and the classification features being used to characterize the feature information of the initial training samples corresponding to a preset classification category; and a model training module configured to train an initial model using the target features of the initial training samples to obtain a trained feature extraction model.
[0007] According to a fourth aspect of this disclosure, a feature extraction apparatus is provided, comprising: a text acquisition module configured to acquire text to be extracted; and a feature extraction module configured to input the text to be extracted into a feature extraction model and output target features of the text to be extracted, wherein the feature extraction model is trained according to a method described in any implementation of the first aspect.
[0008] According to a fifth aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method as described in any implementation of the first or second aspect.
[0009] According to a sixth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing a computer to perform a method as described in any implementation of the first or second aspect.
[0010] According to a seventh aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method as described in any of the implementations of the first or second aspect.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0013] Figure 1 This is an exemplary system architecture diagram to which this disclosure can be applied;
[0014] Figure 2 This is a flowchart of an embodiment of the training method for the feature extraction model according to the present disclosure;
[0015] Figure 3 This is a flowchart of another embodiment of the training method for the feature extraction model according to the present disclosure;
[0016] Figure 4 This is a flowchart of yet another embodiment of the training method for the feature extraction model according to the present disclosure;
[0017] Figure 5-1 This is an application flowchart of the training method for the feature extraction model based on this disclosure;
[0018] Figure 5-2 This is another application flowchart of the training method for the feature extraction model based on this disclosure;
[0019] Figure 6 This is a flowchart of an embodiment of the feature extraction method according to the present disclosure;
[0020] Figure 7 This is a schematic diagram of the structure of a training apparatus for a feature extraction model according to the present disclosure;
[0021] Figure 8 This is a schematic diagram of a structure of an embodiment of the feature extraction apparatus according to the present disclosure;
[0022] Figure 9 This is a block diagram of an electronic device used to implement the training method or feature extraction method of the feature extraction model in the embodiments of this disclosure. Detailed Implementation
[0023] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0025] Figure 1 An exemplary system architecture 100 is shown, which can be used to train the feature extraction model of the present disclosure, the feature extraction method or the training device for the feature extraction model, and the feature extraction device.
[0026] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0027] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send information, etc. Various client applications can be installed on terminal devices 101, 102, and 103.
[0028] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are made here.
[0029] Server 105 can provide various services. For example, server 105 can analyze and process the initial training samples obtained from terminal devices 101, 102, and 103, and generate processing results (such as a trained feature extraction model).
[0030] It should be noted that server 105 can be either hardware or software. When server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 105 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0031] It should be noted that the training method and feature extraction method of the feature extraction model provided in this embodiment are generally executed by the server 105, and correspondingly, the training device and feature extraction device of the feature extraction model are generally set in the server 105.
[0032] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0033] Continue to refer to Figure 2 The diagram illustrates a flow 200 of an embodiment of a training method for a feature extraction model according to the present disclosure. The training method for the feature extraction model includes the following steps:
[0034] Step 201: Obtain the initial training samples.
[0035] In this embodiment, the execution entity of the training method for the feature extraction model (e.g.) Figure 1The server 105 shown will obtain initial training samples. These initial training samples may include a large amount of training data. When this feature extraction model is applied to a financial risk control scenario, the initial training samples may contain a large amount of advertising text data. This advertising text data may include emoticons, URLs (uniform resource locator), and meaningless characters such as garbled text—noise information irrelevant to the classification task. Therefore, it will first undergo noise removal processing, such as noise removal, text processing, and stop word removal, to obtain the initial training samples. Specifically, for URLs and meaningless character sets, regular expressions will be used to preprocess the text and filter out this noise information. For noise information such as emoticons, it can be processed through encoding matching. This can be done by directly filtering by matching the text encoding to Unicode, or by filtering by matching a list of allowed characters.
[0036] Step 202: Determine the target features of the initial training samples.
[0037] In this embodiment, the execution entity determines the target features of the initial training sample. These target features include word segmentation features and classification features. Word segmentation features characterize the feature information of the words corresponding to the initial training sample, while classification features characterize the feature information of the initial training sample corresponding to a preset classification category. Specifically, the execution entity first performs word segmentation on the initial training sample to determine the corresponding word segmentation features, which represent the global features of the training sample.
[0038] Then, the aforementioned execution entity calculates the lift value for each word segmentation feature, extracts the word segmentation features with high lift values, and defines risk classification categories based on these features, such as Level 1, Level 2, ... Level 10, etc. It should be noted that the lift value is an evaluation metric used to measure the effectiveness of an association rule. Next, keyword recall is used to obtain samples to be labeled from the initial training samples, and these samples are labeled according to the defined risk classification categories, resulting in corresponding labeled samples. These labeled samples are then used to perform supervised training on the initial classification model, resulting in a trained classification model. This model is then used to extract classification features from the initial training samples; these features represent the local features of the training samples. Finally, these classification features are combined with the word segmentation features to obtain the target features of the initial training samples.
[0039] Step 203: Train the initial model using the target features of the initial training samples to obtain the trained feature extraction model.
[0040] In this embodiment, the aforementioned execution entity trains the initial model using the target features of the initial training samples to obtain a trained feature extraction model. That is, the initial training samples are used as input, and the target features of the initial training samples are used as output to perform supervised training on the initial model, thereby obtaining the trained feature extraction model. The initial model here can be a large language model. A large language model (large model) is an artificial intelligence model designed to understand and generate human language. By training on large amounts of text data, it can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and so on. A large model refers to a deep neural network with over 1 billion parameters, capable of processing massive amounts of data and completing various complex tasks. With the continuous improvement of computer hardware performance and the continuous optimization of deep learning algorithms, the development of large models is accelerating. The parameter scale of large models is constantly expanding, and the training time is getting longer, but the performance is also improving. Large models are usually based on deep learning architectures, such as Transformers, enabling them to exhibit impressive capabilities in various natural language processing tasks. Common large models include, but are not limited to, ChatGPT, GPT-4, ERNIE, and Lingyi Bot.
[0041] The training method for the feature extraction model provided in this embodiment first obtains initial training samples; then, determines the target features of the initial training samples; and finally, trains the initial model using the target features of the initial training samples to obtain the trained feature extraction model. The training method for the feature extraction model in this embodiment first determines word segmentation features used to characterize the global features of the training text and classification features used to characterize the local features of the training text. Then, it combines the word segmentation features and classification features to generate target features, and trains the model using these target features. This significantly improves the depth and breadth of feature mining and enhances the comprehensiveness of the features extracted by the feature extraction model.
[0042] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0043] Continue to refer to Figure 3 , Figure 3 A flow 300 of another embodiment of a training method for a feature extraction model according to the present disclosure is shown. The training method for the feature extraction model includes the following steps:
[0044] Step 301: Obtain initial training samples.
[0045] In this embodiment, the execution entity of the training method for the feature extraction model (e.g.) Figure 1 The server 105 shown will obtain the initial training samples.
[0046] Step 301 is basically the same as step 201 in the aforementioned embodiment. For the specific implementation method, please refer to the aforementioned description of step 201, which will not be repeated here.
[0047] Step 302: Determine the classification category information based on the word segmentation features of the initial training samples.
[0048] In this embodiment, the execution entity determines the classification category information based on the word segmentation features of the initial training samples. The execution entity first performs word segmentation on the initial training samples, then calculates the lift value for each word segmentation feature, extracts the word segmentation features with high lift values, and defines risk classification categories based on these features, such as Level 1, Level 2…Level 10, etc. It should be noted that the lift value calculation method can be implemented using existing technology, and will not be elaborated here.
[0049] Step 303: Label the initial training samples based on the classification category information to obtain labeled samples.
[0050] In this embodiment, the aforementioned execution entity will use keyword recall to obtain samples to be labeled from the initial training samples, and label the samples to be labeled according to the defined risk classification categories to obtain the corresponding labeled samples.
[0051] Step 304: Supervised training of the initial classification model based on labeled samples to obtain the trained classification model.
[0052] In this embodiment, the aforementioned execution entity will use these labeled samples to perform supervised training on the initial classification model, thereby obtaining a trained classification model.
[0053] Step 305: Generate classification features for the initial training samples based on the classification model.
[0054] In this embodiment, the aforementioned execution entity will use the classification model to extract the classification features of the initial training samples, which represent the local features of the training samples.
[0055] Finally, the classification feature is combined with the word segmentation feature to obtain the target feature of the initial training sample. This makes the target feature information more comprehensive.
[0056] Step 306: Train the initial model using the target features of the initial training samples to obtain the trained feature extraction model.
[0057] In this embodiment, the aforementioned execution entity will use the target features of the initial training samples to train the initial model, thereby obtaining a trained feature extraction model.
[0058] Step 306 is basically the same as step 203 in the aforementioned embodiment. For the specific implementation method, please refer to the aforementioned description of step 203, which will not be repeated here.
[0059] from Figure 3 It can be seen from this that, with Figure 2 Compared with the corresponding embodiments, the training method of the feature extraction model in this embodiment first performs word segmentation on the initial training samples, defines risk classification based on the word segmentation features, and finally combines the word segmentation results with the text classification results to generate target features, thereby greatly improving the depth, breadth and effectiveness of feature mining.
[0060] Continue to refer to Figure 4 , Figure 4 A flow 400 of another embodiment of a training method for a feature extraction model according to the present disclosure is shown. The training method for the feature extraction model includes the following steps:
[0061] Step 401: Obtain the initial training samples.
[0062] In this embodiment, the execution entity of the training method for the feature extraction model (e.g.) Figure 1 The server 105 shown will obtain the initial training samples.
[0063] Step 401 is basically the same as step 201 in the aforementioned embodiment. For the specific implementation method, please refer to the aforementioned description of step 201, which will not be repeated here.
[0064] In some optional implementations of this embodiment, the initial training samples are obtained through the following steps: acquiring raw sample data; performing preprocessing operations on the raw sample data to obtain the initial training samples, wherein the preprocessing operations include removing noise information, text processing, and / or removing stop words.
[0065] In this implementation, the executing entity first acquires a large amount of raw text data, such as advertising text data. This advertising text data may include noise information irrelevant to the classification task, such as emojis, URLs, and meaningless characters like garbled text. Therefore, it first undergoes noise removal processing, such as noise removal, text processing, and stop word removal, to obtain initial training samples. Specifically, for URLs and meaningless character libraries, regular expressions are used to preprocess the text and filter out this noise information. For noise information such as emojis, it can be processed by encoding matching, either by directly filtering by matching the text encoding to Unicode, or by filtering by matching a list of allowed characters.
[0066] Step 402: Perform word segmentation on the initial training samples and extract the corresponding word segmentation features from the processed words.
[0067] In this embodiment, the execution entity performs word segmentation on the initial training sample and extracts the corresponding word segmentation features from the multiple word segments obtained, using them as the word segmentation features of the initial training sample. These word segmentation features represent the global features of the training sample.
[0068] In some optional implementations of this embodiment, step 402 includes: selecting the segmentation granularity according to the required scenario, wherein the segmentation granularity includes sentence level, phrase level, word level and character level; and performing segmentation processing on the initial training samples according to the segmentation granularity.
[0069] In this implementation, word segmentation can be performed at different granularities, such as sentence level, phrase level, word level, and character level. Word segmentation processing for different languages has its own characteristics. For example, in English data, due to changes in part-of-speech tags, special operations such as part-of-speech tagging and stemming are required. In Chinese data, however, the choice of granularity is a major factor; an appropriate segmentation granularity needs to be selected for the specific scenario (e.g., financial text scenarios) to achieve better model performance.
[0070] Step 403: Determine the target word segmentation features from the word segmentation features based on the lifting value of the processed word segmentation.
[0071] In this embodiment, the execution entity determines the target word segmentation feature from the extracted word segmentation features based on the lift values of multiple word segments obtained. For example, the processed analysis can be filtered first, and then the lift values of the filtered word segments can be calculated, thereby determining the target word segmentation feature based on the lift values. Alternatively, the lift value of each word can be calculated separately, and then the word segmentation features with high lift values can be extracted and recorded as the target word segmentation feature.
[0072] In some optional implementations of this embodiment, step 403 includes: calculating the lift value corresponding to the processed word segmentation to obtain a lift value set; determining the lift value that meets the preset conditions from the lift value set to obtain the target lift value; and determining the word segmentation feature corresponding to the target lift value as the target word segmentation feature.
[0073] In this implementation, the execution entity calculates the lift value corresponding to each word segmentation, thus obtaining a lift value set. Then, it extracts lift values that meet preset conditions from this set. Here, the lift values can be sorted from highest to lowest, and lift values greater than a preset value are selected to obtain at least one target lift value. Finally, the word segmentation features corresponding to the target lift values are used as the target word segmentation features.
[0074] Step 404: Determine the classification category information based on the target word segmentation features.
[0075] In this embodiment, the execution entity defines the category information, such as level one, level two... level ten, based on the content of the target word segmentation features. Thus, the category is defined based on the word segmentation features.
[0076] Step 405: Use keyword recall to determine the word segments that correspond to the classification information from the processed word segments.
[0077] In this embodiment, the aforementioned execution entity utilizes keyword recall to determine the word segments corresponding to the category information from the processed multiple word segments. Keyword recall is a commonly used technique in information retrieval and recommendation systems, its core being to achieve rapid filtering by matching keywords in user queries with keywords in documents or advertisements. Using keyword recall, content corresponding to category information can be quickly filtered from massive amounts of word segments.
[0078] Step 406: Label the target training samples according to the classification information to obtain labeled samples.
[0079] In this embodiment, the aforementioned execution entity labels the target training samples based on classification information to obtain labeled samples. The target training samples are the initial training samples corresponding to the determined word segments. That is, the target training samples are matched with various classification categories to determine their category, thereby labeling the target training samples and obtaining labeled samples.
[0080] Step 407: Supervised training of the initial classification model based on labeled samples to obtain the trained classification model.
[0081] In this embodiment, the aforementioned execution entity will use these labeled samples to perform supervised training on the initial classification model, thereby obtaining a trained classification model.
[0082] Step 408: Randomly sample the initial training samples to obtain the sampled samples.
[0083] In this embodiment, the aforementioned execution entity will randomly sample the initial training samples to obtain sampled samples.
[0084] Step 409: Input the sampled data into the classification model and output the classification features of the sampled data.
[0085] In this embodiment, the execution entity inputs the sampled samples into the classification model, thereby outputting the classification features of the sampled samples. This improves the classification accuracy.
[0086] In some optional implementations of this embodiment, the method further includes: in response to the sampled sample being the target training sample, comparing the classification features of the sampled sample with the category labeling results of the sampled sample; in response to the comparison results being different, correcting the category labeling results using the classification features.
[0087] In this implementation, it is also necessary to determine whether the sampled sample is the target training sample, that is, whether the sampled sample has already been labeled with a category. If the sampled sample is the target training sample (that is, the sampled sample has already been labeled with a category), then the classification features of the sampled sample are compared with its corresponding category labeling results. If the comparison results are different, the category labeling results are corrected using the classification features, thereby realizing the verification of the labeling results.
[0088] In some optional implementations of this embodiment, if the sampled sample is not the target training sample (i.e., the sampled sample is not labeled with a category), then the classification features of the sampled sample are obtained through the classification model, which is equivalent to expanding the number of samples in the feature extraction model.
[0089] Step 410: Train the initial model using the target features of the initial training samples to obtain the trained feature extraction model.
[0090] In this embodiment, the aforementioned execution entity will use the target features of the initial training samples to train the initial model, thereby obtaining a trained feature extraction model.
[0091] from Figure 4 It can be seen from this that, with Figure 3 Compared to the corresponding embodiments, the training method of the feature extraction model in this embodiment first performs word segmentation on the initial training samples, defines risk classification based on the lift value of the word segmentation features, and finally combines the word segmentation results with the text classification results to generate scoring features, thereby greatly improving the depth, breadth and effectiveness of feature mining.
[0092] Further references are available. Figure 5-1 , Figure 5-1 The following is an application flow of the training method of the feature extraction model of this disclosure, in a financial scenario, specifically including:
[0093] Step 5101: Obtain the advertising text data.
[0094] Step 5102, text segmentation.
[0095] This involves segmenting the acquired advertising text data into words to obtain multiple corresponding words.
[0096] Step 5103, Classification Definition.
[0097] From the multiple word segments obtained in step 5102, extract the word segmentation features with high lift values, and summarize the classification categories accordingly, such as: Level 1, Level 2... Level 10, etc.
[0098] Step 5104, initial annotation.
[0099] The text data is categorized according to the defined classification categories.
[0100] Step 5105, category classification.
[0101] Based on the annotated text, a local supervised training process is performed to obtain a classification model. This model is then used to classify text data into categories.
[0102] Step 5106, Feature Construction.
[0103] By combining the word segmentation features and classification features of the advertising text data, the complete features of the advertising text data are obtained.
[0104] Further references are available. Figure 5-2 , Figure 5-2 This paper illustrates another application flow of the training method for the feature extraction model of this disclosure, which is also applied in a financial scenario, specifically including:
[0105] Step 5201: Obtain the advertising text data.
[0106] Step 5202: Keyword recall sample.
[0107] Keyword recall is used to extract text data from advertising text data that corresponds to the defined category.
[0108] Step 5203, fine-tuning the Wenxin model.
[0109] The text-centric fine-tuning model is used to determine the classification category information of the recalled text data.
[0110] Step 5204, random sampling prediction.
[0111] Random sampling is performed from the advertising text data, and the classification category information of the sampled samples is predicted.
[0112] Step 5205: Verify and expand the sample.
[0113] If the sampled sample is a recalled sample, the labeling results are verified using the predicted classification information. If they are different, they are corrected.
[0114] If the sampled sample is not the recalled sample, then predicting the classification information of the sampled sample is equivalent to expanding the number of samples for modeling.
[0115] Step 5206, Modeling.
[0116] Modeling is performed based on the above sample data. The model is then further evaluated to determine if it has met expectations. If it has, step 5207 is executed; otherwise, steps 5203-5206 are repeated until the model meets expectations.
[0117] Step 5207, Feature Construction.
[0118] By combining the word segmentation features and classification features of the advertising text data, the complete features of the advertising text data are obtained.
[0119] Continue to refer to Figure 6 , Figure 6 A flow 600 of an embodiment of a feature extraction method according to the present disclosure is shown. The feature extraction method includes the following steps:
[0120] Step 601: Obtain the text to be extracted.
[0121] In this embodiment, the execution body of the feature extraction method (e.g. Figure 1 The server 105 shown will acquire the text to be extracted, which is the text data from which features need to be extracted. For example, in a financial scenario (specifically, a financial risk control scenario), the text to be extracted can be advertising text data. Of course, it can also be text data from other application scenarios, and this embodiment does not specifically limit it.
[0122] Step 602: Input the text to be extracted into the feature extraction model and output the target features of the text to be extracted.
[0123] In this embodiment, the execution entity inputs the text to be extracted into the feature extraction model and outputs the target features of the text to be extracted. The feature extraction model is trained using the method described in the preceding embodiment. The obtained target features include analytical features that characterize the global features of the text to be extracted and classification features that characterize the local features of the text to be extracted.
[0124] The feature extraction method provided in this embodiment first obtains the text to be extracted; then, the text to be extracted is input into a feature extraction model, and the target features of the text to be extracted are output. The feature extraction method in this embodiment can accurately extract the global and local features of text data, improving the comprehensiveness of information extraction, increasing the efficiency and accuracy of text feature extraction, and further enhancing the efficiency of text classification.
[0125] Further reference Figure 7As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a training device for a feature extraction model, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0126] like Figure 7 As shown, the training device 700 for the feature extraction model in this embodiment includes: a sample acquisition module 701, a feature determination module 702, and a model training module 703. The sample acquisition module 701 is configured to acquire initial training samples; the feature determination module 702 is configured to determine the target features of the initial training samples, wherein the target features include word segmentation features and classification features, the word segmentation features representing the feature information of the words corresponding to the initial training samples, and the classification features representing the feature information of the initial training samples corresponding to a preset classification category; the model training module 703 is configured to train the initial model using the target features of the initial training samples to obtain a trained feature extraction model.
[0127] In this embodiment, the specific processing of the sample acquisition module 701, the feature determination module 702, and the model training module 703 in the training device 700 of the feature extraction model, and the resulting technical effects, can be found in the following references: Figure 2 The relevant descriptions of steps 201-203 in the corresponding embodiments will not be repeated here.
[0128] In some optional implementations of this embodiment, the feature determination module includes: an information determination submodule, configured to determine classification category information based on the word segmentation features of the initial training samples; a sample annotation submodule, configured to annotate the initial training samples based on the classification category information to obtain annotated samples; a model training submodule, configured to perform supervised training on the initial classification model based on the annotated samples to obtain a trained classification model; and a feature generation submodule, configured to generate classification features of the initial training samples based on the classification model.
[0129] In some optional implementations of this embodiment, the information determination submodule includes: a word segmentation processing unit configured to perform word segmentation processing on the initial training samples and extract corresponding word segmentation features from the processed word segments; a feature determination unit configured to determine target word segmentation features from the word segmentation features based on the lift value of the processed word segments; and an information determination unit configured to determine classification category information based on the target word segmentation features.
[0130] In some optional implementations of this embodiment, the word segmentation unit is further configured to: select the word segmentation granularity according to the required scenario, wherein the word segmentation granularity includes sentence level, phrase level, word level and character level; and perform word segmentation processing on the initial training samples according to the word segmentation granularity.
[0131] In some optional implementations of this embodiment, the feature determination unit is further configured to: calculate the lift value corresponding to the processed word segmentation to obtain a lift value set; determine the lift value that meets the preset conditions from the lift value set to obtain the target lift value; and determine the word segmentation feature corresponding to the target lift value as the target word segmentation feature.
[0132] In some optional implementations of this embodiment, the sample labeling submodule includes: a recall unit configured to determine the segmentation corresponding to the classification information from the processed segmentation using keyword recall; and a training unit configured to label the target training sample based on the classification information to obtain labeled samples, wherein the target training sample is the initial training sample corresponding to the determined segmentation.
[0133] In some optional implementations of this embodiment, the feature generation submodule is further configured to: randomly sample the initial training samples to obtain sampled samples; input the sampled samples into the classification model and output the classification features of the sampled samples.
[0134] In some optional implementations of this embodiment, the training device 700 for the feature extraction model further includes: a comparison module configured to compare the classification features of the sampled sample with the category labeling result of the sampled sample in response to the sampled sample being the target training sample; and a correction module configured to correct the category labeling result using the classification features in response to the comparison result being different.
[0135] In some optional implementations of this embodiment, the training device 700 for the feature extraction model further includes: a sample generation module for generating initial training samples; the sample generation module is configured to: acquire raw sample data; perform preprocessing operations on the raw sample data to obtain initial training samples, wherein the preprocessing operations include removing noise information, text processing, and / or removing stop words.
[0136] Further reference Figure 8 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a feature extraction device, which is similar to... Figure 6 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0137] like Figure 8 As shown, the feature extraction device 800 of this embodiment includes a text acquisition module 801 and a feature extraction module 802. The text acquisition module 801 is configured to acquire the text to be extracted; the feature extraction module 802 is configured to input the text to be extracted into a feature extraction model and output the target features of the text to be extracted.
[0138] In this embodiment, the specific processing of the text acquisition module 801 and the feature extraction module 802 in the feature extraction device 800 and the resulting technical effects can be referred to respectively. Figure 6 The relevant descriptions of steps 601-602 in the corresponding embodiments will not be repeated here.
[0139] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0140] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0141] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.
[0142] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0143] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as training methods for feature extraction models or feature extraction methods. For example, in some embodiments, the training methods for feature extraction models or feature extraction methods can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the training methods for feature extraction models or feature extraction methods described above can be performed. Alternatively, in other embodiments, the computing unit 901 may be configured in any other suitable manner (e.g., by means of firmware) to perform a training method or a feature extraction method for a feature extraction model.
[0144] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0145] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other training device for a programmable feature extraction model, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0146] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0147] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0148] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0149] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0150] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0151] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for training a feature extraction model, comprising: Obtain initial training samples; The target features of the initial training sample are determined, wherein the target features include word segmentation features and classification features, the word segmentation features are used to characterize the feature information of the words corresponding to the initial training sample, and the classification features are used to characterize the feature information of the initial training sample corresponding to a preset classification category; The initial model is trained using the target features of the initial training samples to obtain a trained feature extraction model, wherein the feature extraction model is used to process text data; Wherein, determining the target features of the initial training samples includes: The initial training samples are segmented into words, and the corresponding segmentation features are extracted from the processed words. The classification category information is determined based on the segmentation features. The word segmentation corresponding to the classification information is determined from the word segmentation obtained by the processing using keyword recall. The target training samples are labeled with categories based on the classification information to obtain labeled samples, wherein the target training samples are the initial training samples corresponding to the determined word segments; The initial classification model is trained in a supervised manner based on the labeled samples to obtain the trained classification model. Randomly sample the initial training samples to obtain sampled samples; The sampled samples are input into the classification model, and the classification features of the sampled samples are output. In response to the fact that the sampled sample is the target training sample, the classification features of the sampled sample are compared with the category labeling results of the sampled sample; In response to a difference in the comparison result, the category labeling result is corrected using the classification features.
2. The method according to claim 1, wherein, The step of determining the classification category information based on the word segmentation features includes: Based on the lifting value of the word segmentation obtained from the above processing, the target word segmentation feature is determined from the word segmentation feature; The classification category information is determined based on the target word segmentation features.
3. The method according to claim 1, wherein, The word segmentation process for the initial training samples includes: The segmentation granularity can be selected according to the needs and scenarios, including sentence level, phrase level, word level and character level. The initial training samples are segmented according to the stated segmentation granularity.
4. The method according to claim 2, wherein, The lifting value of the word segmentation obtained based on the processing is used to determine the target word segmentation features from the word segmentation features, including: Calculate the lifting value corresponding to the word segmentation obtained by the above processing to obtain a set of lifting values; The target lift value is obtained by determining the lift value that meets the preset conditions from the set of lift values. The word segmentation feature corresponding to the target lift value is determined as the target word segmentation feature.
5. The method according to claim 1, wherein, The initial training samples are obtained through the following steps: Obtain the raw sample data; The original sample data is preprocessed to obtain the initial training samples, wherein the preprocessing operations include noise removal, text processing, and / or stop word removal.
6. A feature extraction method, comprising: Get the text to be extracted; The text to be extracted is input into the feature extraction model, and the target features of the text to be extracted are output. The feature extraction model is trained by the method according to any one of claims 1-5.
7. A training device for a feature extraction model, comprising: The sample acquisition module is configured to acquire initial training samples; The feature determination module is configured to determine the target features of the initial training sample, wherein the target features include word segmentation features and classification features, the word segmentation features are used to characterize the feature information of the words corresponding to the initial training sample, and the classification features are used to characterize the feature information of the initial training sample corresponding to a preset classification category; The model training module is configured to train an initial model using the target features of the initial training samples to obtain a trained feature extraction model, wherein the feature extraction model is used to process text data. The feature determination module is further configured to: The initial training samples are segmented into words, and the corresponding segmentation features are extracted from the processed words. The classification category information is determined based on the segmentation features. The word segmentation corresponding to the classification information is determined from the word segmentation obtained by the processing using keyword recall. The target training samples are labeled with categories based on the classification information to obtain labeled samples, wherein the target training samples are the initial training samples corresponding to the determined word segments; The initial classification model is trained in a supervised manner based on the labeled samples to obtain the trained classification model. Randomly sample the initial training samples to obtain sampled samples; The sampled samples are input into the classification model, and the classification features of the sampled samples are output. In response to the fact that the sampled sample is the target training sample, the classification features of the sampled sample are compared with the category labeling results of the sampled sample; In response to a difference in the comparison result, the category labeling result is corrected using the classification features.
8. A feature extraction apparatus, comprising: The text acquisition module is configured to acquire the text to be extracted; The feature extraction module is configured to input the text to be extracted into the feature extraction model and output the target features of the text to be extracted, wherein the feature extraction model is trained by the method according to any one of claims 1-5.
9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
10. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.
Citation Information
Patent Citations
Webpage text classification method and device and webpage text identification method and device
CN107291723A
Dialogue feature representation method and device and model training method and device
CN116151834A
