A machine learning-oriented minority class sample enhancement method, system, device and storage medium

By employing a dual-path generation mechanism combining CTGAN and a large language model, along with multi-level hard constraint filtering, the limitations of minority class sample synthesis methods were overcome. This enabled the generation and filtering of high-quality minority class samples, meeting the data reliability requirements of actual business operations.

CN121009954BActive Publication Date: 2026-02-06SHENZHEN INST OF ADVANCED TECH CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511541848.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-02-06
Estimated Expiration
2045-10-27

AI Technical Summary

Technical Problem

Existing methods for synthesizing minority class samples have their own limitations, lack a unified quality control process, and their quality metrics are disconnected from downstream task indicators, making it difficult to meet the actual business requirements for data reliability.

Method used

A dual-path generation mechanism combining CTGAN and a large language model is adopted. Multi-level hard constraint filtering and unified scoring are used to generate minority class samples. CTGAN fits the distribution of the minority class subjects and maintains the inter-column dependency and joint statistical properties. The large language model explores the long-tail pattern. After the generated samples are verified for the legal range of feature values, feature type, and cross-column logical consistency, a unified scorer is used to filter and perform full-column deduplication.

Benefits of technology

It significantly improves the diversity and effectiveness of synthetic samples, ensures consistency between feature logic and distribution, and achieves a dynamic balance between scale, quality and diversity, meeting the needs of downstream classification tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009954B_ABST
    Figure CN121009954B_ABST
Patent Text Reader

Abstract

The application belongs to the field of machine learning, and discloses a machine learning-oriented minority class sample enhancement method, system, device and storage medium. CTGAN accurately fits the joint distribution characteristics of the minority class subject data through adversarial training, ensuring the statistical rationality of the generated samples. The large language model breaks through the traditional interpolation limit, explores potential long-tail feature combinations, and makes up for the coverage blind area of distribution fitting. After complementation, the hard constraint module forcibly checks the feature legality, type matching and cross-column logical consistency, and eliminates invalid samples. The unified scorer anchors the real distribution with the original data set, retains high-confidence samples through threshold screening, and finally ensures the uniqueness of the samples through full-column deduplication. The method significantly improves the diversity and effectiveness of the synthesized samples, breaking through the bottleneck of single generation technology. The systematic quality control process realizes the dynamic balance of scale, quality and diversity, making the enhanced samples more suitable for downstream classification task requirements.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of machine learning, and particularly relates to a minority class sample enhancement method, system, device and storage medium for machine learning. BACKGROUND

[0002] In table data modeling, especially in typical imbalanced table data modeling in actual business scenarios, the training data often presents the characteristics of extreme class imbalance. Such scenarios exist widely in many fields such as financial risk control, medical diagnosis and industrial quality inspection, and put forward higher requirements on the generalization ability and prediction accuracy of the model. The current mainstream technical improvement ideas are mostly concentrated in the model structure optimization or loss function design level, by adjusting the internal mechanism of the model to adapt to the imbalanced data, but often ignore the core needs of the "sample layer", that is, the quality control of the synthetic samples and the rigid constraints on the legal range of feature values, resulting in that the technical improvement cannot solve the imbalance problem from the data source level, and it is difficult to fully meet the demand of data reliability in actual business.

[0003] Although the existing technical solutions for minority class sample synthesis have formed multiple paths, they all have significant limitations: the generation method based on statistical distribution has the advantage of better fitting the main data distribution, but it cannot effectively cover the rare / long-tail feature combinations in the data set, and cannot effectively supplement the key minority class special samples; the oversampling method based on interpolation generates new samples by linear interpolation of existing samples, which has a bottleneck in improving sample diversity and is prone to model overfitting; the table generation method based on large language models can explore long-tail features to a certain extent, but is limited by the "hallucination" characteristics of the model, often producing invalid samples with feature values exceeding the legal range and logical contradictions between cross-column data. In addition, there is currently a lack of unified sample quality control process, making it difficult to achieve a stable balance between scale expansion, quality assurance and diversity improvement of synthetic samples.

[0004] Therefore, in the context of extremely imbalanced table data modeling, the existing minority class sample synthesis methods have their own limitations, lack a unified quality control process, and the quality metrics are disconnected from the downstream task indicators, which constitutes a problem that needs to be solved. SUMMARY

[0005] The present application provides a minority class sample enhancement method, system, device and storage medium for machine learning, which can solve the problems of the existing minority class sample synthesis methods, such as their own limitations, lack of unified quality control process, and disconnection between quality metrics and downstream task indicators, thereby meeting the demand of data reliability in actual business.

[0006] In order to achieve the above purpose, the present application adopts the following technical solutions:

[0007] A machine learning-oriented minority class sample enhancement method, comprising:

[0008] An original training data set containing only minority class samples is obtained, the minority class samples including a preset number of numerical features;

[0009] The original training data set is input into a pre-built CTGAN generation model to generate first candidate minority class samples, and the original training data set is input into a pre-built large language model to generate second candidate minority class samples; wherein the CTGAN generation model is used to fit the main body distribution of the minority class samples and maintain the column interdependence and joint statistical characteristics, and the large language model is used to explore the long-tail mode of the minority class samples to realize the complementarity between the long-tail mode coverage and the main body distribution fitting of the minority class samples;

[0010] The generated first candidate minority class samples and second candidate minority class samples are respectively subjected to a preset hard constraint condition; the hard constraint condition includes feature value legal range verification, feature type verification, integer feature rounding verification, and cross-column logical consistency verification;

[0011] Based on a unified scorer, a reference sample anchor real distribution extracted from the original data set is combined, and the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint condition are respectively screened according to a preset scoring threshold and a sorting rule;

[0012] The first candidate minority class samples and the second candidate minority class samples obtained after screening are respectively subjected to full-column deduplication with reference to the original training data set to eliminate duplicate samples;

[0013] The first candidate minority class samples and the second candidate minority class samples subjected to full-column deduplication are aggregated to obtain a minority class enhancement sample set.

[0014] Further, the specific structure of the CTGAN generation model is configured as:

[0015] The generator structure of the CTGAN generation model includes an input layer, an intermediate layer and an output layer; wherein the input layer of the generator structure is used to splice a random noise vector and a condition vector, and the condition vector is used to inject column-level conditions, wherein discrete columns are encoded by one-hot encoding, and continuous columns are indicated by mixed components; the intermediate layer of the generator structure adopts a fully connected multilayer perceptron, and each hidden layer is sequentially configured with batch normalization and leaky rectified linear unit; in the output layer of the generator structure, a vector with a value range of (-1, 1) is output for continuous columns after tanh activation, and then restored to the original dimension by numerical inverse transformation; for discrete or enumerated columns, the log probability of each category is output, and Gumbel-Softmax or Softmax is used for approximate one-hot sampling;

[0016] The discriminator structure of the CTGAN generation model comprises an input layer, an intermediate layer and an output layer;

[0017] The input layer of the discriminator structure adopts a PacGAN-2 structure, and is used for inputting 2 samples after feature dimension splicing; the intermediate layer of the discriminator structure adopts a full connection structure, and the activation function is LeakyReLU; the output layer of the discriminator structure adopts 1 neuron, and is used for outputting the true and false probability of the sample through Sigmoid activation.

[0018] Further, the large language model adopts an LLM generation model; the LLM generation model comprises two types of fixed template type and no fixed template type, and the specific configurations are as follows:

[0019] In the LLM generation model of the fixed template type, the input comprises a fixed field order, a feature value range constraint, a cross-column logical consistency constraint and a part of real minority class samples; the generation rule is that: a pre-trained large language model is called through a preset interface, and a first preset number of second candidate samples stored in a CSV format without a header and a label are generated through temperature sampling; the first preset number of second candidate samples are used to cooperate with the first candidate samples to jointly serve as the basic enhanced samples; wherein the first candidate samples are part of the real minority class samples;

[0020] In the LLM generation model of the no fixed template type, the input comprises only a minority class sample basic logical constraint and no feature value range of the minority class sample; the generation rule is that: the same pre-trained large language model as the fixed template type is called through the preset interface, and a second preset number of second candidate samples are generated at a time; the second preset number of second candidate samples are only used to supplement the diversity of the enhanced sample set, and are not used as the basic enhanced samples; wherein the second preset number is at least 200 times of the first preset number.

[0021] Further, the autoregressive target representation of the LLM generation model is:

[0022]

[0023] In the formula, θ represents a model parameter; t represents a position in a sequence; prompt represents a model context prompt, comprising an instruction, a question and a guiding text; represents a probability; represents a token; represents all tokens before the tth step.

[0024] Further, the unified scorer is specifically configured as:

[0025] The input information of the unified scorer includes: first, first candidate minority class samples and second candidate minority class samples to be scored, the first candidate minority class samples and the second candidate minority class samples both containing numerical features in a fixed order; second, upper and lower bounds of each numerical feature value and data type description; and third, multiple reference samples randomly extracted from an original training data set, serving as reference samples to anchor a real distribution;

