Machine Learning with Graphs Library
This Python library offers a comprehensive suite of graph-based machine learning algorithms, designed for ease of use and versatility.
Features
- Graph Neural Networks (GNNs): Includes GCNs, GATs, and more.
- Graph Clustering Algorithms: Features Spectral Clustering, Louvain method, and others.
- Graph Embedding Methods: Implements Node2Vec, DeepWalk, etc.
- Diverse Range of Algorithms: For various graph-based learning tasks.
Installation
pip install machine_learning_with_graph
Usage
Scripts in the examples folder demonstrate various algorithms' usage.
Example to integrate spectral clustering method
import networkx as nx
from networkx.generators.community import stochastic_block_model
from ml_wg.clustering.spectral import SpectralClustering
import numpy as np
# Create a Stochastic Block Model graph
sizes = [15, 15, 15] # Sizes of each block
p_matrix = [[0.5, 0.1, 0.05],
[0.1, 0.5, 0.1],
[0.05, 0.1, 0.5]] # Probability matrix
G = stochastic_block_model(sizes, p_matrix)
# Get the adjacency matrix
adj_matrix = nx.to_numpy_array(G)
# Apply our spectral clustering library
sc = SpectralClustering(n_clusters=3)
clusters = sc.fit_predict(adj_matrix)
# Create a color map based on cluster labels
color_map = ['red' if clusters[node] == 0 else 'blue' if clusters[node] == 1 else 'green' for node in G.nodes()]
# Draw the network
nx.draw(G, node_color=color_map, with_labels=True, node_size=500, font_size=10)
plt.title("Stochastic Block model Graph Visualization")
plt.show()
Output:
Testing
Run tests using pytest:
pytest
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Developer Guide
To contribute to the project, follow these steps to set up a local development environment:
- Clone the Repository:
git clone https://github.com/susheelg1197/machine-learning-with-graphs-lib.git
cd machine-learning-with-graphs-lib
- Create and Activate a Virtual Environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
- Install Dependencies:
pip install -r requirements.txt
- Make Changes:
- Implement new features or fix bugs.
- Write tests to ensure functionality.
- Testing: Add test cases within testing folder
pytest
- Commit Your Changes:
git add .
git commit -m "Your detailed description of changes"
- Push to Your Fork and Create a Pull Request.
Please ensure your code adheres to the project's coding standards and include tests for new features.
Metadata
Release files for machine-learning-with-graph 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| machine_learning_with_graph-0.0.3.tar.gz | 7.6 kB | Without provenance | Details for machine_learning_with_graph-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| machine_learning_with_graph-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for machine_learning_with_graph-0.0.3-py3-none-any.whl |
Total release size: 22.9 kB
Release files / machine_learning_with_graph-0.0.3.tar.gz
| Download URL | machine_learning_with_graph-0.0.3.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b85664144ad098bbf3ddbe046b4ede9f5b2bcac28354b727fd1757d18b80bb21
|
|
BLAKE2b-256 checksum How to use checksums |
d6a565ec775046e7ae00d5e72b9e6646ca5d29fe603e9f0394142d31753ea89a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / machine_learning_with_graph-0.0.3-py3-none-any.whl
| Download URL | machine_learning_with_graph-0.0.3-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8161ad7b5b4568b697378780601098d21deb8872d704398271f3bf9f7f6ae539
|
|
BLAKE2b-256 checksum How to use checksums |
e5dfffa5279d6954337c32c2a08957dc5c5fd9e64e988194baa71cb82d2a195b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for machine-learning-with-graph 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.