An intelligent decision-making method for blockchain application design patterns based on text classification

By using the LDA-BERT semantic analysis model and the intelligent decision-making method of fuzzy C-means clustering algorithm in blockchain application development, the problem of difficult design pattern selection in blockchain application development is solved, and efficient and accurate design is achieved Mode recommendation.

CN119149750BActive Publication Date: 2025-02-11NANJING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411671283.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-11
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

In blockchain application development, when choosing the most suitable design model, software architects face the problem of information dispersion and matching difficulties, and existing decision-making models have limitations when dealing with complex blockchain application scenarios.

Method used

The intelligent decision-making method of blockchain application design pattern based on text classification is adopted, semantic features are extracted through the LDA-BERT semantic analysis model, and the improved fuzzy C-means clustering algorithm is used to intelligently recommend the design pattern.

Benefits of technology

This method can accurately and efficiently provide developers with design pattern recommendations, solve the limitations of existing decision-making patterns in complex blockchain application scenarios, and improve the efficiency and accuracy of design pattern selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149750B_ABST
    Figure CN119149750B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for intelligent decision-making of blockchain application design patterns based on text classification, including: constructing an LDA-BERT semantic analysis model that combines the topic extraction capability of LDA and the deep semantic understanding capability of BERT, performing improved fuzzy C-means clustering according to the results parsed by the model, and then performing a model for intelligent decision-making of blockchain application design patterns, and collecting and collating data about blockchain design patterns before building the model, including problems and their corresponding blockchain design patterns. The constructed intelligent classification model of blockchain application design patterns based on text classification can analyze new problems and output analysis results. A model for intelligent decision-making of blockchain application design patterns based on text classification is implemented, and a method for collecting data information and results during the operation of the model is used to facilitate better blockchain design pattern decisions, so that there are more references when designing blockchain architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to an intelligent decision-making method for blockchain application design patterns based on text classification, which belongs to the technical field of software engineering design patterns. Background Art

[0002] As a distributed ledger technology, the core of blockchain is to connect data blocks in chronological order through a chain structure based on hash pointers to form a decentralized, secure and tamper-proof database system. With the rapid development of blockchain technology, its application has been widely expanded to many fields, such as cross-border transactions and reducing intermediary dependence in the financial field, privacy protection of electronic health records, and reducing fraud. These applications have improved the efficiency and security of data exchange and business processes.

[0003] However, large-scale application of blockchain technology faces many challenges. First, developers may be unfamiliar with the complexity of blockchain technology, resulting in code duplication and potential security vulnerabilities, which increases the difficulty of system maintenance. Second, the immutability of blockchain data storage makes it difficult to update deployed smart contracts, and fixing errors is not easy to solve with simple updates.

[0004] To address these challenges, relevant studies have proposed a series of design patterns for blockchain applications (Blockchain-Based Applications Design Patterns, BADP). These design patterns have been verified in practice, are reusable, can improve the readability, maintainability and scalability of the code, and enhance the decentralization, security and interoperability of the blockchain system. However, when choosing the most suitable BADP, software architects may face problems such as information dispersion and matching difficulties.

[0005] Decision models play a key role in accelerating blockchain application development, especially in improving the efficiency of selecting design patterns. By integrating BADP information from literature and online resources, decision models use clear decision-making processes to guide developers to make effective choices. Nevertheless, there are still challenges in practical applications, including a lack of clear understanding of the application scenarios of design problems and the need for developers to have professional knowledge.

[0006] This paper proposes a BADP intelligent decision-making method based on text classification, which aims to provide developers with accurate and efficient design pattern recommendations through systematic literature review and data set collection, semantic feature extraction using LDA and BERT models, and BADP classification using an improved fuzzy C-means clustering algorithm. This method not only solves the limitations of existing decision-making models in dealing with complex blockchain application scenarios, but also provides a new intelligent solution for design pattern selection in blockchain application development. Summary of the invention

