The invention discloses an attention mechanism optimization-based integrated genetic
feature selection method, which is used for carrying out
feature selection on a training
data set for
software defect prediction through a
genetic algorithm. Specifically, a binary
system is used for coding genes of individuals, then the individuals are used as masks, features are selected from a training
data set to construct a feature subset, 1 represents
feature selection, and 0 represents feature non-selection. The
mass fraction of each
gene in the parent is calculated through a multi-head attention mechanism, the crossed positions are selected according to the
mass fractions of the genes to generate
offspring individuals, and the higher the
mass fractions of the genes are, the higher the probability of being selected is. Training the base model by using the feature subset, calculating a
mean square error of the feature subset on the base model, taking a negative value as a fitness value, taking an individual with the highest fitness value as an optimal individual, selecting features from the training
data set, and constructing the feature subset to
train the
software defect prediction model. And the generalization ability and the training efficiency of the model are improved.