Model construction method, relationship determination method, device, medium and equipment
By constructing a relationship recognition model, using the characteristics in the interactive document information to learn the upstream and downstream relationship characteristics of the enterprise, the problem of being unable to accurately judge the upstream and downstream relationships of the enterprise in the existing technology is solved, and the identification accuracy is improved.
Patent Information
- Application Number
- CN202210451863.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-04-26
AI Technical Summary
The prior art cannot accurately determine the upstream and downstream relationship of an enterprise without transaction order information, and relies too much on the keywords in the text information of the enterprise name or business scope, resulting in inaccurate determination of upstream and downstream relationships.
By obtaining positive and negative sample pairs in the enterprise set, using natural language processing model to extract features from interactive document information, construct a relationship recognition model, learn the features of the existence and absence of upstream and downstream relationships, and expand the negative sample pair to improve the model Identify accuracy.
The accuracy of the model when identifying the upstream and downstream relationships of the enterprise is improved, and the problem of incomplete text information is solved.
Smart Images

Figure CN114840750B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a model construction method, a relationship determination method, an apparatus, a medium and a device. Background Art
[0002] In some business scenarios, users are often recommended related companies, and the upstream and downstream relationship between companies is an important factor in determining whether to recommend. In related technologies, the upstream and downstream relationship is often established after obtaining the names of Company A and Company B through transaction order information. Alternatively, industries with upstream and downstream relationships are defined through artificially set rules, and then upstream and downstream relationships are established based on the company's name or keywords in the business scope.
[0003] However, the first method mentioned above cannot determine the upstream and downstream relationships of companies without transaction order information, and the second method relies too much on keywords in text information such as the company's name or business scope. If the text information is incomplete, it is impossible to accurately determine the upstream and downstream relationships. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a model construction method, a relationship determination method, an apparatus, a medium and a device.
[0005] In a first aspect, the present disclosure provides a method for constructing a model, the method comprising: obtaining a plurality of positive sample pairs from an enterprise set, each of the positive sample pairs comprising two sample enterprises with upstream and downstream relationships; obtaining negative sample pairs from the enterprise set based on the plurality of positive sample pairs, each of the negative sample pairs comprising two sample enterprises without upstream and downstream relationships; obtaining positive sample features corresponding to each of the positive sample pairs and negative sample features corresponding to each of the negative sample pairs; using the plurality of positive sample pairs, the plurality of positive sample features corresponding to the plurality of positive sample pairs, the plurality of negative sample pairs and the plurality of negative sample features corresponding to the plurality of negative sample pairs as the training sample pairs; and constructing a relationship recognition model based on the training sample pairs and the upstream and downstream relationships corresponding to the training sample pairs.
[0006] Optionally, the obtaining a plurality of positive sample pairs from the enterprise set includes: obtaining a plurality of positive sample pairs from the enterprise set according to interaction document information between enterprises.
[0007] Optionally, the interactive document information includes at least transaction document information, invoice information or contract information, and the obtaining of multiple positive sample pairs from the enterprise set based on the interactive document information between enterprises includes: extracting text information from the interactive document information between enterprises; using a natural language processing model to identify enterprises with upstream and downstream relationships from the text information.
[0008] Optionally, the method of obtaining multiple positive sample pairs from the enterprise set further includes: determining the multiple positive sample pairs obtained based on the interaction information between enterprises as the first batch of positive sample pairs; determining the first batch of enterprise categories corresponding to each enterprise in the first batch of positive sample pairs, and performing a difference set between the first batch of enterprise categories and the enterprise categories included in a preset enterprise category database to obtain a second batch of enterprise categories; and obtaining a second batch of positive sample pairs from the enterprise set based on the second batch of enterprise categories.
[0009] Optionally, obtaining a second batch of positive sample pairs from the enterprise set based on the second batch of enterprise categories includes: determining enterprise category pairs in the second batch of enterprise categories according to preset identification rules, each of the enterprise category pairs including two enterprise categories with upstream and downstream relationships; and obtaining a second batch of positive sample pairs corresponding to the enterprise category pairs from the enterprise set.
[0010] Optionally, obtaining negative sample pairs from the enterprise set based on the multiple positive sample pairs includes: obtaining a first negative sample enterprise and a second negative sample enterprise from the multiple positive sample pairs, the first negative sample enterprise and the second negative sample enterprise having the same upstream enterprise and the same downstream enterprise; and using the first negative sample enterprise and the second negative sample enterprise as the first candidate sample pair; establishing multiple upstream and downstream relationship links based on the multiple positive sample pairs, each upstream and downstream relationship link including multiple sample enterprises in the positive sample pairs; and obtaining two sample enterprises that are not in the same upstream and downstream relationship link from the enterprise set as the second candidate sample pair; and using the first candidate sample pair and the second candidate sample pair as the negative sample pair.
[0011] Optionally, obtaining the positive sample feature corresponding to each of the positive sample pairs and the negative sample feature corresponding to each of the negative sample pairs includes: obtaining the first sample feature and the second sample feature corresponding to each target sample pair; wherein the target sample includes the positive sample pair or the negative sample pair; determining a combined sample feature of the first sample feature and the second sample feature based on the first sample feature and the second sample feature; using the first sample feature, the second sample feature and the combined sample feature as the target sample feature; wherein, in the case where the target sample includes the positive sample pair, the target sample feature includes the positive sample feature; and in the case where the target sample includes the negative sample pair, the target sample feature includes the negative sample feature.
[0012] In a second aspect, the present disclosure provides a method for determining upstream and downstream relationships of enterprises based on the relationship identification model described in the first aspect of the present disclosure, the method comprising: obtaining a first enterprise feature of a first target enterprise and a second enterprise feature of a second target enterprise; inputting the first enterprise feature and the second enterprise feature into a pre-trained relationship identification model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship identification model.
[0013] Optionally, the method also includes: determining the combined enterprise characteristics of the first target enterprise and the second target enterprise based on the first enterprise characteristics and the second enterprise characteristics; the inputting the first enterprise characteristics and the second enterprise characteristics into a pre-trained relationship recognition model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship recognition model includes: inputting the first enterprise characteristics, the second enterprise characteristics and the combined enterprise characteristics into a pre-trained relationship recognition model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship recognition model.
[0014] In a third aspect, the present disclosure provides a device for constructing a relationship recognition model, the device comprising: a first acquisition module, used to obtain multiple positive sample pairs in an enterprise set, each of the positive sample pairs including two sample enterprises with upstream and downstream relationships; a second acquisition module, used to obtain negative sample pairs from the enterprise set based on the multiple positive sample pairs, each of the negative sample pairs including two sample enterprises without upstream and downstream relationships; a third acquisition module, used to obtain positive sample features corresponding to each of the positive sample pairs and negative sample features corresponding to each of the negative sample pairs; a sample determination module, used to use the obtained multiple positive sample pairs, the multiple positive sample features corresponding to the multiple positive sample pairs, the multiple negative sample pairs and the multiple negative sample features corresponding to the multiple negative sample pairs as the training sample pairs; a model construction module, used to construct a relationship recognition model based on the training sample pairs and the upstream and downstream relationships corresponding to the training sample pairs.
[0015] Optionally, the first acquisition module is used to acquire a plurality of positive sample pairs from the enterprise set according to interaction document information between enterprises.
[0016] Optionally, the first acquisition module includes: an extraction submodule for extracting text information from interactive document information between enterprises; and an identification submodule for identifying enterprises with upstream and downstream relationships from the text information using a natural language processing model.
[0017] Optionally, the first acquisition module also includes: a first determination submodule, used to determine multiple positive sample pairs obtained based on the interaction information between enterprises as the first batch of positive sample pairs; a second determination submodule, used to determine the first batch of enterprise categories corresponding to each enterprise in the first batch of positive sample pairs, and to perform a difference set between the first batch of enterprise categories and the enterprise categories included in the preset enterprise category database to obtain a second batch of enterprise categories; and a third determination submodule, used to obtain a second batch of positive sample pairs from the enterprise set based on the second batch of enterprise categories.
[0018] Optionally, the third determination submodule is used to determine the enterprise category pairs in the second batch of enterprise categories according to preset identification rules, each of the enterprise category pairs including two enterprise categories with upstream and downstream relationships; and obtain a second batch of positive sample pairs corresponding to the enterprise category pairs from the enterprise set.
[0019] Optionally, the second acquisition module includes: a fourth determination submodule, used to obtain a first negative sample enterprise and a second negative sample enterprise from a plurality of the positive sample pairs, wherein the first negative sample enterprise and the second negative sample enterprise have the same upstream enterprise and the same downstream enterprise; and use the first negative sample enterprise and the second negative sample enterprise as the first candidate sample pair; a fifth determination submodule, used to establish a plurality of upstream and downstream relationship links based on the plurality of positive sample pairs, each upstream and downstream relationship link including a plurality of sample enterprises in the positive sample pairs; and obtain two sample enterprises that are not in the same upstream and downstream relationship link from the enterprise set as the second candidate sample pair; and a sixth determination submodule, used to use the first candidate sample pair and the second candidate sample pair as the negative sample pair.
[0020] Optionally, the third acquisition module includes: an acquisition submodule, used to acquire the first sample feature and the second sample feature corresponding to each target sample pair; wherein the target sample includes the positive sample pair or the negative sample pair; a seventh determination submodule, used to determine the combined sample feature of the first sample feature and the second sample feature based on the first sample feature and the second sample feature; an eighth determination submodule, used to use the first sample feature, the second sample feature and the combined sample feature as the target sample feature; wherein, in the case where the target sample includes the positive sample pair, the target sample feature includes the positive sample feature; in the case where the target sample includes the negative sample pair, the target sample feature includes the negative sample feature.
[0021] In a fourth aspect, the present disclosure provides a device for determining upstream and downstream relationships of enterprises based on the relationship identification model described in the first aspect of the present disclosure, the device comprising: a feature acquisition module, used to obtain a first enterprise feature of a first target enterprise and a second enterprise feature of a second target enterprise; a relationship determination module, used to input the first enterprise feature and the second enterprise feature into a pre-trained relationship identification model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship identification model.
[0022] Optionally, the device also includes: a feature combination module, used to determine the combined enterprise features of the first target enterprise and the second target enterprise based on the first enterprise features and the second enterprise features; the relationship determination module, used to input the first enterprise features, the second enterprise features and the combined enterprise features into a pre-trained relationship recognition model to obtain the upstream and downstream relationships corresponding to the first target enterprise and the second target enterprise output by the relationship recognition model.
[0023] In a fifth aspect, the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect of the present disclosure or the steps of the method described in the second aspect of the present disclosure.
[0024] In a sixth aspect, the present disclosure provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of the present disclosure or the steps of the method described in the second aspect of the present disclosure.
[0025] Through the above technical solution, multiple positive sample pairs are obtained from the enterprise set, each positive sample pair includes two sample enterprises with upstream and downstream relationships; based on the multiple positive sample pairs, negative sample pairs are obtained from the enterprise set, each negative sample pair includes two sample enterprises without upstream and downstream relationships; the positive sample features corresponding to each positive sample pair and the negative sample features corresponding to each negative sample pair are obtained; the obtained multiple positive sample pairs, multiple positive sample features corresponding to multiple positive sample pairs, multiple negative sample pairs and multiple negative sample features corresponding to multiple negative sample pairs are used as the training sample pairs; a relationship recognition model is constructed based on the training sample pairs and the upstream and downstream relationships corresponding to the training sample pairs. Through the above technical solution, in the case of only positive sample pairs, negative sample pairs are expanded based on positive sample pairs, and a relationship recognition model is constructed based on the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample enterprises with upstream and downstream relationships based on the positive sample pairs, and learn the features of sample enterprises without upstream and downstream relationships based on the negative sample pairs, thereby improving the accuracy of model recognition.
[0026] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0028] Figure 1 is a flow chart of a method for constructing a relationship identification model according to an exemplary embodiment;
[0029] Figure 2 is a flowchart of another method for constructing a relationship identification model according to an exemplary embodiment;
[0030] Figure 3 is a flowchart of another method for constructing a relationship identification model according to an exemplary embodiment;
[0031] Figure 4 is a flowchart of another method for constructing a relationship identification model according to an exemplary embodiment;
[0032] Figure 5 is a flowchart of another method for constructing a relationship identification model according to an exemplary embodiment;
[0033] Figure 6 is a flow chart of a method for determining upstream and downstream relationships of enterprises according to an exemplary embodiment;
[0034] Figure 7 is a flow chart of another method for determining upstream and downstream relationships of enterprises according to an exemplary embodiment;
[0035] Figure 8 is a block diagram of a device for constructing a relationship identification model according to an exemplary embodiment;
[0036] Fig. 9 is a block diagram of another apparatus for constructing a relationship identification model according to an exemplary embodiment;
[0037] Fig.10 is a block diagram of another apparatus for constructing a relationship identification model according to an exemplary embodiment;
[0038] Fig.11 is a block diagram of another apparatus for constructing a relationship identification model according to an exemplary embodiment;
[0039] Fig.12 is a block diagram of another apparatus for constructing a relationship identification model according to an exemplary embodiment;
[0040] Fig.13 is a block diagram of a device for determining upstream and downstream relationships of enterprises according to an exemplary embodiment;
[0041] Fig.14 is a block diagram of another device for determining upstream and downstream relationships of enterprises according to an exemplary embodiment;
[0042] Fig.15 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0043] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0044] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.
[0045] In the description below, words such as “first” and “second” are only used for the purpose of distinguishing the description and should not be understood as indicating or implying relative importance or order.
[0046] Before introducing the model construction method, relationship determination method, device, medium and equipment provided by the present disclosure, the application scenarios involved in each embodiment of the present disclosure are first introduced. In the related art, the upstream and downstream relationship is often established after obtaining the company names of Party A and Party B through the transaction order information. However, the problem with this method is that it is impossible to determine the upstream and downstream relationship of enterprises without transaction order information. Another way is to define the industries with upstream and downstream relationships through artificially set rules, for example, "steel plant" is the upstream of "metal products plant". Then select two enterprises whose names or business scopes contain the keywords "steel plant" and "metal products plant", and establish an upstream and downstream relationship between the two. However, this method relies too much on keywords in text information such as the name of the enterprise or the scope of business, and cannot accurately determine the upstream and downstream relationship for the incomplete text information of the enterprise.
[0047] In order to solve the above problems, the present disclosure provides a model construction method, relationship determination method, device, medium and equipment. When there are only positive sample pairs, negative sample pairs are expanded according to the positive sample pairs, and a relationship recognition model is constructed according to the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample enterprises with upstream and downstream relationships according to the positive sample pairs, and learn the features of sample enterprises without upstream and downstream relationships according to the negative sample pairs, thereby improving the accuracy of model recognition.
[0048] The specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0049] Figure 1 A method for constructing a relationship identification model according to an exemplary embodiment is shown. Figure 1 As shown, the method may include the following steps:
[0050] In step S101, a plurality of positive sample pairs in the enterprise set are obtained.
[0051] For example, multiple positive sample pairs can be obtained from the enterprise set based on the interactive document information between enterprises. The interactive document information may include, for example but not limited to, transaction order information, invoice information, or contract information, etc. The enterprise set includes multiple sample enterprises, and each positive sample pair includes two sample enterprises with upstream and downstream relationships.
[0052] In some embodiments, text information may be first extracted from the interactive document information between enterprises. Then, a natural language processing model may be used to identify enterprises with upstream and downstream relationships from the text information. If the interactive document information is in the form of an image, the text information may be first extracted from the interactive document information of the enterprise using an OCR (Optical Character Recognition) model. Then, a natural language processing model (NLP) may be further used to identify enterprises with upstream and downstream relationships from the text information.
[0053] In step S102, negative sample pairs are obtained from the enterprise set according to the multiple positive sample pairs.
[0054] Each of the negative sample pairs includes two sample enterprises that do not have an upstream or downstream relationship.
[0055] In step S103, the positive sample features corresponding to each positive sample pair and the negative sample features corresponding to each negative sample pair are obtained.
[0056] Among them, the positive sample features may include, for example but not limited to, the province information, city information, registered capital information, annual profit information, enterprise scale information, enterprise label, enterprise category information, etc. of the two sample enterprises in the positive sample pair. The negative sample features may include, for example but not limited to, the province information, city information, registered capital information, annual profit information, enterprise scale information, enterprise label, enterprise category information, etc. of the two sample enterprises in the negative sample pair.
[0057] In step S104, the obtained multiple positive sample pairs, multiple positive sample features corresponding to the multiple positive sample pairs, multiple negative sample pairs, and multiple negative sample features corresponding to the multiple negative sample pairs are used as training sample pairs.
[0058] In this step, the obtained multiple positive sample pairs, multiple positive sample features corresponding to the multiple positive sample pairs, multiple negative sample pairs, and multiple negative sample features corresponding to the multiple negative sample pairs can be used as training sample pairs, so as to train the training model according to the training sample pairs. The training model may be, for example but not limited to, a Softmax model, an SVM (Support Vector Machine) model, a KNN (k-Nearest Neighbors) model, a decision tree model, a Boosting model, an Adaboost model, a GBDT (GradientBoosting Decision Tree) model, or an XGBoost model.
[0059] In step S105, a relationship recognition model is constructed according to the training sample pair and the upstream and downstream relationship corresponding to the training sample pair.
[0060] The upstream and downstream relationship corresponding to the training sample pair is the real upstream and downstream relationship between the two sample enterprises in the training sample pair. Furthermore, the training model can be trained according to the training sample pair and the upstream and downstream relationship corresponding to the training sample pair to obtain the relationship recognition model.
[0061] For example, the upstream and downstream relationships of the training sample pairs can be marked by labels. For example, if the training sample pair includes enterprise A and enterprise B, if A is upstream of B, then A is marked as 1 and B is marked as -1; if A and B have no upstream and downstream relationship, then both A and B are marked as 0.
[0062] By adopting the above technical solution, when there are only positive sample pairs, negative sample pairs are expanded based on the positive sample pairs, and a relationship recognition model is constructed based on the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample companies with upstream and downstream relationships based on the positive sample pairs, and learn the features of sample companies without upstream and downstream relationships based on the negative sample pairs, thereby improving the accuracy of model recognition.
[0063] Figure 2 Another method for constructing a relationship identification model according to an exemplary embodiment is shown. Figure 2 As shown, in order to further expand the number of positive sample pairs, the above step S101 of obtaining multiple positive sample pairs in the enterprise set may further include the following steps:
[0064] In step S1011, multiple positive sample pairs obtained according to the interactive information between enterprises are determined as the first batch of positive sample pairs.
[0065] In step S1012, the first batch of enterprise categories corresponding to each enterprise in the first batch of positive sample pairs is determined, and the first batch of enterprise categories is subtracted from the enterprise categories included in the preset enterprise category database to obtain the second batch of enterprise categories.
[0066] In this step, firstly, the enterprise categories involved in the sample enterprises in the first batch of positive sample pairs can be counted to obtain the first batch of enterprise categories corresponding to each sample enterprise. Then, the first batch of enterprise categories are subtracted from all enterprise categories in the preset enterprise category database to obtain the second batch of enterprise categories to supplement the enterprise categories not involved in the first batch of positive sample pairs, thereby expanding the number of samples. The preset enterprise category database includes multiple enterprise categories.
[0067] In step S1013, a second batch of positive sample pairs is obtained from the enterprise set according to the second batch of enterprise categories.
[0068] For example, Figure 3 As shown, step S10131 of obtaining a second batch of positive sample pairs from the enterprise set according to the second batch of enterprise categories may include:
[0069] In step S1013a, enterprise category pairs in the second batch of enterprise categories are determined according to a preset identification rule, each of which includes two enterprise categories having an upstream and downstream relationship.
[0070] The preset identification rule may be a pre-set pair of enterprise categories with upstream and downstream relationships, such as "clothing production-clothing retail", where "clothing production" is an upstream enterprise category and "clothing retail" is a downstream enterprise category. Another example is "steel plant-steel product plant", where "steel plant" is an upstream enterprise category and "steel product plant" is a downstream enterprise category. In this step, the preset identification rule may be used to determine the enterprise category pairs with upstream and downstream relationships in the second batch of enterprise categories.
[0071] In step S1013b, a second batch of positive sample pairs corresponding to the enterprise category pair is obtained from the enterprise set.
[0072] The enterprise set also includes the correspondence between enterprise categories and sample enterprises, and each enterprise category corresponds to at least one sample enterprise. Two sample enterprises corresponding to the two enterprise categories in the enterprise category pair can be obtained from the enterprise set to form the second batch of positive sample pairs.
[0073] Figure 4 Another method for constructing a relationship identification model according to an exemplary embodiment is shown. Figure 4 As shown, the above step S102 of obtaining negative sample pairs from the enterprise set according to the multiple positive sample pairs may include the following steps:
[0074] In step S1021, a first negative sample enterprise and a second negative sample enterprise are obtained from multiple positive sample pairs, wherein the first negative sample enterprise and the second negative sample enterprise have the same upstream enterprise and the same downstream enterprise; and the first negative sample enterprise and the second negative sample enterprise are used as the first candidate sample pair.
[0075] Among them, if two sample enterprises correspond to the same upstream enterprise and the same downstream enterprise, it can be determined that the two sample enterprises are completely similar enterprises, that is, there is no upstream and downstream relationship between the two sample enterprises. Specifically, a first negative sample enterprise and a second negative sample enterprise with the same upstream enterprise and the same downstream enterprise can be obtained from multiple positive sample pairs, and the first negative sample enterprise and the second negative sample enterprise are used as the first candidate sample pair, and the first candidate sample pair is a sample pair without an upstream and downstream relationship.
[0076] In step S1022, multiple upstream and downstream relationship links are established based on the multiple positive sample pairs, each upstream and downstream relationship link includes sample enterprises in the multiple positive sample pairs; and two sample enterprises that are not in the same upstream and downstream relationship link are obtained from the enterprise set as second candidate sample pairs.
[0077] For example, take the case of three positive sample pairs as an example. If A and B are positive sample pairs with upstream and downstream relationships, and A is the upstream enterprise of B; if C and D are positive sample pairs with upstream and downstream relationships, and C is the upstream enterprise of D; if B and E are positive sample pairs with upstream and downstream relationships, and B is the upstream enterprise of E. Based on these three positive sample pairs, an upstream and downstream relationship link is established, and it can be known that there are two upstream and downstream relationship links, namely ABE and CD. Then, two sample enterprises that are not in the same upstream and downstream relationship link can be used as the second candidate sample pair. For example, AC, AD, BC, BD, EC and ED can be used as the second candidate sample pair, respectively. The second candidate sample pair is a sample pair without upstream and downstream relationships.
[0078] In step S1023, the first candidate sample pair and the second candidate sample pair are used as the negative sample pair.
[0079] Figure 5 Another method for constructing a relationship identification model according to an exemplary embodiment is shown. Figure 5 As shown, the above step S103 of obtaining the positive sample features corresponding to each positive sample pair and the negative sample features corresponding to each negative sample pair may include the following steps:
[0080] In step S1031, the first sample feature and the second sample feature corresponding to each target sample pair are obtained.
[0081] The target sample includes a positive sample pair or a negative sample pair.
[0082] For example, when the target sample includes a positive sample pair, the first sample feature and the second sample feature corresponding to the two sample companies in each positive sample pair are obtained. When the target sample includes a negative sample pair, the first sample feature and the second sample feature corresponding to the two sample companies in each negative sample pair are obtained.
[0083] In step S1032, a combined sample feature of the first sample feature and the second sample feature is determined according to the first sample feature and the second sample feature.
[0084] In order to enable the model to learn more sample features and determine the feature relationship between the first sample feature and the second sample feature, in this embodiment, a combined sample feature can be obtained based on the first sample feature and the second sample feature.
[0085] For example, if the first sample feature and the second sample feature are enumerated value data, such as province information or city information, the combined sample feature can be whether the first sample feature and the second sample feature are the same. For example, if the first sample feature is the province information of company A and the second sample feature is the province information of company B, the combined sample feature is whether the province of company A and company B is the same.
[0086] If the first sample feature and the second sample feature are numerical data, such as registered capital information or annual profit information, the combined sample feature may be the sum and difference of the first sample feature and the second sample feature. For example, if the first sample feature is the registered capital information of Company A and the second sample feature is the registered capital information of Company B, the combined sample feature may be the sum of the registered capital of Company A and the registered capital of Company B and the difference between the registered capital of Company A and the registered capital of Company B.
[0087] If the first sample feature and the second sample feature are label-type data, such as enterprise labels or enterprise size information or enterprise category information, then the combined sample feature can be the number of identical features in the first sample feature and the second sample feature. For example, if the first sample feature is the number of enterprise labels of enterprise A, and the second sample feature is the number of enterprise labels of enterprise B, then the combined sample feature is the number of enterprise labels that are identical to enterprise A and enterprise B. In some embodiments, the enterprise labels can first be segmented, and multiple segmented words after the segmentation process can be deduplicated. Then the first sample feature can be the number of segmented words after the enterprise label of enterprise A is segmented and deduplicated, and the second sample feature is the number of segmented words after the enterprise label of enterprise B is segmented and deduplicated. Then the combined sample feature is the number of enterprise labels that are identical to enterprise A and enterprise B.
[0088] In step S1033, the first sample feature, the second sample feature and the combined sample feature are used as the target sample feature.
[0089] Wherein, when the target sample includes a positive sample pair, the target sample feature includes a positive sample feature; when the target sample includes a negative sample pair, the target sample feature includes the negative sample feature.
[0090] Figure 6 A method for determining upstream and downstream relationships of an enterprise is shown according to an exemplary embodiment. Figure 6 As shown, the method may include the following steps:
[0091] In step S201, a first enterprise characteristic of a first target enterprise and a second enterprise characteristic of a second target enterprise are obtained.
[0092] In step S202, the first enterprise feature and the second enterprise feature are input into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
[0093] Among them, the relationship recognition model can be Figures 1 to 5 The construction method of the relationship recognition model is obtained.
[0094] In order to further expand the enterprise characteristics, such as Figure 7 As shown, the method may also include the following steps:
[0095] In step S203, the combined enterprise characteristics of the first target enterprise and the second target enterprise are determined according to the first enterprise characteristics and the second enterprise characteristics.
[0096] In this step, the combined enterprise characteristics of the first target enterprise and the second target enterprise are determined according to the first enterprise characteristics and the second enterprise characteristics. The example in step S1032 can be referred to and will not be described in detail here.
[0097] Correspondingly, in the above step S202, inputting the first enterprise characteristic and the second enterprise characteristic into a pre-trained relationship recognition model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship recognition model may include: inputting the first enterprise characteristic, the second enterprise characteristic and the combined enterprise characteristic into a pre-trained relationship recognition model to obtain the upstream and downstream relationship corresponding to the first target enterprise and the second target enterprise output by the relationship recognition model.
[0098] By adopting the above technical solution, when there are only positive sample pairs, negative sample pairs are expanded based on the positive sample pairs, and a relationship recognition model is constructed based on the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample companies with upstream and downstream relationships based on the positive sample pairs, and learn the features of sample companies without upstream and downstream relationships based on the negative sample pairs, thereby improving the accuracy of model recognition.
[0099] Figure 8 A device for constructing a relationship recognition model according to an exemplary embodiment is shown. Figure 8 As shown, the device 300 includes:
[0100] The first acquisition module 301 is used to acquire multiple positive sample pairs in the enterprise set, each of which includes two sample enterprises in an upstream and downstream relationship;
[0101] A second acquisition module 302 is used to acquire negative sample pairs from the enterprise set according to the multiple positive sample pairs, each of which includes two sample enterprises that do not have an upstream-downstream relationship;
[0102] The third acquisition module 303 is used to obtain the positive sample features corresponding to each positive sample pair and the negative sample features corresponding to each negative sample pair;
[0103] The sample determination module 304 is used to use the obtained multiple positive sample pairs, the multiple positive sample features corresponding to the multiple positive sample pairs, the multiple negative sample pairs and the multiple negative sample features corresponding to the multiple negative sample pairs as the training sample pairs;
[0104] The model building module 305 is used to build a relationship recognition model according to the training sample pair and the upstream and downstream relationship corresponding to the training sample pair.
[0105] Optionally, the first acquisition module 301 is used to acquire a plurality of positive sample pairs from the enterprise set according to the interactive document information between enterprises.
[0106] Alternatively, if Fig. 9 As shown, the first acquisition module 301 includes:
[0107] Extraction submodule 3011, used to extract text information from interactive document information between enterprises;
[0108] The identification submodule 3012 is used to identify the enterprises with upstream and downstream relationships from the text information using a natural language processing model.
[0109] Alternatively, if Fig.10 As shown, the first acquisition module 301 also includes:
[0110] The first determination submodule 3013 is used to determine the multiple positive sample pairs obtained according to the interactive information between enterprises as the first batch of positive sample pairs;
[0111] The second determination submodule 3014 is used to determine the first batch of enterprise categories corresponding to each enterprise in the first batch of positive sample pairs, and to perform a difference set between the first batch of enterprise categories and the enterprise categories included in the preset enterprise category database to obtain the second batch of enterprise categories;
[0112] The third determination submodule 3015 is used to obtain a second batch of positive sample pairs from the enterprise set according to the second batch of enterprise categories.
[0113] Optionally, the third determination submodule 3015 is used to determine the enterprise category pairs in the second batch of enterprise categories according to preset identification rules, each of the enterprise category pairs including two enterprise categories with upstream and downstream relationships; and obtain the second batch of positive sample pairs corresponding to the enterprise category pairs from the enterprise set.
[0114] Alternatively, if Fig.11 As shown, the second acquisition module 302 includes:
[0115] The fourth determination submodule 3021 is used to obtain a first negative sample enterprise and a second negative sample enterprise from the plurality of positive sample pairs, wherein the first negative sample enterprise and the second negative sample enterprise have the same upstream enterprise and the same downstream enterprise; and use the first negative sample enterprise and the second negative sample enterprise as the first candidate sample pair;
[0116] The fifth determination submodule 3022 is used to establish multiple upstream and downstream relationship links according to the multiple positive sample pairs, each upstream and downstream relationship link includes multiple sample enterprises in the positive sample pairs; and obtain two sample enterprises that are not in the same upstream and downstream relationship link from the enterprise set as second candidate sample pairs;
[0117] The sixth determination submodule 3023 is configured to use the first candidate sample pair and the second candidate sample pair as the negative sample pair.
[0118] Alternatively, if Fig.12 As shown, the third acquisition module 303 includes:
[0119] An acquisition submodule 3031 is used to acquire a first sample feature and a second sample feature corresponding to each target sample pair; wherein the target sample includes the positive sample pair or the negative sample pair;
[0120] A seventh determination submodule 3032 is used to determine a combined sample feature of the first sample feature and the second sample feature according to the first sample feature and the second sample feature;
[0121] The eighth determination submodule 3033 is used to use the first sample feature, the second sample feature and the combined sample feature as the target sample feature; wherein, when the target sample includes the positive sample pair, the target sample feature includes the positive sample feature; when the target sample includes the negative sample pair, the target sample feature includes the negative sample feature.
[0122] By using the above device, when there are only positive sample pairs, negative sample pairs are expanded based on the positive sample pairs, and a relationship recognition model is constructed based on the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample companies with upstream and downstream relationships based on the positive sample pairs, and learn the features of sample companies without upstream and downstream relationships based on the negative sample pairs, thereby improving the accuracy of model recognition.
[0123] Fig.13 A device for determining upstream and downstream relationships of enterprises is shown according to an exemplary embodiment. Fig.13 As shown, the device 400 includes:
[0124] A feature acquisition module 401 is used to acquire a first enterprise feature of a first target enterprise and a second enterprise feature of a second target enterprise;
[0125] The relationship determination module 402 is used to input the first enterprise feature and the second enterprise feature into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
[0126] Alternatively, if Fig.14 As shown, the device 400 also includes:
[0127] A feature combination module 403 is used to determine the combined enterprise features of the first target enterprise and the second target enterprise according to the first enterprise feature and the second enterprise feature;
[0128] The relationship determination module 402 is used to input the first enterprise feature, the second enterprise feature and the combined enterprise feature into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
[0129] By using the above device, when there are only positive sample pairs, negative sample pairs are expanded based on the positive sample pairs, and a relationship recognition model is constructed based on the positive sample features of the positive sample pairs and the negative sample features of the negative sample pairs, so that the model can learn the features of sample companies with upstream and downstream relationships based on the positive sample pairs, and learn the features of sample companies without upstream and downstream relationships based on the negative sample pairs, thereby improving the accuracy of model recognition.
[0130] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0131] Fig.15 FIG. 5 is a block diagram of an electronic device 500 according to an exemplary embodiment. Fig.15 As shown, the electronic device 500 may include: a processor 501 and a memory 502. The electronic device 500 may also include one or more of a multimedia component 503, an input / output (I / O) interface 504, and a communication component 505.
[0132] The processor 501 is used to control the overall operation of the electronic device 500 to complete all or part of the steps in the above-mentioned method for constructing a relationship identification model or the method for determining the upstream and downstream relationship of an enterprise. The memory 502 is used to store various types of data to support the operation of the electronic device 500, and these data may include, for example, instructions for any application or method used to operate on the electronic device 500, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 503 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 502 or sent through the communication component 505. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 504 provides an interface between the processor 501 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 505 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0133] In an exemplary embodiment, the electronic device 500 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned method for constructing a relationship identification model or the method for determining the upstream and downstream relationships of enterprises.
[0134] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the method for constructing the above-mentioned relationship identification model or the method for determining the upstream and downstream relationship of an enterprise are implemented. For example, the non-transitory computer-readable storage medium may be the memory 502 including the program instructions, and the program instructions may be executed by the processor 501 of the electronic device 500 to complete the method for constructing the above-mentioned relationship identification model or the method for determining the upstream and downstream relationship of an enterprise.
[0135] In another exemplary embodiment, a computer program product is also provided, which includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned method for constructing a relationship identification model or the method for determining upstream and downstream relationships of enterprises when executed by the programmable device.
[0136] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0137] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0138] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A method for constructing a relationship recognition model, characterized in that: The method comprises: Acquire multiple positive sample pairs in the enterprise set, each of the positive sample pairs including two sample enterprises having an upstream and downstream relationship; According to the multiple positive sample pairs, negative sample pairs are obtained from the enterprise set, each of the negative sample pairs includes two sample enterprises that do not have an upstream-downstream relationship; Obtaining positive sample features corresponding to each of the positive sample pairs and negative sample features corresponding to each of the negative sample pairs; The obtained multiple positive sample pairs, the multiple positive sample features corresponding to the multiple positive sample pairs, the multiple negative sample pairs, and the multiple negative sample features corresponding to the multiple negative sample pairs are used as training sample pairs; Constructing a relationship recognition model according to the training sample pairs and the upstream and downstream relationships corresponding to the training sample pairs; The step of obtaining negative sample pairs from the enterprise set according to the plurality of positive sample pairs includes: Acquire a first negative sample enterprise and a second negative sample enterprise from the plurality of positive sample pairs, wherein the first negative sample enterprise and the second negative sample enterprise have the same upstream enterprise and the same downstream enterprise; and use the first negative sample enterprise and the second negative sample enterprise as a first candidate sample pair; According to the plurality of positive sample pairs, a plurality of upstream-downstream relationship links are established, each of which includes a plurality of sample enterprises in the positive sample pairs; and two sample enterprises that are not in the same upstream-downstream relationship link are obtained from the enterprise set as second candidate sample pairs; The first candidate sample pair and the second candidate sample pair are used as the negative sample pair.
2. The method according to claim 1, characterized in that: The step of obtaining a plurality of positive sample pairs in the enterprise set includes: A plurality of positive sample pairs are obtained from the enterprise set according to the interactive document information between the enterprises.
3. The method according to claim 2, characterized in that The interactive document information at least includes transaction order information, invoice information or contract information, and the acquiring a plurality of positive sample pairs from the enterprise set according to the interactive document information between enterprises includes: Extract text information from interactive document information between enterprises; A natural language processing model is used to identify enterprises with upstream and downstream relationships from the text information.
4. The method according to claim 2, characterized in that: The step of obtaining a plurality of positive sample pairs in the enterprise set further includes: Determine the first batch of positive sample pairs obtained based on the interactive information between enterprises; Determine the first batch of enterprise categories corresponding to each enterprise in the first batch of positive sample pairs, and perform a difference set between the first batch of enterprise categories and the enterprise categories included in a preset enterprise category database to obtain a second batch of enterprise categories; According to the second batch of enterprise categories, a second batch of positive sample pairs are obtained from the enterprise set.
5. The method according to claim 4, characterized in that The step of obtaining a second batch of positive sample pairs from the enterprise set according to the second batch of enterprise categories includes: According to a preset identification rule, determining enterprise category pairs in the second batch of enterprise categories, each of the enterprise category pairs including two enterprise categories having an upstream and downstream relationship; A second batch of positive sample pairs corresponding to the enterprise category pairs are obtained from the enterprise set.
6. The method according to any one of claims 1 to 5, characterized in that The obtaining of the positive sample features corresponding to each of the positive sample pairs and the negative sample features corresponding to each of the negative sample pairs comprises: Obtaining a first sample feature and a second sample feature corresponding to each target sample pair; wherein the target sample includes the positive sample pair or the negative sample pair; Determine, according to the first sample feature and the second sample feature, a combined sample feature of the first sample feature and the second sample feature; The first sample feature, the second sample feature and the combined sample feature are used as target sample features; wherein, when the target sample includes the positive sample pair, the target sample feature includes the positive sample feature; when the target sample includes the negative sample pair, the target sample feature includes the negative sample feature.
7. A method for determining the upstream and downstream relationships of enterprises based on the relationship identification model obtained by the method for constructing the relationship identification model according to claim 1, characterized in that: The method comprises: Obtaining a first enterprise characteristic of a first target enterprise and a second enterprise characteristic of a second target enterprise; The first enterprise feature and the second enterprise feature are input into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
8. The method according to claim 7, characterized in that The method further comprises: Determining the combined enterprise characteristics of the first target enterprise and the second target enterprise according to the first enterprise characteristics and the second enterprise characteristics; The inputting of the first enterprise feature and the second enterprise feature into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise outputted by the relationship recognition model comprises: The first enterprise feature, the second enterprise feature and the combined enterprise feature are input into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
9. A device for constructing a relationship recognition model, characterized in that: The device comprises: A first acquisition module is used to acquire a plurality of positive sample pairs in the enterprise set, each of which includes two sample enterprises having an upstream and downstream relationship; A second acquisition module is used to acquire negative sample pairs from the enterprise set according to the multiple positive sample pairs, each of the negative sample pairs including two sample enterprises that do not have an upstream-downstream relationship; A third acquisition module is used to acquire the positive sample features corresponding to each of the positive sample pairs and the negative sample features corresponding to each of the negative sample pairs; A sample determination module, used to use the obtained multiple positive sample pairs, the multiple positive sample features corresponding to the multiple positive sample pairs, the multiple negative sample pairs, and the multiple negative sample features corresponding to the multiple negative sample pairs as training sample pairs; A model building module, used to build a relationship recognition model according to the training sample pairs and the upstream and downstream relationships corresponding to the training sample pairs; The second acquisition module is used to obtain a first negative sample enterprise and a second negative sample enterprise from the multiple positive sample pairs, wherein the first negative sample enterprise and the second negative sample enterprise have the same upstream enterprise and the same downstream enterprise; and use the first negative sample enterprise and the second negative sample enterprise as a first candidate sample pair; establish multiple upstream and downstream relationship links based on the multiple positive sample pairs, each upstream and downstream relationship link includes multiple sample enterprises in the positive sample pairs; and obtain two sample enterprises that are not in the same upstream and downstream relationship link from the enterprise set as a second candidate sample pair; use the first candidate sample pair and the second candidate sample pair as the negative sample pair.
10. A device for determining the upstream and downstream relationships of enterprises based on the relationship identification model obtained by the method for constructing the relationship identification model according to claim 1, characterized in that: The device comprises: A feature acquisition module, used to acquire a first enterprise feature of a first target enterprise and a second enterprise feature of a second target enterprise; The relationship determination module is used to input the first enterprise feature and the second enterprise feature into a pre-trained relationship recognition model to obtain the upstream and downstream relationship between the first target enterprise and the second target enterprise output by the relationship recognition model.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 or the steps of the method according to claim 7 or 8 are implemented.
12. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6 or the steps of the method according to claim 7 or 8.