[0007] The embodiment of the present invention provides a method for intelligent decision-making of blockchain application design patterns based on text classification. It supports the LDA-BERT text analysis model based on text input, and makes intelligent decisions on blockchain design patterns based on the parsed results.

[0008] In order to achieve the above object, the technical solution of the present invention is as follows: a blockchain application design pattern intelligent decision-making method based on text classification, the method comprising the following steps:

[0009] Step 1: Collect blockchain design problem instances as a dataset;

[0010] Step 2: Take the characteristics of the target blockchain requirements as a text description, input it into the LDA-BERT semantic analysis model, and then generate it into a text vector;

[0011] Step 3: Input the text vector into the blockchain design pattern intelligent decision model based on improved fuzzy C-means clustering and cosine similarity to obtain the recommended blockchain design pattern.

[0012] In step 1, 48 papers were collected from authoritative websites and 444 specific blockchain design problem instances were obtained as a data set. Since the blockchain application design pattern intelligent decision model based on text classification can be directly based on text analysis, the problems can be sorted out as the input of the model.

[0013] In step 2, the LDA-BERT semantic analysis model combines the efficiency of LDA in processing document-level topic distribution and the efficiency of the BERT model in understanding the relationship between context and vocabulary, as follows:

[0014] Step 2-1: Input the word phrases of the text data into the LDA model to extract the topic vector of the document. This step is used to identify the implicit topic of the document as a whole and serves as part of the input of the intelligent decision-making model;

[0015] Step 2-2: Input text data into the BERT model to generate a text semantic vector, which is then input into the intelligent decision-making model as part of the input.

[0016] In step 3, the intelligent decision model recommends blockchain design patterns based on improved fuzzy C-means clustering and cosine similarity, as follows:

[0017] Step 3-1: Input the generated text semantic vector of the BERT model into the autoencoder for dimensionality reduction;

[0018] Step 3-2: Cluster the vectors after dimensionality reduction, obtain the text-topic distribution after clustering, and construct the space vector together with the topic vector extracted from the document by the LDA model;

[0019] Step 3-3: When new question data is input, it is compared with the cosine similarity of the space vector constructed in the previous step to obtain the recommended blockchain design pattern results.

[0020] The fuzzy C-means (FCM) clustering method allows each data point to belong to multiple clusters at the same time. The membership of each cluster is between 0 and 1. FCM assigns a membership matrix to each data point, indicating the degree to which it belongs to each cluster.

[0021] Constructing a space vector by using the text classification processed by BERT and the probability distribution of the topic words obtained by LDA as the space vector steps are as follows:

[0022] The text classification results of the processed BERT semantic vectors are stored as data and label respectively, and the data is converted into a word array.

[0023] The document word vectors obtained by the LDA model are used to obtain the characteristic words of each topic, calculate the probability that each word in the word array belongs to each characteristic word, and finally build a space vector model.

[0024] The degree of membership of each data point to the category center determines the size of the weight. The degree of membership is dynamically calculated from the distance from the data point to the category center. The formula is as follows:

[0025] ,

[0026] in, is the sum of the data points, is the number of clusters, It is a data point Belong to the cluster center The membership degree of is the fuzzification parameter, greater than 1, It is the cluster center.

[0027] Cosine similarity helps measure the correlation between two vectors. The intelligent recommendation model selects the cluster with the highest similarity to the design question. The cosine similarity between the design question and each cluster is calculated in the following formula:

[0028] ,

[0029] in, Delegates and Clusters The cosine similarity of and DPP are descriptions of the problem domain and design problem of BADP, respectively.

[0030] When calculating the similarity between DPP and each article in the problem domain, the following formula is used

[0031] ,

[0032] in, Text representing a DP4BA or design question, Represents a word in the text The weight value of the semantic feature vector describing the BADP and the design problem is used. After using the above two formulas to calculate the correlation between the feature vectors of the design problem and the smart contract class design pattern, and finding the similarity between the given design problem and the design pattern problem domain, one or more design patterns with the highest similarity are found as the recommendation result output.

