machine-learning-with-graph


Namemachine-learning-with-graph JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/yourusername/machine-learning-with-graph
SummaryA comprehensive package for graph-based machine learning algorithms.
upload_time2023-12-11 02:17:36
maintainer
docs_urlNone
authorSusheel Gounder and Parikshit Urs
requires_python>=3.7
licenseMIT
keywords graph neural networks machine learning gnn gcn gat
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```bash
pip install machine_learning_with_graph
```

## Usage
Scripts in the examples folder demonstrate various algorithms' usage.

Example to integrate spectral clustering method
```python
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:

![Clusters using spectral clustering on graph dataset](image-1.png)

## Testing 
Run tests using pytest:
```bash
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:

1. **Clone the Repository**:
```bash
git clone https://github.com/susheelg1197/machine-learning-with-graphs-lib.git
cd machine-learning-with-graphs-lib

```


2. **Create and Activate a Virtual Environment** (optional but recommended):
```bash
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
```

3. **Install Dependencies**:
```bash
pip install -r requirements.txt
```


4. **Make Changes**:
- Implement new features or fix bugs.
- Write tests to ensure functionality.

5. **Testing**:
Add test cases within testing folder
```
pytest
```

6. **Commit Your Changes**:
```bash
git add .
git commit -m "Your detailed description of changes"

```


7. **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.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/machine-learning-with-graph",
    "name": "machine-learning-with-graph",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "graph neural networks machine learning GNN GCN GAT",
    "author": "Susheel Gounder and Parikshit Urs",
    "author_email": "susheelg1107@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/a5/65ec775046e7ae00d5e72b9e6646ca5d29fe603e9f0394142d31753ea89a/machine_learning_with_graph-0.0.3.tar.gz",
    "platform": null,
    "description": "# Machine Learning with Graphs Library\r\n\r\nThis Python library offers a comprehensive suite of graph-based machine learning algorithms, designed for ease of use and versatility.\r\n\r\n## Features\r\n- **Graph Neural Networks (GNNs)**: Includes GCNs, GATs, and more.\r\n- **Graph Clustering Algorithms**: Features Spectral Clustering, Louvain method, and others.\r\n- **Graph Embedding Methods**: Implements Node2Vec, DeepWalk, etc.\r\n- **Diverse Range of Algorithms**: For various graph-based learning tasks.\r\n\r\n## Installation\r\n```bash\r\npip install machine_learning_with_graph\r\n```\r\n\r\n## Usage\r\nScripts in the examples folder demonstrate various algorithms' usage.\r\n\r\nExample to integrate spectral clustering method\r\n```python\r\nimport networkx as nx\r\nfrom networkx.generators.community import stochastic_block_model\r\nfrom ml_wg.clustering.spectral import SpectralClustering\r\nimport numpy as np\r\n\r\n# Create a Stochastic Block Model graph\r\nsizes = [15, 15, 15]  # Sizes of each block\r\np_matrix = [[0.5, 0.1, 0.05],\r\n            [0.1, 0.5, 0.1],\r\n            [0.05, 0.1, 0.5]]  # Probability matrix\r\nG = stochastic_block_model(sizes, p_matrix)\r\n\r\n# Get the adjacency matrix\r\nadj_matrix = nx.to_numpy_array(G)\r\n\r\n# Apply our spectral clustering library\r\nsc = SpectralClustering(n_clusters=3)\r\nclusters = sc.fit_predict(adj_matrix)\r\n\r\n# Create a color map based on cluster labels\r\ncolor_map = ['red' if clusters[node] == 0 else 'blue' if clusters[node] == 1 else 'green' for node in G.nodes()]\r\n\r\n# Draw the network\r\nnx.draw(G, node_color=color_map, with_labels=True, node_size=500, font_size=10)\r\nplt.title(\"Stochastic Block model Graph Visualization\")\r\nplt.show()\r\n\r\n```\r\n\r\nOutput:\r\n\r\n![Clusters using spectral clustering on graph dataset](image-1.png)\r\n\r\n## Testing \r\nRun tests using pytest:\r\n```bash\r\npytest\r\n```\r\n\r\n\r\n## Contributing\r\nContributions are welcome! See CONTRIBUTING.md for guidelines.\r\n\r\n## Developer Guide\r\n\r\nTo contribute to the project, follow these steps to set up a local development environment:\r\n\r\n1. **Clone the Repository**:\r\n```bash\r\ngit clone https://github.com/susheelg1197/machine-learning-with-graphs-lib.git\r\ncd machine-learning-with-graphs-lib\r\n\r\n```\r\n\r\n\r\n2. **Create and Activate a Virtual Environment** (optional but recommended):\r\n```bash\r\npython -m venv venv\r\nsource venv/bin/activate # On Windows use venv\\Scripts\\activate\r\n```\r\n\r\n3. **Install Dependencies**:\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n\r\n4. **Make Changes**:\r\n- Implement new features or fix bugs.\r\n- Write tests to ensure functionality.\r\n\r\n5. **Testing**:\r\nAdd test cases within testing folder\r\n```\r\npytest\r\n```\r\n\r\n6. **Commit Your Changes**:\r\n```bash\r\ngit add .\r\ngit commit -m \"Your detailed description of changes\"\r\n\r\n```\r\n\r\n\r\n7. **Push to Your Fork and Create a Pull Request**.\r\n\r\nPlease ensure your code adheres to the project's coding standards and include tests for new features.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive package for graph-based machine learning algorithms.",
    "version": "0.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/susheelg1197/machine-learning-with-graph/issues",
        "Homepage": "https://github.com/yourusername/machine-learning-with-graph",
        "Source": "https://github.com/susheelg1197/machine-learning-with-graph"
    },
    "split_keywords": [
        "graph",
        "neural",
        "networks",
        "machine",
        "learning",
        "gnn",
        "gcn",
        "gat"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e5dfffa5279d6954337c32c2a08957dc5c5fd9e64e988194baa71cb82d2a195b",
                "md5": "815ec584aad4cb9581c04a48f7d73f9b",
                "sha256": "8161ad7b5b4568b697378780601098d21deb8872d704398271f3bf9f7f6ae539"
            },
            "downloads": -1,
            "filename": "machine_learning_with_graph-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "815ec584aad4cb9581c04a48f7d73f9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15275,
            "upload_time": "2023-12-11T02:17:35",
            "upload_time_iso_8601": "2023-12-11T02:17:35.754327Z",
            "url": "https://files.pythonhosted.org/packages/e5/df/ffa5279d6954337c32c2a08957dc5c5fd9e64e988194baa71cb82d2a195b/machine_learning_with_graph-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6a565ec775046e7ae00d5e72b9e6646ca5d29fe603e9f0394142d31753ea89a",
                "md5": "2d4345be7dd14a3cf43f21d908c10eab",
                "sha256": "b85664144ad098bbf3ddbe046b4ede9f5b2bcac28354b727fd1757d18b80bb21"
            },
            "downloads": -1,
            "filename": "machine_learning_with_graph-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2d4345be7dd14a3cf43f21d908c10eab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7632,
            "upload_time": "2023-12-11T02:17:36",
            "upload_time_iso_8601": "2023-12-11T02:17:36.977955Z",
            "url": "https://files.pythonhosted.org/packages/d6/a5/65ec775046e7ae00d5e72b9e6646ca5d29fe603e9f0394142d31753ea89a/machine_learning_with_graph-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-11 02:17:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "machine-learning-with-graph",
    "github_not_found": true,
    "lcname": "machine-learning-with-graph"
}
        
Elapsed time: 0.20421s