handling case when there is only one categorical value for y