Skip to main content

Regularized methods for efficient ranking in networks

Project description

license PyPI version PyPI downloads Build Status Open Source Love

rSpringRank implements a collection of regularized, convex models (+solvers) that allow the inference of hierarchical structure in a directed network, which exists due to dominance, social status, or prestige. Specifically, this work leverages the time-varying structure and/or the node metadata present in the data set.

This is the software repository behind the paper:

  • Tzu-Chi Yen and Stephen Becker, Regularized methods for efficient ranking in networks, in preparation.
  • For full documentation, please visit this site.
  • General Q&A, ideas, or other things, please visit Discussions.
  • Software-related bugs, issues, or suggestions, please use Issues.

Installation

rSpringRank is available on PyPI. It also depends on graph-tool. We recommend using conda to manage packages.

conda create --name rSpringRank-dev -c conda-forge graph-tool
conda activate rSpringRank-dev
pip install rSpringRank

Example

# Import the library
import rSpringRank as sr

# Load a data set
g = sr.datasets.us_air_traffic()

# Create a model
model = sr.optimize.rSpringRank(method="annotated")

# Fit the model: We decided to analyze the `state_abr` nodal metadata,
# We may inspect `g.list_properties()` for other metadata to analyze.
result = model.fit(g, alpha=1, lambd=0.5, goi="state_abr")

# Now, result["primal"] should have the rankings. We can compute a summary.
summary = sr.compute_summary(g, "state_abr", primal_s=result["primal"])

Let's plot the rankings, via sr.plot_hist(summary). Note that most of the node catetories are regularized to have the same mean ranking.

A histogram of four ranking groups, where most of the metadata share the same mean ranking.

We provided a summary via sr.print_summary_table(summary).

  +-------+-------+--------+-----------------------------------------+--------+---------+
  | Group | #Tags | #Nodes | Members                                 |   Mean |     Std |
  +-------+-------+--------+-----------------------------------------+--------+---------+
  | 1     |     5 |    825 | CA, WA, OR, TT, AK                      |  0.047 | 1.1e-02 |
  | 2     |     4 |    206 | TX, MT, PA, ID                          | -0.006 | 4.2e-03 |
  | 3     |    43 |   1243 | MI, IN, TN, NC, VA, IL, CO, WV, MA, WI, | -0.035 | 4.3e-03 |
  |       |       |        | SC, KY, MO, MD, AZ, PR, LA, UT, MN, GA, |        |         |
  |       |       |        | MS, HI, DE, NM, ME, NJ, NE, VT, CT, SD, |        |         |
  |       |       |        | IA, NV, ND, AL, OK, AR, NH, RI, OH, FL, |        |         |
  |       |       |        | KS, NY, WY                              |        |         |
  | 4     |     1 |      4 | VI                                      | -0.072 | 0.0e+00 |
  +-------+-------+--------+-----------------------------------------+--------+---------+

The result suggests that states such as CA, WA, or AK are significantly more popular than other states.

Data sets

We have a companion repo—rSpringRank-data—for data sets used in the paper. Which are:

In addendum, we have provided the rSpringRank.datasets submodule to load data sets hosted by other repositories, such as the Netzschleuder. See the docs for more information.

Development

The library uses pytest to ensure correctness. The test suite depends on mosek and gurobi.

License

rSpringRank is open-source and licensed under the GNU Lesser General Public License v3.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rspringrank-0.2.28.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

rspringrank-0.2.28-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file rspringrank-0.2.28.tar.gz.

File metadata

  • Download URL: rspringrank-0.2.28.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for rspringrank-0.2.28.tar.gz
Algorithm Hash digest
SHA256 708e9d0346d6aea841df2b4b3c3983fb26a663c3ff3a6438f4918f0be7ed1f7a
MD5 383eefbdcd4ed726b46adfa38308c6fb
BLAKE2b-256 c88638bf521c9d0767db16d52d1e0cbca7d7d8a90046eb2aa010e7af3ff448b6

See more details on using hashes here.

File details

Details for the file rspringrank-0.2.28-py3-none-any.whl.

File metadata

  • Download URL: rspringrank-0.2.28-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for rspringrank-0.2.28-py3-none-any.whl
Algorithm Hash digest
SHA256 41f5c59c5f144996c5ae40603484a3377c216d18f39fa19532b40af7addeeffb
MD5 1ca369eb9513751a7e8c9be1e018bf15
BLAKE2b-256 ed7b8aabf9efcad0379a2b81c9ec4b294c8eaf4ba07df2c698766a94c346483a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page