Method for predicting improper speech and storage medium

By integrating target classifiers from multiple machine learning models, the problem of low detection accuracy of existing censorship systems in complex text data and various types of negative speech is solved, achieving higher detection accuracy and stability, and adapting to complex text data and various types of negative speech.

CN120632101APending Publication Date: 2025-09-12LINGNAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510843820.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing censorship systems have low detection accuracy when faced with complex text data and diverse types of negative speech, making it difficult to effectively identify and handle inappropriate content.

Method used

A target classifier that integrates multiple target classification models is used to predict the comments to be predicted through machine learning classification models such as logistic regression, linear support vector machine and XGBoost. The prediction results of each model are fused through a preset integration strategy to determine the true label of the comment, including data preprocessing and feature extraction to generate TF-IDF vectors.

Benefits of technology

It improves the accuracy and stability of detection of complex text data and various types of negative speech, makes up for the limitations of a single model, and enhances the adaptability and robustness of multi-category and multi-label detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632101A_ABST
    Figure CN120632101A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine learning, in particular to an improper speech prediction method and a storage medium, and the method comprises the steps: obtaining a to-be-predicted comment and a target classifier; a plurality of target classification models are integrated in the target classifier; predicting the to-be-predicted comments through multiple target classification models in the target classifier, and obtaining prediction results of the multiple target classification models on different labels of the to-be-predicted comments; the labels comprise normal labels and various bad labels; and the target classifier fuses the prediction results of the multiple target classification models according to a preset integration strategy, and determines a real label corresponding to the comment to be predicted. The advantages of different models are fused by adopting a multi-model fusion strategy, so that the method is more suitable for complex text data and various bad speech types, and the problem that the detection accuracy is low when an existing review system faces the complex text data and the various bad speech types is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning technology, and in particular to a method for predicting inappropriate speech and a storage medium. Background Art

[0002] With the rapid development of the internet, the use of social media and online platforms has become increasingly popular. However, these platforms are also facing problems such as inappropriate content, hate speech, and explicit images, which seriously affect user experience and online security.

[0003] The traditional solution to this problem is to manually review and delete inappropriate content. Currently, automated review systems are often used to address this issue. Compared to traditional manual review, these systems can identify and address inappropriate content more quickly and promptly. However, these systems still have limitations, often resulting in low detection accuracy when faced with complex text data and a wide variety of offensive content. Summary of the Invention

[0004] In order to solve the problem that the existing review system has low detection accuracy when facing complex text data and various types of inappropriate speech, the present invention provides a prediction method and storage medium for inappropriate speech.

[0005] The solution to the technical problem of the present invention is to provide a method for predicting inappropriate speech, comprising the following steps: obtaining comments to be predicted and a target classifier; the target classifier integrates multiple target classification models; using the multiple target classification models in the target classifier to predict the comments to be predicted respectively, and obtaining prediction results of the multiple target classification models on different labels for the predicted comments; the labels include normal labels and multiple bad labels; the target classifier fuses the prediction results of the multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted.

[0006] Preferably, the target classifier is obtained through the following steps: obtaining a training set, dividing the training set into a preset number of subsets, and using one of the subsets as a test set and the remaining subsets as training subsets in each round of training according to a preset round; the training set includes inappropriate comments marked with different types of bad labels; obtaining multiple machine learning classification models, training each machine learning classification model separately through all training subsets in each round, and outputting the initial prediction results of the current round test set corresponding to different labels through the trained multiple machine learning classification models; the machine learning classification models include at least logistic regression, linear support vector machine, and XGBoost; determining the evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after the preset rounds of training; determining multiple initial target classification models from the multiple machine learning classification models based on the evaluation index values; the initial target classification models include XGBoost, logistic regression and linear support vector machine as initial target classification models; the classifier integrates multiple initial target classification models to obtain a target classifier.

[0007] Preferably, the evaluation index value of each machine learning classification model is determined based on the initial prediction results of multiple rounds obtained after preset rounds of training, specifically including: determining the initial evaluation index value corresponding to each machine learning classification model in each round based on the initial prediction results corresponding to the test set in each round; and taking the average of the initial evaluation index values ​​of each machine learning classification model in multiple rounds as the corresponding evaluation index value.

[0008] Preferably, the evaluation indicators include the harmonic mean and the area under the curve; determining the initial target classification model from a plurality of machine learning classification models according to the evaluation indicator values, specifically including: screening a plurality of machine learning classification models according to the ranking of the harmonic mean and the area under the curve, and determining the XGBoost, the logistic regression and the linear support vector machine as the initial target classification models.

[0009] Preferably, the classifier integrates the initial target classification model to obtain a target classifier, specifically including: the classifier fuses the initial prediction results of XGBoost, logistic regression and linear support vector machine on the test set according to a preset integration strategy to obtain an initial target prediction result; determines the initial target evaluation index value based on the fused initial target prediction result; if the initial target evaluation index value is greater than the evaluation index value corresponding to all single machine learning classification models, the initial target classifier is determined as the target classifier.

[0010] Preferably, before predicting the comments to be predicted respectively by multiple target classification models in the target classifier and obtaining the prediction results of the multiple target classification models on the comments to be predicted on different labels, the method also includes: performing data preprocessing and feature extraction on the comments to be predicted in sequence to obtain the TF-IDF vectors corresponding to the comments to be predicted.

[0011] Preferably, the preset integration strategy is one of a preset soft voting strategy, a preset hard voting strategy, and a preset stacking strategy.

[0012] Preferably, the preset integration strategy is a preset soft voting strategy; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: the target classifier performs probability weighting on the prediction probabilities of different labels corresponding to multiple target classification models according to preset weights to obtain the prediction weighted probabilities corresponding to the comment to be predicted on different labels; and takes the label corresponding to the maximum value of all prediction weighted probabilities as the true label of the comment to be predicted.

[0013] Preferably, the preset integration strategy is a preset hard voting strategy; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: determining the prediction label of each target classification model for the comment to be predicted according to the prediction result output by each target classification model; performing a majority vote on all the prediction labels of the comment to be predicted, and taking the prediction label with the highest number of votes as the true label of the comment to be predicted.

