get_summary_stats function

Internal function that calculates the sufficient statistics for the segmentation model