# An Effective Credit Evaluation Mechanism with Softmax Regression and Blockchain in Power IoT

Authors: Da Li; Dong Wang; Wei Jiang; Qinglei Guo; Desheng Bai; Wei Shi; Linna Ruan
Journal: Security and Communication Networks
 (2022)

---

## Abstract

This paper is oriented to the credit investigation scenario of power grid supply chain enterprises and proposes a blockchain user credit assessment method based on improved Softmax regression in Power IoT. This method first designs a credit-rating mechanism that meets industry characteristics based on business needs. Second, it proposes a user credit evaluation model based on the blockchain architecture. Finally, the improved Softmax regression algorithm is used to train the proposed credit evaluation model, which effectively solves the credit rating. The multiclassification problem has achieved the goal of categorizing the credit rating of the enterprise. The simulation results show that the credit evaluation mechanism proposed in this paper can accurately evaluate the multisource credit data that lacks trust foundation and effectively realize the credit rating of power grid material supply chain enterprises. The credit evaluation mechanism proposed for Power IoT in this paper could have high potential for entity identity authentication and rating for securing mobile video communications.


---

## Body

## 1. Introduction

Credit industry is an important part of China’s social credit system, which can reduce the harm caused by information asymmetry to capital transactions and can solve the bottleneck problem that restricts credit transactions. With a large number of institutions now flooding the credit market, multiagency data convergence can significantly improve the accuracy of the credit assessment. However, from data collection to credit report generation, credit reporting agencies have different data sources, processing methods, information preferences, and reporting formats, which make it difficult to exchange information and database connection between enterprises [1]. Due to the huge amount of credit data, wide coverage, diverse data types, and credit reporting agencies mostly regard data resources as their core competitiveness; in the case of conflicts of interest and data privacy protection difficulties, most institutions are unwilling to share data, resulting in the credit industry data difficult to integrate, inter-institution difficult to reach consensus, and difficult to form a unified standardized credit system.To solve this problem, solutions at different levels have emerged [2, 3], among which the blockchain-enabled IoT architecture [4] has attracted great attention. Blockchain has the technical characteristics of decentralization, distributed trust, timestamp, and the asymmetric cryptographic algorithm, which can ensure that credit data sharing and verification can be safely controlled and effectively guarantee data privacy, so blockchain has superior applications in data transactions, data sharing, and other fields of the credit industry. For example, banks, insurance, and other industries can establish an alliance chain to achieve data sharing and data transactions, the establishment of node distributed trust, which can avoid the emergence of the isolated data island [5–8]. Blockchain technology, “decentralized,” can help solve the problem of node trust in the process of information transmission, can use P2P network to realize P2P data interaction between data demanders and credit data owners, increase the number of credit data sources, wide-ranging multilevel access to customer credit information, and improve the dimension and regional coverage of credit information. In addition, the blockchain realizes the distributed trust of nodes, so there is no central node, which can simplify the credit business process and improve the efficiency of credit nodes. At the same time, there are some authors using the asymmetric cryptographic algorithm. In addition, other cryptography techniques used in blockchain also contribute to the data security of credit information [9–12].Electric energy is the lifeblood of a country’s economic development. The high-quality work of power supply chain enterprises is the key to reduce the risk of power supply chain and improve the service quality of the power grid. Through the credit evaluation of power supply chain enterprises, the quantitative evaluation of their work quality can be realized. In view of the existing problems in the field of the credit industry, such as scattered credit data sources and low willingness of enterprises to share data, this paper studies the multiagency credit evaluation in the power grid supply chain scenario and proposes a blockchain user credit assessment method based on Softmax regression to solve the credit rating problem among the power grid supply chain agencies. First, a set of credit rating mechanism in line with the characteristics of the industry is designed for the supply chain enterprises of power grid materials. Second, this paper proposes a credit model framework based on blockchain and designs blockchain nodes, smart contract, data storage, etc. Finally, this paper proposes a credit evaluation model based on improved Softmax regression, which effectively solves the problem of multiclassification of credit rating. The simulation results show that the blockchain-based Softmax regression algorithm can effectively solve the problem of multiagency credit evaluation in the power grid supply chain and improve the accuracy of credit evaluation. The credit evaluation mechanism proposed for Power IoT in this paper could have high potential for the entity identity authentication and rating for securing mobile video communications.The innovations in this article are as follows:(1)
According to the requirements of the power grid, this paper establishes a credit rating and evaluation index system of enterprises in the power grid supply chain.(2)
In view of the difficult integration of multiagency credit assessment data in the power grid supply chain, this paper designs a blockchain-based credit evaluation system model for power grid enterprises, using smart contracts to achieve multitrust intelligent collaboration.(3)
In view of the difficulty of enterprise credit classification in the power grid supply chain, this paper proposes an improved Softmax regression algorithm and establishes a 4-classification Softmax regression model for enterprises in the power grid supply chain(4)
This model designs an experiment to verify the validity of the proposed method. This paper first configures the credit environment and simulation tools and realizes the credit data processing by gradually simulating according to the operation process of the model. Finally, we verify the validity of the proposed method in evaluating credit to enterprises in the power grid supply chain.The structure of this paper is as follows: Section2 elaborates the related work, Section 3 proposes the blockchain-based credit evaluation model and the improved Softmax regression, Section 4 is shows experimental verification of the proposed method, and Section 5 is a summary of the whole paper.


## 2. Related Work

With the credit industry becoming more and more important in social and economic life, credit factors to be taken into account in credit assessment are increasing, and the credit evaluation of multisource data fusion is a hot research topic now. The main method of earlier credit rating is the expert judgment [13], such as evaluating the borrower’s credit 5C evaluation method and subjective comprehensive evaluation of the borrower’s information through credit experts and scholars. Considering the shortcomings of individual subjective evaluation in the process of credit assessment, credit rating technology is evaluated by the mathematical model method; especially, statistical related methods have been studied and applied in a great deal of research and application [14, 15]. With the development of credit market scale, credit evaluation methods have gradually formed various theoretical systems, for example, the Bayesian method and the logistic regression algorithm designed by the principles of integrated statistics [10, 16], the backpropagation neural network and the SVM model designed by the machine learning theory [17, 18], the credit evaluation based on market value such as the credit metrics model and the KVM model [19], etc. The above studies are all carried out on a single scenario of data source, and there is no consideration of multisource data fusion.Blockchain provides a viable solution to multisource data convergence. The existing blockchain research [20] uses blockchain to replace the traditional central network structure. Data processing and storage no longer rely on the central node, reducing the risk of single point of failure. The node finishes data masking of the private data through the hashing process and encrypts the data blocks in the blockchain, which eliminating the risk of tampering in the centralized information system. Each node in the blockchain system will get a copy of the uploaded data. Failure of one node in the system does not affect the integrity of other node data.Some other existing research studies [21, 22] use blockchain technology to standardize data, which enables participants to participate in the development and maintenance of data standards in a multicentric manner, building data-sharing service systems from data standard model structures and processes, data standard sharing and access control, data updates, and smart contracts. The higher the level of data sharing, the higher the level of data standard development.Blockchain enables Power Internet of Things to build a standardized data management approach that identifies, divides, organizes, and hosts all data information, helping to promote the sustainable development of data sharing. In the existing research, there are a few studies on how to apply blockchain technology to credit evaluation, and how to realize the credit evaluation mechanism based on blockchain technology is a problem to be solved.In view of the shortcomings of the existing research, this paper studies the multiagency credit evaluation in the power supply chain scenario and proposes the blockchain-based Softmax regression algorithm to solve the credit evaluation problem among the power grid supply chain institutions. In this paper, the blockchain technology and the Softmax credit evaluation model are combined, the data transmission mechanism between credit nodes is designed based on the characteristics of blockchain distributed trust, the normalization function and loss function are improved on the basis of the original Softmax function, and the credit evaluation model is trained by improving the Softmax algorithm. Subsequently, the blockchain system simulation is realized by using the Fabric open-source framework; the improved Softmax regression algorithm test is implemented in Python language; finally, the credit evaluation accuracy is obtained by about 95%.


## 3. Blockchain-Based Credit Evaluation Model

### 3.1. Credit Rating and Evaluation Index of Enterprises in Power Grid Supply Chain

The operation of the power grid is related to the national economy and people’s livelihood, public safety, and energy security. In order to accurately manage their supply chain risk, the credit evaluation model should grade the credit of power grid supply chain enterprises and adopt different risk management measures for power grid supply chain enterprises with different credit ratings. As shown in Table1, at present, the credit rating of power grid material supply chain enterprises is divided into A, B, C, and D, corresponding to “excellent,” “good,” “general,” and “poor.”Table 1
Credit rating.
Credit ratingExplanationAExcellentBGoodCGeneralDPoorThe grid supply chain is based on end-user demand for electricity and emergency protection. It is a network chain structure consisting of the whole life cycle activities such as material procurement, circulation, and recovery which are generated from power grid construction, operation maintenance, and emergency support services. So, it needs the cooperation of enterprises in the whole link, and the enterprises need a power grid supply chain service for the power grid. So, they not only need to consider economic benefits but also to shoulder the responsibility of providing energy conservation products, protecting the environment, providing high-quality products and services, and supplying then timely and accurately. Also, the power grid supply chain and Power IoT maintain a safe and economical material inventory and provide emergency support materials and other basic social responsibilities.Based on the overall characteristics of the power grid supply chain, in order to ensure a systematic and global evaluation of the overall credit rating of power grid supply chain enterprises, at the same time reduce the impact of individual subjective factors on credit evaluation, the selection of indicators is based on quantitative indicators. The credit evaluation index system includes five primary indicators: “enterprise basic information,” “service level,” “operational norms,” “safety management,” and “innovation and development,” and subdivides the primary indicators into 13 secondary indicators and 24 tertiary indicators. The specific evaluation indicators are shown in Table2.Table 2
The credit evaluation index of enterprises in the supply chain of power grid materials.
Primary indicatorsSecondary indicatorsTertiary indicatorsEnterprise basic informationEnterprise registered capitalRegistered capital of the enterpriseRegistered employeesRegistered employeesService levelProduct reliabilityThe failure rate of the devicePass rate for spot checksProduct satisfaction ratePurchase supply reliabilitySupply completion rateSupply accuracySupply punctualityOperational normsPurchase supply specification indexOpen purchase rateProcurement specificationStandardized material application ratesSpot check coveragePower trading code indexSettlement of electricity chargesWhether to execute the electricity contract on an appointment basis, including the “direct transaction contract between the power user and the power generation enterprise” and the “power supply contract”The annual rate of performance of electricity consumption of enterprisesIntegrity self-regulation indexNumber of incorruptibility incidents of material system personnelSafety managementProduction safetyNumber of safety incidentsOccupational health and safetyWhether the occupational health and safety management system certification is passedElectricity safetyWhether there is an emergency power supplyWhether there is illegal use of electricityInnovation and developmentGreen development indexWhether the enterprise environmental certification has passedDisposal rate of waste materialsManagement innovationManage the number of innovationsStandard promotion indexStandard rolloutAmong them, “enterprise basic information” includes “enterprise registered capital” and “registered employees,” which are used to evaluate the overall scale level of the enterprise. “Service levels” include “product reliability” and “procurement supply reliability” to assess the quality and service of goods in the procurement and supply process. “Operational norms” include the “purchase supply specification index,” the “power trading code index,” and the “integrity self-regulation index,” which measure the degree of management norms in the process of purchasing and supplying materials and trading electricity. “Safety Management” includes “occupational health and safety,” “production safety,” and “electricity safety” to evaluate the overall level of safety management of an enterprise. “Innovation development” includes the “green development index,” the “management innovation index,” and the “standard promotion index,” which are designed to study innovative management measures to ensure and improve the long-term growth rate, efficiency, and quality of development of enterprises, and enhance their social impact.


