function computeSegmentedFeatureDistributions(type, domain, values) {
  if (![FEATURE_TYPE.CATEGORICAL, FEATURE_TYPE.NUMERICAL].includes(type)) {
    throw new Error('unknown or invalid feature type: ', type);
  }
  const histogramFunc =
    type === FEATURE_TYPE.CATEGORICAL ? computeHistogramCat : computeHistogram;
  // use same bins for every segmented distributions
  // use `[0]` to get only histogram values and not domains
  const T = histogramFunc(values[0], domain)[0];
  const C = histogramFunc(values[1], domain)[0];
  return [T, C];
}
@param {String} type - data type
@param {[Number|String]} domain - an array representing the domain of the distribution
@param {[Array]} values - an array of 2 arrays, each containing feature values of the 2 segment groups
@return {[Array]} an array of 2 arrays, each containing histogram values of the 2 segment groups