Mail misclassification risk determination method and device, and medium
By comparative learning and adversarial training techniques, the representation and classifier model of email address are optimized, and problems such as high maintenance costs and poor generalization capabilities of email misclassification risk identification in the existing technology are solved, achieving higher accuracy and robustness.
Patent Information
- Application Number
- CN202411572616.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, when identifying potential missored sorting risks in the mail address text, there are problems such as high maintenance costs, poor generalization capabilities, and strong artificial dependence.
By obtaining the address data set after standardization, constructing a comparative learning data set, optimizing the pre-trained language model through a comparative learning algorithm, and training the classifier model with an adversarial training method, we evaluate the risk of misclassification of email addresses.
This method can more accurately capture the subtle differences between addresses and deep semantic representations of administrative hierarchical affiliations, improve the accuracy of email processing, reduce the possibility of error sorting, and improve the robustness and anti-interference ability of the model.
Smart Images

Figure CN119647938A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of risk determination models, and specifically to a method, device and medium for determining the risk of misclassification of mails. Background Art
[0002] In recent years, in order to identify the potential risk of missorting in the mail recipient address text, the existing technology usually solves the above problem through the following four technologies, but each technology has certain limitations and shortcomings:
[0003] The first is the rule-based method, which is to manually write a series of rules based on the known characteristics of addresses that are easy to be misclassified, such as spelling errors, irregular formats, and the inclusion of multiple place names, or extract relevant features from the address text, such as the presence or absence of keywords, character length, the number of special symbols, etc., and check whether the address conforms to these predefined rules to determine whether the address is prone to misclassification. The disadvantages of this method are: 1. High maintenance cost: As new types of misclassifications emerge, the rules need to be constantly updated and adjusted; 2. Poor generalization ability: The rules may not cover all situations, especially for new or unforeseen address formats; 3. Strong manual dependence: The quality of the rules is highly dependent on the knowledge and experience of experts.
[0004] The second is to apply the Naive Bayes algorithm, that is, to collect a large number of address samples that have been labeled as "easy to misclassify" and "not easy to misclassify" and convert the addresses into word frequency vectors, use the Naive Bayes algorithm to train the model, learn the probability distribution of different features in the two types of addresses, and for new addresses, calculate the probability that they belong to the "easy to misclassify" category and classify them accordingly. However, since Naive Bayes assumes that features are independent of each other, this is often not true in actual address data, and because it is very sensitive to frequency changes in input data, if there are some small sample data that are misclassified for special reasons, it is possible to cause probability estimation bias, so its ability to handle complex feature combination relationships is relatively limited.
[0005] Another is the random forest algorithm, which needs to recursively split the feature space to form multiple decision tree structures. During the learning process, any decision tree may over-learn the noise in the training data, and small data changes may lead to completely different tree structures. Therefore, it does not have good robustness.
[0006] Finally, there are the deep learning convolutional neural networks and long short-term memory network algorithms. The former converts the address text into word embeddings and then designs a convolutional layer to capture local features, a pooling layer to reduce the dimension, and a fully connected layer for classification. Due to the reduced processing dimension and the lack of in-depth learning of the deep semantic information in the text, it has low discrimination between similar and different addresses and does not effectively utilize external knowledge and administrative hierarchy. The latter, while facing the same problems as the former, may experience problems such as gradient vanishing or gradient exploding when processing longer sequences. Summary of the invention
[0007] In order to solve the above problems, the present application proposes a method, device and medium for determining the risk of misclassification of mails, wherein the method includes:
[0008] Obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set contains multiple positive sample address combinations and multiple negative sample address combinations; the positive sample address combination contains two addresses pointing to the same physical location; the negative sample address combination contains two addresses pointing to different physical locations; determine the negative email addresses that have been misclassified in the address data set, and the positive email addresses that have not been misclassified, and balance the order of magnitude of the negative email addresses and the positive email addresses through oversampling processing to obtain a misclassification risk data set; based on the comparative learning data set, perform comparative learning optimization on the pre-trained language model encoder; based on the misclassification risk data set, train a classifier model; input the email address to be determined into the pre-trained language model encoder optimized by comparative learning to obtain semantic information corresponding to the email address to be determined; input the semantic information into the classifier model to obtain the misclassification risk probability of the email to be determined.
[0009] In one example, the method of obtaining a standardized address data set specifically includes: obtaining an initial geographic data set, determining the field lengths corresponding to all address entries in the initial geographic data set; removing address entries whose field lengths are lower than a first preset threshold and whose field information missingness is higher than a second preset threshold; performing character standardization on the address entries and deleting non-essential elements in the address text to retain only the actual address content; the non-essential elements include at least one of spaces, tabs, quotation marks, brackets, and Chinese punctuation marks; and performing random order adjustment on the sorted data entries to obtain the standardized address data set.
[0010] In one example, the construction of a comparative learning dataset based on the address dataset specifically includes: selecting any address entry in the address dataset as a target address entry; submitting the target address entry to an API interface of a third-party service to obtain a new address description corresponding to the target address entry; the new address description is standardized to point to the same geographic location as the target address entry; determining, in the remaining address list of the address dataset, a different address entry that points to a different physical location from the target address entry; traversing all address entries in the address dataset to obtain new address descriptions and different address entries corresponding to all the address entries respectively; taking a combination of the target address entry and the new address description as a positive sample pair, and taking a combination of the target address entry and the different address entry as a negative sample pair.
[0011] In one example, determining a distinguishing address entry that points to a different physical location from the target address entry in the remaining address list of the address data set specifically includes: randomly selecting an address entry in the remaining address list of the address data set as a to-be-selected distinguishing address entry; inputting the target address entry and the to-be-selected distinguishing address entry into a pre-trained language model encoder; segmenting and encoding the address texts of the target address entry and the to-be-selected distinguishing address entry according to the vocabulary mapping of the pre-trained language model encoder to obtain a first vector corresponding to the target address entry and a second vector corresponding to the to-be-selected distinguishing address entry; padding the shorter vector of the first vector and the second vector with zeros until the first vector has the same length as the second vector; calculating the cosine similarity between the first vector and the second vector; if the cosine similarity is higher than a third preset threshold, manually annotating to determine whether the to-be-selected distinguishing address entry points to a different physical location from the target address entry; if the cosine similarity is lower than the third preset threshold, or it is determined through manual annotation that the to-be-selected distinguishing address entry and the target address entry point to different physical locations, then the to-be-selected distinguishing address entry is a distinguishing address entry of the target address entry.
[0012] In one example, the contrastive learning optimization of the pre-trained language model encoder based on the contrastive learning dataset specifically includes: dividing the contrastive learning dataset into a first training set and a first validation set according to a preset ratio; extracting data sample sets from the first training set in batches and inputting them into the pre-trained language model; encoding the data sample set according to the current vocabulary of the pre-trained language model encoder to obtain a high-dimensional embedding vector corresponding to the data sample set; calculating the average loss value of the data sample set through a preset contrastive loss function; updating the model parameters through a back propagation algorithm according to the gradient of the contrastive loss function relative to the model parameters; the model parameters at least include linear transformation matrices corresponding to queries, keys and values in the self-attention mechanism in the pre-trained language model, and the embedding vector of each word in the BERT model; repeating the training process until the contrastive loss function converges.
[0013] In one example, the contrast loss function is as follows: contrastive =y*d(a,p) 2 +(1-y)*max(0,md(a,n)) 2 Among them, L contrastive is the contrast loss function, y is a constant, d is the cosine distance between two vectors, a is the target address entry, p is another address entry in the positive sample address combination corresponding to the target address entry, n is another address entry in the negative sample address combination corresponding to the target address entry; m is a preset constant boundary value.
[0014] In one example, after the training process is repeated until the contrast loss function converges, the method further includes: dividing the contrast learning data set into positive administrative address combinations and negative administrative address combinations based on the administrative region where the target address entry is located as a label; the positive administrative address combination contains two addresses pointing to the same administrative region; the negative administrative address combination contains two addresses pointing to different administrative regions; based on the positive administrative address combination and the negative administrative address combination, weighted ratio learning optimization is performed on the pre-trained language model encoder, with different administrative region levels corresponding to different weights.
[0015] In one example, the training of the classifier model based on the misclassification risk data set specifically includes: dividing the misclassification risk data set into a second training set and a second validation set according to a preset ratio; selecting cross entropy as the loss function of the classifier model; extracting classified samples from the second training data set in batches, and obtaining labels corresponding to the classified samples; inputting the classified samples into the model, performing forward propagation to obtain a predicted output, and determining a standard loss based on the first predicted label and the correct label; calculating the gradient of the classified sample with respect to the loss function, and generating an adversarial sample corresponding to the classified sample according to the gradient direction, and adding a perturbation amount to the adversarial sample, wherein the adversarial sample is as follows: in, is the perturbation amount, which is used to control the distance between the adversarial sample and the original sample; X ′ is an adversarial sample, X is a classified sample; the adversarial sample is input into the classifier model, forward propagation is performed to obtain a second predicted label, and the adversarial loss is determined according to the second predicted label and the correct label; based on the preset weights, the standard loss and the adversarial loss are weighted to determine the total training loss corresponding to this batch of classified samples; back propagation is performed based on the total loss, and the training process is repeated to update the classifier model parameters until the loss function of the classifier model on the validation set converges.
[0016] The present application also provides a device for determining the risk of misclassification of mail, comprising: at least one processor; and a memory in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute: obtaining a standardized address data set, and constructing a comparative learning data set based on the address data set; the comparative learning data set contains a plurality of positive sample address combinations and a plurality of negative sample address combinations; the positive sample address combination contains two addresses pointing to the same physical location; the negative sample address combination contains two addresses pointing to different physical locations; The method comprises the following steps: determining the negative email addresses that have been misclassified and the positive email addresses that have not been misclassified in the address data set, balancing the order of magnitude of the negative email addresses and the positive email addresses through oversampling processing, and obtaining a misclassification risk data set; performing contrastive learning optimization on a pre-trained language model encoder based on the contrastive learning data set; training a classifier model based on the misclassification risk data set; inputting the email address to be determined into the pre-trained language model encoder optimized by contrastive learning to obtain semantic information corresponding to the email address to be determined; and inputting the semantic information into the classifier model to obtain the misclassification risk probability of the email to be determined.
[0017] The present application also provides a non-volatile computer storage medium, storing computer executable instructions, wherein the computer executable instructions are configured to: obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set includes multiple positive sample address combinations and multiple negative sample address combinations; the positive sample address combination includes two addresses pointing to the same physical location; the negative sample address combination includes two addresses pointing to different physical locations; determine the negative email addresses that have been misclassified in the address data set, and the positive email addresses that have not been misclassified, and balance the order of magnitude of the negative email addresses and the positive email addresses through oversampling processing to obtain a misclassification risk data set; based on the comparative learning data set, perform comparative learning optimization on a pre-trained language model encoder; based on the misclassification risk data set, train a classifier model; input the email address to be determined into the pre-trained language model encoder optimized by comparative learning to obtain semantic information corresponding to the email address to be determined; input the semantic information into the classifier model to obtain the misclassification risk probability of the email to be determined.
[0018] The method proposed in this application can bring the following beneficial effects:
[0019] 1. By combining the powerful text encoding and semantic understanding capabilities of the pre-trained language model, a contrastive learning algorithm is used to optimize the address representation. This method enables the system to more accurately capture the subtle differences between addresses and the deep semantic representation of administrative hierarchical affiliations. In practical applications, this optimization enables the model to not only distinguish the same address in different written forms, but also accurately identify the differences between addresses with similar geographical locations but belonging to different delivery areas. Therefore, even in the face of non-standardized or ambiguous address inputs, the system can effectively assess its risk of misclassification, thereby improving the accuracy of mail processing and reducing the possibility of incorrect sorting.
[0020] 2. The overall robustness and anti-interference ability of the email address misclassification risk determination model can be significantly improved by using adversarial training methods. By applying slight perturbations to the original training data set to generate adversarial samples and incorporating these modified data into the training process, the model can be prompted to learn to ignore insignificant changes and focus on truly important features, and to learn to understand and distinguish normal and abnormal data patterns from the essence, rather than just relying on surface features for judgment. The resulting classifier can more robustly cope with a variety of challenges in the real world, and can maintain a high degree of accuracy and stability regardless of data noise or malicious attacks, ensuring the continuity and reliability of the service. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] 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:
[0022] Figure 1 A flowchart of a method for determining the risk of misclassification of mails in an embodiment of the present application;
[0023] Figure 2 This is a schematic diagram of the structure of a device for determining the risk of misclassification of mails in an embodiment of the present application. DETAILED DESCRIPTION
[0024] 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.
[0025] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0026] Figure 1 A flowchart of a method for determining the risk of misclassification of mail provided in one or more embodiments of this specification. The method can be applied to mail sorting and delivery in the express delivery industry. The process can be executed by a computing device in the corresponding field, and some input parameters or intermediate results in the process can be manually intervened to help improve accuracy.
[0027] The analysis method involved in the embodiments of the present application can be implemented by a terminal device or a server, and the present application does not impose any special restrictions on this. For the convenience of understanding and description, the following embodiments are described in detail by taking a server as an example.
[0028] It should be noted that the server can be a single device or a system composed of multiple devices, that is, a distributed server, and this application does not make any specific limitations on this.
[0029] By integrating advanced technologies and cutting-edge algorithms such as pre-trained language models, contrastive learning algorithms, and FGM adversarial training algorithms, it aims to efficiently identify and evaluate the potential risks of incorrect sorting in the text of email recipient addresses, reduce delivery delays, and reduce unnecessary costs such as re-sorting and secondary delivery, bringing users a more stable and reliable intelligent service experience.
[0030] like Figure 1 As shown, the embodiment of the present application provides a method for determining the risk of misclassification of mails, including:
[0031] S101: Acquire a standardized address dataset, and construct a comparative learning dataset based on the address dataset.
[0032] In the data preparation stage, the address data set needs to be standardized and a comparative learning data set needs to be constructed. The standardization process here includes processing steps such as screening and filtering, character standardization, etc. The comparative learning data set contains multiple positive sample address combinations and multiple negative sample address combinations; the positive sample address combination contains two addresses pointing to the same physical location, and the negative sample address combination contains two addresses pointing to different physical locations. The comparative learning data set is subsequently used to train the language model encoder.
[0033] The above-mentioned address data set can be pre-stored in a storage device of a computer device. When a comparative learning data set and a misclassification risk data set need to be constructed, the computer device can select the address data set from the storage device. Of course, the computer device can also obtain the address data set from other external devices. For example, the address data set is stored in the cloud. When a comparative learning data set and a misclassification risk data set need to be constructed, the computer device can obtain the address data set from the cloud. This embodiment does not limit the method for obtaining the address data set.
[0034] In one embodiment, when standardizing an address data set, the following operations need to be performed: remove address entries whose lengths do not meet the expected standards, that is, records that are too short or too long; and exclude incomplete addresses with serious missing field information. Convert all full-width characters to their corresponding half-width forms to unify the format. Clean up non-essential elements such as spaces, tabs, quotation marks, various types of brackets, and Chinese punctuation marks in the address text, and only retain the actual address content. In order to reduce data deviation problems that may occur during training, the sorted data entries will be randomly ordered to ensure that the model learning will not be affected by specific arrangements. By cleaning and processing the original data, the quality and consistency of the data set used in the end can be ensured.
[0035] In one embodiment, when constructing a comparative learning data set, first select any address entry in the address data set as the target address entry, and submit the target address entry to the API interface of a third-party service such as Amap and Baidu Map to obtain a new address description corresponding to the target address entry. The new address description here is the same geographic location as the target address entry after being standardized. Then, in the remaining address list of the address data set, determine the different address entries that point to different physical locations from the target address entry, and then traverse all address entries in the address data set to obtain the new address descriptions and different address entries corresponding to all address entries, respectively, and use the combination of the target address entry and the new address description as a positive sample pair, and use the combination of the target address entry and the different address entry as a negative sample pair.
[0036] Further, when determining the difference address entry that points to a different physical location from the target address entry, it is first necessary to randomly select an address entry from the remaining address list in the address data set as the to-be-selected difference address entry, and then determine whether the to-be-selected difference address entry and the target address entry point to the same physical location. Specifically, the target address entry and the to-be-selected difference address entry are input into the pre-trained language model encoder, and the address texts of the target address entry and the to-be-selected difference address entry are segmented and encoded according to the vocabulary mapping of the pre-trained language model encoder to obtain a first vector corresponding to the target address entry and a second vector corresponding to the to-be-selected difference address entry. The first vector and the second vector are made to have the same length by zero padding the shorter vector in the first vector and the second vector. At this time, the cosine similarity between the first vector and the second vector is calculated. If the cosine similarity is higher than the third preset threshold, manual annotation is performed to determine whether the to-be-selected difference address entry points to a different physical location from the target address entry. If the cosine similarity is lower than the third preset threshold, or it is determined by manual annotation that the to-be-selected difference address entry and the target address entry point to different physical locations, then the to-be-selected difference address entry is the difference address entry of the target address entry.
[0037] In this way, for each address entry in the address dataset, two types of sentence pairs will eventually be formed: one is a positive sample pair formed with an address describing the same address object; the other is a negative sample pair formed with addresses describing different address objects. In this way, a dataset with clear structure and clear labels is constructed, which is very suitable for the contrastive learning task of the model.
[0038] S102: Determine the negative email addresses that have been misclassified and the positive email addresses that have not been misclassified in the address data set, balance the magnitudes of the negative email addresses and the positive email addresses through oversampling, and obtain a misclassification risk data set.
[0039] For each address entry in the standard corpus, the final delivery agency of the corresponding mail is compared with the delivery agency automatically determined by the system when the order is placed. According to the comparison results, each address is labeled with information on whether it is prone to misclassification. Since the number of negative mail addresses that have been misclassified is relatively small, and the number of positive mail addresses that have not been misclassified is relatively large, after a certain amount of oversampling, the order of magnitude of positive and negative labels can be balanced. In this way, a data set is formed that can be used to train the model to determine whether there is a risk of misclassification of the mail address.
[0040] Through the above steps, we will obtain a comparative learning dataset and a misclassification risk dataset, which are used to optimize the model encoding text representation and determine the risk of misclassification of email addresses respectively.
[0041] S103: Based on the contrastive learning dataset, perform contrastive learning optimization on the pre-trained language model encoder.
[0042] Using contrastive learning algorithms to optimize address representation enables the system to more accurately capture subtle differences between addresses. In practical applications, this optimization enables the model to not only distinguish the same address in different written forms, but also accurately identify the differences between addresses with similar geographical locations but belonging to different delivery areas. Therefore, even in the face of non-standardized or ambiguous address input, the system can effectively assess its risk of misclassification, thereby improving the accuracy of mail processing and reducing the possibility of incorrect sorting.
[0043] In one embodiment, when performing contrastive learning optimization, it is first necessary to divide the contrastive learning data set into a first training set and a first validation set according to a preset ratio, such as 8:2, use the first training set for training, and evaluate the model effect on the first validation set. Then extract data sample sets from the first training set in batches and input them into the pre-trained language model, encode the data sample sets according to the current vocabulary of the pre-trained language model encoder, and map them to the latent space of the text to obtain the high-dimensional embedding vector corresponding to the data sample set. The average loss value of the data sample set is calculated by the preset contrast loss function. And through the back propagation algorithm, the model parameters are updated according to the gradient of the contrast loss function relative to the model parameters; the model parameters at least include the linear transformation matrices corresponding to the query, key and value in the self-attention mechanism in the pre-trained language model, and the embedding vector of each word in the BERT model. Repeat the above training process until the contrast loss function converges.
[0044] Furthermore, the contrast loss function is designed as follows:
[0045] L contrastive =y*d(a,p) 2 +(1-y)*max(0,md(a,n)) 2
[0046] Among them, L contrastive is the contrast loss function, y is a constant, d is the cosine distance between two vectors, a is the target address entry, p is another address entry in the positive sample address combination corresponding to the target address entry, n is another address entry in the negative sample address combination corresponding to the target address entry; m is a preset constant boundary value.
[0047] Furthermore, after completing the comparative learning training for whether two addresses point to the same address object, we also use the province, city, district and county where the two addresses are located as labels, re-divide the positive and negative samples and repeat the above training process, and conduct deeper comparative representation learning training in three rounds with weighted weights. In the current task, we set the weights of province, city, district and county to 1 respectively. -5 , 2 -5 and 3 -5 .
[0048] After training based on multiple rounds of comparative representation learning with labels of different dimensions, the model distanced the address texts pointing to different address objects based on information such as province, city, district, county, and detailed address, and at the same time brought the address texts pointing to the same address object closer. When processing the input text, it encoded it more discriminatively based on its administrative divisions and detailed addresses. This not only allows it to accurately distinguish different addresses, but also allows it to understand the subtle differences in the address texts, extract deeper semantic information from the address texts, and encode external knowledge and administrative hierarchy relationships into the semantic representation of the text.
[0049] S104: Training a classifier model based on the misclassification risk dataset.
[0050] The adversarial training method is used to significantly improve the overall robustness and anti-interference ability of the email address misclassification risk determination model. By applying slight perturbations to the original training data set to generate adversarial samples and incorporating these modified data into the training process, the model can be prompted to learn to ignore insignificant changes and focus on truly important features, and to learn to understand and distinguish normal and abnormal data patterns from the essence, rather than just relying on surface features for judgment. The resulting classifier can more robustly cope with a variety of challenges in the real world, and can maintain a high degree of accuracy and stability regardless of data noise or malicious attacks, ensuring the continuity and reliability of the service.
[0051] In one embodiment, when training a classifier model, the misclassified risk data set is divided into a second training set and a second validation set according to a preset ratio, and cross entropy is selected as the loss function of the classifier model. First, the classified samples are extracted from the second training data set in batches, and the labels corresponding to the classified samples are obtained. The classified samples are input into the model, and forward propagation is performed to obtain the predicted output, and the standard loss is determined based on the first predicted label and the correct label. The gradient of the classified sample with respect to the loss function is calculated, and the adversarial sample corresponding to the classified sample is generated according to the gradient direction, and the perturbation amount is added to the adversarial sample. The adversarial sample is shown as follows:
[0052]
[0053] in, is the perturbation amount, which is used to control the distance between the adversarial sample and the original sample; X ′ is the adversarial sample, and X is the classified sample. The adversarial sample is input into the classifier model, and forward propagation is performed to obtain the second predicted label, and the adversarial loss is determined according to the second predicted label and the correct label. Based on the preset weights, the standard loss and adversarial loss are weighted to determine the total training loss corresponding to the classified samples in this batch, and then backpropagation is performed based on the total loss, and the training process is repeated to update the classifier model parameters until the loss function of the classifier model on the validation set converges.
[0054] S105: Inputting the email address to be determined into a pre-trained language model encoder optimized by contrastive learning to obtain semantic information corresponding to the email address to be determined.
[0055] S106: Inputting the semantic information into a classifier model to obtain a misclassification risk probability of the email to be determined.
[0056] The present application provides a full process for handling missorted mail based on the risk of missorting calculated for the mail delivery address text. Starting from receiving the input mail address to be determined, the system first uses a pre-trained model optimized with the help of a contrastive learning algorithm to comprehensively analyze the address content, and the classifier strengthened by adversarial training is responsible for comprehensively considering all relevant information and giving the final risk assessment result, thereby pre-discovering problem addresses that may cause incorrect mail sorting, and taking timely measures to resolve them, such as contacting customers to confirm information, pre-intervention based on the experience of the delivery department, etc. This method helps to significantly reduce the re-sorting, secondary distribution, etc. caused by address parsing errors, thereby reducing unnecessary logistics costs, while improving the efficiency and service quality of the entire delivery process. By providing a more stable and reliable intelligent service experience, the present invention has brought substantial improvements to the express delivery industry.
[0057] like Figure 2As shown, the embodiment of the present application also provides a device for determining the risk of misclassification of mails, including:
[0058] at least one processor; and,
[0059] a memory communicatively connected to the at least one processor; wherein,
[0060] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0061] Obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set contains multiple positive sample address combinations and multiple negative sample address combinations; the positive sample address combination contains two addresses pointing to the same physical location; the negative sample address combination contains two addresses pointing to different physical locations; determine the negative email addresses that have been misclassified in the address data set, and the positive email addresses that have not been misclassified, and balance the order of magnitude of the negative email addresses and the positive email addresses through oversampling processing to obtain a misclassification risk data set; based on the comparative learning data set, perform comparative learning optimization on the pre-trained language model encoder; based on the misclassification risk data set, train a classifier model; input the email address to be determined into the pre-trained language model encoder optimized by comparative learning to obtain semantic information corresponding to the email address to be determined; input the semantic information into the classifier model to obtain the misclassification risk probability of the email to be determined.
[0062] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:
[0063] Obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set contains multiple positive sample address combinations and multiple negative sample address combinations; the positive sample address combination contains two addresses pointing to the same physical location; the negative sample address combination contains two addresses pointing to different physical locations; determine the negative email addresses that have been misclassified in the address data set, and the positive email addresses that have not been misclassified, and balance the order of magnitude of the negative email addresses and the positive email addresses through oversampling processing to obtain a misclassification risk data set; based on the comparative learning data set, perform comparative learning optimization on the pre-trained language model encoder; based on the misclassification risk data set, train a classifier model; input the email address to be determined into the pre-trained language model encoder optimized by comparative learning to obtain semantic information corresponding to the email address to be determined; input the semantic information into the classifier model to obtain the misclassification risk probability of the email to be determined.
[0064] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0065] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0066] 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-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0067] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0068] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0070] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0071] The 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. The memory is an example of a computer-readable medium.
[0072] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 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, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic 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.
[0073] It should also be noted that the terms "include", "comprises" or any other variations thereof are 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 more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0074] The above is only an embodiment of the present application and is 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 in the scope of the claims of the present application.
Claims
1. A method for determining the risk of misclassification of mail, characterized in that: include: Acquire a standardized address dataset, and construct a comparative learning dataset based on the address dataset; The contrastive learning data set includes a plurality of positive sample address combinations and a plurality of negative sample address combinations; the positive sample address combination includes two addresses pointing to the same physical location; the negative sample address combination includes two addresses pointing to different physical locations; Determine the negative example email addresses that have been misclassified and the positive example email addresses that have not been misclassified in the address data set, and balance the magnitudes of the negative example email addresses and the positive example email addresses through oversampling processing to obtain a misclassification risk data set; Based on the contrastive learning dataset, performing contrastive learning optimization on the pre-trained language model encoder; Based on the misclassification risk dataset, training a classifier model; Inputting the email address to be determined into a pre-trained language model encoder optimized by contrastive learning to obtain semantic information corresponding to the email address to be determined; The semantic information is input into a classifier model to obtain a misclassification risk probability of the email to be determined.
2. The method according to claim 1, characterized in that The step of obtaining the standardized address data set specifically includes: Acquire an initial geographic data set, and determine the field lengths corresponding to all address entries in the initial geographic data set; Remove the address entries whose field length is lower than a first preset threshold and whose field information missing degree is higher than a second preset threshold; Standardizing the characters of the address entry and deleting non-essential elements in the address text, retaining only the actual address content; the non-essential elements include at least one of spaces, tabs, quotation marks, brackets, and Chinese punctuation marks; Random order adjustment is performed on the sorted data entries to obtain the standardized address data set.
3. The method according to claim 1, characterized in that The step of constructing a comparative learning dataset based on the address dataset specifically includes: Select any address entry in the address data set as a target address entry; Submit the target address entry to an API interface of a third-party service to obtain a new address description corresponding to the target address entry; the new address description points to the same geographic location as the target address entry after being standardized; Determining, in a remaining address list of the address data set, a distinct address entry pointing to a different physical location than the target address entry; Traversing all address entries in the address data set to obtain new address descriptions and distinguishing address entries respectively corresponding to all address entries; The combination of the target address entry and the new address description is taken as a positive sample pair, and the combination of the target address entry and the distinguished address entry is taken as a negative sample pair.
4. The method according to claim 3, characterized in that The determining, in the remaining address list of the address data set, a different address entry pointing to a different physical location from the target address entry specifically includes: Randomly selecting an address entry from the remaining address list of the address data set as a distinguished address entry to be selected; Inputting the target address entry and the to-be-selected distinguished address entry into a pre-trained language model encoder; Segmenting and encoding the address texts of the target address entry and the distinguished address entry to be selected according to the vocabulary mapping of the pre-trained language model encoder to obtain a first vector corresponding to the target address entry and a second vector corresponding to the distinguished address entry to be selected; Performing zero padding on the shorter vector between the first vector and the second vector until the first vector has the same length as the second vector; Calculating the cosine similarity between the first vector and the second vector; If the cosine similarity is higher than a third preset threshold, manual marking is performed to determine whether the to-be-selected distinguishing address entry points to a different physical location than the target address entry; If the cosine similarity is lower than a third preset threshold, or it is determined through manual marking that the to-be-selected distinguishing address entry and the target address entry point to different physical locations, then the to-be-selected distinguishing address entry is the distinguishing address entry of the target address entry.
5. The method according to claim 1, characterized in that The performing contrastive learning optimization on the pre-trained language model encoder based on the contrastive learning dataset specifically includes: Dividing the comparative learning data set into a first training set and a first validation set according to a preset ratio; Extracting data sample sets from the first training set in batches and inputting them into the pre-trained language model; Encoding the data sample set according to the current vocabulary of the pre-trained language model encoder to obtain a high-dimensional embedding vector corresponding to the data sample set; Calculate the average loss value of the data sample set by using a preset contrast loss function; The model parameters are updated according to the gradient of the contrastive loss function with respect to the model parameters by a back-propagation algorithm; the model parameters at least include linear transformation matrices corresponding to the query, key, and value in the self-attention mechanism in the pre-trained language model, and the embedding vector of each word in the BERT model; The training process is repeated until the contrast loss function converges.
6. The method according to claim 5, characterized in that The contrast loss function is as follows: L contrastive =y*d(a,p) 2 +(1-y)*max(0,md(a,n)) 2 Among them, L contrastive is the contrast loss function, y is a constant, d is the cosine distance between two vectors, a is the target address entry, p is another address entry in the positive sample address combination corresponding to the target address entry, n is another address entry in the negative sample address combination corresponding to the target address entry; m is a preset constant boundary value.
7. The method according to claim 6, characterized in that After repeating the training process until the contrast loss function converges, the method further includes: The comparative learning data set is divided into positive administrative address combinations and negative administrative address combinations using the administrative region where the target address entry is located as a label; the positive administrative address combination contains two addresses pointing to the same administrative region; and the negative administrative address combination contains two addresses pointing to different administrative regions; Based on the positive administrative address combination and the negative administrative address combination, the pre-trained language model encoder is optimized for weighted ratio learning, and different administrative area levels correspond to different weights.
8. The method according to claim 1, characterized in that The training of a classifier model based on the misclassification risk dataset specifically includes: Dividing the misclassification risk data set into a second training set and a second validation set according to a preset ratio; Selecting cross entropy as the loss function of the classifier model; Extracting classified samples from the second training data set in batches, and obtaining labels corresponding to the classified samples; Input the classified samples into the model, perform forward propagation to obtain the predicted output, and determine the standard loss based on the first predicted label and the correct label; Calculate the gradient of the classification sample with respect to the loss function, generate an adversarial sample corresponding to the classification sample according to the gradient direction, and add a perturbation amount to the adversarial sample. The adversarial sample is as follows: in, is the perturbation amount, which is used to control the distance between the adversarial sample and the original sample; X ′ is an adversarial sample, X is a classified sample; Inputting the adversarial sample into the classifier model, performing forward propagation to obtain a second predicted label, and determining the adversarial loss according to the second predicted label and the correct label; Based on the preset weights, the standard loss and the adversarial loss are weighted to determine the total training loss corresponding to the classification samples of this batch; Back propagation is performed based on the total loss, and the training process is repeated to update the classifier model parameters until the loss function of the classifier model on the validation set converges.
9. A device for determining the risk of misclassification of mail, characterized in that: include: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute: Obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set includes a plurality of positive sample address combinations and a plurality of negative sample address combinations; the positive sample address combination includes two addresses pointing to the same physical location; the negative sample address combination includes two addresses pointing to different physical locations; Determine the negative example email addresses that have been misclassified and the positive example email addresses that have not been misclassified in the address data set, and balance the magnitudes of the negative example email addresses and the positive example email addresses through oversampling processing to obtain a misclassification risk data set; Based on the contrastive learning dataset, performing contrastive learning optimization on the pre-trained language model encoder; Based on the misclassification risk dataset, training a classifier model; Inputting the email address to be determined into a pre-trained language model encoder optimized by contrastive learning to obtain semantic information corresponding to the email address to be determined; The semantic information is input into a classifier model to obtain a misclassification risk probability of the email to be determined.
10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Obtain a standardized address data set, and construct a comparative learning data set based on the address data set; the comparative learning data set includes a plurality of positive sample address combinations and a plurality of negative sample address combinations; the positive sample address combination includes two addresses pointing to the same physical location; the negative sample address combination includes two addresses pointing to different physical locations; Determine the negative example email addresses that have been misclassified and the positive example email addresses that have not been misclassified in the address data set, and balance the magnitudes of the negative example email addresses and the positive example email addresses through oversampling processing to obtain a misclassification risk data set; Based on the contrastive learning dataset, performing contrastive learning optimization on the pre-trained language model encoder; Based on the misclassification risk dataset, training a classifier model; Inputting the email address to be determined into a pre-trained language model encoder optimized by contrastive learning to obtain semantic information corresponding to the email address to be determined; The semantic information is input into a classifier model to obtain a misclassification risk probability of the email to be determined.
Citation Information
Cited By
Address standardization and dynamic management method
CN120371939A