# Financial Risk Avoidance Based on the Sensor Network and Edge Computing

Authors: Yong Yu; Xiaoguo Yin
Journal: Journal of Electrical and Computer Engineering
 (2022)

---

## Abstract

In order to improve the effect of financial risk aversion, this paper studies the financial risk aversion system combined with the edge computing method of the sensor network and proposes a sensor data anomaly detection algorithm based on the offset distance. Moreover, this paper divides the sensor data into several sliding windows according to the time series, analyzes the offset between the data object and other data in the sliding window by calculating the offset distance, and uses the abnormal level to indicate the possibility of data abnormality. In addition, this paper analyzes the single-layer linear network model for the data with high abnormal level and constructs a financial risk aversion model based on the edge computing of the sensor network. The simulation test results show that the financial risk aversion model based on sensor network and edge computing proposed in this paper meets the actual needs of financial risk analysis.


---

## Body

## 1. Introduction

As the vane of economic development, finance is the core of the modern economic system. “When the finance is alive, the economy is alive, and when the finance is stable, the economy is stable.” In recent years, China’s financial market has generally been running smoothly, the RMB exchange rate has remained relatively stable, financial supervision has been gradually strengthened, financial risks exposed in the early stage are being dealt with in a reasonable and orderly manner, and the financial sector has basically kept the bottom line of no systemic financial risks. However, under the current wave of “de-globalization,” international economic and trade frictions are becoming more and more frequent, the epidemic of COVID-19 further increases the uncertainty of global economic recovery, and the turmoil in the international financial market intensifies.From the perspective of the capital structure, the high leverage structure also has the problem of “mismatch” of assets and liabilities, which is an endogenous problem that financial institutions cannot avoid. In the cyclical fluctuations of the financial system, the problem of maturity mismatch is particularly obvious. In addition to the adverse selection and moral hazard caused by information asymmetry, the high leverage of the virtual economy will eventually lead to excessive fluctuations in the real economy that exceed expectations and lead to real economic risks. “Original Sin” II: The nature of financial contracts. The anonymity, high liquidity of financial contracts, and the nonphysical nature of the underlying contracts accelerate the transmission of risks, and the negative feedback effect of transaction frequency on risks is significantly enhanced. This relatively independent evolution and development mechanism makes it easier for finance to decouple from the real economy. The rapid development of financial derivatives under the current background of financial innovation is more likely to lead to the general information failure problem and the systemic imbalance of market risk distribution. “Original Sin” Three: The financial safety net. The financial safety net mainly includes a deposit insurance system, lender of last resort system, and government guarantee. However, the existence of such a financial safety net not only cannot fundamentally eliminate systemic risks but also leads to excessive accumulation of risks and moral hazard problems. The long-term accumulation of energy is more likely to cause systemic risks to occur.The dynamic evolution process of systemic financial risk is very complex and difficult to quantify. It can be divided into three processes: systemic financial risk accumulation, mutation, and crisis diffusion [1]. From the traditional point of view, the events that lead to the outbreak of systemic financial risk are accidental, exogenous shocks. However, more and more current research studies believe that [2], systemic financial risk is endogenous, and its serious consequences are the result of the continuous accumulation of systemic financial risk. Moreover, the event itself is not of great significance, and other events would have caused its outbreak without this accidental event. Residents increasing leverage is a necessary process in the process of macroeconomic development. It has a useful side, which can be used as a promoter and cushion for economic transformation and development under China’s new normal, but it also has its harmful side. If it is done too hastily, it is very likely to cause systemic financial risks [3].This paper studies the financial risk aversion system combined with the edge computing method of the sensor network and verifies the process of financial risk aversion with experiments.


## 2. Related Work

