Method, related device, equipment and storage medium for generating counterfactual samples
Патент · CN B
Полный текст
The application discloses a method for generating a counterfactual sample, which can be applied to the fields including but not limited to the fields of man-machine interaction and the like. The method comprises the steps of obtaining category probability distribution through a text classification model based on an original text sample, determining the association score of each text unit in the original text sample according to the category probability distribution, determining N causal fragments from the original text sample according to the association score of each text unit, carrying out covering treatment on M causal fragments in the N causal fragments to obtain a target text sample, obtaining M target fragments through a text generation model based on the target text sample, and replacing the M causal fragments in the original text sample with the M target fragments to obtain a counterfactual sample. The application also provides a device, equipment and a storage medium. According to the application, the counterfactual sample can be automatically generated without manual intervention, so that the cost of data augmentation is reduced.