[0033] The present invention implements a text-based LDA-BERT text analysis model, which includes:

[0034] First, in the field of text classification, Latent Dirichlet Allocation (LDA) has shown significant advantages over Term Frequency-Inverse Document Frequency (TF-IDF). As a probabilistic model, LDA is able to identify implicit topics in documents and deeply express the content of the text through these topics. LDA's topic-based analysis method not only focuses on word frequency, but also captures more complex semantic associations by revealing shared topics between documents. This goes beyond simple word frequency analysis and provides a deeper understanding of the text.

[0035] Relatively speaking, although TF-IDF can effectively measure the importance of words in a document set, it mainly relies on the surface frequency of vocabulary and does not consider the context or conceptual relationship behind the vocabulary. Therefore, it may not perform as well as LDA when processing text data with rich meanings. LDA provides an effective way to deal with semantically rich text by revealing the topic structure of the document, which is especially suitable for scenarios that require in-depth analysis of text content and structure. It can reveal low-dimensional structures hidden in high-dimensional vocabulary space, thereby providing more accurate text classification and analysis in the feature extraction framework;

[0036] BERT is a pre-trained language model that can capture deep language features, such as contextual meaning and the relationship between words, by pre-training on a large amount of text. In terms of text semantic extraction, BERT has demonstrated strong capabilities, being able to understand complex language expressions, recognize implicit meanings in sentences, and understand the multiple meanings of different words in different contexts. Therefore, BERT performs well in natural language processing tasks such as text classification, sentiment analysis, named entity recognition, and question-answering systems.

[0037] Although the LDA model can capture high-level topic information of a document, it ignores the positional relationship and grammatical structure of words in the text, especially when processing short texts, because the vocabulary in short texts is sparse and the semantic features are not obvious. To make up for these shortcomings, this method uses the LDA-BERT hybrid model. The model process is as follows:

[0038] First, the input text is processed through the process of text cleaning, string segmentation, punctuation removal, part-of-speech tagging, spell checking, and stop word removal. By normalizing the original text through these steps, noise and redundant information can be reduced, and the word sequence required for the LDA-BERT semantic analysis model is constructed, which is easier to process and analyze than ordinary input. The topic vector of the document is extracted using the LDA model, with the focus on identifying the overall implicit topic of the document. Next, the BERT model is used to obtain a richer and deeper full-text semantic vector to better understand the contextual semantic relationship in the text. Then, the document topic vector obtained by LDA is fused and spliced ​​with the full-text semantic vector obtained by BERT to form a vector that comprehensively represents the text topic and semantic content.

[0039] In order to reduce the complexity of high-dimensional vectors, the fused vectors are input into the autoencoder for dimensionality reduction. Finally, the k-means algorithm is used to cluster the reduced-dimensional vectors to achieve topic classification of the document. After the classification is completed, LDA can be used to extract feature words under each identified topic, which help to further understand and explain the content of each topic. Through the above steps, combined with LDA's document topic analysis capabilities and BERT's contextual semantic understanding capabilities, text topics can be effectively extracted and classified while retaining the fine-grained semantic information of the text.

[0040] The present invention implements an improved fuzzy C-means clustering method for blockchain design patterns:

[0041] The Fuzzy C-means (FCM) algorithm is a soft clustering method that allows each data point to belong to multiple clusters at the same time, and the membership of each cluster is between 0 and 1. Unlike hard clustering methods such as K-Means, FCM assigns a membership matrix to each data point, indicating the degree to which it belongs to each cluster. The closer the membership value is to 1, the more likely the point is to belong to the cluster; the closer it is to 0, the lower the possibility.