### 3.2. Blockchain-Based Credit Evaluation Model

#### 3.2.1. Overall Architecture

The credit evaluation model proposed in this paper adopts the alliance chain structure, and the participants of blockchain are power grid enterprises and power grid material supply chain enterprises. Nodes in the alliance chain improve data security and effectiveness by setting up different identities for access control. When credit assessment is required, the data demander node (power grid enterprise) can call the Softmax regression credit assessment algorithm, use the credit rating data already performed in the blockchain, and train the weight matrix that can be used for credit evaluation. The overall architecture model is shown in Figure1.Figure 1
Blockchain overall architecture diagram.In the credit evaluation model, there are two main types of roles: data provider and data demander. Data providers include credit bureaus and grid supply chain enterprises that require credit ratings, and data demanders are grid enterprises. Two different nodes correspond to the two roles of data provider and data demander. The data provider node is responsible for collecting credit evaluation index data and corresponding credit rating of power grid supply chain enterprises, preprocessing such data, and chaining the processed credit data. Data providers can only upload data and cannot make changes to or download data. The data demander nodes obtain the data from the blockchain, train the model, and finally obtain the model that can accurately divide the enterprise credit rating according to the credit index.After completing the blockchain credit node design, Fabric uses its own certificate components to generate CA certificates and MSP identity files for the credit node, providing identity configuration services for the Fabric node.


#### 3.2.2. Smart Contract

The credit evaluation model proposed in this paper is based on the open-source framework, the Hyperledger Fabric, to do blockchain simulation, and the development of smart contracts is based on the development principles of the Fabric chain code. The creator writes credit evaluation smart contracts in high-level languages and signs them by all members of the alliance chain. In the design process of this blockchain-based credit evaluation system, the smart contract based on the blockchain framework is divided into two categories: system smart contract and user smart contract.System smart contracts are the basis for Fabric operation and need to be deployed to the blockchain when the blockchain node is started to implement process interaction tasks. There are five types of system chain codes:(1)
Configuration system chain code: responsible for chain code and channel configuration management(2)
Endorsement management system chain code: responsible for the endorsement (signature) process and can support the management of endorsement strategies(3)
Lifecycle system chain code: responsible for the user chain code life cycle management, including installation, deployment, upgrade, rights management, access to information, and other links(4)
Query system chain code: responsible for providing blockchain ledger information query function, such as access to block and transaction information(5)
Verify system chain code: responsible for checking according to endorsement strategy before the transaction is submittedUser smart contract is to use JAVA, Golang, and other programming languages to write code, processing business logic, its design on the one hand to consider the status of blockchain distributed ledger, and on the other hand to consider the actual business scenarios and development requirements. User smart contracts include: data publishing smart contracts and data request smart contracts.(1) Data Publishing Smart Contract. This smart contract is responsible for uploading credit data owned by the data provider into the blockchain. Data publishing intelligence strictly requires the amount and format of data collected, requires data providers to preprocess raw data, and uploads only the necessary information to the blockchain. The data format of the chain is id,x1,x2,…,x24,y, id is the number of the credit data, x1,x2,…,x24 is the credit evaluation indicator, and y is the credit rating of the corresponding sample.(2) Data Request Smart Contract. This smart contract is responsible for obtaining credit data from the blockchain. When a data demander (grid enterprise) needs to make a credit assessment of its material supply chain enterprises, the node permission information is verified, if the permissions are met, the contract is called to obtain data from the blockchain. The format in which the data is obtained is the same as the format of the chained data.The process of data upload and data acquisition should follow the blockchain consensus mechanism, and after the consensus is completed, the node operation information is stored in the blockchain ledger.In this paper, the experiment is implemented through Fabric 1.4. It supports three consensus modes, which are Solo mode, Kafka mode, and Etcdraft mode. In the Solo mode, there is a central authority serving as the ranking node for all peer nodes. Its scalability is poor, and it is not suitable for the production environment. The Kafka mode is implemented through the Kafka cluster and uses the Kafka platform to sort all transaction information. The Etcdraft pattern introduces the Raft consensus mechanism. Raft is a crash fault tolerant consensus sorting algorithm, and it allows for up to half of the failed node in the system. Raft is a new consensus mode for Fabric that can replace the Kafka consensus mode and is easier to configure and more decentralized. The Etcdraft pattern is used in this paper.Different from the POW consensus mechanism, the Etcdraft pattern does not require computing power consumption to reach consensus, thus saving a lot of computing resource consumption for nodes. However, each node needs to fully store the transaction data which brings the pressure of storage. And the storage pressure will gradually increase as the length of the blockchain increases.


#### 3.2.3. Data Storage

Blockchain holds transactions for all nodes, and the transactions are orderly and tamper-proof. In the superledge Fabric, the blockchain ledger consists of two parts: the world state and the blockchain. The transactions recorded in the blockchain determine the state of the world. The state of the world of the ledger is the latest value of a set of ledger data in the form of a key value pair, generally expressed as a database, such as CouchDB. The blockchain of the ledger is constructed from N blocks linked by hash values, each containing orderly transactions overtime.There are two types of data stored in the blockchain ledger of the credit evaluation model: one is the credit data of the power grid material supply chain enterprises uploaded by the data supply node, which is recorded as the original data of the credit system, that is, the credit data of the power grid supply chain enterprises, which is recorded in the status database. The other type is the operation record information of the blockchain node, which is generally the read and write record of the peer node in the blockchain, and the information is recorded in the block structure of the blockchain.Before the blockchain data are uploaded, the credit data are preprocessed, and the data are stored by Fabric’s world state database CouchDB during the storage of the original data. Each credit source data includes the number of the credit data, 24 credit indicators, and the credit rating of each data. Each credit data has a different number and serves as the primary key to the credit data.credit ID=130001,index1=2,index2=3,index3=0,……index23=1,index24=2,rank=2. The framework adopts the alliance chain structure. Data are stored in the blockchain, and the failure of one node does not affect the work of others. This distributed storage mode improves the security of the framework. In addition, by setting different identities for nodes in the alliance chain, access control can be realized, and data security can be improved. For example, data providers can only upload data but cannot change or download data.Although the decentralized architecture based on an alliance chain enhances data security, it brings scalability problems. If all nodes participate in the consensus, the overall system performance is limited to the upper limit of a single node. Therefore, the overall system performance cannot be improved even if a large number of nodes are added to the system. The increment of scalability requires the sacrifice of security.


### 3.3. Improved Softmax Regression Credit Rating Estimation

#### 3.3.1. Credit Evaluation Softmax Regression Algorithm

