Method and apparatus for risk identification
By using random coding and statistical coding to generate feature mapping sets in risk identification, combined with WOE or IV coding, the problems of low identification efficiency and high computing resource consumption of existing models are solved, and the accuracy of risk identification and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202210162714.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-22
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-02-22
AI Technical Summary
Existing machine learning models have low identification efficiency and consume large amounts of computing resources in risk identification, resulting in low risk identification accuracy.
By obtaining multiple features in the sample set, the number of categories of category features is determined and compared with the threshold, and a feature mapping set is generated using random coding or statistical coding, which is used to train and predict risk identification models. Random coding is suitable for categorical features with a small number of categories, and statistical coding is suitable for categorical features with a large number of categories. It is combined with WOE or IV coding methods to handle numerical features and missing data.
It improves the accuracy of risk identification, saves computing resources, improves the predictive performance and interpretability of the model, and reduces the risk of overfitting.
Smart Images

Figure CN114548765B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for constructing features in risk identification. Background Art
[0002] With the development of Internet business, various risk events (such as payment account theft, etc.) have emerged. In order to maintain the stability of the business platform, it is necessary to monitor the business (such as transactions) and identify illegal businesses in a timely manner.
[0003] With the rapid development of machine learning technology, models for risk identification can be used to identify risk events. However, the current method of using models to identify risk events is relatively inefficient, resulting in low accuracy in risk identification and a great consumption of system computing resources.
[0004] Therefore, there is an urgent need for solutions that can improve the machine learning model's ability to identify risk events and save computing resources. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for risk identification, comprising:
[0006] Acquire a sample set, each sample in the sample set includes multiple features;
[0007] For each category feature among the multiple features, determining the number of categories of the category feature in the sample set;
[0008] comparing the category number of the category feature with a category number threshold;
[0009] If the number of categories of the category feature is less than or equal to the category number threshold, encoding the category feature using a random encoding method to generate a feature mapping set for the category feature, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value; and
[0010] If the number of categories of the category feature is greater than the category number threshold, a statistical encoding method is used to encode the category feature to generate a feature mapping set for the category feature.
[0011] Optionally, the random encoding method includes, for each category of the category feature, determining a feature value corresponding to the category as a random number.
[0012] Optionally, using the statistical encoding method to encode the category feature includes:
[0013] Determining the total number of risky samples and the total number of non-risky samples in the sample set;
[0014] For each category of the categorical features:
[0015] Determine the number of risky samples and the number of non-risky samples under the category in the sample set;
[0016] Using the total number of risk samples and the number of risk samples in this category, determine the proportion of risk samples in this category;
[0017] Determine the risk-free sample percentage for the category using the total number of risk-free samples and the number of risk-free samples for the category; and
[0018] The proportion of risky samples and the proportion of non-risk samples are used to determine a feature value corresponding to the category.
[0019] Optionally, the statistical encoding method includes a weight of evidence WOE encoding method or an information value IV encoding method.
[0020] Optionally, using the WOE encoding method to encode the category feature includes:
[0021] The feature value f of the category feature with respect to the category is determined as:
[0022]
[0023] Optionally, encoding the category feature using the IV encoding method includes:
[0024] The feature value f of the category feature with respect to the category is determined as:
[0025]
[0026] Optionally, the plurality of features include numerical features, and the method further comprises determining a set of feature maps for the numerical features using the statistical encoding scheme.
[0027] Optionally, the method further comprises:
[0028] Binning the values of the numerical features, wherein the number of bins is greater than the category number threshold; and
[0029] Each bin is regarded as a category, and a feature mapping set of the numerical feature is determined using a statistical coding method.
[0030] Optionally, the method further comprises:
[0031] performing a truncation operation on the numerical feature; and
[0032] A set of feature maps for the truncated numerical features is determined using the statistical encoding method.
[0033] Optionally, the method further comprises:
[0034] For each feature of the plurality of features, determining the number of missing samples in the sample set that lack the feature;
[0035] Comparing the number of missing samples with a missing number threshold;
[0036] If the number of missing samples is greater than the missing number threshold, encoding the feature using the random encoding method; and
[0037] If the number of missing samples is less than or equal to the missing number threshold, the feature is encoded using the statistical encoding method.
[0038] Optionally, the method further comprises:
[0039] Using the feature map set to determine feature values corresponding to category features in a training sample set; and
[0040] The tree model is trained using the feature vectors corresponding to the training sample set.
[0041] Optionally, the method further comprises:
[0042] Using the feature mapping set to determine feature values corresponding to the category features in the sample set to be predicted; and
[0043] The feature vector corresponding to the sample set to be predicted is input into the trained tree model to perform risk identification prediction.
[0044] Optionally, the plurality of features include a numerical feature, wherein the numerical feature includes a plurality of numerical values within a period, and the method further includes:
[0045] Acquire multiple values of the numerical feature within a period from the sample set; and
[0046] A value is randomly selected from the multiple values as a feature value of the numerical feature in the period.
[0047] Optionally, the method further comprises:
[0048] Obtain a training sample set for training the model;
[0049] The training sample set includes risk-free transaction samples and risky transaction samples, and excludes unsuccessful transaction samples.
[0050] Optionally, the method further comprises:
[0051] A training sample set for risk identification is periodically acquired to train a model using the training sample set, wherein the period is one month.
[0052] Another aspect of the present disclosure provides a device for risk identification, comprising:
[0053] A module for acquiring a sample set, each sample in the sample set including a plurality of features;
[0054] A module for determining, for each category feature among the multiple features, the number of categories of the category feature in the sample set;
[0055] A module for comparing the number of categories of the category feature with a category number threshold;
[0056] a module for encoding the categorical feature using a random encoding method to generate a feature mapping set for the categorical feature if the number of categories of the categorical feature is less than or equal to the category number threshold, the feature mapping set comprising a mapping of each category in the categorical feature to a corresponding feature value; and
[0057] A module is used for encoding the category feature by using a statistical coding method to generate a feature mapping set for the category feature if the category number of the category feature is greater than the category number threshold.
[0058] Optionally, the random encoding method includes, for each category of the category feature, determining a feature value corresponding to the category as a random number.
[0059] Optionally, the module for encoding the category feature using the statistical encoding method includes:
[0060] A module for determining a total number of risky samples and a total number of non-risky samples in the sample set;
[0061] A module for performing the following operations for each category of the category features:
[0062] Determine the number of risky samples and the number of non-risky samples under the category in the sample set;
[0063] Using the total number of risk samples and the number of risk samples in this category, determine the proportion of risk samples in this category;
[0064] Determine the risk-free sample percentage for the category using the total number of risk-free samples and the number of risk-free samples for the category; and
[0065] The proportion of risky samples and the proportion of non-risk samples are used to determine a feature value corresponding to the category.
[0066] Optionally, the statistical encoding method includes a weight of evidence WOE encoding method or an information value IV encoding method.
[0067] Optionally, using the WOE encoding method to encode the category feature includes:
[0068] The feature value f of the category feature with respect to the category is determined as:
[0069]
[0070] Optionally, encoding the category feature using the IV encoding method includes:
[0071] The feature value f of the category feature with respect to the category is determined as:
[0072]
[0073] Optionally, the plurality of features include numerical features, and the apparatus further comprises a module for determining a set of feature maps for the numerical features using the statistical encoding method.
[0074] Optionally, the device further comprises:
[0075] a module for binning the values of the numerical features, wherein the number of bins is greater than the category number threshold; and
[0076] A module for treating each bin as a category and determining a feature mapping set of the numerical feature using a statistical coding method.
[0077] Optionally, the device further comprises:
[0078] A module for performing a truncation operation on the numerical feature; and
[0079] Means for determining a set of feature maps for the truncated numerical features using the statistical encoding scheme.
[0080] Optionally, the device further comprises:
[0081] A module for determining, for each feature of the plurality of features, the number of missing samples in the sample set that lack the feature;
[0082] A module for comparing the number of missing samples with a missing number threshold;
[0083] A module for encoding the feature using the random encoding method if the number of missing samples is greater than the missing number threshold; and
[0084] A module for encoding the feature using the statistical encoding method if the number of missing samples is less than or equal to the missing number threshold.
[0085] Optionally, the device further comprises,
[0086] A module for determining feature values corresponding to class features in a training sample set using the feature map set; and
[0087] A module for training a tree model using feature vectors corresponding to the training sample set.
[0088] Optionally, the device further comprises:
[0089] A module for using the feature map set to determine a feature value corresponding to a category feature in a sample set to be predicted; and
[0090] Used to input the feature vector corresponding to the sample set to be predicted into the trained tree model to perform risk identification prediction.
[0091] Optionally, the plurality of features include numerical features, the numerical features include a plurality of values within a period, and the apparatus further comprises:
[0092] A module for obtaining multiple values of the numerical feature within a period from the sample set; and
[0093] A module is used for randomly selecting a value from the multiple values as a feature value of the numerical feature in the period.
[0094] Optionally, the device further comprises:
[0095] A module for obtaining a training sample set for training a model;
[0096] The training sample set includes risk-free transaction samples and risky transaction samples, and excludes unsuccessful transaction samples.
[0097] Optionally, the device further comprises:
[0098] A module for periodically acquiring a training sample set for risk identification to train a model using the training sample set, wherein the period is one month.
[0099] Another aspect of the present disclosure provides a device for risk identification, comprising:
[0100] Processor; and
[0101] a memory arranged to store computer executable instructions which, when executed, cause the processor to:
[0102] Acquire a sample set, each sample in the sample set includes multiple features;
[0103] For each category feature among the multiple features, determining the number of categories of the category feature in the sample set;
[0104] comparing the category number of the category feature with a category number threshold;
[0105] If the number of categories of the category feature is less than or equal to the category number threshold, encoding the category feature using a random encoding method to generate a feature mapping set for the category feature, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value; and
[0106] If the number of categories of the category feature is greater than the category number threshold, a statistical encoding method is used to encode the category feature to generate a feature mapping set for the category feature. BRIEF DESCRIPTION OF THE DRAWINGS
[0107] Figure 1 is an illustration of a system for feature coding for risk identification according to aspects of the present disclosure.
[0108] Figure 2 is a graph of the distribution of transaction quantity over time according to an aspect of the present disclosure.
[0109] Figure 3 is a diagram of a system for model training / prediction for risk identification according to aspects of the present disclosure.
[0110] Figure 4 is a flow chart of a method of feature construction for risk identification according to aspects of the present disclosure.
[0111] Figure 5 is a diagram of an apparatus for feature construction for risk identification according to various aspects of the present disclosure. DETAILED DESCRIPTION
[0112] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0113] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0114] In risk identification, each sample (training sample or sample to be predicted) needs to be converted into a feature vector to be input into the model for training and prediction. For example, a sample can correspond to a transaction, and the sample can include multiple features, such as the IP addresses used by both parties to the transaction, the user's province, city, and historical transaction times.
[0115] Each feature of a transaction sample can be converted into a feature value, thereby converting a transaction sample into a feature vector [f1,f2,…f i ,…f n ], where n is the number of features included in the sample of the transaction, and element f i represents the eigenvalue corresponding to the i-th feature.
[0116] During the model training process, the feature vector corresponding to the sample of historical transactions and its label can be input into the model to train the model, and the label can indicate whether the transaction is a risky transaction or a risk-free transaction. For example, the label value of a risky transaction is 1, and the label value of a risk-free transaction is 0. Other label values are also within the conception of the present disclosure.
[0117] During the model prediction process, the feature vector corresponding to the sample of the transaction to be predicted can be input into the model to predict whether the transaction is risky.
[0118] The sample data used for risk identification has the following characteristics:
[0119] 1. Structured data. Structured data is a type of sampled sparse data provided in a tabular form.
[0120] 2. Some data samples (e.g., IP addresses) are difficult to convert into predictive features for use in the model.
[0121] 3. Label imbalance: Among the data samples used for risk identification, the vast majority are white samples (risk-free samples), while the concentration of black samples (risky samples) is very small, which poses difficulties for modeling.
[0122] 4. Overfitting problem. Risk identification is a rapidly changing scenario. The currently trained model may find it difficult to maintain the current prediction performance after a period of time.
[0123] Feature construction currently used for risk identification can include strategy-based feature construction, conventional tree model-based feature construction, and traditional deep learning algorithm-based feature construction.
[0124] Strategy-based feature construction specifies a series of rules through data analysis and superimposes the rules. However, its disadvantage is that the rules are very simple and mainly rely on expert experience, and its prediction effect is poor. Data based on tree models are structured features, which are less sensitive to sample concentration, but the predictability of category features is poor. Deep learning-based solutions use network models such as convolutional neural networks and recurrent neural networks. Their feature construction mainly relies on normalization and standardization operations, and cannot directly use structured data.
[0125] In response to the above problems, the present disclosure proposes an efficient feature construction solution, so that the constructed features have predictive properties for risk identification and are easier to be explained by the model.
[0126] In the system used for risk identification, the characteristics of the samples can be selected according to various aspects involved in the transaction to carry out model training and prediction.
[0127] For example, the characteristics of a sample used for risk identification may include the following:
[0128] The payer characteristics of the transaction, which may include the user information of the payer (for example, user ID, the average number of transactions of the user within one hour, the maximum number of transactions, etc.) and device information (how many different users have appeared on the device before the current transaction, the number of transactions of the device before the current transaction, etc.), the mobile phone number corresponding to the payer's bank card, address information (province, city, etc.), etc.
[0129] Transaction characteristics: These may include the payment amount, time, payment channel, etc. of the transaction.
[0130] The characteristics of the payee of the transaction, which may include the user signal (for example, ID number, etc.) and device information of the payee of the transaction, the mobile phone number corresponding to the payee's bank card, address information (province, city, etc.), etc.
[0131] On the other hand, the features of the samples used for risk identification may include category features, identification features, numerical features, etc. The solution disclosed in the present invention may perform different feature constructions (ie, determine feature values) on the above features.
[0132] Figure 1 is a diagram of a system 100 for feature building for risk identification in accordance with aspects of the present disclosure.
[0133] The system 100 may include a candidate sample acquisition module 102, a target sample acquisition module 104, and a feature map generation module 106. The system 100 may encode the original feature data (e.g., text form, character form, original data form, etc.) of the sample into a numerical value for constructing a feature vector corresponding to the sample.
[0134] The candidate sample acquisition module 102 may acquire a candidate sample set from numerous transactions occurring on the application platform. Each sample in the candidate sample set may correspond to a transaction and include multiple features, as described above.
[0135] The target sample acquisition module 104 may extract a target sample set from the candidate sample set.
[0136] In one aspect of the present disclosure, the inventors have found that the number of transactions conducted on the platform varies in a specific cycle. In other words, the number of samples in the candidate sample set varies in a specific cycle.
[0137] Figure 2 is a graph showing the distribution of the number of transactions over time.
[0138] like Figure 2 As shown in Figure 1, the distribution of transaction quantity changes in a one-month cycle. Therefore, obtaining the target sample set for feature construction in a one-month cycle can fully reflect the characteristics of the sample data, thereby improving the accuracy of model training.
[0139] According to one aspect of the present disclosure, during model training, sample data from one month before the current time may be selected from the candidate sample set and included in the target sample set, and features may be constructed using the target sample set for model training.
[0140] The feature map generation module 106 can be used to map the original feature data (e.g., text form, character form, original data form, etc.) of each feature of the sample in the target sample set into a feature value (e.g., numerical value) suitable for model processing to generate a feature map set.
[0141] On the one hand, the characteristics of the sample may include category characteristics, which may involve multiple categories. For example, gender category characteristics may include male category and female category, and province category characteristics may include Zhejiang Province category, Jiangsu Province category, Sichuan Province category, Shanghai category, Beijing category, etc.
[0142] The feature map generation module 106 may map (eg, encode) each category of the category features to a corresponding feature value to generate a feature map set, as shown in Table 1 below.
[0143] category <![CDATA[C1]]> <![CDATA[C2]]> …… <![CDATA[C i ]]> …… <![CDATA[C n ]]> Eigenvalue <![CDATA[f1]]> <![CDATA[f2]]> …… <![CDATA[f i ]]> …… <![CDATA[f n ]]>
[0144] Table 1
[0145] Among them C i represents the i-th category, the eigenvalue f i Represents the eigenvalue corresponding to the i-th category.
[0146] The feature map of the category feature can use historical samples and their labels (risky / non-risky) to determine the feature value corresponding to each category. The historical samples can be training samples or other samples corresponding to historical transactions.
[0147] For example, the province category feature may include categories such as Zhejiang Province, Jiangsu Province, Sichuan Province, Shanghai, Beijing, etc. Each category (eg, province) in the sample may be mapped to a corresponding feature value (eg, numerical value).
[0148] The prior art usually randomly maps each category to a feature value (referred to as randomly encoding the features in this article).
[0149] As an example of random coding, in the province category feature, Zhejiang Province can be mapped to feature value 1, Jiangsu Province can be mapped to feature value 2, Sichuan Province can be mapped to feature value 3, ...; in the gender category feature, male users can be mapped to feature value 1, and female users can be mapped to feature value 0. Please note that the feature values of the above category features are only examples, and other randomly selected feature values can also be used.
[0150] The prediction effect of random coding is acceptable when the number of categories of categorical features is small, such as the gender of the user (male / female, two categories), the age range of the user (under 20, 20-30, 30-40, 40-50, 50-60, over 60, a total of 6 categories), the day of the week when the transaction occurred (7 categories), etc.
[0151] However, when the number of categories involved in the category feature is large (for example, the number of categories is greater than the category number threshold), the feature value generated by randomly encoding the category feature may not be suitable for processing by a subsequent model (for example, a tree model). Specifically, the feature value generated by randomly encoding the category feature cannot introduce predictive significance (that is, explanatory power of transaction risk) to the feature for use by the model (for example, a tree model).
[0152] According to one aspect of the present disclosure, for a category feature with more categories, a statistical coding method may be used, including a WOE (weight of evidence) coding method or an IV (information value) coding method to introduce predictive significance to the feature. For example, when the number of categories of a category feature is greater than a category number threshold, a statistical coding method may be used to encode the category feature. The category number threshold may be pre-set. The category number threshold may be pre-set.
[0153] During the statistical coding process, the proportion of the number of risky samples and the number of risk-free samples in each category to the total number of risky samples and the total number of risk-free samples in the sample set can be counted, and the characteristic value of each category can be determined using the counted proportion.
[0154] Specifically, the feature value of a category in the category feature can be determined according to the following statistical coding method:
[0155] First, a sample set (e.g., Figure 1 The total number of risky samples T in the target sample set bad and the total number of risk-free samples T good .
[0156] For each (e.g., the i-th) category in the category feature, the following operations can be taken:
[0157] Determine the number of risky samples N in the sample set for this category bad_i and the number of risk-free samples N good_i .
[0158] For example, for the province category feature, for the Zhejiang category, the number of risky samples N in the samples in the sample set with the Zhejiang category can be counted. bad and the number of risk-free samples N good .
[0159] On the one hand, we can use the total number of risk samples T bad and the number of risky samples N of this category bad_i To determine the proportion of risky samples in this category R bad_i .
[0160] On the other hand, the total number of risk-free samples T can be used good and the number of risk-free samples N in this category good_i To determine the risk-free sample ratio R of this category good_i .
[0161] Then we can use the risk sample proportion R bad_i and the proportion of risk-free samples R good_i To determine the feature value corresponding to category i.
[0162] For WOE encoding, the category feature can be expressed as the feature value f of category i i Determined as:
[0163]
[0164] For IV encoding, the category feature can be expressed as the feature value f of category i i Determined as:
[0165]
[0166] The higher the characteristic value of a category in the category features obtained through statistical coding, the higher the risk level (probability of risk) of the category, so that risky samples can be efficiently identified in the subsequent tree model processing.
[0167] On the one hand, the present disclosure may use a random encoding method for category features with fewer categories (for example, the number of categories is less than a category number threshold).
[0168] For categorical features with a small number of categories (e.g., 2, 3, 4, 6), WOE / IV encoding will introduce label information into the feature value, thereby causing label leakage. Therefore, for categorical features with a small number of categories, random encoding can be used to determine the feature mapping set.
[0169] In one aspect, identification features (ie, features used for identification, such as IP addresses, etc.) may also be encoded using statistical encoding.
[0170] For example, for each IP address, it can be mapped to a corresponding feature value.
[0171] Specifically, the total number of risky samples T in the sample set can be determined bad and the total number of risk-free samples T good .
[0172] For each IP address a, you can take the following actions:
[0173] Determine the number of risky samples N in the sample set with IP address a bad_a and the number of risk-free samples N good_a .
[0174] In one aspect, the total number of samples at risk T can be used bad and the number of risky samples with IP address a in the sample set N bad_a To determine the risky sample ratio R of IP address a bad_a .
[0175] On the other hand, the total number of risk-free samples T can be used good and the number of risk-free samples with IP address a in the sample set N good_a To determine the proportion of risk-free samples with IP address a, R good_a .
[0176] Then, the WOE characteristic value f of IP address a can be determined according to formula (1): j , or determine the IV characteristic value f about IP address a according to formula (2) j .
[0177] By using statistical coding to determine the characteristic value of each IP address, high-risk IP addresses can be identified.
[0178] The above explanation uses the IP address as an example, but the use of other statistical encoding methods to encode other identification features is also within the conception of the present disclosure.
[0179] On the one hand, numerical features can also be encoded using statistical encoding.
[0180] For example, for the feature of the number of historical transactions of a user, its feature value may be determined for each number of historical transactions in the sample set, as shown in Table 2.
[0181] Historical transaction number <![CDATA[n1]]> <![CDATA[n2]]> …… <![CDATA[n j ]]> …… <![CDATA[n m ]]> Eigenvalue <![CDATA[f1]]> <![CDATA[f2]]> …… <![CDATA[f j ]]> …… <![CDATA[f m ]]>
[0182] Table 2
[0183] like Figure 2 As shown, each historical transaction number n j can correspond to an eigenvalue f j .
[0184] Similarly, the total number of risky samples in the sample set T can be determined bad and the total number of risk-free samples T good .
[0185] For each historical transaction number n j , you can take the following actions:
[0186] Determine the number of historical transactions in this sample set as n j The number of risky samples in the sample is N bad_j and the number of risk-free samples N good_j .
[0187] In one aspect, the total number of samples at risk T can be used bad And the number of historical transactions is n j The number of risk samples N bad_j To determine the number of historical transactions n j The proportion of risky samples R bad_j .
[0188] On the other hand, the total number of risk-free samples T can be used good And the number of historical transactions is n j The number of risk-free samples N good_j To determine the risk-free sample ratio R of the historical transaction number j good_j .
[0189] Then, the number of historical transactions n can be determined according to formula (1):j The WOE eigenvalue f j , or determine the number of historical transactions n according to formula (2) j IV eigenvalue f j .
[0190] Furthermore, the numerical features may be first binned, and each bin may correspond to a category as described above. Thus, the numerical values of each bin may be statistically encoded using the method for category features described above. The number of bins may be greater than the category number threshold as described above.
[0191] On the other hand, a truncation operation may be performed on a feature (eg, an identification feature, a numerical feature, etc.), and a statistical coding method may be used to determine the value of the truncated numerical feature.
[0192] For example, for an IP address feature, it can be represented by a 32-bit binary number, such as abcd (eg, 168.126.17.5), where a, b, c, and d can be represented by four binary digits respectively, ranging from 0 to 255.
[0193] The IP address may be truncated, for example, to 16 binary digits, and then the IP feature value of the truncated IP address may be determined by the above encoding for numerical features.
[0194] When determining the characteristic value of the IP address of the new data sample, the IP address can be truncated in the same manner, and the truncated IP address can be mapped to its corresponding IP characteristic value as the characteristic value of the component corresponding to the IP address in the characteristic vector of the sample.
[0195] Truncating numerical features can greatly reduce the amount of computation required by a computer system.
[0196] On the other hand, the encoding method can be selected according to the degree of missing features in the sample set. During the sample collection process, some features may not be collected for various reasons, resulting in the missing of the feature in the sample.
[0197] Random encoding can be used for features with relatively large number of missing items in the sample set. For example, if there are relatively large number of samples lacking IP address features in the sample set (e.g., above the missing number threshold), WOE or IV encoding will affect the predictive power of the encoded feature value, so random encoding is used for them. The missing number threshold can be pre-set.
[0198] For features with relatively few missing items in the sample set, statistical encoding can be used.
[0199] The above feature encoding can use historical samples (eg, training samples) and their labels (risky / non-risky) to determine the feature value of each category.
[0200] Figure 3 is a diagram of a system for model training / prediction for risk identification according to aspects of the present disclosure.
[0201] After determining the eigenvalue corresponding to the original data of each feature (for example, generating a eigenvalue mapping set of the feature), each feature in the sample to be processed (for example, the training sample and the sample to be predicted) can be mapped to the eigenvalue according to the generated mapping set, thereby generating a feature vector for subsequent network model processing.
[0202] like Figure 3 As shown, the system 300 may include a sample acquisition module 302 , a feature vector generation module 304 , and a network model 306 .
[0203] The sample acquisition module 302 may acquire samples to be processed (eg, training samples and samples to be predicted).
[0204] The feature vector generation module 304 maps each feature in the acquired sample to a feature value according to the generated feature value mapping set. For example, for a province category feature, the province data in the sample can be mapped to a corresponding feature value according to the feature mapping set for the province category. For an IP address feature, the IP address in the sample can be mapped to a corresponding feature value according to the IP address feature mapping set.
[0205] Each feature of the sample can be mapped to a corresponding eigenvalue, and the eigenvalues can be combined into a vector, thereby generating a feature vector for the sample.
[0206] The network model 306 may include a tree model that receives the generated feature vectors and performs corresponding training and prediction operations. For example, for the training process, the network model 306 may be trained using feature vectors corresponding to the training samples and labels of the samples (e.g., risky / non-risky). For the prediction process, the feature vectors corresponding to the samples to be predicted may be input into the network model 306 to predict whether the transaction corresponding to the sample is risky.
[0207] On the other hand, during the training process of the model, the sample set collected may include risk-free transaction samples (white samples), risky transaction samples (black samples), and transaction failure samples (for example, transactions failed to proceed successfully due to various reasons). Risk-free transaction samples, risky transaction samples, and transaction failure samples may be given label values of 0, 1, and -1, respectively. Please note that the label values are merely exemplary, and other label values are also within the conception of the present disclosure.
[0208] During the prediction process of the model, only two prediction results are generated: risk-free transaction samples (prediction label is 0) and risky samples (prediction label is 1).
[0209] As a result, there is a difference between the model's training sample set and the sample set to be predicted.
[0210] According to one aspect of the present disclosure, only risk-free transaction samples and risky transaction samples may be included in the training sample set, and transaction failure samples may be excluded, thereby keeping the labels of the training sample set and the sample set to be predicted consistent.
[0211] Another aspect of the present disclosure relates to randomly sampling a feature (eg, a statistical numerical feature) in a sample set to generate a feature value of the feature.
[0212] Since the time interval between the training sample set and the sample set to be predicted is relatively large, it is easy to cause the model to overfit on the training set. Adding feature noise can reduce this overfitting.
[0213] The present disclosure may randomly select a value from multiple values within a specific period as the feature value within the period for certain statistical numerical features of a user or device (e.g., the statistical value of a user or device within a specific period), which is referred to herein as random sampling of the feature. Random sampling can greatly reduce the amount of calculation of subsequent Cartesian product operations on the one hand, and on the other hand, feature noise is added to the sample set, thereby reducing overfitting.
[0214] For example, for the feature 'Number of user device logins per hour', multiple values can be collected for the one-hour period from 9:00 to 10:00 on January 3, 2021. For example, the number of user device logins collected at 9:30 is 6 times, the number of user device logins collected at 9:40 is 8 times, the number of user device logins collected at 9:50 is 10 times, and so on.
[0215] A value may be randomly selected from multiple values (eg, 6, 8, 10, etc.) of the feature 'number of user logins per hour' in the sample set within the period as the feature value of the feature for the period.
[0216] Generally speaking, the number of transactions for most users within an hour is stable and small in magnitude, so this noise is fine-grained noise, which can avoid overfitting while ensuring the prediction accuracy of the model.
[0217] Figure 4 is a flow chart of a method of feature construction for risk identification according to aspects of the present disclosure.
[0218] like Figure 4As shown, in step 402, a sample set may be obtained, and each sample in the sample set may include multiple features.
[0219] In step 404, for each category feature in the multiple features, the number of categories of the category feature in the sample set may be determined.
[0220] At step 406 , the category number of the category feature may be compared with a category number threshold.
[0221] In step 408, if the number of categories of the category feature is less than or equal to the category number threshold, the category feature may be encoded using a random encoding method to generate a feature mapping set for the category feature, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value.
[0222] In one aspect, the random encoding method includes determining, for each category of the category feature, a feature value corresponding to the category as a random number.
[0223] In step 410 , if the number of categories of the category feature is greater than the category number threshold, a statistical encoding method may be used to encode the category feature to generate a feature mapping set for the category feature.
[0224] On the one hand, using statistical coding to encode the category feature may include: determining the total number of risky samples and the total number of risk-free samples in the sample set; for each category of the category feature: determining the number of risky samples and the number of risk-free samples under the category in the sample set; using the total number of risky samples and the number of risky samples under the category to determine the proportion of risky samples in the category; using the total number of risk-free samples and the number of risk-free samples under the category to determine the proportion of risk-free samples in the category; and using the proportion of risky samples and the proportion of risk-free samples to determine the feature value corresponding to the category.
[0225] In one aspect, the statistical encoding scheme includes a weight of evidence (WOE) encoding scheme or an information value (IV) encoding scheme.
[0226] In one aspect, encoding the category feature using the WOE encoding method includes: determining a feature value f of the category feature with respect to the category as:
[0227]
[0228] In one aspect, encoding the category feature using IV encoding includes: determining a feature value f of the category feature with respect to the category as:
[0229]
[0230] In one aspect, the plurality of features may include numerical features, and a statistical encoding approach may be used to determine a set of feature maps for the numerical features.
[0231] On the one hand, the value of the numerical feature can be binned, wherein the number of bins can be greater than the category number threshold; and each bin is taken as a category, and a feature mapping set for the numerical feature is determined using a statistical coding method.
[0232] In one aspect, a truncation operation may be performed on the numerical feature, and a statistical coding method may be used to determine a feature mapping set for the truncated numerical feature.
[0233] On the one hand, for each feature of the multiple features, the number of missing samples in the sample set that lack the feature can be determined; the number of missing samples can be compared with a missing number threshold; if the number of missing samples is greater than the missing number threshold, the feature can be encoded using a random encoding method; and if the number of missing samples is less than or equal to the missing number threshold, the feature can be encoded using a statistical encoding method.
[0234] In one aspect, the feature map set may be used to determine feature values corresponding to category features in a training sample set, and a tree model may be trained using feature vectors corresponding to the training sample set.
[0235] On the other hand, the feature mapping set can be used to determine feature values corresponding to category features in the sample set to be predicted, and the feature vector corresponding to the sample set to be predicted is input into the trained tree model to perform risk identification prediction.
[0236] In one aspect, feature values of features in the sample may be determined based on the feature value mapping.
[0237] In one aspect, the plurality of features may include a numerical feature, the numerical feature including a plurality of values within a period, and the method further includes: obtaining a plurality of values of the numerical feature within a period from the sample set; and randomly selecting a value from the plurality of values as a feature value of the numerical feature within the period. The period may include one hour.
[0238] On the one hand, a training sample set for training a model may be obtained; wherein the training sample set includes risk-free transaction samples and risky transaction samples, and excludes unsuccessful transaction samples.
[0239] In one aspect, a training sample set for risk identification may be periodically acquired to train a model using the training sample set, wherein the period is one month.
[0240] Figure 5is a diagram of an apparatus for feature construction for risk identification according to various aspects of the present disclosure.
[0241] like Figure 5 As shown, the device 500 for constructing features for risk identification may include a sample set acquisition module 502 , a coding method determination module 504 , a random coding module 506 , a statistical coding module 508 , and a feature value generation module 510 .
[0242] The sample set acquisition module 502 may acquire a sample set, each sample in the sample set including a plurality of features. The sample set may be a historical sample set.
[0243] The encoding mode determination module 504 can determine the number of categories of each category feature in the multiple features in the sample set, and can compare the number of categories of the category feature with the category number threshold. If the number of categories of the category feature is less than or equal to the category number threshold, the category feature is encoded using a random encoding mode to generate a feature mapping set for the category feature, and the feature mapping set includes a mapping of each category in the category feature to a corresponding feature value. If the number of categories of the category feature is greater than the category number threshold, the category feature is encoded using a statistical encoding mode to generate a feature mapping set for the category feature.
[0244] The random encoding module 506 may determine, for each category of the category feature, a feature value corresponding to the category as a random number.
[0245] The statistical coding module 508 can determine the total number of risky samples and the total number of risk-free samples in the sample set; for each category of the category feature: determine the number of risky samples and the number of risk-free samples under the category in the sample set; use the total number of risky samples and the number of risky samples under the category to determine the proportion of risk-free samples in the category; use the total number of risk-free samples and the number of risk-free samples under the category to determine the proportion of risk-free samples in the category; and use the proportion of risky samples and the proportion of risk-free samples to determine the characteristic value of the category feature corresponding to the category.
[0246] On the one hand, the statistical encoding method may include a weight of evidence WOE encoding method or an information value IV encoding method.
[0247] In one aspect, encoding the category feature using the WOE encoding method may include: determining a feature value f of the category feature with respect to the category as:
[0248]
[0249] In one aspect, encoding the category feature using IV encoding may include: determining a feature value f of the category feature with respect to the category as:
[0250]
[0251] In one aspect, the statistical coding module 508 may use statistical coding to determine a set of feature maps for numerical features.
[0252] The statistical coding module 508 may bin the value of the numerical feature, wherein the number of bins is greater than the category number threshold; and each bin is regarded as a category, and a feature mapping set of the numerical feature is determined using a statistical coding method.
[0253] The statistical coding module 508 may perform a truncation operation on the numerical feature, and use a statistical coding method to determine a feature mapping set for the truncated numerical feature.
[0254] On the one hand, the statistical coding module 506 can determine, for each feature of the multiple features, the number of missing samples in the sample set that is missing the feature; compare the number of missing samples with a missing number threshold; if the number of missing samples is greater than the missing number threshold, encode the feature using a random coding method; and if the number of missing samples is less than or equal to the missing number threshold, encode the feature using a statistical coding method.
[0255] In one aspect, the sample set includes a training sample set and a sample set to be predicted.
[0256] The feature value generation module 510 may use the feature mapping set to determine feature values corresponding to the category features in the training sample set, so as to construct a feature vector corresponding to the training sample set to train the tree model.
[0257] The feature value generation module 510 can also use the feature mapping set to determine feature values corresponding to the category features in the sample set to be predicted, so as to construct a feature vector corresponding to the sample set to be predicted for risk identification prediction by the trained tree model.
[0258] In one aspect, the multiple features may include a numerical feature, the numerical feature includes multiple values within a period, and the feature value generation module 510 may obtain multiple values of the numerical feature within a period from the sample set; and randomly select a value from the multiple values as the feature value of the numerical feature within the period. The period may include one hour.
[0259] In one aspect, the sample set acquisition module 502 may acquire a training sample set for training a model; wherein the training sample set includes risk-free transaction samples and risky transaction samples, and excludes unsuccessful transaction samples.
[0260] In one aspect, the sample set acquisition module 502 may periodically acquire a training sample set for risk identification to train a model using the training sample set, wherein the period is one month.
[0261] The descriptions set forth herein in conjunction with the accompanying drawings describe example configurations and do not represent all examples that may be implemented or that fall within the scope of the claims. The term "exemplary" as used herein means "used as an example, instance, or illustration" and does not mean "better than" or "better than other examples." This detailed description includes specific details to provide an understanding of the described techniques. However, these techniques may be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form to avoid obscuring the concepts of the described examples.
[0262] In the accompanying drawings, similar components or features may have the same reference number. In addition, various components of the same type may be distinguished by following the reference number with a dash and a second reference number that distinguishes between the similar components. If only the first reference number is used in the specification, the description may apply to any of the similar components having the same first reference number regardless of the second reference number.
[0263] The various illustrative blocks and modules described in conjunction with the disclosure herein may be implemented or executed with a general purpose processor, a DSP, an ASIC, an FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in an alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices (e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration).
[0264] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, each function may be stored on a computer-readable medium or transmitted therefrom as one or more instructions or codes. Other examples and implementations fall within the scope of the present disclosure and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software, hardware, firmware, hard wiring, or any combination thereof executed by a processor. The features that implement the functions may also be physically located in various locations, including being distributed so that the various parts of the functions are implemented at different physical locations. In addition, as used herein (including in the claims), the "or" used in the enumeration of items (e.g., enumeration of items with phrases such as "at least one of" or "one or more of") indicates an inclusive enumeration, so that, for example, the enumeration of at least one of A, B, or C means A or B or C or AB or AC or BC or ABC (i.e., A and B and C). Similarly, as used herein, the phrase "based on" should not be interpreted as citing a closed set of conditions. For example, an exemplary step described as "based on condition A" may be based on both condition A and condition B without departing from the scope of the present disclosure. In other words, as used herein, the phrase "based on" should be interpreted in the same manner as the phrase "based at least in part on."
[0265] Computer readable medium includes both non-transient computer storage medium and communication medium, and it includes any medium that facilitates computer program to transfer from one place to another place.Non-transient storage medium can be any available medium that can be accessed by general or special-purpose computer.As an example and not limitation, non-transient computer readable medium can include RAM, ROM, electrically erasable programmable read-only memory (EEPROM), compact disk (CD) ROM or other optical disk storage, disk storage or other magnetic storage device, or can be used to carry or store instruction or data structure form of desired program code means and can be accessed by general or special-purpose computer or general or special-purpose processor any other non-transient medium.Any connection is also properly referred to as computer readable medium.For example, if software is transmitted from website, server or other remote source using coaxial cable, optical fiber cable, twisted pair, digital subscriber line (DSL) or wireless technology such as infrared, radio and microwave, then this coaxial cable, optical fiber cable, twisted pair, digital subscriber line (DSL) or wireless technology such as infrared, radio and microwave are just included in the definition of medium. Disk and disc as used herein include CDs, laser discs, optical discs, digital versatile discs (DVDs), floppy disks, and Blu-ray discs, where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above are also included within the scope of computer-readable media.
[0266] The description herein is provided to enable those skilled in the art to make or use the present disclosure. Various modifications to the present disclosure will be apparent to those skilled in the art, and the universal principles defined herein may be applied to other variations without departing from the scope of the present disclosure. Thus, the present disclosure is not limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for risk identification, include: Acquire a sample set for risk identification, each sample in the sample set including a plurality of features; For each category feature among the multiple features, determining the number of categories of the category feature in the sample set; comparing the category number of the category feature with a category number threshold; If the number of categories of the category feature is less than or equal to the category number threshold, encoding the category feature in a random encoding manner to generate a feature mapping set for the category feature, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value; If the number of categories of the category feature is greater than the category number threshold, encoding the category feature using a statistical encoding method to generate a feature mapping set for the category feature; Wherein the method further comprises: Using the feature map set to determine feature values corresponding to the category features in the training sample set; Using the feature vectors corresponding to the training sample set to train a tree model; and The method further comprises: Using the feature mapping set to determine feature values corresponding to the category features in the sample set to be predicted; and The feature vector corresponding to the sample set to be predicted is input into the trained tree model to perform risk identification prediction.
2. The method according to claim 1, wherein the random encoding method comprises, for each category of the category feature, determining the feature value corresponding to the category as a random number.
3. The method according to claim 1, wherein the statistical coding method is used to encode the category feature. include: Determining the total number of risky samples and the total number of non-risky samples in the sample set; For each category of the categorical features: Determine the number of risky samples and the number of non-risky samples under the category in the sample set; Using the total number of risk samples and the number of risk samples in this category, determine the proportion of risk samples in this category; Use the total number of risk-free samples and the number of risk-free samples under the category to determine the risk-free sample ratio for the category; as well as The proportion of risky samples and the proportion of non-risk samples are used to determine a feature value corresponding to the category.
4. The method according to claim 3, wherein the statistical coding method comprises a weight of evidence (WOE) coding method or an information value (IV) coding method.
5. The method according to claim 4, wherein the WOE encoding method is used to encode the category feature. include: The feature value f of the category feature with respect to the category is determined as:
6. The method of claim 4, wherein the IV encoding method is used to encode the category feature. include: The feature value f of the category feature with respect to the category is determined as:
7. The method of claim 1, wherein the plurality of features include numerical features, and the method further comprises using the statistical encoding method to determine a feature mapping set for the numerical features.
8. The method of claim 7, further comprising: include: Binning the values of the numerical features, wherein the number of bins is greater than the category number threshold; as well as Each bin is regarded as a category, and a feature mapping set of the numerical feature is determined using a statistical coding method.
9. The method of claim 7, further comprising: include: Performing a truncation operation on the numerical feature; as well as A set of feature maps for truncated numerical features is determined using the statistical encoding scheme.
10. The method of claim 1, further comprising: include: For each feature of the plurality of features, determining the number of missing samples in the sample set that lack the feature; Comparing the number of missing samples with a missing number threshold; If the number of missing samples is greater than the missing number threshold, encoding the feature using the random encoding method; as well as If the number of missing samples is less than or equal to the missing number threshold, the feature is encoded using the statistical encoding method.
11. The method of claim 1, wherein the plurality of features include a numerical feature, wherein the numerical feature includes a plurality of values within a period, and the method further comprises: include: Acquire multiple values of the numerical feature within a period from the sample set; as well as A value is randomly selected from the multiple values as a feature value of the numerical feature in the period.
12. The method of claim 1, further comprising: include: Obtain a training sample set for training the model; The training sample set includes risk-free transaction samples and risky transaction samples, and excludes unsuccessful transaction samples.
13. The method of claim 1, further comprising: include: A training sample set for risk identification is periodically acquired to train a model using the training sample set, wherein the period is one month.
14. A device for risk identification, include: A module for obtaining a sample set for risk identification, each sample in the sample set including a plurality of features; A module for determining, for each category feature among the multiple features, the number of categories of the category feature in the sample set; A module for comparing the number of categories of the category feature with a category number threshold; A module for encoding the category feature using a random encoding method to generate a feature mapping set for the category feature if the number of categories of the category feature is less than or equal to the category number threshold, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value; A module for encoding the category feature using a statistical coding method to generate a feature mapping set for the category feature if the category number of the category feature is greater than the category number threshold; A module for determining feature values corresponding to class features in a training sample set using the feature map set; A module for training a tree model using feature vectors corresponding to the training sample set; A module for using the feature map set to determine feature values corresponding to the category features in the sample set to be predicted; as well as Used to input the feature vector corresponding to the sample set to be predicted into the trained tree model to perform risk identification prediction.
15. The apparatus according to claim 14, wherein the random encoding method comprises determining, for each category of the category feature, a feature value corresponding to the category as a random number.
16. The apparatus of claim 14, further comprising a module for encoding the category feature using the statistical encoding method. include: A module for determining a total number of risky samples and a total number of non-risky samples in the sample set; A module for performing the following operations for each category of the category features: Determine the number of risky samples and the number of non-risky samples under the category in the sample set; Using the total number of risk samples and the number of risk samples in this category, determine the proportion of risk samples in this category; Use the total number of risk-free samples and the number of risk-free samples under the category to determine the risk-free sample ratio for the category; as well as The proportion of risky samples and the proportion of non-risk samples are used to determine a feature value corresponding to the category.
17. The device as claimed in claim 16, wherein the statistical coding method includes a weight of evidence (WOE) coding method or an information value (IV) coding method.
18. The device according to claim 17, wherein the WOE encoding method is used to encode the category feature. include: The feature value f of the category feature with respect to the category is determined as:
19. The apparatus of claim 17, wherein the IV encoding method is used to encode the category feature. include: The feature value f of the category feature with respect to the category is determined as:
20. The device of claim 14, further comprising: include: A module for determining, for each feature of the plurality of features, the number of missing samples in the sample set that lack the feature; A module for comparing the number of missing samples with a missing number threshold; A module for encoding the feature using the random encoding method if the number of missing samples is greater than the missing number threshold; as well as A module for encoding the feature using the statistical encoding method if the number of missing samples is less than or equal to the missing number threshold.
21. The apparatus of claim 14, wherein the plurality of features include a numerical feature, wherein the numerical feature includes a plurality of values within a period, and the apparatus further include: A module for obtaining multiple values of the numerical feature within a period from the sample set; as well as A module is used for randomly selecting a value from the multiple values as a feature value of the numerical feature in the period.
22. A device for risk identification, include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: Acquire a sample set for risk identification, each sample in the sample set including a plurality of features; For each category feature among the multiple features, determining the number of categories of the category feature in the sample set; comparing the category number of the category feature with a category number threshold; If the number of categories of the category feature is less than or equal to the category number threshold, encoding the category feature in a random encoding manner to generate a feature mapping set for the category feature, the feature mapping set including a mapping of each category in the category feature to a corresponding feature value; If the number of categories of the category feature is greater than the category number threshold, encoding the category feature using a statistical encoding method to generate a feature mapping set for the category feature; Using the feature map set to determine feature values corresponding to the category features in the training sample set; Training a tree model using feature vectors corresponding to the training sample set; Using the feature mapping set to determine feature values corresponding to the category features in the sample set to be predicted; as well as The feature vector corresponding to the sample set to be predicted is input into the trained tree model to perform risk identification prediction.