[0026] The scoring dimensions of the unified scorer include feature consistency, sample consistency, diversity distribution, and overall confidence, and the sum of the weights corresponding to each scoring dimension is 1.

[0027] The scoring rule of the unified scorer is:

[0028] A score in the range of 0-1 is output according to the scoring dimension, and a total score is calculated according to the weight; samples with a total score not lower than a preset scoring threshold are screened out; the screened samples are sorted in descending order of total score, and the top samples are selected according to a preset number.

[0029] Further, the first candidate minority class samples and the second candidate minority class samples obtained after screening are subjected to full column deduplication with reference to the original training data set, including:

[0030] The first candidate minority class samples and the second candidate minority class samples after screening are compared with all numerical features of the original training data set, respectively, and if the values of all numerical features of the two samples are exactly the same, one of the samples is removed.

[0031] Further, the first candidate minority class samples and the second candidate minority class samples subjected to full column deduplication are aggregated, including:

[0032] The first candidate minority class samples and the second candidate minority class samples subjected to full column deduplication are inserted into a preset output pool to form an initial aggregated sample set;

[0033] All minority class samples in the initial aggregated sample set are subjected to full column secondary deduplication to obtain a minority class enhanced sample set.

[0034] A minority class sample enhancement system for machine learning includes:

[0035] A data acquisition module is configured to obtain an original training data set containing only minority class samples, the minority class samples including a preset number of numerical features;

[0036] The sample generation module is configured to input the original training data set into a pre-built CTGAN generation model to generate first candidate minority class samples, and input the original training data set into a pre-built large language model to generate second candidate minority class samples; the CTGAN generation model is configured to fit the main body distribution of the minority class samples and maintain the column interdependence and joint statistical characteristics, and the large language model is configured to explore the long-tail mode of the minority class samples to realize the complementarity between the long-tail mode coverage and the main body distribution fitting of the minority class samples.

[0037] The conditional constraint module is configured to apply preset hard constraint conditions to the generated first candidate minority class samples and second candidate minority class samples respectively; the hard constraint conditions include feature value legal range verification, feature type verification, integer feature rounding verification and cross-column logical consistency verification.

[0038] The score screening module is configured to anchor the real distribution based on the reference samples extracted from the original data set by using a unified scorer, and screen the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint conditions according to a preset score threshold and a sorting rule.

[0039] The sample deduplication module is configured to perform full-column deduplication on the first candidate minority class samples and the second candidate minority class samples obtained after screening with reference to the original training data set to eliminate duplicate samples.

[0040] The sample aggregation module is configured to aggregate the first candidate minority class samples and the second candidate minority class samples subjected to the full-column deduplication to obtain a minority class enhanced sample set.

[0041] A minority class sample enhancement device for machine learning, comprising:

[0042] A memory configured to store a computer program;

[0043] A processor configured to execute the computer program to implement the steps of the above-mentioned machine learning-oriented minority class sample enhancement method.

[0044] A computer readable storage medium storing a computer program, the computer program being configured to be executed by a processor to implement the steps of the above-mentioned machine learning-oriented minority class sample enhancement method.

[0045] Compared with the prior art, the present application has the following beneficial effects:

[0046] The application provides a machine learning-oriented minority class sample enhancement method, which realizes high-quality minority class sample enhancement by fusing a double-path generation mechanism of CTGAN and a large language model, combining multi-level hard constraint filtering and unified scoring screening. CTGAN accurately fits the joint distribution characteristics of the minority class main body data through adversarial training, ensuring the statistical rationality of the generated samples; the large language model breaks through the traditional interpolation limit, explores potential long-tail feature combinations, and makes up for the coverage blind area of distribution fitting. After complementary generation, the hard constraint module forcibly checks the feature legality, type matching and cross-column logical consistency, eliminating invalid samples; the unified scorer anchors the real distribution with the original data set, retains high-confidence samples through threshold screening, and finally ensures sample uniqueness through full-column deduplication. Under the premise of strictly guaranteeing the consistency of feature logic and distribution, the method significantly improves the diversity and effectiveness of the synthesized samples, breaking through the bottleneck of single generation technology; the systematic quality control process realizes the dynamic balance of scale, quality and diversity, making the enhanced samples more suitable for downstream classification task requirements. BRIEF DESCRIPTION OF DRAWINGS

[0047] Figure 1 An implementation flowchart of a machine learning-oriented minority class sample enhancement method provided for an embodiment of the application is provided.

[0048] Figure 2 A flowchart of a machine learning-oriented minority class sample enhancement method provided for an embodiment of the application is provided.

[0049] Figure 3 A structural schematic diagram of a machine learning-oriented minority class sample enhancement system provided for an embodiment of the application is provided.

[0050] Figure 4 An overall performance schematic diagram of each model for enhancing samples provided for an embodiment of the application is provided. DETAILED DESCRIPTION

[0051] For a further understanding of the present application, the following will describe the application in detail in conjunction with the drawings and specific embodiments. It should be understood that the embodiments are only used to explain the application and are not limiting.

[0052] Technical terms related to the present application are explained and described:

[0053] LLM (Large Language Model) is a natural language processing model in the field of artificial intelligence based on deep learning, which has the core feature of training a neural network with super large-scale parameters through massive data to understand and generate human language.

[0054] CTGAN (Conditional Tabular GAN) is a generative adversarial network (GAN) model designed specifically for structured tabular data.

[0055] Gemini Grader refers to an automated grading system developed based on Google Gemini series large models.

[0056] Softmax is a function that converts a real number vector into a probability distribution.

[0057] Gumbel-Softmax (also known as Concrete Distribution) is a technique for sampling discrete variables through continuous relaxation.

[0058] PacGAN is an improved generative adversarial network (GAN) method designed to address the mode collapse problem in GAN training.

[0059] CSV (Comma-Separated Values) is a simple and widely used plain text data format for storing tabular data.

[0060] LeakyReLU (Leaky Rectified Linear Unit) is a commonly used activation function in deep learning.

[0061] Sigmoid (Sigmoid function) is one of the most classic activation functions in deep learning and machine learning, which maps any real number input to the interval (0, 1), and the output can be interpreted as a probability value.

[0062] MLP (Multilayer Perceptron) is one of the most basic and widely used neural network structures in deep learning, belonging to feedforward artificial neural networks.

[0063] Minor class samples refer to the relatively small number of class samples in the classification problem in the field of machine learning.

[0064] As shown in Figure 2 , the embodiment provides a machine learning-oriented minority class sample enhancement method, and the specific steps are as follows:

[0065] An original training data set containing only minority class samples is obtained, and the minority class samples include a preset number of numerical features.

[0066] The original training data set is input into a pre-constructed CTGAN generation model to generate first candidate minority class samples; the original training data set is input into a pre-constructed large language model to generate second candidate minority class samples; wherein the CTGAN generation model is used to fit the main body distribution of the minority class samples and maintain the column interdependence and joint statistical characteristics, and the large language model is used to explore the long tail mode of the minority class samples to realize the complementarity between the long tail mode coverage and the main body distribution fitting of the minority class samples;

[0067] The generated first candidate minority class samples and second candidate minority class samples are respectively subjected to a pre-set hard constraint condition; the hard constraint condition includes feature value legal range verification, feature type verification, integer feature rounding verification, and cross-column logical consistency verification;

[0068] Based on a unified scorer, in combination with reference samples anchored to the real distribution extracted from the original data set, the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint condition are respectively screened according to a pre-set scoring threshold and a ranking rule;

[0069] The first candidate minority class samples and the second candidate minority class samples obtained after screening are subjected to full-column deduplication with reference to the original training data set to eliminate duplicate samples;

[0070] The first candidate minority class samples and the second candidate minority class samples subjected to full-column deduplication are aggregated to obtain a minority class enhanced sample set.

[0071] The minority class sample enhancement method provided by the embodiment will be further explained and described in combination with examples and the accompanying drawings:

[0072] As shown in Figure 1 , the embodiment provides a machine learning-oriented minority class sample enhancement method, which is applied to a default customer minority class sample enhancement scene in the financial field, and the specific steps are as follows:

[0073] An original training data set containing only default customers (containing 10 numerical features) is obtained;

[0074] The CTGAN is used to generate the first candidate samples fitting the main body distribution, and the fixed template type / LLM without fixed template type is used to generate the second candidate samples covering the long tail mode;

[0075] The candidate samples are subjected to "feature value legal range, feature type, integer rounding, and cross-column logical consistency" hard constraints to eliminate illegal samples;

[0076] A unified scorer is constructed based on Gemini 1.5 Pro, in combination with the original samples to anchor the real distribution, and high-quality samples are screened according to "threshold 0.65 + Top-3 within the group".

[0077] The selected samples and the original dataset are deduplicated across all columns, and the aggregated samples are used to train the risk assessment model.

[0078] In this embodiment, the more specific implementation steps are as follows:

[0079] Step 1: Obtain the original training dataset:

[0080] The original training dataset in this embodiment comes from the personal credit history records of a consumer finance company. The dataset contains only "defaulting customers" (a minority class) samples, totaling 1200 records. Each sample contains 10 numerical features. The feature definitions, value ranges, and statistical characteristics are as follows:

[0081] Revolving Utilization of Unsecured Lines: The rate at which unsecured credit lines are revolved.

[0082] age: age;

[0083] NumberOfTime30-59DaysPastDueNotWorse: The number of times a payment has not been made in the past 30-59 days;

[0084] Debt Ratio: Debt ratio;

[0085] Monthly Income: Monthly income;

[0086] Number of Open Credit Lines and Loans: The number of open credit cards and loans;

[0087] Number of Times 90 Days Late: The number of times a payment was overdue in the past 90 days;

[0088] Number Real Estate Loans or Lines: The number of real estate loans or lines;

[0089] Number of Time 60-89 Days Past Due Not Worse: The number of times a payment has not been made in the past 60-89 days.

[0090] Number of dependents: The number of people supported.

[0091] Among them, the original data set has excluded missing values and outliers (such as age <18 years old, monthly income <1000 yuan) through data cleaning to ensure data legality; the quality control of the generated samples is based on the characteristics and distribution of the data set.

[0092] Step 2: Dual-source generation of candidate minority class samples:

[0093] This step generates the first candidate minority class sample (main distribution) and the second candidate minority class sample (long tail mode) through the CTGAN generation model and two types of LLM generation models, respectively, to realize the complementarity of distribution fitting and long tail coverage.

[0094] Specifically, the construction of the CTGAN generation model and the generation of the first candidate sample are as follows:

[0095] The CTGAN generation model is based on the "generator-discriminator" adversarial architecture design, and the specific structure and training parameters are as follows:

[0096] In this embodiment, the generator structure of the CTGAN generation model includes:

[0097] Input layer: concatenate 128-dimensional random noise vector (z~N (0,1)) and conditional vector (c), total input dimension is "128 + conditional vector dimension". Among them, the conditional vector c is used to inject column-level constraints:

[0098] Discrete hash processing: Number Of Dependents (value 0-3), Number Of Real Estate LoansOr Lines (value 0-5) and other discrete features use one-hot encoding, such as Number Of Dependents=2 encoded as [0,0,1,0];

[0099] Continuous column processing: age, Monthly Income and other continuous features use "mixed component indication" - divide the continuous features into 5 intervals according to the distribution of the original data set (such as age is divided into [21-30, 31-40, 41-50, 51-60, 61-80]), each interval corresponds to 1 indicator bit, forming a mixed component vector.

[0100] Intermediate layer: use 2-layer fully connected multilayer perceptron (MLP), neuron number is 256, 128 in turn; Each layer is configured with batch normalization (BatchNorm) and leaky rectified linear unit (LeakyReLU, negative slope = 0.2) to solve the problem of gradient disappearance and stabilize the adversarial training process.

[0101] Output layer:

[0102] Continuous columns (e.g. Revolving Utilization Of Unsecured Lines, Monthly Income): output a vector with tanh activation (values range (-1,1)), and then inverse-transform it back to the original scale. The inverse-transform formula is: original value = mean of original dataset + activation value x standard deviation of original dataset (e.g. inverse-transform of Monthly Income: generate activation value v=0.3, original value = 9500 + 0.3x5200=11060.00);

[0103] Discrete / Enumerated columns (e.g. Number Of Time 30-59 Days Past Due Not Worse): output logits for each category, and then sample an approximate one-hot vector using Gumbel-Softmax (temperature parameter = 0.1), and then map it to the specific feature value (e.g. sample result [0,1,0,0] maps to 1).

[0104] In this embodiment, the generator structure of the CTGAN generation model includes:

[0105] Input layer: use PacGAN-2 structure to concatenate the 10-dimensional features of 2 samples into a 20-dimensional input vector to suppress mode collapse (avoid generated samples converging).

[0106] Intermediate layer: use a 2-layer fully connected MLP with neuron counts of 256 and 128 respectively, and the activation function is LeakyReLU (negative slope = 0.2).

[0107] Output layer: 1 neuron, activated by Sigmoid to output the "true probability" of the sample (values range 0-1) - a probability close to 1 indicates that it is judged as an "original real sample", and close to 0 indicates that it is judged as a "generated sample".

[0108] The training parameters of the CTGAN generation model are:

[0109] Optimizer: Adam optimizer, learning rate = 0.0002, β1 = 0.5, β2 = 0.999; loss function: binary cross-entropy loss; training rounds: 300 rounds, batch size = 64 per round; during training, save the model parameters every 50 rounds, and finally select the model at the 300th round.

[0110] For example, according to the rule of "generate 5 samples per group, a total of 240 groups", 1200 first candidate samples are generated.

[0111] The LLM generation model adopts Gemini 1.5 Pro pre-trained large language model, and realizes sample generation through API calling, which is divided into "fixed template type" and "no fixed template type". The specific configuration is as follows:

[0112] The input of the fixed template type LLM generation model is the prompt template: "The task is to generate a personal credit default customer sample for risk assessment model training.

[0113] The output format is CSV format without header and label, a total of 5 rows, each row contains 10 numerical features, and the numerical feature order is: the number of unpaid times in the past 30-59 days, debt ratio, monthly income, the number of open credit cards and loans, the number of overdue repayments in the past 90 days, the number of real estate loans or lines, the number of unpaid times in the past 60-89 days, and the number of dependents.

[0114] Constraint conditions:

[0115] 1. Feature value range: Revolving Utilization Of Unsecured Lines ∈ [0, 1.72], age ∈ [21, 80] (integer), overdue times (30-59 days, 60-89 days, 90 days) ∈ [0, 3] (integer), Debt Ratio ∈ [0, 3.0], Monthly Income ∈ [1800, 80000], Number Of Open Credit Lines And Loans ∈ [0, 15] (integer), Number Real Estate Loans Or Lines ∈ [0, 5] (integer), Number Of Dependents ∈ [0, 3] (integer).

[0116] 2. Cross-column logical consistency:

[0117] When Revolving Utilization Of Unsecured Lines > 1.0, at least one overdue time ≥ 1;

[0118] When Monthly Income < 3000, Debt Ratio ≤ 0.6;

[0119] When Number Of Open Credit Lines And Loans > 10, at least one overdue time ≥ 1;

[0120] When Number Real Estate Loans Or Lines ≥ 2, age ≥ 35;

[0121] 3. Seed sample reference (real default customer sample):

[0122] 0.75, 38, 1, 0.42, 7500.00, 6, 0, 1, 0, 1;

[0123] 1.20, 45, 2, 0.85, 15000.00, 9, 1, 2, 1, 2.

[0124] Sampling parameters: Temperature = 0.4 (balance diversity and legality), Top-p = 0.9 (only keep token sequences with cumulative probability ≥ 0.9);

[0125] Generation strategy: generate 5 samples per group, a total of 240 groups, resulting in 1200 second candidate samples (consistent with CTGAN generation, as the basis for enhanced samples);

[0126] Generation result example (1 valid sample): 1.05, 36, 2, 0.72, 9800.00, 8, 1, 1, 0, 1.

[0127] Example, no fixed template type LLM generation model, input prompt template (only contains basic logic): "Task: generate personal credit default customer samples for risk assessment model long tail mode coverage.

[0128] Output format: CSV format, no header, no label, 100 per group, each row contains 10 numerical features, and the feature order is consistent with the fixed template.

[0129] Constraints: 1. Conform to financial common sense: such as income and debt level matching (low-income debt ratio should not be too high), number of overdue times and credit utilization rate are positively correlated, number of dependents and income level are positively correlated; 2. Cover rare scenarios: such as freelancers (monthly income fluctuates greatly, such as 1800-50000 yuan), new citizens (age <30, Number Of Open Credit Lines And Loans <3), multi-property holders (Number Real Estate Loans Or Lines ≥3) and other long tail default modes.

[0130] Sampling parameters: Temperature = 0.6 (higher diversity), Top-p = 0.95;

[0131] Generation strategy: generate 100 samples per group, a total of 100 groups, resulting in 10000 second candidate samples (only used to supplement diversity, not as a basis for enhanced samples);

[0132] Generation result example (1 rare scene sample): 0.88, 28, 1, 0.55, 4200.00, 2, 0, 0, 0, 1 (new citizen, low account opening number, small amount of overdue).

[0133] Step 3, apply hard constraint condition to filter illegal samples:

[0134] Apply four hard constraint conditions to 1200 first candidate samples generated by CTGAN, 1200 second candidate samples generated by LLM fixed template, and 10000 second candidate samples generated by LLM without fixed template, respectively, to remove illegal samples. The specific constraint rules and execution results are as follows:

[0135] 1. Feature value range verification:

[0136] Verification rule: check each sample's 10 features one by one. If any feature value exceeds the "value range", it is determined as an illegal sample and is removed.