[0042] The FCM algorithm first initializes random cluster centers and continuously updates these centers through iterative optimization until the center change is below a certain threshold or reaches a predetermined number of iterations. In each iteration, the algorithm calculates the distance between each data point and each cluster center and updates the membership matrix based on these distances. The membership update is calculated by considering the inverse distance weight of the distance between the data point and all cluster centers. Subsequently, the cluster center is updated using these membership values ​​to become the weighted average position containing the data point. Through this process, FCM can effectively handle overlapping clusters and allow data points to share multiple clusters. This method makes a good treatment for the boundary fuzziness problem of some design patterns of blockchain. After fuzzy C-means clustering of the vectors obtained by the LDA-BERT text analysis model, when new problems come, the blockchain application design pattern intelligent decision-making method based on text classification is used to handle them, and corresponding suggestions can be obtained.

[0043] Compared with the existing technology, the advantages of this solution are as follows:

[0044] Compared with some existing design pattern automatic selection methods in the field of software engineering, such as automatic pattern selection based on information retrieval, case reasoning and text classification, the method of the present invention has the characteristics of wide design pattern coverage, low construction cost, fast recommendation speed and high accuracy.

[0045] The LDA-BERT semantic analysis model combines the efficiency of LDA in processing document-level topic distribution and the efficiency of the BERT model in understanding the relationship between context and vocabulary. Due to BERT's excellent semantic understanding ability, it is widely used in unsupervised text classification. In this model, text data is input to generate a text space vector model, which is easy to operate and has a low threshold for users.

[0046] Autoencoder is a dimensionality reduction learning algorithm implemented through neural networks. Compared with traditional dimensionality reduction

[0047] The method uses a multi-layer neural network structure and multiple linear transformations and nonlinear activation functions inside its encoder to convert high-dimensional input data into low-dimensional encoded data. This low-dimensional representation not only has a high representation capability, but also effectively retains the important feature information of the original data, thereby achieving effective dimensionality reduction and feature information extraction. Therefore, the Autoencoder encoder has become the mainstream dimensionality reduction technology for processing high-dimensional BERT semantic vectors, which can not only reduce high-dimensional vectors to low-dimensional feature vectors, but also retain the deep semantic information of the data.

[0048] The Fuzzy C-means (FCM) algorithm is a soft clustering method that allows each data point to belong to multiple clusters at the same time. Compared with the traditional clustering algorithm K-Means, FCM assigns a membership matrix to each data point to indicate the degree to which it belongs to each cluster. The algorithm initializes random cluster centers, calculates the distance between the data point and the cluster center in iterations, updates the membership matrix and the location of the cluster center until the stopping condition is met. FCM can effectively handle overlapping clusters and allow data points to share multiple clusters. Applying this algorithm to blockchain design pattern clustering is very suitable for the problem of unclear boundaries in blockchain design patterns.

[0049] Cosine similarity is usually used to calculate the correlation between two vectors and is independent of the document length. Therefore, the present invention uses cosine similarity to calculate the similarity between the design problem feature vector and the spatial problem domain feature vector constructed by the data set, which is simple to calculate and highly efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 is the overall design diagram of the model in Example 1 of the present invention,

[0051] Figure 2 is a diagram of the paper screening process in Example 1 of the present invention,

[0052] Figure 3 is a BADP quantity diagram in each document in Example 1 of the present invention,

[0053] Figure 4 is a data preprocessing flow chart in Embodiment 1 of the present invention,

[0054] Figure 5 is a diagram of the topic generation process of the document corpus in Example 1 of the present invention,

[0055] Figure 6 is the LAD topic model diagram in Example 1 of the present invention,

[0056] Figure 7 is a Transformer structure diagram in Example 1 of the present invention,

[0057] Figure 8 is the vector mapping diagram in Embodiment 1 of the present invention,

[0058] Fig. 9 is a flowchart of multiple bidirectional Transformer text processing in Example 1 of the present invention,

[0059] Fig.10 is the overall flow chart of the model in Example 2 of the present invention,

[0060] Fig.11is the LDA-BERT model fusion feature input autoencoder dimensionality reduction graph in Example 1 of the present invention,

[0061] Fig.12 is the space vector diagram in Embodiment 2 of the present invention,