The research on systemic financial risk is mainly carried out from the following three aspects: one is to define systemic financial risk. Reference [4] attributes a systemic financial risk to the occurrence of a trigger event that causes multiple financial institutions to go bankrupt or even financial institutions. Risk of Systemic Collapse. Reference [5] considers the systemic financial risk as the possibility of systemic events leading to widespread collapse of the financial system. The second is to analyze the causes of systemic financial risks. On the one hand, it is the direct cause of relevant risks. Literature [6] believes that under the macroindustry background of increasing financial vulnerabilities and accumulating potential financial risks, a certain trigger event occurs. It will directly lead to systemic financial risks. Literature [7] concluded that financial opening and house price regulation will have different degrees of impact on systemic financial risks. On the other hand, there are indirect causes of risk. Reference [8] verifies the spillover effect of the banking industry’s multilayer network structure on systemic risk. Literature [9] believes that improper regulatory policies and lack of regulatory strength are important reasons for the occurrence of systemic financial risks. Reference [10] attributes the occurrence of systemic financial risk to the strong correlation between financial institutions. Literature [11] believes that the asset-side convergence of financial institutions is also an important cause of systemic financial risks. Literature [12] believes that the indirect cause of systemic financial risk lies in the homogeneity of financial behaviors of financial institutions in the industry and the similarity of financial risks. The third is the measurement and early warning of systemic financial risk. For example, literature [13] established the early warning index system of systemic financial risk in China to verify the efficiency of the early warning index system of systemic financial risk. Literature [14] established a downward and upward △CoE measurement and early warning system and found that systemic financial risk has significant risk spillover effects in the financial industry.From the research conclusions of scholars on the causes of systemic financial risk, it can be seen that financial institutions and the financial system have a significant impact on systemic financial risk. The systemic financial risk caused by the externalities of the financial market cannot be resolved through the internal procedures of financial institutions [15]. The role of financial supervision has become increasingly prominent, and regulators should pay more attention to the supervision of financial institutions and the financial system. However, from the scholars’ research on the impact of financial supervision on systemic financial risks, it is found that financial supervision has not played its due role in preventing systemic financial risks [16]. In order to prevent and resolve systemic financial risks, it is necessary to innovate the original financial supervision, and the supervision department should adjust the supervision system and structure in time according to the transfer of risk points and changes in the risk structure [17]. Literature [18] believes that due to the strong correlation of financial institutions and the fragility of financial foundations, once a trigger event occurs, it is likely to cause systemic financial risks. In order to implement the relevant instructions of the Party Central Committee, the role of financial supervision is particularly necessary. However, the current financial supervision has many shortcomings, and the low supervision efficiency is not enough to prevent systemic financial risks. impact is of great practical significance.Financial market stress refers to the level of risk pressure that the financial system bears under the conditions of uncertainty and expected losses. When the financial stress index is at an extreme level, a country is very likely to have a financial crisis [19]. Reference [20] argues that financial stress refers to information asymmetry, uncertainty in asset value or investor behavior, and increased demand for low-risk assets or high-liquidity assets. At the same time, scholars have developed indices to measure financial risks. Representative regional stress indices include Kansas City Financial Stress Index, Chicago Federal Reserve National Financial Conditions Index, etc.; global indices include Financial Stress Index, Global Financial Stress Index, etc. [21].


## 3. Sensor Network and Edge Computing Algorithms

