ragibson / ModularityPruning

Pruning tool to identify small subsets of network partitions that are significant from the perspective of stochastic block model inference. This method works for single-layer and multi-layer networks, as well as for restricting focus to a fixed number of communities when desired.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refuse to use CHAMP's small step interior point calculation

ragibson opened this issue · comments

CHAMP's fallback of "taking a small step" during halfspace intersection seems to return incorrect results. We need to find a way to raise errors when this fallback occurs.

Since the halfspace intersection algorithm uses a duality that changes distances from the interior point to their inverses, it seems CHAMP's small step fallback

    # take a small step into interior from 1st plane.
    dim = hs_list.shape[1] - 1  # hs_list has shape (number of halfspaces, dimension+1)
    intpt = np.array([0 for _ in range(dim - 1)] + [np.max(z_vals)])
    internal_step = np.array([.000001 for _ in range(dim)])
    return intpt + internal_step

is actually more stable if you take a larger step (since inverting the distances isn't as extreme then). For example,

    # take a small step into interior from 1st plane.
    dim = hs_list.shape[1] - 1  # hs_list has shape (number of halfspaces, dimension+1)
    intpt = np.array([0 for _ in range(dim - 1)] + [np.max(z_vals)])
    internal_step = np.array([1 for _ in range(dim)])
    return intpt + internal_step

The fix in wweir827/CHAMP@8cbfd64 should resolve this issue (at least partially).