The purpose of this model design is to divide the credit rating of enterprises into four categories, such as A, B, C, and D, through the relevant credit information of power grid material supply chain enterprises. This problem is a typical multiclassification problem. The commonly used machine learning methods for this kind of problem include the kNN algorithm, Softmax regression algorithm, and multi-SVM algorithm.Among them, the Softmax regression model is the popularization of the logistic regression model in multiclassification problems, and logical regression is mainly aimed at the second classification problem, which has been used more in the field of credit evaluation such as personal credit. The Softmax regression algorithm has good training results for multiclassification problems with linear data and mutually exclusive categories which makes it more suitable for establishing the credit evaluation model. So, the algorithm we used in this paper is Softmax regression. According to the credit evaluation mechanism designed in this paper, a 4-category Softmax regression model is designed.In this credit evaluation model, including the dataset and the Softmax regression algorithm, a part of the dataset is taken as a training set, through the Softmax regression algorithm for continuous iterative training, and finally, a weight matrix is obtained to determine the impact of each indicator on the classification results.The workflow of Softmax regression is shown in Figure2, and the specific process is as follows:(1)
Obtaining the dataset: the parameters of the dataset include 24 credit evaluation indicators for the power grid supply chain enterprises and an existing credit evaluation result. In the processing of the data source, the training set and the test set are divided according to the ratio of 7 : 3, the former as input when the model is trained, and the latter as input when testing the model.(2)
Data preprocessing: storing the dataset as a matrix, the initial data matrix has a total of N rows and 24 columns, recorded asDataN×24, of which N is the number of bars of training set information, and 24 is the number of credit evaluation indicators. LabelN is the credit categories corresponding to the credit history, Labeli∈1,2,3,4.(3)
Initializing the weight matrix: credit evaluation weight matrixWeight24×4 has a total of 24 rows and 4 columns, indicating the impact of each evaluation index on the evaluation results of the size, 24 is the number of evaluation indicators, 4 is the number of credit grade categories, and the initial value of the weight matrix can be set to 1.(4)
DataN×24 is multiplied by Weight24×4 to get a new matrix of N rows and 4 columns, MatrixN×4, where the 1, 2, 3, and 4 columns of data respectively represent the credit data under the current weight under the A, B, C, and D four levels of the score.(5)
Using the Softmax function to normalize each row of data, the updated new matrix,SoftmaxN×4, where the 1, 2, 3, and 4 columns of data represent the probability that the credit data belong to the four levels A, B, C, and D.(1)SoftmaxMatrixi,j=eMatrixi,j∑k=14eMatrixi,j,j=1,2,3,4.(6)
According to the updatedSoftmaxN×4 and LabelN, the cross-entropy loss function is calculated to produce the loss matrix LossN×4.(2)Lossi=−∑j=14yjlnSoftmaxi,j.Whenj=Labeli, yj=1, otherwise, yj=0.(7)
The loss function is optimized and decomposed by the gradient drop method to obtain the gradient (∇Loss) of the loss function in the direction of the parameter, as shown in the following equation:(3)∇Loss=∂Loss∂w0,0⋯∂Loss∂wk0,3⋮⋱⋮∂Loss∂w24,0⋯∂Loss∂w24,4.(8)
The weight matrix is updated according to a certain learning rate.(4)newWeightk,j=Weightk,j−α∂Loss∂wk,j=Weightk,j+α1n∑i=1nDatai,ky^i,j−eMatrixi,j∑∑k=14eMatrixi,j,(y^i,j is a one-dimensional 0-1 matrix. When j = Labeli, y^i,j=1, otherwise, y^i,j=0. Α is the set learning rate (step)).(9)
Steps (4–8) are repeated until the model converges.Figure 2
The workflow of Softmax regression.Through the above steps, we can get the weight matrix after training, which can show the impact of each indicator on the credit evaluation results more accurately.The test dataX1,X2,…,X24 is multiplied by the weight matrix, and the predict value of the test data D1,D2,D3,D4 is obtained for each category; the category with the highest predict value is the result. According to this kind of testing method, the credit rating of the enterprise can be graded according to the 24 selected evaluation indicators.


### 3.4. Softmax Regression Algorithm Improvements

Although the initial Softmax regression algorithm is often used to solve multiple classification problems, it still has some disadvantages. The Softmax normalization functions are prone to spillover problems when performing exponential operations, and the Softmax loss function does not encourage increased intraclass compactness and class-to-class separation. As a result, the initial Softmax regression algorithm may not reach the expected accuracy in the classification of corporate credit. Thus, it is necessary to improve the normalization function and loss function of the Softmax regression algorithm to make the feature vector class as compact as possible within the class and as separate as possible between classes so as to meet the needs of the credit evaluation model in this paper.


#### 3.4.1. Improved Softmax Normalization Function

The normalization function maps the data from the real range to a range of 0 to 1 in order to make the data more comparable, such as min-max standardization, log function transform, and inverse tangent transform. The most commonly used function in neural network multiclassification is Softmax normalization, which balances probability distribution while avoiding the occurrence of probability 0.Softmax normalization function is shown, as equation (5) maps the indicators of the normalization function by the exponential function; the denominator adds all the results after the mapping. F is the input array, which refers to MatrixN×4 (DataN×24 multiplied by Weight24×4).(5)Softmaxfi=efi∑k=1Kefk.Considering the growth characteristics of exponential functions, it is easy to produce very large values in the (5) calculation process. Division between these extreme values is prone to overflow operations, exceeding the computer double-type storage limit, so the formula is transformed as follows:(6)Softmaxfi=CefiC∑k=1Kefk=efi+lnC∑k=1Kefk+lnC=efi+C∗∑k=1Kefk+C∗.In equation (6), it can be seen that the constant-level addition and subtraction operation in Softmax during exponential mapping do not change the final normalization result. Therefore, excluding the maximum value of the input signal when calculating can prevent overflow.Finally, the normalization is done bySoftmaxfi=efi−maxf/∑k=1Kefk−maxf.


#### 3.4.2. Improved Softmax Loss Function

Loss function is used to evaluate the distance between the results predicted by the model and the actual results, also known as the cost function. In the credit evaluation model, the process of iterative training is the process of loss optimization; the smaller the loss function, the closer the prediction results of the model to the real results, and the better the robustness of the model.In the design process of the model, the cross-entropy loss function is used to predict the degree of proximity between the label and the real label, and the cross-entropy loss is only related to the probability corresponding to the real category, which is easy to calculate the gradient. However, in order to enhance the accuracy of classification and the ability to distinguish characteristics, a new cost calculation method, center loss function, is introduced, combined with cross-entropy loss function and central loss function to improve the accuracy of the credit evaluation model.Formula (7) is the definition of the center loss function, where xi is the sample I, and cyi is the eigencenter of yj:(7)Lc=12∑i=1Nxi−xyi22.The principle of the center loss function is to set a class centerc in the feature space for each category of the training set, and in the process of gradient decline, the training results of the sample are close to the center of the characteristic space class of the category and can enhance the cohesion of the category. The gradient of Lc in the direction of the parameters is shown in the following equation:(8)∂Lc∂xi=xi−cyi.The update of the eigencenterc is shown in (9); δyi=j is 1 when conditions are met, otherwise, it is 0; that is, cj is needed to be updated when yj equals j.(9)Δcj=∑i=1Nδyi=j∗cj−xi1+∑i=1Nδyi=j.In the Softmax regression model adopted by the credit evaluation mechanism in this paper, the cross-entropy loss function and the central loss function are combined; the improved loss function is shown in (10); β is used to control the proportion between the two loss functions.(10)Lossi=−∑j=14yjlnSoftmaxi,j.The loss function is to use cross-entropy lossLs to separate different categories, to compress the same category by using central loss Lc, and finally to combine the advantages of the two loss functions to distinguish the classification. The new loss function can achieve better interclass separation through cross-entropy loss and can minimize the inclass distance through the central loss so that the results of credit evaluation can have good discrimination.


### 3.5. Credit Evaluation Model Performance Evaluation Indicators

After the Softmax credit evaluation model is established, it is necessary to choose the appropriate method to evaluate the accuracy of the model. In this paper, the accuracy, precision, recall rate, F1_score, and other classification algorithms are the commonly used indicators for model analysis.First, we establish a confusion matrix based on the test sample. The evaluation index of the model is calculated on the basis of the confusion matrix.Table3 is a 4-classification confusion matrix, where aij represents the sample size of the predicted value Class j, the true value is Class I, and aij is the result of the prediction success. In a multiclassification model, the common indicators used to evaluate the model are accuracy (accuracy), precision (precision), recall(recall), F1 score (F1_score), and adjusted F1 score (F1_weighted).Table 3
Confusion matrix.
Confusion matrixPredicted valueType 1Type 2Type 3Type 4True valueType 1a11a12a13a14Type 2a21a22a23a24Type 3a31a32a33a34Type 4a41a42a43a44Based on the resulting confusion matrix, the following calculations can be made:The accuracy of a multiclassified model is the total proportion that describes the model’s correct judgment, as defined in the following equation:(11)accuracy=∑i=1kaii∑i=1k∑j=1kaij.In the F-classification model, if class I is specified, it can be thought of as a positive class, and other F1 classes can be combined into negative classes, and then it can be transformed into a two-classification model. The following,precisioni, recalli,F1Scorei are all derived from this method.(12)precisioni=aii∑t=1kati,recalli=aii∑t=1kait,F1−scorei=2∗precisioni+recalliprecisioni∗recalli.Adjusted F1 score (F1_weighted) is the weighted average ofF1Scorei, and the weight is the proportion of each type in the true value.(13)F1weighted=∑i=1kF1Scorei∗∑j=1kaij∑i=1k∑j=1kaij.In the five indicators above, accuracy and adjusted F1 scores (F1_weighted) reflect the evaluation level of the evaluation model more holistically, while accuracy, recall, and F1 score (F1_score) do not reflect the overall picture but rather prefer the evaluation of category I.According to the test results in the above indicators of the score, we can evaluate the performance of the model objectively; the higher the score on the above indicators, the better the performance of the model.In addition, in order to show the effect of the credit evaluation model more intuitively, the ROC (receiver operating characteristic) curve is also used to evaluate the performance of the model. ROC curves are used in the evaluation of two classifications and can evaluate the relationship between model specificity and sensitivity. In the evaluation of the four-classification Softmax regression model, adaptive improvement is carried out. The improved method is to treat one class in A, B, C, and D as a positive class and the other three as a negative class, to calculate the four ROC curves, and to turn the four-classification problems into two-classification problems. During the establishment of the ROC curve, two indicators, TPR (true positive rate) and FPR (false positive rate), need to be calculated as ordinates and horizontal coordinates.(14)TPR=TPTP+FN,FPR=FPFP+TN.TP represents the sample of [predicted value = positive, real value = positive], FP represents the sample of [predicted value = positive, real value = negative], FN represents the sample of [predicted value = negative, real value = positive], and TN represents the sample of [predicted value = negative, real value = negative].AUC (area under the curve) is also used with the ROC curve to evaluate model performance. The value of AUC is the area below the ROC curve. In general, the larger the area corresponding to the AUC, the model is corresponding to a stronger classification capacity.


## 3.1. Credit Rating and Evaluation Index of Enterprises in Power Grid Supply Chain

