This is the code for my paper Segmented Reverse Diffusion Model for Class Imbalance. it is a simpler way to implement binary encoder for discrete data and diffusion models. The dataset can be download here: https://data.mendeley.com/datasets/c2gw7fy2j4/3