Definition 1.
The single-source sensing data collected and transmitted by the sensor is simplified in the form of time series data in this study as follows:(1)X=x1,x2,…,xi,…,xn,1≤i≤n.
X represents a collection of single-source sensor time series and n represents how many data objects are composed of time series in this collection, that is, the length of X. xi is a data object in X, which is represented as the data value collected at a certain moment in X, which can be represented as xi=ti,vi. Among them, ti represents the time information of xi and vi represents the numerical information of xi.
According to the definition of single-source sensor time series, this paper introduces a sliding window (W) to store a segment of continuous data in X. The length of the sliding window W is set to the length.Definition 2.
A sliding window in sensor data can be represented as follows:(2)W=xp+1,xp+2,…,xp+i,…,xp+len,1≤i≤len.
Because the data in the sliding window are continuous and increase in time, after ignoring the time information, formula (3) can be simplified as follows:(3)W=vp+1,vp+2,…,vp+i,…,vp+len,1≤i≤len.
In the sliding window, we will perform the calculation of relative distance between data objects in the Euclidean distance. ForN-dimensional data P and Q, there is the following:(4)P=p1,p2,…,pi,…,pn.
Then, the Euclidean distance betweenР and Q can be represented as follows:(5)EDP,Q=p1−q12+p2−q22+⋯+p2−q22+⋯+pn−qn2,1≤i≤len.
WhenР is all one-dimensional data, formula (4) can be simplified as follows:(6)EDP,Q=p1−q1.Definition 3.
In the sliding window of sensing time series data, the Euclidean distance of any two data objects in the window is called the relative distance of the two data objects(7)EDxn,xm=vn−vm.
The offset distance between a data objectxp+n in window W and all objects in the window is as follows:(8)DISW,xp+n=1len∑i=p+1p+lenED2xp+n,xi=1len∑i=p+1p+lenvp+n−vi2.
Formula (7) draws on the squared difference formula, which reflects the relative distance between the data object xp+n in the window and each data in the sliding window W as a whole. It reflects the offset between the data object xp+n and the entire sliding window W.Definition 4.
Definition of exception. For a certain data objectx0 existing in the sliding window W, if the offset distance of x0 exceeds the offset threshold R, it is defined that the data object x0 is outlier in the window W.
The data in the sliding window are continuous time series data, so the data values in the window have time series continuity. Any two data in the sliding window have a relatively little difference in data value. Under the premise of normal data, the data offset distance within the window is within a certain range. When the offset distance of a data in the window exceeds the threshold, it means that the data are outlier and far from the overall data, and the data can be defined as the outlier value under the window. As shown in Figure1, there is a sliding window W1 with a window size of 10.
In sliding windows, a data object often belongs to multiple windows. In this paper, the concept of abnormality level is proposed, and the abnormality level is used to represent the possibility of abnormality of data objects. The initial abnormality level of data objectx0 is 0. When x0 is outlier in a certain window to which it belongs, the abnormality level of object x0 is increased by one. If the window size is p, the anomaly level of the data object x0 is at least 0 and at most p. When the abnormality level of data object x0 is p, it means that x0 is an outlier in every window in which it is located.
The offset distance formula defined above is analyzed. We assume that there is a sliding windowW of length len:(9)W=xp+1,xp+2,…,xp+n,…,xp+len,1≤n≤len.
The data objectxp+n in W is normal data in the window W, then its offset distance satisfies the following condition:(10)DISW,xp+n=1len∑i=p+1p+lenED2xp+n,xi≤R.
Formula (9) can be converted into the following:(11)DIS2W,xp+n∗len=∑i=p+1p+lenED2xp+n,xi≤R∗len.
Through the formula transformation, the calculation of offset distance is transformed into the accumulation of the relative distance squared value. Then, the definition of outlier in Definition4 is equivalent to: for a certain data object x existing in the sliding window w, if the total value of the deviation of x exceeds the upper limit of deviation, the data object x0 is defined in the window W outliers.(12)DISW,xp+n=∑i=p+1p+lenED2xp+n,xi≤Rdic.
For time series data, there must be a large number of similar data in adjacent windows, and calculating the relative distance of all data in the window is an invalid process of a large number of repeated calculations. If the size of the sliding window is len,W1, and W2 are adjacent windows, and the data object collected at time p is xp, the time series contained in the sliding window W1 can be expressed as follows:(13)W1=xp,xp+1,…,xp+t,…,xp+len−1,0≤t≤len−1.
The time series contained in the sliding windoww2 can be expressed as follows:(14)W2=xp+1,xp+2,…,xp+t,…,xp+len,1≤t≤len1.
xp+t jointly contained in W1 and W2 is taken as an example, and the total offset value t of xp+t in W1 and W2 is calculated, respectively.(15)DICW1,xp+t=ED2xp+t,xp+ED2xp+t,xp+1+⋯+ED2xp+t,xp+len−1.
By observing formulae (12) and (13), we can see that W1 and W2 have (len-2) common data, and the transition from W1 to W2 is only the departure of xp and the addition of xp+len. The total offset of xp+t in W1 and W2 is analyzed, the difference is also the departure of ED2xp+t,xp+1 and the addition of ED2xp+t,xp+len. Therefore, in the process of sliding the sliding window backward, only xp and xp+len can be processed to realize the calculation of the total offset value, and then complete the abnormality detection. The following will specifically design the algorithm of this research according to the design idea.
When anomalies in the time series data flow within the sliding window are detected, the anomalous dataset is usually only constrained by the departure of old data and the addition of new data. The departure of data will cause the total value of the offset of its successor data in the window to decrease, and false negatives may change from abnormal to normal. On the contrary, the addition of data will lead to an increase in the total offset of its predecessor data, and false positives may change from normal to abnormal.Figure 1
Outlier case within the window.


### 3.1. Parameters Used in the Algorithm Design Are Defined As Follows

X: All sensing time series data are stored (including data value, acquisition time)xer: All candidate abnormal data and related information are stored (including data value, collection time)xi: The i-th data object in X (including data value, collection time)aj: The j-th data object in the sliding window (including data value, acquisition time, total offset value, abnormal level)vj: The data value of the data object “in the sliding window.”tj: The acquisition time of the data object “in the sliding window.”len: The length of the sliding windowRdic: Offset capDICWp,aq, the total offset value of data object aq in sliding window Wp under this windowanew: The data object that is about to enter the sliding windowalast: The data object that is about to leave the sliding windowler: Abnormal level


### 3.2. Detailed Algorithm

#### 3.2.1. Sliding Window Is Initialized

The flowchart is shown in Figure2(a).Figure 2
Algorithm flow chart. (a) Window initialization flowchart. (b) Window sliding flow chart. (c) Clear window flow chart.
(a)(b)(c)When starting the algorithm, the sliding window needs to be initialized first, and the sliding window is filled with data objects to generate the first window. Because ofai=xi at this time, the total offset value of each data under the current sliding window can be directly calculated. If the total value of the offset is greater than the upper limit of the offset Rdic, the initial exception level is 1, otherwise it is 0. The content of a node (data value, acquisition time, offset total value, anomaly level) is filled into the corresponding node.


#### 3.2.2. Window Slides