The operation of the power grid is related to the national economy and people’s livelihood, public safety, and energy security. In order to accurately manage their supply chain risk, the credit evaluation model should grade the credit of power grid supply chain enterprises and adopt different risk management measures for power grid supply chain enterprises with different credit ratings. As shown in Table1, at present, the credit rating of power grid material supply chain enterprises is divided into A, B, C, and D, corresponding to “excellent,” “good,” “general,” and “poor.”Table 1
Credit rating.
Credit ratingExplanationAExcellentBGoodCGeneralDPoorThe grid supply chain is based on end-user demand for electricity and emergency protection. It is a network chain structure consisting of the whole life cycle activities such as material procurement, circulation, and recovery which are generated from power grid construction, operation maintenance, and emergency support services. So, it needs the cooperation of enterprises in the whole link, and the enterprises need a power grid supply chain service for the power grid. So, they not only need to consider economic benefits but also to shoulder the responsibility of providing energy conservation products, protecting the environment, providing high-quality products and services, and supplying then timely and accurately. Also, the power grid supply chain and Power IoT maintain a safe and economical material inventory and provide emergency support materials and other basic social responsibilities.Based on the overall characteristics of the power grid supply chain, in order to ensure a systematic and global evaluation of the overall credit rating of power grid supply chain enterprises, at the same time reduce the impact of individual subjective factors on credit evaluation, the selection of indicators is based on quantitative indicators. The credit evaluation index system includes five primary indicators: “enterprise basic information,” “service level,” “operational norms,” “safety management,” and “innovation and development,” and subdivides the primary indicators into 13 secondary indicators and 24 tertiary indicators. The specific evaluation indicators are shown in Table2.Table 2
The credit evaluation index of enterprises in the supply chain of power grid materials.
Primary indicatorsSecondary indicatorsTertiary indicatorsEnterprise basic informationEnterprise registered capitalRegistered capital of the enterpriseRegistered employeesRegistered employeesService levelProduct reliabilityThe failure rate of the devicePass rate for spot checksProduct satisfaction ratePurchase supply reliabilitySupply completion rateSupply accuracySupply punctualityOperational normsPurchase supply specification indexOpen purchase rateProcurement specificationStandardized material application ratesSpot check coveragePower trading code indexSettlement of electricity chargesWhether to execute the electricity contract on an appointment basis, including the “direct transaction contract between the power user and the power generation enterprise” and the “power supply contract”The annual rate of performance of electricity consumption of enterprisesIntegrity self-regulation indexNumber of incorruptibility incidents of material system personnelSafety managementProduction safetyNumber of safety incidentsOccupational health and safetyWhether the occupational health and safety management system certification is passedElectricity safetyWhether there is an emergency power supplyWhether there is illegal use of electricityInnovation and developmentGreen development indexWhether the enterprise environmental certification has passedDisposal rate of waste materialsManagement innovationManage the number of innovationsStandard promotion indexStandard rolloutAmong them, “enterprise basic information” includes “enterprise registered capital” and “registered employees,” which are used to evaluate the overall scale level of the enterprise. “Service levels” include “product reliability” and “procurement supply reliability” to assess the quality and service of goods in the procurement and supply process. “Operational norms” include the “purchase supply specification index,” the “power trading code index,” and the “integrity self-regulation index,” which measure the degree of management norms in the process of purchasing and supplying materials and trading electricity. “Safety Management” includes “occupational health and safety,” “production safety,” and “electricity safety” to evaluate the overall level of safety management of an enterprise. “Innovation development” includes the “green development index,” the “management innovation index,” and the “standard promotion index,” which are designed to study innovative management measures to ensure and improve the long-term growth rate, efficiency, and quality of development of enterprises, and enhance their social impact.


## 3.2. Blockchain-Based Credit Evaluation Model

### 3.2.1. Overall Architecture

The credit evaluation model proposed in this paper adopts the alliance chain structure, and the participants of blockchain are power grid enterprises and power grid material supply chain enterprises. Nodes in the alliance chain improve data security and effectiveness by setting up different identities for access control. When credit assessment is required, the data demander node (power grid enterprise) can call the Softmax regression credit assessment algorithm, use the credit rating data already performed in the blockchain, and train the weight matrix that can be used for credit evaluation. The overall architecture model is shown in Figure1.Figure 1
Blockchain overall architecture diagram.In the credit evaluation model, there are two main types of roles: data provider and data demander. Data providers include credit bureaus and grid supply chain enterprises that require credit ratings, and data demanders are grid enterprises. Two different nodes correspond to the two roles of data provider and data demander. The data provider node is responsible for collecting credit evaluation index data and corresponding credit rating of power grid supply chain enterprises, preprocessing such data, and chaining the processed credit data. Data providers can only upload data and cannot make changes to or download data. The data demander nodes obtain the data from the blockchain, train the model, and finally obtain the model that can accurately divide the enterprise credit rating according to the credit index.After completing the blockchain credit node design, Fabric uses its own certificate components to generate CA certificates and MSP identity files for the credit node, providing identity configuration services for the Fabric node.


### 3.2.2. Smart Contract

The credit evaluation model proposed in this paper is based on the open-source framework, the Hyperledger Fabric, to do blockchain simulation, and the development of smart contracts is based on the development principles of the Fabric chain code. The creator writes credit evaluation smart contracts in high-level languages and signs them by all members of the alliance chain. In the design process of this blockchain-based credit evaluation system, the smart contract based on the blockchain framework is divided into two categories: system smart contract and user smart contract.System smart contracts are the basis for Fabric operation and need to be deployed to the blockchain when the blockchain node is started to implement process interaction tasks. There are five types of system chain codes:(1)
Configuration system chain code: responsible for chain code and channel configuration management(2)
Endorsement management system chain code: responsible for the endorsement (signature) process and can support the management of endorsement strategies(3)
Lifecycle system chain code: responsible for the user chain code life cycle management, including installation, deployment, upgrade, rights management, access to information, and other links(4)
Query system chain code: responsible for providing blockchain ledger information query function, such as access to block and transaction information(5)
Verify system chain code: responsible for checking according to endorsement strategy before the transaction is submittedUser smart contract is to use JAVA, Golang, and other programming languages to write code, processing business logic, its design on the one hand to consider the status of blockchain distributed ledger, and on the other hand to consider the actual business scenarios and development requirements. User smart contracts include: data publishing smart contracts and data request smart contracts.(1) Data Publishing Smart Contract. This smart contract is responsible for uploading credit data owned by the data provider into the blockchain. Data publishing intelligence strictly requires the amount and format of data collected, requires data providers to preprocess raw data, and uploads only the necessary information to the blockchain. The data format of the chain is id,x1,x2,…,x24,y, id is the number of the credit data, x1,x2,…,x24 is the credit evaluation indicator, and y is the credit rating of the corresponding sample.(2) Data Request Smart Contract. This smart contract is responsible for obtaining credit data from the blockchain. When a data demander (grid enterprise) needs to make a credit assessment of its material supply chain enterprises, the node permission information is verified, if the permissions are met, the contract is called to obtain data from the blockchain. The format in which the data is obtained is the same as the format of the chained data.The process of data upload and data acquisition should follow the blockchain consensus mechanism, and after the consensus is completed, the node operation information is stored in the blockchain ledger.In this paper, the experiment is implemented through Fabric 1.4. It supports three consensus modes, which are Solo mode, Kafka mode, and Etcdraft mode. In the Solo mode, there is a central authority serving as the ranking node for all peer nodes. Its scalability is poor, and it is not suitable for the production environment. The Kafka mode is implemented through the Kafka cluster and uses the Kafka platform to sort all transaction information. The Etcdraft pattern introduces the Raft consensus mechanism. Raft is a crash fault tolerant consensus sorting algorithm, and it allows for up to half of the failed node in the system. Raft is a new consensus mode for Fabric that can replace the Kafka consensus mode and is easier to configure and more decentralized. The Etcdraft pattern is used in this paper.Different from the POW consensus mechanism, the Etcdraft pattern does not require computing power consumption to reach consensus, thus saving a lot of computing resource consumption for nodes. However, each node needs to fully store the transaction data which brings the pressure of storage. And the storage pressure will gradually increase as the length of the blockchain increases.


### 3.2.3. Data Storage

Blockchain holds transactions for all nodes, and the transactions are orderly and tamper-proof. In the superledge Fabric, the blockchain ledger consists of two parts: the world state and the blockchain. The transactions recorded in the blockchain determine the state of the world. The state of the world of the ledger is the latest value of a set of ledger data in the form of a key value pair, generally expressed as a database, such as CouchDB. The blockchain of the ledger is constructed from N blocks linked by hash values, each containing orderly transactions overtime.There are two types of data stored in the blockchain ledger of the credit evaluation model: one is the credit data of the power grid material supply chain enterprises uploaded by the data supply node, which is recorded as the original data of the credit system, that is, the credit data of the power grid supply chain enterprises, which is recorded in the status database. The other type is the operation record information of the blockchain node, which is generally the read and write record of the peer node in the blockchain, and the information is recorded in the block structure of the blockchain.Before the blockchain data are uploaded, the credit data are preprocessed, and the data are stored by Fabric’s world state database CouchDB during the storage of the original data. Each credit source data includes the number of the credit data, 24 credit indicators, and the credit rating of each data. Each credit data has a different number and serves as the primary key to the credit data.credit ID=130001,index1=2,index2=3,index3=0,……index23=1,index24=2,rank=2. The framework adopts the alliance chain structure. Data are stored in the blockchain, and the failure of one node does not affect the work of others. This distributed storage mode improves the security of the framework. In addition, by setting different identities for nodes in the alliance chain, access control can be realized, and data security can be improved. For example, data providers can only upload data but cannot change or download data.Although the decentralized architecture based on an alliance chain enhances data security, it brings scalability problems. If all nodes participate in the consensus, the overall system performance is limited to the upper limit of a single node. Therefore, the overall system performance cannot be improved even if a large number of nodes are added to the system. The increment of scalability requires the sacrifice of security.


## 3.2.1. Overall Architecture

The credit evaluation model proposed in this paper adopts the alliance chain structure, and the participants of blockchain are power grid enterprises and power grid material supply chain enterprises. Nodes in the alliance chain improve data security and effectiveness by setting up different identities for access control. When credit assessment is required, the data demander node (power grid enterprise) can call the Softmax regression credit assessment algorithm, use the credit rating data already performed in the blockchain, and train the weight matrix that can be used for credit evaluation. The overall architecture model is shown in Figure1.Figure 1
Blockchain overall architecture diagram.In the credit evaluation model, there are two main types of roles: data provider and data demander. Data providers include credit bureaus and grid supply chain enterprises that require credit ratings, and data demanders are grid enterprises. Two different nodes correspond to the two roles of data provider and data demander. The data provider node is responsible for collecting credit evaluation index data and corresponding credit rating of power grid supply chain enterprises, preprocessing such data, and chaining the processed credit data. Data providers can only upload data and cannot make changes to or download data. The data demander nodes obtain the data from the blockchain, train the model, and finally obtain the model that can accurately divide the enterprise credit rating according to the credit index.After completing the blockchain credit node design, Fabric uses its own certificate components to generate CA certificates and MSP identity files for the credit node, providing identity configuration services for the Fabric node.


