Class prediction model training and class prediction method and device, storage medium and program product
By dividing text lengths and sorting the training samples, a category prediction model containing a semantic information extraction layer and at least two-level category prediction layer was trained, which solved the problem of different accuracy and insufficient generalization capabilities in the prediction of posts of different lengths, and achieved higher prediction accuracy and generalization capabilities.
Patent Information
- Application Number
- CN202411999513.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
When existing category prediction models process posts of different lengths, there are large differences in the accuracy of prediction results, and the generalization ability of the model is poor.
Model training is performed to obtain the target category prediction model by dividing the training samples into training subsets of the same length range according to the text length and randomly sorting these subsets. The model includes a semantic information extraction layer and at least two-level category prediction layer. Through loss calculation and network parameter adjustment, the accuracy and generalization ability of the model are improved.
It effectively improves the accuracy of the model in making category predictions for posts of different lengths, enhances the generalization ability of the model, and ensures the consistency and reliability of the results of category predictions.
Smart Images

Figure CN119918697A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a category prediction model training and category prediction method, device, storage medium and program product. Background Art
[0002] In the post publishing area, users need to manually select which category the post belongs to when posting, which is a cumbersome process. Especially in the field of housekeeping services, there are a large number of categories. Users sometimes do not know which categories their posts belong to, and thus give up posting because the posting process is too long.
[0003] In this regard, with the continuous development of artificial intelligence technology, the category prediction model can be used to predict the category of the post based on the content of the post to be published. Before using the model, historical posts with rich text content are selected from the historical post texts, and then the selected historical posts are used as training samples for model training to obtain a category prediction model. However, the accuracy of the results of the existing trained models for category prediction for posts of different lengths varies greatly, and the model generalization ability is poor. Summary of the invention
[0004] Multiple aspects of the present application provide a category prediction model training and category prediction method, device, storage medium and program product to avoid large differences in the results of the model's category prediction for posts of different lengths, while improving the accuracy of the model's category prediction results for posts of different lengths and improving the generalization ability of the model.
[0005] The embodiment of the present application provides a category prediction model training method, comprising: obtaining multiple training samples, each training sample corresponding to at least two levels of category annotation results; according to the text lengths of the multiple training samples, dividing the training samples whose text lengths are within the same length range into the same training subset to obtain multiple training subsets, and different training subsets correspond to different length ranges; randomly sorting the multiple training subsets, and training an initial category prediction model according to the target training samples in each training subset after the random sorting, so as to obtain prediction results of at least two levels of categories corresponding to each target training sample; the initial category prediction model at least includes a semantic information extraction layer and at least two levels of category prediction layers, and the prediction results of at least two levels of categories are at least two levels of category prediction layers. The prediction layer predicts the target training samples according to the semantic information extracted by the semantic information extraction layer from the target training samples; the loss on the same-level categories is calculated according to the labeling results and prediction results of the same-level categories corresponding to each target training sample to obtain the loss function on at least two-level categories; the comprehensive loss function is calculated according to the loss function on at least two-level categories; according to the comprehensive loss function, the network parameters of the semantic information extraction layer and the at least two-level category prediction layer in the initial category prediction model are adjusted until the comprehensive loss function meets the model training termination condition to obtain the intermediate category prediction model; the semantic information extraction layer in the intermediate category prediction model is copied and spliced to obtain a target category prediction model that at least includes multiple semantic information extraction layers and at least two-level category prediction layers connected in sequence.
[0006] The embodiment of the present application also provides a category prediction method, including: obtaining text content of a category to be predicted; when the length of the text content is greater than a text length threshold supported by a target category prediction model, dividing the text content into at least two text segments, the length of each text segment being no greater than the text length threshold; the target category prediction model includes at least a plurality of semantic information extraction layers and at least two levels of category prediction layers; inputting the at least two text segments into the at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information; the at least two semantic information extraction layers are semantic information extraction layers selected from the plurality of semantic information extraction layers and are the same in number as the at least two text segments; generating target semantic information corresponding to the text content based on the at least two semantic information; inputting the target semantic information into the at least two levels of category prediction layers to predict at least two levels of categories to obtain at least two levels of categories corresponding to the text content.
[0007] An embodiment of the present application also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program; the processor is coupled to the memory and is used to execute the computer program to implement the steps in the above method.
[0008] An embodiment of the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the steps in the above method.
[0009] An embodiment of the present application also provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the processor is enabled to implement the steps in the above method.
[0010] In an embodiment of the present application, training samples in the same length range are divided into the same training subset, and training subsets of different length ranges are shuffled, and target training samples are selected from each shuffled training subset to train the initial category prediction model, rather than training the initial category prediction model according to a rule of length range from small to large or from large to small. This can not only avoid the problem of large differences in the results of category prediction for posts of different lengths made by the trained model, but also improve the accuracy of the category prediction results of the trained model for posts of different lengths, and improve the generalization ability of the trained model. In the process of model training, the loss calculation on the same-level category is performed according to the labeling results and prediction results of the same-level category corresponding to each target training sample, and the network parameters of the semantic information extraction layer and each-level category prediction layer are adjusted to improve the calculation accuracy of each network layer and the prediction accuracy of the model; further, the comprehensive loss function can be calculated according to the loss function on at least two levels of categories, and the network parameters of the semantic information extraction layer and each-level category prediction layer in the initial category prediction model are further adjusted according to the comprehensive loss function until the comprehensive loss function meets the model training termination condition to obtain the intermediate category prediction model, thereby greatly improving the accuracy of the prediction model. Further, according to the network parameters of the trained semantic information extraction layer, the semantic information extraction layer in the intermediate category prediction model can be copied and spliced to obtain a target category prediction model including multiple semantic information extraction layers connected in sequence, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text fragments of the target training sample respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model.
[0011] In an embodiment of the present application, after obtaining the target category prediction model, the target category prediction model is used to perform category prediction on the text content of the category to be predicted, which can improve the accuracy of the text content of the category to be predicted. When performing category prediction on the text content of the category to be predicted, the text content whose text length is greater than the text length threshold supported by the target category prediction model can be divided into at least two text segments to ensure that each text segment does not exceed the text length threshold supported by the target category prediction model, and the same number of semantic information extraction layers can be selected according to the number of text segments to extract the semantic information of each text segment respectively, thereby improving the extraction speed of semantic information and thus improving the efficiency of category prediction; in addition, other redundant semantic information extraction layers do not need to be started, thereby providing sufficient operating space for the semantic information extraction layer used in this category prediction, further improving the extraction speed of semantic information and thus improving the efficiency of category prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0013] Figure 1a A flow chart of a category prediction model training method provided by an exemplary embodiment of the present application;
[0014] Figure 1b A schematic diagram of the structure of an initial category prediction model provided by an exemplary embodiment of the present application;
[0015] Figure 1c A schematic diagram of the structural flow of a target category prediction model provided for an exemplary embodiment of the present application;
[0016] Figure 2a A schematic diagram of a flow chart of a category prediction method provided by an exemplary embodiment of the present application;
[0017] Figure 2b A schematic diagram of a front-end display page provided for an exemplary embodiment of the present application;
[0018] Figure 2c A schematic diagram of a backend display page provided for an exemplary embodiment of the present application;
[0019] Figure 3 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0021] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0022] In order to solve the technical problems that the accuracy of the category prediction results of the existing trained models for posts of different lengths is greatly different, and the model generalization ability is poor, in an embodiment of the present application, the training samples in the same length range are divided into the same training subset, and the training subsets of different length ranges are shuffled. The target training samples are selected from each shuffled training subset to train the initial category prediction model, instead of training the initial category prediction model according to the rule of length range from small to large or from large to small. This can not only avoid the problem that the results of the trained model predicting the category of posts of different lengths are greatly different, but also improve the accuracy of the category prediction results of the trained model for posts of different lengths, and improve the generalization ability of the trained model. In the process of model training, the loss calculation on the same-level category is performed according to the labeling results and prediction results of the same-level category corresponding to each target training sample, and the network parameters of the semantic information extraction layer and each-level category prediction layer are adjusted to improve the calculation accuracy of each network layer and the prediction accuracy of the model; further, the comprehensive loss function can be calculated according to the loss function on at least two levels of categories, and the network parameters of the semantic information extraction layer and each-level category prediction layer in the initial category prediction model are further adjusted according to the comprehensive loss function until the comprehensive loss function meets the model training termination condition to obtain the intermediate category prediction model, thereby greatly improving the accuracy of the prediction model. Further, according to the network parameters of the trained semantic information extraction layer, the semantic information extraction layer in the intermediate category prediction model can be copied and spliced to obtain a target category prediction model including multiple semantic information extraction layers connected in sequence, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text fragments of the target training sample respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model.
[0023] The above solution provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0024] Figure 1a A flow chart of a method for training a category prediction model provided by an exemplary embodiment of the present application. Figure 1a As shown, the method includes:
[0025] 101. Obtain multiple training samples, each training sample corresponding to at least two levels of category labeling results;
[0026] 102. According to the text lengths of the plurality of training samples, the training samples whose text lengths are within the same length range are divided into the same training subset to obtain a plurality of training subsets, and different training subsets correspond to different length ranges;
[0027] 103. Randomly sort multiple training subsets, and perform model training on an initial category prediction model according to the target training samples in each training subset after random sorting, so as to obtain prediction results of at least two levels of categories corresponding to each target training sample; the initial category prediction model at least includes a semantic information extraction layer and at least two levels of category prediction layers, and the prediction results of at least two levels of categories are predicted by the at least two levels of category prediction layers according to the semantic information extracted from the target training samples by the semantic information extraction layer;
[0028] 104. Calculate the loss of the same-level category according to the labeling result and prediction result of the same-level category corresponding to each target training sample to obtain the loss function of at least two-level categories; calculate the comprehensive loss function according to the loss function of at least two-level categories;
[0029] 105. According to the comprehensive loss function, adjust the network parameters of the semantic information extraction layer and at least two-level category prediction layers in the initial category prediction model until the comprehensive loss function satisfies the model training termination condition to obtain an intermediate category prediction model;
[0030] 106. Copy and splice the semantic information extraction layers in the intermediate category prediction model to obtain a target category prediction model that includes at least a plurality of semantic information extraction layers connected in sequence and at least two levels of category prediction layers.
[0031] In an embodiment of the present application, in order to obtain a category prediction model with high category prediction accuracy, the initial category prediction model can be trained to obtain a target category prediction model. The initial category prediction model includes at least a semantic information extraction layer and at least two levels of category prediction layers. The semantic information extraction layer is used to extract semantic information from text content. The "at least two levels" in the at least two levels of category prediction layers is used to limit the number and hierarchical relationship of category prediction layers. Each level of category prediction layer is used to predict the category of the training sample at that level based on the semantic information extracted from the text content by the semantic information extraction layer. Figure 1bThe figure is an exemplary structural diagram of the initial category prediction model, wherein the semantic information extraction layer can be implemented as a BERT (Bidirectional Encoder Representations from Transformers) model or a RoBERTa (A Robustly Optimized BERT Pretraining Approach) model. At least two levels of category prediction layers can be implemented as a Word2Vec model, a TF-IDF vector, and a logistic regression model, etc. At least two levels of category prediction layers can be implemented as the same model to simultaneously predict at least two levels of categories, or each level of category prediction layer can be implemented as a model to simultaneously predict the corresponding level categories. When each level of category prediction layer can be implemented as a model, at least two levels of category prediction layers can be different models.
[0032] In an embodiment of the present application, multiple training samples can be obtained, and the initial prediction model can be trained using the multiple training samples. Among them, the multiple training samples can be posts, articles, etc. that have been published on the platform, and each training sample contains text content, and the text content includes but is not limited to: Chinese and its punctuation marks, foreign languages and their punctuation marks, and each training sample corresponds to at least two levels of category annotation results. The at least two levels of category annotation results refer to each level of category annotated for each training sample, that is, each level of category selected by each training sample when it is published.
[0033] This embodiment does not limit the specific implementation method of obtaining multiple training samples. For example, the text content of multiple published posts or articles with annotation results is selected from an associated database as multiple training samples; or, the text content in multiple posts or articles is annotated with categories manually or through an annotation model as multiple training samples; and so on. In addition, in order to balance the categories, training samples can be evenly obtained according to at least two levels of categories. For example, samples are evenly obtained according to two levels of categories, and 1,000 training samples are obtained for each level of category; or, training samples can be evenly obtained according to three or more levels of categories, for example, 1,000 training samples are obtained for each category. The selection of training samples for several levels of categories depends on the specific application situation, and this embodiment does not limit this.
[0034] In an embodiment of the present application, each training sample corresponds to a text length. In order to reduce the difference between the results of the model's category prediction for posts of different lengths, and at the same time to improve the accuracy of the trained model's category prediction results for posts of different lengths, and to improve the generalization ability of the trained model, the training samples whose text lengths are within the same length range can be divided into the same training subset according to the text lengths of multiple training samples, so as to obtain multiple training subsets, and different training subsets correspond to different length ranges, so as to select training samples within different length ranges as target training samples to train the initial category prediction model.
[0035] Optionally, according to the text lengths of multiple training samples, the training samples whose text lengths are within the same length range are divided into the same training subset to obtain multiple training subsets, including: sorting the multiple training samples according to the text lengths of the multiple training samples; and evenly dividing the sorted multiple training samples according to the preset number of subsets to obtain multiple training subsets, each training subset including the same number of training samples. Thus, it can be ensured that the multiple training samples in each training subset are within the same length range, and when selecting at least one as the target training sample, the generalization ability of the model will not be affected by the uncertainty of the length. Alternatively, the training subset corresponds to a preset number of training sample carrying capacity, and the sample carrying capacity of each training subset can be the same. If there is a situation where the training samples cannot be evenly divided, the multiple training samples can be divided into each training subset in turn according to the maximum carrying capacity of the samples, and the remaining training samples are divided into the last training subset, and the number of remaining training samples should be less than or equal to the training sample carrying capacity corresponding to the training subset. In addition, multiple training samples can also be unevenly divided.
[0036] For example, if there are 5 training subsets, including: a first training subset, a second training subset, a third training subset, a fourth training subset and a fifth training subset, and the length ranges of the 5 training subsets can be 50-60 characters, 60-70 characters, 70-80 characters, 80-90 characters, and 90-100 characters, respectively, then the training samples with a length range of 50-60 characters are divided into the first training subset, the training samples with a length range of 60-70 characters are divided into the first training subset, the training samples with a length range of 70-80 characters are divided into the first training subset, the training samples with a length range of 80-90 characters are divided into the first training subset, and the training samples with a length range of 90-100 characters are divided into the first training subset.
[0037] In an embodiment of the present application, after dividing a plurality of training samples into a plurality of training subsets, the plurality of training subsets can also be randomly sorted, and the initial category prediction model can be trained according to the target training samples in each training subset after random sorting to obtain the prediction results of at least two levels of categories corresponding to each target training sample, and the training subsets of different length ranges can be shuffled, and the target training samples are selected from each shuffled training subset to train the initial category prediction model, which can further reduce the difference between the results of the model's category prediction for posts of different lengths, and improve the accuracy of the trained model's category prediction results for posts of different lengths and the generalization ability of the model. Among them, the prediction results of at least two levels of categories are predicted by at least two levels of category prediction layers based on the semantic information extracted from the target training samples by the semantic information extraction layer.
[0038] In some embodiments, the initial category prediction model is trained according to the target training samples in each training subset after random sorting to obtain prediction results of at least two levels of categories corresponding to each target training sample, including: for each training subset after random sorting, selecting a target training sample from the training subset; inputting the target training sample into a semantic information extraction layer to extract semantic information to obtain the semantic information of the target training sample; using the pooling layer in the initial category prediction model to pool the semantic information of the target training sample to obtain the pooled semantic information of the target training sample; inputting the pooled semantic information of the target training sample into at least two levels of category prediction layers respectively to perform prediction of at least two levels of categories to obtain prediction results of at least two levels of categories corresponding to the target training sample.
[0039] Optionally, selecting a target training sample from each training subset includes: each training sample in each training subset is used as a target training sample; or, randomly selecting a training sample or part of the training samples from each training subset as the target training sample; or, selecting a training sample with the longest text length, a text with a medium text length, and a training sample with the shortest text length or a combination thereof from each training subset as the target training sample, which is not limited in this embodiment. In addition, the number of target training samples selected from each training subset may be the same or different, and the method of selecting the target training samples from each training subset may be the same or different. For example, for some training subsets, the longest text length may be selected as the target sample, and for other training subsets, the shortest text length may be selected as the training sample; or, for all training subsets, the longest text length may be selected as the target sample.
[0040] Further optionally, since the number of target training samples selected in each subset may be multiple and the lengths of the multiple training samples are within the same range, in order to further improve the generalization ability of the model, the multiple training samples contained in each target training sample may be randomly sorted, and the randomly sorted training samples may be used for model training.
[0041] It should be noted that in the following embodiments, the number of training target samples selected in each training sample is 1 as an example for detailed description.
[0042] Optionally, the target training sample contains multiple segmentations, which refer to independent and meaningful segmentations. A segmentation can be a word, phrase, symbol, number or any other segmentation that can be processed separately. For example, the text content "We are committed to providing high-quality cleaning and washing services!" includes the following segmentations: "we", "committed to", "provide", "high-quality", "cleaning and washing services" and "!". Based on this, the target training sample is input into the semantic information extraction layer in the initial category prediction model to extract semantic information to obtain the semantic information of the target training sample, including: inputting the target training sample into the semantic information extraction layer in the initial category prediction model, and based on the self-attention learning mechanism, learning the semantic information of each segmentation and the semantic association relationship between each segmentation to obtain the semantic information of the target training sample.
[0043] Among them, the self-attention learning mechanism, also known as the intra-attention mechanism, is a mechanism that allows the model to focus on the relationship between different segmentations within the sequence when processing the segmentation sequence (an independent text content) corresponding to the text content of the target training sample. The core idea of the self-attention mechanism is to allow each segmentation in the segmentation sequence to interact directly with other segmentations in the sequence, thereby capturing the short-distance and long-distance dependencies between the segmentations within the segmentation sequence, so that the model can dynamically pay attention to different segmentations in the segmentation sequence and adjust the importance of each segmentation according to the context. Among them, short-distance dependencies refer to the mutual dependencies between segments that are close to each other in the segmentation sequence data, and long-distance dependencies refer to the mutual dependencies between segments that are far apart in the segmentation sequence data. This dependency can be semantic, grammatical, or context-based. The main features of the self-attention learning mechanism include: (1) Query vector, key vector, and value vector: The self-attention mechanism maps each word in the input word sequence to three vectors: query (Q), key (K), and value (V). These vectors are obtained by multiplying the input word sequence with the learnable parameters (weight matrix) in the model. The query vector represents the word or position currently being processed, which needs to obtain information from other words or positions in the word sequence. In the self-attention mechanism, each word generates a query vector for comparison with the key vector to determine which words or positions in the sequence should be used to obtain information. The key vector determines which information or words at which positions in the word sequence are "accessible". The degree of match between the query vector and the key vector determines the degree to which the value vector is weighted and summed. In the self-attention mechanism, each word or position has a corresponding key vector, which together with the query vector determines the degree of influence of other words in the word sequence on the current word. The value vector contains the actual content or features of each position or word in the sequence, which will be weighted and summed according to the degree of match between the query and the key. The value vector represents the specific semantic information of each word in the word sequence, which will be integrated into the output according to the attention weight. (2) Attention score calculation: Calculate the similarity or match between the query vector and all key vectors to generate an attention score. The attention score represents the importance of each word in the word sequence to the current word. (3) Scaling and tiling: To avoid numerical problems, such as vanishing or exploding gradients caused by excessive dot products, the model scales the attention scores (usually by dividing by the square root of the key vector dimension) and then normalizes the scores using the Softmax function. (4) Attention-weighted features: The normalized values obtained by the Softmax function are used as weights and multiplied by the value vector to obtain the final attention-weighted features. The attention-weighted features integrate the information of all words in the word sequence, and the contribution of each word is determined by its corresponding attention weight.(5) Multi-head attention: In order to capture the relationship between different subspaces in the sequence, the self-attention mechanism can be expanded to a multi-head attention mechanism. In the multi-head attention, the model executes the above process multiple times in parallel, and each "head" may focus on different relationships or features in the word segmentation sequence. (6) Residual connection and layer normalization: The output of the self-attention will be added to the original input (residual connection), and then normalized (LayerNormalization) to stabilize the training process and improve the gradient flow. (7) Calculation of the feedforward neural network layer (also known as fully connected layer calculation): After the self-attention layer, there is usually a fully connected layer, which performs further nonlinear transformation on the output of the self-attention layer to strengthen the position representation or extract more complex features. For the detailed implementation of the self-attention learning mechanism applied to this application, please refer to the relevant description of the following embodiments, which will not be repeated here.
[0044] In an embodiment of the present application, through a learning process based on a self-attention learning mechanism, the semantic information of the target training sample corresponding to each segmentation in each target training sample can be obtained, and the semantic information of the target training sample corresponding to each segmentation is the same, that is, the semantic information of multiple identical target training samples is obtained. In practical applications, one of the semantic information of multiple target training samples can be selected as the output of the semantic information extraction layer. For this, special characters (without specific semantic meanings) can be added to the target training sample, and the semantic information of the target training sample corresponding to the special characters can also be obtained based on the self-attention learning mechanism, and the semantic information of the target training sample corresponding to the special characters is used as the output of the semantic information extraction layer. Based on this, the target training sample is input into the semantic information extraction layer in the initial category prediction model to extract the semantic information to obtain the semantic information of the target training sample, including: performing a special segmentation addition operation on the target training sample to obtain a target training sample containing special characters; inputting the target training sample containing special characters into the semantic information extraction layer in the initial category prediction model, based on the self-attention learning mechanism, learning the semantic information of each segmentation and the semantic association between each segmentation, so as to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample.
[0045] In some embodiments, a special word segmentation adding operation is performed on a target training sample to obtain a target training sample containing special characters, including: selecting special characters. The selection of special characters depends on the specific task and model architecture. Common special characters include <cls>(Classification) and <sep>(separated), for example, in the BERT model, <cls>The token is added to the beginning of the sentence, <sep>The tag is added to the end of the sentence; word segmentation: the text content of the target training sample is divided into multiple tokens, which can be words, subwords or characters; the tokenizer converts the text content into a token sequence according to predefined rules, and the token sequence contains multiple tokens in the text content of the target training sample; adding special characters: adding special characters to the token sequence, for example, if processing a single sentence, <cls>will be added to the beginning of the sequence, <sep>It will be added to the end of the sequence; encoding (Encoding), converting multiple participles (including special characters) into numerical representations (digital form) that the model can understand. Specifically, the numerical representation of each participle in the vocabulary (including each participle and its corresponding numerical mapping relationship) can be found to input the numerical representation corresponding to each participle into the model. The numerical representation corresponding to each participle can represent the initial semantic information of the participle. The numerical representation corresponding to each participle can be implemented in the form of a matrix, which contains the numerical representation corresponding to each participle. In addition, in order to enable the model to understand the position of multiple participles in the participle sequence, position encoding can also be added to each participle in the participle sequence, which is conducive to the model capturing the order information in the sequence data.
[0046] In some embodiments, a target training sample containing special characters is input into a semantic information extraction layer in an initial category prediction model, and based on a self-attention learning mechanism, the semantic association relationship between each word segment is learned to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample, including: inputting the numerical representation corresponding to the word segmentation sequence containing special characters into the semantic information extraction layer in the initial category prediction model, performing vector mapping on the numerical representation corresponding to each word segmentation in the target training sample to obtain the query vector, key vector and value vector corresponding to each word segmentation; for each word segmentation, performing matching calculations using the query vector of the word segmentation and the key vector of each word segmentation to obtain the attention weight of each word segmentation; performing a full connection calculation operation on the value vector of each word segmentation according to the attention weight of each word segmentation to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample.
[0047] Optionally, the numerical representation corresponding to the word segmentation sequence containing special characters is input into the semantic information extraction layer in the initial category prediction model, and vector mapping is performed on the numerical representation corresponding to each word segmentation in the target training sample to obtain the query vector, key vector and value vector corresponding to each word segmentation, including: mapping the numerical representation of each word segmentation in the word segmentation sequence to the query vector, key vector and value vector respectively through different weight matrices, such as mapping them to the query vector, key vector and value vector respectively through three different weight matrices W^Q, W^K, and W^V.
[0048] Optionally, for each word segment, the query vector of the word segment is used to calculate the matching degree with the key vector of each word segment to obtain the attention weight of each word segment, including, for the current word segment (each word segment), the query vector of the word segment is calculated with the key vector of each word segment (including the current word segment) to obtain multiple score values, each score value represents the attention weight of the word segment providing the key vector to the current word segment. The attention weight reflects the relative importance of one word segment to another word segment in the sequence. The higher the weight, the more important the corresponding word segment is in the current context.
[0049] Further optionally, the multiple score values may include positive scores and negative scores. In order to facilitate the subsequent full connection calculation, each score value may be normalized to obtain multiple normalized values, and the multiple normalized values are all positive numbers. The normalization process here may be an exponential calculation operation (the score value is used as a parameter of the exponential calculation), but is not limited thereto.
[0050] Further optionally, after obtaining the attention weight of each segmentation, before performing the pooling process, a weighted sum calculation can be performed on the value vector of each segmentation according to the attention weight of each segmentation to obtain a weighted sum vector (updated representation). The weighted sum vector incorporates the segmentations at all positions in the input sequence, but the contribution of the segmentations at different positions is determined by their attention relative to the query. This means that for each segmentation in the segmentation sequence, its weighted sum vector is a weighted combination of other segmentation information associated with it in the entire segmentation sequence, and the weight is determined by the attention score (normalized). Through this process, the weighted sum vector of each segmentation not only represents the semantic information of the segmentation itself, but also represents the synthesis of the contextual semantic information of the entire segmentation sequence, which enables the model to capture long-distance dependencies within the sequence and take into account the semantic information of the entire sequence when processing the current segmentation.
[0051] Further optionally, after obtaining the weighted sum vector of each word segment, before performing the pooling process, a fully connected calculation operation can be performed on the value vector of each word segment according to the attention weight of each word segment to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample, including: inputting the value vector obtained by weighted summation into the fully connected layer, the fully connected layer includes two linear transformation functions and a nonlinear activation function such as ReLU); the first linear transformation function maps the value vector to an intermediate dimension, and then applies the nonlinear activation function to perform nonlinear calculation, and finally the second linear transformation function maps the nonlinear calculation result back to the original dimension or the target dimension to output the semantic information of the target training sample corresponding to the special character, the semantic information of the target training sample integrates the context information of the entire input word segmentation sequence, and can be used as the semantic information of the target training sample.
[0052] Further optionally, the semantic information of the target training sample is a multidimensional parameter vector. Based on this, after obtaining the semantic information of the target training sample, the semantic information of the target training sample is pooled using the pooling layer in the initial category prediction model to obtain the pooled semantic information of the target training sample, including: determining the window size of the pooling window and the sliding step of the pooling window corresponding to the pooling process, and the values of the window size and the sliding step are equal; based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, the maximum value of the parameter is selected as the output to obtain the pooled semantic information of the target training sample; or, based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, the average value of all parameter values is calculated as the output to obtain the pooled semantic feature vector of the target training sample; or, based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, the sum of all parameter values is calculated as the output to obtain the pooled semantic feature vector of the target training sample.
[0053] In some embodiments, the pooled semantic information of the target training sample is respectively input into at least two levels of category prediction layers to perform prediction of at least two levels of categories to obtain prediction results of at least two levels of categories corresponding to the target training sample, including: inputting the pooled semantic information of the target training sample into at least two levels of category prediction layers, analyzing the similarity between the pooled semantic information and the semantic information of multiple known categories at the corresponding category level; based on the similarity, determining the probability value of the target training sample belonging to the multiple known categories contained in each category level as the prediction result of at least two levels of categories corresponding to the target training sample.
[0054] Optionally, analyzing the similarity between the pooled semantic information and the semantic information of multiple known categories at the corresponding category level includes: calculating the similarity between the pooled semantic information and the semantic information of each known category, and the calculation method includes cosine similarity, Euclidean distance, etc. Cosine similarity evaluates their similarity by measuring the angle between two vectors, and Euclidean distance measures the straight-line distance between them. The calculation formula of cosine similarity is: Among them, A and B are the semantic information vector after pooling and the semantic information vector of the category level, "·" represents the dot product, and ||A|| and ||B|| are the moduli of the vectors, respectively; for at least two levels of category prediction layers, it is necessary to calculate the similarity between the semantic information after pooling and all known categories at each level, which can be done by iteratively comparing the semantic vectors of each category, such as constructing a similarity matrix, in which each row represents a category level, each column represents a known category, and the values in the matrix represent the similarity between the semantic information after pooling and the corresponding category. According to the similarity matrix, category prediction can be performed. Usually, the category with the highest similarity will be selected as the most likely prediction result.
[0055] In the above-mentioned embodiments of the present application, in the process of self-attention learning, only the encoding process is used to realize the extraction and comparison of semantic information, and the decoding process is not involved, thereby improving the efficiency of the self-attention learning process.
[0056] In an embodiment of the present application, in order to improve the prediction accuracy of the model, the parameters of the model can also be continuously adjusted by calculating the loss function between the network layers. Therefore, the loss calculation on the same-level category can be performed according to the labeling results and prediction results of the same-level category corresponding to each target training sample to obtain the loss function on at least two levels of categories, and the parameters of each network layer are adjusted according to the loss function on at least two levels of categories. Optionally, the loss calculation on the same-level category is performed according to the labeling results and prediction results of the same-level category corresponding to each target training sample to obtain the loss function on at least two levels of categories, including: according to the labeling results and prediction results of the same-level category corresponding to each target training sample, respectively obtain the loss function on at least two levels of categories, wherein the prediction result of the category is the predicted category of the model; wherein different category levels use different loss functions for the same loss function, or different category levels use different loss functions, and the higher the category level, the higher the complexity of the loss calculation method.
[0057] In the embodiment of the present application, in order to further improve the accuracy of the model, a comprehensive loss function can also be calculated based on the loss function on at least two levels of categories, and the network parameters of the semantic information extraction layer and at least two levels of category prediction layer in the initial category prediction model can be adjusted according to the comprehensive loss function until the comprehensive loss function meets the model training termination condition to obtain an intermediate category prediction model. Among them, the model training termination condition can be that the output result of the comprehensive loss function is less than a set threshold.
[0058] In the embodiment of the present application, the semantic information extraction layers in the intermediate category prediction model can also be copied and spliced to obtain a target category prediction model that includes at least a plurality of semantic information extraction layers connected in sequence and at least two-level category prediction layers, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text segments of the target training sample respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model. An exemplary schematic diagram of the target category prediction model is shown in FIG. Figure 1c As shown, it contains multiple semantic information extraction layers.
[0059] Further optionally, a selection mechanism for the semantic information extraction layer can be preset. Then, when performing category prediction according to the target category prediction model, a number of semantic information extraction layers that are adapted to the text length of the text content to be predicted can be adaptively selected from multiple semantic information extraction layers according to the text length of the text content to be predicted and the selection mechanism of the semantic information extraction layer to extract semantic information from the text content to be predicted, without starting the remaining semantic information extraction layers. Thus, video memory is allocated to an adapted number of semantic information extraction layers according to the actual text length of the text content to be predicted, which can save the size of video memory occupied during prediction, improve throughput, and increase prediction speed.
[0060] For example, the target category prediction model includes 5 semantic information extraction layers, and the upper limit of the text length processed by each semantic information extraction layer at a time is 500 characters. If the text length of the current text content to be predicted is 1000 characters, then according to the preset semantic information extraction layer selection mechanism and text length, two semantic information extraction layers can be selected from the 5 semantic information extraction layers and video memory can be allocated to them to support their operation, and two text fragments (each text fragment is 500 characters) are respectively input into the two semantic information extraction layer pairs to extract the semantic information of the two text fragments.
[0061] In the above embodiments of the present application, training samples in the same length range are divided into the same training subset, and training subsets of different length ranges are shuffled, and target training samples are selected from each shuffled training subset to train the initial category prediction model, rather than training the initial category prediction model according to the rule of length range from small to large or from large to small. This can not only avoid the problem of large differences in the results of category prediction for posts of different lengths made by the trained model, but also improve the accuracy of the category prediction results of the trained model for posts of different lengths, and improve the generalization ability of the trained model. In the process of model training, the loss calculation on the same-level category is performed according to the labeling results and prediction results of the same-level category corresponding to each target training sample, and the network parameters of the semantic information extraction layer and each-level category prediction layer are adjusted to improve the calculation accuracy of each network layer and the prediction accuracy of the model; further, the comprehensive loss function can be calculated according to the loss function on at least two levels of categories, and the network parameters of the semantic information extraction layer and each-level category prediction layer in the initial category prediction model are further adjusted according to the comprehensive loss function until the comprehensive loss function meets the model training termination condition to obtain the intermediate category prediction model, thereby greatly improving the accuracy of the prediction model. Further, according to the network parameters of the trained semantic information extraction layer, the semantic information extraction layer in the intermediate category prediction model can be copied and spliced to obtain a target category prediction model including multiple semantic information extraction layers connected in sequence, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text fragments of the target training sample respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model.
[0062] The above and Figure 1a , Figure 1b and Figure 1c The relevant embodiments specifically describe the training process of the target category prediction model. Figure 2a , Figure 2b and Figure 2c A related embodiment is a specific process of performing category prediction on text content of a to-be-predicted category based on a target category prediction model.
[0063] Figure 2a The following is a flow chart of a category prediction method provided by an exemplary embodiment of the present application. Figure 2a As shown, the method includes:
[0064] 201. Obtain text content of the category to be predicted;
[0065] 202. When the length of the text content is greater than a text length threshold supported by the target category prediction model, the text content is divided into at least two text segments, and the length of each text segment is not greater than the text length threshold; the target category prediction model includes at least a plurality of semantic information extraction layers and at least two levels of category prediction layers;
[0066] 203. Inputting at least two text segments into at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information; the at least two semantic information extraction layers are semantic information extraction layers selected from a plurality of semantic information extraction layers and are the same in number as the at least two text segments;
[0067] 204. Generate target semantic information corresponding to the text content according to the at least two pieces of semantic information;
[0068] 205. Input the target semantic information into at least two-level category prediction layer to predict at least two-level categories, so as to obtain at least two-level categories corresponding to the text content.
[0069] This embodiment does not limit the specific implementation method of obtaining the text content of the category to be predicted. Figure 2b The post or article to be published page shown obtains the text content filled in by the user as the text content to be predicted. Alternatively, the text content of the post or article of the category to be predicted is selected from the associated database as the text content to be predicted.
[0070] In an embodiment of the present application, the text length threshold supported by the target category prediction model actually refers to the text length threshold that a single semantic information extraction layer in the target category prediction model can process at a time. In the case where the length of the text content is greater than the text length threshold supported by the target category prediction model, that is, in the case where the length of the text content is greater than the text length threshold that a single semantic information extraction layer can process at a time, the text content of the category to be predicted can be divided into at least two text segments according to the text length threshold that each semantic information extraction layer can process at a time, the length of each text segment is not greater than the text length threshold, and the text length of each text segment can be the same or different.
[0071] Further, after obtaining at least two text segments, video memory is allocated to the same number of semantic information extraction layers according to the number of text segments to support their operation. It should be noted that, when the text length of each text segment is different, it is necessary to adaptively select a semantic information extraction layer that supports the text length of each text segment and allocate video memory to it to support its operation.
[0072] In an embodiment of the present application, each text fragment contains multiple participles; at least two text fragments are input into at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information, including: performing a special participle adding operation for each text fragment to obtain at least two text fragments containing special participles according to the number of text fragments; each text fragment is input into a semantic information extraction layer with allocated video memory, and based on a self-attention learning mechanism, the semantic information of each participle in the text fragment and the semantic association relationship between each participle are learned to obtain the target semantic information corresponding to the special character as the semantic information of the text fragment to obtain at least two semantic information.
[0073] In some embodiments, each text segment containing special characters is input into a corresponding semantic information extraction layer in the target category prediction model, and based on the self-attention learning mechanism, the semantic information of each word segment and the semantic association relationship between each word segment are learned to obtain the semantic information of the text segment corresponding to each special character, including: performing vector mapping for each word segment in each text segment to obtain the query vector, key vector and value vector corresponding to each word segment in the text segment; for each word segment in the text segment, performing matching calculations using the query vector of the word segment and the key vectors of each word segment to obtain the attention weight of each word segment in the text segment; performing a full connection calculation operation on the value vector of each word segment in the text segment according to the attention weight of each word segment in the text segment to obtain at least two semantic information.
[0074] In an embodiment of the present application, after obtaining at least two pieces of semantic information, target semantic information corresponding to the text content is generated based on the at least two pieces of semantic information, including: using a pooling layer in a target category prediction model to perform pooling processing on at least two pieces of semantic information to obtain the target semantic information corresponding to the text content.
[0075] In some embodiments, the pooling layer has a pooling window, and the window size of the pooling window and the sliding step size of the pooling window are equal in value; based on at least two semantic information, target semantic information corresponding to the text content is generated, including: inputting at least two semantic information into the pooling layer in the target category prediction model, semantically splicing the at least two semantic information to obtain the spliced semantic information, and the spliced semantic information is a multidimensional parameter vector; based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the maximum value of the parameter is selected as output to obtain the target semantic information corresponding to the text content; or, based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the average value of all parameter values is calculated as output to obtain the target semantic information corresponding to the text content; or, based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the sum of all parameter values is calculated as output to obtain the target semantic information corresponding to the text content.
[0076] In an embodiment of the present application, target semantic information is input into at least two levels of category prediction layers to perform prediction of at least two levels of categories to obtain at least two levels of categories corresponding to the text content, including: inputting the target semantic information into at least two levels of category prediction layers respectively, analyzing the similarity between the target semantic information and the semantic information of multiple known categories at the corresponding category level; determining the probability value of the target training sample belonging to the multiple known categories contained in each category level based on the similarity, the probability value of each category indicating the possibility that the text content belongs to the category, and the larger the probability value, the greater the possibility; based on the probability values of the multiple known categories contained in each category level, selecting the known categories whose probability values are ranked before the preset ranking as the at least two levels of categories corresponding to the text content, for example, selecting the top 10 consistent categories in the probability value ranking in each level of categories as the at least two levels of categories corresponding to the text content.
[0077] It should be noted that in the training stage of the target prediction model, at least two levels of category prediction layers have learned the unique identifier (such as ID) corresponding to each category in the platform. Then, when predicting categories, the output results of at least two levels of category prediction layers can be the identifier corresponding to each known category and its probability value, and then based on the identifier, find out which category each identifier corresponds to from the known category-identifier mapping table. Alternatively, the output results of at least two levels of category prediction layers can also be each known category and its probability value. Alternatively, the output results of at least two levels of category prediction layers can also be each known category, the identifier corresponding to each known category and its probability value. Taking "home improvement service" as an example, the corresponding prediction results can be "cate": 1043, "cateName": "home improvement service", "p": 0.5791.
[0078] It should be noted that 2a, Figure 2b and Figure 2c The specific implementation methods and technical effects of each step in the relevant embodiments can be found in 1a, Figure 1b and Figure 1c The relevant descriptions of the relevant embodiments will not be repeated here.
[0079] Further optionally, when the text content is content to be posted sent by the client, at least two levels of categories corresponding to the text content are sent to the client, so that the client can display it on the posting page for the user to configure the at least two levels of categories to which the text content belongs on the posting page.
[0080] Optionally, at least two levels of categories corresponding to the text content are sent to the client, including: there can be multiple predicted categories at each level, and there is an arrangement order between multiple prediction results of the same level category, and the arrangement order is determined according to the similarity between the text content and each predicted category; the top N prediction results corresponding to each level of category are selected and pushed to the client for display.
[0081] Further optionally, taking posting as an example, the user can select any category from at least two levels of predicted categories displayed on the post-to-be-posted page of the client as the category to which the text content of the post-to-be-posted belongs.
[0082] Further optionally, in response to the user's post publishing operation, the post to be published is published to the corresponding category of the corresponding platform so that other users can view the post content.
[0083] Figure 2a It is an exemplary schematic diagram of the backend corresponding to the prediction results under each level of category predicted based on the text content in the figure. The prediction results include the ID corresponding to each predicted category, the category name and the probability value of the text content belonging to the category. 2b is an exemplary schematic diagram of at least two levels of predicted categories displayed on the client's posting page. This embodiment does not limit the ranking method of at least two levels of predicted categories displayed on the posting page. For example, for categories of the same level, they can be arranged in order of the probability value belonging to each category, or they can be arranged randomly. For categories of different levels, they can be arranged in partitions.
[0084] In an embodiment of the present application, after obtaining the target category prediction model, the target category prediction model is used to perform category prediction on the text content of the category to be predicted, which can improve the accuracy of the text content of the category to be predicted. When performing category prediction on the text content of the category to be predicted, the text content whose text length is greater than the text length threshold supported by the target category prediction model can be divided into at least two text segments to ensure that each text segment does not exceed the text length threshold supported by the target category prediction model, and the same number of semantic information extraction layers can be selected according to the number of text segments to extract the semantic information of each text segment respectively, thereby improving the extraction speed of semantic information and thus improving the efficiency of category prediction; in addition, other redundant semantic information extraction layers do not need to be started, thereby providing sufficient operating space for the semantic information extraction layer used in this category prediction, further improving the extraction speed of semantic information and thus improving the efficiency of category prediction.
[0085] Figure 3 The schematic diagram of the structure of the electronic device provided by the exemplary embodiment of the present application. Figure 3 As shown, it includes: a memory 30a and a processor 30b; the memory 30a is used to store a computer program; the processor 30b is coupled to the memory 30a and is used to execute the computer program to implement the following steps:
[0086] A plurality of training samples are obtained, each training sample corresponds to an annotation result of at least two levels of categories; according to the text lengths of the plurality of training samples, the training samples whose text lengths are within the same length range are divided into the same training subset to obtain a plurality of training subsets, and different training subsets correspond to different length ranges; the plurality of training subsets are randomly sorted, and an initial category prediction model is trained according to the target training samples in each training subset after random sorting to obtain a prediction result of at least two levels of categories corresponding to each target training sample; the initial category prediction model includes at least a semantic information extraction layer and at least two levels of category prediction layers, and the prediction result of at least two levels of categories is obtained by the at least two levels of category prediction layers according to the semantic information extraction layer from Prediction based on the semantic information extracted from the target training samples; calculating the loss on the same-level categories according to the labeling results and prediction results of the same-level categories corresponding to each target training sample to obtain the loss function on at least two-level categories; calculating the comprehensive loss function based on the loss function on at least two-level categories; adjusting the network parameters of the semantic information extraction layer and the at least two-level category prediction layer in the initial category prediction model according to the comprehensive loss function until the comprehensive loss function meets the model training termination condition to obtain the intermediate category prediction model; copying and splicing the semantic information extraction layer in the intermediate category prediction model to obtain a target category prediction model that at least includes a plurality of semantic information extraction layers and at least two-level category prediction layers connected in sequence.
[0087] In an embodiment of the present application, in order to obtain a prediction model with high prediction accuracy, the processor can perform model training on the initial category prediction model to obtain a target category prediction model. The initial category prediction model includes at least a semantic information extraction layer and at least two levels of category prediction layers. The semantic information extraction layer is used to extract semantic information from the text content. The at least two levels are used to limit the number and hierarchical relationship of the category prediction layers. Each level of the category prediction layer is used to predict the category of the training sample at that level based on the semantic information extracted from the text content by the semantic information extraction layer.
[0088] In an embodiment of the present application, the processor can be used to obtain multiple training samples and use the multiple training samples to perform model training on the initial prediction model, each training sample containing text content. The multiple training samples can be posts, articles, etc. published on the platform, and each training sample corresponds to the annotation results of at least two levels of categories. The annotation results of at least two levels of categories are the categories of each level annotated by each training sample, that is, the categories of each level selected by each training sample when it is published.
[0089] Optionally, this embodiment does not limit the real-time manner in which the processor obtains multiple training samples. For example, multiple published data with annotation results are selected from the database of the platform as multiple training samples; or, multiple unpublished data are annotated manually or by an annotation model as multiple training samples; and so on.
[0090] In order to reduce the difference between the results of the model's category prediction for posts of different lengths, and at the same time to improve the accuracy of the trained model's category prediction results for posts of different lengths, and to improve the generalization ability of the trained model, the processor can divide the training samples whose text lengths are within the same length range into the same training subset according to the text lengths of multiple training samples, so as to obtain multiple training subsets, and different training subsets correspond to different length ranges. Further, the multiple training subsets are randomly sorted, and the initial category prediction model is trained according to the target training samples in each training subset after random sorting, so as to obtain the prediction results of at least two levels of categories corresponding to each target training sample, and the prediction results of at least two levels of categories are predicted by at least two levels of category prediction layers according to the semantic information extracted from the target training samples by the semantic information extraction layer.
[0091] In an embodiment of the present application, in order to further improve the accuracy of the model, the processor can perform loss calculation on the same-level category according to the labeling results and prediction results of the same-level category corresponding to each target training sample to obtain a loss function on at least two levels of categories; and calculate a comprehensive loss function based on the loss function on at least two levels of categories. Further, according to the comprehensive loss function, adjust the network parameters of the semantic information extraction layer and the at least two-level category prediction layer in the initial category prediction model until the comprehensive loss function meets the model training termination condition to obtain an intermediate category prediction model.
[0092] In an embodiment of the present application, the processor can also copy and splice the semantic information extraction layers in the intermediate category prediction model to obtain a target category prediction model that includes at least multiple semantic information extraction layers connected in sequence and at least two levels of category prediction layers, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text fragments of the target training samples respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model.
[0093] In an embodiment of the present application, the text lengths of each training sample in each training subset are close, and the training subsets of different length ranges are shuffled, rather than training the initial category prediction model according to the rule of length range from small to large or from large to small, which can not only improve the accuracy of the model's category prediction results for posts of different lengths, but also improve the generalization ability of the model. In the process of model training by the processor, the loss calculation on the same level category can be performed according to the annotation results and prediction results of the same level category corresponding to each target training sample, and the loss function on at least two levels of categories can be obtained. According to the loss function on each level of category, the network parameters of the semantic information extraction layer and each level of category prediction layer can be adjusted to improve the accuracy of each network layer; further, the comprehensive loss function can be calculated according to the loss function on at least two levels of categories, and the network parameters of the semantic information extraction layer and each level of category prediction layer in the initial category prediction model can be further adjusted according to the comprehensive loss function, until the comprehensive loss function meets the model training termination condition, so as to obtain an intermediate category prediction model, thereby greatly improving the accuracy of the prediction model. Furthermore, the semantic information extraction layer in the intermediate category prediction model can be copied and spliced according to the network parameters of the trained semantic information extraction layer to obtain a target category prediction model including multiple semantic information extraction layers connected in sequence, so that when performing category prediction, multiple semantic information extraction layers can be used to extract semantic information from multiple text fragments of the target training sample respectively, thereby improving the efficiency of semantic information extraction and thus improving the prediction efficiency of the category prediction model.
[0094] Optionally, when the processor divides the training samples whose text lengths are within the same length range into the same training subset according to the text lengths of the multiple training samples to obtain multiple training subsets, the processor is specifically used to: sort the multiple training samples according to the text lengths of the multiple training samples; and evenly divide the sorted multiple training samples according to a preset number of subsets to obtain multiple training subsets, each training subset including the same number of training samples. In this way, it can be ensured that the multiple training samples in each training subset are within the same length range, and when selecting at least one as a target training sample, the generalization ability of the model will not be affected by the uncertainty of the length.
[0095] Optionally, when the processor performs model training on the initial category prediction model according to the target training samples in each training subset after random sorting to obtain prediction results of at least two levels of categories corresponding to each target training sample, it is specifically used to: for each training subset after random sorting, select a target training sample from the training subset, the target training sample is each training sample or one training sample or part of the training samples in the training subset; input the target training sample into the semantic information extraction layer to extract semantic information to obtain the semantic information of the target training sample; use the pooling layer in the initial category prediction model to pool the semantic information of the target training sample to obtain the pooled semantic information of the target training sample; input the pooled semantic information of the target training sample into at least two levels of category prediction layers respectively to predict at least two levels of categories to obtain prediction results of at least two levels of categories corresponding to the target training sample.
[0096] Optionally, the target training sample contains multiple participles; when the processor inputs the target training sample into the semantic information extraction layer in the initial category prediction model to extract semantic information to obtain the semantic information of the target training sample, it is specifically used to: perform a special participle addition operation on the target training sample to obtain a target training sample containing special characters; input the target training sample into the semantic information extraction layer in the initial category prediction model, and based on the self-attention learning mechanism, learn the semantic information of each participle and the semantic association relationship between each participle to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample.
[0097] Optionally, when the processor learns the semantic association relationship between each word segment based on the self-attention learning mechanism to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample, it is specifically used to: perform vector mapping on each word segment in the target training sample to obtain the query vector, key vector and value vector corresponding to each word segment; for each word segment, use the query vector of the word segment and the key vector of each word segment to perform matching calculations respectively to obtain the attention weight of each word segment; perform a full connection calculation operation on the value vector of each word segment according to the attention weight of each word segment to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample.
[0098] Optionally, the semantic information of the target training sample is a multidimensional parameter vector; when the processor uses the pooling layer in the initial category prediction model to perform pooling processing on the semantic information of the target training sample to obtain the pooled semantic information of the target training sample, it is specifically used to: determine the window size of the pooling window corresponding to the pooling processing and the sliding step of the pooling window, and the window size and the sliding step are equal; based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, select the maximum parameter value as output to obtain the pooled semantic information of the target training sample; or, based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, calculate the average value of all parameter values as output to obtain the pooled semantic feature vector of the target training sample; or, based on the window size and the sliding step, for the multidimensional parameter vector, in the area covered by each pooling window, calculate the sum of all parameter values as output to obtain the pooled semantic feature vector of the target training sample.
[0099] Optionally, when the processor inputs the pooled semantic information of the target training sample into at least two levels of category prediction layers respectively to perform prediction of at least two levels of categories to obtain prediction results of at least two levels of categories corresponding to the target training sample, it is specifically used to: input the pooled semantic information of the target training sample into at least two levels of category prediction layers respectively, and analyze the similarity between the pooled semantic information and the semantic information of multiple known categories at the corresponding category level; based on the similarity, determine the probability value of the target training sample belonging to the multiple known categories contained in each category level as the prediction result of at least two levels of categories corresponding to the target training sample.
[0100] Optionally, when the processor performs loss calculation on the same-level category according to the labeling results and prediction results of the same-level category corresponding to each target training sample to obtain the loss function on at least two levels of categories, it is specifically used to: obtain the loss functions on at least two levels of categories according to the labeling results and prediction results of the same-level category corresponding to each target training sample; wherein different category levels use different loss functions for the same loss function, or different category levels use different loss functions, and the higher the category level, the higher the complexity of the loss calculation method.
[0101] Furthermore, the processor may also perform the following steps:
[0102] Obtain text content of a category to be predicted; when the length of the text content is greater than a text length threshold supported by a target category prediction model, divide the text content into at least two text segments, with the length of each text segment being no greater than the text length threshold; the target category prediction model comprises at least a plurality of semantic information extraction layers and at least two levels of category prediction layers; input the at least two text segments into at least two semantic information extraction layers in the target category prediction model to extract semantic features, so as to obtain at least two semantic information; the at least two semantic information extraction layers are semantic information extraction layers selected from the plurality of semantic information extraction layers, the same number as the at least two text segments; generate target semantic information corresponding to the text content according to the at least two semantic information; input the target semantic information into at least two levels of category prediction layers to predict at least two levels of categories, so as to obtain at least two levels of categories corresponding to the text content.
[0103] Optionally, each text fragment contains multiple word segments; when the processor inputs at least two text fragments into at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information, it is specifically used to: perform a special word segmentation addition operation for each text fragment to obtain at least two text fragments containing special word segments; allocate video memory to the same number of semantic information extraction layers according to the number of text fragments to support their operation; input each text fragment into a semantic information extraction layer to which video memory has been allocated, and based on a self-attention learning mechanism, learn the semantic information of each word segment in the text fragment and the semantic association relationship between each word segment to obtain the target semantic information corresponding to the special character as the semantic information of the text fragment to obtain at least two semantic information.
[0104] Optionally, the pooling layer has a pooling window, and the window size of the pooling window and the sliding step size of the pooling window are equal in value; when the processor generates target semantic information corresponding to the text content based on at least two semantic information, it is specifically used to: input at least two semantic information into the pooling layer in the target category prediction model, semantically splice the at least two semantic information to obtain the spliced semantic information, and the spliced semantic information is a multidimensional parameter vector; based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, select the maximum value of the parameter as output to obtain the target semantic information corresponding to the text content; or, based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, calculate the average value of all parameter values as output to obtain the target semantic information corresponding to the text content; or, based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, calculate the sum of all parameter values as output to obtain the target semantic information corresponding to the text content.
[0105] Optionally, when the processor inputs the target semantic information into at least two levels of category prediction layers to perform prediction of at least two levels of categories to obtain at least two levels of categories corresponding to the text content, it is specifically used to: input the target semantic information into at least two levels of category prediction layers respectively, and analyze the similarity between the target semantic information and the semantic information of multiple known categories at the corresponding category level; determine the probability value of the target training sample belonging to the multiple known categories contained in each category level based on the similarity; based on the probability values of the multiple known categories contained in each category level, select the known categories whose probability values are ranked before the preset ranking as the at least two levels of categories corresponding to the text content.
[0106] Further optionally, when the text content is content to be posted sent by the client, the processor can also send at least two levels of categories corresponding to the text content to the client, so that the client can display it on the posting page for the user to configure the at least two levels of categories to which the text content belongs on the posting page.
[0107] In an embodiment of the present application, after obtaining the target category prediction model, the target category prediction model is used to perform category prediction on the text content of the category to be predicted, which can improve the accuracy of the text content of the category to be predicted. When performing category prediction on the text content of the category to be predicted, the text content whose text length is greater than the text length threshold supported by the target category prediction model can be divided into at least two text segments to ensure that each text segment does not exceed the text length threshold supported by the target category prediction model, and the same number of semantic information extraction layers can be selected according to the number of text segments to extract the semantic information of each text segment respectively, thereby improving the extraction speed of semantic information and thus improving the efficiency of category prediction; in addition, other redundant semantic information extraction layers do not need to be started, thereby providing sufficient operating space for the semantic information extraction layer used in this category prediction, further improving the extraction speed of semantic information and thus improving the efficiency of category prediction.
[0108] Furthermore, if Figure 3 As shown, the electronic device also includes: a communication component 30c, a display 30d, a power component 30e, an audio component 30f and other components. Figure 3 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 3 Components shown.
[0109] The detailed implementation methods and beneficial effects provided by the embodiments of the present application have been described in detail in the aforementioned embodiments and will not be elaborated in detail here.
[0110] The exemplary embodiments of the present application further provide a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor is caused to implement the steps in the above-mentioned method embodiments.
[0111] An exemplary embodiment of the present application further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the processor is enabled to implement the steps in the above-mentioned method embodiments.
[0112] The above-mentioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0113] The above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
[0114] The above-mentioned display includes a screen, and the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0115] The power supply assembly provides power to various components of the device where the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.
[0116] The above-mentioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal.
[0117] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-readable storage media (including but not limited to disk storage, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage, etc.) containing computer-usable program code.
[0118] The present application is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0119] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0120] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0121] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interface, network interface and memory.
[0122] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0123] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0124] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0125] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.< / sep> < / cls> < / sep> < / cls> < / sep> < / cls>
Claims
1. A category prediction model training method, characterized in that: include: Obtain multiple training samples, each of which corresponds to at least two levels of category labeling results; According to the text lengths of the multiple training samples, the training samples whose text lengths are within the same length range are divided into the same training subset to obtain multiple training subsets, and different training subsets correspond to different length ranges; Randomly sorting the multiple training subsets, and performing model training on the initial category prediction model according to the target training samples in each training subset after the random sorting, so as to obtain prediction results of at least two levels of categories corresponding to each target training sample; The initial category prediction model comprises at least a semantic information extraction layer and at least two-level category prediction layers, and the prediction results of the at least two-level categories are predicted by the at least two-level category prediction layers according to the semantic information extracted from the target training samples by the semantic information extraction layer; Calculate the loss of the same-level category according to the labeling result and prediction result of the same-level category corresponding to each target training sample, so as to obtain the loss function of at least two levels of categories; Calculating a comprehensive loss function based on the loss functions on the at least two levels of categories; According to the comprehensive loss function, adjusting the network parameters of the semantic information extraction layer and at least two-level category prediction layers in the initial category prediction model until the comprehensive loss function satisfies the model training termination condition, so as to obtain an intermediate category prediction model; The semantic information extraction layers in the intermediate category prediction model are copied and spliced to obtain a target category prediction model that includes at least a plurality of semantic information extraction layers connected in sequence and at least two levels of category prediction layers.
2. The method according to claim 1, characterized in that According to the text lengths of the multiple training samples, the training samples whose text lengths are within the same length range are divided into the same training subset to obtain multiple training subsets, including: Sorting the multiple training samples according to the text lengths of the multiple training samples; According to the preset number of subsets, the sorted multiple training samples are evenly divided to obtain multiple training subsets, each training subset includes the same number of training samples.
3. The method according to claim 1, characterized in that The initial category prediction model is trained according to the target training samples in each training subset after random sorting to obtain prediction results of at least two levels of categories corresponding to each target training sample, including: For each training subset after random sorting, select a target training sample from the training subset, where the target training sample is each training sample or one training sample or part of the training samples in the training subset; Inputting the target training sample into the semantic information extraction layer to extract semantic information to obtain the semantic information of the target training sample; Using the pooling layer in the initial category prediction model to perform pooling processing on the semantic information of the target training sample to obtain the pooled semantic information of the target training sample; The pooled semantic information of the target training sample is respectively input into the at least two-level category prediction layer to perform at least two-level category prediction, so as to obtain the prediction result of at least two-level category corresponding to the target training sample.
4. The method according to claim 3, characterized in that: The target training sample includes a plurality of segmented words; the target training sample is input into the semantic information extraction layer in the initial category prediction model to extract semantic information to obtain the semantic information of the target training sample, including: Performing a special word segmentation adding operation on the target training sample to obtain a target training sample containing special characters; The target training sample containing special characters is input into the semantic information extraction layer in the initial category prediction model, and based on the self-attention learning mechanism, the semantic information of each word segment and the semantic association relationship between the word segment are learned to obtain the target semantic information corresponding to the special characters as the semantic information of the target training sample.
5. The method according to claim 4, characterized in that Based on the self-attention learning mechanism, the semantic association relationship between each word segment is learned to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample, including: Performing vector mapping for each word segment in the target training sample to obtain a query vector, a key vector, and a value vector corresponding to each word segment; For each of the word segments, the query vector of the word segment and the key vector of each word segment are used to calculate the matching degree respectively, so as to obtain the attention weight of each of the word segments; A full connection calculation operation is performed on the value vector of each word segment according to the attention weight of each word segment to obtain the target semantic information corresponding to the special character as the semantic information of the target training sample.
6. The method according to claim 3, characterized in that The semantic information of the target training sample is a multidimensional parameter vector; the semantic information of the target training sample is pooled using the pooling layer in the initial category prediction model to obtain the pooled semantic information of the target training sample, including: Determine a window size of a pooling window corresponding to the pooling process and a sliding step size of the pooling window, wherein the window size and the sliding step size have the same value; Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, select the maximum parameter value as output to obtain the pooled semantic information of the target training sample; or, Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the average value of all parameter values is calculated as output to obtain the pooled semantic feature vector of the target training sample; or, Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the sum of all parameter values is calculated as output to obtain the pooled semantic feature vector of the target training sample.
7. The method according to claim 5, characterized in that Inputting the pooled semantic information of the target training sample into the at least two-level category prediction layer to perform at least two-level category prediction to obtain prediction results of at least two-level categories corresponding to the target training sample, including: Inputting the pooled semantic information of the target training sample into the at least two-level category prediction layer respectively, and analyzing the similarity between the pooled semantic information and the semantic information of multiple known categories at the corresponding category level; Based on the similarity, a probability value of the target training sample belonging to a plurality of known categories included in each category level is determined as a prediction result of at least two levels of categories corresponding to the target training sample.
8. The method according to any one of claims 1 to 7, characterized in that According to the labeling results and prediction results of the same-level categories corresponding to each target training sample, the loss on the same-level categories is calculated to obtain the loss function on at least two levels of categories, including: According to the labeling results and prediction results of the same-level categories corresponding to each target training sample, loss functions on at least two levels of categories are obtained respectively; Among them, different category levels use the same loss function differently, or different category levels use different loss functions. The higher the category level, the more complicated the loss calculation method is.
9. A category prediction method, characterized in that: include: Get the text content of the category to be predicted; When the length of the text content is greater than a text length threshold supported by the target category prediction model, the text content is divided into at least two text segments, and the length of each text segment is not greater than the text length threshold; the target category prediction model includes at least a plurality of semantic information extraction layers and at least two levels of category prediction layers; Inputting the at least two text segments into at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information; the at least two semantic information extraction layers are semantic information extraction layers selected from the plurality of semantic information extraction layers and are the same in number as the at least two text segments; Generating target semantic information corresponding to the text content according to the at least two semantic information; The target semantic information is input into the at least two-level category prediction layer to perform at least two-level category prediction to obtain at least two-level categories corresponding to the text content.
10. The method according to claim 9, characterized in that Each text segment contains a plurality of segmented words; the at least two text segments are input into at least two semantic information extraction layers in the target category prediction model to extract semantic features to obtain at least two semantic information, including: Performing a special word adding operation on each of the text segments to obtain at least two text segments containing special words; According to the number of text segments, video memory is allocated to the same number of semantic information extraction layers to support their operation; Each text segment containing special characters is input into a semantic information extraction layer of the allocated video memory. Based on the self-attention learning mechanism, the semantic information of each word segment in the text segment and the semantic association relationship between the word segments are learned to obtain the target semantic information corresponding to the special characters as the semantic information of the text segment, so as to obtain at least two semantic information.
11. The method according to claim 9, characterized in that The target category prediction model further includes a pooling layer, the pooling layer having a pooling window, and the window size of the pooling window and the sliding step length of the pooling window are equal in value; Generating target semantic information corresponding to the text content according to the at least two pieces of semantic information includes: Inputting the at least two pieces of semantic information into a pooling layer in the target category prediction model, and semantically concatenating the at least two pieces of semantic information to obtain concatenated semantic information, wherein the concatenated semantic information is a multidimensional parameter vector; Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, select the maximum parameter value as output to obtain the target semantic information corresponding to the text content; or, Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the average value of all parameter values is calculated as output to obtain the target semantic information corresponding to the text content; or, Based on the window size and the sliding step size, for the multidimensional parameter vector, in the area covered by each pooling window, the sum of all parameter values is calculated as output to obtain the target semantic information corresponding to the text content.
12. The method according to claim 9, characterized in that Inputting the target semantic information into the at least two-level category prediction layer to predict at least two-level categories to obtain at least two-level categories corresponding to the text content, including: Inputting the target semantic information into the at least two-level category prediction layer respectively, and analyzing the similarity between the target semantic information and the semantic information of multiple known categories at the corresponding category level; Determine, based on the similarity, a probability value that the target training sample belongs to a plurality of known categories included in each category level; Based on the probability values of a plurality of known categories included in each category level, the known categories whose probability values are ranked before the preset ranking are selected as the at least two-level categories corresponding to the text content.
13. The method according to any one of claims 9 to 12, characterized in that: The method further comprises: When the text content is content to be posted sent by the client, at least two levels of categories corresponding to the text content are sent to the client, so that the client can display it on the posting page for the user to configure the at least two levels of categories to which the text content belongs on the posting page.
14. An electronic device, characterized in that: include: Memory and processor; The memory is used to store a computer program; the processor is coupled to the memory and is used to execute the computer program to implement the steps in the method of any one of claims 1-8 or 9-13.
15. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to implement the steps in the method according to any one of claims 1 to 8 or 9 to 13.
16. A computer program product, characterized in that The computer program product comprises a computer program / instruction, which, when executed by a processor, enables the processor to implement the steps of any one of the methods of claims 1-8 or 9-13.