The flowchart is shown in Figure2(b).When the window slides,anew and alast in it will affect the active data of all data in the next window. In order to reduce the space complexity of the algorithm, we give priority to alast processing.First, the abnormality level ofalast is judged. If the abnormality level is greater than len/2, it means that alast is an abnormal data object on the overall data, and alast is stored in Xer and then alast in the window is deleted. If the exception level is not greater than len/2, alast in the window is directly deleted.Next, data objectanew populates the window. The data value and acquisition time of anew from X are obtained. The relative distance between anew and other len-1 data objects in the window is calculated respectively, and the total value of the offset of anew under the current window is obtained. The initial abnormal level is obtained according to the relationship between the total value of the offset and the upper limit of the offset.Finally, the data objects inside the window are computed. We assume that there is a data object a inside the window, and a is neitheranew nor alast. According to the above, data objects with an anomaly level greater than half of the window size are regarded as anomalous data objects as a whole. Therefore, we first judge the abnormal level of ai. If the abnormality level is greater than lenl2, it means that q currently meets the conditions of the abnormal data object and becomes absolute abnormal data. At this time, it is not necessary to calculate the total value of the next offset for a, and it is only necessary to add X directly when ai becomes alast. On the basis of the total value of the previous sliding window offset, it subtracts ED2ai,alast and adds ED2ai,anew to get the total value of ai in the current sliding window. The offset total value of ai is updated, and it is judged whether the abnormal level of ai needs to be increased according to the latest offset total value.


#### 3.2.3. Sliding Window Is Cleared

The flowchart is shown in Figure2(c).When all data objects inX have entered the sliding window, it means entering the terminal window. At this point, each data object in the terminal window is treated as an alast-check until the amount of data in the terminal window is cleared.(1) Algorithm Performance Analysis. The main calculation content of this algorithm is the calculation of the total offset value. For the data to be detected with dimension m, the time complexity of the offset total value of adjacent windows of the same data is calculated as o(m). We assume that the size of the sliding window is W, the number of time series data to be detected is L. In the whole algorithm, only the relevant information of each data in the sliding window needs to be processed and stored, so the space complexity of the algorithm is o(w).The analysis shows that the time complexity and space complexity of this algorithm are low, and it is suitable for application in the environment of edge computing.(2) Example of Algorithm Application. This algorithm uses a sliding window to process continuous sensor data in time. By calculating the total offset value of the data object in each sliding window where it is located, possible anomalies are detected according to the anomaly level. This algorithm is used to detect the temperature data, and the detection situation of the algorithm is shown in Figure 3. Through the sliding window anomaly detection algorithm based on the offset distance, it can be detected that the sensor data have data anomalies in the three boxes in the figure.Figure 3
Anomaly detection result graph.Anomaly estimation revision refers to using the model to estimate anomalous data to revise the possible actual values, so that this series of data is in a state that tends to be true and stable. In this paper, the estimation and correction of abnormal data is realized by the method of data prediction, and the possible actual value of abnormal points is predicted according to the recent historical data. The ARMA autoregressive moving average model consists of an autoregressive model and a moving average model. It is an important method to study time series, which can achieve accurate short-term forecasting ability. The MARMA mixed autoregressive moving average model utilizes the GMTD and MAR models and makes some generalizations. This model is mainly used for nonlinear time series and can effectively approximate any complex distribution form. The Fourier series prediction model is suitable for time series data with trend changes. The original sequence is decomposed, and the corresponding prediction model is obtained through the Fourier transformation and the least square method.The prediction effects of the naive prediction model, the single-layer linear network prediction model, the nearest neighbor cluster prediction model, and the multilayer perceptron model are compared and analyzed. The research results show that the single-layer linear network can achieve ideal prediction results under the concise model representation. This study adopts a single-layer linear network as the prediction model. A single-layer linear network can be understood as a single-layer feedforward neural network with only one output node, and the output point is obtained by combining the input vector and the weight vector.(16)s=b+∑i=1nwixi.We assume that the collected data at timet + 1 can be represented by a set of p previous data. If it is assumed that there is a sliding window X1=vt−p+1,vt−p+2,…,vt−i,vt, and the p data in the sliding window X1 are used as the input of the single-layer linear network model, the collected data at time t + 1 can be expressed as follows:(17)vt+1⟶=b+∑i=0p−1wt−ivt−i.Among them,b is a constant, and w represents the weight of each node in the window. For the convenience of representation and calculation, formula (17) is represented by the weight vector W and the input vector V, which can be transformed into the following:(18)vt+1⟶=fv=b+WTV.In order to obtain a model with good prediction effects, it is necessary to adjust the constantb and the weight vector W in the model through instance training. We assume that the training set consists of m consecutive sets of data, and each set of data contains p + 1 data. In this study, the mean square error is used to represent the prediction error under the training set:(19)E=12m∑j=1mvt+1j−fVj2=12m∑j=1mvt+1j−b−WTVj2.The purpose of training and learning the model is to continuously update the weight vector and reduce the prediction error to minimize it. This study uses the delta rule to correct and update the parameters in the model. The delta rule is a typical gradient descent learning rule in machine learning, which is used to update the input weights of artificial neurons in a single-layer neural network. The delta rule obtains the partial derivative∂E/∂W of the weight vector W through E. The inverse of the obtained partial derivative value indicates the parameter update direction that makes the error attenuate the fastest under the current weight vector. If it is assumed that the initial parameter vector is W0 and the corresponding constant term is b0, after one training, the parameter vector and constant term are corrected as follows:(20)Wt=W0−η∂E∂W0,bt=b0−η∂E∂b0.In the formula,η represents the learning rate, which represents the step size of each parameter adjustment, and η∂E/∂W and η∂E/∂b represent the gradient of the correction training. By setting an appropriate learning rate, the model can reach the optimal parameters at a relatively fast speed. In general, it is often necessary to revise multiple times in a loop to make the model optimal. When each value in the gradient is less than le-5, it means that the model has reached a relatively stable state. At this time, the actual effect of iterative training will be relatively poor, so the iterative loop is terminated at this time.