[0062] Fig.13 This is a diagram for selecting the design pattern of smart contracts and business logic classes in Example 2 of the present invention.

[0063] Fig.14 It is an overview diagram of the present invention. DETAILED DESCRIPTION

[0064] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0065] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. The processes may be terminated when their operations are completed, but may also have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, subprograms, etc.

[0066] The term “model” used in this article refers to the blockchain application design pattern intelligent decision-making model based on text classification.

[0067] Example 1

[0068] The blockchain application design pattern intelligent decision model based on text classification of the present invention is based on Figure 1 It can be seen that the model is roughly divided into two parts, namely the LDA-BERT semantic analysis model and the text-based blockchain design pattern intelligent decision model. Example 1 introduces the LDA-BERT semantic analysis model and the collection and processing of the input data set required for building the model, which specifically includes the following steps:

[0069] Step 110. Use the Quasi-Gold Standard (QGS) method to select appropriate search keywords. The Quasi-Gold Standard method is to construct a search query based on the terms used in a set of research papers that must appear in the search results. The reason for choosing this search strategy is that the number of relevant papers is large, so a relatively rigorous process is required to screen out the most relevant studies. To construct the research corpus for the QGS method, four secondary studies on BADP were manually searched, resulting in the following search keyword strings:

[0070] Search keyword string: (“Blockchain” OR “Distributed Ledger” OR “SmartContract” OR “Decentralized Application” OR “DApp”) AND (“Design Pattern” OR “Security Pattern” OR “Pattern”) AND (“Review” OR “Systematic LiteratureReview” OR “SLR” OR “Systematic Mapping Study” OR “SMS”).

[0071] In order to ensure the accuracy and comprehensiveness of the search, the present invention focuses on selecting papers that contain relevant terms in the title, abstract or keywords. As shown in Table 1, the number of papers retrieved in each scientific literature database is shown.

[0072] Table 1

[0073]

[0074] Step 111: Based on the 738 papers collected in step 110, the snowball method is used to reduce the risk of missing important research. Figure 2 Diagram of the paper screening process. Duplicate papers were removed first. Then the titles, abstracts, and keywords of the papers were reviewed according to the exclusion criteria, and irrelevant papers were deleted. Finally, the full text of the papers was further reviewed according to the inclusion criteria, and the design issues of BADP in different scenarios were discussed. The inclusion criteria of this study include: the paper needs to propose at least one blockchain architecture design pattern (BADP), can be applied to multiple scenarios, and describe the design problems and corresponding design patterns. Exclusion criteria include: the paper is not in the field of software engineering or blockchain, is not written in English, or has not been peer reviewed.

[0075] A comprehensive analysis and integration of blockchain application design patterns (BADP) in 18 papers screened by the snowballing method was conducted. The number of BADPs in each document is as follows: Figure 3. To ensure uniformity in the naming of design patterns and reduce redundancy, this paper carefully compared the descriptions of design patterns in various sources and merged semantically similar entries. This process enables this paper to identify patterns that have different names but essentially solve the same design problems, and remove duplicates with the same name but pointing to different concepts. Through this meticulous screening and merging, this study identified 139 unique blockchain application design patterns. In order to focus on the universality and applicability of blockchain application development, this paper selectively excludes those design patterns that are specifically targeted at specific blockchain architectures. Specifically, this paper eliminates 24 design patterns that are mainly used at the underlying architecture level of blockchain. In addition, this paper excludes 39 design patterns specific to platforms such as Ethereum, HyperledgerSawtooth, etc., because they are not applicable to the wide application of blockchain technology. After taking into account these proprietary and architecture-specific patterns, this paper synthesizes a total of 76 design patterns that are applicable to the development of a wide range of blockchain applications.