[0014] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for predicting inappropriate speech as described in any of the above items is implemented.

[0015] Compared with the prior art, the inappropriate speech prediction method and storage medium provided by the present invention have the following advantages: 1. An embodiment of the present invention provides a method for predicting inappropriate speech, comprising the following steps: obtaining a comment to be predicted and a target classifier; integrating multiple target classification models in the target classifier; predicting the comment to be predicted using the multiple target classification models in the target classifier, respectively, to obtain prediction results of the multiple target classification models on different labels for the predicted comment; the labels include normal labels and multiple inappropriate labels; the target classifier fuses the prediction results of the multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted. By integrating the prediction results of the multiple target classification models on different labels for the comment to be predicted using the preset integration strategy and determining the true label of the comment to be predicted, the advantages of different target classification models are fully utilized, and the different advantages of different models on different category labels are integrated, thereby making up for the limitations of a single model, making the target classifier more adaptable to complex text data and various types of inappropriate speech, thereby improving the accuracy and stability of the target classifier's prediction, and solving the problem of low detection accuracy of existing review systems when faced with complex text data and various types of inappropriate speech.

[0016] 2. The target classifier provided by the embodiment of the present invention is obtained by the following steps: obtaining a training set, dividing the training set into a preset number of subsets, and using one of the subsets as a test set and the remaining subsets as training subsets in each round of training according to a preset round; the training set includes inappropriate comments marked with different types of bad labels; obtaining multiple machine learning classification models, training each machine learning classification model separately through all training subsets in each round, and outputting the initial prediction results of the current round test set corresponding to different labels through the trained multiple machine learning classification models; the machine learning classification models include at least logistic regression, linear support vector machine, and XGBoost; determining the initial evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after the preset rounds of training; determining multiple initial target classification models from the multiple machine learning classification models based on the initial evaluation index values; the initial target classification models include XGBoost, logistic regression and linear support vector machine as initial target classification models; the classifier integrates multiple initial target classification models to obtain a target classifier. By using the same training set to train multiple machine learning classification models separately, the effectiveness of the preset integration strategy can be ensured on the basis of obtaining the different classification advantages of each machine learning classification model; and under the same test set, the same evaluation indicators can be determined to screen out machine learning classification models with better performance for integration, which is conducive to achieving the complementarity of error patterns of multiple machine learning classification models, thereby improving the robustness of the target classifier.

[0017] 3. The embodiment of the present invention provides a method for determining the evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after a preset round of training, specifically including: determining the initial evaluation index value corresponding to each machine learning classification model in each round based on the initial prediction results corresponding to the test set in each round; and taking the average of the initial evaluation index values ​​of each machine learning classification model in multiple rounds as the corresponding evaluation index value. By selecting different test sets in each round and training the training subsets, the average of the evaluation index values ​​of multiple rounds is finally used as the corresponding initial evaluation index value, realizing training and comprehensive evaluation after multiple rounds of data partitioning, reducing the evaluation fluctuation caused by the deviation of a single partition, and making the results of each machine learning classification model after training more stable.

[0018] 4. The embodiment of the present invention provides a method for determining an initial target classification model from multiple machine learning classification models based on evaluation index values, specifically including: screening multiple machine learning classification models based on the ranking of harmonic mean and area under the curve, and determining XGBoost, logistic regression, and linear support vector machine as the initial target classification model. By jointly using the harmonic mean and area under the curve to evaluate the performance of each machine learning classification model, machine learning classification models with better performance on these two indicators can be screened out, ensuring that the final target classifier can correctly classify the predicted comments while reducing misjudgments and missed judgments.

[0019] 5. The embodiment of the present invention provides that the classifier integrates the initial target classification model to obtain a target classifier, specifically including: the classifier fuses the initial prediction results of XGBoost, logistic regression and linear support vector machine on the test set according to a preset integration strategy to obtain an initial target prediction result; determines the initial target evaluation index value based on the fused initial target prediction result; if the initial target evaluation index value is greater than the initial evaluation index value corresponding to all single machine learning classification models, the initial target classifier is determined as the target classifier. By comparing the evaluation index value of the integrated initial target classifier with the optimal base model, it can be confirmed whether the performance improvement of the integrated initial target classifier is significant, thereby ensuring the accuracy and stability of the prediction performance of the integrated target classifier.

[0020] 6. The embodiment of the present invention provides a method for predicting the comments to be predicted respectively by using multiple target classification models in the target classifier, and obtaining the prediction probabilities of the multiple target classification models on different labels for the comments to be predicted. The method also includes: performing data preprocessing and feature extraction on the comments to be predicted in sequence to obtain the TF-IDF vectors corresponding to the comments to be predicted, thereby removing meaningless noise in the comments to be predicted, improving processing efficiency and avoiding overfitting, and converting the unstructured comments to be predicted into machine-understandable numerical signals through TF-IDF to more accurately measure the importance of words in the text, providing effective features for the target classification model prediction, and enabling the target classification model to identify malicious comments based on the vocabulary distribution pattern. 7. The preset integration strategy provided in the embodiment of the present invention is a preset soft voting strategy; the prediction result includes a prediction probability; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: the target classifier performs probability weighting on the prediction probabilities of different labels corresponding to multiple target classification models according to preset weights to obtain the prediction weighted probabilities corresponding to the comment to be predicted on different labels; the label corresponding to the maximum value of all prediction weighted probabilities is used as the true label of the comment to be predicted. The preset soft voting strategy can be used to achieve probability weighting of the prediction probabilities of all target classification models in the target classifier, so as to weight the confidence of different target classification models and capture subtle differences between categories with similar probabilities, so as to make the final prediction more accurate; in addition, the weights of different target classification models can be adjusted to improve the flexibility of the target classifier.

[0021] 8. The preset integration strategy provided in the embodiment of the present invention is a preset hard voting strategy; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: determining the prediction label of the comment to be predicted for each target classification model according to the prediction result output by each target classification model; performing a majority vote on all the prediction labels of the comment to be predicted, and taking the prediction label with the highest number of votes as the true label of the comment to be predicted. The preset hard voting strategy can be used to directly count the prediction results output by all target classification models in the target classifier, so as to determine the final prediction result by majority voting, thereby realizing a simple and efficient fusion of the different advantages of multiple models on different category labels, making up for the limitations of a single model; in addition, the hard voting strategy has a wider range of adaptability and is more suitable for scenarios where probabilities cannot be directly generated.