## 3.1. Parameters Used in the Algorithm Design Are Defined As Follows

X: All sensing time series data are stored (including data value, acquisition time)xer: All candidate abnormal data and related information are stored (including data value, collection time)xi: The i-th data object in X (including data value, collection time)aj: The j-th data object in the sliding window (including data value, acquisition time, total offset value, abnormal level)vj: The data value of the data object “in the sliding window.”tj: The acquisition time of the data object “in the sliding window.”len: The length of the sliding windowRdic: Offset capDICWp,aq, the total offset value of data object aq in sliding window Wp under this windowanew: The data object that is about to enter the sliding windowalast: The data object that is about to leave the sliding windowler: Abnormal level


## 3.2. Detailed Algorithm

### 3.2.1. Sliding Window Is Initialized

The flowchart is shown in Figure2(a).Figure 2
Algorithm flow chart. (a) Window initialization flowchart. (b) Window sliding flow chart. (c) Clear window flow chart.
(a)(b)(c)When starting the algorithm, the sliding window needs to be initialized first, and the sliding window is filled with data objects to generate the first window. Because ofai=xi at this time, the total offset value of each data under the current sliding window can be directly calculated. If the total value of the offset is greater than the upper limit of the offset Rdic, the initial exception level is 1, otherwise it is 0. The content of a node (data value, acquisition time, offset total value, anomaly level) is filled into the corresponding node.


### 3.2.2. Window Slides

The flowchart is shown in Figure2(b).When the window slides,anew and alast in it will affect the active data of all data in the next window. In order to reduce the space complexity of the algorithm, we give priority to alast processing.First, the abnormality level ofalast is judged. If the abnormality level is greater than len/2, it means that alast is an abnormal data object on the overall data, and alast is stored in Xer and then alast in the window is deleted. If the exception level is not greater than len/2, alast in the window is directly deleted.Next, data objectanew populates the window. The data value and acquisition time of anew from X are obtained. The relative distance between anew and other len-1 data objects in the window is calculated respectively, and the total value of the offset of anew under the current window is obtained. The initial abnormal level is obtained according to the relationship between the total value of the offset and the upper limit of the offset.Finally, the data objects inside the window are computed. We assume that there is a data object a inside the window, and a is neitheranew nor alast. According to the above, data objects with an anomaly level greater than half of the window size are regarded as anomalous data objects as a whole. Therefore, we first judge the abnormal level of ai. If the abnormality level is greater than lenl2, it means that q currently meets the conditions of the abnormal data object and becomes absolute abnormal data. At this time, it is not necessary to calculate the total value of the next offset for a, and it is only necessary to add X directly when ai becomes alast. On the basis of the total value of the previous sliding window offset, it subtracts ED2ai,alast and adds ED2ai,anew to get the total value of ai in the current sliding window. The offset total value of ai is updated, and it is judged whether the abnormal level of ai needs to be increased according to the latest offset total value.


### 3.2.3. Sliding Window Is Cleared

