Data analysis: quantitative evaluation process in complex business scenarios

Source code of this article: GitHub·click here || GitEE·click here

1. Quantitative thinking

There are many complex businesses in the programming system that are difficult to understand, but a quantitative analysis is needed to give business personnel or operations or users a reference standard, such as common index, sesame score, store level, such business evaluation standards Very complicated, because there are many factors that affect the results.

In the multi-dimensional business consideration model, there is a core concept called weight, which refers to the importance of a certain factor or indicator relative to a certain thing. It is different from the general proportion and reflects more than just a certain factor or indicator. The percentage that emphasizes the relative importance of factors or indicators, and tends to contribute to or importance. Under normal circumstances, the weight of each dimension is between 0-1, and the sum of the weights of all dimensions is 1.

The concept of weight can be analyzed from a practical case. For example, to determine whether a customer is a key operation object, it is usually considered in terms of the number of logins per week, online duration, transaction volume, etc. If customer A logs in frequently, but does not have core business transactions , Customer B rarely logs in, but business transactions are high, so the weight of the number of logins here should be lower than the dimension of transaction volume.

How to determine the proportion of weights usually has two ideas. One is to learn from the experience provided by professional business personnel and put it into the business to continuously try to optimize; second, to calculate the weight of each dimension based on the analysis data of the product, it also needs to be tried in the business. optimization.

In fact, the quantification process of complex business scenarios is complicated and lengthy. It is necessary to collect data in multiple dimensions. Sometimes not only periodic quantification is required, such as the credit scores of several large factories, but there may also be real-time analysis scenarios. For fraud risk control in financial business, there are also two comprehensive real-time recommendation systems for scenarios, both of which use quantitative processes.

Two, scene case

1. Comprehensive assessment

Comprehensive evaluation of multiple scenarios such as users, shops, products, and abstract analysis of a complex thing through multiple dimensions to generate simple and easy-to-understand evaluation results, such as store level, product rating, user comprehensive index, etc., and then use each The basis of the scene generation reference. It may be easy to understand from the results, but the analysis process to obtain the results is relatively complicated. Some scenarios may require periodic execution of the evaluation model, some scenarios may require real-time calculations, or a combination of the two situations that is dependent. Periodic evaluation also needs to refer to real-time calculations.

2. Scene recommendation

This scenario is relatively complex. For example, the user performs a search, but a series of exclusions or necessary conditions are checked. This is very common in search functions. When processing, it is not only necessary to perform the highest matching analysis on the user’s search conditions. , And perform the optimal ranking based on the search results. There are two stages of evaluation. The first stage matches the optimal search conditions, and the second stage performs the most optimal ranking of the matching results to give the user what the user wants. search results.

3. Risk control score

In the financial field, this is a very common risk control model that counts users in multiple dimensions, scores the dimensions, and then adds them together. The higher the risk control score, the greater the risk of the user, thereby preventing high-risk transactions. .

4. Financial Index

This scenario is very common. In financial management apps, an evaluation system must be passed before use to judge the user’s risk tolerance: for example, conservative, proactive, etc. When the product purchased by the user is high-risk, it will prompt and The user’s risk tolerance does not match, and the user is prompted to re-evaluate.

Three, realization of ideas

1. Dimension rule table

Maintain a dimensional evaluation rule table, classify_sign is understood as a division identifier in the same business scenario, and weight identifies the proportion of the dimension in the evaluation.

CREATE TABLE `evaluate_rule` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `classify_sign` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '归类标识',
  `rule_value` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '规则描述',
  `rule_type` int(1) DEFAULT NULL COMMENT '规则类型:1精准匹配,2范围,3模糊',
  `weight` decimal(10,2) DEFAULT '0.00' COMMENT '权重分布',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='评估项规则';

2. Describe the rules

For the specific description of the rule, the core is two fields, the rule value and the result obtained by matching the rule.

