Feature extraction model training method and feature extraction method
By obtaining and combining the word segmentation features and classification features of the text, target features are generated for training the feature extraction model, which solves the problems of unity and subjectivity in the feature extraction process in text classification, and achieves more comprehensive feature extraction and more efficient Text classification.
Patent Information
- Application Number
- CN202410781102.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-17
AI Technical Summary
Existing technologies in text classification have problems with the singleness and subjectivity of feature engineering in the feature extraction process, making it difficult to effectively extract global and local features of text, affecting classification accuracy.
By obtaining the word segmentation features and classification features of the initial training samples, combined with lift value and keyword recall technology, target features are generated for training the feature extraction model, improving the depth and breadth of feature mining.
It significantly improves the comprehensiveness and accuracy of the feature extraction model, improves the efficiency and accuracy of text classification, and solves the problems of singleness and subjectivity in the feature extraction process.
Smart Images

Figure CN118690169A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as natural language processing, deep learning, smart finance, and large models, and in particular to a training method for a feature extraction model and a feature extraction method. Background Art
[0002] In recent years, with the rapid iteration of the Internet and computer technology, a huge amount of text-based data has been generated on the Internet. Text classification refers to automatically assigning text to predefined categories based on the specific content of the text. It is a basic and important task in the field of natural language processing. Natural language processing is a sub-direction of artificial intelligence that aims to enable computers to understand human language. Text classification through natural language processing and deep learning methods can avoid problems such as singleness and subjectivity when extracting features in feature engineering. Summary of the invention
[0003] The present invention provides a method for training a feature extraction model and a method for extracting features.
[0004] According to a first aspect of the present disclosure, a method for training a feature extraction model is provided, comprising: obtaining an initial training sample; determining 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 feature information of word segmentations corresponding to the initial training sample, and the classification features are used to characterize feature information of the initial training sample corresponding to a preset classification category; using the target features of the initial training sample to train the initial model to obtain a trained feature extraction model.
[0005] According to a second aspect of the present disclosure, a feature extraction method is provided, comprising: obtaining 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 method in the first aspect.
[0006] According to a third aspect of the present disclosure, a training device for a feature extraction model is provided, comprising: a sample acquisition module, configured to acquire an initial training sample; a feature determination module, configured to determine 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 feature information of the word segmentations corresponding to the initial training sample, and the classification features are used to characterize feature information of the initial training sample 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 sample to obtain a trained feature extraction model.
[0007] According to a fourth aspect of the present disclosure, a feature extraction device is provided, comprising: a text acquisition module, configured to acquire text to be extracted; 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 the method described in any implementation method in the first aspect.
[0008] According to a fifth aspect of the present 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any implementation manner of the first aspect or the second aspect.
[0009] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method described in any implementation manner of the first aspect or the second aspect.
[0010] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the computer program implements the method described in any implementation manner of the first aspect or the second aspect.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0013] Figure 1 is an exemplary system architecture diagram in which the present disclosure may be applied;
[0014] Figure 2 is a flow chart of an embodiment of a method for training a feature extraction model according to the present disclosure;
[0015] Figure 3 is a flowchart of another embodiment of a method for training a feature extraction model according to the present disclosure;
[0016] Figure 4 is a flowchart of another embodiment of a method for training a feature extraction model according to the present disclosure;
[0017] Figure 5-1 is an application flow chart of the training method of the feature extraction model according to the present disclosure;
[0018] Figure 5-2 is another application flow chart of the training method of the feature extraction model according to the present disclosure;
[0019] Figure 6 is a flow chart of an embodiment of a feature extraction method according to the present disclosure;
[0020] Figure 7 is a structural schematic diagram of an embodiment of a training device for a feature extraction model according to the present disclosure;
[0021] Figure 8 is a structural schematic diagram of an embodiment of a feature extraction device according to the present disclosure;
[0022] Fig. 9 It is a block diagram of an electronic device used to implement the training method of the feature extraction model or the feature extraction method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of a feature extraction model training method, a feature extraction method or a feature extraction model training device, and a feature extraction device of the present disclosure can be applied.
[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0027] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send information, etc. Various client applications can be installed on the terminal devices 101, 102, 103.
[0028] The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. When the terminal devices 101, 102, 103 are software, they may be installed in the above electronic devices. They may be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.
[0029] The server 105 can provide various services. For example, the server 105 can analyze and process the initial training samples obtained from the terminal devices 101, 102, and 103, and generate processing results (such as a trained feature extraction model).
[0030] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 105 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0031] It should be noted that the feature extraction model training method and feature extraction method provided in the embodiments of the present disclosure are generally executed by the server 105 , and accordingly, the feature extraction model training device and feature extraction device are generally arranged in the server 105 .
[0032] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0033] Continue to refer Figure 2 , which shows a process 200 of an embodiment of a method for training a feature extraction model according to the present disclosure. The method for training a feature extraction model comprises the following steps:
[0034] Step 201: Obtain initial training samples.
[0035] In this embodiment, the execution subject of the training method of the feature extraction model (for example Figure 1The server 105 shown in the figure will obtain the initial training sample. The initial training sample may include a large amount of training data. When the feature extraction model is applied to the financial risk control scenario, the initial training sample may contain a large amount of advertising text data, and these advertising text data may include emoticons, URLs (uniform resource locator), meaningless characters such as garbled characters, and other noise information that is irrelevant to the classification task. Therefore, it will first be processed by noise removal, such as removing noise information, text processing, and removing stop words, so as to obtain the initial training sample. Specifically, for URLs and meaningless character libraries, regular expressions will be used to pre-process the text to filter out these noise information; for noise information such as emoticons, it can be processed by encoding matching, directly filtering by matching the text encoding with Unicode (Unicode), or filtering by matching the allowed character list.
[0036] Step 202: determine the target features of the initial training samples.
[0037] In this embodiment, the execution subject determines 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 word segmentation corresponding to the initial training sample, and the classification features are used to characterize the feature information of the initial training sample corresponding to the preset classification category. Specifically, the execution subject first performs word segmentation processing on the initial training sample to determine the corresponding word segmentation features, which represent the global features of the training sample.
[0038] Then, the execution body will calculate the lift value of each word segmentation feature, extract the word segmentation features with high lift value, and define the risk classification category according to these word segmentation features, such as level one, level two...level ten, etc. It should be noted that the lift value is an evaluation indicator used to measure the effectiveness of an association rule. After that, the keyword recall method is used to obtain the samples to be labeled from the initial training samples, and the samples to be labeled are labeled according to the defined risk classification categories to obtain the corresponding labeled samples. Then, these labeled samples are used to perform supervised training on the initial classification model to obtain a trained classification model. Then, the classification model is used to extract the classification features of the initial training samples, and the classification features represent the local features of the training samples. Finally, the 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 a trained feature extraction model.
[0040] In this embodiment, the above-mentioned execution subject will use the target features of the initial training sample to train the initial model to obtain a trained feature extraction model. That is, the initial training sample is used as input, the target features of the initial training sample are used as output, and the initial model is supervised for training, so as to obtain a trained feature extraction model. The initial model here can be a large language model, which is an artificial intelligence model designed to understand and generate human language. By training on a large amount of text data, a wide range of tasks can be performed, including text summarization, translation, sentiment analysis, etc. A large model refers to a deep neural network with more than 1 billion parameters that can process massive data and complete 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 also getting faster and faster. The parameter scale of large models continues to expand, the training time is getting longer and longer, but the performance is also improved. Large models are usually based on deep learning architectures, such as transformers, which enable impressive capabilities in various natural language processing tasks. Common large models may include but are not limited to ChatGPT, GPT-4, ERNIE, Lingyi Bot, etc.
[0041] The training method of the feature extraction model provided in the embodiment of the present disclosure first obtains the initial training sample; then determines the target feature of the initial training sample; finally, uses the target feature of the initial training sample to train the initial model to obtain a trained feature extraction model. The training method of the feature extraction model in this embodiment first determines the word segmentation feature used to characterize the global feature of the training text and the classification feature used to characterize the local feature of the training text, then synthesizes the word segmentation feature and the classification feature to generate the target feature, and trains the model with the target feature, thereby greatly improving the depth and breadth of feature mining and improving the comprehensiveness of feature extraction by the feature extraction model.
[0042] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0043] Continue to refer Figure 3 , Figure 3 A process 300 of another embodiment of a method for training a feature extraction model according to the present disclosure is shown. The method for training a feature extraction model comprises the following steps:
[0044] Step 301, obtaining initial training samples.
[0045] In this embodiment, the execution subject of the training method of the feature extraction model (for example Figure 1 The server 105 shown in the figure will obtain the initial training samples.
[0046] Step 301 is basically the same as step 201 of the aforementioned embodiment. The specific implementation method can refer to the aforementioned description of step 201, which will not be repeated here.
[0047] Step 302: Determine classification category information based on the word segmentation features of the initial training sample.
[0048] In this embodiment, the above-mentioned execution subject determines the classification category information according to the word segmentation features of the initial training sample. The above-mentioned execution subject first performs word segmentation processing on the initial training sample, and then calculates the lift value of each word segmentation feature respectively, and extracts the word segmentation features with high lift (lift) value, and defines the risk classification category according to these word segmentation features, for example: level one, level two...level ten, etc. It should be noted that the calculation method of the lift value can be implemented using existing technology, which will not be repeated here.
[0049] Step 303: label the initial training samples based on the classification category information to obtain labeled samples.
[0050] In this embodiment, the execution subject obtains samples to be labeled from initial training samples by using keyword recall, and labels the samples to be labeled according to defined risk classification categories to obtain corresponding labeled samples.
[0051] Step 304: Perform supervised training on the initial classification model based on the labeled samples to obtain a trained classification model.
[0052] In this embodiment, the execution entity uses these labeled samples to perform supervised training on the initial classification model, thereby obtaining a trained classification model.
[0053] Step 305: Generate classification features of initial training samples based on the classification model.
[0054] In this embodiment, the execution entity uses the classification model to extract classification features of the initial training samples, and the classification features represent 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, thereby making the target feature information more comprehensive.
[0056] Step 306: train the initial model using the target features of the initial training samples to obtain a trained feature extraction model.
[0057] In this embodiment, the execution subject uses the target features of the initial training samples to train the initial model to obtain a trained feature extraction model.
[0058] Step 306 is basically the same as step 203 of the aforementioned embodiment. The specific implementation method can refer to the aforementioned description of step 203, which will not be repeated here.
[0059] from Figure 3 It can be seen that 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 Figure 4 , Figure 4 A process 400 of another embodiment of a method for training a feature extraction model according to the present disclosure is shown. The method for training a feature extraction model comprises the following steps:
[0061] Step 401, obtaining initial training samples.
[0062] In this embodiment, the execution subject of the training method of the feature extraction model (for example Figure 1 The server 105 shown in the figure will obtain the initial training samples.
[0063] Step 401 is basically the same as step 201 of the aforementioned embodiment. The specific implementation method can 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 by the following steps: acquiring original sample data; performing preprocessing operations on the original sample data to obtain initial training samples, wherein the preprocessing operations include removing noise information, text processing and / or removing stop words.
[0065] In this implementation, the execution subject will first obtain a large amount of original text data, such as advertising text data, which may include emoticons, URLs, meaningless characters such as garbled characters, and other noise information that is irrelevant to the classification task. Therefore, it will first be subjected to noise removal processing, such as removing noise information, text processing, and removing stop words, so as to obtain the initial training samples. Specifically, for URLs and meaningless character libraries, regular expressions will be used to pre-process the text to filter out these noise information; for noise information such as emoticons, it can be processed by encoding matching, directly filtering by matching the text encoding to Unicode, or filtering by matching the allowed character list.
[0066] Step 402: perform word segmentation processing on the initial training samples, and extract corresponding word segmentation features from the processed word segments.
[0067] In this embodiment, the execution subject performs word segmentation processing on the initial training sample, and extracts corresponding word segmentation features from the multiple word segments obtained by the processing, and uses them as the word segmentation features of the initial training sample, which represent the global features of the training sample.
[0068] In some optional implementations of this embodiment, step 402 includes: selecting a word segmentation granularity according to a demand scenario, wherein the word segmentation granularity includes a sentence level, a phrase level, a word level, and a character level; and performing word segmentation processing on the initial training sample according to the word 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 in different languages has its own characteristics. For example, in English data, due to the change of part of speech, there are special operations such as part of speech restoration and stem extraction; in Chinese data, the choice of granularity is one of the main factors. It is necessary to select the appropriate word segmentation granularity in specific scenarios (such as financial text scenarios) to achieve better model effects.
[0070] Step 403: determine a target word segmentation feature from the word segmentation features based on the processed word segmentation lift value.
[0071] In this embodiment, the execution subject determines the target word segmentation feature from the extracted word segmentation features according to the lift values of the multiple word segmentations obtained. For example, the analysis obtained by processing can be filtered first, and then the lift value of the filtered word segmentation is calculated, so as to determine the target word segmentation feature based on the lift value. For another example, the lift value (lift value) of each word segmentation can be calculated separately, and then the word segmentation features with high lift values are extracted therefrom, and the extracted features are recorded as the target word segmentation features.
[0072] In some optional implementations of this embodiment, step 403 includes: calculating the lift value corresponding to the word segmentation obtained by processing to obtain a lift value set; determining the lift value that meets the preset conditions from the lift value set to obtain a 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 subject will calculate the lift value corresponding to each word segmentation, thereby obtaining a lift value set, and then extract the lift value that meets the preset conditions from the lift value set. Here, the lift values can be sorted from high to low, and then the lift values greater than the preset value are intercepted to obtain at least one target lift value. Finally, the word segmentation feature corresponding to the target lift value is used as the target word segmentation feature.
[0074] Step 404: Determine classification category information based on the target word segmentation features.
[0075] In this embodiment, the execution subject will define the classification category information according to the content of the target word segmentation feature, such as level one, level two, level ten, etc. Thus, the classification category is defined based on the word segmentation feature.
[0076] Step 405: determine the segmented words corresponding to the classification category information from the processed segmented words by using a keyword recall method.
[0077] In this embodiment, the execution subject uses the keyword recall method to determine the segmented words corresponding to the classification category information from the multiple segmented words obtained by processing. Keyword recall is a commonly used technology in information retrieval and recommendation systems. Its core is to achieve rapid filtering by matching the keywords in the user query with the keywords in the document or advertisement. The keyword recall method can quickly filter out the content corresponding to the classification category information from the massive segmented words.
[0078] Step 406: classify the target training samples based on the classification category information to obtain labeled samples.
[0079] In this embodiment, the execution subject will perform category labeling on the target training sample based on the classification category information to obtain a labeled sample, wherein the target training sample is the initial training sample corresponding to the determined word segmentation. That is, the target training sample is matched with each classification category to determine the category of the target training sample, and the target training sample is labeled to obtain a labeled sample.
[0080] Step 407: Perform supervised training on the initial classification model based on the labeled samples to obtain a trained classification model.
[0081] In this embodiment, the execution entity uses 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 sampled samples.
[0083] In this embodiment, the execution entity performs random sampling on the initial training samples to obtain sampled samples.
[0084] Step 409: input the sampled sample into the classification model, and output the classification features of the sampled sample.
[0085] In this embodiment, the execution subject inputs the sampled sample into the classification model, thereby outputting the classification features of the sampled sample, thereby improving the classification accuracy.
[0086] In some optional implementations of this embodiment, it also includes: in response to the sampled sample being a target training sample, comparing the classification features of the sampled sample with the category labeling result of the sampled sample; in response to the comparison result being different, correcting the category labeling result using the classification features.
[0087] In this implementation, it is also determined whether the sampled sample is the target training sample, that is, whether the sampled sample has been labeled with a category. If the sampled sample is the target training sample (that is, the sampled sample has been labeled with a category), the classification feature of the sampled sample is compared with its corresponding category labeling result. If the comparison result is different, the classification feature is used to correct the category labeling result, thereby realizing the verification of the labeling result.
[0088] In some optional implementations of this embodiment, if the sampled sample is not a target training sample (ie, 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 of the feature extraction model.
[0089] Step 410, train the initial model using the target features of the initial training samples to obtain a trained feature extraction model.
[0090] In this embodiment, the execution subject uses the target features of the initial training samples to train the initial model to obtain a trained feature extraction model.
[0091] from Figure 4 It can be seen that Figure 3 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 the risk classification according to the lift value of the word segmentation feature, and finally combines the word segmentation result with the text classification result to generate a scoring feature, thereby greatly improving the depth, breadth and effectiveness of feature mining.
[0092] For further reference Figure 5-1 , Figure 5-1 An application process of the training method of the feature extraction model disclosed in the present invention is shown. The application scenario is a financial scenario, which specifically includes:
[0093] Step 5101, obtaining advertisement text data.
[0094] Step 5102, text segmentation.
[0095] That is, the acquired advertisement text data is segmented to obtain corresponding multiple segmented words.
[0096] Step 5103, category definition.
[0097] From the multiple segmented words obtained in step 5102, the segmented word features with high lift values are extracted, and the classification categories are summarized based on them, such as: level one, level two...level ten, etc.
[0098] Step 5104, initial labeling.
[0099] The text data is labeled according to the defined classification categories.
[0100] Step 5105, category classification.
[0101] Local supervised training is performed based on the annotated text to obtain a classification model, and the classification model is used to classify the text data.
[0102] Step 5106, feature construction.
[0103] The word segmentation features and classification features of the advertisement text data are combined to obtain the complete features of the advertisement text data.
[0104] For further reference Figure 5-2 , Figure 5-2 Another application process of the training method of the feature extraction model disclosed in the present invention is shown. The application scenario is also a financial scenario, which specifically includes:
[0105] Step 5201, obtaining advertisement text data.
[0106] Step 5202, keyword recall samples.
[0107] The text data corresponding to the defined classification category is obtained from the advertisement text data by using the keyword recall method.
[0108] Step 5203, Wenxin fine-tunes the model.
[0109] The classification category information of the recalled text data is determined using the Wenxin fine-tuning model.
[0110] Step 5204, random sampling prediction.
[0111] Randomly sample from the advertisement text data and predict the classification category information of the sampled samples.
[0112] Step 5205, verify and expand the sample.
[0113] If the sampled sample is a recalled sample, the labeling result is verified using the predicted classification category information. If they are different, corrections are made.
[0114] If the sampled sample is not a recalled sample, then predicting the classification category 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 sample data, and further determining whether the model has achieved the expected result. If the model has achieved the expected result, step 5207 is executed; if the model has not achieved the expected result, steps 5203-5206 are repeated until the model has achieved the expected result.
[0117] Step 5207, feature construction.
[0118] The word segmentation features and classification features of the advertisement text data are combined to obtain the complete features of the advertisement text data.
[0119] Continue to refer Figure 6 , Figure 6 A process 600 of an embodiment of a feature extraction method according to the present disclosure is shown. The feature extraction method comprises the following steps:
[0120] Step 601, obtaining the text to be extracted.
[0121] In this embodiment, the execution subject of the feature extraction method (eg Figure 1 The server 105 shown in the figure will obtain the text to be extracted, that is, the text data that needs to be extracted. For example, in a financial scenario (specifically, a financial risk control scenario), the text to be extracted may be advertising text data. Of course, it may also be text data in other application scenarios, which is not specifically limited in this embodiment.
[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 subject inputs the text to be extracted into the feature extraction model, and outputs the target features of the text to be extracted, wherein the feature extraction model is trained using the method described in the above embodiment. The obtained target features include analysis features for characterizing the global features of the text to be extracted and classification features for characterizing the local features of the text to be extracted.
[0124] The feature extraction method provided in the embodiment of the present disclosure first obtains the text to be extracted; then, 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 method in this embodiment can accurately extract the global features and local features of the text data, improve the comprehensiveness of information extraction, improve the extraction efficiency and extraction accuracy of text features, and further improve the classification efficiency of the text.
[0125] Further references Figure 7As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a training device for a feature extraction model. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0126] like Figure 7 As shown, the training device 700 of the feature extraction model of 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 an initial training sample; the feature determination module 702 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 word segmentation corresponding to the initial training sample, and the classification features are used to characterize the feature information of the initial training sample corresponding to the preset classification category; the model training module 703 is configured to train the initial model using the target features of the initial training sample to obtain a trained feature extraction model.
[0127] In this embodiment, in the feature extraction model training device 700, the specific processing of the sample acquisition module 701, the feature determination module 702 and the model training module 703 and the technical effects thereof can be referred to respectively. Figure 2 The relevant descriptions of steps 201 - 203 in the corresponding embodiment are not repeated here.
[0128] In some optional implementations of the present 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 labeling submodule, configured to label the initial training samples based on the classification category information to obtain labeled samples; a model training submodule, configured to perform supervised training on the initial classification model based on the labeled 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 the present embodiment, the information determination submodule includes: a word segmentation processing unit, configured to perform word segmentation processing on the initial training sample 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 values 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 processing 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 sample 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 word segmentation obtained by processing to obtain a lift value set; determine the lift value that meets the preset conditions from the lift value set to obtain a 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 word segmentation corresponding to the classification category information from the processed word segmentation by using keyword recall; a training unit, configured to perform category labeling on the target training sample based on the classification category information to obtain a labeled sample, wherein the target training sample is an initial training sample corresponding to the determined word 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 the present embodiment, the training device 700 of the feature extraction model further includes: a comparison module, configured to compare the classification features of the sampled sample with the category labeling results of the sampled sample in response to the sampled sample being a target training sample; and a correction module, configured to correct the category labeling results using the classification features in response to the comparison results being different.
[0135] In some optional implementations of the present embodiment, the training device 700 of the feature extraction model further includes: a sample generation module for generating initial training samples; the sample generation module is configured to: obtain original sample data; perform preprocessing operations on the original sample data to obtain initial training samples, wherein the preprocessing operations include removing noise information, text processing and / or removing stop words.
[0136] Further references Figure 8 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a feature extraction device, which is similar to Figure 6 Corresponding to the method embodiment shown, the 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 the feature extraction model, and output the target features of the text to be extracted.
[0138] In this embodiment, in the feature extraction device 800, the specific processing of the text acquisition module 801 and the feature extraction module 802 and the technical effects thereof can be referred to in Figure 6 The relevant descriptions of steps 601-602 in the corresponding embodiment are not repeated here.
[0139] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0140] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment 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 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0141] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0142] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0143] The computing unit 901 may be a variety of general and / or special 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 dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as a training method or a feature extraction method for a feature extraction model. For example, in some embodiments, the training method or the feature extraction method for a feature extraction model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the training method or the feature extraction method for the feature extraction model described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute a training method of a feature extraction model or a feature extraction method in any other suitable manner (eg, by means of firmware).
[0144] Various implementations 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 chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0145] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other training device for a programmable feature extraction model, so that the program code, when executed by the processor or controller, causes the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0146] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, 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 (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, voice input, or tactile input).
[0148] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0149] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0150] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0151] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for training a feature extraction model, comprising: Get initial training samples; Determine the target feature of the initial training sample, wherein the target feature includes a segmentation feature and a classification feature, the segmentation feature is used to characterize the feature information of the segmentation corresponding to the initial training sample, and the classification feature is 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.
2. The method according to claim 1, wherein: The determining of the target features of the initial training samples comprises: Determining classification category information according to the word segmentation features of the initial training sample; Labeling the initial training samples based on the classification category information to obtain labeled samples; Performing supervised training on the initial classification model based on the labeled samples to obtain a trained classification model; Generate classification features of the initial training samples based on the classification model.
3. The method according to claim 2, wherein: The determining of classification category information according to the word segmentation features of the initial training sample includes: Performing word segmentation processing on the initial training samples, and extracting corresponding word segmentation features from the processed word segments; Determining a target word segmentation feature from the word segmentation features based on the lift value of the word segmentation obtained by the processing; The classification category information is determined based on the target word segmentation feature.
4. The method according to claim 3, wherein: The performing word segmentation processing on the initial training sample includes: 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; The initial training samples are segmented according to the segmentation granularity.
5. The method according to claim 3, wherein: The step of determining a target word segmentation feature from the word segmentation features based on the word segmentation lift value obtained by the processing includes: Calculate the lift values corresponding to the word segments obtained by the processing to obtain a lift value set; Determine a lift value that meets a preset condition from the lift value set to obtain a target lift value; The word segmentation feature corresponding to the target lift value is determined as the target word segmentation feature.
6. The method according to claim 3, wherein: The step of labeling the initial training samples based on the classification category information to obtain labeled samples includes: Determining the segmented words corresponding to the classification category information from the segmented words obtained by the processing by using a keyword recall method; The target training sample is labeled with a category based on the classification category information to obtain the labeled sample, wherein the target training sample is an initial training sample corresponding to the determined word segmentation.
7. The method according to claim 6, wherein: The step of generating the classification features of the initial training samples based on the classification model includes: Randomly sampling the initial training samples to obtain sampling samples; The sampled samples are input into the classification model, and the classification features of the sampled samples are obtained as output.
8. The method according to claim 7, further comprising: In response to the sampling sample being the target training sample, comparing the classification feature of the sampling sample with the category labeling result of the sampling sample; In response to the comparison result being different, the category labeling result is corrected using the classification feature.
9. The method according to claim 1, wherein: The initial training sample is obtained by the following steps: Get the original sample data; The original sample data is preprocessed to obtain the initial training sample, wherein the preprocessing operation includes removing noise information, text processing and / or removing stop words.
10. A feature extraction method, comprising: Get the text to be extracted; The text to be extracted is input into a feature extraction model, and the target features of the text to be extracted are obtained as output, wherein the feature extraction model is trained according to any one of the methods of claims 1-9.
11. A training device for a feature extraction model, comprising: A sample acquisition module is configured to acquire initial training samples; A feature determination module is configured to determine a target feature of the initial training sample, wherein the target feature includes a word segmentation feature and a classification feature, the word segmentation feature is used to characterize feature information of the word segmentation corresponding to the initial training sample, and the classification feature is used to characterize feature information of the initial training sample corresponding to a preset classification category; The model training module is configured to train the initial model using the target features of the initial training samples to obtain a trained feature extraction model.
12. A feature extraction device, comprising: A 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 a feature extraction model and output a target feature of the text to be extracted, wherein the feature extraction model is trained according to the method described in any one of claims 1 to 9.
13. 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, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method of any one of claims 1-10.
15. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Webpage text classification method and device and webpage text identification method and device
CN107291723A
Text classification model training method, text classification method and device
CN116049400A
Dialogue feature representation method and device and model training method and device
CN116151834A
Semantic representation model-based text classification method and apparatus, and computer device
WO2021051503A1