[0022] 9. The present invention also provides a computer-readable storage medium, which has the same beneficial effects as the above-mentioned method for predicting inappropriate speech, and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1 This is a flowchart of the steps of the method for predicting inappropriate speech provided by the first embodiment of the present invention.

[0025] Figure 2 This is the specific step flow of step S30 of the inappropriate speech prediction method provided by the second embodiment of the present invention. Figure 1 .

[0026] Figure 3 This is the specific step flow of step S30 of the inappropriate speech prediction method provided by the second embodiment of the present invention. Figure 2 . DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0028] Existing content moderation systems often rely on single models or simple rules, which have limited performance when faced with a wide variety of malicious comment types. First, datasets have significant class imbalance and multi-label correlation. Malicious comments, such as "toxic" and "insulting," account for a relatively low proportion of the total comments, making it difficult for a single model to achieve both high precision and high recall. Furthermore, the complexities of comment content, including multiple languages, HTML tags, and special characters, place higher demands on text preprocessing. Existing technologies also lack unified evaluation criteria, often focusing on a single metric and failing to fully reflect the actual effectiveness of multi-category, multi-label classification tasks.

[0029] Based on this, an embodiment of the present invention proposes a method for predicting inappropriate speech, which can realize multi-category and multi-label detection of the detection text and perform unified evaluation of the detection text. At the same time, it can adapt to complex text data and various types of inappropriate speech, thereby improving the accuracy and stability of the target classifier prediction, and solving the problem of low detection accuracy of the existing review system when facing complex text data and various types of inappropriate speech.

[0030] See also Figure 1 The first embodiment of the present invention provides a method for predicting inappropriate speech, comprising the following steps: S10: Obtain the comments to be predicted and a target classifier; the target classifier integrates multiple target classification models; Specifically, the target classifier can combine the prediction results of multiple target classification models to generate the final prediction result.

[0031] S20: Predicting the comments to be predicted respectively by using multiple target classification models in the target classifier, and obtaining prediction results of the multiple target classification models on different labels for the predicted comments; the labels include normal labels and multiple bad labels; Specifically, negative labels may include six types: toxic, severely toxic, obscene, threatening, insulting, and identity-based hatred. Normal labels are labels that comply with platform rules, have information value, and have no negative social impact, excluding negative labels. Each target classification model performs differently on different categories of labels. Therefore, all target classification models in the target classifier will predict the comments to be predicted separately to output the prediction results of each target classification model on different labels for the predicted comments. The prediction results can be the prediction probabilities on different labels or the predicted category labels. The specific output prediction results are determined by the target classification model.

[0032] S30: The target classifier fuses the prediction results of multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted.

[0033] It can be understood that by pre-setting the integration strategy, the prediction results of multiple target classification models on different labels of the predicted comments can be integrated to determine the true labels of the comments to be predicted, which can give full play to the advantages of different target classification models and integrate the different advantages of different models on different category labels, making up for the limitations of a single model, making the target classifier more adaptable to complex text data and various types of bad speech, thereby improving the accuracy and stability of the target classifier's prediction, and solving the problem of low detection accuracy of the existing review system when facing complex text data and various types of bad speech.

[0034] Furthermore, the target classifier is obtained by the following steps: S101: Obtain a training set, divide the training set into a preset number of subsets, and use one of the subsets as a test set and the remaining subsets as training subsets in each round of training according to a preset number of rounds; the training set includes inappropriate comments marked with different types of negative labels; Specifically, the training set is a text data consisting of a number of inappropriate comments marked with bad labels and normal comments marked with normal labels. The labels corresponding to the comments in the training set are correct labels. The training set can be obtained by pre-labeling the collected inappropriate comments and normal comments. Before model training, the training set can be divided into a preset number of subsets, and the preset number can be customized by the user and determined according to the actual model training situation. The inappropriate comments and normal comments in the training subsets are marked with corresponding labels, and the labels of the inappropriate comments and normal comments in the test set are not retained, that is, the comments in the test set do not have labels, which facilitates machine learning classification to predict the test set. The preset rounds are the number of rounds that the machine learning classification model needs to perform training iterations set in advance by the user. The preset rounds must be less than or equal to the preset number of divided subsets to ensure that in each round of training, different test sets are used for prediction under the premise of using all training subsets under the same training set for training.

[0035] Optionally, the preset number may be the same as the preset rounds, that is, the number of rounds required to train the machine learning classification model is the same as the preset rounds, so that the test set of each round is different, and each divided subset can be fully utilized, thereby ensuring the balance of training of each machine learning classification model.

[0036] S102: Obtain multiple machine learning classification models, train each machine learning classification model using all training subsets in each round, and output initial prediction results corresponding to different labels of the current round test set using the trained multiple machine learning classification models; the comments in the test set do not have labels, and the machine learning classification models include at least logistic regression, linear support vector machine, and XGBoost; Specifically, because different models have their own advantages in performing on different specific categories, the target classifier in this embodiment integrates multiple target classification models. Therefore, different types of machine learning classification models can be selected and independently trained using the same training set. Machine learning classification models can include logistic regression, linear support vector machine, XGBoost, and can also include multinomial naive Bayes, AdaBoost, GradientBoosting, and XGBoost.

[0037] For example, linear models such as Logistic Regression (LR) and Linear Support Vector Classifier (LinearSVC) can capture linearly separable patterns between text features and are good at processing high-dimensional sparse data.

[0038] Probabilistic model: Multinomial Naive Bayes (MultinomialNB), which can be used to model conditional probabilities based on word frequency, is sensitive to short texts, and is computationally efficient.

[0039] Tree models: AdaBoost, GradientBoosting, and XGBoost capture nonlinear relationships and feature interactions through residual fitting of multiple trees.