[0137] Execution result: 120 CTGAN samples are removed (10% of the total, mainly Revolving Utilization Of Unsecured Lines>1.72, Debt Ratio>3.0); 84 LLM fixed template samples are removed (7% of the total, mainly age<21, Monthly Income<1800); 2100 LLM samples without fixed template are removed (21% of the total, mainly overdue times>3, Number Of Open Credit Lines And Loans>15).

[0138] 2. Feature type verification:

[0139] Verification rule: check if the integer type features (such as age, Number Of Dependents) in the sample are in integer format, and if the decimal type features (such as Revolving Utilization Of Unsecured Lines) are in 2 decimal places. If not, it is determined as an illegal sample and is removed.

[0140] Execution result: 36 CTGAN samples are removed (3% of the total, mainly age contains decimal, such as 35.6); 24 LLM fixed template samples are removed (2% of the total, mainly Number Of Dependents contains decimal, such as 1.5); 900 LLM samples without fixed template are removed (9% of the total, mainly integer features contain decimals).

[0141] 3. Integer feature rounding verification:

[0142] Check rule: For integer type features, if a decimal number appears in the generation process due to model errors (e.g., age = 35.2), use "rounding" to take the integer (e.g., 35.2→35); if the integer exceeds the value range after rounding (e.g., age = 80.6→81, exceeding the upper limit of 80), it is rejected;

[0143] Execution result: CTGAN samples are rounded to 30, with no rejection; LLM fixed template samples are rounded to 20, with no rejection; LLM non-fixed template samples are rounded to 500, with 50 rejected (exceeding the range after rounding).

[0144] 4. Cross-column logical consistency check:

[0145] Check rule: Based on financial common sense, 5 logical rules are preset, and each sample is checked. If any rule is violated, it is rejected:

[0146] Rule 1: Revolving Utilization Of Unsecured Lines > 1.0→ At least one overdue number ≥1;

[0147] Rule 2: Monthly Income <3000→ Debt Ratio ≤0.6;

[0148] Rule 3: Number Of Open Credit Lines And Loans >10→ At least one overdue number ≥1;

[0149] Rule 4: Number Real Estate Loans Or Lines ≥2→ age ≥35;

[0150] Rule 5: Number Of Dependents ≥3→ Monthly Income ≥5000;

[0151] Execution result: CTGAN samples are rejected for 60 (5% of the total, mainly violating rules 1 and 4); LLM fixed template samples are rejected for 48 (4% of the total, mainly violating rules 2 and 5); LLM non-fixed template samples are rejected for 1500 (15% of the total, mainly violating rules 1 and 3).

[0152] After hard constraint filtering, the remaining candidate sample size is: CTGAN samples 954 (1200-120-36-0-60), LLM fixed template samples 1024 (1200-84-24-0-48), LLM non-fixed template samples 5450 (10000-2100-900-50-1500).

[0153] Step 4: Screening high-quality samples with unified scorer:

[0154] In this step, a unified scorer is constructed based on Gemini 1.5 Pro, and the candidate samples filtered by hard constraints are scored and screened in combination with the original data set anchoring the real distribution. The specific configuration and execution process are as follows:

[0155] The input information of the unified scorer: samples to be scored: 954 CTGAN samples filtered by hard constraints, 1024 LLM fixed template samples, and 5450 LLM no fixed template samples; feature constraint description: "feature name, value range, data type"; reference sample: 50 samples randomly selected from the original data set (1200) as the benchmark for anchoring the real distribution (to ensure that the scoring dimension is consistent with the original data distribution).

[0156] The scoring dimension and weight set the scorer to evaluate the sample quality from four dimensions, with the total weight of each dimension being 1. The scoring dimensions include: feature consistency degree with a weight of 0.25, sample consistency with a weight of 0.3, diversity distribution with a weight of 0.25, and overall confidence with a weight of 0.2.

[0157] For example, the specific scoring and screening rules are as follows:

[0158] First, calculate the four-dimensional score of each sample according to the above method, and calculate the total score according to the weight (total score = feature consistency degree x 0.25 + sample consistency x 0.30 + diversity distribution x 0.25 + overall confidence x 0.20).

[0159] Second, set the scoring threshold to 0.65 (based on the confidence field standard of Google Research Open Buildings data set, and combined with the threshold scanning verification of the original data set - when the threshold is 0.65, the AUC of the downstream model of the screened samples is optimal), and remove samples with a total score less than 0.65.

[0160] Third, sort the remaining samples in descending order of total score, and select 5 samples from each group and take the Top-3 within the group for CTGAN samples and LLM fixed template samples (matching the generation strategy), and take the top 2000 for LLM no fixed template samples (to meet the diversity supplement demand).

[0161] The screening results are as follows: CTGAN samples: a total of 600 samples with a total score greater than or equal to 0.65, after sorting within the group Top-3, 360 samples are obtained (240 groups x 3); LLM fixed template samples: a total of 624 samples with a total score greater than or equal to 0.65, after sorting within the group Top-3, 360 samples are obtained (240 groups x 3); LLM no fixed template samples: a total of 2800 samples with a total score greater than or equal to 0.65, and the top 2000 are taken.

[0162] Step 5, full column deduplication and sample aggregation:

[0163] First step, full column deduplication: compare the filtered CTGAN samples (360), LLM fixed template samples (360), and LLM non-fixed template samples (2000) with the original dataset (1200) for full column comparison. If the values of the 10 features of two samples are exactly the same (including decimal places, such as Monthly Income being 9800.00), the candidate sample is removed (the original sample is retained to avoid data redundancy). The deduplication results are as follows: CTGAN samples: 5 duplicates with the original data, 355 remaining after removal; LLM fixed template samples: 3 duplicates with the original data, 357 remaining after removal; LLM non-fixed template samples: 12 duplicates with the original data, 1988 remaining after removal.

[0164] Second step, sample aggregation: insert the deduplicated CTGAN samples (355), LLM fixed template samples (357), and LLM non-fixed template samples (1988) into the pre-set output pool to form an initial aggregated sample set (355+357+1988=2700). Perform a second full column deduplication on the initial aggregated sample set to remove duplicates between samples. After removing 18 duplicate samples, the final minority class enhanced sample set is obtained, with a size of 2682. Distribution verification of enhanced samples: compare the feature distributions of the original dataset and the enhanced sample set (using age and Debt Ratio as examples). The results show that the mean age of the enhanced samples is 37.8±10.2, with a deviation of <5% from the original data (38.2±11.5); the mean Debt Ratio is 0.43±0.26, with a deviation of <5% from the original data (0.45±0.28), indicating that the enhanced samples have consistent distribution with the original data and cover more long-tail patterns (such as the proportion of samples with age<30 increasing from 18% to 25% in the original data).

[0165] For example, the machine learning-oriented minority class sample enhancement method provided in this embodiment is applied to the photovoltaic power station short-term output / power prediction scenario in the new energy power generation field, and the specific steps are as follows:

[0166] Obtain an original training dataset containing only extreme weather scenarios (containing 12 numerical features, covering meteorological, installed, and output information);

[0167] Use CTGAN to generate the first candidate sample fitting the main distribution of extreme weather, and use fixed template type / non-fixed template type LLM to generate the second candidate sample covering rare extreme scenarios;

[0168] The candidate samples are subjected to "physical value constraints, feature type constraints, integer rounding constraints, and meteorological-output logic constraints" hard constraints, and samples that do not conform to physical laws are removed;

[0169] A unified scorer is constructed based on Gemini1.5Pro, combined with original sample anchoring real physical distribution, and high-quality samples are screened according to "threshold 0.7+scene coverage priority";

[0170] Full-column deduplication is performed on the screened samples and the original data set, and a minority class enhanced sample set is aggregated for training the output prediction model.

[0171] More specific implementation steps are as follows:

[0172] The original training data set of this embodiment is derived from the SCADA (data acquisition and monitoring) system of a 100MW photovoltaic power station, and the data set only contains output records of "extreme weather scenes" (minority class), a total of 520, covering three types of scenes: heavy rain (180), heavy snow (150), and strong sandstorm (190). Each sample contains 12 numerical features, and the feature definition, value range and physical meaning are as follows:

[0173] Irradiance: solar irradiance;

[0174] Temperature: ambient temperature;

[0175] Wind Speed: wind speed;

[0176] Cloud Cover: cloud cover;

[0177] Hour: hour;

[0178] Season: season;

[0179] Installed Capacity: installed capacity;

[0180] Azimuth: azimuth of photovoltaic module;

[0181] Tilt Angle: tilt angle of photovoltaic module;

[0182] Historical Power: output of the previous 1 hour;

[0183] Current Power: current hour output;

[0184] Power Change Rate: output change rate.