## 3.2.2. Smart Contract

The credit evaluation model proposed in this paper is based on the open-source framework, the Hyperledger Fabric, to do blockchain simulation, and the development of smart contracts is based on the development principles of the Fabric chain code. The creator writes credit evaluation smart contracts in high-level languages and signs them by all members of the alliance chain. In the design process of this blockchain-based credit evaluation system, the smart contract based on the blockchain framework is divided into two categories: system smart contract and user smart contract.System smart contracts are the basis for Fabric operation and need to be deployed to the blockchain when the blockchain node is started to implement process interaction tasks. There are five types of system chain codes:(1)
Configuration system chain code: responsible for chain code and channel configuration management(2)
Endorsement management system chain code: responsible for the endorsement (signature) process and can support the management of endorsement strategies(3)
Lifecycle system chain code: responsible for the user chain code life cycle management, including installation, deployment, upgrade, rights management, access to information, and other links(4)
Query system chain code: responsible for providing blockchain ledger information query function, such as access to block and transaction information(5)
Verify system chain code: responsible for checking according to endorsement strategy before the transaction is submittedUser smart contract is to use JAVA, Golang, and other programming languages to write code, processing business logic, its design on the one hand to consider the status of blockchain distributed ledger, and on the other hand to consider the actual business scenarios and development requirements. User smart contracts include: data publishing smart contracts and data request smart contracts.(1) Data Publishing Smart Contract. This smart contract is responsible for uploading credit data owned by the data provider into the blockchain. Data publishing intelligence strictly requires the amount and format of data collected, requires data providers to preprocess raw data, and uploads only the necessary information to the blockchain. The data format of the chain is id,x1,x2,…,x24,y, id is the number of the credit data, x1,x2,…,x24 is the credit evaluation indicator, and y is the credit rating of the corresponding sample.(2) Data Request Smart Contract. This smart contract is responsible for obtaining credit data from the blockchain. When a data demander (grid enterprise) needs to make a credit assessment of its material supply chain enterprises, the node permission information is verified, if the permissions are met, the contract is called to obtain data from the blockchain. The format in which the data is obtained is the same as the format of the chained data.The process of data upload and data acquisition should follow the blockchain consensus mechanism, and after the consensus is completed, the node operation information is stored in the blockchain ledger.In this paper, the experiment is implemented through Fabric 1.4. It supports three consensus modes, which are Solo mode, Kafka mode, and Etcdraft mode. In the Solo mode, there is a central authority serving as the ranking node for all peer nodes. Its scalability is poor, and it is not suitable for the production environment. The Kafka mode is implemented through the Kafka cluster and uses the Kafka platform to sort all transaction information. The Etcdraft pattern introduces the Raft consensus mechanism. Raft is a crash fault tolerant consensus sorting algorithm, and it allows for up to half of the failed node in the system. Raft is a new consensus mode for Fabric that can replace the Kafka consensus mode and is easier to configure and more decentralized. The Etcdraft pattern is used in this paper.Different from the POW consensus mechanism, the Etcdraft pattern does not require computing power consumption to reach consensus, thus saving a lot of computing resource consumption for nodes. However, each node needs to fully store the transaction data which brings the pressure of storage. And the storage pressure will gradually increase as the length of the blockchain increases.


## 3.2.3. Data Storage

Blockchain holds transactions for all nodes, and the transactions are orderly and tamper-proof. In the superledge Fabric, the blockchain ledger consists of two parts: the world state and the blockchain. The transactions recorded in the blockchain determine the state of the world. The state of the world of the ledger is the latest value of a set of ledger data in the form of a key value pair, generally expressed as a database, such as CouchDB. The blockchain of the ledger is constructed from N blocks linked by hash values, each containing orderly transactions overtime.There are two types of data stored in the blockchain ledger of the credit evaluation model: one is the credit data of the power grid material supply chain enterprises uploaded by the data supply node, which is recorded as the original data of the credit system, that is, the credit data of the power grid supply chain enterprises, which is recorded in the status database. The other type is the operation record information of the blockchain node, which is generally the read and write record of the peer node in the blockchain, and the information is recorded in the block structure of the blockchain.Before the blockchain data are uploaded, the credit data are preprocessed, and the data are stored by Fabric’s world state database CouchDB during the storage of the original data. Each credit source data includes the number of the credit data, 24 credit indicators, and the credit rating of each data. Each credit data has a different number and serves as the primary key to the credit data.credit ID=130001,index1=2,index2=3,index3=0,……index23=1,index24=2,rank=2. The framework adopts the alliance chain structure. Data are stored in the blockchain, and the failure of one node does not affect the work of others. This distributed storage mode improves the security of the framework. In addition, by setting different identities for nodes in the alliance chain, access control can be realized, and data security can be improved. For example, data providers can only upload data but cannot change or download data.Although the decentralized architecture based on an alliance chain enhances data security, it brings scalability problems. If all nodes participate in the consensus, the overall system performance is limited to the upper limit of a single node. Therefore, the overall system performance cannot be improved even if a large number of nodes are added to the system. The increment of scalability requires the sacrifice of security.


## 3.3. Improved Softmax Regression Credit Rating Estimation

### 3.3.1. Credit Evaluation Softmax Regression Algorithm

The purpose of this model design is to divide the credit rating of enterprises into four categories, such as A, B, C, and D, through the relevant credit information of power grid material supply chain enterprises. This problem is a typical multiclassification problem. The commonly used machine learning methods for this kind of problem include the kNN algorithm, Softmax regression algorithm, and multi-SVM algorithm.Among them, the Softmax regression model is the popularization of the logistic regression model in multiclassification problems, and logical regression is mainly aimed at the second classification problem, which has been used more in the field of credit evaluation such as personal credit. The Softmax regression algorithm has good training results for multiclassification problems with linear data and mutually exclusive categories which makes it more suitable for establishing the credit evaluation model. So, the algorithm we used in this paper is Softmax regression. According to the credit evaluation mechanism designed in this paper, a 4-category Softmax regression model is designed.In this credit evaluation model, including the dataset and the Softmax regression algorithm, a part of the dataset is taken as a training set, through the Softmax regression algorithm for continuous iterative training, and finally, a weight matrix is obtained to determine the impact of each indicator on the classification results.The workflow of Softmax regression is shown in Figure2, and the specific process is as follows:(1)
Obtaining the dataset: the parameters of the dataset include 24 credit evaluation indicators for the power grid supply chain enterprises and an existing credit evaluation result. In the processing of the data source, the training set and the test set are divided according to the ratio of 7 : 3, the former as input when the model is trained, and the latter as input when testing the model.(2)
Data preprocessing: storing the dataset as a matrix, the initial data matrix has a total of N rows and 24 columns, recorded asDataN×24, of which N is the number of bars of training set information, and 24 is the number of credit evaluation indicators. LabelN is the credit categories corresponding to the credit history, Labeli∈1,2,3,4.(3)
Initializing the weight matrix: credit evaluation weight matrixWeight24×4 has a total of 24 rows and 4 columns, indicating the impact of each evaluation index on the evaluation results of the size, 24 is the number of evaluation indicators, 4 is the number of credit grade categories, and the initial value of the weight matrix can be set to 1.(4)
DataN×24 is multiplied by Weight24×4 to get a new matrix of N rows and 4 columns, MatrixN×4, where the 1, 2, 3, and 4 columns of data respectively represent the credit data under the current weight under the A, B, C, and D four levels of the score.(5)
Using the Softmax function to normalize each row of data, the updated new matrix,SoftmaxN×4, where the 1, 2, 3, and 4 columns of data represent the probability that the credit data belong to the four levels A, B, C, and D.(1)SoftmaxMatrixi,j=eMatrixi,j∑k=14eMatrixi,j,j=1,2,3,4.(6)
According to the updatedSoftmaxN×4 and LabelN, the cross-entropy loss function is calculated to produce the loss matrix LossN×4.(2)Lossi=−∑j=14yjlnSoftmaxi,j.Whenj=Labeli, yj=1, otherwise, yj=0.(7)
The loss function is optimized and decomposed by the gradient drop method to obtain the gradient (∇Loss) of the loss function in the direction of the parameter, as shown in the following equation:(3)∇Loss=∂Loss∂w0,0⋯∂Loss∂wk0,3⋮⋱⋮∂Loss∂w24,0⋯∂Loss∂w24,4.(8)
The weight matrix is updated according to a certain learning rate.(4)newWeightk,j=Weightk,j−α∂Loss∂wk,j=Weightk,j+α1n∑i=1nDatai,ky^i,j−eMatrixi,j∑∑k=14eMatrixi,j,(y^i,j is a one-dimensional 0-1 matrix. When j = Labeli, y^i,j=1, otherwise, y^i,j=0. Α is the set learning rate (step)).(9)
Steps (4–8) are repeated until the model converges.Figure 2
The workflow of Softmax regression.Through the above steps, we can get the weight matrix after training, which can show the impact of each indicator on the credit evaluation results more accurately.The test dataX1,X2,…,X24 is multiplied by the weight matrix, and the predict value of the test data D1,D2,D3,D4 is obtained for each category; the category with the highest predict value is the result. According to this kind of testing method, the credit rating of the enterprise can be graded according to the 24 selected evaluation indicators.


## 3.3.1. Credit Evaluation Softmax Regression Algorithm

