Payment channel routing method and device, computer equipment and storage medium
By using multiple prediction models to analyze and predict transaction data and payment channel status, the integration of results and select payment channels is solved, and the traditional payment channel selection method is inefficient and insufficient accuracy is achieved, and more efficient and reliable payment routing is achieved.
Patent Information
- Application Number
- CN202411902079.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-25
AI Technical Summary
Traditional payment channel selection methods rely on manual configuration and maintenance, resulting in inefficiency, difficulty in responding to business changes quickly, and manual judgments have limitations, resulting in low accuracy of payment routing and increasing the risk of transaction failure.
Multiple prediction models (decision tree model, neural network model and logistic regression model) are used to analyze and predict transaction data and payment channel status, and the prediction scores of payment channels are determined by integrating the results of each model, thereby selecting the optimal payment channel.
It improves the prediction accuracy and reliability of payment channels, reduces the risk of transaction failure, improves the efficiency of payment routing, and can quickly adapt to various complex transaction situations and changes in payment channels.
Smart Images

Figure CN119887191A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a payment channel routing method, apparatus, computer equipment and storage medium. Background Art
[0002] In current Internet companies, especially those that need to use multiple external payment channels for credit business, they are faced with the problem of how to choose the best payment channel from multiple payment channels. Among them, the payment channel refers to the way or channel through which funds are transferred from the payer to the payee when consumers make payment operations. It is a bridge connecting the two parties of payment and realizing the flow of funds.
[0003] Traditional payment methods mainly rely on operators to manually configure and maintain channel lists and screening rules. Operators set payment channel priorities, rates and other rules in advance based on experience and business needs. When there is a payment request, the system selects the payment channel based on these manually configured rules to complete the fund transfer operation.
[0004] However, the process of manually configuring and maintaining channel lists and screening rules in traditional solutions is cumbersome and time-consuming, especially when facing a large number of payment requests or when the rules need to be adjusted frequently. The efficiency is obviously insufficient and it is difficult to respond quickly to business changes. In addition, human experience and judgment have limitations and may not fully consider various complex business scenarios and real-time changing factors, resulting in low accuracy of payment routing and increased risk of transaction failure. Summary of the invention
[0005] Based on this, it is necessary to provide a payment channel routing method, device, computer equipment and storage medium that can improve the accuracy of payment channels in response to the above technical problems.
[0006] In a first aspect, the present application provides a payment channel routing method, comprising:
[0007] In response to the payment request, obtaining current transaction data and status data of at least one payment channel;
[0008] Input the current transaction data and the status data of the payment channel into multiple pre-trained prediction models to obtain prediction results corresponding to each prediction model. The multiple prediction models include a decision tree model, a neural network model, and a logistic regression model. The prediction model is trained based on historical transaction data and historical status data of the payment channel. The prediction results include the initial score of the payment channel.
[0009] The prediction results of each prediction model are integrated to obtain the prediction score of the payment channel;
[0010] A target payment channel is determined according to the predicted score of the payment channel, and the payment request is sent to the target payment channel so that the payment request is processed through the target payment channel.
[0011] In one embodiment, the payment channel routing method further includes:
[0012] Collect historical transaction data and historical status data of payment channels;
[0013] Extract key features based on historical transaction data and historical status data of payment channels;
[0014] Encode and normalize key features;
[0015] Combining the encoded and normalized features into a feature vector in a preset order;
[0016] The feature vectors are used to train the decision tree model, neural network model and logistic regression model respectively.
[0017] In one embodiment, the encoded and normalized features are combined into a feature vector in a preset order, including:
[0018] Arrange the encoded and normalized features in a preset order to form a feature vector, wherein the preset order includes the order of feature weight values from large to small and / or the order of feature acquisition time.
[0019] In one embodiment, the prediction results corresponding to each prediction model are integrated to obtain the prediction score of the payment channel, including:
[0020] Get the prediction results of each prediction model corresponding to the current payment channel;
[0021] According to the preset weight values of each prediction model, the weighted average of the prediction results of each prediction model for the current payment channel is calculated to obtain the prediction score of the current payment channel;
[0022] Determine the target payment channel based on the predicted score of the payment channel, including:
[0023] Select the payment channel with the highest predicted score as the target payment channel.
[0024] In one embodiment, the payment channel routing method further includes:
[0025] Initialize the parameters of the prediction model;
[0026] Determine the value of the loss function of the prediction model;
[0027] Calculate the gradient based on the value of the loss function;
[0028] According to the calculated gradient and the preset learning rate, the parameters of the prediction model are updated until the stopping condition is met. The stopping condition includes reaching a preset number of iterations or the change in the value of the loss function is less than a preset threshold.
[0029] In one embodiment, the payment channel routing method further includes:
[0030] Construct a joint objective function based on the parameters of each prediction model;
[0031] Calculate the value of the joint objective function using the current model parameters;
[0032] Calculate the gradient of the joint objective function with respect to each model parameter according to the value of the joint objective function;
[0033] According to the calculated gradient and the preset optimization algorithm, the parameters of each model are updated until the stopping condition is met. The stopping condition includes reaching a preset number of iterations or the change in the value of the joint objective function is less than a preset threshold.
[0034] In one embodiment, the payment channel routing method further includes:
[0035] Collect real-time transaction data from various payment channels;
[0036] Calculate the traffic load indicators of each payment channel based on the collected real-time transaction data;
[0037] The traffic allocation of each payment channel is adjusted according to the traffic load indicators of each payment channel and the pre-set traffic allocation strategy.
[0038] In a second aspect, the present application also provides a payment channel routing device, including:
[0039] An acquisition module, configured to acquire current transaction data and status data of at least one payment channel in response to a payment request;
[0040] A prediction module, which is used to input current transaction data and payment channel status data into multiple pre-trained prediction models to obtain prediction results corresponding to each prediction model. The multiple prediction models include a decision tree model, a neural network model, and a logistic regression model. The prediction model is trained based on historical transaction data and payment channel status data. The prediction results include the initial score of the payment channel.
[0041] The fusion module is used to fuse the prediction results corresponding to each prediction model to obtain the prediction score of the payment channel;
[0042] The routing module is used to determine the target payment channel according to the predicted score of the payment channel, and send the payment request to the target payment channel so that the payment request can be processed through the target payment channel.
[0043] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the payment channel routing method provided in any embodiment of the present application in the first aspect are implemented.
[0044] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the payment channel routing method provided in any embodiment of the present application in the first aspect.
[0045] The above-mentioned payment channel routing method, device, computer equipment and storage medium can analyze and predict transaction data and payment channel status from different angles by using multiple different prediction models, such as decision tree model, neural network model and logistic regression model, avoiding the limitations of a single model, thereby improving the accuracy and reliability of the prediction results. The results of each prediction model are integrated, the advantages of multiple models are comprehensively considered, and the prediction score of the payment channel is further optimized, so that the final target payment channel is more accurate. The prediction model is trained based on historical transaction data and historical status data of the payment channel, and can learn the characteristics and laws of the payment channel in different scenarios, so it can better adapt to various complex transaction situations and payment channel changes, and adjust the routing strategy in time. After responding to the payment request, the current transaction data and payment channel status can be quickly obtained, and the prediction results can be obtained through the trained model. The whole process does not require manual intervention, which greatly improves the efficiency of payment channel routing and shortens the transaction processing time. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of a payment channel routing method in some embodiments;
[0047] Figure 2 It is a structural block diagram of a payment channel routing device in some embodiments;
[0048] Figure 3 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In a first aspect, the present application provides a payment channel routing method, such as Figure 1 As shown, this method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0051] Step S11, in response to the payment request, obtaining current transaction data and status data of at least one payment channel.
[0052] Among them, the current transaction data refers to the collection of various specific information related to the payment transaction when the payment request is initiated at the moment. This information can reflect the basic situation and characteristics of the transaction. Specifically, the current transaction data may include the transaction amount, transaction time, payer information, payee information, transaction type, and product or service information. Among them, the payer information includes the payer's account number, identity identification information, such as bank card number, Alipay account number and corresponding real-name authentication information, which are used to verify the payer's identity and determine the source of funds. The payee information includes information such as the payee's account number, payment platform, etc., such as the merchant's WeChat payment merchant number, etc., to facilitate the accurate transfer of funds to the corresponding account.
[0053] Transaction type: For example, for consumer payments, remittances, payments, etc., consumer payments may give priority to commonly used quick payment channels, while remittances may focus on bank channels with strong security and compliance.
[0054] Product or service information (if it is a consumer transaction): covers product name, price, quantity, etc. When purchasing high-value goods, higher security requirements are placed on the payment channel.
[0055] Payment channels refer to the way or channel through which funds are transferred from the payer to the payee when consumers make payments. It is a bridge connecting the payee and the payment service provider, ensuring the safety, speed and convenience of the payment process. For example, payment channels may include online banking, Alipay and WeChat Pay.
[0056] The status data of payment channels refers to the actual situation of each available payment channel at present, reflecting whether it is capable of processing payment requests and its processing efficiency, stability, etc. The status data of payment channels may specifically include:
[0057] Channel availability: that is, whether the payment channel is open and available normally. For example, if a channel is unavailable during a bank system maintenance, this channel cannot be selected for payment.
[0058] Channel load: reflects the number of transactions currently processed by the channel, its busyness, etc. Excessive load may lead to slower processing speed or even freezes and delays. For example, a payment platform prompts that the current business is busy, which is a reflection of high load.
[0059] Channel fee rate: the fee ratio charged by each payment channel for different types of transactions. The fee rate is an important consideration when choosing a payment channel. Merchants may prefer channels with low fees to reduce costs.
[0060] Channel processing speed: reflects the average time and real-time processing efficiency of the payment channel in the past. For transactions with high demand for instant payment, channels with fast processing speed should be given priority.
[0061] Channel security level: involves the assessment of the channel's encryption measures, risk prevention and control capabilities, etc. For example, when it comes to large-value payments, channels with higher security levels should be selected to ensure the safety of funds.
[0062] Success rate: historical success rate and real-time success rate.
[0063] Processing time: average processing time and maximum processing time.
[0064] Historical transaction records: transaction volume, transaction amount, abnormal transactions, etc.
[0065] Specifically, when the user initiates a payment operation on the client and clicks the confirmation payment button to generate a payment request, the system receives the request signal and starts the data acquisition process. The database and backend system related to the transaction receive the acquisition instruction and search and extract the current transaction data information such as the transaction amount, transaction time, and payment recipient mentioned above according to the set data format and association relationship. Through the connection interface and monitoring module established with each payment channel, a query request is sent to each payment channel server or the corresponding management background to obtain the payment channel status data such as channel availability, load, and rate feedback.
[0066] Furthermore, the current transaction data and payment channel status data obtained are aggregated together, and format verification, data integrity check and other operations are performed to ensure that the data is accurate and meets the requirements of subsequent model input and other processing requirements. For example, check whether the transaction amount data format is correct, whether the payment channel status information is completely updated, etc. If any problems are found, they will be re-acquired or supplemented in a timely manner.
[0067] Step S12, input the current transaction data and the status data of the payment channel into multiple pre-trained prediction models to obtain prediction results corresponding to each prediction model. The multiple prediction models include a decision tree model, a neural network model and a logistic regression model. The prediction model is trained based on historical transaction data and historical status data of the payment channel. The prediction result includes an initial score of at least one payment channel.
[0068] Among them, the decision tree model is a machine learning model that makes decisions based on a tree structure. It divides the sample space by making conditional judgments on features and finally generates a decision tree. Each internal node is a test on an attribute, the branch is the test output, and the leaf node is a category or value.
[0069] The role of the decision tree model: It can handle classification and regression problems, can intuitively display the importance of data features and the decision-making process, quickly classify and predict data, and in payment channel routing, it can determine the appropriate payment channel based on transaction and channel characteristics.
[0070] Specifically, the application first preprocesses the historical transaction data and the historical status data of the payment channel, extracts features and divides the training set and the test set. Then, the appropriate feature is selected as the root node, the data set is divided according to the different values of the feature, and the decision tree is recursively constructed until the stopping condition is met, such as the node purity reaches a certain threshold or the depth of the tree reaches a preset value. Finally, the trained decision tree is used to predict the input current transaction data and payment channel status to obtain the initial score of the payment channel.
[0071] The neural network model is a machine learning model that imitates the structure and function of biological neural networks. It is composed of a large number of neurons connected to each other. It realizes nonlinear mapping and feature learning of data by performing weighted summation of input data, activation function processing and other operations.
[0072] The role of the neural network model: It can automatically learn complex patterns and feature relationships in the data, has a strong fitting ability for nonlinear problems, can mine the potential correlation between transaction data and channel status in payment channel routing, and more accurately predict the quality of payment channels.
[0073] Specifically, this application performs preprocessing and feature extraction on historical data, and then initializes the weights and bias parameters of the neural network. The processed historical data is input into the neural network, and the output result is calculated through forward propagation, and the loss function value is calculated by comparing with the real label. Then, back propagation is performed according to the loss function value, and the weights and bias parameters are updated. The training is continuously iterated until the model converges. Finally, the current transaction data and payment channel status are input into the trained neural network to obtain the initial score of the payment channel.
[0074] The logistic regression model is a generalized linear model used to solve binary or multi-classification problems. It predicts the probability of an event by fitting a logistic function and converts the input features into probability values through a logistic function after linear combination.
[0075] The role of the logistic regression model: In payment channel routing, the probability of different payment channels being selected can be calculated based on transaction and channel characteristics, providing a basis for selecting the optimal payment channel.
[0076] Specifically, the present application can perform preprocessing operations such as cleaning and feature selection on historical data, and divide the data into a training set and a test set. The training set data is used to estimate the parameters of the logistic regression model, and the parameter value that maximizes the likelihood function is found through methods such as maximum likelihood estimation or gradient descent. The current transaction data and payment channel status are input into the trained logistic regression model to calculate the initial score of the payment channel.
[0077] Among them, the initial score refers to the score obtained by each model when predicting the current transaction data and payment channel status, which is the score before integration.
[0078] Step S13, integrating the prediction results corresponding to each prediction model to obtain the prediction score of the payment channel.
[0079] The prediction score is the score after integrating the prediction results of each model.
[0080] Specifically, this application can be integrated in the following ways:
[0081] First, the initial scores of each prediction model for the same payment channel are directly added together, and then divided by the number of prediction models to obtain the prediction score of the payment channel. This method treats each model equally, does not distinguish between the advantages and disadvantages of the model, and is simple and direct to operate.
[0082] Second, voting fusion. It is applicable to classification problems. When multiple prediction models classify and predict payment channels, the category with the most occurrences in the prediction results of each model is counted as the final fusion result. For example, if three models predict payment channels as A, A, and B respectively, then A is finally determined.
[0083] Third, stacking fusion. The outputs of multiple prediction models are used as new features, and then a meta-model is trained for fusion. First, each basic prediction model is trained with training data, and then the prediction results of these models on the training data are used as new features to train the meta-model together with the labels of the original training data. Finally, the meta-model is used to predict the test data to obtain the fusion result.
[0084] Fourth, fusion based on confidence. Fusion is performed based on the confidence of each prediction model in its own prediction results. If a model has a high confidence in its prediction results, it will be given a greater weight or more decision-making power; if the confidence is low, its influence will be reduced accordingly.
[0085] Fifth, Bayesian model average fusion. Based on Bayesian statistical theory, multiple prediction models are weighted averaged and fused. The weight is determined by the posterior probability of each model under given data. The posterior probability is obtained by calculating the likelihood function and prior probability of the model, and then the fusion weight is determined.
[0086] Step S14, determining a target payment channel according to the predicted score of the payment channel, and sending the payment request to the target payment channel so that the payment request is processed through the target payment channel.
[0087] Among them, this application can select the payment channel with the highest prediction score as the target payment channel according to the prediction scores of each payment channel, and route the payment request to the target payment channel so that the payment request can be processed through the target payment channel.
[0088] In one of the embodiments, the payment channel routing method may also include: collecting historical transaction data and historical status data of the payment channel, extracting key features based on the historical transaction data and the historical status data of the payment channel, encoding and normalizing the key features, combining the encoded and normalized features into a feature vector in a preset order, and using the feature vector to respectively train a decision tree model, a neural network model, and a logistic regression model.
[0089] Specifically, the server collects historical transaction data and historical status data of payment channels from relevant systems, databases and other sources to ensure the accuracy and completeness of the data and to organize the data. Use appropriate data analysis methods, algorithms or business experience to screen and extract key features that can reflect the transaction status and payment channel status from the two types of historical data collected, such as transaction amount, transaction time, success rate of payment channels and other features. For the extracted key features with categorical properties (such as payment channel type, etc.), use appropriate encoding methods such as unique hot encoding and label encoding to convert them into numerical forms that can be processed by computers.
[0090] Furthermore, for key numerical features (such as transaction amounts, etc.), methods such as minimum-maximum normalization and Z-score standardization are used to map feature values to specific intervals (commonly [0,1] intervals, etc.), unify data scales, and avoid adverse effects on subsequent model training due to differences in dimensions, etc. In a pre-set order, the encoded and normalized features are orderly combined to form feature vectors, and each sample corresponds to a feature vector.
[0091] Furthermore, the feature vectors are used as input, and the decision tree model, neural network model and logistic regression model are trained by using appropriate training algorithms, data set partitioning (such as partitioning into training set, validation set, and test set), and other means, and the parameters of the model are continuously adjusted until the expected training effect is achieved (such as indicators such as accuracy meet the requirements).
[0092] The beneficial effects of this embodiment are:
[0093] By collecting multi-dimensional historical data and extracting key features, we can discover the patterns and information hidden in the data, provide more comprehensive and effective input for the model, and help improve the accuracy of each model in predicting transaction-related situations, payment channel status, etc.
[0094] Training multiple different types of models (decision trees, neural networks, logistic regression) at the same time can leverage the advantages of each model, making them more applicable in different scenarios and data distributions, adapting to more complex and changing actual business environments, and improving the versatility of the overall solution.
[0095] It is convenient to compare the performance of different models, select the model that best suits specific business needs based on evaluation indicators, or further optimize the models by integrating and improving them, which is conducive to continuously improving the quality of analysis and prediction related to transactions and payment channels.
[0096] Encoding and normalization make the data more standardized, which can avoid difficulties in model training due to differences in the magnitude and type of data features, making the model training process more stable and converging faster, thereby improving the efficiency and effectiveness of model training.
[0097] In one embodiment, the encoded and normalized features are combined into a feature vector in a preset order, including: arranging the encoded and normalized features in a preset order to form a feature vector, wherein the preset order includes the order of feature weight values from large to small and / or the order of feature acquisition time.
[0098] Among them, the order of feature weight values from large to small means: determine the importance of each key feature to the target to be predicted (such as payment risk situation, transaction success or failure, etc.) in advance based on business understanding, data analysis, etc., that is, the weight, and then arrange these features in order from high to low weight, and put more important features in the front position of the feature vector.
[0099] The order of feature acquisition time means: arranging the key feature data in the order of their acquisition time, for example, the transaction amount feature acquired first is arranged in front, and the payment channel response time feature acquired later is arranged in the back, etc. This is an arrangement rule based on time order.
[0100] Specifically, the server pre-sets feature weights. The importance of each key feature to the target task (such as predicting transaction success rate, etc.) can be evaluated based on business expert experience and data analysis methods (such as correlation coefficient analysis, model-based feature importance evaluation, etc.), and a corresponding weight value can be assigned to each key feature.
[0101] Furthermore, check the timestamps and other relevant time record information when each key feature data is collected, and sort out the order in which each feature data is obtained. If the order is from large to small in terms of weight value, the key features are arranged in order according to the determined weights; if the order is in terms of acquisition time, the key features are arranged one by one in the sorted order, and finally an ordered feature vector is formed. The position of each feature in the vector is determined according to the preset order rule.
[0102] The beneficial effect of this embodiment is that by setting a preset order, it is ensured that the dimension of the feature vector of each sample is consistent and the feature order is the same.
[0103] In one of the embodiments, the prediction results corresponding to each prediction model are integrated to obtain a prediction score of the payment channel, including: obtaining the prediction results of each prediction model corresponding to the current payment channel, calculating the weighted average of the prediction results of each prediction model for the current payment channel according to the preset weight values of each prediction model, and obtaining the prediction score of the current payment channel; and determining the target payment channel according to the prediction score of the payment channel, including: selecting the payment channel with the highest prediction score as the target payment channel.
[0104] Specifically, for the current payment channel, the relevant data is input into each trained prediction model (such as a decision tree model, a neural network model, a logistic regression model, etc.), and these models are run to obtain the prediction results corresponding to each model. These results may be numerical or categorical representations of certain aspects of the payment channel status (such as risk level, success rate, etc.).
[0105] Furthermore, the weight of each prediction model in the comprehensive decision-making is clarified based on pre-set rules or through historical data verification, business experience, etc. For example, the weight of the decision tree model is 0.3, the weight of the neural network model is 0.5, the weight of the logistic regression model is 0.2, etc., and the sum of all weight values should be 1.
[0106] Furthermore, the prediction results obtained by each prediction model are multiplied by their corresponding weight values, and then these products are added together. The result is the weighted average of the prediction results of each prediction model for the current payment channel. This average value is the prediction score of the current payment channel. The calculation formula can be expressed as (model 1 prediction result × model 1 weight + model 2 prediction result × model 2 weight + ... + model n prediction result × model n weight).
[0107] Furthermore, the prediction scores corresponding to different payment channels are compared, and the payment channel with the highest prediction score is selected and determined as the target payment channel, that is, the payment channel that is preferentially recommended or selected for use in the current business scenario.
[0108] The beneficial effects of this embodiment are:
[0109] By integrating the results of multiple different prediction models and taking a weighted average according to their respective weights, we fully utilize the advantages and characteristics of each model and avoid the limitations and biases that may exist in a single model, making the final payment channel prediction score more reliable, thereby more accurately determining the better target payment channel.
[0110] Different prediction models have different algorithmic principles and are good at handling different situations. For example, the decision tree model is easy to explain, and the neural network model has strong capabilities in handling complex nonlinear relationships. This weighted fusion method can integrate the analysis results of payment channels from multiple models from different angles, and better cope with complex and changing payment business scenarios.
[0111] The weight value can be flexibly adjusted according to the actual business situation, model performance, etc. When a model is found to perform better in a specific business stage or data feature, its weight can be increased accordingly, so as to dynamically optimize the strategy for determining the target payment channel to adapt to the needs of business development and changes.
[0112] The calculated prediction score provides an intuitive quantitative comparison basis for different payment channels, which helps business personnel, decision makers, etc. to clearly understand the relative advantages and disadvantages of each payment channel under comprehensive evaluation, and helps to make more scientific and reasonable decisions on payment channel selection.
[0113] In one of the embodiments, the payment channel routing method may further include: initializing the parameters of the prediction model, determining the value of the loss function of the prediction model, calculating the gradient according to the value of the loss function, and updating the parameters of the prediction model according to the calculated gradient and a preset learning rate until a stopping condition is met, wherein the stopping condition includes reaching a preset number of iterations or the change in the value of the loss function is less than a preset threshold.
[0114] Specifically, for the selected prediction model (such as a neural network model, a logistic regression model, etc.), according to the structure of the model and corresponding requirements, each parameter in the model (such as weights and biases in the neural network) is assigned an initial random value or a specific default value so that it is in an initial operable state.
[0115] Furthermore, a suitable loss function is selected (for example, the mean square error loss function is used for regression problems, the cross entropy loss function is used for classification problems, etc.), the training data is input into the initialized prediction model, the prediction output of the model is obtained, and then the current loss function value is calculated according to the prediction output and the actual true label through the loss function calculation formula, so as to measure the degree of difference between the model prediction result and the actual situation.
[0116] Furthermore, mathematical methods such as differentiation are used (the back propagation algorithm is often used in deep learning) to obtain partial derivatives of each parameter of the model based on the current loss function value to obtain the gradient value corresponding to each parameter. The gradient reflects the direction of the rate of change of the loss function value as the parameter changes, and is used to guide the direction of parameter updating.
[0117] Furthermore, based on the calculated gradient and the pre-set learning rate (the learning rate is a hyperparameter that controls the parameter update step), the various parameters of the model are updated according to certain update rules (such as the parameter update formula in the common gradient descent algorithm: new parameter = old parameter - learning rate × gradient), so that the parameters of the model are adjusted in the direction that can reduce the value of the loss function.
[0118] After each parameter update, check whether the stopping condition is met. The stopping condition includes two aspects: one is to see whether the preset number of iterations has been reached (for example, the maximum number of iterations is preset to 1000, and the iteration stops when the number of iterations reaches 1000); the other is to observe the change of the value of the loss function. If the change of the loss function value in the process of multiple consecutive iterations is less than the preset threshold (for example, the change is less than 0.001), it means that the model performance has not been significantly improved, and the iteration process is stopped at this time.
[0119] The beneficial effects of this embodiment are:
[0120] By continuously updating the model parameters based on the feedback of the loss function, the model can gradually adjust its own structure to better fit the training data, reduce the difference between the predicted results and the actual results, and thus improve the accuracy and generalization ability of the model when dealing with practical problems (such as predicting payment channel-related situations, etc.).
[0121] Automatically updating parameters based on gradient and learning rate, without manually trying different parameter value combinations one by one, provides an efficient and automatic parameter optimization mechanism for the training of complex models (especially deep learning models often have a large number of parameters), greatly saving manpower and time costs. In one embodiment, the payment channel routing method may also include: constructing a joint objective function according to the parameters of each prediction model, calculating the value of the joint objective function using the current model parameters, calculating the gradient of the joint objective function to each model parameter according to the value of the joint objective function, and updating the parameters of each model according to the calculated gradient and the preset optimization algorithm until the stop condition is met, and the stop condition includes reaching a preset number of iterations or the change in the value of the joint objective function is less than a preset threshold.
[0122] Specifically, the present application can comprehensively consider the parameters of each prediction model, and according to business needs and optimization goals (such as comprehensively improving the accuracy of each model's prediction of payment channels, etc.), combine the objective functions related to each model through appropriate mathematical expressions to construct a joint objective function. For example, it may be in the form of a weighted sum of the objective functions of each model, and the weight of each part is determined according to factors such as the importance of each model.
[0123] Substitute the parameter values of the current models into the constructed joint objective function, perform calculations according to the calculation rules of the joint objective function, and obtain the corresponding joint objective function value to measure the overall performance of the current combination of model parameters (such as the degree of difference from the true value, etc.).
[0124] Using mathematical methods related to derivation, partial derivatives of the joint objective function are calculated for each parameter of each model, thereby obtaining the gradient value of the joint objective function to each model parameter. These gradient values reflect the direction of the rate of change of the joint objective function value with the change of each model parameter, indicating the direction for subsequent parameter updates.
[0125] Based on the calculated gradient and the pre-set optimization algorithm (such as the common stochastic gradient descent and other optimization algorithms, different optimization algorithms have different parameter update strategies), the parameters of each model are updated according to the rules of the corresponding algorithm, so that the parameters of each model are adjusted in the direction that can reduce the value of the joint objective function (that is, optimize the overall performance).
[0126] After each model parameter update, check whether the stop condition is met. First, check whether the preset number of iterations has been reached (for example, if the upper limit of the number of iterations is set to 500, stop when this number is reached); second, check the change of the value of the joint objective function. If its change in multiple consecutive iterations is less than the preset threshold (for example, the change is less than 0.001), it means that the overall performance improvement is no longer obvious, and the model parameter update process is stopped at this time.
[0127] The beneficial effects of this embodiment are:
[0128] By constructing a joint objective function, we can consider the overall performance of multiple different prediction models at the same time, optimize each model as an organic whole, avoid the incoordination that may occur when optimizing each model individually, and enable each model to better play its respective advantages when working together, thereby improving the overall accuracy and effectiveness of prediction tasks related to payment channels.
[0129] Calculating the gradient based on the joint objective function and updating the parameters of each model is an approach that seeks the optimal combination of parameters from a global perspective. Compared with optimizing each model individually, which may lead to a local optimal solution, it is more likely to find the parameter configuration that optimizes the overall performance of each model, thereby improving the adaptability of the model system in complex business scenarios.
[0130] The construction form of the joint objective function (such as changing the weight of each model in the joint objective function, etc.) and parameters such as the optimization algorithm can be flexibly adjusted according to business needs, so as to facilitate responses to business changes in different periods and characteristics of different payment channels, and ensure that the model system can always be better optimized and adjusted to meet actual business needs.
[0131] In one of the embodiments, the payment channel routing method further includes: collecting real-time transaction data of each payment channel, calculating the traffic load index of each payment channel based on the collected real-time transaction data, and adjusting the traffic distribution of each payment channel based on the traffic load index of each payment channel and a pre-set traffic distribution strategy.
[0132] Among them, the traffic load index is a quantitative index used to measure the business traffic pressure or load degree borne by the payment channel within a certain period of time. The traffic load index can specifically include the number of transaction requests, the total transaction amount, the transaction processing time, the system resource occupancy rate (such as CPU usage, memory usage, etc.), the number of concurrent transactions, etc. These indicators reflect the busyness and resource utilization of the payment channel from different angles.
[0133] Traffic distribution strategies can include:
[0134] Load balancing strategy: aims to distribute the traffic load of each payment channel as evenly as possible, avoid performance problems caused by excessive load on some channels, and ensure overall transaction processing efficiency. For example, when the traffic load indicator of a channel exceeds the set threshold, part of the traffic will be transferred to other channels with lighter loads.
[0135] Business priority-based strategy: Allocate traffic based on the importance or priority of the businesses supported by different payment channels. For payment channels corresponding to high-priority businesses, more traffic quotas are given to ensure the smooth progress of key businesses.
[0136] Strategy based on user preference: Consider the user's usage preferences and historical selection records for different payment channels, and allocate more traffic to payment channels commonly used by users to improve user experience and payment success rate.
[0137] Specifically, the present application can build a data collection system to obtain transaction data of each payment channel in real time, including transaction time, amount, channel type and other information. Based on the collected real-time transaction data, the flow load index of each payment channel is calculated using the corresponding calculation formula and algorithm. For example, the number of transaction requests within a certain period of time, the total transaction amount, etc. The calculated flow load index of each payment channel is matched with the pre-set flow distribution strategy to determine whether the current load conditions of each channel meet the conditions for policy adjustment. According to the matching results and flow distribution strategy, the flow of each payment channel is adjusted through corresponding technical means (such as routing algorithms, flow control valves, etc.) to achieve reasonable distribution of flow.
[0138] The beneficial effects of this embodiment are: avoiding resource bottlenecks due to excessive traffic in certain payment channels, improving overall resource utilization, and ensuring stable operation of the payment system. Dynamically adjusting traffic according to load conditions can reduce transaction waiting time and processing delays, improve transaction success rate and overall efficiency. Reasonable traffic allocation allows users to complete payments faster and reduce the negative experience caused by payment channel jams or failures.
[0139] In one of the embodiments, the present application can also regularly collect and count performance indicator data such as payment accuracy and time sensitivity of each payment channel, mark and analyze payment channel-related transaction data with payment accuracy lower than a preset accuracy threshold or time sensitivity higher than a preset time sensitivity threshold, determine key factors affecting performance based on the analysis results, such as specific transaction characteristics, payment channel status characteristics, etc., adjust the corresponding feature weights in the model based on these key factors, reduce the weight of features associated with low accuracy or high time sensitivity in the feature vector, use the adjusted feature vector and a sample set containing problematic payment channel transaction data to retrain the decision tree model, neural network model, and logistic regression model to optimize model parameters and improve the model's performance in terms of payment accuracy and time sensitivity. During the model retraining process, continuously monitor changes in performance indicators. When the payment accuracy reaches an acceptable level and the time sensitivity is reduced to a reasonable range, stop training and update the model parameters for subsequent payment channel routing decisions.
[0140] Through the above technical points, the model parameters can be dynamically adjusted according to key performance indicators such as payment accuracy and time sensitivity, making the payment channel routing method more intelligent, efficient and reliable, and adapting to the ever-changing payment business needs and environment.
[0141] In one of the embodiments, the present application can also determine the system performance indicators to be monitored. In addition to the mentioned response time and throughput, indicators such as CPU usage, memory occupancy, network bandwidth utilization, error rate, etc. can also be determined according to actual conditions to form a complete monitoring indicator system.
[0142] Select the appropriate monitoring tool based on the system architecture and technology stack. After selecting the monitoring tool, configure the systems, servers, network devices, etc. related to each payment channel according to the tool's instructions so that it can collect the corresponding performance indicator data at set time intervals (such as every 1 minute) and transmit the data to the designated data storage location (such as a database or the data warehouse that comes with the monitoring tool).
[0143] This application can also set a reasonable alarm threshold for each monitoring indicator, combining historical data, business requirements and the experience value of normal system operation. For example, if the average response time is within 1 second under normal circumstances, the alarm threshold can be set to 3 seconds, and an alarm will be triggered when this value is exceeded.
[0144] Furthermore, determine how to send the alarm information, common methods include text messages, emails, instant messaging tools (such as alarm robots on WeChat for Enterprise and DingTalk), etc., configure the corresponding receiving personnel or groups to ensure that the relevant responsible personnel can be notified in time.
[0145] This application can also classify abnormal situations based on past experience and analysis of possible problems in the system, such as performance abnormalities (too long response time, too low throughput, etc.), resource abnormalities (CPU overload, memory overflow, etc.), network abnormalities (network interruption, insufficient bandwidth, etc.), etc., to facilitate targeted processing measures.
[0146] Furthermore, specific processing strategies are formulated for different types of abnormal situations. For example, for performance-related abnormalities, we may first check whether there is a code performance bottleneck and try to optimize the relevant code logic; for resource-related abnormalities, we may consider increasing resource configuration (such as expanding memory, upgrading servers, etc.); for network-related abnormalities, we may check the network fault point and repair it.
[0147] In a second aspect, the present application provides a payment channel routing device, such as Figure 2 As shown, the payment channel routing device includes: an acquisition module 21, a prediction module 22, a fusion module 23 and a routing module 24, wherein:
[0148] An acquisition module 21, configured to acquire current transaction data and status data of at least one payment channel in response to a payment request;
[0149] The prediction module 22 is used to input the current transaction data and the status data of the payment channel into a plurality of pre-trained prediction models to obtain prediction results corresponding to each prediction model. The plurality of prediction models include a decision tree model, a neural network model and a logistic regression model. The prediction model is trained based on the historical transaction data and the historical status data of the payment channel. The prediction results include the initial score of the payment channel.
[0150] A fusion module 23 is used to fuse the prediction results corresponding to each prediction model to obtain the prediction score of the payment channel;
[0151] The routing module 24 is used to determine the target payment channel according to the predicted score of the payment channel, and send the payment request to the target payment channel so that the payment request is processed through the target payment channel.
[0152] In one of the embodiments, the acquisition module 21 can also collect historical transaction data and historical status data of payment channels, extract key features based on the historical transaction data and historical status data of payment channels, encode and normalize the key features, and combine the encoded and normalized features into feature vectors in a preset order, and use the feature vectors to train decision tree models, neural network models, and logistic regression models respectively.
[0153] In one embodiment, the acquisition module 21 can also arrange the encoded and normalized features in a preset order to form a feature vector, wherein the preset order includes the order of feature weight values from large to small and / or the order of feature acquisition time.
[0154] In one embodiment, the fusion module 23 can obtain the prediction results of each prediction model corresponding to the current payment channel, calculate the weighted average of the prediction results of each prediction model for the current payment channel according to the preset weight values of each prediction model, and obtain the prediction score of the current payment channel. The routing module 24 can select the payment channel with the highest prediction score as the target payment channel.
[0155] In one embodiment, the prediction module 22 can also initialize the parameters of the prediction model, determine the value of the loss function of the prediction model, calculate the gradient according to the value of the loss function, and update the parameters of the prediction model according to the calculated gradient and a preset learning rate until a stopping condition is met, wherein the stopping condition includes reaching a preset number of iterations or the change in the value of the loss function is less than a preset threshold.
[0156] In one embodiment, the prediction module 22 constructs a joint objective function based on the parameters of each prediction model, calculates the value of the joint objective function using the current model parameters, calculates the gradient of the joint objective function with respect to each model parameter based on the value of the joint objective function, and updates the parameters of each model based on the calculated gradient and a preset optimization algorithm until a stopping condition is met, wherein the stopping condition includes reaching a preset number of iterations or a change in the value of the joint objective function being less than a preset threshold.
[0157] In one of the embodiments, the prediction module 22 can also collect real-time transaction data of each payment channel, calculate the traffic load index of each payment channel based on the collected real-time transaction data, and adjust the traffic allocation of each payment channel based on the traffic load index of each payment channel and a pre-set traffic allocation strategy.
[0158] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the payment channel routing method provided in any embodiment of the present application in the first aspect are implemented.
[0159] In one embodiment, the computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the payment channel routing method is implemented.
[0160] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the payment channel routing method provided in any embodiment of the present application in the first aspect.
[0161] The computer readable storage medium may be Figure 3 A computer-readable storage medium in the computer device shown.
[0162] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0163] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0164] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A payment channel routing method, characterized in that: The method comprises: In response to the payment request, obtaining current transaction data and status data of at least one payment channel; Inputting the current transaction data and the status data of the payment channel into a plurality of pre-trained prediction models to obtain prediction results corresponding to the respective prediction models, wherein the plurality of prediction models include a decision tree model, a neural network model, and a logistic regression model, and the prediction models are trained based on historical transaction data and historical status data of the payment channel, and the prediction results include an initial score of the payment channel; The prediction results corresponding to each prediction model are integrated to obtain the prediction score of the payment channel; A target payment channel is determined according to the predicted score of the payment channel, and the payment request is sent to the target payment channel so that the payment request is processed through the target payment channel.
2. The method according to claim 1, characterized in that: The method further comprises: Collect historical transaction data and historical status data of payment channels; Extracting key features based on the historical transaction data and the historical status data of the payment channel; Encoding and normalizing the key features; Combining the encoded and normalized features into a feature vector in a preset order; The decision tree model, the neural network model and the logistic regression model are trained respectively using the feature vectors.
3. The method according to claim 1, characterized in that The step of combining the encoded and normalized features into a feature vector in a preset order includes: Arrange the encoded and normalized features in a preset order to form the feature vector, wherein the preset order includes the order of feature weight values from large to small and / or the order of feature acquisition time.
4. The method according to claim 1, characterized in that The step of fusing the prediction results corresponding to the various prediction models to obtain the prediction score of the payment channel includes: Get the prediction results of each prediction model corresponding to the current payment channel; According to the preset weight values of each prediction model, the weighted average value of the prediction results of each prediction model on the current payment channel is calculated to obtain the prediction score of the current payment channel; Determining the target payment channel according to the predicted score of the payment channel includes: The payment channel with the highest predicted score is selected as the target payment channel.
5. The method according to claim 1, characterized in that The method further comprises: Initializing parameters of the prediction model; Determining a value of a loss function of the prediction model; Calculate the gradient according to the value of the loss function; According to the calculated gradient and the preset learning rate, the parameters of the prediction model are updated until a stopping condition is met, wherein the stopping condition includes reaching a preset number of iterations or the change in the value of the loss function is less than a preset threshold.
6. The method according to claim 1, characterized in that The method comprises: Construct a joint objective function based on the parameters of each prediction model; Calculate the value of the joint objective function using the current model parameters; Calculating the gradient of the joint objective function with respect to each model parameter according to the value of the joint objective function; According to the calculated gradient and the preset optimization algorithm, the parameters of each model are updated until a stopping condition is met, wherein the stopping condition includes reaching a preset number of iterations or the change in the value of the joint objective function is less than a preset threshold.
7. The method according to claim 1, characterized in that The method further comprises: Collect real-time transaction data from various payment channels; Calculate the traffic load indicators of each payment channel based on the collected real-time transaction data; The traffic allocation of each payment channel is adjusted according to the traffic load indicators of each payment channel and the pre-set traffic allocation strategy.
8. A payment channel routing device, characterized in that: The device comprises: An acquisition module, configured to acquire current transaction data and status data of at least one payment channel in response to a payment request; A prediction module, used for inputting the current transaction data and the status data of the payment channel into a plurality of pre-trained prediction models, and obtaining prediction results corresponding to each prediction model, wherein the plurality of prediction models include a decision tree model, a neural network model and a logistic regression model, and the prediction model is trained based on historical transaction data and historical status data of the payment channel, and the prediction result includes an initial score of the payment channel; A fusion module, used to fuse the prediction results corresponding to each prediction model to obtain the prediction score of the payment channel; A routing module is used to determine a target payment channel according to the predicted score of the payment channel, and send the payment request to the target payment channel so that the payment request is processed through the target payment channel.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Payment interface market dynamic matching and optimizing method
CN120297969A
Payment routing optimization method and device and computer equipment
CN121120039A