The flowchart is shown in Figure2(c).When all data objects inX have entered the sliding window, it means entering the terminal window. At this point, each data object in the terminal window is treated as an alast-check until the amount of data in the terminal window is cleared.(1) Algorithm Performance Analysis. The main calculation content of this algorithm is the calculation of the total offset value. For the data to be detected with dimension m, the time complexity of the offset total value of adjacent windows of the same data is calculated as o(m). We assume that the size of the sliding window is W, the number of time series data to be detected is L. In the whole algorithm, only the relevant information of each data in the sliding window needs to be processed and stored, so the space complexity of the algorithm is o(w).The analysis shows that the time complexity and space complexity of this algorithm are low, and it is suitable for application in the environment of edge computing.(2) Example of Algorithm Application. This algorithm uses a sliding window to process continuous sensor data in time. By calculating the total offset value of the data object in each sliding window where it is located, possible anomalies are detected according to the anomaly level. This algorithm is used to detect the temperature data, and the detection situation of the algorithm is shown in Figure 3. Through the sliding window anomaly detection algorithm based on the offset distance, it can be detected that the sensor data have data anomalies in the three boxes in the figure.Figure 3
Anomaly detection result graph.Anomaly estimation revision refers to using the model to estimate anomalous data to revise the possible actual values, so that this series of data is in a state that tends to be true and stable. In this paper, the estimation and correction of abnormal data is realized by the method of data prediction, and the possible actual value of abnormal points is predicted according to the recent historical data. The ARMA autoregressive moving average model consists of an autoregressive model and a moving average model. It is an important method to study time series, which can achieve accurate short-term forecasting ability. The MARMA mixed autoregressive moving average model utilizes the GMTD and MAR models and makes some generalizations. This model is mainly used for nonlinear time series and can effectively approximate any complex distribution form. The Fourier series prediction model is suitable for time series data with trend changes. The original sequence is decomposed, and the corresponding prediction model is obtained through the Fourier transformation and the least square method.The prediction effects of the naive prediction model, the single-layer linear network prediction model, the nearest neighbor cluster prediction model, and the multilayer perceptron model are compared and analyzed. The research results show that the single-layer linear network can achieve ideal prediction results under the concise model representation. This study adopts a single-layer linear network as the prediction model. A single-layer linear network can be understood as a single-layer feedforward neural network with only one output node, and the output point is obtained by combining the input vector and the weight vector.(16)s=b+∑i=1nwixi.We assume that the collected data at timet + 1 can be represented by a set of p previous data. If it is assumed that there is a sliding window X1=vt−p+1,vt−p+2,…,vt−i,vt, and the p data in the sliding window X1 are used as the input of the single-layer linear network model, the collected data at time t + 1 can be expressed as follows:(17)vt+1⟶=b+∑i=0p−1wt−ivt−i.Among them,b is a constant, and w represents the weight of each node in the window. For the convenience of representation and calculation, formula (17) is represented by the weight vector W and the input vector V, which can be transformed into the following:(18)vt+1⟶=fv=b+WTV.In order to obtain a model with good prediction effects, it is necessary to adjust the constantb and the weight vector W in the model through instance training. We assume that the training set consists of m consecutive sets of data, and each set of data contains p + 1 data. In this study, the mean square error is used to represent the prediction error under the training set:(19)E=12m∑j=1mvt+1j−fVj2=12m∑j=1mvt+1j−b−WTVj2.The purpose of training and learning the model is to continuously update the weight vector and reduce the prediction error to minimize it. This study uses the delta rule to correct and update the parameters in the model. The delta rule is a typical gradient descent learning rule in machine learning, which is used to update the input weights of artificial neurons in a single-layer neural network. The delta rule obtains the partial derivative∂E/∂W of the weight vector W through E. The inverse of the obtained partial derivative value indicates the parameter update direction that makes the error attenuate the fastest under the current weight vector. If it is assumed that the initial parameter vector is W0 and the corresponding constant term is b0, after one training, the parameter vector and constant term are corrected as follows:(20)Wt=W0−η∂E∂W0,bt=b0−η∂E∂b0.In the formula,η represents the learning rate, which represents the step size of each parameter adjustment, and η∂E/∂W and η∂E/∂b represent the gradient of the correction training. By setting an appropriate learning rate, the model can reach the optimal parameters at a relatively fast speed. In general, it is often necessary to revise multiple times in a loop to make the model optimal. When each value in the gradient is less than le-5, it means that the model has reached a relatively stable state. At this time, the actual effect of iterative training will be relatively poor, so the iterative loop is terminated at this time.


## 3.2.1. Sliding Window Is Initialized

The flowchart is shown in Figure2(a).Figure 2
Algorithm flow chart. (a) Window initialization flowchart. (b) Window sliding flow chart. (c) Clear window flow chart.
(a)(b)(c)When starting the algorithm, the sliding window needs to be initialized first, and the sliding window is filled with data objects to generate the first window. Because ofai=xi at this time, the total offset value of each data under the current sliding window can be directly calculated. If the total value of the offset is greater than the upper limit of the offset Rdic, the initial exception level is 1, otherwise it is 0. The content of a node (data value, acquisition time, offset total value, anomaly level) is filled into the corresponding node.


## 3.2.2. Window Slides