[0076] Step 112. Although the context, motivation, and practicality of blockchain design patterns are not limited to specific scenarios, design problems vary from scenario to scenario. In order to comprehensively identify and analyze design problems and their application scenarios in software design patterns, the present invention is based on a literature retrieval strategy based on the snowball method. This method enables this paper to systematically start from the selected 30 core research papers and gradually expand to work in related fields to ensure that a wide set of design problems and rich application cases are included. First, clear literature selection criteria are set, focusing on those that discuss in detail the challenges of design patterns in software development. The criteria include the publication time of the literature, the quality of the paper, the influence of the research, the diversity of design problems in the literature, and the breadth of application of the pattern. In summary, the present invention obtains 444 specific blockchain design problem examples from 48 papers from authoritative data sources. Since this method uses text data to extract feature words under each topic, it does not require a large amount of labeled data to reveal the intrinsic structure of the text. Subsequent unsupervised learning can automatically extract useful features from unlabeled text data.

[0077] Step 113: Text preprocessing is the basis and premise of the text mining process. The quality of the preprocessing results will directly determine the results of text mining on the original text data. Figure 4The steps in the process the raw text data and process the data into the data structure required for the training model. The steps are as follows: Text cleaning: Normalize the input raw text to reduce noise and redundant information in the text; String segmentation: Decompose the continuous character sequence in the text data into a word list, convert the text into a word sequence that can be understood and processed by the machine, and provide a basis for subsequent text processing and analysis tasks; Delete punctuation: Filter out punctuation and numbers from the word list, and only keep pure alphabetic words to simplify the text data and improve the effect of subsequent processing; Part of speech tagging: Select nouns and adjectives from the word list, which help capture the key features of the text, thereby improving the performance and effect of subsequent processing tasks; Spell check: Spell check and correct the word list; Delete stop words: Filter stop words from the word list, and other steps are processed.

[0078] Step 114: Input the word sequence after text preprocessing into the LDA model to extract the topic vector of the document. This step focuses on identifying the implicit topic of the document as a whole. The LDA model is a probabilistic model that can identify implicit topics in documents and deeply express the text content through these topics. The topic-based analysis method of the LDA model not only focuses on word frequency, but also captures more complex semantic associations by revealing the shared topics between documents, which goes beyond simple word frequency analysis and provides a deeper understanding of the text. The LDA model extracts topics from a document collection and classifies documents according to topics.

[0079] like Figure 5 Generate topics from the document corpus word. Each topic contains a set of words from the document corpus. These words may appear together and belong to the topic with different probabilities. Each document can be represented by a vector containing the probability of topic distribution on the document. That is, the topic is generated from the document corpus word through Dirichlet distribution and Multinomial distribution, such as Figure 6 As shown, the final distribution of subject words is obtained.

[0080] Step 115: Input the text into the BER2018T model to obtain a richer and deeper full-text semantic vector for understanding the contextual semantic relationship in the text. The BERT model is based on a multi-layer bidirectional encoder of Transformer. The Transformer structure is as follows: Figure 7 The text vector table is mapped to a vector representation obtained by adding a character vector, a character type vector, and a position vector, as shown in Figure 8As shown. Then, the text is processed by multiple bidirectional Transformers to obtain text context information. Finally, Ti (i = 1, 2, 3, . . . , N) is output, which is the text character vector output after encoding, as shown Fig. 9 shown.

[0081] Embodiment 2:

[0082] The blockchain application design pattern intelligent decision model based on text classification of the present invention is based on Fig.10 It can be seen that after the design pattern data set is subjected to the LDA-BERT semantic analysis model, there are two parts of the intelligent decision-making model. The decision-making model part is introduced in Example 2, which specifically includes the following steps:

[0083] Step 210, reduce the dimension of the full-text semantic vector obtained after processing by the BERT model. In high-dimensional space, it becomes more difficult to distinguish different cluster centers. In order to reduce the complexity of the high-dimensional vector obtained in the previous step, the full-text semantic vector is input into the autoencoder for dimensionality reduction. Autoencoder is a nonlinear dimensionality reduction method that can learn its low-dimensional representation from input data. This makes it particularly suitable for processing text data containing complex nonlinear relationships and patterns. Autoencoder effectively retains the core information in the data by reducing the difference between the original input data and its reconstructed version during the training process, and can eliminate noise in the text to a certain extent. This method enables it to deeply explore and represent the key features of text data. The k-means algorithm is then used to cluster the vectors after dimensionality reduction to achieve topic classification of the document, such as Fig.11 shown.

