IP Library Granted Patent US 11,762,949
Granted Patent B2
US 11,762,949 · App. 17/789,392 · Granted Sep 19, 2023

Classification model training method, system, electronic device and strorage medium

Inventor: Gangfeng Wang (Shandong, CN)
Assignee: SHANDONG YINGXIN COMPUTER TECHNOLOGIES CO., LTD.
G06F18/214
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,762,949
App. No.
17/789,392
Granted
Sep 19, 2023
Kind
B2
Abstract

Provided are a classification model training method, system, electronic device, and storage medium. The method includes: determining sampling rates of first-class samples and second-class samples in a data set, and setting the samples with a sampling rate less than a preset value as target samples (S 101 ); determining data distribution feature information of the target samples based on Euclidean distances between all the samples in the data set (S 102 ); wherein the data distribution feature information is information describing the number of same-class samples in nearest neighbor samples, and the nearest neighbor samples are two samples at a Euclidean distance less than a preset distance; generating new samples corresponding to the target samples based on the data distribution feature information (S 103 ); and training the classification model using the first-class samples, the second-class samples and the new samples (S 104 ).

Claims (53)

1. A classification model training method, comprising:

determining sampling rates of first-class samples and second-class samples in a data set, and setting the first-class samples and the second-class samples with a sampling rate less than a preset value as target samples;

determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set, wherein the data distribution feature information is information describing a number of same-class samples in nearest neighbor samples, and the nearest neighbor samples are two samples at a Euclidean distance less than a preset distance;

generating new samples corresponding to the target samples based on the data distribution feature information; and

training the classification model using the first-class samples, the second-class samples and the new samples;

wherein the determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set comprises:

calculating a superiority ratio between any two nearest neighbor target samples using a first formula, and determining the superiority ratio as the data distribution feature information, wherein the two nearest neighbor target samples are two target samples at a Euclidean distance less than the preset distance;

wherein the first formula is Rat im =Numx i /Numx im , where Rat im is a superiority ratio between a sample x i and a sample x im , x i is any sample in the target samples, x im is an m-th nearest neighbor sample in k same-class nearest neighbor samples of the sample x i , Numx i is a number of target samples in k nearest neighbor samples of the sample x i , and Numx im is a number of target samples in k nearest neighbor samples of the sample x im ; and

wherein the generating new samples corresponding to the target samples based on the data distribution feature information comprises:

in case that the superiority ratio is less than 1, generating a new sample x newim corresponding to the target samples using a second formula, wherein the second formula is x newim =x im +rand(0, 1)*Rat im *(x i −x im );

in case that the superiority ratio is greater than 1, generating a new sample x newim corresponding to the target samples using a third formula, wherein the third formula is x newim =x i +(rand(0, 1)/Rat im )*(x im −x i ); and

in case that the superiority ratio is equal to 1, generating a new sample x newim corresponding to the target samples using a fourth formula, wherein the fourth formula is x newim =x i +rand(0, 1)*(x im −x i ).

2. The classification model training method of claim 1 , wherein the training the classification model using the first-class samples, the second-class samples and the new samples comprises:

performing a sampling operation on the first-class samples, the second-class samples and the new samples to obtain a sampling result, and performing a training operation on the classification model based on the sampling result to obtain a trained file type detection model.

3. The classification model training method of claim 2 , wherein the first-class samples are virus file samples, the second-class samples are non-virus file samples and the classification model is a file type detection model.

4. The classification model training method of claim 3 , wherein after the performing a training operation on the classification model based on the sampling result, the method further comprises:

performing a detection operation on an unknown file using the trained file type detection model to generate a detection result, to determine whether the unknown file is a virus file based the detection result.

5. The classification model training method of claim 1 , wherein the determining sampling rates of first-class samples and second-class samples in a data set comprises:

determining the sampling rates of the first-class samples and the second-class samples in the data set based on quantitative proportions of the first-class samples and the second-class samples in the data set.

6. An electronic device, comprising a memory and a processor, wherein the memory has a computer program stored thereon; and the processor, when calling the computer program stored in the memory, implements a classification model training method, comprising:

determining sampling rates of first-class samples and second-class samples in a data set, and setting the first-class samples and the second-class samples with a sampling rate less than a preset value as target samples;

determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set, wherein the data distribution feature information is information describing a number of same-class samples in nearest neighbor samples, and the nearest neighbor samples are two samples at a Euclidean distance less than a preset distance;

generating new samples corresponding to the target samples based on the data distribution feature information; and

training the classification model using the first-class samples, the second-class samples and the new samples;

wherein the determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set comprises:

calculating a superiority ratio between any two nearest neighbor target samples using a first formula, and determining the superiority ratio as the data distribution feature information, wherein the two nearest neighbor target samples are two target samples at a Euclidean distance less than the preset distance;