The flowchart is shown in Figure2(b).When the window slides,anew and alast in it will affect the active data of all data in the next window. In order to reduce the space complexity of the algorithm, we give priority to alast processing.First, the abnormality level ofalast is judged. If the abnormality level is greater than len/2, it means that alast is an abnormal data object on the overall data, and alast is stored in Xer and then alast in the window is deleted. If the exception level is not greater than len/2, alast in the window is directly deleted.Next, data objectanew populates the window. The data value and acquisition time of anew from X are obtained. The relative distance between anew and other len-1 data objects in the window is calculated respectively, and the total value of the offset of anew under the current window is obtained. The initial abnormal level is obtained according to the relationship between the total value of the offset and the upper limit of the offset.Finally, the data objects inside the window are computed. We assume that there is a data object a inside the window, and a is neitheranew nor alast. According to the above, data objects with an anomaly level greater than half of the window size are regarded as anomalous data objects as a whole. Therefore, we first judge the abnormal level of ai. If the abnormality level is greater than lenl2, it means that q currently meets the conditions of the abnormal data object and becomes absolute abnormal data. At this time, it is not necessary to calculate the total value of the next offset for a, and it is only necessary to add X directly when ai becomes alast. On the basis of the total value of the previous sliding window offset, it subtracts ED2ai,alast and adds ED2ai,anew to get the total value of ai in the current sliding window. The offset total value of ai is updated, and it is judged whether the abnormal level of ai needs to be increased according to the latest offset total value.


## 3.2.3. Sliding Window Is Cleared

The flowchart is shown in Figure2(c).When all data objects inX have entered the sliding window, it means entering the terminal window. At this point, each data object in the terminal window is treated as an alast-check until the amount of data in the terminal window is cleared.(1) Algorithm Performance Analysis. The main calculation content of this algorithm is the calculation of the total offset value. For the data to be detected with dimension m, the time complexity of the offset total value of adjacent windows of the same data is calculated as o(m). We assume that the size of the sliding window is W, the number of time series data to be detected is L. In the whole algorithm, only the relevant information of each data in the sliding window needs to be processed and stored, so the space complexity of the algorithm is o(w).The analysis shows that the time complexity and space complexity of this algorithm are low, and it is suitable for application in the environment of edge computing.(2) Example of Algorithm Application. This algorithm uses a sliding window to process continuous sensor data in time. By calculating the total offset value of the data object in each sliding window where it is located, possible anomalies are detected according to the anomaly level. This algorithm is used to detect the temperature data, and the detection situation of the algorithm is shown in Figure 3. Through the sliding window anomaly detection algorithm based on the offset distance, it can be detected that the sensor data have data anomalies in the three boxes in the figure.Figure 3
Anomaly detection result graph.Anomaly estimation revision refers to using the model to estimate anomalous data to revise the possible actual values, so that this series of data is in a state that tends to be true and stable. In this paper, the estimation and correction of abnormal data is realized by the method of data prediction, and the possible actual value of abnormal points is predicted according to the recent historical data. The ARMA autoregressive moving average model consists of an autoregressive model and a moving average model. It is an important method to study time series, which can achieve accurate short-term forecasting ability. The MARMA mixed autoregressive moving average model utilizes the GMTD and MAR models and makes some generalizations. This model is mainly used for nonlinear time series and can effectively approximate any complex distribution form. The Fourier series prediction model is suitable for time series data with trend changes. The original sequence is decomposed, and the corresponding prediction model is obtained through the Fourier transformation and the least square method.The prediction effects of the naive prediction model, the single-layer linear network prediction model, the nearest neighbor cluster prediction model, and the multilayer perceptron model are compared and analyzed. The research results show that the single-layer linear network can achieve ideal prediction results under the concise model representation. This study adopts a single-layer linear network as the prediction model. A single-layer linear network can be understood as a single-layer feedforward neural network with only one output node, and the output point is obtained by combining the input vector and the weight vector.(16)s=b+∑i=1nwixi.We assume that the collected data at timet + 1 can be represented by a set of p previous data. If it is assumed that there is a sliding window X1=vt−p+1,vt−p+2,…,vt−i,vt, and the p data in the sliding window X1 are used as the input of the single-layer linear network model, the collected data at time t + 1 can be expressed as follows:(17)vt+1⟶=b+∑i=0p−1wt−ivt−i.Among them,b is a constant, and w represents the weight of each node in the window. For the convenience of representation and calculation, formula (17) is represented by the weight vector W and the input vector V, which can be transformed into the following:(18)vt+1⟶=fv=b+WTV.In order to obtain a model with good prediction effects, it is necessary to adjust the constantb and the weight vector W in the model through instance training. We assume that the training set consists of m consecutive sets of data, and each set of data contains p + 1 data. In this study, the mean square error is used to represent the prediction error under the training set:(19)E=12m∑j=1mvt+1j−fVj2=12m∑j=1mvt+1j−b−WTVj2.The purpose of training and learning the model is to continuously update the weight vector and reduce the prediction error to minimize it. This study uses the delta rule to correct and update the parameters in the model. The delta rule is a typical gradient descent learning rule in machine learning, which is used to update the input weights of artificial neurons in a single-layer neural network. The delta rule obtains the partial derivative∂E/∂W of the weight vector W through E. The inverse of the obtained partial derivative value indicates the parameter update direction that makes the error attenuate the fastest under the current weight vector. If it is assumed that the initial parameter vector is W0 and the corresponding constant term is b0, after one training, the parameter vector and constant term are corrected as follows:(20)Wt=W0−η∂E∂W0,bt=b0−η∂E∂b0.In the formula,η represents the learning rate, which represents the step size of each parameter adjustment, and η∂E/∂W and η∂E/∂b represent the gradient of the correction training. By setting an appropriate learning rate, the model can reach the optimal parameters at a relatively fast speed. In general, it is often necessary to revise multiple times in a loop to make the model optimal. When each value in the gradient is less than le-5, it means that the model has reached a relatively stable state. At this time, the actual effect of iterative training will be relatively poor, so the iterative loop is terminated at this time.


