Skip to content

Separating feature construction from calculation of distances #174

Description

@sdmccabe

Many of the graph distances here are essentially two-step processes:

  1. calculate some feature vector for each graph
  2. calculate a distance between those feature vectors

So, DegreeDivergence computes the degree histograms and NetSimile constructs a vector of "signatures," then DegreeDivergence computes the JSD and NetSimile computes Canberra distance. The choice here is sometimes principled, sometimes arbitrary.

It would be preferable, to make the package flexible, to make these slightly more explicitly distinct. In practice this would look a lot like how the thresholding issue for graph reconstructions was handled (#38).

A conceptual illustration using DegreeDivergence:

class DegreeDivergence(BaseDistance):
    def dist(self, G1, G2, measure_type='jsd'):
        # get the degrees
        # from degree sequences to degree histograms
        dist = measure(p1, p2, measure_type)

where measure is basically a wrapper around things like np.linalg.norm, sp.stats.wasserstein_distance, or our JSD function (#165).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions