def _variance_within_cluster(clu, X):
    """Calculate the variance for objects within the same clusters.
    
    Parameters
    ----------
    clu : list of frozensets
        Resource groups in an organizational model.
    X : DataFrame
        The corresponding resource feature table used for deriving the 
        resource groups.

    Returns
    -------
    var_between : float
        The result within-cluster variance.
    """
    from numpy import mean, sum
    var_within = 0
    for ig, g in enumerate(clu):
        g_mean = mean(X.loc[g].values, axis=0)
        var_within += sum((X.loc[g].values - g_mean) ** 2)
    var_within /= len(X) - len(clu)
    return var_within