[0084] Step 211: Use the fuzzy c-means (FCM) algorithm to re-cluster the results of the topic classification. The fuzzy C-means clustering algorithm is a data analysis method that applies fuzzy set theory. Its main purpose is to divide the data set into C categories. The uniqueness of the FCM algorithm is that it allows a single data point to have a certain degree of membership in multiple categories, thereby reflecting the uncertainty and ambiguity of the data point. The algorithm achieves data classification by minimizing the sum of the weighted distances between the data point and the center of each category for the spatial vector. The spatial vector is as follows: Fig.11 , where the degree of membership of each point to the category center determines the size of the weight, and the degree of membership is dynamically calculated from the distance from the data point to the category center. The formula is as follows:

[0085] ,

[0086] in, is the sum of the data points, is the number of clusters, It is a data point Belong to the cluster center The membership degree of is the fuzzification parameter, greater than 1, It is the cluster center.

[0087] When FCM divides the BADP set into clusters, it assigns a membership matrix to each data point, which indicates the degree to which the point belongs to each cluster. The closer the membership value is to 1, the more likely the point is to belong to the cluster; the closer the membership value is to 0, the lower the probability. The distance between each BADP and the center of each cluster is iteratively calculated, and then the membership matrix corresponding to each BADP is updated based on these distances. A point is allowed to belong to multiple clusters. Ultimately, the result of applying the FCM algorithm to classify the BADP is to classify it into five different categories.

[0088] Step 212, in the previous step, BADP is divided into five categories by FCM based on its characteristics: infrastructure and data management, smart contracts and business logic, security and privacy, interoperability and scalability, and economic model and incentive mechanism. In order to correctly classify the design problem, the scenario description text of the design problem is first preprocessed and converted into a word list. Then, the word list is converted into a feature vector using the vocabulary in the vector space model. Thereafter, the most appropriate category for each design problem is determined by calculating the membership values ​​of these feature vectors and the corresponding category cluster centers. The design problem examples are as follows:

[0089] Design Question 1: “Like any software application, a smart contract may need to be eventually upgraded to fix bugs, overcome security weaknesses, or add new functionality. In general, business logic and data changes are requiredat different times andfrequencies.”

[0090] The membership value of design problem 1 is shown in Table 2 below, which shows that it is highly associated with the "smart contract and business logic" category (with a membership value of 0.41). This result indicates that this design problem may be best solved by a design pattern related to smart contracts and business logic.

[0091] Table 2

[0092]

[0093] Step 213: In the previous step, the design problem 1 is selected as belonging to the smart contract and business logic design pattern according to the highest class membership value. Then, the cosine similarity (CS) is used to calculate the similarity between the design problem feature vector and the BADP (belonging to the smart contract design pattern) problem domain feature vector, such as Fig.12 . Cosine similarity helps measure the correlation between two vectors. The intelligent recommendation model selects the cluster with the highest similarity to the design question. The cosine similarity between the design question and each cluster is calculated in the following formula:

[0094] ,

[0095] in, Delegates and Clusters The cosine similarity of and DPP are descriptions of the problem domain and design problem of BADP, respectively.

[0096] When calculating the similarity between DPP and each article in the problem domain, the following formula is used

[0097] ,

[0098] in, Text representing a DP4BA or design question, Represents a word in the text The weight value of the semantic feature vector describing the BADP and the design problem is used. After using the above two formulas to calculate the correlation between the feature vectors of the design problem and the smart contract class design pattern, and finding the similarity between the given design problem and the design pattern problem domain, one or more design patterns with the highest similarity are found as the recommendation result output.