## 4. Financial Risk Avoidance Based on the Sensor Network and Edge Computing

In this paper, the research on the financial risk aversion system is carried out by combining the sensor network and edge computing. The interaction process of the two modules in the system model diagram is shown in Figure4.Figure 4
Flowchart of the interaction between the intelligent terminal and the edge server.As shown in Figure5, the data layer generally gives the data record type and data structure of the blockchain-data records are also called transactions. These transactions are evidence of specific interactions between nodes that occurred at specific times. For example, transactions in Bitcoin record the transfer of funds. From a data structure perspective, a typical blockchain represented by Bitcoin is a series of continuously growing linked lists of blocks containing transactions. As shown in (a) of Figure 6, a block usually consists of a block header and a block body containing a series of transactions. At the same time, each block contains a new set of transactions and the hash of the previous block, allowing the current block to be linked to the previous block. The design of hashes and timestamps makes it difficult to modify records because each block depends on the previous block and the current time. The new data structure is shown in Figure 6(b), the blockchain based on the DAG structure eliminates the concept of blocks. In this way, each transaction is a single node linked in the distributed ledger, and these nodes are not bound by a single main chain, and the relationship between them is like an entangled web.Figure 5
Blockchain framework.Figure 6
Blockchain data structure. (a) Chained structure blockchain. (b) Directed acyclic graph structure blockchain.
(a)(b)For different application scenarios, blockchain technology can also be combined with emerging cloud computing, fog computing, edge computing, and other technologies to make a prospect, as shown in Figure7. In the application scenarios combined with these technologies, the optimal allocation of computing resources is also an important part of the research. The reasonable resource optimization management strategy in the blockchain network system helps to improve the operating efficiency of the system and the utilization efficiency of computing resources.Figure 7
Combination of blockchain and new technologies.After the above model is constructed, the effect of the financial risk aversion model based on sensors and edge computing proposed in this paper is verified, and the risk identification and risk aversion effects of the system model in this paper are verified, and the results shown in Tables1 and 2 are obtained.Table 1
Risk identification effect of the financial risk aversion model based on sensor and edge computing.
NumberRisk identificationNumberRisk identificationNumberRisk identification177.941971.583777.72270.092082.033876.15374.552183.593979.62479.412274.944073.88573.652373.634184.11678.972474.374285.06779.492579.304377.09871.392672.794470.78979.122771.874582.501071.622875.344672.491170.322982.374771.681278.553072.704873.711378.633177.754980.041477.513274.585073.511572.543385.615179.961671.643474.545279.171781.493574.085381.581874.303673.235475.94Table 2
Risk aversion effect of the financial risk aversion model based on sensor and edge computing.
NumberRisk aversionNumberRisk aversionNumberRisk aversion177.311971.273771.16273.872072.723879.89373.182170.623978.77468.422272.774079.06580.322366.634178.04665.952480.364273.30777.272566.724368.60862.652672.974471.79966.272765.934568.611067.662880.654668.411178.782965.554776.521279.023068.484865.361363.083173.484979.381475.553275.185077.371574.413363.105177.271664.253474.895279.521764.603568.195371.191864.103668.415478.01It can be seen from the above research that the financial risk aversion model based on sensor edge computing proposed in this paper meets the actual needs of financial risk analysis.


## 5. Conclusion

The financial system has specific functions and a highly leveraged structure. By promoting the centralized transformation of savings into investment, the financial system guides the flow and cost of monetary funds and determines the allocation structure of financial resources. In essence, the financial system functions as a credit intermediary, assuming both the risk of monetary capital operation and the risk of adverse changes in the external real economy. At present, the downward pressure on the economy continues to increase, the undigested early debt and credit risks still have the possibility of rebounding, and the intertwined and superimposed domestic and foreign unfavorable factors have brought many difficulties and challenges to China’s financial risk prevention and control. This paper studies the financial risk aversion system based on the edge computing method of the sensor network. The simulation test results show that the financial risk aversion model based on sensor edge computing proposed in this paper meets the actual needs of financial risk analysis.



---

*Source: 2028155-2022-05-24.xml*