wherein the first formula is Rat im =Numx i /Numx im , where Rat im is a superiority ratio between a sample x i and a sample x im , x i is any sample in the target samples, x im is an m-th nearest neighbor sample in k same-class nearest neighbor samples of the sample x i , Numx i is a number of target samples in k nearest neighbor samples of the sample x i , and Numx im is a number of target samples in k nearest neighbor samples of the sample x im ; and

wherein the generating new samples corresponding to the target samples based on the data distribution feature information comprises:

in case that the superiority ratio is less than 1, generating a new sample x newim corresponding to the target samples using a second formula, wherein the second formula is x newim =x im +rand(0, 1)*Rat im *(x i −x im );

in case that the superiority ratio is greater than 1, generating a new sample x newim corresponding to the target samples using a third formula, wherein the third formula is x newim =x i +(rand(0, 1)/Rat im )*(x im −x i ); and

in case that the superiority ratio is equal to 1, generating a new sample x newim corresponding to the target samples using a fourth formula, wherein the fourth formula is x newim =x i +rand(0, 1)*(x im −x i ).

7. The electronic device of claim 6 , wherein the training the classification model using the first-class samples, the second-class samples and the new samples comprises:

performing a sampling operation on the first-class samples, the second-class samples and the new samples to obtain a sampling result, and performing a training operation on the classification model based on the sampling result to obtain a trained file type detection model.

8. The electronic device of claim 7 , wherein the first-class samples are virus file samples, the second-class samples are non-virus file samples and the classification model is a file type detection model.

9. The electronic device of claim 8 , wherein after the performing a training operation on the classification model based on the sampling result, the method further comprises:

performing a detection operation on an unknown file using the trained file type detection model to generate a detection result, to determine whether the unknown file is a virus file based the detection result.

10. A non-transitory storage medium, having computer-executable instructions stored thereon, wherein the computer-executable instructions, when loaded and executed by a processor, implements a classification model training method, comprising:

determining sampling rates of first-class samples and second-class samples in a data set, and setting the first-class samples and the second-class samples with a sampling rate less than a preset value as target samples;

determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set, wherein the data distribution feature information is information describing a number of same-class samples in nearest neighbor samples, and the nearest neighbor samples are two samples at a Euclidean distance less than a preset distance;

generating new samples corresponding to the target samples based on the data distribution feature information; and

training the classification model using the first-class samples, the second-class samples and the new samples;

wherein the determining data distribution feature information of the target samples based on Euclidean distances between all the first-class samples and the second-class samples in the data set comprises:

calculating a superiority ratio between any two nearest neighbor target samples using a first formula, and determining the superiority ratio as the data distribution feature information, wherein the two nearest neighbor target samples are two target samples at a Euclidean distance less than the preset distance;

wherein the first formula is Rat im =Numx i /Numx im , where Rat im is a superiority ratio between a sample x i and a sample x im , x i is any sample in the target samples, x im is an m-th nearest neighbor sample in k same-class nearest neighbor samples of the sample x i , Numx i is a number of target samples in k nearest neighbor samples of the sample x i , and Numx im is a number of target samples in k nearest neighbor samples of the sample x im ; and

wherein the generating new samples corresponding to the target samples based on the data distribution feature information comprises:

in case that the superiority ratio is less than 1, generating a new sample x newim corresponding to the target samples using a second formula, wherein the second formula is x newim =x im +rand(0, 1)*Rat im *(x i −x im );

in case that the superiority ratio is greater than 1, generating a new sample x newim corresponding to the target samples using a third formula, wherein the third formula is x newim =x i +(rand(0, 1)/Rat im )*(x im −x i ); and

in case that the superiority ratio is equal to 1, generating a new sample x newim corresponding to the target samples using a fourth formula, wherein the fourth formula is x newim =x i +rand(0, 1)*(x im −x i ).

11. The non-transitory storage medium of claim 10 , wherein the training the classification model using the first-class samples, the second-class samples and the new samples comprises:

performing a sampling operation on the first-class samples, the second-class samples and the new samples to obtain a sampling result, and performing a training operation on the classification model based on the sampling result to obtain a trained file type detection model.

12. The non-transitory storage medium of claim 11 , wherein the first-class samples are virus file samples, the second-class samples are non-virus file samples and the classification model is a file type detection model.

13. The non-transitory storage medium of claim 12 , wherein after the performing a training operation on the classification model based on the sampling result, the method further comprises:

performing a detection operation on an unknown file using the trained file type detection model to generate a detection result, to determine whether the unknown file is a virus file based the detection result.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 27, 2022
From: WANG, GANGFENG
To: SHANDONG YINGXIN COMPUTER TECHNOLOGIES CO., LTD.
Reel/Frame 060322/0183 →
Priority Claims (1)
CN 201911398087.1 · Dec 30, 2019 · national
Continuity (1)
Related Publication 20230038579A1 · Feb 9, 2023