public class RuleValue {
    
    
    /**
     * 规则值描述
     */
    private Object ruleValue ;
    /**
     * 规则匹配结果
     */
    private Object ruleResult ;
    // 基础构造
    public RuleValue(Object ruleValue, Object ruleResult) {
    
    
        this.ruleValue = ruleValue;
        this.ruleResult = ruleResult;
    }
    // 省略 Get 和 Set
}

3. Package matching value

In order to simplify the complexity of parameter transmission in the model, the data of the matching factors are uniformly encapsulated in a data model. Here, the two factors of city and label are used for process testing.

public class MatchItem {
    
    
    // 城市
    private String city ;
    // 标签
    private String tag ;
    // 基础构造
    public MatchItem(String city, String tag) {
    
    
        this.city = city;
        this.tag = tag;
    }
    // 省略 Get 和 Set
}

4. Evaluation logic implementation

Here is just a simple implementation description for the two situations. In the actual development scenario, the data and matching specifications are very complex, and the entire evaluation model implementation process needs to be continuously optimized.

@Service
public class AssessBizService {
    
    

    private static Logger LOG = LoggerFactory.getLogger(AssessBizService.class);

    @Resource
    private EvaluateRuleDao evaluateRuleDao ;

    /**
     * 业务评估流程
     */
    public void assessBiz (MatchItem matchItem){
    
    
        // 精准匹配城市
        EvaluateRuleEntity evaluateRule01 = evaluateRuleDao.getBySign("assess-biz",1);
        List<RuleValue> cityRuleList = JSONArray.parseArray(evaluateRule01.getRuleValue(), RuleValue.class);
        for (RuleValue cityRule:cityRuleList){
    
    
            if (cityRule.getRuleValue().equals(matchItem.getCity())){
    
    
                int result = Integer.parseInt(String.valueOf(cityRule.getRuleResult()));
                LOG.info("匹配项:{},匹配结果:{}",matchItem.getCity(),result*evaluateRule01.getWeight());
                break ;
            }
        }
        // 模糊匹配标签
        EvaluateRuleEntity evaluateRule02 = evaluateRuleDao.getBySign("assess-biz",3);
        List<RuleValue> tagRuleList = JSONArray.parseArray(evaluateRule02.getRuleValue(), RuleValue.class);
        for (RuleValue tagRule:tagRuleList){
    
    
            if (String.valueOf(tagRule.getRuleValue()).contains(matchItem.getTag())){
    
    
                int result = Integer.parseInt(String.valueOf(tagRule.getRuleResult()));
                LOG.info("匹配项:{},匹配结果:{}",matchItem.getTag(),result*evaluateRule02.getWeight());
                break ;
            }
        }
    }

}

Fourth, the source code address

GitHub·地址
https://github.com/cicadasmile/data-manage-parent
GitEE·地址
https://gitee.com/cicadasmile/data-manage-parent

Recommended reading: finishing programming system

Serial number project name GitHub address GitEE address Recommended
01 Java describes design patterns, algorithms, and data structures GitHub·click here GitEE·Click here ☆☆☆☆☆
02 Java foundation, concurrency, object-oriented, web development GitHub·click here GitEE·Click here ☆☆☆☆
03 Detailed explanation of SpringCloud microservice basic component case GitHub·click here GitEE·Click here ☆☆☆
04 SpringCloud microservice architecture actual combat comprehensive case GitHub·click here GitEE·Click here ☆☆☆☆☆
05 Getting started with SpringBoot framework basic application to advanced GitHub·click here GitEE·Click here ☆☆☆☆
06 SpringBoot framework integrates and develops common middleware GitHub·click here GitEE·Click here ☆☆☆☆☆
07 Basic case of data management, distribution, architecture design GitHub·click here GitEE·Click here ☆☆☆☆☆
08 Big data series, storage, components, computing and other frameworks GitHub·click here GitEE·Click here ☆☆☆☆☆

Guess you like

Origin blog.csdn.net/cicada_smile/article/details/110500162