The purpose of this model design is to divide the credit rating of enterprises into four categories, such as A, B, C, and D, through the relevant credit information of power grid material supply chain enterprises. This problem is a typical multiclassification problem. The commonly used machine learning methods for this kind of problem include the kNN algorithm, Softmax regression algorithm, and multi-SVM algorithm.Among them, the Softmax regression model is the popularization of the logistic regression model in multiclassification problems, and logical regression is mainly aimed at the second classification problem, which has been used more in the field of credit evaluation such as personal credit. The Softmax regression algorithm has good training results for multiclassification problems with linear data and mutually exclusive categories which makes it more suitable for establishing the credit evaluation model. So, the algorithm we used in this paper is Softmax regression. According to the credit evaluation mechanism designed in this paper, a 4-category Softmax regression model is designed.In this credit evaluation model, including the dataset and the Softmax regression algorithm, a part of the dataset is taken as a training set, through the Softmax regression algorithm for continuous iterative training, and finally, a weight matrix is obtained to determine the impact of each indicator on the classification results.The workflow of Softmax regression is shown in Figure2, and the specific process is as follows:(1)
Obtaining the dataset: the parameters of the dataset include 24 credit evaluation indicators for the power grid supply chain enterprises and an existing credit evaluation result. In the processing of the data source, the training set and the test set are divided according to the ratio of 7 : 3, the former as input when the model is trained, and the latter as input when testing the model.(2)
Data preprocessing: storing the dataset as a matrix, the initial data matrix has a total of N rows and 24 columns, recorded asDataN×24, of which N is the number of bars of training set information, and 24 is the number of credit evaluation indicators. LabelN is the credit categories corresponding to the credit history, Labeli∈1,2,3,4.(3)
Initializing the weight matrix: credit evaluation weight matrixWeight24×4 has a total of 24 rows and 4 columns, indicating the impact of each evaluation index on the evaluation results of the size, 24 is the number of evaluation indicators, 4 is the number of credit grade categories, and the initial value of the weight matrix can be set to 1.(4)
DataN×24 is multiplied by Weight24×4 to get a new matrix of N rows and 4 columns, MatrixN×4, where the 1, 2, 3, and 4 columns of data respectively represent the credit data under the current weight under the A, B, C, and D four levels of the score.(5)
Using the Softmax function to normalize each row of data, the updated new matrix,SoftmaxN×4, where the 1, 2, 3, and 4 columns of data represent the probability that the credit data belong to the four levels A, B, C, and D.(1)SoftmaxMatrixi,j=eMatrixi,j∑k=14eMatrixi,j,j=1,2,3,4.(6)
According to the updatedSoftmaxN×4 and LabelN, the cross-entropy loss function is calculated to produce the loss matrix LossN×4.(2)Lossi=−∑j=14yjlnSoftmaxi,j.Whenj=Labeli, yj=1, otherwise, yj=0.(7)
The loss function is optimized and decomposed by the gradient drop method to obtain the gradient (∇Loss) of the loss function in the direction of the parameter, as shown in the following equation:(3)∇Loss=∂Loss∂w0,0⋯∂Loss∂wk0,3⋮⋱⋮∂Loss∂w24,0⋯∂Loss∂w24,4.(8)
The weight matrix is updated according to a certain learning rate.(4)newWeightk,j=Weightk,j−α∂Loss∂wk,j=Weightk,j+α1n∑i=1nDatai,ky^i,j−eMatrixi,j∑∑k=14eMatrixi,j,(y^i,j is a one-dimensional 0-1 matrix. When j = Labeli, y^i,j=1, otherwise, y^i,j=0. Α is the set learning rate (step)).(9)
Steps (4–8) are repeated until the model converges.Figure 2
The workflow of Softmax regression.Through the above steps, we can get the weight matrix after training, which can show the impact of each indicator on the credit evaluation results more accurately.The test dataX1,X2,…,X24 is multiplied by the weight matrix, and the predict value of the test data D1,D2,D3,D4 is obtained for each category; the category with the highest predict value is the result. According to this kind of testing method, the credit rating of the enterprise can be graded according to the 24 selected evaluation indicators.


## 3.4. Softmax Regression Algorithm Improvements

Although the initial Softmax regression algorithm is often used to solve multiple classification problems, it still has some disadvantages. The Softmax normalization functions are prone to spillover problems when performing exponential operations, and the Softmax loss function does not encourage increased intraclass compactness and class-to-class separation. As a result, the initial Softmax regression algorithm may not reach the expected accuracy in the classification of corporate credit. Thus, it is necessary to improve the normalization function and loss function of the Softmax regression algorithm to make the feature vector class as compact as possible within the class and as separate as possible between classes so as to meet the needs of the credit evaluation model in this paper.


### 3.4.1. Improved Softmax Normalization Function

The normalization function maps the data from the real range to a range of 0 to 1 in order to make the data more comparable, such as min-max standardization, log function transform, and inverse tangent transform. The most commonly used function in neural network multiclassification is Softmax normalization, which balances probability distribution while avoiding the occurrence of probability 0.Softmax normalization function is shown, as equation (5) maps the indicators of the normalization function by the exponential function; the denominator adds all the results after the mapping. F is the input array, which refers to MatrixN×4 (DataN×24 multiplied by Weight24×4).(5)Softmaxfi=efi∑k=1Kefk.Considering the growth characteristics of exponential functions, it is easy to produce very large values in the (5) calculation process. Division between these extreme values is prone to overflow operations, exceeding the computer double-type storage limit, so the formula is transformed as follows:(6)Softmaxfi=CefiC∑k=1Kefk=efi+lnC∑k=1Kefk+lnC=efi+C∗∑k=1Kefk+C∗.In equation (6), it can be seen that the constant-level addition and subtraction operation in Softmax during exponential mapping do not change the final normalization result. Therefore, excluding the maximum value of the input signal when calculating can prevent overflow.Finally, the normalization is done bySoftmaxfi=efi−maxf/∑k=1Kefk−maxf.


### 3.4.2. Improved Softmax Loss Function

Loss function is used to evaluate the distance between the results predicted by the model and the actual results, also known as the cost function. In the credit evaluation model, the process of iterative training is the process of loss optimization; the smaller the loss function, the closer the prediction results of the model to the real results, and the better the robustness of the model.In the design process of the model, the cross-entropy loss function is used to predict the degree of proximity between the label and the real label, and the cross-entropy loss is only related to the probability corresponding to the real category, which is easy to calculate the gradient. However, in order to enhance the accuracy of classification and the ability to distinguish characteristics, a new cost calculation method, center loss function, is introduced, combined with cross-entropy loss function and central loss function to improve the accuracy of the credit evaluation model.Formula (7) is the definition of the center loss function, where xi is the sample I, and cyi is the eigencenter of yj:(7)Lc=12∑i=1Nxi−xyi22.The principle of the center loss function is to set a class centerc in the feature space for each category of the training set, and in the process of gradient decline, the training results of the sample are close to the center of the characteristic space class of the category and can enhance the cohesion of the category. The gradient of Lc in the direction of the parameters is shown in the following equation:(8)∂Lc∂xi=xi−cyi.The update of the eigencenterc is shown in (9); δyi=j is 1 when conditions are met, otherwise, it is 0; that is, cj is needed to be updated when yj equals j.(9)Δcj=∑i=1Nδyi=j∗cj−xi1+∑i=1Nδyi=j.In the Softmax regression model adopted by the credit evaluation mechanism in this paper, the cross-entropy loss function and the central loss function are combined; the improved loss function is shown in (10); β is used to control the proportion between the two loss functions.(10)Lossi=−∑j=14yjlnSoftmaxi,j.The loss function is to use cross-entropy lossLs to separate different categories, to compress the same category by using central loss Lc, and finally to combine the advantages of the two loss functions to distinguish the classification. The new loss function can achieve better interclass separation through cross-entropy loss and can minimize the inclass distance through the central loss so that the results of credit evaluation can have good discrimination.


## 3.4.1. Improved Softmax Normalization Function

The normalization function maps the data from the real range to a range of 0 to 1 in order to make the data more comparable, such as min-max standardization, log function transform, and inverse tangent transform. The most commonly used function in neural network multiclassification is Softmax normalization, which balances probability distribution while avoiding the occurrence of probability 0.Softmax normalization function is shown, as equation (5) maps the indicators of the normalization function by the exponential function; the denominator adds all the results after the mapping. F is the input array, which refers to MatrixN×4 (DataN×24 multiplied by Weight24×4).(5)Softmaxfi=efi∑k=1Kefk.Considering the growth characteristics of exponential functions, it is easy to produce very large values in the (5) calculation process. Division between these extreme values is prone to overflow operations, exceeding the computer double-type storage limit, so the formula is transformed as follows:(6)Softmaxfi=CefiC∑k=1Kefk=efi+lnC∑k=1Kefk+lnC=efi+C∗∑k=1Kefk+C∗.In equation (6), it can be seen that the constant-level addition and subtraction operation in Softmax during exponential mapping do not change the final normalization result. Therefore, excluding the maximum value of the input signal when calculating can prevent overflow.Finally, the normalization is done bySoftmaxfi=efi−maxf/∑k=1Kefk−maxf.


## 3.4.2. Improved Softmax Loss Function

Loss function is used to evaluate the distance between the results predicted by the model and the actual results, also known as the cost function. In the credit evaluation model, the process of iterative training is the process of loss optimization; the smaller the loss function, the closer the prediction results of the model to the real results, and the better the robustness of the model.In the design process of the model, the cross-entropy loss function is used to predict the degree of proximity between the label and the real label, and the cross-entropy loss is only related to the probability corresponding to the real category, which is easy to calculate the gradient. However, in order to enhance the accuracy of classification and the ability to distinguish characteristics, a new cost calculation method, center loss function, is introduced, combined with cross-entropy loss function and central loss function to improve the accuracy of the credit evaluation model.Formula (7) is the definition of the center loss function, where xi is the sample I, and cyi is the eigencenter of yj:(7)Lc=12∑i=1Nxi−xyi22.The principle of the center loss function is to set a class centerc in the feature space for each category of the training set, and in the process of gradient decline, the training results of the sample are close to the center of the characteristic space class of the category and can enhance the cohesion of the category. The gradient of Lc in the direction of the parameters is shown in the following equation:(8)∂Lc∂xi=xi−cyi.The update of the eigencenterc is shown in (9); δyi=j is 1 when conditions are met, otherwise, it is 0; that is, cj is needed to be updated when yj equals j.(9)Δcj=∑i=1Nδyi=j∗cj−xi1+∑i=1Nδyi=j.In the Softmax regression model adopted by the credit evaluation mechanism in this paper, the cross-entropy loss function and the central loss function are combined; the improved loss function is shown in (10); β is used to control the proportion between the two loss functions.(10)Lossi=−∑j=14yjlnSoftmaxi,j.The loss function is to use cross-entropy lossLs to separate different categories, to compress the same category by using central loss Lc, and finally to combine the advantages of the two loss functions to distinguish the classification. The new loss function can achieve better interclass separation through cross-entropy loss and can minimize the inclass distance through the central loss so that the results of credit evaluation can have good discrimination.


