Skip to main content

Implements the Computational Hypergraph Discovery algorithm

Project description

Computational Hypergraph Discovery: A Gaussian process framework for connecting the dots

License: Apache 2.0 Python 3.11.4 GitHub Repo

This is the source code for the paper "Computational Hypergraph Discovery: A Gaussian process framework for connecting the dots".

Please see the companion blog post for a gentle introduction to the method and the code. See the repo here for full documentation and examples.

Installation

The code is written in Python 3 and requires the following packages:

  • matplotlib
  • NumPy
  • scipy
  • scikit-learn
  • networkx

You can install using pip:

pip install ComputationalHypergraphDiscovery

Quick start

Graph discovery takes very little time. The following code runs the method on the example dataset provided in the repo. The dataset is a 2D array of shape (n_samples, n_features) where each row is a sample and each column is a feature. After fitting the model, the graph is stored in the GraphDiscovery object, specifically its graph G attribute. The graph is a networkx object, which can be easily plotted using .plot_graph().

You can find the Sachs dataset in the repo, at this link.

import ComputationalHypergraphDiscovery as CHD
import pandas as pd
df=pd.read_csv('path_to\SachsData.csv')
kernel=CHD.Modes.LinearMode()+CHD.Modes.QuadraticMode()
graph_discovery = CHD.GraphDiscovery.from_dataframe(df,mode_kernel=kernel)
graph_discovery.fit()
graph_discovery.plot_graph()

Available modifications of the base algorithm

The code gives an easy-to-use interface to manipulate the graph discovery method. It is designed to be modular and flexible. The main changes you can make are

  • Kernels and modes: You can decide what type of function will be used to link the nodes. The code provides a set of kernels, but you can easily add your own. The interface is designed to resemble the scikit-learn API, and you can use any kernel from scikit-learn.
  • Decision logics: In order to identify the edges of the graph, we need to decide whether certain connections are significant. The code provides indicators (like the level of noise), and the user specifies how to interpret them. The code provides a set of decision logic, but you can define your own.
  • Clustering: If a set of nodes is highly dependent, it is possible to merge them into a cluster of nodes. This gives greater readability and prevents the graph discovery method from missing other connections.
  • Possible edges: If you know that specific nodes cannot be connected, you can specify it to the algorithm. By default, all edges are possible.

Full documentation is available here.

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

ComputationalHypergraphDiscovery-1.0.1.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file ComputationalHypergraphDiscovery-1.0.1.tar.gz.

File metadata

File hashes

Hashes for ComputationalHypergraphDiscovery-1.0.1.tar.gz
Algorithm Hash digest
SHA256 eec4fcbb168c7b21ea85aaaf008827b3fac2e50fb7e45f7c00d905789f9512bb
MD5 2e402afda8dc071a3655a5733138ecd2
BLAKE2b-256 e6c99d64cadcb553aae364efa190defc4c764b8925007d6b8fee780f6c63dc07

See more details on using hashes here.

File details

Details for the file ComputationalHypergraphDiscovery-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ComputationalHypergraphDiscovery-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 786fe7544d7a0c75fcc8c6d0fa256b800428efc1685f519d0f109f6b9a0326cf
MD5 539f8b1f91e8d8ce65c0e4d38d2c8eea
BLAKE2b-256 f585e49b7582fdf71be42f54a3c59648fd85869d2c5154eb9bb7e57e93498913

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