Financial cost prediction method and device based on machine learning, equipment and medium
By performing dimensionality reduction and extracting latent features from corporate financial data, and combining feature importance scoring and cross-scenario validation, the model parameters are optimized, solving the problem of ineffective utilization of latent features in existing technologies, and achieving more accurate and stable financial cost prediction.
Patent Information
- Application Number
- CN202511670528.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-02-13
AI Technical Summary
Existing machine learning-based financial cost prediction methods have failed to effectively uncover hidden features in corporate financial data, resulting in insufficient accuracy and stability of prediction results, as well as a lack of cross-scenario adaptability.
By performing dimensionality reduction on corporate financial data, periodic fluctuation features and project-related features are extracted to generate a set of hidden features. Then, the model parameters are optimized through feature importance scoring and cross-scenario validation to generate a stable prediction model.
It improves the accuracy and reliability of financial cost forecasting, adapts to complex business environments, and enhances the stability of the model in different scenarios.
Smart Images

Figure CN121526682A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cost forecasting technology, and in particular relates to a method, apparatus, equipment and medium for financial cost forecasting based on machine learning. Background Technology
[0002] With the increasing sophistication of corporate financial management, financial cost forecasting technology has developed rapidly. Machine learning technology, with its ability to mine data patterns, has gradually become an important tool in the field of financial cost forecasting. It aims to build predictive models by analyzing historical financial data of enterprises to support cost control.
[0003] Existing machine learning-based financial cost prediction methods typically use raw corporate financial data (such as various income and expenditure details, asset and liability data, etc.) as model input. They are trained by constructing a single or simple combination of machine learning models to generate cost prediction results. In this process, they rely heavily on explicit financial indicators and do not systematically process the data dimensions and potential features.
[0004] However, existing methods have obvious shortcomings: due to the high dimensionality of corporate financial data and the presence of a large amount of redundant information, the implicit features such as periodic fluctuations and project correlations contained in the data have not been effectively mined and utilized, and there is a lack of screening for the reliability of features and verification of the stability of the model across scenarios. As a result, the prediction model is unable to accurately capture the pattern of cost changes, ultimately resulting in insufficient accuracy and stability of financial cost prediction results. Summary of the Invention
[0005] Therefore, it is necessary to provide a machine learning-based financial cost prediction method, apparatus, equipment, and medium that can accurately predict financial costs, addressing the aforementioned technical problems.
[0006] Firstly, this application provides a machine learning-based method for predicting financial costs, including:
[0007] The dimensionality-reduced dataset is obtained by performing dimensionality reduction processing on the company's financial data.
[0008] Latent feature analysis is performed on the dimensionality-reduced dataset to generate a set of latent features that include periodic fluctuation features and project association features;
[0009] The model is trained based on the set of hidden features to generate an initial prediction model;
[0010] The feature importance of each latent feature in the initial prediction model is analyzed and scored to obtain the feature importance score of each latent feature;
[0011] Based on the feature importance score, reliable feature selection is performed on the set of hidden features to obtain a reliable feature subset;
[0012] The initial prediction model is validated across scenarios using a reliable subset of features to generate a stability index.
[0013] The parameters of the initial prediction model are optimized based on stability indices to generate an optimized prediction model.
[0014] Input real-time financial data into the optimized forecasting model and output cost forecast results.
[0015] In one embodiment, dimensionality reduction is performed on the enterprise's financial data to obtain a dimensionality-reduced dataset, including:
[0016] Standardize corporate financial data to generate standardized data;
[0017] Calculate the covariance of the standardized data to generate a covariance matrix;
[0018] Perform eigenvalue decomposition on the covariance matrix to generate eigenvalues and eigenvectors;
[0019] Principal components are selected based on eigenvalues to generate a projection matrix;
[0020] The standardized data is linearly transformed using a projection matrix to generate a dimensionality-reduced dataset.
[0021] In one embodiment, latent feature analysis is performed on the dimensionality-reduced dataset to generate a set of latent features containing periodic fluctuation features and project association features, including:
[0022] Perform time series decomposition on the dimensionality-reduced dataset to generate seasonal components;
[0023] The periodic intensity of the seasonal components is calculated to generate periodic fluctuation characteristics;
[0024] Perform correlation analysis on the data of each item in the dimensionality-reduced dataset to generate an item association matrix;
[0025] Cluster the project association matrix to generate project association features;
[0026] The periodic fluctuation characteristics and project-related characteristics are merged to generate a set of hidden characteristics.
[0027] In one embodiment, the project association matrix is clustered to generate project association features, including:
[0028] Transform the project association matrix into a graph structure to generate a project relationship diagram;
[0029] Community discovery is performed based on project relationship diagrams, generating project clustering results;
[0030] Based on the weight coefficients of each project cluster, the project clustering results are filtered, and the clustering results of projects with weight coefficients greater than a preset threshold are confirmed as project association features; the weight coefficients are calculated using the following formula:
[0031]
[0032] in, Clustering in the project clustering results The weighting coefficients, This represents the number of items in the cluster. For projects in the project association matrix and projects The correlation coefficient.
[0033] In one embodiment, model training is performed based on a set of latent features to generate an initial prediction model, including:
[0034] The dataset of hidden features is divided into training and validation sets.
[0035] Based on the training set, base learners are trained to generate multiple weak learners;
[0036] A strong learner is generated by ensemble learning of multiple weak learners.
[0037] The strong learner is hyperparameters tuned using a validation set to generate an initial prediction model.
[0038] In one embodiment, a reliable feature subset is obtained by performing reliable feature filtering on the latent feature set based on feature importance scores, including:
[0039] The mean and standard deviation of the importance scores for all features are calculated to generate importance distribution parameters;
[0040] Based on the importance distribution parameters, the reliability score of each feature in the latent feature set is calculated to generate a reliability score set; the reliability score is calculated using the following formula:
[0041]
[0042] in, Features Reliability score, Features Importance score The mean of the importance scores for all features. The standard deviation of the importance scores for all features;
[0043] Based on the set of reliability scores, features with reliability scores greater than a preset reliability threshold are selected to generate a subset of candidate features;
[0044] Perform multicollinearity tests on the candidate feature subsets to generate reliable feature subsets.
[0045] In one embodiment, the parameters of the initial prediction model are adjusted based on a stability index to generate an optimized prediction model, including:
[0046] Calculate the regularization intensity adjustment coefficient based on the stability index, and generate the adjustment coefficient value;
[0047] Based on the adjustment coefficient values, the weight parameters corresponding to the reliable feature subset in the initial prediction model are regularized and enhanced to generate enhanced weight parameters.
[0048] Based on the enhanced weight parameters and the training set containing a reliable feature subset, the initial prediction model is iteratively updated to generate an intermediate prediction model;
[0049] The variance of the intermediate prediction model's output on the validation set is calculated to generate a prediction variance sequence.
[0050] Stability convergence is determined based on the predicted variance sequence. When the intermediate prediction model is confirmed to have reached a stable state, the intermediate prediction model is output as the optimized prediction model.
[0051] Secondly, this application also provides a machine learning-based financial cost prediction device, comprising:
[0052] The data dimensionality reduction module is used to perform dimensionality reduction processing on enterprise financial data to obtain a dimensionality-reduced dataset.
[0053] The latent feature extraction module is used to perform latent feature analysis on the dimensionality-reduced dataset and generate a set of latent features that includes periodic fluctuation features and project association features.
[0054] The initial model training module is used to train the model based on the set of hidden features and generate an initial prediction model.
[0055] The feature importance scoring module is used to analyze and score the feature importance of each latent feature in the initial prediction model, and obtain the feature importance score of each latent feature.
[0056] The reliable feature filtering module is used to filter the set of hidden features based on feature importance scores to obtain a reliable feature subset;
[0057] The cross-scenario verification module is used to verify the initial prediction model across scenarios using a reliable subset of features and generate stability metrics.
[0058] The parameter optimization module is used to optimize the parameters of the initial prediction model based on stability indices, and generate an optimized prediction model.
[0059] The cost forecasting module is used to input real-time financial data into the optimized forecasting model and output cost forecasting results.
[0060] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the machine learning-based financial cost prediction method as described in the first aspect.
[0061] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the machine learning-based financial cost prediction method of the first aspect.
[0062] The aforementioned machine learning-based financial cost prediction method, apparatus, equipment, and medium reduce redundant information interference and improve data processing efficiency by downscaling enterprise financial data; they also uncover hidden features such as cyclical fluctuations and project correlations, capturing deep-seated patterns overlooked by traditional methods; after training the model based on these hidden features, reliable features are selected through feature importance scoring, reducing the impact of noise; further, cross-scenario validation and parameter optimization enhance the model's stability in different scenarios. This technical solution effectively solves the problems in existing technologies caused by inadequate handling of high-dimensional data, mining of hidden features, and ensuring model stability, improving the accuracy and reliability of financial cost prediction and making it more adaptable to complex business environments. Attached Figure Description
[0063] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0064] Figure 1 A flowchart illustrating a machine learning-based financial cost prediction method provided by this invention;
[0065] Figure 2 A flowchart illustrating a method for generating an initial prediction model in an optional embodiment of the present invention;
[0066] Figure 3 This is a schematic diagram of a machine learning-based financial cost prediction device provided by the present invention. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0068] In one embodiment, such as Figure 1 As shown, a machine learning-based financial cost prediction method is provided. This embodiment illustrates the method's application to a terminal, but it is understood that the method can also be applied to a server, or to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0069] S111. Perform dimensionality reduction processing on the enterprise's financial data to obtain the dimensionality-reduced dataset.
[0070] Optionally, corporate financial data can be preprocessed to eliminate dimensional differences and redundant information. Then, commonly used dimensionality reduction methods, such as principal component analysis and factor analysis, can be employed to compress the dimensions of the preprocessed financial data. Specifically, by analyzing the inherent relationships among various indicators in the data, core information that has a significant impact on cost prediction is retained, while redundant or irrelevant dimensions are eliminated, ultimately resulting in a dimensionality-simplified dataset with higher information concentration.
[0071] S112. Perform latent feature analysis on the dimensionality-reduced dataset to generate a set of latent features that includes periodic fluctuation features and project association features.
[0072] Optionally, latent feature analysis is performed on the dimensionality-reduced dataset from two dimensions: firstly, from the time dimension, analyzing the patterns of data change over time, identifying recurring periodic fluctuation patterns, and extracting periodic fluctuation features reflecting cost changes over time; secondly, from the project association dimension, analyzing the mutual influence relationships between different project data in the dataset, uncovering correlation patterns not directly apparent between projects, and extracting project association features reflecting the inherent connections between projects. These two types of features are then integrated to form a latent feature set containing both periodic fluctuation features and project association features.
[0073] S113. Train the model based on the set of hidden features to generate an initial prediction model.
[0074] Optionally, historical financial data containing a set of latent features is first collected and organized as the basic data for model training. Based on the needs of financial cost prediction, an appropriate machine learning model, such as an ensemble learning model or a regression model, is selected as the basic model framework. The basic model is trained using the training data, and the internal parameters of the model are continuously adjusted during the process. The model performance is judged by preset evaluation indicators, such as prediction error rate and goodness of fit. When the model performance meets the preset requirements, training is stopped and an initial prediction model is generated.
[0075] S114. Analyze and score the feature importance of each latent feature in the initial prediction model to obtain the feature importance score of each latent feature.
[0076] Optionally, a feature importance assessment method adapted to the initial prediction model type is adopted to analyze the influence of each latent feature on the prediction results during the model prediction process. Specifically, the contribution of each latent feature in the model decision-making or computation process is quantified and converted into a comparable value, namely, the feature importance score of each latent feature; where a higher score indicates that the latent feature has a more significant effect on the accurate prediction cost of the model, and a lower score indicates that its effect is weaker.
[0077] S115. Based on the feature importance score, perform reliable feature screening on the set of hidden features to obtain a reliable feature subset.
[0078] Optionally, a reasonable screening threshold is first set based on the feature importance score. Latent features with scores below the threshold are identified as features that contribute little to the prediction and are removed to obtain an initial subset of candidate features. To avoid information redundancy in the subset of candidate features, the correlation between features in the subset of candidate features is further tested to identify and remove features with strong linear correlation or high information overlap, ensuring that the final reliable subset of features contains features that are key to the prediction and does not contain redundant interference.
[0079] S116. Validate the initial prediction model across scenarios using a reliable subset of features to generate a stability index.
[0080] Optionally, first identify several representative business scenarios that cover common financial operation situations for enterprises, such as different financial accounting cycles and different types of project implementation modes; obtain corresponding validation data for each business scenario and perform preprocessing on the validation data in the same way as the previous data processing; input a subset of reliable features into the initial prediction model, perform prediction operations on the validation data of each scenario, and quantify the stability index that reflects the model's ability to adapt to different scenarios by analyzing the degree of deviation of the prediction results of the model in different scenarios.
[0081] S117. Optimize the parameters of the initial prediction model based on the stability index to generate the optimized prediction model.
[0082] Optionally, based on stability metrics, the performance shortcomings of the initial prediction model in different scenarios can be identified, and the core parameters of the model can be adjusted accordingly, such as the weight allocation of features and the regularization parameters of the model. With the goal of improving stability metrics, the model can be iteratively optimized using training and validation data. After each parameter adjustment, the stability and prediction accuracy of the model can be re-evaluated. When the stability metrics of the model reach the preset qualified standard and the prediction performance does not decrease significantly, the optimization is stopped, and the optimized prediction model is generated.
[0083] S118. Input real-time financial data into the optimized prediction model and output the cost prediction results.
[0084] Optionally, the real-time collected corporate financial data is preprocessed. The preprocessing operation must be consistent with the dimensionality reduction and implicit feature extraction logic used in the previous processing of historical financial data to ensure that the real-time data can be transformed into real-time features that match the model input requirements. The processed real-time features are then input into the optimized prediction model, which analyzes and calculates the real-time features according to the preset calculation logic. After the calculation is completed, the model outputs the corresponding cost prediction results, which can be directly used for corporate financial cost control and decision-making reference.
[0085] The aforementioned machine learning-based financial cost prediction method first simplifies and reduces the dimensionality of financial data, then mines hidden features to supplement key information. Next, it eliminates redundancy through feature importance screening, evaluates stability through cross-scenario verification, and optimizes parameters to improve model adaptability, ultimately achieving accurate prediction of real-time data. This method effectively addresses the shortcomings of existing methods in processing high-dimensional financial data, utilizing hidden features, and adapting models to different scenarios, significantly improving the accuracy and reliability of financial cost prediction and better meeting the cost prediction needs of enterprises in complex business environments.
[0086] In one embodiment, dimensionality reduction is performed on the enterprise's financial data to obtain a dimensionality-reduced dataset, including:
[0087] S211. Standardize the enterprise's financial data to generate standardized data.
[0088] Optionally, the Z-score standardization method commonly used in this field can be employed for processing. Specifically, it first iterates through each financial indicator in the company's financial data, such as operating revenue, operating costs, and R&D expenses, calculating the mean μ and standard deviation σ of all sample data for each indicator; then, it uses the formula: Each original financial data point x is transformed to obtain standardized data. Here, the mean μ is the arithmetic mean of all sample data for that indicator, and the standard deviation σ reflects the dispersion of the indicator data. This transformation eliminates the influence of differences in units (such as monetary units or statistical periods) between different financial indicators, bringing all indicators to the same order of magnitude.
[0089] S212. Calculate the covariance of the standardized data to generate a covariance matrix.
[0090] Optionally, based on standardized data, the covariance between any two financial indicators is calculated, and a covariance matrix is constructed. Covariance measures the degree of linear correlation between two indicator data points, and its calculation formula is as follows: Here, X and Y represent two different standardized financial indicators, and E[・] represents the expected value. If there are n standardized financial indicators, the covariance matrix is an n x n square matrix. The elements on the diagonal are the variances of each indicator itself, i.e., the covariance between the indicator and itself. The elements off-diagonal are the covariances between the corresponding two indicators. By traversing all indicator pairs and substituting them into the formula to calculate the covariance, a complete covariance matrix is finally generated to quantitatively present the correlation between the indicators.
[0091] S213. Perform eigenvalue decomposition on the covariance matrix to generate eigenvalues and eigenvectors.
[0092] Optionally, an eigenvalue decomposition operation can be performed on the covariance matrix using a linear algebra library. This decomposition process can represent the covariance matrix A as follows: The decomposition is in the form of Λ. Here, P is the eigenvector matrix, where each column corresponds to an eigenvector, representing the principal direction in the data space described by the covariance matrix; Λ is a diagonal matrix, where the elements on the diagonal are the eigenvalues. The magnitude of the eigenvalue reflects the degree of dispersion of the data in the direction represented by the corresponding eigenvector, i.e., the total amount of data information contained in that direction. After decomposition, all eigenvalues and their corresponding eigenvectors are output, with a one-to-one correspondence between eigenvalues and eigenvectors.
[0093] S214. Perform principal component selection based on eigenvalues to generate a projection matrix.
[0094] Optionally, all feature values are sorted in descending order. After sorting, the contribution rate of each feature value to the sum of all feature values is calculated, as well as the cumulative contribution rate of the top k feature values, i.e., the proportion of the sum of the top k feature values to the sum of all feature values. A cumulative contribution rate threshold is preset based on the actual needs of financial cost prediction. The top k feature values whose cumulative contribution rate reaches this threshold are selected, and the feature vectors corresponding to these k feature values are extracted. These k feature vectors are arranged column-wise to form a matrix of dimension n rows and k columns, which is the projection matrix. The value of k is determined by the cumulative contribution rate threshold. This filtering method retains directions containing key information in the data while eliminating directions with low information content.
[0095] S215. Perform a linear transformation on the standardized data using a projection matrix to generate a dimensionality-reduced dataset.
[0096] Optionally, the standardized data can be represented as an m x n matrix X, where m is the number of samples and n is the number of original financial indicators. The projection matrix can be represented as an n x k matrix P, where k is the number of principal components after screening, and k < n. A linear transformation is performed on the standardized data using matrix multiplication. During the operation, the inner product of each row of sample data in the standardized data matrix X and each column of the projection matrix P is calculated, ultimately generating an m x k matrix Y, which is the dimensionality-reduced dataset. This linear transformation maps the original high-dimensional data to a low-dimensional space composed of k principal components, significantly reducing data dimensionality and subsequent computational load while preserving key information in the original data to the greatest extent possible, avoiding information loss that could lead to biases in subsequent analysis.
[0097] In the above embodiments, standardization eliminates dimensional interference in financial data, covariance matrix quantifies the correlation between indicators, eigenvalue decomposition locates the direction of core data information, key principal components are selected based on cumulative contribution rate to construct projection matrix, and finally linear transformation is used to achieve data dimensionality reduction. This method is based on mature mathematical methods and linear algebra operations, can be efficiently executed on software terminals, and solves the processing problems caused by dimensional differences and information redundancy in high-dimensional financial data, while preserving key data information to the greatest extent.
[0098] In one embodiment, latent feature analysis is performed on the dimensionality-reduced dataset to generate a set of latent features containing periodic fluctuation features and project association features, including:
[0099] S311. Perform time series decomposition on the dimensionality-reduced dataset to generate seasonal components.
[0100] For example, the STL (Seasonal and Trend decomposition using Loess) algorithm is used to perform time series decomposition on the dimensionality-reduced dataset. This algorithm achieves data decomposition through local weighted regression scatter smoothing. Specifically, firstly, trend extraction is performed on the time series data (financial data arranged in chronological order, such as monthly cost data and quarterly income and expenditure data) in the dimensionality-reduced dataset to separate the trend component reflecting long-term changing patterns; then, based on a preset time period (such as a monthly period or a quarterly period), the portion of the data that repeats with the period is extracted to obtain the seasonal component; finally, the random fluctuation portion after excluding the influence of trends and seasons, i.e., the residual component, is separated. In this step, the focus is on retaining and outputting the seasonal component, which directly reflects the pattern of financial data changes over time.
[0101] S312. Calculate the periodic intensity of the seasonal components to generate periodic fluctuation characteristics.
[0102] Optionally, based on the seasonal component, the impact on financial costs can be quantified by calculating the intensity of periodicity. Specifically, the variance of the seasonal component is first calculated. This variance represents the degree of fluctuation of the seasonal component itself; then, the total variance of the original time series of the dataset after dimensionality reduction is calculated. This variance represents the overall volatility of the original data; expressed by the formula: The periodicity intensity SI is calculated, where SI ranges from 0 to 1. The closer SI is to 1, the greater the contribution of the seasonal component to the fluctuation of the original data, i.e., the more significant the periodicity. The calculated periodicity intensity value and the corresponding periodic attributes (such as monthly cycle and quarterly cycle) are used as core information to generate periodic fluctuation features, which can be directly used to describe the intensity of periodic changes in financial data.
[0103] S313. Perform correlation analysis on the data of each item in the dimensionality-reduced dataset to generate an item association matrix.
[0104] Specifically, the Pearson correlation coefficient is used to calculate the correlation between the data items in the dimensionality-reduced dataset. First, the definition of project data is clarified: it refers to independent financial unit data divided according to business attributes in the dataset, such as cost data from different product lines or expense data from different departments. Assuming there are n projects, all project data pairs need to be traversed (a total of n(n-1) / 2 pairs). For each pair of project data X and Y, the correlation is calculated using the formula: Calculate the correlation coefficient, where , These are the i-th sample values of X and Y, respectively. , Let X and Y be the sample means, respectively, and m be the sample size. Arrange all correlation coefficients in order of item pairs to construct an n x n item association matrix. The element in the i-th row and j-th column of the matrix is the correlation coefficient between item i and item j.
[0105] S314. Perform clustering on the project association matrix to generate project association features.
[0106] Optionally, the project association matrix is converted into a project relationship graph, where each project corresponds to a node in the graph. The absolute value of the correlation coefficient between projects corresponds to the weight of the edges between nodes; the larger the weight, the stronger the correlation between projects. Next, the Louvain algorithm is used to perform community detection on the project relationship graph. This algorithm achieves clustering by iteratively optimizing the modularity metric. Modularity measures the reasonableness of the clustering results; a higher value indicates that the nodes within a cluster are more tightly connected, and the connections between clusters are sparser. After clustering, multiple project clustering results are generated. The weight coefficient of each cluster is calculated, and clustering results with weight coefficients greater than a preset threshold are selected. The identification information of the above clusters (such as cluster number) and the average correlation coefficient within the clusters are used as core content to generate project association features.
[0107] S315. Merge the periodic fluctuation features and project-related features to generate a set of hidden features.
[0108] Optionally, the feature forms of periodic fluctuation characteristics and project association characteristics are first defined. Periodic fluctuation characteristics are typically numerical, such as the periodic intensity values at different periods, while project association characteristics can be categorical (e.g., the cluster number to which the project belongs) or numerical (e.g., the average correlation coefficient within a cluster). Next, the two types of features are aligned to ensure that the feature dimensions of all samples are consistent, meaning each sample contains both the corresponding periodic fluctuation characteristic value and the corresponding project association characteristic information. Finally, the two types of features are integrated through feature concatenation. Specifically, the periodic fluctuation characteristic column and the project association characteristic column are concatenated in dimensional order to form a new feature matrix, which is the latent feature set.
[0109] In the above embodiments, seasonal components are extracted through time series decomposition to uncover periodic patterns, and the periodic influence is quantified by calculating the periodic intensity to generate periodic fluctuation characteristics. Simultaneously, a project association matrix is constructed through correlation analysis, and effective association information is filtered using clustering to generate project association features. Finally, the two types of features are merged to form a set of implicit features. This method is based on mature time series analysis and correlation analysis methods, can be efficiently executed on software terminals, and solves the problem of traditional methods neglecting the periodicity of financial data and project association. Furthermore, through systematic feature extraction and integration, it helps improve the accuracy of financial cost forecasting.
[0110] In one embodiment, the project association matrix is clustered to generate project association features, including:
[0111] S411. Perform graph structure transformation on the project association matrix to generate a project relationship diagram.
[0112] Optionally, the project association matrix is an n x n square matrix (n is the total number of projects), where the element in the i-th row and j-th column represents the correlation coefficient between project i and project j. During graph structure transformation, each project is mapped to a node in the graph, and the node's identifier corresponds one-to-one with the project's unique identifier (such as project number). The absolute value of the element in the i-th row and j-th column of the project association matrix is used as the weight of the edge connecting node i and node j; the larger the weight value, the stronger the association between the two projects. For the diagonal elements of the matrix, the correlation coefficient of the project itself (usually 1) can be ignored or set to 0 to avoid self-loop effects. Through the above mapping rules, the two-dimensional matrix structure is transformed into a project relationship graph containing a set of nodes and a set of edges, where the edge set stores all node connections with non-zero weights.
[0113] S412. Community discovery is performed based on the project relationship graph, and project clustering results are generated.
[0114] Optionally, community detection aims to identify closely related project groups from the project relationship graph, preferably implemented using the Louvain algorithm. This algorithm performs clustering by iteratively optimizing the modularity metric, which measures the reasonableness of the clustering results. A higher modularity value indicates tighter connections between nodes within a group and sparser connections between groups. Specifically, each node is first treated as an independent community, and an initial modularity is calculated. Then, adjacent communities that can improve the modularity are iteratively merged until the modularity no longer increases significantly. Finally, the final community partitioning results are output, with each community corresponding to a project cluster. The clustering results include the cluster identifier (such as cluster number) to which each project belongs and a list of projects within the cluster, thus completing the transformation from the project relationship graph to the project clustering results.
[0115] S413. Based on the weight coefficients of each project cluster, the project clustering results are filtered, and the clustering results of projects with weight coefficients greater than a preset threshold are confirmed as project association features; the weight coefficients are calculated using the following formula:
[0116]
[0117] in, Clustering in the project clustering results The weighting coefficients, This represents the number of items in the cluster. For projects in the project association matrix and projects The correlation coefficient.
[0118] Optionally, for each item clustering result, first determine the number of items n contained in the cluster c, and then traverse all item pairs (i, j) (i < j) within the cluster, and extract the corresponding correlation coefficient from the item association matrix , calculate all of the sum; divide this sum by the total number of item pairs within the cluster (i.e., the combination number C(n, 2)), to obtain the weight coefficient of this cluster , Essentially, it is the average value of the absolute values of the correlation coefficients between items within the cluster, reflecting the overall strength of the association between items within the cluster. Preset a weight coefficient threshold, set according to the business requirements for the association strength, compare the of each cluster with the threshold, and confirm the cluster results where is greater than the threshold as item association features. The feature content includes the cluster identifier, the list of items within the cluster, and the corresponding value, ensuring that the extracted association features have practical business significance.
[0119] In the above embodiment, the item association matrix is converted into an intuitive graph structure to simplify the analysis of association relationships, and then the community discovery algorithm is used to mine the groups of items with closely related internal associations. Finally, the weight coefficient is used to screen out the association features with practical significance. This method not only solves the problem that traditional methods are difficult to capture the implicit associations between items, but also ensures the reliability of the item association features through quantitative screening.
[0120] In an optional embodiment, as Figure 2 shown, based on the set of invisible features, model training is performed to generate an initial prediction model, including:
[0121] S511. Divide the set of invisible features into a training set and a validation set.
[0122] Optionally, the set of invisible features is a structured data matrix containing periodic fluctuation features and item association features. Each row represents a sample, and each column represents a feature. When dividing, first check the data distribution of this set to ensure that the samples are evenly distributed in each feature dimension, and then use the stratified sampling method to divide the samples into a training set and a validation set according to a preset ratio. The core of stratified sampling is to keep the feature distribution of the two groups of data after division consistent with the original set, avoiding the over-concentration or missing of certain types of feature samples due to random sampling. Among them, the training set is used for the parameter learning of the subsequent base learner, and the validation set is used to evaluate the model performance and perform hyperparameter tuning. Through the above division, the overfitting problem of the model on a single data set can be effectively avoided.
[0123] S512. Train the base learner based on the training set to generate multiple weak learners.
[0124] Optionally, the base learners are simple machine learning models commonly used in this field, such as decision trees. Before training, the training set is cleaned to remove a small number of outliers, such as by identifying and removing them using the 3σ criterion. Each base learner is then trained independently based on the training set data. The training process is implemented by recursively partitioning the feature space: starting from the root node, a feature is selected each time, and the impurity corresponding to different partitioning thresholds for that feature is calculated, such as the Gini coefficient or information gain. The partitioning method that reduces impurity the most is selected to generate child nodes, until the node samples have consistent categories or a preset stopping condition is met, generating a weak learner. This process is repeated, using different subsets of the training set (such as those obtained through Bootstrap sampling) to train multiple structurally independent weak learners, ensuring that each weak learner has certain differences to support subsequent ensemble training.
[0125] S513. Perform ensemble learning on multiple weak learners to generate a strong learner.
[0126] Optionally, ensemble learning employs the Bagging algorithm, whose core principle is to reduce the variance of individual weak learners through "parallel training of multiple models and fusion of results." Multiple weak learners are constructed into a learner ensemble. When predicting each new sample, for classification tasks such as cost range prediction, a "majority voting" method is used, counting the predicted categories of all weak learners and selecting the category with the most votes as the ensemble prediction result. For regression tasks such as specific cost value prediction, an "arithmetic mean" method is used, calculating the mean of the prediction results of all weak learners as the ensemble prediction result. Through this fusion method, the local bias of individual weak learners can be offset, improving the overall generalization ability of the model and ultimately generating a strong learner with predictive performance superior to a single weak learner.
[0127] S514. Use the validation set to perform hyperparameter tuning on the strong learner and generate an initial prediction model.
[0128] Optionally, hyperparameters are parameters that need to be preset before model training, not parameters that are automatically learned during model training, such as the maximum depth of a decision tree, the number of base learners in a random forest, and the learning rate. During optimization, first determine the list of hyperparameters to be optimized and the preset value range for each hyperparameter based on the selected strong learner type. Then, use a grid search method to traverse all hyperparameter combinations. For each combination, retrain the strong learner using the training set, then input the validation set into the model and calculate the prediction error (e.g., mean squared error (MSE) for regression tasks and accuracy for classification tasks). Record the validation errors for all combinations and select the hyperparameter combination with the smallest error as the optimal parameters. Substitute the optimal parameters into the strong learner, update the model parameters, and generate the initial prediction model.
[0129] In the above embodiments, the reliability of training and validation is first ensured by reasonably dividing the dataset. Then, the generalization ability of the model is improved by training multiple weak learners and integrating them. Finally, the model performance is further optimized by hyperparameter tuning. This method is based on mature machine learning methods, which not only solves the problems of overfitting and poor generalization ability of traditional single models, but also ensures that the initial prediction model has high prediction accuracy through systematic training and tuning.
[0130] In one embodiment, a reliable feature subset is obtained by performing reliable feature filtering on the latent feature set based on feature importance scores, including:
[0131] S611. Calculate the mean and standard deviation of the importance scores for all features to generate importance distribution parameters.
[0132] Optionally, it is first clarified that the feature importance score is obtained from the initial prediction model and is used to quantify the influence of each latent feature on the prediction result. The mean is then calculated. At that time, iterate through the importance scores of all features. All The summation is divided by the total number of features, n, using the following formula: =( + +...+ ) / n; Calculate the standard deviation First calculate each and The square of the difference, summed over all squares and divided by (n-1) (using the sample standard deviation method, which better reflects the characteristic distribution of the dataset), and then the square root of the result is given by the formula: , calculate and As an importance distribution parameter.
[0133] S612. Based on the importance distribution parameters, calculate the reliability score for each feature in the latent feature set to generate a reliability score set; the reliability score is calculated using the following formula:
[0134]
[0135] in, Features Reliability score, Features Importance score The mean of the importance scores for all features. is the standard deviation of the importance scores for all features.
[0136] Optionally, the importance distribution parameters are known. (The mean of all feature importance scores) and (Standard deviation of all feature importance scores) For each feature i in the hidden feature set, extract its corresponding feature importance score. ,Will , , Substitute into the preset formula The calculation is performed. This formula is essentially a standardization process for feature importance scores, eliminating the influence of dimensions and thus... Converted into an index of deviation from the overall distribution, the reliability score. .like A positive value indicates that the importance of this feature is higher than the average level of all features; a negative value indicates that it is lower than the average level. After traversing all features and completing the calculation, all features are collected. This constitutes a set of reliability scores.
[0137] S613. Based on the reliability score set, select features with a reliability score greater than the preset reliability threshold and generate a subset of candidate features.
[0138] Optionally, before setting a reliability threshold, the logic for setting the threshold needs to be determined based on the business objectives of financial cost forecasting (such as wanting to retain features that significantly contribute to the forecast). This threshold does not need to be a fixed value; it only needs to reflect the core requirement of "selecting features with a certain degree of importance above average." Iterate through each feature in the reliability score set. ,Will Compare with a preset reliability threshold and retain Features exceeding this threshold are considered significantly more important than the overall average and thus contribute more positively to the prediction results. All retained features are then integrated to generate a subset of candidate features, initially eliminating features with weak predictive impact.
[0139] S614. Perform multicollinearity test on the candidate feature subsets to generate reliable feature subsets.
[0140] Optionally, multicollinearity refers to the existence of strong linear correlations among different features within a candidate feature subset, which can lead to unstable model parameter estimation. Therefore, the variance inflation factor (VIF) needs to be used for testing. When calculating the VIF for each candidate feature, a linear regression model is constructed with that feature as the dependent variable and all other features in the candidate subset as independent variables. The determination coefficient R² of the model is obtained, and then the VIF value is calculated using the formula VIF = 1 / (1-R²). The larger the VIF value, the stronger the collinearity between that feature and other features. A preset VIF threshold is used; threshold logic is commonly used in this field and no specific value is required. Features with VIF values greater than this threshold are removed, and the remaining features form a reliable feature subset, ensuring that there is no significant collinearity among features.
[0141] In the above embodiments, a feature evaluation benchmark is established by calculating importance distribution parameters, and then a reliability score is obtained through standardization to screen important features. Multicollinearity testing is then used to eliminate feature redundancy. This method solves the problem of traditional methods easily retaining redundant or low-value features, while ensuring that the reliable feature subset possesses both importance and independence, thus helping to improve the stability and accuracy of the prediction model.
[0142] In one embodiment, the parameters of the initial prediction model are adjusted based on a stability index to generate an optimized prediction model, including:
[0143] S711. Calculate the regularization intensity adjustment coefficient based on the stability index and generate the adjustment coefficient value.
[0144] Optionally, the stability index is generated in the early stages by validating the initial prediction model across scenarios using a reliable subset of features. It quantifies the degree of prediction volatility under different business scenarios, and commonly manifests as the coefficient of variation or standard deviation of the prediction results. When calculating the regularization strength adjustment coefficient, a model stability threshold is first set, and the current stability index is compared with this threshold: if the stability index is higher than the threshold, it indicates that the model fluctuates significantly and lacks stability, so the adjustment coefficient is increased by a preset ratio to enhance the subsequent regularization constraint; if the stability index is lower than the threshold, it indicates that the model has achieved a certain level of stability, so the adjustment coefficient is appropriately reduced to avoid excessive constraints affecting the model's prediction accuracy. Through the above calculation logic linked to the stability index, an adjustment coefficient value adapted to the current model state is generated.
[0145] S712. Based on the adjustment coefficient values, the weight parameters corresponding to the reliable feature subset in the initial prediction model are regularized and enhanced to generate enhanced weight parameters.
[0146] Optionally, the regularization enhancement processing preferably employs the L2 regularization (Ridge Regression) method. This method introduces a squared penalty term for the weight parameters into the model's loss function to constrain the absolute values of the weight parameters, preventing overfitting due to excessively large weights. Specifically, the weight parameters corresponding to the reliable feature subset in the initial prediction model are first extracted; that is, the coefficients corresponding to each reliable feature in the model operation, which directly affect the contribution of that feature to the prediction result. Then, the adjusted coefficient values are used as penalty coefficients and incorporated into the original loss function of the model. Assuming the original loss function is... ( (where the weights are parameters), then the enhanced loss function is: Where λ is the adjustment coefficient value. These are the weight parameters corresponding to reliable features. Based on this enhanced loss function, the weight parameters are recalculated to generate enhanced weight parameters, thus achieving reasonable constraints on the weights of key features.
[0147] S713. Based on the enhanced weight parameters and the training set containing a reliable feature subset, iteratively update the initial prediction model to generate an intermediate prediction model.
[0148] Optionally, the training set containing a reliable feature subset is obtained after prior data partitioning and feature selection, where redundant information has been removed and core prediction features are retained. During iterative updates, the enhanced weight parameters are first used as the initial parameters of the model, and then the training set data is input into the initial prediction model. Common optimization algorithms such as gradient descent are used to gradually adjust the model parameters with the goal of minimizing the enhanced loss function. In each iteration, the error between the training set prediction result and the actual result is calculated, and the weight parameters are updated based on backpropagation of the error until the model loss function value decreases to a preset range or the maximum number of iterations is reached. During the iteration process, the model state after each parameter update needs to be recorded in real time, ultimately generating an intermediate prediction model with optimized parameters, ensuring that the model gradually adapts to the patterns of the training data while retaining reliable feature information.
[0149] S714. Calculate the variance of the intermediate prediction model's output on the validation set to generate a prediction variance sequence.
[0150] Optionally, the validation set is reserved separately during the initial dataset partitioning and is used to evaluate the model's generalization ability. Its data distribution is consistent with the training set, but it has not been used in model training. Before calculating the prediction variance, all prediction results of the intermediate prediction model on the validation set are collected in iteration order to form a prediction result sequence; then, the variance is calculated for this sequence using the following formula: , where m is the number of samples in the validation set. The prediction result for the k-th sample. This is the mean of the prediction results for all samples. If the intermediate prediction model undergoes multiple iterations, the prediction variance for each iteration needs to be calculated separately. The variance values for all iterations are then arranged in chronological order to generate a prediction variance sequence, which directly reflects the trend of stability changes during the model iteration process.
[0151] S715. Based on the predicted variance sequence, determine the stability convergence. When it is confirmed that the intermediate prediction model has reached a stable state, output the intermediate prediction model as the optimized prediction model.
[0152] Optionally, the core of convergence judgment is to analyze the magnitude of change in the predicted variance sequence. A convergence threshold is first set to determine if the variance fluctuation is small enough, indicating that the model is approaching stability. The predicted variance sequence is traversed, and the variance difference between two consecutive iterations is calculated. If the variance difference in multiple consecutive iterations is less than the convergence threshold, or if the variance sequence as a whole stabilizes within a very small numerical range (i.e., the variance no longer changes significantly with iteration), then the intermediate prediction model is confirmed to have reached a stable state. At this point, the prediction fluctuation on the validation set is sufficiently small, and parameter adjustments cannot further improve stability. When this convergence condition is met, iterative updates are stopped, and the current intermediate prediction model is output as the optimized prediction model, ensuring that the final model combines prediction accuracy and scenario adaptability.
[0153] In the above embodiments, the regularization strength is first determined based on model stability, then the weights of key features are constrained by regularization, followed by iterative updates and optimization of model parameters. Subsequently, stability changes are monitored using a variance sequence, and finally, a stable model is output based on convergence. This method not only solves the problem of insufficient stability of the initial prediction model across scenarios, but also ensures that the model retains the predictive value of reliable features while constraining weights and avoiding overfitting through gradual optimization, ultimately improving the overall performance and practical value of the financial cost prediction model.
[0154] In the aforementioned machine learning-based financial cost prediction method, device, equipment, and medium, the enterprise financial data is first reduced in dimensionality through standardization, covariance calculation, eigenvalue decomposition, and principal component screening to simplify the data while retaining key information. Then, seasonal components are extracted through time series decomposition to calculate periodic fluctuation features. Combined with project data correlation analysis, graph structure transformation, community detection, and weight coefficient screening, project-related features are obtained, forming a set of implicit features. Subsequently, a weak learner is trained by dividing the dataset and then integrated to generate a strong learner. An initial prediction model is obtained through hyperparameter tuning. Next, a reliability score is calculated using the mean and standard deviation of feature importance. Candidate features are screened, and collinearity is tested to obtain a reliable feature subset. Finally, a stability index is generated through cross-scenario verification using the reliable feature subset. Based on this, regularization adjustment coefficients are calculated to constrain model weights. The model is iteratively updated, and convergence is determined through variance sequence to obtain an optimized model. Real-time financial data is input into the model for processing, and the prediction result is output. This technical solution effectively solves the problems of insufficient accuracy and stability in financial cost prediction caused by traditional methods due to inadequate handling of high-dimensional data, neglect of hidden features, and lack of stability verification. It improves the accuracy and reliability of prediction by systematically processing high-dimensional financial data, mining hidden features such as periodicity and project correlation, and verifying and optimizing model stability.
[0155] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0156] Based on the same inventive concept, this application also provides an apparatus for implementing the machine learning-based financial cost prediction method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations of the one or more machine learning-based financial cost prediction apparatus embodiments provided below can be found in the limitations of the machine learning-based financial cost prediction method described above, and will not be repeated here.
[0157] In one exemplary embodiment, such as Figure 3 As shown, a machine learning-based financial cost prediction device 10 is provided, comprising:
[0158] Data dimensionality reduction module 11 is used to perform dimensionality reduction processing on enterprise financial data to obtain a dimensionality-reduced dataset;
[0159] The latent feature extraction module 12 is used to perform latent feature analysis on the dimensionality-reduced dataset and generate a set of latent features containing periodic fluctuation features and project association features.
[0160] The initial model training module 13 is used to train the model based on the set of hidden features and generate an initial prediction model.
[0161] The feature importance scoring module 14 is used to analyze and score the feature importance of each latent feature in the initial prediction model to obtain the feature importance score of each latent feature.
[0162] The reliable feature filtering module 15 is used to filter the set of hidden features based on the feature importance score to obtain a reliable feature subset;
[0163] The cross-scenario verification module 16 is used to perform cross-scenario verification on the initial prediction model using a reliable feature subset and generate a stability index.
[0164] The parameter optimization module 17 is used to optimize the parameters of the initial prediction model based on the stability index, and generate the optimized prediction model.
[0165] The cost forecasting module 18 is used to input real-time financial data into the optimized forecasting model and output cost forecasting results.
[0166] In one embodiment, the data dimensionality reduction module includes:
[0167] Data standardization units are used to standardize corporate financial data and generate standardized data.
[0168] The covariance calculation unit is used to calculate the covariance of standardized data and generate a covariance matrix.
[0169] Eigenvalue decomposition unit, used to perform eigenvalue decomposition on the covariance matrix to generate eigenvalues and eigenvectors;
[0170] Principal component screening unit is used to screen principal components based on eigenvalues and generate a projection matrix;
[0171] The linear transformation unit is used to perform a linear transformation on the standardized data using a projection matrix to generate a dimensionality-reduced dataset.
[0172] In one embodiment, the stealth feature extraction module includes:
[0173] The time series decomposition unit is used to perform time series decomposition on the dimensionality-reduced dataset to generate seasonal components.
[0174] The periodic intensity calculation unit is used to calculate the periodic intensity of the seasonal component and generate periodic fluctuation characteristics.
[0175] The correlation analysis unit is used to perform correlation analysis on the data of each item in the dimensionality-reduced dataset and generate an item association matrix.
[0176] The clustering processing unit is used to cluster the project association matrix and generate project association features;
[0177] The feature merging unit is used to merge periodic fluctuation features and project-related features to generate a set of hidden features.
[0178] In one embodiment, the clustering processing unit includes:
[0179] The graph structure transformation subunit is used to transform the project association matrix into a graph structure to generate a project relationship diagram.
[0180] The community discovery subunit is used to perform community discovery based on the project relationship graph and generate project clustering results.
[0181] The weighted filtering subunit is used to filter the project clustering results based on the weight coefficients of each project cluster, and to confirm the clustering results of projects with weight coefficients greater than a preset threshold as project association features; the weight coefficients are calculated using the following formula:
[0182]
[0183] in, Clustering in the project clustering results The weighting coefficients, This represents the number of items in the cluster. For projects in the project association matrix and projects The correlation coefficient.
[0184] In one embodiment, the initial model training module includes:
[0185] The dataset partitioning unit is used to partition the set of latent features into training and validation sets.
[0186] The base learner training unit is used to train base learners based on the training set, generating multiple weak learners.
[0187] An ensemble learning unit is used to integrate multiple weak learners to generate a strong learner.
[0188] The hyperparameter tuning unit is used to tune the hyperparameters of the strong learner using the validation set and generate an initial prediction model.
[0189] In one embodiment, the reliable feature screening module includes:
[0190] The importance distribution calculation unit is used to calculate the mean and standard deviation of the importance scores of all features, and generate importance distribution parameters;
[0191] The reliability score calculation unit is used to calculate the reliability score of each feature in the latent feature set based on the importance distribution parameter, generating a reliability score set; the reliability score is calculated using the following formula:
[0192]
[0193] in, Features Reliability score, Features Importance score The mean of the importance scores for all features. The standard deviation of the importance scores for all features;
[0194] The candidate feature filtering unit is used to filter out features with a reliability score greater than a preset reliability threshold based on the reliability score set, and generate a subset of candidate features.
[0195] The multicollinearity test unit is used to perform multicollinearity tests on candidate feature subsets and generate reliable feature subsets.
[0196] In one embodiment, the parameter optimization module includes:
[0197] The regularization coefficient calculation unit is used to calculate the regularization intensity adjustment coefficient based on the stability index and generate the adjustment coefficient value.
[0198] The regularization enhancement unit is used to perform regularization enhancement on the weight parameters corresponding to the reliable feature subset in the initial prediction model based on the adjustment coefficient value, and generate enhanced weight parameters.
[0199] The model iterative update unit is used to iteratively update the initial prediction model based on the enhanced weight parameters and the training set containing a reliable feature subset, and generate an intermediate prediction model.
[0200] The prediction variance calculation unit is used to calculate the variance of the output of the intermediate prediction model on the validation set and generate a prediction variance sequence.
[0201] The stability judgment unit is used to judge the stability convergence based on the predicted variance sequence. When it is confirmed that the intermediate prediction model has reached a stable state, the intermediate prediction model is output as the optimized prediction model.
[0202] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of a machine learning-based financial cost prediction method as described above.
[0203] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of a machine learning-based financial cost prediction method as described above.
[0204] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0205] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.
Claims
1. A financial cost prediction method based on machine learning, characterized in that, The method includes: The dimensionality-reduced dataset is obtained by performing dimensionality reduction processing on the company's financial data. Latent feature analysis is performed on the dimensionality-reduced dataset to generate a set of latent features containing periodic fluctuation features and project association features; The model is trained based on the set of hidden features to generate an initial prediction model; The feature importance of each latent feature in the initial prediction model is analyzed and scored to obtain the feature importance score of each latent feature; Based on the feature importance score, reliable feature filtering is performed on the set of hidden features to obtain a reliable feature subset; The initial prediction model is validated across scenarios using the reliable feature subset to generate a stability index. The parameters of the initial prediction model are optimized based on the stability index to generate an optimized prediction model. Input real-time financial data into the optimized prediction model to output cost prediction results.
2. The method according to claim 1, characterized in that, The step of performing dimensionality reduction processing on the enterprise's financial data to obtain a dimensionality-reduced dataset includes: The enterprise's financial data is standardized to generate standardized data; The covariance of the standardized data is calculated to generate a covariance matrix; The covariance matrix is decomposed into eigenvalues to generate eigenvalues and eigenvectors; Principal component screening is performed based on the eigenvalues to generate a projection matrix; The standardized data is linearly transformed using the projection matrix to generate the dimensionality-reduced dataset.
3. The method according to claim 1, characterized in that, The step of performing latent feature analysis on the dimensionality-reduced dataset to generate a latent feature set containing periodic fluctuation features and project association features includes: The dimensionality-reduced dataset is decomposed into time series components to generate seasonal components; The periodic intensity of the seasonal components is calculated to generate periodic fluctuation characteristics; Correlation analysis is performed on the data of each item in the dimensionality-reduced dataset to generate an item association matrix; Cluster the project association matrix to generate project association features; The periodic fluctuation features and project-related features are merged to generate the set of hidden features.
4. The method according to claim 3, characterized in that, The step of clustering the project association matrix to generate project association features includes: The project association matrix is transformed into a graph structure to generate a project relationship diagram; Community discovery is performed based on the project relationship graph, and project clustering results are generated. Based on the weight coefficients of each project cluster, the project clustering results are filtered, and the project clustering results with weight coefficients greater than a preset threshold are confirmed as the project association features; the weight coefficients are calculated using the following formula: in, Clustering in the clustering results of the project The weighting coefficients, This represents the number of items in the cluster. For the items in the project association matrix and projects The correlation coefficient.
5. The method according to claim 1, characterized in that, The step of training the model based on the set of hidden features to generate an initial prediction model includes: The set of hidden features is divided into a dataset to generate a training set and a validation set; Based on the training set, a base learner is trained to generate multiple weak learners; The multiple weak learners are integrated to generate a strong learner; The strong learner is hyperparameter-tuned using the validation set to generate the initial prediction model.
6. The method according to claim 1, characterized in that, The reliable feature subset is obtained by performing reliable feature filtering on the latent feature set based on the feature importance score, including: The mean and standard deviation of the importance scores of all the aforementioned features are calculated to generate importance distribution parameters; Based on the importance distribution parameters, the reliability score of each feature in the latent feature set is calculated to generate a reliability score set; the reliability score is calculated using the following formula: in, Features Reliability score, Features Importance score The mean of the importance scores for all features. The standard deviation of the importance scores for all features; Based on the set of reliability scores, features with reliability scores greater than a preset reliability threshold are selected to generate a subset of candidate features; A multicollinearity test is performed on the candidate feature subset to generate the reliable feature subset.
7. The method according to claim 1, characterized in that, The step of adjusting the parameters of the initial prediction model according to the stability index to generate an optimized prediction model includes: Calculate the regularization intensity adjustment coefficient based on the stability index, and generate the adjustment coefficient value; Based on the adjustment coefficient value, the weight parameters corresponding to the reliable feature subset in the initial prediction model are regularized and enhanced to generate enhanced weight parameters. Based on the enhanced weight parameters and the training set containing the reliable feature subset, the initial prediction model is iteratively updated to generate an intermediate prediction model; The variance of the intermediate prediction model's output on the validation set is calculated to generate a prediction variance sequence; Based on the predicted variance sequence, stability convergence is determined. When it is confirmed that the intermediate prediction model has reached a stable state, the intermediate prediction model is output as the optimized prediction model.
8. A financial cost prediction device based on machine learning, characterized in that, The device includes: The data dimensionality reduction module is used to perform dimensionality reduction processing on enterprise financial data to obtain a dimensionality-reduced dataset. The latent feature extraction module is used to perform latent feature analysis on the dimensionality-reduced dataset to generate a set of latent features containing periodic fluctuation features and project association features. The initial model training module is used to train the model based on the set of hidden features and generate an initial prediction model. The feature importance scoring module is used to analyze and score the feature importance of each latent feature in the initial prediction model to obtain the feature importance score of each latent feature. A reliable feature filtering module is used to perform reliable feature filtering on the set of hidden features based on the feature importance score, so as to obtain a reliable feature subset; The cross-scenario verification module is used to perform cross-scenario verification on the initial prediction model using the reliable feature subset and generate a stability index. The parameter optimization module is used to optimize the parameters of the initial prediction model according to the stability index, and generate an optimized prediction model. The cost forecasting module is used to input real-time financial data into the optimized forecasting model and output cost forecasting results.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.