[0040] S103: Determine an evaluation index value for each machine learning classification model based on multiple rounds of initial prediction results obtained after a preset number of rounds of training; More specifically, the evaluation metrics include F1 Score (harmonic mean) and AUC (area under the ROC curve). F1 Score is the harmonic mean of precision and recall.

[0041] Precision is the percentage of comments that the model correctly predicted as "inappropriate" among all the comments it identified. Recall is the percentage of inappropriate comments that the model successfully identified among all the actual examples.

[0042] , , , TP (True Positive): The number of comments correctly predicted as "inappropriate." FP (False Positive): The number of legitimate comments incorrectly predicted as "inappropriate," a misclassification. FN (False Negative): The number of inappropriate comments incorrectly predicted as "valid," a misclassification. FN (True Negative): The number of legitimate comments correctly predicted as "valid."

[0043] It can be understood that the above-mentioned “inappropriate comments” are specifically comments whose predicted label category belongs to bad labels in the test set. The above-mentioned “normal comments” are specifically comments whose predicted label category belongs to normal labels in the test set.

[0044] Specifically, AUC can be calculated by first plotting the ROC curve based on the true positive rate (TPR) and the false positive rate (FPR), and then using numerical integration, such as the trapezoidal rule, to calculate the area under the curve. TPR = TP / (TP + FN), representing the ratio of predicted positive examples to all true positive examples. FPR = FP / (TN + FP), representing the ratio of predicted positive examples to all true negative examples. Positive examples are comments predicted to have a good label, while negative examples are comments predicted to have a bad label.

[0045] Alternatively, AUC can be obtained by first obtaining the predicted probability of each model for each sample in the test set belonging to each category label; then sorting the predicted probability of each model predicting all samples in the test set as normal labels from large to small, and assigning each sample a rank, with the rank of the sample with the highest probability being the total number of samples n, and descending in descending order. If the probabilities are the same, take the average rank. Assume the number of positive samples is M, the number of negative samples is N, and the sum of the ranks of the positive samples is S:

[0046] It should be noted that the test set for each round can be constructed by removing the original labels from one of the subsets of the training set. After multiple machine learning models predict the comments in the test set, the TP, FP, FN, and FN are determined based on the true labels of the comments in the original, unlabeled subset corresponding to the current test set. This allows the construction of a test set from a correctly labeled training set, facilitating subsequent verification of predictions on the test set and improving the accuracy of prediction verification.

[0047] S104: Determine multiple initial target classification models from multiple machine learning classification models according to the evaluation index value; the initial target classification models include XGBoost, logistic regression and linear support vector machine as initial target classification models; Specifically, based on the same evaluation indicators F1 Score and AUC, multiple machine learning classification models that meet user needs can be screened out from the multiple trained machine learning classification models as the initial target classification model. The initial target classification model retains the training parameters after training using the training set.

[0048] S105: The classifier integrates multiple initial target classification models to obtain a target classifier.

[0049] It can be understood that by dividing the same training set into subsets, multiple machine learning classification models are iteratively trained and verified for preset rounds, thus achieving cross-validation of multiple machine learning classification models, which is more conducive to comparing different machine learning classification models. By evaluating the models using the same evaluation indicators, machine learning classification models with better performance can be screened out for integration, which is conducive to achieving complementary error patterns of multiple machine learning classification models, thereby improving the robustness of the target classifier. In addition, using the same training set for training can ensure the effectiveness and consistency of the preset integration strategy based on the different classification advantages of each machine learning classification model; and under the same test set, the generalization ability of the model on unknown data is evaluated by the same determined evaluation indicators to avoid overfitting the training set. In addition, using the same training set to divide into subsets to train multiple machine learning classification models separately can make full use of all the comments in the training set and avoid losing key information due to a single division.

[0050] Furthermore, step S103 specifically includes: S1031: Determine an initial evaluation index value corresponding to each round of each machine learning classification model based on the initial prediction results corresponding to the test set in each round; Specifically, in each round, one of the subsets of the training set is used as the test set, while the remaining subsets are used as the training subsets. This means that each round requires a preset number of trainings minus one, followed by predictions on the corresponding test set. Initial prediction results corresponding to the test set are obtained, and the corresponding initial evaluation index values ​​can be determined based on these initial prediction results. In other words, each round of training will yield initial prediction results for each machine learning classification model on a test set, along with the corresponding initial evaluation index values.

[0051] S1032: Taking the average of the initial evaluation index values ​​of each machine learning classification model in multiple rounds as the corresponding evaluation index value.

[0052] It can be understood that by selecting different test sets in each round and training the training subsets, multiple machine learning models will obtain the same number of initial evaluation index values ​​as the preset rounds after iterative training. By using the average of the evaluation index values ​​of multiple rounds as the corresponding initial evaluation index value, training and comprehensive evaluation after multiple rounds of data partitioning are achieved, reducing the evaluation fluctuations caused by the deviation of a single partition, and making the results of each machine learning classification model after training more stable. In addition, by determining the initial evaluation index value through multiple rounds of "training-validation" cycles, it can reflect the generalization ability of each machine learning classification model on unknown data, avoid overfitting the training set, and make the final evaluation result closer to the true generalization ability of the model.

[0053] Furthermore, step S104 specifically includes: S1041: Screen multiple machine learning classification models according to the ranking of the harmonic mean and the area under the curve, and determine that the XGBoost, the logistic regression, and the linear support vector machine are the initial target classification models.

[0054] Understandably, the higher the F1 Score, the less misjudgments and the more real positive examples can be identified. Especially when the categories are unbalanced, such as when the proportion of malicious comments is low, the F1 Score can more comprehensively evaluate the predictive ability of the model than a single indicator. AUC can evaluate the model's ability to distinguish between positive and negative classes. The higher the AUC value, the stronger the model's ability to sort positive and negative samples, and the more suitable it is for malicious comment detection scenarios. Therefore, in this embodiment, the two types of evaluation indicators, F1 Score and AUC, are used to jointly evaluate multiple machine learning classification models to screen out models that can accurately classify under multi-label and multi-task conditions and stably distinguish between bad labels and normal labels within the full threshold range, as well as models that can handle category imbalance and avoid the "false high AUC trap", such as high AUC but poor actual classification effect.

