Small sample geological relation extraction method based on improved prototype network
By introducing a global attention mechanism and a weighted loss function, the geological relationship extraction model is optimized, which solves the problems of low accuracy and poor stability in traditional methods and achieves more efficient geological relationship extraction.
Patent Information
- Application Number
- CN202511016603.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-11-07
AI Technical Summary
Existing techniques for relation extraction in the geological field have low accuracy. Traditional methods rely on local features, ignore semantic information, and random sampling leads to poor model stability. Furthermore, they inappropriately depend on relation description information.
A global attention mechanism is introduced, combined with geological relationship guidance, to dynamically adjust weights. A weighted loss function and auxiliary training mechanism are used to optimize the relationship extraction model.
It significantly improves the accuracy of geological relationship extraction and enhances the model's performance, robustness, adaptability, and stability in complex contexts.
Smart Images

Figure CN120911468A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of geology, and particularly relates to a small sample geological relation extraction method based on an improved prototype network. BACKGROUND
[0002] In the 21st century, the research in the field of geology is undergoing a profound transformation driven by big data, with the core being the construction of a new knowledge system. This transformation marks a revolutionary leap from the traditional encyclopedic knowledge system to a computer-understandable and operable knowledge graph. It is crucial to construct a knowledge graph in the field of geology, as it can effectively address the long-standing issues of scattered geological data, complex relationships that are difficult to reveal, and difficulties in knowledge discovery. Through the construction of a knowledge graph, the systematic integration of geological information can be achieved, enhancing the relevance and operability of data.
[0003] Specifically, a knowledge graph can represent scattered geological data uniformly, enabling researchers to more efficiently access and analyze relevant information. Additionally, based on intelligent reasoning capabilities, a knowledge graph can reveal potential geological laws, facilitating in-depth research in fields such as mineral resource exploration and geological disaster prediction. Furthermore, a knowledge graph can represent and analyze complex multi-level relationships between geological entities, enabling deep mining and extensive application of data. As a key technology in the construction of a knowledge graph, relation extraction plays a crucial role in identifying and extracting relationships between geological entities, and is a core step in promoting the intelligent management of geological big data.
[0004] Due to the complexity and strong professional nature of entity relationships in the field of geology, traditional relation extraction methods often require the construction of large-scale labeled data, which is not only time-consuming but also labor-intensive. In recent studies, some have proposed using prototype networks for relation extraction. This method can achieve high accuracy with a small amount of labeled data. However, traditional relation extraction methods often only consider the relationship between triples, ignoring the semantic information in the sentence, resulting in low efficiency and accuracy. Moreover, prototype networks construct support sets through random sampling during training, which may lead to uneven difficulty in each batch task when the sample size is small or the class difference is large, affecting the stability of relation extraction. Additionally, while some prototype networks introduce relation descriptions to enhance prototype representation, they do not fully consider that the semantic information in the original sentence is sometimes more abundant than the relation description, which also leads to poor model performance. SUMMARY
[0005] In order to solve the problem of low accuracy of relationship extraction in the existing geological field, the application provides a small sample geological relationship extraction method based on an improved prototype network, which combines the encoding mode of the global attention mechanism, uses weighted relationship description to generate more accurate prototypes, and introduces the weighted loss of difficult tasks and the auxiliary classification method, which greatly improves the accuracy of relationship extraction in the geological field. The method mainly comprises: Obtain geological entities and their triples, and construct a geological relationship extraction dataset based on the same; S2: using BERT-base-Chinese as a pre-training model, performing relationship extraction on the dataset to obtain word embeddings to capture semantic relationships and context information between words; S3: using the pre-training model to perform word segmentation processing on the dataset to further train the model; S4: add a global attention mechanism to the model and perform text encoding based on the global attention mechanism: Calculate the attention weight of the head entity and the tail entity with all the words in the sentence; According to the obtained attention weight, the global context features of the head entity and the tail entity are calculated; By splicing the original entity representation and the global context features, an enhanced entity representation is obtained; S5: add relationship description to the model, use a learnable parameter to dynamically adjust the weight of sentence information and relationship description; according to the result of each training, dynamically update the weight, so that the model gradually focuses on more challenging tasks.
[0006] A computer device comprising a memory, a processor and a computer program stored in the memory, the processor executing the computer program to implement the steps of the above method.
[0007] A computer readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above method.
[0008] A computer program product comprising a computer program or instructions, which, when executed by a processor, implements the steps of the above method.
[0009] The technical scheme provided by the application has the following advantages: 1. In the design of traditional relation extraction models, the extraction of local features is mainly relied on, and only the context around the main geological entity is focused on, making it difficult for the model to fully exploit the potential information of the entire geological text and perform poorly in the face of complex geological relationships. In order to solve this limitation, the invention introduces a global attention mechanism based on geological relationship orientation. Based on geological expertise, this mechanism can give higher weights to key geological words for relation inference according to different geological relationship types (such as geological structure, mineral distribution relationship). With this mechanism, the model can start from the whole sentence and comprehensively analyze the semantic association between geological entities and other components. Through this mechanism, the model not only focuses on the local context around the entity, but also comprehensively analyzes the semantic relationship between the entity and other sentence components from the perspective of the entire sentence. Specifically, the invention calculates the interaction between each entity's original hidden state and the global context oriented by geological relationship, and fuses this global feature with the initial state of the entity. This method solves the over-reliance on local information in traditional methods and enables the model to understand complex relationships between entities in a broader context, significantly improving the model's performance in handling complex geological structure sentences and diverse mineral distribution scenarios. By injecting global geological relationship information, the model not only dynamically acquires more context, but also better adapts to long sentences or complex semantic structure task scenarios, accurately completing geological relation extraction.
[0010] 2. Relationship description information plays a crucial role in the relation extraction task, and reasonable use of these information can significantly improve the accuracy of the model. However, existing models often rely on complex mechanisms to handle relationship descriptions, increasing the structural complexity of the model. To solve this problem, the invention proposes a method based on dynamic weight distribution, which flexibly introduces relationship description information into the relationship prototype. In this method, the model dynamically adjusts the semantic importance of the sentence and relationship description information. In the case of information-rich, the model can reduce its dependence on relationship description information, while in the case of insufficient information, the model can automatically assign higher weights to relationship description information so that it receives more attention. This mechanism solves the problem of over-reliance on or ignoring the weight difference of relationship description information in traditional models, and improves the accuracy of semantic expression and task adaptability while ensuring the simplicity of the model structure. Through this optimization, the model can more flexibly handle information fusion in different situations, effectively improving its performance in practical applications.
[0011] 3. Traditional prototype networks often rely on random sampling to select samples from the support set when training relation extraction models. The uncertainty introduced by this approach can lead to significant differences in task difficulty across different batches, affecting the model's stability and robustness. To address this issue, this invention designs a weighted loss function and an auxiliary training mechanism. This method allows the model to balance weights across tasks of varying difficulty, particularly enabling more accurate feature extraction and training for more challenging tasks. Under this mechanism, the model automatically identifies task difficulty and trains separately for more complex tasks with a dedicated loss function. This allows the model to better learn the features of complex relations, exhibiting greater robustness and stability, especially when dealing with indistinguishable relations. This approach significantly improves the model's generalization ability and stability when handling indistinguishable relations. By introducing this method, the model not only better adapts to diverse task scenarios but also enhances its robustness when facing complex tasks. Attached Figure Description
[0012] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a flowchart of a small-sample geological relationship extraction method based on an improved prototype network in an embodiment of the present invention; Figure 2 This is a flowchart of word segmentation in an embodiment of the present invention; Figure 3 This is a schematic diagram of the generation of a hybrid prototype based on a weight allocation relationship in an embodiment of the present invention; Figure 4 This is a schematic diagram of weighted loss and auxiliary training task for difficult tasks in an embodiment of the present invention. Detailed Implementation
[0013] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0014] Example 1 Please refer to Figure 1 , Figure 1 This is a flowchart of a small-sample geological relationship extraction method based on an improved prototype network according to an embodiment of the present invention, specifically including: 1. Construct a relation extraction dataset in the geological field. Firstly, the geological entities are extracted from the national standard "Geological and Mineral Terms Classification Code". Then, the triplets containing these geological entities are obtained from the Baidu Encyclopedia triplet corpus with high data quality. After manual screening, the screened geological entity relationship triplets are aligned with the Chinese Wikipedia corpus, and finally a labeled geological relationship extraction dataset is constructed. The so-called labeled means that the head entity, tail entity and relationship in the sentence are marked, and triplets are formed.
[0015] Text preprocessing based on semantic enhancement in the field of geology and fine-tuning of word embedding with geological professional dictionary and rules is one of the key steps in natural language processing (NLP), and its quality directly affects the effect of downstream tasks. As a core component in the preprocessing process, word embedding has important significance in NLP. It maps words to continuous vector space, so that semantically similar words are close to each other in space. This representation method not only preserves the semantic information of words, but also provides rich semantic associations and context information for subsequent machine learning tasks. Although traditional word representation methods (such as bag-of-words or TF-IDF) can provide certain weights for each word, they cannot capture the semantic relationship between words. Word embedding technology can effectively solve this problem by representing words as low-dimensional dense vectors. Using word embedding, NLP systems can better understand and process complex language phenomena, such as synonyms, polysemous words, and word similarity. Through this representation, semantically similar words have a shorter distance in the vector space, providing more semantic information for relationship extraction, sentiment analysis, machine translation, and other tasks. Among the many pre-training models, BERT-base-Chinese has received widespread attention due to its specialized training on Chinese corpus and excellent performance in various natural language processing tasks. This model makes full use of bidirectional context information, enabling more accurate capture of semantic relationships in sentences. Selecting BERT-base-Chinese as a pre-training model for relationship extraction on geological data sets not only significantly improves model performance, but also enhances its generalization ability across different datasets and knowledge domains. Typically, word embedding is learned through pre-training models BERT base-Chinese, which are trained on large corpora to capture semantic relationships and contextual information between words. In addition, it is fine-tuned in combination with professional dictionaries and semantic rules in the field of geology. Through this way of learning, the word embedding can more accurately capture the semantic relationships and contextual information between words in the field of geology, enhancing the semantic representation ability of geological professional terms. Let the number of vocabulary in the dataset be V (including all words), and the word embedding function can be represented as:
[0016] where V denotes the vocabulary, d denotes the dimension of the word embedding vector, and f is the word embedding function that maps each word to a continuous d-dimensional vector. For a word v ∈ V, its word embedding is denoted as:
[0017] where emb(v) denotes the d-dimensional word embedding vector of word v.
[0018] Chinese word segmentation is a fundamental task in natural language processing, aiming to divide continuous Chinese text into word units with independent semantics. Unlike English, Chinese does not use spaces to separate words when written, so Chinese word segmentation is of great significance when processing Chinese text. In the field of geology, due to the existence of a large number of professional terms and complex expressions, accurate word segmentation is particularly crucial. In this processing method, the word segmentation of the dataset will be based on the rules of the geological dictionary. The geological dictionary rules are a series of rules formulated based on the professional knowledge and language habits of the geological field. The geological dictionary includes a wealth of geological professional vocabulary, such as various types of rock names (granite, limestone, etc.), geological structure terms (folds, faults, etc.), geological ages (Cambrian, Cretaceous, etc.), and mineral resource names (gold mine, copper mine, etc.). Based on these vocabularies, the following rules are formulated to guide word segmentation: (1) The first is the complete matching rule. When a continuous fragment in the text is completely consistent with the vocabulary in the geological dictionary, it is divided as an independent word unit. For example, when encountering "quartz sandstone", since the dictionary has this word, it is divided as a whole into a word.
[0019] (2) The second is the prefix matching rule. If a fragment in the text is a prefix of a word in the geological dictionary, and the subsequent part cannot form a reasonable geological term with other words, then the prefix part is divided into a word first. For example, "Dali" is a prefix in the geological term "Dali rock", if the subsequent text cannot form other reasonable words with it, then "Dali" is divided separately.
[0020] (3) Finally, the suffix matching rule. Similar to the prefix matching, when the text fragment is the suffix of a word in the geological dictionary, and the front part cannot form a reasonable geological term with other words, the suffix part is divided into a word.
[0021] By following these geology dictionary rules for word segmentation, the system can more accurately identify the basic semantic units in the text, providing support for downstream natural language processing tasks. For example, in relation extraction, sentiment analysis, named entity recognition, and other tasks, accurate word segmentation can help the model better understand the semantic structure of the text, improving the accuracy of predictions and the overall performance of the model. The word segmentation flowchart is shown in Figure 2 As shown in the word segmentation flowchart, first input the text, standardize the text, such as character unification, clean up special characters. Then, check if there are invalid characters in the text, if there are invalid characters, filter and remove the invalid characters, and perform word segmentation preprocessing (initial word segmentation rules), and perform word segmentation processing based on rules. If there are no invalid characters, the word segmentation process is directly ended. Chinese word segmentation is an important step in natural language processing, which converts unstructured Chinese text into a series of meaningful single characters or word units, making it easier for computers to understand continuous text that is difficult to process. Through word segmentation, the semantic information in the text can be effectively extracted, which lays the foundation for subsequent natural language processing tasks. The segmented text not only reduces the computational complexity, but also improves the processing efficiency, thereby saving computational resources during model training and inference. In addition, accurate word segmentation helps improve the model's performance in various tasks such as text classification, named entity recognition, sentiment analysis, etc. The dataset processed based on the geology dictionary rules can provide the model with more rich and accurate semantic features, thereby improving the accuracy during training and the generalization ability of the model. Therefore, in this invention, Chinese word segmentation based on geology dictionary rules becomes one of the key steps for the model to process and understand Chinese geological text, providing high-quality basic data for subsequent model training and evaluation.
[0022] In the relation extraction task in the geology field, when encoding the entities in the support set and the query set, the global attention mechanism based on geology relationship orientation is used, which can greatly improve the model's ability to capture complex geological semantics. This mechanism differs from traditional global attention mechanisms in that it assigns higher weights to geological words in the sentence that are crucial for relationship inference based on different geological relationship types, such as geological structure relationships and mineral distribution relationships. This allows the model to accurately focus on important geological information, effectively enhancing its understanding of geological semantics and improving its ability to capture complex semantics.
[0023] During the processing, the global features are obtained through the interaction of the head entity and the tail entity with the entire sentence output, with the help of attention mechanism based on geological relationship guidance, and are spliced with the original entity state. This means that the model no longer relies only on the original entity representation, but also combines the context information of the entire sentence. This is crucial for the relationship extraction task, so in the geological relationship extraction task, the relationship between entities is not only determined by the entity itself, but also by the surrounding geological context clues. For example, when describing geological structures, the context information such as the age of the stratum and the type of rock is crucial for determining the structural relationship; when discussing the distribution of mineral resources, the context information such as the regional geological background and ore-forming conditions can provide important basis for determining the relationship between mineral resources and geological environment. In this way, the model can comprehensively consider other geological words or phrases in the sentence, so as to more accurately infer the relationship between geological entities. Traditional encoding methods often focus on local information, such as relying only on the characteristics of the entity itself for judgment. However, the determination of geological relationship usually depends on the geological background and context of the entire sentence. If only relying on the entity itself information, the model may miss some important geological context clues. The introduction of global attention mechanism based on geological relationship guidance enables the model to better balance local and global geological information, and avoid excessive reliance on the surface characteristics of the entity itself in relationship inference. The global attention mechanism based on geological relationship guidance incorporates geological relationship type information in the weight calculation link to dynamically adjust the attention weight. The core idea is to construct an adjustment matrix related to the geological relationship type, which will modify the initial calculated attention weight according to different geological relationship types. Let there be a geological relationship type indication vector R, whose dimension corresponds to the number of different geological relationship types, for example, it can be a one-hot encoding vector. When processing geological structure relationship, the dimension position corresponding to the structure relationship is 1, and the rest is 0; when processing mineral distribution relationship, the dimension position corresponding to the mineral distribution relationship is 1, and the rest is 0. At the same time, construct a weight adjustment matrix W R , whose shape is ((L,L), L is the maximum length of the sentence. This matrix will adjust the attention weight according to the geological relationship type.
[0024] For the head entity h and the tail entity t, the attention weight formula of their interaction with all the words in the sentence is as follows:
[0025]
[0026] Where: H represents the sequence output representation matrix (last_hidden_state of BERT).
[0027] h and t are head and tail entities, respectively.
[0028] α t and α h are normalized attention weights.
[0029] represents the original relevance score of the tail entity t with all the words in the sentence, and is the dot product of the sentence sequence output representation matrix H and the tail entity t.
[0030] represents the original relevance score of the head entity h with all the words in the sentence, and is the dot product of the sentence sequence output representation matrix H and the head entity h.
[0031] According to the obtained attention weights, the global context features of the head entity h and the tail entity t are calculated:
[0032]
[0033] where: L is the maximum length of the sentence.
[0034] H (i) represents the i-th word hidden state vector.
[0035] α t and α h are normalized attention weights.
[0036] By concatenating the original entity representation and the global context feature, the enhanced entity representation is obtained:
[0037]
[0038] This way, the model can combine local and global context information, which is helpful for entity relationship recognition in the relationship extraction task.
[0039] Prototype networks based on weight assignment relationship description, such as Figure 3Adding relation descriptions in the relation extraction of the prototype network can provide additional semantic information for each relation category, helping the model to better learn and distinguish different relation categories. This not only enhances the accuracy of the prototype representation, but also solves the problem of data sparsity and improves the generalization ability of the model, especially in the scene of few-shot learning. By fusing relation descriptions and sentence information, the model can more flexibly determine the relationship and improve the extraction effect. However, in different contexts, the amount of information in the sentence itself and the importance of the relationship description may vary. In some cases, the sentence representation is more important than the relationship description, or vice versa, the relationship description provides key semantic information. The direct addition method cannot dynamically adjust the weight of the two, which may cause information bias. Therefore, the present application uses a learnable parameter to dynamically adjust the weight of the sentence information and the relationship description. The model can learn how to balance the weight of the two during the training process and automatically adjust according to different contexts or tasks. The formula for dynamically adjusting the weight is as follows: R Wherein: S represents the representation of the sentence R represents the representation of the relationship description α is a learnable weight parameter, ranging from [0, 1].
[0040] Weighted loss for difficult tasks and auxiliary training tasks, such as Figure 4 As shown, the average accuracy of each task is calculated as a measure to evaluate the difficulty of each meta-task during the training process of each meta-task. The loss function used by this model is the cross-entropy loss function, and the formula is as follows:
[0041] Wherein: C represents the number of categories.
[0042] x i represents the true label of the i-th category.
[0043] y i represents the prediction probability of the model for the i-th category.
[0044] Dynamically adjust the weight of each meta-task: increase the weight of difficult tasks and reduce the weight of simple tasks. The weighted loss function can be represented as:
[0045] Wherein, w i is the weight of task T i .
[0046] According to the result of each training, the weight is dynamically updated, so that the model gradually focuses on more challenging tasks. The task difficulty weighting strategy can balance the influence of simple tasks and difficult tasks during training, avoid overtraining of the model on simple tasks, and improve its performance on complex tasks.
[0047] In addition, the task with low classification accuracy is defined as a difficult task. In the training batch, these difficult tasks are additionally extracted and assigned to the difficult task training part. For difficult tasks, a separate loss function is defined as follows:
[0048] This loss is optimized together with the overall training loss:
[0049] In order to further verify the performance of the present application, the running effect is obtained on the present model and the baseline model using the geological data set constructed before, and comparison is made. The verification experiment is realized by using the Pytorch framework, and during the training process, the total number of iterations of training is 30000, the verification interval is 2000, and the number of verification iterations is 1000.
[0050] The prototype network used by the present application uses a meta-learning framework, so the experimental method used is the episode learning method, and an N-way K-shot task is constructed, which means that N classes are randomly sampled in each episode, K samples of each class are sampled as a support set, and Q samples are sampled as a query set. For the labeled geological data set, 2 groups of N and K are set, which are 5-way 1-shot and 5-way 5-shot respectively, and two types of different small sample scenes are constructed.
[0051] In the small sample relation extraction task, accuracy (Accuracy) is usually used as an evaluation index for verifying the effect of the model, and the accuracy is calculated according to the confusion matrix in the following table.
[0052]
[0053] The accuracy Accuracy in the task is calculated in the following way:
[0054] The relationship and relationship description of the geological data set used in the experiment are shown in the following table:
[0055] The baseline model selected in the experiment is as follows: Proto: Prototype network BERT-PAIR: a method for measuring the similarity of sentence pairs based on the sequence classification model in BERT.
[0056] SimpleFSRE: a method for directly adding relationship description information to the prototype.
[0057] The experimental results are shown in the following table:
[0058] As can be seen from the above table, the model of the present patent performs excellently in 5way-1shot and 5way-5shot compared with other models. The model of the present patent is 6.25% higher than the traditional prototype network Proto in 5way-1shot, and 4.48% higher than the traditional prototype network Proto in 5way-5shot, which shows that the global attention mechanism used by the model of the present patent can more comprehensively capture the contextual dependency between entities, thereby enhancing the effect of relationship extraction. By designing a special training and loss function for difficult tasks, the model can more carefully learn complex relationships, significantly improving the ability to distinguish between difficult-to-distinguish relationships, thereby improving the overall model effect. The model of the present patent is 1.1% higher than the excellent model SimpleFSRE in the general field in 5way-1shot, and 1.08% higher than the excellent model SimpleFSRE in the general field in 5way-5shot. This shows that the model of the present patent can flexibly adjust the fusion degree between relationship description and sample features through weight distribution, dynamically balancing the influence of the two. This method can effectively improve the semantic expression ability of the prototype, so that the model performs more accurately in the relationship extraction task, especially when dealing with complex relationships, the expression of the prototype will be more comprehensive and rich. The above results reflect the strong ability of the model in the field of geological relationship extraction.
[0059] Embodiment 2 A computer device comprising a memory, a processor, and a computer program stored on the memory, the processor executing the computer program to implement the steps of the above method.
[0060] Embodiment 3 A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above method.
[0061] Embodiment 4 A computer program product comprising a computer program or instructions, which, when executed by a processor, implements the steps of the above method.
[0062] The above merely describes preferred embodiments of the present application and is not used to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A small sample geological relationship extraction method based on an improved prototype network, characterized by, The method comprises the following steps: S1: Obtain geological entities and their triples, and construct a geological field relation extraction dataset based on the triples; S2: Use BERT-base-Chinese as a pre-training model to perform relation extraction on the dataset to obtain word embeddings to capture semantic relationships and context information between words; S3: Use the pre-training model to perform word segmentation processing on the dataset to further train the model; S4: Add a global attention mechanism to the model and perform text encoding based on the global attention mechanism: Calculate the attention weights of the head entity and the tail entity with all the words in the sentence; Calculate the global context features of the head entity and the tail entity according to the obtained attention weights; Obtain the enhanced entity representation by concatenating the original entity representation and the global context features; S5: Add a relation description to the model, use a learnable parameter to dynamically adjust the weights of the sentence information and the relation description; dynamically update the weights according to the results of each training, so that the model gradually focuses on more challenging tasks.
2. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In S2, the word embedding function is: Where V represents the vocabulary, d represents the dimension of the word embedding vector, and f is the word embedding function that maps each word to a continuous d-dimensional vector; For a word v∈V, its word embedding representation is: Where emb(v) represents the d-dimensional word embedding vector of the word v.
3. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In S4, the attention weights of the head entity h and the tail entity t with all the words in the sentence are calculated by dot product: wherein, α t and α h are normalized attention weights, H denotes a sequence output representation matrix, denotes the original relevance score of the tail entity t with all words in the sentence, denotes the original relevance score of the head entity h with all words in the sentence.
4. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In S4, the formula for calculating the global context features of the head entity h and the tail entity t is as follows: where L is the maximum length of a sentence, denotes the i-th word hidden state vector, α t and α h is the normalized attention weight, denotes the global context feature of the tail entity t, denotes the global context feature of the head entity h.
5. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In S4, the formula for obtaining the enhanced entity representation is as follows: wherein h denotes the head entity, t denotes the tail entity, global context features representing the tail entity t, global context features representing the head entity h.
6. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In S5, the formula for dynamically adjusting the weights is as follows: R Where S represents the representation of the sentence, R represents the representation of the relation description, and α is a learnable weight parameter ranging from 0 to 1.
7. The small sample geological relationship extraction method based on the improved prototype network of claim 1, wherein, In this method, during the training process of each meta-task, the average accuracy of each task is calculated as a measure to evaluate the difficulty of each meta-task, and the cross-entropy loss function is used as the loss function of the model, as follows: where C denotes the number of classes, x i represents the true label of the i-th class, y i represents the predicted probability of the model for the i-th class; Dynamically adjust the weights of each meta-task, and the weighted loss function is: where w i is the weight of task T i . According to the results of each training, dynamically update the weights, so that the model gradually focuses on more challenging tasks; Define the task with lower classification accuracy as a difficult task, and in the training batch, extract the difficult task and assign it to the difficult task training part. For the difficult task, define a separate loss function as follows: According to the weighted loss function and the separately defined loss function, the overall training loss is obtained to optimize the model: wherein indicates a difficult task.
8. A computer apparatus comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program, when executed by the processor, causes the processor to perform the method of any one of claims 1 to 7. The processor executes the computer program to implement the steps of the small sample geological relation extraction method based on the improved prototype network according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer program is stored in the memory, and when the program is executed by the processor, the steps of the small sample geological relation extraction method based on the improved prototype network according to any one of claims 1-7 are implemented.
10. A computer program product, characterised in that, Computer program product including computer programs or instructions, which when executed by a processor, implement the steps of the method for small sample geologic relation extraction based on improved prototype network according to any one of claims 1-7.