## 3.5. Credit Evaluation Model Performance Evaluation Indicators

After the Softmax credit evaluation model is established, it is necessary to choose the appropriate method to evaluate the accuracy of the model. In this paper, the accuracy, precision, recall rate, F1_score, and other classification algorithms are the commonly used indicators for model analysis.First, we establish a confusion matrix based on the test sample. The evaluation index of the model is calculated on the basis of the confusion matrix.Table3 is a 4-classification confusion matrix, where aij represents the sample size of the predicted value Class j, the true value is Class I, and aij is the result of the prediction success. In a multiclassification model, the common indicators used to evaluate the model are accuracy (accuracy), precision (precision), recall(recall), F1 score (F1_score), and adjusted F1 score (F1_weighted).Table 3
Confusion matrix.
Confusion matrixPredicted valueType 1Type 2Type 3Type 4True valueType 1a11a12a13a14Type 2a21a22a23a24Type 3a31a32a33a34Type 4a41a42a43a44Based on the resulting confusion matrix, the following calculations can be made:The accuracy of a multiclassified model is the total proportion that describes the model’s correct judgment, as defined in the following equation:(11)accuracy=∑i=1kaii∑i=1k∑j=1kaij.In the F-classification model, if class I is specified, it can be thought of as a positive class, and other F1 classes can be combined into negative classes, and then it can be transformed into a two-classification model. The following,precisioni, recalli,F1Scorei are all derived from this method.(12)precisioni=aii∑t=1kati,recalli=aii∑t=1kait,F1−scorei=2∗precisioni+recalliprecisioni∗recalli.Adjusted F1 score (F1_weighted) is the weighted average ofF1Scorei, and the weight is the proportion of each type in the true value.(13)F1weighted=∑i=1kF1Scorei∗∑j=1kaij∑i=1k∑j=1kaij.In the five indicators above, accuracy and adjusted F1 scores (F1_weighted) reflect the evaluation level of the evaluation model more holistically, while accuracy, recall, and F1 score (F1_score) do not reflect the overall picture but rather prefer the evaluation of category I.According to the test results in the above indicators of the score, we can evaluate the performance of the model objectively; the higher the score on the above indicators, the better the performance of the model.In addition, in order to show the effect of the credit evaluation model more intuitively, the ROC (receiver operating characteristic) curve is also used to evaluate the performance of the model. ROC curves are used in the evaluation of two classifications and can evaluate the relationship between model specificity and sensitivity. In the evaluation of the four-classification Softmax regression model, adaptive improvement is carried out. The improved method is to treat one class in A, B, C, and D as a positive class and the other three as a negative class, to calculate the four ROC curves, and to turn the four-classification problems into two-classification problems. During the establishment of the ROC curve, two indicators, TPR (true positive rate) and FPR (false positive rate), need to be calculated as ordinates and horizontal coordinates.(14)TPR=TPTP+FN,FPR=FPFP+TN.TP represents the sample of [predicted value = positive, real value = positive], FP represents the sample of [predicted value = positive, real value = negative], FN represents the sample of [predicted value = negative, real value = positive], and TN represents the sample of [predicted value = negative, real value = negative].AUC (area under the curve) is also used with the ROC curve to evaluate model performance. The value of AUC is the area below the ROC curve. In general, the larger the area corresponding to the AUC, the model is corresponding to a stronger classification capacity.


## 4. Experimental Validation

### 4.1. Experimental Environment

In order to test the model, it is necessary to prepare the necessary simulation environment and experimental tools, including the preparation of the blockchain environment and the programming tool of the credit evaluation algorithm. This paper chooses Ubuntu16.04 64 bits. Design is based on Hyperledger Fabric1.4. Hyperledger Fabric operates on container services provided by Docker and requires Docker and Docker-compose to be installed in the system. At the same time, many components in Hyperledger Fabric use Golang implementations, and this article also uses Golang to write smart contracts, so you need to install and set up the Golang environment in your system. Hyperledger Fabric stand-alone environment configuration is shown in Table4.Table 4
Blockchain stand-alone environment configuration.
Equipment nameEquipment environmentOSUbuntu16.04 64 bitsCPUAMD Ryzen 7 4800H with Radeon graphics 2.90 GHzRAM4 GBDocker version18.06.3Docker-compose version1.17.0Fabric-ca version1.5.1Golang versiongo1.13.10 Linux/amd64


### 4.2. Experimental Process

In this paper, six data provider nodes and one data demander node are set up in the blockchain architecture, on the basis of which the simulation of the chain and data acquisition on the credit evaluation model is carried out. Blockchain nodes in Hyperledger Fabric rely on Docker containers that provide virtualized environments, so node designs need to be performed in the node profile docker-compose-credit.yaml to map the real credit evaluation network.According to the profile to start the credit evaluation blockchain network, the number of service nodes has a total of 8, of which orderer.credit.com for blockchain transactions provides sorting services, peer0.org1.credit.com for the data demander node, data acquisition, the remaining 6 peer nodes for data provider nodes, and data upload work.At the same time, this blockchain architecture uses Fabric-ca for authentication services, and the docker-compose.yaml file also requires the configuration of ca-related information, including server name, directory, certificate name and path, key name, and path-related information.After writing the profile of the credit evaluation blockchain’s order part, peer part, ca part, and couch database, network testing is carried out by using the $\ docker-compose\ up instruction to view the status of each docker container, and if the configuration state is intact, the data demander node and the data provider node can invoke the data acquisition smart contract and data upload smart contract for data transmission.There is a lot of sensitive information and difficulty to deal directly with the original data of credit, so it is necessary to preprocess the credit data before uploading the blockchain of credit data.In order to maintain the privacy of enterprise data, upload blockchain data are hidden company name and other information, changed to 7 bit credit data ID unique identity data, each credit data corresponding to the privacy information has only local mapping storage. At the same time, in order to clarify the credit data that belong to the node, each data node upload data number in the design has a certain difference, such as peer1.org3.credit.com node uploaded data ID is 13 at the beginning, recorded as 13∗∗∗∗. Among the 24 credit indicators selected, some variables are continuous values and some variables are discrete values, and the data needs to be standardized in order to facilitate subsequent processing and training of data. If the service level product reliability under the second level indicators of the following processing, the percentage into integer data.Upload credit data to blockchain. After the data provider node preprocesseses the data, the data is transmitted in the front-end interface of the data upload, after which the data is judged to be in a format that meets the requirements, and the data is uploaded to the blockchain. When the data entry is incomplete, or the data input is out of range of the variable, or the data entry type is wrong, the front-end page prompts for an error message.Get credit data from the block chain. There are two ways to obtain credit data from blockchain network, one is to query individual data according to the credit data ID, and the other is to query according to the scope of credit ID.The results of the front-end query are displayed in a read-only scrolling text box, spaced at space intervals, for replication and processing by the data demander node. When the credit ID corresponding data entered by the ordinary query does not exist or the credit ID does not have the corresponding data in the bulk query range, “no results of this query” is returned.During data acquisition, the back-end Fabric blockchain invokes the data to get the smart contract.peer chaincode query−Cmychannel−nCreditGet−c′“Args”:getCredit”,130001”′ credit data is obtained according to CreditID. CreditID”:130001”,index1:2”,index2:3”,……,index23:1,index24:2,Rank:2Data training based on improved the Softmax regression algorithm. Based on the relevant credit data obtained from the blockchain by the data demander node peer0.org1.credit.com, it can be put into an improved Softmax regression algorithm for model training. 2,000 credit data are extracted from other nodes; each credit rating (A, B, C, and D) has the same number of samples (500) in order to prevent the impact on test results due to uneven sample distribution. After importing the credit sample into the credit evaluation model, based on the improved Softmax loss function, iteration is carried out according to the algorithmic idea of gradient drop to update the weight matrix.(15)Weightk,j=Weightk,j−α∂Loss∂wk,j.In this paper, the learning rateα is set to 0.005, and the maximum number of iterations is set to 10,000. The weight matrix is constantly updated after continuous iteration. The test data can finally be predicted based on the weight matrix. The test dataset selects a sample size of 400 and does not coincide with the 2,000 samples selected by the training set.Credit evaluation for the credit data. According to the weight matrix trained by the Softmax regression model, the sample was tested by matrix multiplication to get the score under the four credit ratings A, B, C, and D. A piece of data is selected from the test sample, and the data is converted into a matrix of 1 × 24 by using Python’s numpy.mat () function, while the weight matrix has dimensions of 24 × 4, multiplying the two matrices to get a score matrix of 1 × 4.(16)Score1×4=testdata1×24∗weight24×4.Normalization through the Softmax function makes the results intuitive. In normalized results, the result that determines the highest score is the credit rating corresponding to the sample.


### 4.3. Experiment Results