[0099] It should be noted that the above embodiments are not intended to limit the protection scope of the present invention, and equivalent changes or substitutions made on the basis of the above technical solutions all fall within the protection scope of the claims of the present invention.

Claims

1. An intelligent decision-making method for blockchain application design patterns based on text classification, characterized in that: The method comprises the following steps: Step 1: Collect blockchain design problem instances as a dataset; Step 2: Take the characteristics of the target blockchain requirements as a text description, input it into the LDA-BERT semantic analysis model, and then generate it into a text vector; Step 3: Input the text vector into the blockchain design pattern intelligent decision model based on improved fuzzy C-means clustering and cosine similarity to obtain the recommended blockchain design pattern; Among them, in step 2, the LDA-BERT semantic analysis model combines the efficiency of LDA in processing document-level topic distribution and the efficiency of the BERT model in understanding the relationship between context and vocabulary, as follows: Step 2-1: Input the word phrases of the text data into the LDA model to extract the topic vector of the document. This step is used to identify the implicit topic of the document as a whole and serves as part of the input of the intelligent decision-making model; Step 2-2: Input text data into the BERT model to generate text semantic vectors, which are then input into the intelligent decision-making model as part of the input; In step 3, the intelligent decision model recommends blockchain design patterns based on improved fuzzy C-means clustering and cosine similarity, as follows: Step 3-1: Input the generated text semantic vector of the BERT model into the autoencoder for dimensionality reduction processing; Step 3-2: Cluster the vector after dimensionality reduction processing, obtain the text-topic distribution after clustering, and construct the space vector together with the topic vector extracted from the document by the LDA model; Step 3-3: When new question data is input, it is compared with the cosine similarity of the space vector constructed in the previous step to obtain the recommended blockchain design pattern result; The fuzzy C-means FCM clustering method allows each data point to belong to multiple clusters at the same time. The membership of each cluster is between 0 and 1. FCM assigns a membership matrix to each data point, indicating the degree to which it belongs to each cluster; Constructing a space vector by using the text classification processed by BERT and the probability distribution of topic words obtained by LDA is as follows: The text classification results of the processed BERT semantic vector are stored as data and label respectively, and the data is converted into a word array. Using the document word vector obtained by the LDA model, we get the characteristic words of each topic, calculate the probability that each word in the word array belongs to each characteristic word, and finally build a space vector model; The degree of membership of each data point to the category center determines the weighted size. The degree of membership is dynamically calculated from the distance from the data point to the category center. The formula is as follows: Where n is the total number of data points, c is the number of clusters, and u ij is the data point x i Belongs to cluster center c j The membership degree, m is the fuzzification parameter, greater than 1, c j It is the cluster center; The intelligent recommendation model will select the cluster with the highest similarity to the design problem. The formula for calculating the cosine similarity between the design problem and each cluster is: Among them, CS i represents the cosine similarity with cluster i, BADP i and DPP are descriptions of the problem domain and design problem of BADP, respectively. When calculating the similarity between DPP and each article in the problem domain, the following formula is used: W(d) = (w(d, t1), w(d, t2), ..., w(d, t n )) Where W(d) represents the text of the design problem, w(d, t i ) represents the weight value of a word i in the text, describing the semantic feature vectors of BADP and design problems. After using the above two formulas to calculate the correlation between the feature vectors of design problems and smart contract design patterns, and finding the similarity between the given design problems and design pattern problem domains, one or more design patterns with the highest similarity are found as the recommendation result output.

2. According to the text classification-based blockchain application design pattern intelligent decision-making method of claim 1, it is characterized in that: In step 1, the snowball method was used to collect data, as follows: 48 papers were collected from authoritative websites and 444 specific blockchain design problem instances were obtained as a dataset.

Citation Information

Patent Citations

  • Extraction method based on 12345 hotspots

    CN115345252A

  • Software design mode recommendation method based on bimodal joint modeling

    CN115390806A