[0055] Specifically, the models are sorted according to the size of the harmonic mean and the area under the curve, and the models with the highest harmonic mean and the highest area under the curve are selected. That is, XGBoost, logistic regression and linear support vector machine are selected as the initial target classification models for integration, so that the final target classifier can combine the advantages of linear models and tree models to ensure that the final target classifier can adapt to complex text data and various types of bad speech, and can accurately classify the predicted comments while reducing misjudgments and missed judgments.

[0056] Optionally, if faced with data category imbalance, or if the model needs to focus more on the classification and ranking capabilities of the predicted comments on different labels, the area under the curve can be selected as the initial target evaluation indicator value and compared with the area under the curve in the initial evaluation indicator values ​​corresponding to all single machine learning classification models, so as to evaluate whether the screened model meets the requirements after fusion under the preset integration strategy.

[0057] Furthermore, step S105 specifically includes: S1051: The classifier fuses the initial prediction results of XGBoost, logistic regression, and linear support vector machine on the test set according to a preset integration strategy to obtain an initial target prediction result; Specifically, the initial prediction result can be the predicted probability of each sample in all test sets being predicted as different category labels and the corresponding TP, FP, FN, TN by XGBoost, logistic regression and linear support vector machine in all training rounds in the cross-validation stage.

[0058] S1052: Determine an initial target evaluation index value based on the fused initial target prediction result; Specifically, the initial target evaluation index value is the average value of the evaluation index values ​​of the initial target prediction results after the fusion corresponding to all test sets in the cross-validation stage, and the average value includes the respective average values ​​of the harmonic mean and the area under the curve. That is, the classifier will obtain an initial target prediction result corresponding to each test set, and determine the average value of the harmonic mean and the average value of the area under the curve according to each initial target classification result. The initial target evaluation index value can directly reflect the classification prediction ability of the integrated classifier to texts with different labels. In the determination stage of the target classifier, the initial prediction results of XGBoost, logistic regression and linear support vector machine on the test set are integrated and fused using the same preset integration strategy as in step S30. And the corresponding initial target evaluation index value is calculated based on the initial target prediction result after fusion. That is, the corresponding harmonic mean and area under the curve are calculated based on the TP, FP, FN and TN obtained. Specifically, after the model screening is completed and XGBoost, logistic regression and linear support vector machine are determined as the initial target classification models, the predictive classification performance of the classifier is also evaluated by the harmonic mean and the area under the curve, so as to ensure that the final integrated target classifier can correctly classify different categories of bad labels and reduce misjudgments and missed judgments.

[0059] S1053: If the initial target evaluation index value is greater than the initial evaluation index values ​​corresponding to all single machine learning classification models, the initial target classifier is determined as the target classifier.

[0060] Specifically, to ensure the classification performance of the target classification type of the final integration, the harmonic mean and area under the curve of the initial target classifier integrated by XGBoost, logistic regression and linear support vector machine need to be compared with the initial evaluation index values ​​of each single machine learning classification model in the cross-validation stage to ensure that the integrated target classifier has a classification performance that is significantly better than any single model.

[0061] It can be understood that by comparing the initial evaluation index values ​​of the integrated classifier with the optimal base model, it can be confirmed whether the classification performance of the classifier integrated according to the preset integration strategy is significantly improved, thereby ensuring the accuracy and stability of the prediction classification performance of the integrated target classifier, so that the final integrated target classifier can accurately distinguish the label type of the predicted text, adapt to the situation of category imbalance, and better balance misjudgment and missed judgment.

[0062] Optionally, in this embodiment, only the average value of the fused harmonic mean may be used as the final evaluation indicator for comparison with a single model. This evaluation indicator is insensitive to category imbalance and can more objectively reflect the comprehensive distinguishing ability of the final classifier.

[0063] Furthermore, before step S20, the method further includes: S11: Perform data preprocessing and feature extraction on the comments to be predicted in sequence to obtain the TF-IDF vector corresponding to the comments to be predicted.