According to the coefficient weight matrix obtained by the improved Softmax regression model training, the test set is predicted, and the confusion matrix of 400 sample prediction results can be obtained; the accuracy, precision, recall rate, F1_score, and other scoring indicators of the Softmax regression model can be obtained from the confusion matrix.At the same time, in order to verify whether the improvement of normalization function and loss function in the Softmax regression algorithm has a positive effect on the final result of the model, two tests were carried out when test set testing was carried out. The samples selected for the two tests were the same; the first test used an improved Softmax regression algorithm, and the second test used an improved back-end Softmax regression algorithm.The two tests obtained their respective confusion matrix and ROC graph, which are shown in Figures3 and 4 through the confusion matrix, calculate accuracy, precision, recall rate, and other indicators. The calculation results are shown in Table 5.Figure 3
The ROC graph of the initial Softmax regression.Figure 4
The ROC graph of the improved Softmax regression.Table 5
The performance of the two regression algorithms.
Initial Softmax regressionImproved Softmax regressionAccuracy0.900.95Precision[0.95, 0.81, 0.92, 0.94][0.96, 0.91, 0.99, 0.94]Recall[0.95, 0.9, 0.82, 0.96][0.97, 0.95, 0.89, 1.0]F1_score[0.95 0.85 0.87 0.95][0.96, 0.93, 0.94, 0.97]F1_weighted0.910.95AUC[0.9852, 0.9347, 0.9118, 0.9909][0.9901, 0.9717, 0.9788, 0.9934]By comparing the confusion matrix with the ROC graph, it is found that the improved Softmax regression algorithm performs significantly better in the credit evaluation than the original Softmax regression algorithm. However, the improved Softmax regression algorithm also has some disadvantages, such as the improved algorithm requires more running time, but the time difference can be ignored with a small sample size.According to the confusion matrix and ROC curve of the improved Softmax regression algorithm, a total of 380 samples were successfully classified out of 400 test samples, the accuracy and recall rate of the four types of samples were calculated F1_weighted of 0.95, and the AUC value of the four types of curves was above 0.97. Thus, the model can predict the credit rating of enterprises according to the credit index of enterprises more accurately.


## 4.1. Experimental Environment

In order to test the model, it is necessary to prepare the necessary simulation environment and experimental tools, including the preparation of the blockchain environment and the programming tool of the credit evaluation algorithm. This paper chooses Ubuntu16.04 64 bits. Design is based on Hyperledger Fabric1.4. Hyperledger Fabric operates on container services provided by Docker and requires Docker and Docker-compose to be installed in the system. At the same time, many components in Hyperledger Fabric use Golang implementations, and this article also uses Golang to write smart contracts, so you need to install and set up the Golang environment in your system. Hyperledger Fabric stand-alone environment configuration is shown in Table4.Table 4
Blockchain stand-alone environment configuration.
Equipment nameEquipment environmentOSUbuntu16.04 64 bitsCPUAMD Ryzen 7 4800H with Radeon graphics 2.90 GHzRAM4 GBDocker version18.06.3Docker-compose version1.17.0Fabric-ca version1.5.1Golang versiongo1.13.10 Linux/amd64


## 4.2. Experimental Process

In this paper, six data provider nodes and one data demander node are set up in the blockchain architecture, on the basis of which the simulation of the chain and data acquisition on the credit evaluation model is carried out. Blockchain nodes in Hyperledger Fabric rely on Docker containers that provide virtualized environments, so node designs need to be performed in the node profile docker-compose-credit.yaml to map the real credit evaluation network.According to the profile to start the credit evaluation blockchain network, the number of service nodes has a total of 8, of which orderer.credit.com for blockchain transactions provides sorting services, peer0.org1.credit.com for the data demander node, data acquisition, the remaining 6 peer nodes for data provider nodes, and data upload work.At the same time, this blockchain architecture uses Fabric-ca for authentication services, and the docker-compose.yaml file also requires the configuration of ca-related information, including server name, directory, certificate name and path, key name, and path-related information.After writing the profile of the credit evaluation blockchain’s order part, peer part, ca part, and couch database, network testing is carried out by using the $\ docker-compose\ up instruction to view the status of each docker container, and if the configuration state is intact, the data demander node and the data provider node can invoke the data acquisition smart contract and data upload smart contract for data transmission.There is a lot of sensitive information and difficulty to deal directly with the original data of credit, so it is necessary to preprocess the credit data before uploading the blockchain of credit data.In order to maintain the privacy of enterprise data, upload blockchain data are hidden company name and other information, changed to 7 bit credit data ID unique identity data, each credit data corresponding to the privacy information has only local mapping storage. At the same time, in order to clarify the credit data that belong to the node, each data node upload data number in the design has a certain difference, such as peer1.org3.credit.com node uploaded data ID is 13 at the beginning, recorded as 13∗∗∗∗. Among the 24 credit indicators selected, some variables are continuous values and some variables are discrete values, and the data needs to be standardized in order to facilitate subsequent processing and training of data. If the service level product reliability under the second level indicators of the following processing, the percentage into integer data.Upload credit data to blockchain. After the data provider node preprocesseses the data, the data is transmitted in the front-end interface of the data upload, after which the data is judged to be in a format that meets the requirements, and the data is uploaded to the blockchain. When the data entry is incomplete, or the data input is out of range of the variable, or the data entry type is wrong, the front-end page prompts for an error message.Get credit data from the block chain. There are two ways to obtain credit data from blockchain network, one is to query individual data according to the credit data ID, and the other is to query according to the scope of credit ID.The results of the front-end query are displayed in a read-only scrolling text box, spaced at space intervals, for replication and processing by the data demander node. When the credit ID corresponding data entered by the ordinary query does not exist or the credit ID does not have the corresponding data in the bulk query range, “no results of this query” is returned.During data acquisition, the back-end Fabric blockchain invokes the data to get the smart contract.peer chaincode query−Cmychannel−nCreditGet−c′“Args”:getCredit”,130001”′ credit data is obtained according to CreditID. CreditID”:130001”,index1:2”,index2:3”,……,index23:1,index24:2,Rank:2Data training based on improved the Softmax regression algorithm. Based on the relevant credit data obtained from the blockchain by the data demander node peer0.org1.credit.com, it can be put into an improved Softmax regression algorithm for model training. 2,000 credit data are extracted from other nodes; each credit rating (A, B, C, and D) has the same number of samples (500) in order to prevent the impact on test results due to uneven sample distribution. After importing the credit sample into the credit evaluation model, based on the improved Softmax loss function, iteration is carried out according to the algorithmic idea of gradient drop to update the weight matrix.(15)Weightk,j=Weightk,j−α∂Loss∂wk,j.In this paper, the learning rateα is set to 0.005, and the maximum number of iterations is set to 10,000. The weight matrix is constantly updated after continuous iteration. The test data can finally be predicted based on the weight matrix. The test dataset selects a sample size of 400 and does not coincide with the 2,000 samples selected by the training set.Credit evaluation for the credit data. According to the weight matrix trained by the Softmax regression model, the sample was tested by matrix multiplication to get the score under the four credit ratings A, B, C, and D. A piece of data is selected from the test sample, and the data is converted into a matrix of 1 × 24 by using Python’s numpy.mat () function, while the weight matrix has dimensions of 24 × 4, multiplying the two matrices to get a score matrix of 1 × 4.(16)Score1×4=testdata1×24∗weight24×4.Normalization through the Softmax function makes the results intuitive. In normalized results, the result that determines the highest score is the credit rating corresponding to the sample.


## 4.3. Experiment Results

According to the coefficient weight matrix obtained by the improved Softmax regression model training, the test set is predicted, and the confusion matrix of 400 sample prediction results can be obtained; the accuracy, precision, recall rate, F1_score, and other scoring indicators of the Softmax regression model can be obtained from the confusion matrix.At the same time, in order to verify whether the improvement of normalization function and loss function in the Softmax regression algorithm has a positive effect on the final result of the model, two tests were carried out when test set testing was carried out. The samples selected for the two tests were the same; the first test used an improved Softmax regression algorithm, and the second test used an improved back-end Softmax regression algorithm.The two tests obtained their respective confusion matrix and ROC graph, which are shown in Figures3 and 4 through the confusion matrix, calculate accuracy, precision, recall rate, and other indicators. The calculation results are shown in Table 5.Figure 3
The ROC graph of the initial Softmax regression.Figure 4
The ROC graph of the improved Softmax regression.Table 5
The performance of the two regression algorithms.
Initial Softmax regressionImproved Softmax regressionAccuracy0.900.95Precision[0.95, 0.81, 0.92, 0.94][0.96, 0.91, 0.99, 0.94]Recall[0.95, 0.9, 0.82, 0.96][0.97, 0.95, 0.89, 1.0]F1_score[0.95 0.85 0.87 0.95][0.96, 0.93, 0.94, 0.97]F1_weighted0.910.95AUC[0.9852, 0.9347, 0.9118, 0.9909][0.9901, 0.9717, 0.9788, 0.9934]By comparing the confusion matrix with the ROC graph, it is found that the improved Softmax regression algorithm performs significantly better in the credit evaluation than the original Softmax regression algorithm. However, the improved Softmax regression algorithm also has some disadvantages, such as the improved algorithm requires more running time, but the time difference can be ignored with a small sample size.According to the confusion matrix and ROC curve of the improved Softmax regression algorithm, a total of 380 samples were successfully classified out of 400 test samples, the accuracy and recall rate of the four types of samples were calculated F1_weighted of 0.95, and the AUC value of the four types of curves was above 0.97. Thus, the model can predict the credit rating of enterprises according to the credit index of enterprises more accurately.


## 5. Conclusion

This paper studies the credit evaluation mechanism of power grid supply chain, introduces blockchain technology into credit industry, and proposes a credit evaluation mechanism based on blockchain. This paper combines the blockchain technology and the Softmax credit evaluation model, designs the data transmission mechanism between credit nodes based on the characteristics of blockchain distributed trust, improves the Softmax algorithm by normalization function and loss function, and the credit evaluation model training is carried out by the improved Softmax algorithm. In order to verify the effectiveness of the proposed mechanism, blockchain simulation was implemented by using the Fabric open-source framework, and the improved Softmax regression algorithm was tested using Python language. The experiment results show that the accuracy of credit evaluation is about 95%, which effectively realizes the credit evaluation of power supply chain enterprises. The credit evaluation mechanism proposed for Power IoT in this paper could have high potential for entity identity authentication and rating for securing mobile video communications.



---

*Source: 3842077-2022-02-14.xml*