[0185] Among them, the original data set has been cleaned by physical rules (such as removing "night irradiance>50W / m 2and output > 1000kW ”), ensuring that the data conforms to the physical laws of photovoltaic operation; the quality control of subsequent sample generation is based on the characteristics of this data set and physical logic.

[0186] Step 2: Dual-source generation of candidate minority class samples:

[0187] This step generates the first candidate samples (extreme weather main distribution, such as "heavy rain + normal temperature") and the second candidate samples (rare extreme scenarios, such as "strong sandstorm + low temperature") through the CTGAN generation model and two types of LLM generation models, achieving complementary distribution fitting and scenario coverage.

[0188] Construction of CTGAN generation model and generation of first candidate samples:

[0189] The CTGAN generation model optimizes the architecture for the physical characteristics of photovoltaic data, with the following specific structure and training parameters:

[0190] Generator structure: input layer: concatenate 128-dimensional random noise vector (z ~ N(0, 1)) and conditional vector (c), total input dimension is "128 + conditional vector dimension". The conditional vector c injects photovoltaic physical constraints:

[0191] Discrete hash processing: discrete features such as Season (1-4) and Hour (0-23) are encoded using one-hot encoding, e.g. Season = 4 (winter) is encoded as [0, 0, 0, 1];

[0192] Continuous column processing: continuous features such as Irradiance and Temperature use a hybrid component indicator based on "physical interval division" - e.g. Irradiance is divided into 4 intervals according to "0 (night), 1-200 (weak irradiance), 201-500 (moderate irradiance), 501-1200 (strong irradiance)", each interval corresponds to 1 indicator bit.

[0193] Intermediate layer: use 2-layer fully connected MLP, neuron number is 384, 192 in turn; each layer is configured with BatchNorm and LeakyReLU (negative slope = 0.2) to solve the problem of gradient disappearance caused by high complexity of extreme weather data.

[0194] Output layer:

[0195] Continuous columns (such as Irradiance, Temperature): output a vector activated by tanh (-1, 1), which is restored to the original dimension through physical inverse transformation. The inverse transformation formula is combined with photovoltaic physical laws: e.g. Irradiance inverse transformation = max(0, original mean + activation value x original standard deviation) (to ensure non-negative irradiance);

[0196] Integer columns (e.g. Hour, Current Power): output the integer probability after Gumbel-Softmax sampling (temperature=0.1) and rounding, to ensure compliance with integer types;

[0197] Fixed value columns (e.g. Installed Capacity=100): directly output fixed values, not involved in generation (to avoid generating illegal installed capacity).

[0198] Discriminator structure: input layer: use PacGAN-2 structure to concatenate the 12-dimensional features of 2 samples into 24-dimensional input, to suppress the pattern collapse of extreme weather samples (e.g. avoid all rainstorm samples output 10000kW).

[0199] Intermediate layer: 2 layers of fully connected MLP, with neuron numbers of 384 and 192 respectively, and LeakyReLU (negative slope=0.2) as the activation function.

[0200] Output layer: 1 neuron, Sigmoid activation output "true probability" - probability close to 1 indicates discrimination as "original extreme weather sample", close to 0 indicates discrimination as "generated sample".

[0201] Specific training parameters: optimizer: Adam optimizer, learning rate=0.0003, β1=0.5, β2=0.999; loss function: binary cross-entropy loss (BCE), additional "physical constraint loss term" - if the generated sample violates the rules such as "night output≈0" "wind speed>15m / s output decreases", then increase the generator loss (penalty coefficient=0.5); training rounds: 350 rounds, batchsize=128; at the 350th training round, 95% of the generated samples meet the basic physical rules, and the model at this round is selected for generation.

[0202] First candidate sample generation: generate 800 first candidate samples (covering rainstorm, snowstorm, and strong sandstorm scenarios, about 260-270 for each scenario) according to the rule of "8 samples per group, a total of 100 groups";

[0203] Generation result example (rainstorm scenario sample): Irradiance=120.5, Temperature=18.2, WindSpeed=6.5, Cloud Cover=95, Hour=14, Season=2, Installed Capacity=100, Azimuth=180, Tilt Angle=30, Historical Power=18000, Current Power=17500, Power Change Rate=-2.8.

[0204] In this embodiment, the construction of LLM generation model and the generation of second candidate samples: LLM generation model adopts Gemini1.5Pro, generates samples through API call, and is divided into "fixed template type" (basic enhancement) and "no fixed template type" (rare scene supplement). The specific configuration is as follows:

[0205] Fixed template type LLM generation model (basic enhancement sample): input prompt template (contains physical constraints): "task: generate 100MW photovoltaic power station extreme weather scene output sample for short-term output prediction model training.

[0206] Output format: CSV format, no header, no label, a total of 8 rows / groups, each row contains 12 numerical features in the order of: Irradiance, Temperature, WindSpeed, CloudCover, Hour, Season, InstalledCapacity, Azimuth, TiltAngle, HistoricalPower, CurrentPower, PowerChangeRate.

[0207] Constraint conditions:

[0208] 1. Physical value range: Irradiance∈[0,1200], Temperature∈[-20,45], Wind Speed∈[0,30], Cloud Cover∈[0,100] (integer), Hour∈[0,23] (integer), Season∈[1,4] (integer), Installed Capacity=100, Azimuth=180, TiltAngle=30, Current Power∈[0,100000] (integer), Power Change Rate∈[-50,50];

[0209] 2. Meteorological-output physical logic:

[0210] Hour∈[0,6] (night) → Irradiance≤50 and Current Power≤5000;

[0211] Wind Speed>15→Current Power≤Installed Capacity×50% (i.e. ≤50000kW);

[0212] Temperature <-10 or >40 → Current Power ≤ Installed Capacity × 80% (i.e., ≤ 80000 kW);

[0213] Power Change Rate's absolute value ≤ 30 (output hour fluctuation does not exceed 30%);

[0214] 3. Scene coverage: each group of samples contains 2-3 scenes of heavy rain (Cloud Cover > 90, Wind Speed > 5), heavy snow (Temperature < 0, Cloud Cover > 80), and strong sandstorm (Irradiance < 200, Wind Speed > 8).

[0215] Sampling parameters: Temperature = 0.3 (priority to ensure physical legality), Top-p = 0.9.

[0216] Generation strategy: generate 8 for each group, a total of 100 groups, and get 800 second candidate samples;

[0217] Generation result example (strong sandstorm scene sample): Irradiance = 180.2, Temperature = 5.3, WindSpeed = 9.8, CloudCover = 85, Hour = 11, Season = 4, InstalledCapacity = 100, Azimuth = 180, TiltAngle = 30, HistoricalPower = 22000, CurrentPower = 20500, PowerChangeRate = -6.8.

[0218] Fixed template type LLM generation model, (rare scene supplement): input prompt template (only contains core physical logic): "task: generate 100MW photovoltaic power station rare extreme weather scene output sample, for covering long tail mode. Output format: CSV format, no header, no label, a total of 150 rows / group, each row contains 12 numerical features, the order is consistent with the fixed template. Constraints:

[0219] 1. Core physical rules: night output ≤ 5000kW, wind speed > 15m / s output ≤ 50000kW, irradiance and output are positively correlated;

[0220] 2. Rare scene requirements: cover "strong sandstorm + low temperature (Temperature <-5)" "heavy snow + high wind speed (WindSpeed > 12)" "heavy rain + night (Hour ∈ [20, 23])" and other scenes with sample number <20 in the original data;

[0221] 3. Timing consistency: the difference between Current Power and Historical Power ≤ Historical Power x 30% (consistent with the timing fluctuation of photovoltaic output).

[0222] Sampling parameters: Temperature = 0.7 (higher scene diversity), Top-p = 0.95;

[0223] Generation strategy: 150 samples per group, a total of 100 groups, resulting in 15,000 second candidate samples;

[0224] Generation result example (rare scene sample): Irradiance = 80.3, Temperature = -8.5, WindSpeed = 10.2, Cloud Cover = 90, Hour = 13, Season = 4, Installed Capacity = 100, Azimuth = 180, Tilt Angle = 30, Historical Power = 15000, Current Power = 13200, Power ChangeRate = -12.0 (strong sandstorm + low temperature scene).

[0225] Step 3, apply hard constraint conditions to filter illegal samples: apply four hard constraint conditions (highlighting photovoltaic physical characteristics) to the 800 first candidate samples generated by CTGAN, the 800 second candidate samples generated by LLM fixed template, and the 15,000 second candidate samples generated by LLM without fixed template, respectively. Remove illegal samples, specific rules and execution results as follows:

[0226] 1. Physical value constraint:

[0227] Verification rule: based on the physical law of photovoltaic operation, six value constraints are preset, and any violation will be removed:

[0228] Rule 1: Irradiance ≥ 0 (non-negative irradiance);

[0229] Rule 2: Hour ∈ [0, 6] → Irradiance ≤ 50 and Current Power ≤ 5000;

[0230] Rule 3: WindSpeed > 15 → CurrentPower ≤ 50000;

[0231] Rule 4: Temperature <-10 or >40 → CurrentPower ≤ 80000;

[0232] Rule 5: CurrentPower ≤ 100000 (not exceeding installed capacity);

[0233] Rule 6: PowerChangeRate ∈ [-50, 50] (reasonable output fluctuation);

[0234] Execution results: 96 CTGAN samples were removed (12% of the total, mainly violating rules 2 and 3); 64 LLM fixed template samples were removed (8% of the total, mainly violating rules 4 and 5); 3600 LLM non-fixed template samples were removed (24% of the total, mainly violating rules 2 and 3).

[0235] 2. Feature type constraints:

[0236] Verification rules: Check if integer type features (such as Hour, Cloud Cover, Current Power) are integers, and if decimal type features (such as Irradiance, Temperature) retain 1 decimal place;

[0237] Execution results: 32 CTGAN samples were removed (4% of the total, mainly due to Current Power containing decimals); 24 LLM fixed template samples were removed (3% of the total, mainly due to Cloud Cover containing decimals); 1350 LLM non-fixed template samples were removed (9% of the total, mainly due to Hour containing decimals).

[0238] 3. Integer feature rounding verification:

[0239] Verification rules: For integer type features, if a decimal is generated (such as Hour = 14.3), round it to the nearest integer (14.3 → 14); if the rounded value exceeds the range (such as Hour = 23.6 → 24, exceeding the upper limit of 23), it is removed;

[0240] Execution results: 24 CTGAN samples were rounded, with no removal; 16 LLM fixed template samples were rounded, with no removal; 750 LLM non-fixed template samples were rounded, with 75 removed (after rounding, the range was exceeded).

[0241] 4. Meteorological-output logical constraints:

[0242] Verification rules: Based on the photovoltaic module efficiency model, 3 logical constraints are preset, and any violation will be removed:

[0243] Rule 1: Irradiance > 500 → Current Power > 50000 (high irradiance corresponds to high output);

[0244] Rule 2: The absolute value of the difference between Current Power and Historical Power is less than or equal to 30% of Historical Power (reasonable timing fluctuations);

[0245] Rule 3: Season = 4 (winter) and Temperature < -5 → Current Power is 10-15% lower than Season = 2 (summer) under the same irradiance;

[0246] Execution results: 48 CTGAN samples were removed (6% of the total, mainly violating rules 2 and 3); 32 LLM fixed template samples were removed (4% of the total, mainly violating rules 1 and 2); 1800 LLM non-fixed template samples were removed (12% of the total, mainly violating rules 1 and 3).

[0247] After hard constraint filtering, the remaining candidate sample size is: CTGAN samples 592 (800-96-32-0-48), LLM fixed template samples 664 (800-64-24-0-32), LLM non-fixed template samples 8475 (15000-3600-1350-75-1800).

[0248] Step 4, screening high-quality samples with a unified scorer: a unified scorer is built based on Gemini1.5Pro, combined with the original dataset to anchor the real physical distribution, and the candidate samples after hard constraint filtering are scored and screened, with the scoring dimension highlighting "physical reasonableness". The specific configuration and execution process are as follows: unified scorer input information: samples to be scored: 592 CTGAN samples, 664 LLM fixed template samples, and 8475 LLM non-fixed template samples after hard constraint filtering; feature constraint description: "feature name, value range, physical meaning"; reference samples: 80 samples (25 heavy rain, 25 heavy snow, 30 strong sandstorm) are extracted from the original dataset (520) by scene stratification, serving as the benchmark for anchoring the real physical distribution.

[0249] Scoring dimensions and weights The scorer evaluates sample quality from 4 dimensions, with sample consistency (physical logic) weight increased to 0.4. The scoring dimensions include: feature consistency degree with a weight of 0.2, sample consistency with a weight of 0.4, diversity distribution with a weight of 0.25, and overall confidence with a weight of 0.15.

[0250] For example, the specific scoring and screening rules are as follows:

[0251] Step 1: Calculate the 4-dimensional score of each sample, and calculate the total score according to the weight (total score = feature consistency degree × 0.20 + sample consistency × 0.40 + diversity distribution × 0.25 + overall confidence × 0.15).

[0252] Second step: Set the score threshold to 0.7, and remove samples with a total score <0.7;

[0253] Third step: Filter the remaining samples according to "scene coverage priority, total score descending": CTGAN samples and LLM fixed template samples are filtered according to "8 samples per group, Top-3 within the group" (100 groups x 3 = 300 samples / class); LLM samples without fixed templates prefer to retain rare scene samples, and take the top 3000.

[0254] The filtering results are as follows: CTGAN samples: a total of 480 samples with a total score ≥0.7, after filtering within the group Top-3, 300 samples are obtained (95 heavy rain, 95 heavy snow, 110 strong sandstorm); LLM fixed template samples: a total of 496 samples with a total score ≥0.7, after filtering within the group Top-3, 300 samples are obtained (100 heavy rain, 90 heavy snow, 110 strong sandstorm); LLM samples without fixed templates: a total of 3800 samples with a total score ≥0.7, after preferentially retaining rare scene samples, 3000 samples are obtained (including "strong sandstorm + low temperature" 500, "heavy snow + high wind speed" 600, "heavy rain + night" 400).

[0255] Step 5, full column deduplication and sample aggregation:

[0256] First step, full column deduplication: compare the filtered CTGAN samples (300), LLM fixed template samples (300), and LLM samples without fixed templates (3000) with the original dataset (520) for full column comparison - if the values of the 12 features of two samples are exactly the same (including decimal places, such as Irradiance being 120.5), the candidate sample is removed; the deduplication results are as follows: CTGAN samples: 8 duplicates with the original data, after removal, there are 292 remaining; LLM fixed template samples: 6 duplicates with the original data, after removal, there are 294 remaining; LLM samples without fixed templates: 25 duplicates with the original data, after removal, there are 2975 remaining.

[0257] Second step, sample aggregation: insert the deduplicated three types of samples into the output pool to form the initial aggregated sample set (292+294+2975=3561);

[0258] Second deduplication: perform full column second deduplication on the initial aggregated sample set, remove 15 duplicate samples between samples, and obtain the final minority class enhanced sample set with a size of 3546;

[0259] Enhanced sample scene coverage verification: The enhanced sample set covers 1087 heavy rain, 1079 heavy snow, and 1180 strong sandstorm, and the rare scene sample ratio reaches 28% (the original data is only 5%), effectively supplementing the data of rare scenes such as "strong sandstorm + low temperature" and "heavy snow + high wind speed".

[0260] For example, the machine learning-oriented minority class sample enhancement method provided in the embodiment is experimentally verified, and the grouping is as follows:

[0261] G1: LLM Medium + SMOTE (oversample the minority class to 1:1 in the training stage);

[0262] G2: LLM ALL (only LLM source);

[0263] G3: CTGAN (only CTGAN source);

[0264] G4: Original (original data subset, keep imbalance);

[0265] G5: LLM + CTGAN + LLM(GPT2k) + CTGAN(5k) (double-source generation, add CTGAN 5k);

[0266] G6: LLM + CTGAN + LLM(GPT2k) + CTGAN(2k) (double-source generation, add CTGAN 2k);

[0267] G7: LLM + CTGAN + LLM(GPT2k) + CTGAN(10k) (double-source generation, add CTGAN 10k);

[0268] G8: LLM + CTGAN + LLM(GPT2k) (double-source generation, only add a small amount of filtered diversity samples, no longer add CTGAN expansion).

[0269] The specific training set configuration is shown in Table 1:

[0270] Table 1 is the training set configuration table of each model

[0271]

[0272] For example, the overall performance and implementation effect obtained after experimental verification are as shown in Figure 4 and Table 2:

[0273] Table 2 is a specific implementation effect table

[0274]

[0275] In the table, Precision, Recall, F1-score, AUC, and Accuracy are the core indicators for evaluating model performance, each measuring the classification effect of the model from a different perspective.

[0276] Based on the above experimental results, synthetic data quality evaluation (SDmetrics) was conducted, as follows:

[0277] In terms of synthetic data evaluation, SDMetrics was also selected as the quality measurement tool; SDMetrics is an open-source Python library for evaluating synthetic data quality. It provides multi-dimensional metrics and visual reports by comparing synthetic data with real data, helping users ensure the quality and privacy of synthetic data. The reason is that traditional classification indicators (such as AUC, F1, Recall) mainly measure the contribution of augmented samples in downstream prediction tasks, but it is difficult to directly reveal the statistical rationality and structural effectiveness of synthetic data itself. In contrast, SDMetrics provides multi-dimensional evaluation indicators, including feature distribution shape (Column Shapes), feature correlation (Column PairTrends), and legality verification (Data Validity), which can explain the differences between different augmentation strategies from the perspective of data generation quality. It is worth noting that the experimental results show that the augmentation scheme with higher scores on SDMetrics often performs better in AUC / F1 of the classification task, and the trend is consistent, which shows that quality screening not only improves the structural effectiveness of synthetic data, but also brings actual benefits at the task level, thereby establishing a "generation quality-task performance" echo relationship.

[0278] As shown in Tables 3 and 4, the test results and SDmetrics detailed data of different datasets are as follows:

[0279] Table 3 is the synthetic data quality evaluation table

[0280]

[0281] Table 4 is the SDmetrics detailed data

[0282]

[0283] Overall, the results of SDMetrics are consistent with the trends of downstream classification indicators. The best solution LLM+CTGAN+GPT2k+CTGAN1w has a Composite of 0.9064, significantly better than the baseline SMOTE_Positive (0.7562), and the lowest in the de-duplication rate (2.84%). The results show that adding a small amount of filtered diversity samples (such as GPT2k) on the basis of LLM can improve the overall quality; CTGAN scale expansion (2k→5k→1w) brings continuous improvement, but the marginal decrease; the quality score echoes the downstream AUC / F1, among which "large-scale CTGAN+ filtering" is more conducive to recall and generalization, while "CTGAN-only" is more friendly to ranking. Therefore, in practical applications, it is appropriate to combine Composite with AUC / F1 / Recall, etc.

[0284] In summary, dual-source generation has more advantages than single-source: CTGAN can maintain the structural consistency of samples and ranking friendliness, while LLM is good at exploring long-tail patterns, and their combination brings more stable improvement in Recall and F1. Among them, G5 performs the most balanced in classification indicators, while G3 has the highest AUC, showing the unique value of statistical generation in probability ranking. At the same time, the experiment also shows that introducing a small amount of filtered diversity samples (such as GPT2k) on the basis of LLM can significantly improve model performance, while further expanding the sample size of CTGAN can continuously improve Recall and F1, but the gain is marginal and decreasing, and a scale of about 5k is most beneficial to classification, while 10k is slightly more advantageous in ranking indicators. It is worth noting that the results of SDMetrics are consistent with the trends of downstream classification indicators: the enhancement schemes with higher scores tend to perform better in AUC and F1. This shows that the legal range constraint of feature values and unified filtering not only improve the structural effectiveness of synthetic data and reduce the duplication rate, but also bring tangible benefits at the task level. Overall, the "legal range constraint of feature values + dual-source generation + unified filtering" framework proposed by this method can effectively improve the minority class coverage and prediction performance without changing the downstream model.

[0285] In summary, the minority class sample enhancement method for machine learning provided by the embodiment combines the advantages of CTGAN and LLM models to generate high-quality minority class samples. The CTGAN model focuses on generating samples that conform to the data distribution, while the LLM model generates more samples through flexible templates. After each generation step, the Gemini scorer scores the generated samples and selects the best samples to ensure that the final output samples are of high quality and diversity. The final output pool combines the best samples from different models to maximize the data augmentation effect.

[0286] As shown in Figure 3 The embodiment also provides a machine learning-oriented minority class sample enhancement system, which comprises: a data acquisition module configured to acquire an original training data set containing only minority class samples, the minority class samples including a preset number of numerical features; a sample generation module configured to input the original training data set into a pre-built CTGAN generation model to generate first candidate minority class samples, and input the original training data set into a pre-built large language model to generate second candidate minority class samples; wherein the CTGAN generation model is configured to fit the main body distribution of the minority class samples and maintain the column-dependent and joint statistical characteristics, and the large language model is configured to explore the long-tail mode of the minority class samples to realize the complementarity between the long-tail mode coverage and the main body distribution fitting of the minority class samples; a conditional constraint module configured to apply preset hard constraint conditions to the generated first candidate minority class samples and second candidate minority class samples respectively; the hard constraint conditions include feature value legal range verification, feature type verification, integer feature rounding verification and cross-column logical consistency verification; a score screening module configured to anchor the real distribution by combining reference samples extracted from the original data set based on a unified scorer, and screen the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint conditions according to a preset score threshold and a sorting rule; a sample deduplication module configured to perform full-column deduplication on the first candidate minority class samples and the second candidate minority class samples obtained after screening with reference to the original training data set to eliminate duplicate samples; and a sample aggregation module configured to aggregate the first candidate minority class samples and the second candidate minority class samples subjected to the full-column deduplication to obtain a minority class enhancement sample set.

[0287] The application further provides a machine learning-oriented minority class sample enhancement device, which comprises: a memory configured to store a computer program; and a processor configured to execute the computer program to realize the steps of the machine learning-oriented minority class sample enhancement method.

[0288] The processor implements the steps of the machine learning-oriented minority class sample enhancement when executing the computer program, for example: obtaining an original training data set containing only minority class samples, the minority class samples including a preset number of numerical features; inputting the original training data set into a pre-built CTGAN generation model respectively to generate first candidate minority class samples; inputting the original training data set into a pre-built large language model to generate second candidate minority class samples; wherein the CTGAN generation model is used to fit the main body distribution of the minority class samples and maintain the column interdependence and joint statistical characteristics, and the large language model is used to explore the long tail mode of the minority class samples to realize the complementarity between the long tail mode coverage and the main body distribution fitting of the minority class samples; applying a preset hard constraint condition to the generated first candidate minority class samples and second candidate minority class samples respectively; the hard constraint condition includes feature value legal range verification, feature type verification, integer feature rounding verification and cross-column logical consistency verification; based on a unified scorer, combining a reference sample anchor real distribution extracted from the original data set, and according to a preset scoring threshold and a sorting rule, the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint condition are screened respectively; the first candidate minority class samples and the second candidate minority class samples obtained after screening are subjected to full-column deduplication with reference to the original training data set respectively to eliminate duplicate samples; the first candidate minority class samples and the second candidate minority class samples subjected to full-column deduplication are aggregated to obtain a minority class enhanced sample set.

[0289] Exemplarily, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing preset functions, which are used to describe the execution process of the computer program in the machine learning-oriented minority class sample enhancement device. For example, the computer program can be divided into a data acquisition module, a sample generation module, a condition constraint module, a scoring screening module, a sample deduplication module, and a sample aggregation module; the specific functions of each module are as follows: the data acquisition module is used to obtain an original training data set containing only minority class samples, the minority class samples including a preset number of numerical features; the sample generation module is used to input the original training data set into a pre-built CTGAN generation model to generate first candidate minority class samples; and the original training data set is input into a pre-built large language model to generate second candidate minority class samples; wherein the CTGAN generation model is used to fit the main body distribution of the minority class samples and maintain the column-dependent and joint statistical characteristics, and the large language model is used to explore the long-tail mode of the minority class samples to realize the complementarity between the long-tail mode coverage and the main body distribution fitting of the minority class samples; the condition constraint module is used to apply preset hard constraint conditions to the generated first candidate minority class samples and second candidate minority class samples respectively; the hard constraint conditions include feature value legal range verification, feature type verification, integer feature rounding verification, and cross-column logic consistency verification; the scoring screening module is used to screen the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint conditions according to a preset scoring threshold and a sorting rule based on a unified scorer in combination with a reference sample anchor real distribution extracted from the original data set; the sample deduplication module is used to perform full-column deduplication on the first candidate minority class samples and the second candidate minority class samples obtained after screening with reference to the original training data set respectively to eliminate duplicate samples; and the sample aggregation module is used to aggregate the first candidate minority class samples and the second candidate minority class samples subjected to the full-column deduplication to obtain a minority class enhancement sample set.

[0290] The machine learning-oriented minority class sample enhancement device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The machine learning-oriented minority class sample enhancement device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above is an example of the machine learning-oriented minority class sample enhancement device, and does not constitute a limitation on the machine learning-oriented minority class sample enhancement device, and can include more components than the above, or combine certain components, or different components, for example, the machine learning-oriented minority class sample enhancement device can also include an input / output device, a network access device, a bus, and the like.

[0291] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like, which is the control center of the machine learning-oriented minority class sample enhancement, and connects various parts of the machine learning-oriented minority class sample enhancement device through various interfaces and lines.

[0292] The memory can be used to store the computer programs and / or modules, and the processor realizes various functions of the machine learning-oriented minority class sample enhancement device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory.

[0293] The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; and the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, for example, a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state memory devices.

[0294] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the machine learning-oriented minority class sample enhancement method.

[0295] If the modules / units integrated in the machine learning-oriented minority class sample enhancement system are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium.

[0296] Based on such understanding, the present application implements all or part of the processes in the machine learning-oriented minority class sample enhancement method described above, which can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, the computer program can implement the steps of the machine learning-oriented minority class sample enhancement method described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or preset intermediate forms, etc.

[0297] The computer-readable storage medium can include any entity or device, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. that can carry the computer program code.

[0298] It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.

[0299] The present application provides a machine learning-oriented minority class sample enhancement method, which has the following advantages compared with existing sample enhancement methods:

[0300] The present application realizes high-quality minority class sample enhancement by fusing the double-path generation mechanism of CTGAN and large language models, combining strict hard constraint conditions, unified scoring screening, and full-column deduplication aggregation processes. CTGAN accurately fits the main body distribution and inter-column dependency of minority class samples through adversarial training, ensuring the statistical rationality of the generated samples. The large language model breaks through the linear interpolation limit, explores potential long-tail feature combinations, and makes up for the distribution coverage blind area, forming a complementary generation mechanism. Subsequently, the hard constraint forcibly checks the feature legality, type matching, and cross-column logical consistency, eliminating invalid samples caused by model hallucinations; the unified scorer anchors the real distribution of the original data set to filter high-confidence samples; the full-column deduplication ensures the uniqueness of the samples, and finally the aggregated sample set strengthens the diversity. The use of this method significantly improves the diversity and effectiveness of the synthesized samples, overcoming the problems of insufficient coverage of long-tail features, interpolation bottlenecks, and logical contradictions of single technologies; the systematic quality control process realizes the dynamic balance of scale expansion, quality assurance, and diversity improvement, enhancing the sample to better meet the needs of downstream classification tasks.

[0301] The above embodiment is only one of the implementation manners of the technical scheme of the present application, and the protection scope of the present application is not limited to the above embodiment, but also includes any changes, substitutions and other implementation manners which are easily thought by those skilled in the art within the technical scope disclosed by the present application.

[0302] Finally, it should be noted that the above embodiments are only used to illustrate the technical scheme of the present application, but not to limit it. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the specific implementation manners of the present application can be modified or replaced equivalently without departing from the spirit and scope of the present application, and any modification or equivalent replacement should be covered in the protection scope of the claims of the present application.

Claims

1. A machine learning oriented minority class sample enhancement method, characterized by, The method comprises the following steps: obtain an original training data set containing only a few class samples, which include a preset number of numerical features; input the original training data set into a pre-built CTGAN generation model to generate first candidate few-class samples, and input the original training data set into a pre-built large language model to generate second candidate few-class samples; wherein the CTGAN generation model is used to fit the main distribution of the few-class samples and maintain the column-dependent and joint statistical characteristics, and the large language model is used to explore the long-tail mode of the few-class samples to realize the complementarity between the long-tail mode coverage and the main distribution fitting of the few-class samples; apply the generated first candidate few-class samples and second candidate few-class samples to a preset hard constraint condition respectively; the hard constraint condition includes feature value range verification, feature type verification, integer feature rounding verification and cross-column logical consistency verification; based on a unified scorer, combine the reference sample anchor real distribution extracted from the original data set, and screen the first candidate few-class samples and the second candidate few-class samples subjected to the hard constraint condition according to a preset scoring threshold and a sorting rule respectively; refer to the original training data set to perform full-column deduplication on the screened first candidate few-class samples and second candidate few-class samples to eliminate duplicate samples; aggregate the first candidate few-class samples and the second candidate few-class samples subjected to full-column deduplication to obtain a few-class enhanced sample set.

2. The machine learning oriented minority class sample enhancement method according to claim 1, characterized in that, The specific structure of the CTGAN generation model is configured as: The generator structure of the CTGAN generation model includes an input layer, an intermediate layer and an output layer; wherein the input layer of the generator structure is used to splice a random noise vector and a condition vector, and the condition vector is used to inject column-level conditions, wherein discrete hash uses one-hot encoding, and continuous columns use mixed component indication; the intermediate layer of the generator structure adopts a fully connected multilayer perceptron, and each hidden layer is sequentially configured with batch normalization and leaky rectified linear unit; in the output layer of the generator structure, a vector activated by tanh and having a value range of (-1, 1) is output for continuous columns, and then the value is restored to the original dimension through numerical inverse transformation; for discrete or enumerated columns, the log probability of each category is output, and Gumbel-Softmax or Softmax is used for approximate one-hot sampling; The discriminator structure of the CTGAN generation model includes an input layer, an intermediate layer and an output layer; wherein the input layer of the discriminator structure adopts a PacGAN-2 structure and is used to splice two samples in the feature dimension before input; the intermediate layer of the discriminator structure adopts a fully connected structure, and the activation function is LeakyReLU; the output layer of the discriminator structure adopts one neuron and is used to output the true or false probability of the sample through Sigmoid activation.

3. The machine learning oriented minority class sample enhancement method according to claim 1, characterized in that, The large language model adopts an LLM generation model; the LLM generation model includes two types of fixed template type and non-fixed template type, and the specific configuration is as follows: In the fixed template type LLM generation model, the input includes a fixed field order, a feature value range constraint, a cross-column logical consistency constraint, and a part of real minority class samples; the generation rule is: a pre-trained large language model is called through a preset interface, and a first preset number of second candidate samples stored in CSV format without a table header and a label are generated by temperature sampling; the first preset number of second candidate samples are used as basic enhancement samples together with the first candidate samples; In the no-fixed template type LLM generation model, the input includes only a minority class sample basic logical constraint and no feature value range setting; the generation rule is: the same pre-trained large language model as the fixed template type is called through the preset interface, and a second preset number of second candidate samples are generated at a time; the second preset number of second candidate samples are only used to supplement the diversity of the enhancement sample set and are not used as basic enhancement samples; wherein the second preset number is at least 200 times the first preset number.

4. The machine learning oriented minority class sample enhancement method according to claim 3, characterized in that, The autoregressive target representation of the LLM generation model is: where θ represents model parameters; t represents a position in the sequence; prompt represents a model context prompt, including instructions, questions, and guiding text; represents a probability; represents a token; represents all tokens before the t-th step.

5. The machine learning oriented minority class sample enhancement method according to claim 1, characterized in that, The unified scorer is specifically configured as: The input information of the unified scorer is: first, the first candidate minority class sample and the second candidate minority class sample to be scored, both of which contain numerical features in a fixed order; second, the upper and lower bounds of each numerical feature value and the data type description; and third, multiple reference samples randomly extracted from the original training data set to anchor the real distribution as reference samples. The scoring dimensions of the unified scorer are: feature consistency, sample consistency, diversity distribution, and overall confidence, and the sum of the weights corresponding to each scoring dimension is 1. The scoring rule of the unified scorer is: Output a score in the range of 0-1 according to the scoring dimension, and then calculate the total score according to the weight; select samples with a total score not lower than a preset score threshold; sort the selected samples in descending order of total score, and select the top samples according to a preset number. The first candidate minority class sample and the second candidate minority class sample obtained after screening are subjected to full-column deduplication with reference to the original training data set, including:

6. The machine learning oriented minority class sample enhancement method according to claim 1, characterized in that, Compare all numerical features of the first candidate minority class sample and the second candidate minority class sample after screening with the original training data set, and if the numerical feature values of the two samples are completely the same, remove one of the samples. The first candidate minority class sample and the second candidate minority class sample after full-column deduplication are aggregated, including:

7. The machine learning oriented minority class sample enhancement method according to claim 1, characterized in that, Insert the first candidate minority class sample and the second candidate minority class sample after full-column deduplication into a preset output pool to form an initial aggregation sample set; Perform full-column secondary deduplication on all minority class samples in the initial aggregation sample set to obtain a minority class enhancement sample set. It includes:

8. A machine learning oriented minority class sample augmentation system, characterized by, A data acquisition module for acquiring an original training data set containing only minority class samples, the minority class samples including a preset number of numerical features; ​ The sample generation module is configured to input the original training data set into a pre-built CTGAN generation model to generate first candidate minority class samples, and input the original training data set into a pre-built large language model to generate second candidate minority class samples. The CTGAN generation model is configured to fit the main body distribution of the minority class samples and maintain the column-dependent and joint statistical characteristics. The large language model is configured to explore the long-tail mode of the minority class samples to realize the complementarity between the long-tail mode coverage and the main body distribution fitting of the minority class samples. The conditional constraint module is configured to apply preset hard constraint conditions to the generated first candidate minority class samples and second candidate minority class samples respectively. The hard constraint conditions include feature value legal range verification, feature type verification, integer feature rounding verification, and cross-column logic consistency verification. The scoring and screening module is configured to anchor the real distribution based on a unified scorer in combination with reference samples extracted from the original data set, and to screen the first candidate minority class samples and the second candidate minority class samples subjected to the hard constraint conditions according to a preset scoring threshold and a sorting rule. The sample deduplication module is configured to perform full-column deduplication on the first candidate minority class samples and the second candidate minority class samples obtained after screening with reference to the original training data set to eliminate duplicate samples. The sample aggregation module is configured to aggregate the first candidate minority class samples and the second candidate minority class samples subjected to full-column deduplication to obtain a minority class enhanced sample set.

9. A machine learning oriented minority class sample enhancement device, characterized by, The computer program is executed by the processor to implement the steps of the machine learning-oriented minority class sample enhancement method according to any one of claims 1-7. The computer program is executed by the processor to implement the steps of the machine learning-oriented minority class sample enhancement method according to any one of claims 1-7. ​ 10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. ​

Citation Information

Patent Citations

  • Stacked network model-based sparse small sample industrial process quality prediction method

    CN120494633A

  • Systems and methods for training language models to reason over tables

    US20220309087A1