Text data processing method and device, equipment, storage medium and program product
By clustering and correcting the initial predictions of large models, and utilizing cluster labels and actions, the problem of large model illusion is solved, thus improving the accuracy of text data prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-07
AI Technical Summary
Large models are prone to the "big model illusion" during text data prediction, resulting in lower accuracy of the output prediction results.
The initial prediction results of the target model are clustered, and the initial prediction results are corrected using cluster labels and execution actions in the preset state matrix to determine the final prediction results.
This improves the accuracy of the model's predictions within the preset non-compliance range, ensuring the accuracy and reliability of the output results.
Smart Images

Figure CN121808747A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of artificial intelligence, and particularly relates to a text data processing method and device, equipment, a storage medium and a program product. BACKGROUND
[0002] With the popular application of large model technology in various working scenarios, the working efficiency in various working scenarios is greatly improved. The large model has top-level information insight editing capability and performs outstandingly in pattern recognition and inference and many other fields.
[0003] However, in the process of predicting based on text data, the large model is prone to large model hallucination, that is, the content predicted by the large model seems smooth and reasonable, but actually does not conform to the input information or is incorrect information contrary to known facts. As such, the accuracy of the prediction result output by the large model is low. SUMMARY
[0004] The embodiments of the present application provide a text data processing method, device, equipment, storage medium and program product, which can improve the accuracy of the prediction result of the model.
[0005] In a first aspect, the embodiments of the present application provide a text data processing method, comprising: obtaining an initial prediction result of a target model based on text data; in the case that the initial prediction result is in a preset unqualified interval, performing clustering processing on the text data and training data of the target model to obtain a clustering label of the text data, wherein the preset unqualified interval is a preset probability interval in which the prediction result accuracy is lower than a preset threshold value; determining a target execution action in a preset state matrix according to the clustering label and the initial prediction result, wherein the preset state matrix includes a combination data set of each clustering label and each prediction result, and an execution action corresponding to each combination data set; the execution action in the preset state matrix is obtained by training the prediction result of the target model and real label data corresponding to the training data; correcting the initial prediction result by using the target execution action to determine a final prediction result.
[0006] In a possible implementation manner, the step of correcting the initial prediction result by using the target execution action to determine a final prediction result comprises: in the case that the target execution action is a first execution action, modifying the initial prediction result to obtain the final prediction result; in the case that the target execution action is a second execution action, taking the initial prediction result as the final prediction result.
[0007] In one possible implementation, determining the target action in a preset state matrix according to the clustering labels and the initial prediction results includes: Multiple candidate actions are determined in the preset state matrix according to the clustering labels and the initial prediction results; Obtain the score for each candidate action; The candidate action with the highest score is selected as the target action.
[0008] In one possible implementation, before clustering the text data and the training data of the target model to obtain the clustering labels of the text data when the initial prediction result is in a preset unqualified range, the method further includes: Obtain the sample prediction results of the target model on the training data; Based on the preset probability interval in which the prediction result of each sample falls, determine the training data corresponding to each preset probability interval; For each preset probability interval, the prediction result of the sample that is the same as the real label data corresponding to the training data is taken as the correct prediction result; For each preset probability interval, the proportion of correct prediction results is calculated to obtain the proportion of correct results; For each preset probability interval, if the proportion of correct results is less than a preset proportion threshold, the preset probability interval is regarded as the unqualified probability interval. The preset non-compliance interval is constructed based on the non-compliance probability interval.
[0009] In one possible implementation, before determining the target action in a preset state matrix according to the clustering labels and the initial prediction results, the method further includes: The training data is clustered to obtain multiple cluster labels; An initial learning matrix is constructed based on the cluster labels and the sample prediction results of the target model. The first column of the initial learning matrix represents the combined dataset of each cluster label and each sample prediction result, the second column represents the score of the first execution action, and the third column represents the score of the second execution action. For each row in the initial learning matrix, determine the cluster label, prediction result, and old score of the action to be performed according to the corresponding combined dataset; Obtain the target training dataset according to the clustering labels and the prediction results; For each sample group in the target training dataset, obtain the real label data corresponding to the sample group; The action score is determined based on the real label data and the sample prediction results corresponding to the sample group; The updated score for each executed action is calculated based on the action score, the preset discount factor, the preset learning rate, the old score, and the maximum score of the old score. The initial learning matrix is updated according to the update score of each executed action to obtain the preset state matrix.
[0010] In one possible implementation, after updating the initial learning matrix according to the update score of each executed action to obtain the preset state matrix, the method further includes: The sample prediction results are adjusted according to the preset state matrix to obtain the first prediction result; If the accuracy of the first prediction result is less than the accuracy of the sample prediction result, the learning rate and discount factor in the action value function learning algorithm are adjusted according to a preset step size to obtain the target learning rate and target discount factor. The adjustment score for each action is calculated based on the target learning rate and the target discount factor. The preset state matrix is updated according to the adjusted score.
[0011] In one possible implementation, before obtaining the sample prediction results of the target model on the training data, the method further includes: Obtain basic training data; The training data is standardized and cleaned to obtain the basic data. Feature extraction is performed on the basic data to obtain derived feature data; The derived feature data and the basic data are concatenated to obtain the training data.
[0012] Secondly, embodiments of this application provide a text data processing apparatus, comprising: The acquisition module is used to obtain the initial prediction results of the target model based on text data; The clustering module is used to perform clustering processing on the text data and the training data of the target model when the initial prediction result is in a preset unqualified interval, so as to obtain the clustering label of the text data. The preset unqualified interval is a preset probability interval where the prediction result accuracy is lower than a preset threshold. The determination module is used to determine the target execution action in a preset state matrix according to the clustering labels and the initial prediction results. The preset state matrix includes a combined dataset of each clustering label and each prediction result, and an execution action corresponding to each combined dataset. The execution actions in the preset state matrix are obtained by training using the prediction results of the target model and the real label data corresponding to the training data. The determining module is further configured to correct the initial prediction result using the target's execution action, and determine the final prediction result.
[0013] Thirdly, embodiments of this application provide an electronic device, the device comprising: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the text data processing method as described in any one of the first aspects.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the text data processing method as described in any one of the first aspects.
[0015] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform the text data processing method as described in any of the first aspects.
[0016] This application discloses a method, apparatus, device, storage medium, and program product for text data processing. It obtains the initial prediction result of a target model based on text data, and then performs clustering operations on the text data and training data when the initial prediction result falls within a preset unacceptable range. Within the preset unacceptable range, the accuracy of the target model's output result is low. Therefore, by performing clustering operations on the text data and training data, a target execution action is determined in a preset state matrix according to the cluster labels and the initial prediction result. The preset state matrix stores a combined dataset of each cluster label and each prediction result, as well as the execution action corresponding to each combined dataset. Each execution action is trained using the real label data corresponding to the prediction result and the training data. In this way, the initial prediction result can be corrected according to the target execution action, thereby improving the accuracy of the prediction result. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a text data processing method according to an embodiment of this application; Figure 2 This is a flowchart illustrating an action determination method according to an embodiment of this application; Figure 3 This is a flowchart illustrating a method for determining a preset state matrix according to an embodiment of this application; Figure 4 This is a flowchart illustrating a preset state matrix update method provided in one embodiment of this application; Figure 5 This is an exemplary schematic diagram of a text data processing method provided in one embodiment of this application; Figure 6 This is a schematic diagram of the structure of a text data processing apparatus provided in one embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0019] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0021] It should be noted that the acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.
[0022] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0023] To address the problems of the prior art, embodiments of the present invention provide a method, apparatus, device, storage medium, and program product for text data processing.
[0024] The text data processing method provided in the embodiments of the present invention will be described below.
[0025] Figure 1 A flowchart illustrating a text data processing method according to an embodiment of the present invention is shown. This method is applied to electronic devices, such as… Figure 1 As shown, the method may include the following steps: S101. Obtain the initial prediction results of the target model based on text data.
[0026] The target model can be pre-trained based on actual business needs. Specifically, the target model can be a statistical model, a machine learning model, or a rule engine, etc., which are not large-scale models.
[0027] The initial prediction result is the confidence level output by the target model, with a value ranging from 0 to 1. After obtaining the confidence level of the initial prediction result, the electronic device determines whether the confidence level is greater than 0.5. If the confidence level is greater than 0.5, the corresponding value of the initial prediction result is set to 1; otherwise, if the confidence level is less than or equal to 0.5, the corresponding value of the initial prediction result is set to 0.
[0028] In one example, the text data may include data on multiple basic metrics, such as the user's age, gender, tax payment, etc., and the initial prediction result represents the user's probability of default.
[0029] S102. If the initial prediction result is in the preset unqualified range, perform clustering processing on the text data and the training data of the target model to obtain the clustering labels of the text data.
[0030] The preset non-compliance range can be pre-set according to the actual business scenario. For example, the preset non-compliance range is 0.2-0.8. This application embodiment does not impose specific restrictions on the preset non-compliance range.
[0031] After adding the text data to the clustering space of the training data, the electronic device calculates the Euclidean distance between the text data and each cluster center, adds the text data to the cluster with the closest Euclidean distance, and uses the cluster label of that cluster as the cluster label of the text data. Then, the electronic device recalculates the cluster centers based on the text data and the data in that cluster.
[0032] S103. Determine the target action in the preset state matrix according to the clustering labels and initial prediction results.
[0033] The preset state matrix includes a combined dataset of each cluster label and each prediction result, as well as the execution action corresponding to each combined dataset. The execution actions in the preset state matrix are obtained by training the target model using the prediction results and the real label data corresponding to the training data.
[0034] In one example, the cluster labels include label 1, label 2, and label 3, and the prediction results include 0 and 1. The resulting combined dataset includes [label 1, 0], [label 2, 0], [label 3, 0], [label 1, 1], [label 2, 1], and [label 3, 1].
[0035] The execution action includes a first execution action and a second execution action. The first execution action is to modify the prediction result, and the second execution action is to maintain the prediction result.
[0036] S104. Correct the initial prediction result by using the target's execution action to determine the final prediction result.
[0037] Specifically, the values corresponding to the initial prediction results determined by the aforementioned electronic device are corrected by using the target execution action.
[0038] Specifically, the initial prediction result corresponds to a value of 0 or 1. The electronic device determines whether to modify the value corresponding to the initial prediction result based on the target's execution action. If the target's execution action is "change," then the value corresponding to the initial prediction result is modified. If the target's execution action is "do not change," then the value corresponding to the initial prediction result remains unchanged.
[0039] Using the above method, the initial prediction results of the target model based on text data are obtained. Then, if the initial prediction results fall within a preset unacceptable range, clustering is performed on the text data and training data. Within the preset unacceptable range, the accuracy of the target model's output results is low. Therefore, by clustering the text data and training data, the target execution action is determined in a preset state matrix according to the cluster labels and the initial prediction results. The preset state matrix stores the combined dataset of each cluster label and each prediction result, as well as the execution action corresponding to each combined dataset. Furthermore, each execution action is trained using the real label data corresponding to the prediction results and training data. In this way, the values corresponding to the initial prediction results can be calibrated according to the target execution action, thereby improving the accuracy of the prediction results.
[0040] Regarding S103 above, the target action is determined in the preset state matrix according to the clustering labels and initial prediction results. Specifically, this can be implemented as S1031-S1033, such as... Figure 2 As shown: S1031. Determine multiple candidate actions to be executed in the preset state matrix according to the clustering labels and the initial prediction results.
[0041] The electronic device constructs a state vector [clustering label, initial prediction result] by using clustering labels and initial prediction results. Then, it searches for the same combination dataset in the preset state matrix according to the state vector to obtain the target combination dataset, obtains the execution action of the target combination dataset, and obtains multiple candidate execution actions and the score of each candidate execution action.
[0042] S1032. Obtain the score for each candidate action.
[0043] As shown in Table 1, Table 1 provides an example of the target combination dataset and its corresponding execution actions and scores: Table 1 Among them, changing it to the first execution action and not changing it to the second execution action is compared. and The action with the highest score is selected as the target action.
[0044] S1033, Select the candidate action with the highest score as the target action.
[0045] Using the method provided in this application embodiment, multiple candidate execution actions can be found in the preset state matrix according to the clustering labels and the initial prediction results. Each candidate execution action corresponds to a score. By taking the candidate execution action with the highest score as the target execution action, the value of the initial prediction result is subsequently corrected according to the target execution action, thereby improving the accuracy of the prediction results.
[0046] Regarding S104 above, the initial prediction result is corrected using the target execution action to determine the final prediction result, which can be specifically implemented as follows: If the target action is the first action to be executed, the initial prediction result is modified to obtain the final prediction result.
[0047] The first action is a "change" action, which corrects the value corresponding to the initial prediction result from a first value to a second value. In one example, the first value can be 1 and the second value can be 0; this application does not impose any restrictions on this.
[0048] If the target action is the second action, the initial prediction result will be used as the final prediction result.
[0049] Using the method provided in this application, when the target execution action is the first execution action, it indicates that the accuracy of the initial prediction result is low. The initial prediction result is modified from a first value to a second value. It can be understood that the initial prediction result is either 0 or 1; the first value can be 1, and the second value can be 0. Thus, modifying the initial prediction result using a preset state matrix improves the accuracy of the prediction result. When the target execution action is the second execution action, it indicates that the accuracy of the current initial prediction result is high; therefore, the initial prediction result is directly used as the final prediction result.
[0050] In some embodiments of this application, before performing clustering processing on the text data and the training data of the target model to obtain the clustering labels of the text data in S102, where the initial prediction result is in a preset unqualified range, the method further includes: Step 1: Obtain the target model's sample prediction results for the training data.
[0051] The sample prediction result is represented by the confidence level. The confidence level ranges from 0 to 1.
[0052] Step 2: Determine the training data corresponding to each preset probability interval based on the preset probability interval in which the prediction result of each sample is located.
[0053] The preset probability interval is obtained by dividing the range of confidence values according to a preset step size. For example, if the preset step size is 0.2, the preset probability interval includes [0, 0.2), [0.2-0.4), [0.4-0.6), [0.6-0.8), and [0.8-1].
[0054] In one example, for training data 1, the sample prediction result is 0.5, and the preset probability interval of the sample prediction result is [0.4-0.6]. Therefore, the preset probability interval corresponding to training data 1 is [0.4-0.6].
[0055] Step 3: For each preset probability interval, the prediction result of the sample that is the same as the real label data corresponding to the training data is taken as the correct prediction result.
[0056] Step 4: For each preset probability interval, calculate the proportion of correct prediction results to obtain the proportion of correct results.
[0057] Specifically, for each preset probability interval, the ratio of the number of correct prediction results to the total number of prediction results corresponding to that preset probability interval is calculated to obtain the correct result ratio.
[0058] Step 5: For each preset probability interval, if the proportion of correct results is less than the preset proportion threshold, the preset probability interval is taken as the unqualified probability interval.
[0059] The preset ratio threshold is set in advance based on the actual business scenario.
[0060] Step 6: Construct a preset non-compliance interval based on the non-compliance probability interval.
[0061] Specifically, the electronic device calculates the union of the non-compliance probability intervals to obtain the preset non-compliance probability interval.
[0062] The method provided in this application determines the preset probability interval in which the prediction result of each sample falls, wherein the preset probability interval is divided according to a preset step size. Then, the proportion of correct results corresponding to each preset probability interval is calculated. Thus, the accuracy of the target model's prediction results in each preset probability interval can be determined by the proportion of correct results. This determines whether further correction is needed for the prediction results in that preset probability interval, thereby ensuring the accuracy of the prediction results.
[0063] The following combination Figure 3 This section introduces the method for constructing the preset state matrix, such as... Figure 3 As shown, the method includes S301-S308: S301. Cluster the training data to obtain multiple cluster labels.
[0064] In the data preparation phase, electronic devices acquire training preparation data, and then perform standardization and data cleaning on the training preparation data to obtain basic data.
[0065] Specifically, the training data preparation includes multiple sample groups, each containing data corresponding to multiple basic indicators. For each basic indicator, the mean and standard deviation are calculated. For each basic indicator in each data set, the corresponding mean is subtracted from the data for that basic indicator, and then divided by the standard deviation to achieve standardization. Data cleaning is achieved by removing sample groups with missing data.
[0066] In one example, taking the assessment of customer default risk in a financial scenario as an example, the training preparation data collected is shown in Table 2: Table 2 Among them, indicators - These are the basic indicators, corresponding to age, gender, income, tax payment, etc. Each column in Table 2 represents a sample group. Indicates the breach of contract. When the value is 1, it indicates that the customer has defaulted. When the value is 0, it means that the customer has not defaulted.
[0067] After standardizing and cleaning the data shown in Table 2 above, the basic data is obtained. .in, Indicates the number of sample groups. This indicates the quantity of basic indicators.
[0068] For each sample group in the basic data, the basic data is processed again based on feature engineering methods. Methods such as cross-multiplication, difference calculation, second-order difference, polynomial combination, and exponential transformation are used to obtain derived feature data for each sample group. This derived feature data is then concatenated with the basic data to obtain the training data. .
[0069] In this way, after standardizing and cleaning the training data, more features can be extracted from the sample group data through feature engineering methods, which greatly enriches the source of feature data and makes it easier for the target model to extract various types of information from the sample group, thereby improving the model's prediction performance.
[0070] After obtaining the training data, the electronic device uses the training data to train the target model. The target model can be constructed using the LightGBM model, or it can be replaced by other machine learning models such as XGBoost or Random Forest. This application embodiment does not impose specific limitations on this. The target model extracts and analyzes the correlation between the training data and the real label data through gradient operations. After the model reaches its optimum on the data gradient, the training is complete.
[0071] After obtaining the sample prediction results using the target model, training data in which the sample prediction results fall within a preset unqualified range are obtained, and then the electronic device performs clustering processing on the training data.
[0072] S302. Construct an initial learning matrix based on the cluster labels and the sample prediction results of the target model.
[0073] In the initial learning matrix, the first column represents the combined dataset of each cluster label and each sample prediction result, the second column represents the score of the first execution action, and the third column represents the score of the second execution action.
[0074] In one example, with 10 cluster labels, the initial learning matrix is shown in Table 3: Table 3 The first column represents the combined dataset, while the second and third columns represent the two execution actions. Taking the first row of the initial learning matrix as an example: For a combined dataset with a cluster label of 1 and a sample prediction result of 0, "change" means modifying the current sample prediction result to 1, with a corresponding score of 0, while "do not change" means keeping the current sample prediction result at 0, with a corresponding score of 0.
[0075] S303. For each row in the initial learning matrix, determine the cluster label, prediction result, and old score of the action to be performed according to the corresponding combined dataset.
[0076] S304. Obtain the target training dataset according to the clustering labels and prediction results.
[0077] First, the first training dataset corresponding to the cluster label is found in the training data. Then, the second training dataset with the same sample prediction result and the prediction result in the combined dataset is found in the first training dataset. The second training dataset is used as the target training dataset.
[0078] S305. For each sample group in the target training dataset, obtain the corresponding real label data of the sample group.
[0079] The target training dataset includes multiple sample groups, and each sample group includes data on multiple basic metrics.
[0080] S306. Determine the action score based on the real label data and the sample prediction results corresponding to the sample group.
[0081] Specifically, when the actual label data and the sample prediction results are the same, the action score for the "no change" action is 100, and the action score for the "change" action is 0. Conversely, when the actual label data and the sample prediction results are different, the action score for the "no change" action is 0, and the action score for the "change" action is 100.
[0082] S307. Calculate the updated score for each executed action based on the action score, preset discount factor, preset learning rate, old score, and the maximum score of the old score.
[0083] S308. Update the initial learning matrix according to the update score of each executed action to obtain the preset state matrix.
[0084] For each row of the initial learning matrix, an updated score is calculated for each action based on the action score from the training data, the discount factor, the learning rate, the old score for each action, and the maximum old score. Thus, when updating the action score using the next set of samples, the updated score calculated in the previous round is used as the old score for this round.
[0085] Specifically, the score for each action is updated using the following formula: ; in, This indicates the updated score. This represents the old score before the update. This represents the learning rate, which can be preset based on experience. Indicates the score for the action. This represents the maximum score among the old scores.
[0086] In response to the above If the sample prediction result is 0 and the true label data of the training data is 1, then the score for the "no change" action is 0, and the score for the "change" action is 100. When calculating the update score for the "no change" action, the above... The value is 0. When calculating the update score for the "change" action, the above... The value is 100.
[0087] In one example The initial scores for the corresponding actions are all 0, and the updated scores are calculated as follows: Combined datasets The score corresponding to "no change" is updated to 10.
[0088] Update score for the "change" action 0, Combined dataset And the score corresponding to "change" remains 0.
[0089] For combined datasets The scores after one round of updates are shown in Table 4: The method provided in this application involves clustering training data to obtain multiple cluster labels. A combined dataset is then constructed using each cluster label and the prediction result of each sample. An action value function learning algorithm is then used to calculate the reward score after performing an action on the prediction result of each combined dataset, thereby determining whether performing the action can improve the accuracy of the prediction result. The resulting preset state matrix stores the execution action corresponding to each combined dataset, as well as the benefit of improving the accuracy of the prediction result after performing each action. This facilitates subsequent correction of the prediction result based on the score of each execution action, thus ensuring the accuracy of the prediction result.
[0090] In some embodiments of this application, after step S303 above, where the scores of the first and second executed actions in the initial learning matrix are iteratively updated using an action value function learning algorithm to obtain a preset state matrix, the method further includes steps S401-S404, such as... Figure 4 As shown: S401. Adjust the sample prediction results according to the preset state matrix to obtain the first prediction result.
[0091] S402. If the accuracy of the first prediction result is less than the accuracy of the sample prediction result, adjust the learning rate and discount factor in the action value function learning algorithm according to the preset step size to obtain the target learning rate and target discount factor.
[0092] Understandably, improper settings of the learning rate and discount factor can lead to a decrease in the accuracy of the first prediction result. Therefore, the learning rate and discount factor are fine-tuned through the large model algorithm. The learning rate and discount factor are adjusted according to the preset step size to obtain a variety of combinations of learning rate and discount factor.
[0093] S403. Calculate the adjusted score based on the target learning rate and the target discount factor.
[0094] Specifically, the electronic device adjusts the action value function learning algorithm according to a combination of various learning rates and discount factors, and adjusts the preset state matrix according to the adjusted updated action value function learning algorithm. The sample prediction results are then adjusted using the adjusted preset state matrix to obtain a second prediction result. If the accuracy of the second prediction result is higher than the accuracy of the sample prediction result, a target learning rate and a target discount factor are determined. The action value function learning algorithm is then adjusted according to the target learning rate and the target discount factor to obtain an updated action value function learning algorithm. An adjusted score is then calculated using the adjusted updated action value function learning algorithm.
[0095] The preset step size is set based on experience; for example, the preset step size can be 0.05.
[0096] It should be noted that during the above fine-tuning process, when multiple combinations of learning rates and discount factors result in a second prediction result that is more accurate than the sample prediction result, the combination of learning rate and discount factor that provides the highest accuracy improvement is taken as the target learning rate and target discount factor.
[0097] Furthermore, during the aforementioned fine-tuning process, if the combination of learning rate and discount factor results in the accuracy of the second prediction result being higher than a preset threshold, it indicates that the combination of learning rate and discount factor is close to the optimal combination, and the electronic device stops the aforementioned fine-tuning process.
[0098] S404. Update the preset state matrix according to the adjustment score.
[0099] Using the method provided in this application, after adjusting the sample prediction results using a preset state matrix to obtain a first prediction result, the electronic device judges the accuracy of the first prediction result. If the accuracy of the first prediction result is less than the accuracy of the sample prediction result, it indicates that the accuracy of the relevant parameters in the above-mentioned action value function learning algorithm is insufficient. By adjusting the relevant parameters in the action value function learning algorithm, the computational accuracy of the action value function learning algorithm is improved. Thus, by adjusting the learning rate and discount factor in the action value function learning algorithm according to a preset step size, a target learning rate and a target discount factor are obtained, thereby ensuring that after updating the preset state matrix using the target learning rate and target discount factor, a more accurate prediction result is obtained.
[0100] The following combination Figure 5 This application introduces a method for processing text data, such as... Figure 5 As shown: In this process, after acquiring the training preparation data, the electronic device uses feature engineering methods to standardize the training preparation data, thereby obtaining the training data.
[0101] The training data is input into the model for fitting and training to obtain the target model. The training data is then input into the reinforcement learning optimization strategy module to construct a preset state matrix. The reinforcement learning optimization strategy module inputs the preset state matrix into the target model to adjust the sample prediction results.
[0102] The target model feeds back the sample prediction results and the first prediction result adjusted according to the preset state matrix to the large model algorithm module. The large model algorithm module fine-tunes the learning rate and discount factor, and sends the adjusted learning rate and discount factor to the reinforcement learning optimization strategy module so that the reinforcement learning optimization strategy module can update the preset state matrix. The reinforcement learning optimization strategy module sends the updated preset state matrix to the target model. The target model adjusts the sample prediction results according to the updated preset state matrix and sends the adjusted second prediction result to the large model algorithm module so that the large model algorithm module can dynamically judge whether the setting of the learning rate and discount factor is reasonable. This process is repeated until the preset state matrix is updated according to the fine-tuned target learning rate and target discount factor. The target model then adjusts the sample prediction results according to the updated preset state matrix to obtain a second prediction result with higher accuracy than the sample prediction result. The large model algorithm module then stops fine-tuning the learning rate and discount factor.
[0103] After receiving new sample data (text data), the electronic device inputs the new sample data into the target model to obtain an initial prediction result. Then, it uses a preset state matrix stored locally to adjust the initial prediction result to obtain an accurate prediction result.
[0104] Based on the same concept, embodiments of this application provide a text data processing apparatus, such as... Figure 6 As shown, the device includes: The acquisition module 601 is used to acquire the initial prediction results of the target model based on text data; Clustering module 602 is used to perform clustering processing on the text data and the training data of the target model when the initial prediction result is in a preset unqualified interval, to obtain the clustering label of the text data, wherein the preset unqualified interval is a preset probability interval where the prediction result accuracy is lower than a preset threshold. The determining module 603 is used to determine the target execution action in a preset state matrix according to the clustering labels and the initial prediction results. The preset state matrix includes a combined dataset of each clustering label and each prediction result, and an execution action corresponding to each combined dataset. The execution actions in the preset state matrix are obtained by training using the prediction results of the target model and the real label data corresponding to the training data. The determining module 603 is further configured to correct the initial prediction result using the target execution action to determine the final prediction result.
[0105] In one possible implementation, module 603 is specifically used for: If the target action is the first action, the initial prediction result is modified to obtain the final prediction result; If the target action is the second action, the initial prediction result is used as the final prediction result.
[0106] In one possible implementation, module 603 is specifically used for: Multiple candidate actions are determined in the preset state matrix according to the clustering labels and the initial prediction results; Obtain the score for each candidate action; The candidate action with the highest score is selected as the target action.
[0107] In one possible implementation, the device further includes: The acquisition module 601 is further configured to acquire the sample prediction results of the target model on the training data; The determination module 603 is also used to determine the training data corresponding to each preset probability interval based on the preset probability interval in which the prediction result of each sample is located. The determination module 603 is also used to, for each preset probability interval, take the sample prediction result that is the same as the real label data corresponding to the training data as the correct prediction result; The calculation module is used to calculate the proportion of correct prediction results for each preset probability interval, and obtain the proportion of correct results; The determining module 603 is further configured to, for each preset probability interval, if the proportion of correct results is less than a preset proportion threshold, designate the preset probability interval as an unqualified probability interval. A construction module is used to construct the preset non-compliance interval based on the non-compliance probability interval.
[0108] In one possible implementation, the device further includes: The clustering module is used to cluster the training data to obtain multiple cluster labels; The building module is also used to build an initial learning matrix based on the cluster labels and the sample prediction results of the target model. The first column of the initial learning matrix represents the combined dataset of each cluster label and each sample prediction result, the second column represents the score of the first execution action, and the third column represents the score of the second execution action. The determination module 603 is also used to determine the clustering label, prediction result, and old score of the action to be performed for each row in the initial learning matrix according to the corresponding combined dataset; The acquisition module 601 is further configured to acquire the target training dataset according to the clustering labels and the prediction results; The acquisition module 601 is also used to acquire the real label data corresponding to each sample group in the target training dataset. The determining module 603 is further configured to determine the action score based on the real label data and the sample prediction results corresponding to the sample group; The calculation module is used to calculate the updated score for each executed action based on the action score, the preset discount factor, the preset learning rate, the old score, and the maximum score of the old score. The update module is used to update the initial learning matrix according to the update score of each executed action to obtain the preset state matrix.
[0109] In one possible implementation, the device further includes: An adjustment module is used to adjust the sample prediction result according to the preset state matrix to obtain a first prediction result; The adjustment module is also used to adjust the learning rate and discount factor in the action value function learning algorithm according to a preset step size when the accuracy of the first prediction result is less than the accuracy of the sample prediction result, so as to obtain the target learning rate and target discount factor. The adjustment module is also used to calculate the adjustment score for each action based on the target learning rate and the target discount factor; An update module is used to update the preset state matrix according to the adjusted score.
[0110] In one possible implementation, before obtaining the sample prediction results of the target model on the training data, the apparatus further includes: The acquisition module 601 is also used to acquire basic training data; The processing module is used to perform standardization and data cleaning on the training base data to obtain base data; The feature extraction module is used to extract features from the basic data to obtain derived feature data; The splicing module is used to splice the derived feature data and the basic data to obtain the training data.
[0111] This application provides various modules of a text data processing apparatus, which can realize... Figure 1This provides the functionality for each step of the text data processing method and enables it to achieve the corresponding technical effects. For the sake of brevity, these details will not be elaborated here.
[0112] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0113] The electronic device 700 may include a processor 701 and a memory 702 storing computer program instructions.
[0114] Specifically, the processor 701 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0115] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 702 may include removable or non-removable (or fixed) media. Where appropriate, memory 702 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 702 is non-volatile solid-state memory.
[0116] In certain embodiments, the memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Thus, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.
[0117] The processor 701 implements any of the text data processing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 702.
[0118] In some examples, the electronic device 700 may also include a communication interface 703 and a bus 704. For example, Figure 7 As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 704 and complete communication with each other.
[0119] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0120] Bus 704 includes hardware, software, or both, that couples components of an electronic device together. For example, and not as a limitation, bus 704 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 704 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0121] For example, the electronic device 700 can be a mobile phone, tablet computer, laptop computer, handheld computer, in-vehicle electronic device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc.
[0122] The electronic device 700 can execute the text data processing method in the embodiments of this application, thereby achieving the combination Figure 1 and Figure 6 The methods and apparatus described herein are for processing text data.
[0123] In addition, in conjunction with the text data processing methods in the above embodiments, this application also provides a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the text data processing methods in the above embodiments. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0124] This application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, they implement any of the text data processing methods described in the above embodiments.
[0125] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0126] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0127] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0128] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0129] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method for text data processing, characterized in that, include: Obtain the initial prediction results of the target model based on text data; If the initial prediction result is in a preset unqualified interval, the text data and the training data of the target model are clustered to obtain the clustering label of the text data. The preset unqualified interval is a preset probability interval where the prediction result accuracy is lower than a preset threshold. The target action is determined in a preset state matrix according to the clustering labels and the initial prediction results. The preset state matrix includes a combined dataset of each clustering label and each prediction result, and an action corresponding to each combined dataset. The action in the preset state matrix is obtained by training the target model using the prediction results and the real label data corresponding to the training data. The initial prediction result is corrected by using the target execution action to determine the final prediction result.
2. The method according to claim 1, characterized in that, The step of correcting the initial prediction result using the target execution action to determine the final prediction result includes: If the target action is the first action, the initial prediction result is modified to obtain the final prediction result; If the target action is the second action, the initial prediction result is used as the final prediction result.
3. The method according to claim 1, characterized in that, The step of determining the target action in the preset state matrix according to the clustering labels and the initial prediction results includes: Multiple candidate actions are determined in the preset state matrix according to the clustering labels and the initial prediction results; Obtain the score for each candidate action; The candidate action with the highest score is selected as the target action.
4. The method according to claim 1, characterized in that, Before performing clustering processing on the text data and the training data of the target model to obtain the clustering labels of the text data when the initial prediction result is in a preset unqualified range, the method further includes: Obtain the sample prediction results of the target model on the training data; Based on the preset probability interval in which the prediction result of each sample falls, determine the training data corresponding to each preset probability interval; For each preset probability interval, the prediction result of the sample that is the same as the real label data corresponding to the training data is taken as the correct prediction result; For each preset probability interval, the proportion of correct prediction results is calculated to obtain the proportion of correct results; For each preset probability interval, if the proportion of correct results is less than a preset proportion threshold, the preset probability interval is regarded as the unqualified probability interval. The preset non-compliance interval is constructed based on the non-compliance probability interval.
5. The method according to claim 1, characterized in that, Before determining the target action in the preset state matrix according to the clustering labels and the initial prediction results, the method further includes: The training data is clustered to obtain multiple cluster labels; An initial learning matrix is constructed based on the cluster labels and the sample prediction results of the target model. The first column of the initial learning matrix represents the combined dataset of each cluster label and each sample prediction result, the second column represents the score of the first execution action, and the third column represents the score of the second execution action. For each row in the initial learning matrix, determine the cluster label, prediction result, and old score of the action to be performed according to the corresponding combined dataset; Obtain the target training dataset according to the clustering labels and the prediction results; For each sample group in the target training dataset, obtain the real label data corresponding to the sample group; The action score is determined based on the real label data and the sample prediction results corresponding to the sample group; The updated score for each executed action is calculated based on the action score, the preset discount factor, the preset learning rate, the old score, and the maximum score of the old score. The initial learning matrix is updated according to the update score of each executed action to obtain the preset state matrix.
6. The method according to claim 5, characterized in that, After updating the initial learning matrix according to the update score of each executed action to obtain the preset state matrix, the method further includes: The sample prediction results are adjusted according to the preset state matrix to obtain the first prediction result; If the accuracy of the first prediction result is less than the accuracy of the sample prediction result, the learning rate and the discount factor are adjusted according to a preset step size to obtain the target learning rate and the target discount factor. The adjustment score for each action is calculated based on the target learning rate and the target discount factor. The preset state matrix is updated according to the adjusted score.
7. The method according to claim 4, characterized in that, Before obtaining the sample prediction results of the target model on the training data, the method further includes: Obtain basic training data; The training data is standardized and cleaned to obtain the basic data. Feature extraction is performed on the basic data to obtain derived feature data; The derived feature data and the basic data are concatenated to obtain the training data.
8. A text data processing apparatus, characterized in that, include: The acquisition module is used to obtain the initial prediction results of the target model based on text data; The clustering module is used to perform clustering processing on the text data and the training data of the target model when the initial prediction result is in a preset unqualified interval, so as to obtain the clustering label of the text data. The preset unqualified interval is a preset probability interval where the prediction result accuracy is lower than a preset threshold. The determination module is used to determine the target execution action in a preset state matrix according to the clustering labels and the initial prediction results. The preset state matrix includes a combined dataset of each clustering label and each prediction result, and an execution action corresponding to each combined dataset. The execution actions in the preset state matrix are obtained by training using the prediction results of the target model and the real label data corresponding to the training data. The determining module is further configured to correct the initial prediction result using the target's execution action, and determine the final prediction result.
9. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the text data processing method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the text data processing method as described in any one of claims 1-7.
11. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device is able to perform the text data processing method as described in any one of claims 1-7.