[0064] Specifically, data preprocessing includes data cleaning, word segmentation and lemmatization, and stop word and short word filtering. For comments containing HTML tags or multilingual content, this preprocessing step effectively filters out noise, ensuring the quality of the text for subsequent analysis. For example, if the input comment to be predicted is "You're such a moron! [emoji] Go die!!! #HATE"`, after data preprocessing, the result is ["moron", "hate"].

[0065] Specifically, feature extraction involves calculating the frequency of feature words using CountVectorizer on preprocessed data, then calculating the TF-IDF value of the feature word frequency using TfidfVectorizer, and finally generating the corresponding feature vector. This allows for more accurate measurement of the importance of words in a text by selecting the most appropriate method for calculating the weight of feature words based on the characteristics of the text.

[0066] For example: Total number of documents: 1000 comments; The frequency of characteristic words is: moron appears in 20 comments, with an IDF value of log(1000 / 20)≈3.91; Hate appears in 150 comments, with an IDF value of log(1000 / 150)≈1.90; TF-IDF value of the current feature word frequency: moron appears once in the current comment, TF=1, TF-IDF=1×3.91=3.91; hate appears once in the current comment, TF=1, TF-IDF=1×1.90=1.90; Eigenvectors: Dictionary mapping: If moron corresponds to index 5, hate corresponds to index 20, and the dimensions of other words are 0: The eigenvector representation is: [0, 0, 0, 0, 0, 3.91, ... 0, 1.90, ...].

[0067] It should be noted that when each model is trained separately, the comments in the training set need to be converted into corresponding TF-IDF feature vectors and corresponding multi-labels, and then input into each machine learning classification model for training, so as to learn the associated weights of features and labels. Before all target classification models in the target classifier predict the comments to be predicted, they also need to perform data preprocessing and feature extraction on the comments to be predicted in turn to obtain TF-IDF vectors. Therefore, no matter which model of this application is in the training stage or the actual prediction stage after the training is completed, the comments will be converted into corresponding TF-IDF feature vectors before the model is trained or predicted. Thus, the TF-IDF vector is obtained by first using CountVectorizer to calculate the word frequency and then using TfidfVectorizer to calculate the TF-IDF weight. Compared with the single vectorization method, this combined method takes into account the word frequency information and the word importance measurement, so that the features can better reflect the semantic value of the text.

[0068] Furthermore, the preset integration strategy is one of a preset soft voting strategy, a preset hard voting strategy, and a preset stacking strategy.

[0069] Specifically, the preset soft voting strategy is to pre-set preset weights for each target classification model in the target classifier, and perform weighted averaging on the prediction probabilities of the comprehensive models of each category label for the predicted comments according to the preset weights, thereby obtaining the final prediction result with higher accuracy. The preset hard voting strategy is to directly count the category label voting results of each model, which is simple to implement and has high computational efficiency. The preset stacking strategy is to input the prediction results of the base model as new features into the meta-model, usually logistic regression, XGBoost, etc., which is specifically used to input the prediction results of the base model into the meta-model and make the final decision, so that the final model effect is better than a single model.

[0070] As you can understand, by setting up multiple ensemble strategies, you can choose different ensemble strategies to suit different prediction and classification needs. For example, if you need faster prediction results for comments, you can choose the preset hard voting strategy; if you need more accurate prediction results, you can choose the preset soft voting strategy. You can choose the strategy based on the specific situation.

[0071] As an optional implementation of a preset integration strategy, the preset integration strategy in this implementation is a preset soft voting strategy; See also Figure 2 Step S30 specifically includes: S301: The target classifier performs probability weighting on the prediction probabilities of different labels corresponding to multiple target classification models according to preset weights to obtain the prediction weighted probabilities corresponding to the comments to be predicted on different labels; Specifically, the preset weights can be set and adjusted by the user based on actual usage, or based on the AUC and F1Score of each machine learning classification model after cross-validation training. Alternatively, after the initial target classification model is determined through screening, the preset weights of the preset ensemble strategy used in step S1051 can be used to determine the preset weights of step S301.

[0072] Optionally, in step S1051, different test groups can be set, and at least two of the preset weights of XGBoost, logistic regression and linear support vector machines in each test group are different, so as to obtain initial target evaluation index values ​​under different preset weights in multiple test groups, compare the multiple initial target evaluation index values ​​with the initial evaluation index values ​​corresponding to all single machine learning classification models, screen out initial target evaluation index values ​​that are greater than all single machine learning classification models, and determine the highest initial target evaluation index value among the screened multiple initial target evaluation index values, and use the preset weight corresponding to the highest initial target evaluation index value as the preset weight in step S301.

[0073] More specifically, in step S20, the target classification model, namely logistic regression, linear support vector machine, and XGBoost will predict the comments to be predicted respectively, and output the predicted probabilities of the comments to be predicted on different labels respectively; step S301 will perform probability weighting on the probabilities of the same label output by logistic regression, linear support vector machine, and XGBoost respectively to output the predicted weighted probability of the label.

[0074] For example, weights=[0.5, 0.2, 0.3]), the weight of logistic regression is 0.5; the weight of linear support vector machine is 0.2; and the weight of XGBoost is 0.3.

[0075] The predicted probability of each class label output by logistic regression is: [0.8, 0.2]-(toxic, clean); Linear support vector machine: [0.7, 0.3]; XGBoost: [0.6, 0.4].

[0076] Then the corresponding predicted weighted probability of different labels = (0.5*[0.8, 0.2])+(0.2*[0.7, 0.3])+(0.3*[0.6, 0.4])=[0.71, 0.29]; The final probability of the toxic label is 0.71, and the probability of the clean label is 0.29.

[0077] S302: The label corresponding to the maximum value among all predicted weighted probabilities is used as the true label of the comment to be predicted.

[0078] Specifically, the greater the predicted weighted probability, the greater the possibility that the corresponding predicted comment will be correctly classified into this label. Therefore, after obtaining the predicted weighted probabilities of the comments to be predicted on different category labels, all predicted weighted probabilities are sorted, and the label corresponding to the predicted weighted probability with the highest value in the top ranking is used as the true label of the comment to be predicted. In this way, by presetting a soft voting strategy, the predicted probabilities of multiple target classification models can be probability weighted, and the prediction results of multiple models can be integrated to improve the overall classification accuracy and stability. In addition, the classification ability of the integrated model can be higher than that of any single model. In addition, it can also achieve error complementarity in the classification of multiple models. For example, logistic regression is good at capturing high-frequency words, such as idiot; XGBoost is more sensitive to low-frequency combinations such as go die; and after integration, it can cover a more comprehensive range of malicious patterns.

[0079] It can be understood that by presetting the soft voting strategy, the prediction probabilities of all target classification models in the target classifier can be weighted, so as to weight the confidence of different target classification models and capture the subtle differences between categories with similar probabilities, so as to make the final prediction more accurate. In addition, the weights of different target classification models can be adjusted to improve the flexibility of the target classifier.

[0080] It should be noted that different target classification models will output predicted probabilities or predicted labels when predicting the text to be predicted. Therefore, whether using a preset soft voting strategy or a hard voting strategy, the prediction results must be unified. Specifically, if a soft voting strategy outputs a predicted label, the predicted label must be converted to a predicted probability. Similarly, if a hard voting strategy outputs a predicted probability, the predicted probability must be converted to a predicted label. This facilitates the final prediction.

[0081] As another optional implementation of the preset integration strategy, the preset integration strategy in this implementation is a preset hard voting strategy; See also Figure 3 Step S30 specifically includes: S311: Determine the prediction labels of each target classification model for the to-be-predicted comments based on the prediction results output by each target classification model; Specifically, when using the preset hard voting strategy ensemble, the predicted probabilities must first be converted into predicted labels. For example, if the logistic regression predicts a comment with the highest probability when the negative label is toxic - 0.85, then toxic can be considered the predicted label for the comment.

[0082] S312: Perform a majority vote on all predicted labels of the comment to be predicted, and use the predicted label with the highest number of votes as the true label of the comment to be predicted.

[0083] Specifically, after determining the predicted label for the comment to be predicted from the target classifiers XGBoost, logistic regression, and linear support vector machine, a majority vote is performed on the predicted labels, with the highest-voted predicted label being output as the true label for the comment to be predicted. For example, if the predicted label output by logistic regression is "toxic," the predicted label output by the linear support vector machine is "toxic," and the predicted label output by XGBoost is "clean," the final result is a ratio of toxic:clean = 2:1, and the final label for the comment to be predicted is "toxic."

[0084] It can be understood that by presetting the hard voting strategy, direct statistics of the prediction results output by all target classification models in the target classifier can be achieved, so that the final prediction result can be determined by majority voting, which realizes the fusion of the different advantages of multiple different models on different category labels in a simple and efficient way, making up for the limitations of a single model; in addition, the hard voting strategy has a wider range of adaptability and is more suitable for scenarios where probabilities cannot be generated directly.

[0085] A second embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting inappropriate speech described in any one of the first embodiments is implemented.

[0086] In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information.

[0087] It should be understood that references to "one embodiment" or "an embodiment" throughout this specification mean that specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "in one embodiment" or "in an embodiment" appearing throughout this specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present invention.

[0088] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0089] The flow charts and block diagrams in the accompanying drawings of the present invention illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementation schemes, the functions marked in the box can also occur in a different order than those marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which is determined based on the functions involved. It should be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0090] Compared with the prior art, the inappropriate speech prediction method and storage medium provided by the present invention have the following advantages: 1. An embodiment of the present invention provides a method for predicting inappropriate speech, comprising the following steps: obtaining a comment to be predicted and a target classifier; integrating multiple target classification models in the target classifier; predicting the comment to be predicted using the multiple target classification models in the target classifier, respectively, to obtain prediction results of the multiple target classification models on different labels for the predicted comment; the labels include normal labels and multiple inappropriate labels; the target classifier fuses the prediction results of the multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted. By integrating the prediction results of the multiple target classification models on different labels for the comment to be predicted using the preset integration strategy and determining the true label of the comment to be predicted, the advantages of different target classification models are fully utilized, and the different advantages of different models on different category labels are integrated, thereby making up for the limitations of a single model, making the target classifier more adaptable to complex text data and various types of inappropriate speech, thereby improving the accuracy and stability of the target classifier's prediction, and solving the problem of low detection accuracy of existing review systems when faced with complex text data and various types of inappropriate speech.

[0091] 2. The target classifier provided by the embodiment of the present invention is obtained by the following steps: obtaining a training set, dividing the training set into a preset number of subsets, and using one of the subsets as a test set and the remaining subsets as training subsets in each round of training according to a preset round; the training set includes inappropriate comments marked with different types of bad labels; obtaining multiple machine learning classification models, training each machine learning classification model separately through all training subsets in each round, and outputting the initial prediction results of the current round test set corresponding to different labels through the trained multiple machine learning classification models; the machine learning classification models include at least logistic regression, linear support vector machine, and XGBoost; determining the initial evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after the preset rounds of training; determining multiple initial target classification models from the multiple machine learning classification models based on the initial evaluation index values; the initial target classification models include XGBoost, logistic regression and linear support vector machine as initial target classification models; the classifier integrates multiple initial target classification models to obtain a target classifier. By using the same training set to train multiple machine learning classification models separately, the effectiveness of the preset integration strategy can be ensured on the basis of obtaining the different classification advantages of each machine learning classification model; and under the same test set, the same evaluation indicators can be determined to screen out machine learning classification models with better performance for integration, which is conducive to achieving the complementarity of error patterns of multiple machine learning classification models, thereby improving the robustness of the target classifier.

[0092] 3. The embodiment of the present invention provides a method for determining the evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after a preset round of training, specifically including: determining the initial evaluation index value corresponding to each machine learning classification model in each round based on the initial prediction results corresponding to the test set in each round; and taking the average of the initial evaluation index values ​​of each machine learning classification model in multiple rounds as the corresponding evaluation index value. By selecting different test sets in each round and training the training subsets, the average of the evaluation index values ​​of multiple rounds is finally used as the corresponding initial evaluation index value, realizing training and comprehensive evaluation after multiple rounds of data partitioning, reducing the evaluation fluctuation caused by the deviation of a single partition, and making the results of each machine learning classification model after training more stable.

[0093] 4. The embodiment of the present invention provides a method for determining an initial target classification model from multiple machine learning classification models based on evaluation index values, specifically including: screening multiple machine learning classification models based on the ranking of harmonic mean and area under the curve, and determining XGBoost, logistic regression, and linear support vector machine as the initial target classification model. By jointly using the harmonic mean and area under the curve to evaluate the performance of each machine learning classification model, machine learning classification models with better performance on these two indicators can be screened out, ensuring that the final target classifier can correctly classify the predicted comments while reducing misjudgments and missed judgments.

[0094] 5. The embodiment of the present invention provides that the classifier integrates the initial target classification model to obtain a target classifier, specifically including: the classifier fuses the initial prediction results of XGBoost, logistic regression and linear support vector machine on the test set according to a preset integration strategy to obtain an initial target prediction result; determines the initial target evaluation index value based on the fused initial target prediction result; if the initial target evaluation index value is greater than the initial evaluation index value corresponding to all single machine learning classification models, the initial target classifier is determined as the target classifier. By comparing the evaluation index value of the integrated initial target classifier with the optimal base model, it can be confirmed whether the performance improvement of the integrated initial target classifier is significant, thereby ensuring the accuracy and stability of the prediction performance of the integrated target classifier.

[0095] 6. The embodiment of the present invention provides a method for predicting the comments to be predicted respectively by using multiple target classification models in the target classifier, and obtaining the prediction probabilities of the multiple target classification models on different labels for the comments to be predicted. The method also includes: performing data preprocessing and feature extraction on the comments to be predicted in sequence to obtain the TF-IDF vectors corresponding to the comments to be predicted, thereby removing meaningless noise in the comments to be predicted, improving processing efficiency and avoiding overfitting, and converting the unstructured comments to be predicted into machine-understandable numerical signals through TF-IDF to more accurately measure the importance of words in the text, providing effective features for the target classification model prediction, and enabling the target classification model to identify malicious comments based on the vocabulary distribution pattern. 7. The preset integration strategy provided in the embodiment of the present invention is a preset soft voting strategy; the prediction result includes a prediction probability; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: the target classifier performs probability weighting on the prediction probabilities of different labels corresponding to multiple target classification models according to preset weights to obtain the prediction weighted probabilities corresponding to the comment to be predicted on different labels; the label corresponding to the maximum value of all prediction weighted probabilities is used as the true label of the comment to be predicted. The preset soft voting strategy can be used to achieve probability weighting of the prediction probabilities of all target classification models in the target classifier, so as to weight the confidence of different target classification models and capture subtle differences between categories with similar probabilities, so as to make the final prediction more accurate; in addition, the weights of different target classification models can be adjusted to improve the flexibility of the target classifier.

[0096] 8. The preset integration strategy provided in the embodiment of the present invention is a preset hard voting strategy; the target classifier fuses the prediction results of multiple target classification models according to the preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: determining the prediction label of the comment to be predicted for each target classification model according to the prediction result output by each target classification model; performing a majority vote on all the prediction labels of the comment to be predicted, and taking the prediction label with the highest number of votes as the true label of the comment to be predicted. The preset hard voting strategy can be used to directly count the prediction results output by all target classification models in the target classifier, so as to determine the final prediction result by majority voting, thereby realizing a simple and efficient fusion of the different advantages of multiple models on different category labels, making up for the limitations of a single model; in addition, the hard voting strategy has a wider range of adaptability and is more suitable for scenarios where probabilities cannot be directly generated.

[0097] 9. The present invention also provides a computer-readable storage medium, which has the same beneficial effects as the above-mentioned method for predicting inappropriate speech, and will not be described in detail here.

[0098] The above is a detailed introduction to a method for predicting inappropriate speech and a storage medium disclosed in an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention. Any modifications, equivalent replacements and improvements made within the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for predicting inappropriate speech, characterized by: The following steps are involved: Obtaining comments to be predicted and a target classifier; the target classifier integrates multiple target classification models; Using multiple target classification models in the target classifier to predict the comments to be predicted, respectively, to obtain prediction results of the multiple target classification models on different labels for the predicted comments; the labels include normal labels and multiple bad labels; The target classifier fuses the prediction results of multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted.

2. The method for predicting inappropriate speech according to claim 1, wherein: The target classifier is obtained by the following steps: Obtaining a training set, dividing the training set into a preset number of subsets, and using one of the subsets as a test set and the remaining subsets as training subsets in each round of training according to a preset number of rounds; the training set includes inappropriate comments marked with different types of negative labels; Obtain multiple machine learning classification models, train each machine learning classification model separately using all training subsets in each round, and output initial prediction results corresponding to different labels of the current round test set using the trained multiple machine learning classification models; the machine learning classification models include at least logistic regression, linear support vector machine, and XGBoost; Determine the evaluation index value of each machine learning classification model based on the initial prediction results of multiple rounds obtained after a preset number of rounds of training; Determining multiple initial target classification models from a plurality of machine learning classification models according to the evaluation index value; the initial target classification models include XGBoost, logistic regression and linear support vector machine as initial target classification models; The classifier integrates multiple initial target classification models to obtain a target classifier.

3. The method for predicting inappropriate speech according to claim 2, wherein: The evaluation index values ​​of each machine learning classification model are determined based on the initial prediction results of multiple rounds obtained after the preset rounds of training, including: Determine the initial evaluation index value of each machine learning classification model in each round based on the initial prediction results corresponding to the test set in each round; The average of the initial evaluation index values ​​of each machine learning classification model in multiple rounds is taken as the corresponding evaluation index value.

4. The method for predicting inappropriate speech according to claim 3, wherein: The evaluation indicators include harmonic mean and area under the curve; Determining an initial target classification model from a plurality of machine learning classification models based on the evaluation index value, specifically including: A plurality of machine learning classification models were screened according to the ranking of the harmonic mean and the area under the curve, and the XGBoost, the logistic regression, and the linear support vector machine were determined as the initial target classification models.

5. The method for predicting inappropriate speech according to claim 3, wherein: The classifier integrates the initial target classification model to obtain a target classifier, which specifically includes: The classifier fuses the initial prediction results of XGBoost, logistic regression and linear support vector machine on the test set according to a preset integration strategy to obtain an initial target prediction result; Determine the initial target evaluation index value based on the fused initial target prediction results; If the initial target evaluation index value is greater than the evaluation index values ​​corresponding to all single machine learning classification models, the initial target classifier is determined as the target classifier.

6. The method for predicting inappropriate speech according to claim 1, wherein: Before respectively predicting the comments to be predicted by using multiple target classification models in the target classifier and obtaining prediction results of the multiple target classification models on different labels for the comments to be predicted, the method further includes: Data preprocessing and feature extraction are performed on the comments to be predicted in sequence to obtain the TF-IDF vector corresponding to the comments to be predicted.

7. The method for predicting inappropriate speech according to claim 5, wherein: The preset integration strategy is one of a preset soft voting strategy, a preset hard voting strategy, and a preset stacking strategy.

8. The method for predicting inappropriate speech according to claim 7, wherein: The preset integration strategy is a preset soft voting strategy; The target classifier fuses the prediction results of multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: The target classifier performs probability weighting on the prediction probabilities of different labels corresponding to the multiple target classification models according to preset weights to obtain the corresponding prediction weighted probabilities of the comments to be predicted on different labels; The label corresponding to the maximum value of all predicted weighted probabilities is taken as the true label of the comment to be predicted.

9. The method for predicting inappropriate speech according to claim 8, wherein: The preset integration strategy is a preset hard voting strategy; The target classifier fuses the prediction results of multiple target classification models according to a preset integration strategy to determine the true label corresponding to the comment to be predicted, specifically including: Determine the prediction labels of each target classification model for the to-be-predicted comments based on the prediction results output by each target classification model; A majority vote is performed on all predicted labels of the comment to be predicted, and the predicted label with the highest number of votes is used as the true label of the comment to be predicted.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for predicting inappropriate speech according to any one of claims 1 to 9 is implemented.