A financial risk prediction method and system based on dynamic time warping
Patent Information
- Application Number
- CN202610936915.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-10-30
AI Technical Summary
[0006]本发明旨在克服现有财务风险预测技术忽视指标联动、时序对齐适应性差、无法溯源的缺陷,通过优化动态时间规整算法,结合财务指标联动特征与自适应带宽机制,实现企业财务风险等级判定,并定位风险发生节点,提升预测精度与实用价值
1.本发明的基于动态时间规整的财务风险预测方法,通过提取多期财务指标时间序列并计算不同指标间的联动梯度,融合两类数据构建多维联合特征序列。该方法不再单独依托单一财务指标开展分析,将财务指标的数值变化与指标之间的协同联动规律纳入分析范围,完整保留财务数据在连续报告期内的动态特征。传统分析模式往往割裂各财务指标的内在关联,难以察觉指标联动异常引发的潜在风险,而本方法依托联动梯度量化指标间的滞后变化关系,让后续的序列比对与风险分析能够基于更全面的特征数据开展,保证基础分析数据贴合企业财务运行的实际状态,为后续风险判断打下扎实的数据基础。
Smart Images

Figure CN123015180A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of financial risk prediction technology, and more specifically, relates to a financial risk prediction method and system based on dynamic time warping. Background Technology
[0002] In today's rapidly developing economy, the business environment is becoming increasingly complex. Market fluctuations, supply chain changes, and industry competition, among other factors, are constantly exacerbating the uncertainty of corporate financial situations, significantly increasing the concealment and suddenness of financial risks. Conducting financial risk forecasting is not only a core element for stable business operations and crisis avoidance, but it also provides crucial information for investment and financing decisions, regulatory oversight, and other tasks, possessing extremely high practical application value.
[0003] Current mainstream methods for assessing financial risk still have many shortcomings. Traditional analytical methods often rely on single static financial indicators for assessment, focusing only on the performance of individual data points at specific points in time, neglecting the synergistic changes and lagged correlations between different financial indicators. This makes it difficult to capture hidden risks caused by imbalances in indicator linkages, resulting in a significant lag in risk identification. Furthermore, traditional linear statistical models cannot adapt to the non-linear evolution of financial data. When faced with data fluctuations caused by sudden changes in the market environment, prediction results are prone to bias and fail to accurately reflect the dynamic trends of a company's financial situation.
[0004] While dynamic time warping algorithms are well-suited for time-series data comparison and are increasingly being applied in financial time-series analysis, existing solutions still have significant drawbacks. Most of these solutions use fixed search bandwidth for sequence alignment, making it impossible to flexibly adjust constraints based on the fluctuations in financial data. They are susceptible to outliers during periods of sharp data volatility, and limit reasonable time-series offset matching during periods of stable data. Furthermore, conventional algorithms only consider numerical differences in data, neglecting the co-evolutionary characteristics between indicators, which can easily lead to ineffective alignment and, in some scenarios, path breaks, further reducing prediction reliability.
[0005] At the same time, existing risk prediction systems generally lack risk tracing capabilities, only able to output risk assessment results but unable to pinpoint the specific time points when risks occur, making it difficult for enterprises to conduct targeted risk investigations and rectifications. Faced with today's complex and ever-changing financial time-series data and diverse risk scenarios, the industry urgently needs a new financial risk prediction solution that can take into account the linkage between indicators, adapt to data fluctuations, ensure the stability of time-series alignment, and simultaneously achieve risk tracing. Summary of the Invention
[0006] This invention aims to overcome the shortcomings of existing financial risk prediction technologies, such as neglecting indicator linkage, poor time-series alignment adaptability, and lack of traceability. By optimizing the dynamic time warping algorithm and combining the linkage characteristics of financial indicators with an adaptive bandwidth mechanism, it can determine the level of corporate financial risk and locate the risk occurrence node, thereby improving prediction accuracy and practical value.
[0007] To address the aforementioned deficiencies or improvement needs of existing technologies, as a first aspect of this invention, the present invention provides a financial risk prediction method based on dynamic time warping, comprising: S1. Extract the time series of financial indicators of the target company in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; generate a multi-dimensional joint feature sequence based on the time series of financial indicators and the linkage gradient; S2. Construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; S3. Calculate the volatility of the financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of the financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library to obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. S4. Based on the comprehensive similarity, filter the nearest template set from the template library. Based on the financial risk labels pre-associated with each template sequence in the nearest template set, determine the financial risk prediction level of the target enterprise. Extract the abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest template set, and map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence to generate and output the prediction result containing risk level and time traceability information.
[0008] Furthermore, in S1, calculating the correlation gradient between different financial indicators within adjacent financial reporting periods includes: For any two different financial indicators, calculate the change in the indicator between the current financial reporting period and the previous financial reporting period. Construct a sliding window containing a preset time lag order, and calculate the lagged cross-covariance sequence of the changes in two financial indicators within the sliding window; The time lag order corresponding to the element with the largest absolute value in the lagged covariance sequence is extracted and used as the linkage gradient between the two different financial indicators.
[0009] Furthermore, the construction of the sliding window containing a preset time lag order specifically includes: Calculate the sample mean and sample variance of the time series of the financial indicators; for each preset lag order, calculate the autocovariance between the time series of the financial indicators and its own series after shifting by the lag order. Divide the autocovariance by the sample variance to obtain the autocorrelation function value under the corresponding lag order, so as to obtain the autocorrelation function of the financial indicator time series; Extract the lag order of the autocorrelation function when the function value first changes from positive to negative, and use the lag order as the length of the sliding window; Generate a set of corresponding lag orders based on the length of the sliding window; traverse the set of lag orders, calculate the cross-correlation function values of the changes in the two financial indicators at each lag order, and use the sequence of the cross-correlation function values as the lag cross-covariance sequence.
[0010] Furthermore, in S2, the elements of the local cost matrix are composed of the feature numerical distance and the co-evolution penalty term, and the specific calculation formula is as follows: in, The first in the local cost matrix Line 1 The element values of the column; and These are the multidimensional joint feature vectors of the target enterprise sequence and the template sequence at corresponding time points; The feature is the numerical distance function; and This is the corresponding linkage gradient vector; For the penalty weighting coefficient, This is the gradient difference amplification factor.
[0011] Furthermore, in step S3, dynamically adjusting the search bandwidth of the regularization path based on the volatility of the financial indicators to generate adaptive local bandwidth constraints includes: Calculate the variance of the financial indicators of the target enterprise sequence and the template sequence within a local time window, and use it as the volatility of the financial indicators. Calculate the local search bandwidth radius based on the volatility of the aforementioned financial indicators. The calculation formula is: in, and These are the preset global maximum and minimum bandwidth radii, respectively. The volatility of financial indicators for the current time window. and The maximum and minimum volatility in the sequence; the calculated values will be used to determine the maximum and minimum volatility. This serves as an adaptive local bandwidth constraint for the current time point.
[0012] Furthermore, in S3, when solving for the globally optimal regularized path, a path connectivity repair mechanism is introduced: In the process of solving the cumulative cost matrix using dynamic programming, if the current node If there is no valid predecessor node within its adaptive local bandwidth constraint range, then connectivity repair is triggered; The connectivity restoration includes: temporarily disconnecting the current node. Given the local bandwidth constraint, the system searches for the legal predecessor node with the minimum cumulative cost within a preset extended search radius and adds that predecessor node to the current node. The path segment is marked as a forced alignment path segment.
[0013] Furthermore, in step S4, determining the financial risk prediction level of the target enterprise specifically includes: All financial templates in the template library are sorted in ascending order according to their overall similarity to the target enterprise sequence to obtain a similarity ranking sequence; A predetermined number of financial templates are selected from the similarity ranking sequence to construct the nearest neighbor template set; Count the frequency of occurrence of each known financial risk level in the nearest neighbor template set; The known financial risk level that appears most frequently is used as the predicted financial risk level of the target company.
[0014] Further, in step S4, extracting outlier nodes from the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest neighbor template set, and mapping the outlier nodes to the time axis corresponding to the multidimensional joint feature sequence, includes: Calculate the mean and standard deviation of the local cost values of each node on the globally optimal regularized path; Nodes whose local cost is greater than the sum of the mean and a preset multiple of the standard deviation are identified as abnormal nodes. Extract the time index corresponding to the abnormal node in the multidimensional joint feature sequence, and map the time index to the time axis to generate the time tracing information.
[0015] As a second aspect of the present invention, a financial risk prediction system based on dynamic time warping is also provided, comprising: A multidimensional joint feature sequence construction unit is used to extract the time series of financial indicators of a target enterprise in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; and generate a multidimensional joint feature sequence based on the time series of financial indicators and the linkage gradient. The local cost matrix calculation unit is used to construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; The optimal regularization path solving unit is used to calculate the volatility of financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library, and obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. The risk prediction unit is used to filter a set of nearest-neighbor templates from the template library based on the comprehensive similarity, determine the financial risk prediction level of the target enterprise based on the financial risk labels pre-associated with each template sequence in the set of nearest-neighbor templates, extract abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the set of nearest-neighbor templates, map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence, generate a prediction result containing risk level and time traceability information, and output it.
[0016] As a third aspect of the invention, a computer-readable storage medium is also provided, on which a computer program is stored, which is executed by a processor, according to any one of the claims, a financial risk prediction method based on dynamic time warping.
[0017] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: 1. The financial risk prediction method based on dynamic time warping of this invention extracts time series of financial indicators from multiple periods and calculates the linkage gradient between different indicators, fusing the two types of data to construct a multi-dimensional joint feature sequence. This method no longer relies on a single financial indicator for analysis, but incorporates the numerical changes of financial indicators and the synergistic linkage patterns between indicators into the analysis scope, fully preserving the dynamic characteristics of financial data within a continuous reporting period. Traditional analysis models often sever the inherent connections between various financial indicators, making it difficult to detect potential risks caused by abnormal indicator linkages. However, this method relies on linkage gradients to quantify the lagged changes between indicators, allowing subsequent sequence comparisons and risk analyses to be conducted based on more comprehensive feature data. This ensures that the basic analysis data closely reflects the actual state of the company's financial operations, laying a solid data foundation for subsequent risk assessment.
[0018] 2. The financial risk prediction method based on dynamic time warping of this invention constructs a template library of historical enterprise feature sequences with risk labels, builds a local cost matrix by combining feature numerical distance and linkage gradient differences, and introduces a co-evolution penalty term to participate in cost calculation. This method, when measuring the differences between two sets of sequences, simultaneously considers the deviation of feature numerical deviations and the deviation of indicator linkage states, correcting the problem of traditional cost calculation focusing only on numerical differences. Relying on unified cost calculation rules to quantify the differences between the target sequence and each template sequence, it can objectively reflect the degree of matching between the target enterprise's financial characteristics and different risk samples, making the comparison results between sequences more consistent with the characteristics of financial data co-evolution, reducing comparison errors caused by ignoring indicator linkage relationships, and improving the objectivity of sequence matching results.
[0019] 3. The financial risk prediction method based on dynamic time warping of this invention sets adaptive local bandwidth constraints based on the volatility of financial indicators, solves the globally optimal warping path by combining the local cost matrix, selects nearest neighbor templates based on comprehensive similarity to determine the risk level, and extracts abnormal nodes based on the warped path to complete time source tracing. The adaptive bandwidth can adjust the search range according to the data fluctuation state to ensure the stable operation of the time alignment process, and the comprehensive similarity obtained from the path solution can intuitively reflect the degree of sequence similarity. The risk level is determined based on the nearest neighbor template labels, and the time nodes corresponding to anomalies are located. Based on the completion of financial risk prediction, source tracing information is supplemented. The entire process stably realizes the determination and anomaly location of enterprise financial risks, meeting the basic usage requirements of financial risk assessment. Attached Figure Description
[0020] Figure 1 This is a flowchart of a financial risk prediction method based on dynamic time warping, according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the system units in an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0022] Example 1 Please refer to Figure 1 This embodiment 1 provides a financial risk prediction method based on dynamic time warping, including: S1. Extract the time series of financial indicators of the target company in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; generate a multi-dimensional joint feature sequence based on the time series of financial indicators and the linkage gradient; S2. Construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; S3. Calculate the volatility of the financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of the financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library to obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. S4. Based on the comprehensive similarity, filter the nearest template set from the template library. Based on the financial risk labels pre-associated with each template sequence in the nearest template set, determine the financial risk prediction level of the target enterprise. Extract the abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest template set, and map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence to generate and output the prediction result containing risk level and time traceability information.
[0023] This embodiment 1 further elaborates on the above steps.
[0024] (1) Construction of multidimensional joint feature sequences In the initial stage of constructing a multidimensional joint feature sequence, it is necessary to obtain the target company's basic financial data in the continuous time dimension. First, set the... Each financial reporting period is expressed as , No. Each financial indicator is expressed as Based on this, the original observation data of various financial indicators of the target company in each financial reporting period are extracted. For the first... Several financial indicators were used to construct a time series of their observations across all financial reporting periods. ,in Representing the The financial indicator in the first Specific figures for each financial reporting period This represents the total for the financial reporting period.
[0025] Obtain the basic time series Subsequently, to explore the dynamic impact relationships between different financial dimensions, it is necessary to calculate the linkage gradient between different financial indicators within adjacent financial reporting periods. Two different financial indicators are selected and denoted as the [missing information - likely a specific financial indicator or indicator]. Financial Indicators and the Financial Indicators To eliminate dimensions and capture trends, the changes in these two financial indicators were calculated separately for the current financial reporting period and the previous financial reporting period. The change in each financial indicator is denoted as... , representing the The financial indicator in the first Compared to the first financial reporting period The numerical increment for each financial reporting period; similarly, the... The change in each financial indicator is denoted as... , representing the The increase in the value of a financial indicator between two adjacent financial reporting periods.
[0026] To measure the lagged correlation between the aforementioned changes, a sliding window with a preset time lag order needs to be constructed. This process relies on the statistical characteristics of the financial indicator time series itself. For the [specific example]... For each financial indicator time series, calculate its sample mean. This represents the arithmetic mean of the financial indicator over all financial reporting periods; its sample variance is also calculated. This represents the degree of dispersion of the financial indicator value around the sample mean. The time lag order is set to... For each preset Calculate the autocovariance between the time series of financial indicators and its own time series shifted by the specified lag order. This reflects the sequence at intervals of The degree of linear correlation at each reporting period. Dividing the autocovariance by the sample variance yields the autocorrelation function value at the corresponding lag order. traverse all possible This allows us to obtain the complete autocorrelation function. From the autocorrelation function, we extract the time lag order corresponding to the first change of the function value from positive to negative, and denote this as the length of the sliding window. This length characterizes the first The effective decay boundary of the memory effect of a financial indicator itself.
[0027] Once the boundaries of the sliding window are determined, the cross-correlation characteristics between the changes in two financial indicators can be calculated within a defined range. This is based on the length of the sliding window. Generate the corresponding set of lag orders Iterate through each element in the set of lag orders. Calculate the cross-correlation function values of the changes in the two financial indicators at each lag order. ,in and Representing the first The and the first The sample mean of the series of changes in financial indicators is used. All calculated cross-correlation function values are arranged in ascending order of lag order; this sequence is the lagged cross-covariance series. In this series, the time lag order corresponding to the element with the largest absolute value is extracted and taken as the lagged order. The first financial indicator and the first The correlation gradient between financial indicators This variable quantifies the number of financial reporting periods required for the former to have the greatest impact on the latter.
[0028] After completing the calculation of the correlation gradient between all pairwise financial indicators, the time series of the financial indicators will be... With all calculated linkage gradients By splicing and aligning the data along the time and feature dimensions, a multidimensional joint feature sequence is constructed that includes the original financial values and the dynamic lag effects between indicators. .
[0029] (2) Calculation of local cost matrix To provide historical benchmark data for comparison, a template library containing multidimensional joint feature sequences of historical enterprises with known risk level labels needs to be constructed. First, time series of financial indicators from multiple historical enterprises within consecutive financial reporting periods are collected. Using the same data processing logic as the target enterprise, the correlation gradient between different financial indicators in adjacent financial reporting periods is calculated, thereby generating multidimensional joint feature sequences for each historical enterprise. Based on the actual financial situation of each historical enterprise in subsequent operating cycles, a clear risk level label is assigned to its corresponding multidimensional joint feature sequence. All labeled multidimensional joint feature sequences of historical enterprises are aggregated and stored, thus forming a template library containing multidimensional joint feature sequences of historical enterprises with known risk level labels.
[0030] After establishing the comparison benchmark, the differences between the target company sequence and each template sequence are calculated point by point. The total number of time points contained in the multidimensional joint feature sequence of the target company is set to the target sequence length, and the total number of time points contained in any template sequence in the template library is set to the template sequence length; the time point index of the target company sequence is set to... The time point index of the template sequence is The target company sequence is in the first... The multidimensional joint feature vector at each time point is denoted as . The template sequence is in the first... The multidimensional joint feature vector at each time point is denoted as . Simultaneously, the linkage gradient information corresponding to these two feature vectors is extracted, and the target enterprise sequence is placed in the first position. The corresponding linkage gradient vector at each time point is denoted as . The template sequence is in the first... The corresponding linkage gradient vector at each time point is denoted as . .
[0031] Once the feature vectors and gradient vectors at each time point are defined, the local cost matrix between the target company's multidimensional joint feature sequence and each template sequence in the template library can be calculated by quantifying the feature differences and gradient differences. This local cost matrix measures the local matching cost when two sequences are aligned at different time points; its elements are composed of the feature numerical distance and a co-evolution penalty term. The feature numerical distance measures the absolute difference between the two multidimensional joint feature vectors in the numerical space and is denoted as the feature numerical distance function. The co-evolutionary penalty term is determined based on the difference in the linkage gradients of the two sequences at corresponding time points, and is used to penalize alignment issues arising from inconsistent dynamic evolution trends of financial indicators. The local cost matrix contains the term... Line 1 The element values of a column are denoted as The specific calculation formula is as follows: In this formula, This represents the absolute difference between two linked gradient vectors. This is the gradient difference amplification factor, used to control the degree to which the linkage gradient difference amplifies the exponential term; This is the penalty weighting coefficient, used to adjust the proportion of the co-evolution penalty term in the overall cost value; and These are all hyperparameters and can be calibrated using the mesh method; This represents an exponential function with the natural constant as its base. Iterates through all possible... and The matrix elements are combined, calculated and filled one by one, and finally a complete local cost matrix is generated.
[0032] (3) Solving for the optimal regular path After obtaining the target company sequence representing the financial status of the target companies and the template sequence representing the standard financial health status, the variances of the financial indicators of the target company sequence and the template sequence within a local time window are calculated based on the constructed multidimensional joint feature sequence. This local time window is centered on the current time point and has a preset fixed length. This continuous time segment approach, using local slicing, effectively captures the dispersion and abrupt changes in financial data within a specific period. The volatility of financial indicators within the current time window... The specific calculation process is as follows: In the above calculation process, The preset fixed length of the local time window, For the multidimensional joint feature sequence within the local time window, the first... Feature values at each time point This is the arithmetic mean of all feature values within this local time window. This is a floor function. After traversing the entire time series, the maximum value of the volatility of financial indicators corresponding to all time windows is defined as the maximum volatility in the series. The minimum volatility among all financial indicators is extracted and defined as the minimum volatility in the sequence. .
[0033] The search bandwidth of the normalized path is dynamically adjusted based on the obtained financial indicator volatility to generate adaptive local bandwidth constraints. The specific adjustment process calculates the local search bandwidth radius using the following formula. : In the formula, The preset global maximum bandwidth radius represents the maximum allowed time alignment offset; The preset global minimum bandwidth radius represents the minimum allowed time alignment offset. This represents the volatility of financial indicators within the current time window. The maximum volatility in the sequence; The minimum volatility in the sequence; This is the adaptive local bandwidth constraint calculated for the current time point. Through this linear mapping, the search bandwidth can be automatically narrowed when financial indicators fluctuate drastically to limit excessive distortion of the time series and suppress alignment bias caused by outliers, while the search bandwidth can be widened when financial indicators are stable to allow for reasonable time offsets.
[0034] After generating adaptive local bandwidth constraints, the Euclidean distance between the feature vectors of the target enterprise sequence and the template sequence at each time point is calculated to construct the local cost matrix. Any element in the local cost matrix... The calculation formula is: in, For the time index of the target enterprise sequence. The time index of the template sequence. The feature dimension of the multidimensional joint feature sequence. For the target enterprise sequence in time index The first 3D eigenvalues For template sequences in time index The first The eigenvalues are calculated. Based on this local cost matrix, the cumulative cost matrix is solved using a dynamic programming algorithm. The recursive relationship for its state transition is as follows: In the above recursive relation, For the current node The accumulated value of life The local value of the current node. To find a valid predecessor node that satisfies the conditions of monotonicity and continuity. Subject to adaptive local bandwidth constraints A strictly limited set of predecessor nodes for search.
[0035] In the process of solving the cumulative cost matrix, if the current node Its adaptive local bandwidth constraint There are no valid predecessor nodes within the range that satisfy the transition conditions; that is, the predecessor node search set is not defined. If the set is empty, a path break is determined, and the path connectivity repair mechanism is immediately triggered. The specific execution process of this mechanism is as follows: temporarily disconnect the current node. Adaptive local bandwidth constraint Instead of limiting the search area, it expands the search radius by setting a preset range. Expand the search scope, including Within this expanded search radius, a new valid predecessor node that satisfies the monotonicity and continuity conditions and minimizes the cumulative cost is searched. Once this valid predecessor node is found, it is not only used as the current node. The source of the state transition will also be the predecessor node to the current node. The path segments between them are marked as forced alignment path segments.
[0036] After solving the entire cumulative cost matrix and fixing the necessary path connectivity, start from the endpoint node of the cumulative cost matrix. Begin by backtracking along the pointers to the predecessor nodes of the records until the starting node is reached. This allows us to obtain the complete globally optimal regularized path, where... The total time length of the target enterprise sequence. The total time length of the template sequence is given. The local cost values corresponding to all nodes on the globally optimal normalized path are accumulated and normalized to obtain the comprehensive cost value. The specific calculation formula is as follows: In the above formula, This represents the total path length of the globally optimal regularized path, which is the total number of nodes contained in the path. The node number on the path. The first one on the globally optimal regularized path 1 node This represents the local cost value corresponding to this node. The total cost value is... The overall deviation between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library was objectively quantified. The smaller the value, the higher the similarity between the sequences, and the larger the value, the more serious the deviation between the sequences.
[0037] To unify the semantic direction of the evaluation indicators and ensure that the final indicators conform to the intuitive logic that "the larger the value, the more similar the similarity," after obtaining the comprehensive cost value set of the target company and all template sequences in the template library, the relative position percentage is calculated based on the ascending ranking of the comprehensive cost value. Convert to comprehensive similarity The specific conversion process is achieved through the following formula: In the above calculation process, The range of values for the transformed comprehensive similarity is strictly limited to [value range missing]. between; The current template sequence is ranked in ascending order within the comprehensive generation value set (i.e., the smaller the comprehensive generation value, the higher the ranking). This represents the total number of template sequences in the template library. When multiple template sequences have the same comprehensive cost value, the timestamp of the template sequence's entry into the library is used as a secondary sorting criterion to ensure that the ranking of all template sequences is strictly unique.
[0038] (4) Risk prediction After obtaining the comprehensive similarity between the target company and all template sequences in the template library, a nearest neighbor matching mechanism is needed to determine the financial risk prediction level of the target company. The total number of financial templates in the template library is set to the total number of templates. All financial templates in the template library are sorted in ascending order according to the comprehensive cost value corresponding to their comprehensive similarity to the target company's sequence, thus obtaining a similarity ranking sequence. This ascending order based on comprehensive cost value ensures that the financial template most similar to the target company is placed at the beginning of the sequence. A preset number of nearest neighbors is set. This variable represents the number of nearest-neighbor financial templates used for voting. The template at the top of the similarity ranking sequence is selected. Each financial template is used to construct a nearest neighbor template set. The total number of known financial risk levels in the nearest neighbor template set is defined as the number of risk level types, and the... The known financial risk level is Statistically analyze the known financial risk levels in the nearest neighbor template set. The frequency of occurrence of is denoted as . The corresponding frequency will be... Maximum known financial risk level As a measure of the financial risk level of the target company.
[0039] After determining the overall risk prediction level of the target company, it is necessary to further pinpoint the specific time points that led to the financial risk. This requires extracting abnormal features from the globally optimal regularization path. Let the total number of nodes on the globally optimal regularization path between any template sequence in the nearest neighbor template set and the target company sequence be denoted as the total number of path nodes, and let the node indices on the path be denoted as . The globally optimal normalized path is the first... The local cost corresponding to each node is denoted as . Calculate the mean of the local costs of all nodes on the globally optimal regularized path. ,in The total number of path nodes; simultaneously calculate the standard deviation of these local costs. Set the preset multiplier to... This variable controls the sensitivity threshold for anomaly detection. It assigns local cost... Greater than the mean With preset multiple and standard deviation The nodes that satisfy the sum of the products are... Nodes that meet the conditions are identified as abnormal nodes. These nodes represent alignment positions where the target company and its neighboring financial templates deviate significantly from each other in the evolution of local financial characteristics.
[0040] To transform the extracted anomaly nodes into time-based traceability information with practical business guidance significance, it is necessary to map the path nodes back to the original time dimension. The time index of the target enterprise sequence corresponding to the anomaly node in the globally optimal normalized path is set as follows: This time index directly corresponds to a specific financial reporting period in the target company's multidimensional joint feature sequence. Extract the time index corresponding to all anomaly nodes. These time indices are then mapped onto the time axis corresponding to the multidimensional joint feature sequence in chronological order, thereby generating prediction results that include risk level and time-based information.
[0041] Example 2 Please refer to Figure 2 This embodiment 2 provides a financial risk prediction system based on dynamic time warping, including: A multidimensional joint feature sequence construction unit is used to extract the time series of financial indicators of a target enterprise in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; and generate a multidimensional joint feature sequence based on the time series of financial indicators and the linkage gradient. The local cost matrix calculation unit is used to construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; The optimal regularization path solving unit is used to calculate the volatility of financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library, and obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. The risk prediction unit is used to filter a set of nearest-neighbor templates from the template library based on the comprehensive similarity, determine the financial risk prediction level of the target enterprise based on the financial risk labels pre-associated with each template sequence in the set of nearest-neighbor templates, extract abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the set of nearest-neighbor templates, map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence, generate a prediction result containing risk level and time traceability information, and output it.
[0042] Example 3 This embodiment 3 also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement any step of a financial risk prediction method based on dynamic time warping.
[0043] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0044] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.
[0045] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A financial risk prediction method based on dynamic time warping, characterized in that, include: S1. Extract the time series of financial indicators of the target company in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; generate a multi-dimensional joint feature sequence based on the time series of financial indicators and the linkage gradient; S2. Construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; S3. Calculate the volatility of the financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of the financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library to obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. S4. Based on the comprehensive similarity, filter the nearest template set from the template library, and determine the financial risk prediction level of the target enterprise based on the financial risk labels pre-associated with each template sequence in the nearest template set; Extract the abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest neighbor template set, and map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence to generate and output the prediction results containing risk level and time traceability information.
2. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In step S1, the calculation of the correlation gradient between different financial indicators in adjacent financial reporting periods includes: For any two different financial indicators, calculate the change in the indicator between the current financial reporting period and the previous financial reporting period. Construct a sliding window containing a preset time lag order, and calculate the lagged cross-covariance sequence of the changes in two financial indicators within the sliding window; The time lag order corresponding to the element with the largest absolute value in the lagged covariance sequence is extracted and used as the linkage gradient between the two different financial indicators.
3. The financial risk prediction method based on dynamic time warping according to claim 2, characterized in that, The construction of the sliding window, which includes a preset time lag order, specifically includes: Calculate the sample mean and sample variance of the time series of the financial indicators; for each preset lag order, calculate the autocovariance between the time series of the financial indicators and its own series after shifting by the lag order. Divide the autocovariance by the sample variance to obtain the autocorrelation function value under the corresponding lag order, so as to obtain the autocorrelation function of the financial indicator time series; Extract the lag order of the autocorrelation function when the function value first changes from positive to negative, and use the lag order as the length of the sliding window; Generate a set of corresponding lag orders based on the length of the sliding window; traverse the set of lag orders, calculate the cross-correlation function values of the changes in the two financial indicators at each lag order, and use the sequence of the cross-correlation function values as the lag cross-covariance sequence.
4. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In S2, the elements of the local cost matrix consist of the feature numerical distance and the co-evolution penalty term, and the specific calculation formula is as follows: in, The first in the local cost matrix Line 1 The element values of the column; and These are the multidimensional joint feature vectors of the target enterprise sequence and the template sequence at corresponding time points; The feature is the numerical distance function; and This is the corresponding linkage gradient vector; For the penalty weighting coefficient, This is the gradient difference amplification factor.
5. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In step S3, the search bandwidth of the normalized path is dynamically adjusted based on the volatility of the financial indicators to generate adaptive local bandwidth constraints, including: Calculate the variance of the financial indicators of the target enterprise sequence and the template sequence within a local time window, and use it as the volatility of the financial indicators. Calculate the local search bandwidth radius based on the volatility of the aforementioned financial indicators. The calculation formula is: in, and These are the preset global maximum and minimum bandwidth radii, respectively. The volatility of financial indicators for the current time window. and The maximum and minimum volatility in the sequence; the calculated values will be used to determine the maximum and minimum volatility. This serves as an adaptive local bandwidth constraint for the current time point.
6. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In S3, when solving for the globally optimal regularized path, a path connectivity repair mechanism is introduced: In the process of solving the cumulative cost matrix using dynamic programming, if the current node If there is no valid predecessor node within its adaptive local bandwidth constraint range, then connectivity repair is triggered; The connectivity restoration includes: temporarily disconnecting the current node. Given the local bandwidth constraint, the system searches for the legal predecessor node with the minimum cumulative cost within a preset extended search radius and adds that predecessor node to the current node. The path segment is marked as a forced alignment path segment.
7. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In step S4, determining the financial risk prediction level of the target enterprise specifically includes: All financial templates in the template library are sorted in ascending order according to their overall similarity to the target enterprise sequence to obtain a similarity ranking sequence; A predetermined number of financial templates are selected from the similarity ranking sequence to construct the nearest neighbor template set; Count the frequency of occurrence of each known financial risk level in the nearest neighbor template set; The known financial risk level that appears most frequently is used as the predicted financial risk level of the target company.
8. The financial risk prediction method based on dynamic time warping according to claim 1, characterized in that, In step S4, extracting outlier nodes from the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest neighbor template set, and mapping the outlier nodes to the time axis corresponding to the multidimensional joint feature sequence, includes: Calculate the mean and standard deviation of the local cost values of each node on the globally optimal regularized path; Nodes whose local cost is greater than the sum of the mean and a preset multiple of the standard deviation are identified as abnormal nodes. Extract the time index corresponding to the abnormal node in the multidimensional joint feature sequence, and map the time index to the time axis to generate the time tracing information.
9. A financial risk prediction system based on dynamic time warping, characterized in that, include: A multidimensional joint feature sequence construction unit is used to extract the time series of financial indicators of a target enterprise in multiple financial reporting periods; calculate the linkage gradient between different financial indicators in adjacent financial reporting periods; and generate a multidimensional joint feature sequence based on the time series of financial indicators and the linkage gradient. The local cost matrix calculation unit is used to construct a template library containing historical enterprise multidimensional joint feature sequences with known risk level labels; calculate the local cost matrix between the multidimensional joint feature sequence of the target enterprise and each template sequence in the template library; the element values of the local cost matrix are composed of feature numerical distance and co-evolution penalty term; the co-evolution penalty term is determined based on the difference in linkage gradient between the two sequences at corresponding time points; The optimal regularization path solving unit is used to calculate the volatility of financial indicators of the multidimensional joint feature sequence; dynamically adjust the search bandwidth of the regularization path based on the volatility of financial indicators to generate an adaptive local bandwidth constraint; under the adaptive local bandwidth constraint, solve the global optimal regularization path based on the local cost matrix between the multidimensional joint feature sequence and each template sequence in the template library, and obtain the comprehensive similarity between the multidimensional joint feature sequence and each template sequence. The risk prediction unit is used to filter the nearest template set from the template library based on the comprehensive similarity, and determine the financial risk prediction level of the target enterprise based on the financial risk tags pre-associated with each template sequence in the nearest template set; Extract the abnormal nodes in the globally optimal normalized path between the multidimensional joint feature sequence and each template sequence in the nearest neighbor template set, and map the abnormal nodes to the time axis corresponding to the multidimensional joint feature sequence to generate and output the prediction results containing risk level and time traceability information.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor as described in any one of claims 1-8: a financial risk prediction method based on dynamic time warping.
