simnetpy


Namesimnetpy JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryPython package for the Construction and Clustering of Similarity Networks
upload_time2024-05-14 12:26:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords clustering community-detection graph-clustering graphs network-construction networks similarity-network
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # simnetpy

Python Package for the creation and analysis of similarity networks.

<!-- Project Organization
--------------------

    .
    ├── AUTHORS.md
    ├── LICENSE
    ├── README.md
    ├── notebooks
    └── src/simnet
        ├── clustering
        ├── datasets
        ├── graph
        ├── plotting
        ├── similarity
        └── utils 
-->


## Installation
Install latest release from PyPi with pip
```
pip install simnetpy
```

### Install from source
The source code for this project can be installed using `git` and `pip`. 
Clone repository 
```
git clone https://github.com/amarnane/simnetpy.git
cd simnetpy
pip install .
```

To remove the package simply use 
```
pip uninstall simnetpy
```

### Developer Mode
To install in developer mode (have changes in source code update without reinstallation) add `-e` flag
```
pip install -e .
```

### Graph Tool
There is one dependency that cannot be installed through pip - `Graph-Tool`. This is a result of it's underlying `c++` dependencies.
The simplest method for python users is to make use of a conda environment, install this package using the commands above and install `graph-tool` using `conda-forge`
```
conda install -c conda-forge graph-tool
```
Note: this will not work on Windows. Alternative (conda independent) solutions can be found on the [Graph Tool Website](https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#installing-via-conda)

# Using `simnetpy`
```Python
import simnet as sn
import numpy as np

# create mixed guassian data with 100 nodes, 2 dimensions and 3 equally sized clusters.
N = 100
sizes=np.array([34,33,33])
d = 2
dataset = sn.datasets.mixed_multi_guassian(len(sizes), d, N, sizes=sizes)

# calculate pairwise similarity
S = sn.pairwise_sim(dataset.X, metric='euclidean', norm=True)

# Create igraph Igraph from matrix
gg = sn.network_from_sim_mat(S, method='knn', K=10)

# print graph stats
print(gg.graph_stats())

# true cluster quality
cqual_ytrue = sn.clustering.cluster_quality(gg, dataset.y)
print(cqual_ytrue)

# cluster
ylabels = sn.clustering.spectral_clustering(gg, laplacian='lrw')

# cluster accuracy
cacc = sn.clustering.cluster_accuracy(dataset.y, ylabels)
print(cacc)

# predicted cluster quality
cqual = sn.clustering.cluster_quality(gg, ylabels)
print(cqual)
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "simnetpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "clustering, community-detection, graph-clustering, graphs, network-construction, networks, similarity-network",
    "author": null,
    "author_email": "Aidan Marnane <aidan.marnane@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/30/82/3f3190d6aace93644486ae84390bfa094aa1c1fe9066625d8010766b63e0/simnetpy-0.3.1.tar.gz",
    "platform": null,
    "description": "# simnetpy\n\nPython Package for the creation and analysis of similarity networks.\n\n<!-- Project Organization\n--------------------\n\n    .\n    \u251c\u2500\u2500 AUTHORS.md\n    \u251c\u2500\u2500 LICENSE\n    \u251c\u2500\u2500 README.md\n    \u251c\u2500\u2500 notebooks\n    \u2514\u2500\u2500 src/simnet\n        \u251c\u2500\u2500 clustering\n        \u251c\u2500\u2500 datasets\n        \u251c\u2500\u2500 graph\n        \u251c\u2500\u2500 plotting\n        \u251c\u2500\u2500 similarity\n        \u2514\u2500\u2500 utils \n-->\n\n\n## Installation\nInstall latest release from PyPi with pip\n```\npip install simnetpy\n```\n\n### Install from source\nThe source code for this project can be installed using `git` and `pip`. \nClone repository \n```\ngit clone https://github.com/amarnane/simnetpy.git\ncd simnetpy\npip install .\n```\n\nTo remove the package simply use \n```\npip uninstall simnetpy\n```\n\n### Developer Mode\nTo install in developer mode (have changes in source code update without reinstallation) add `-e` flag\n```\npip install -e .\n```\n\n### Graph Tool\nThere is one dependency that cannot be installed through pip - `Graph-Tool`. This is a result of it's underlying `c++` dependencies.\nThe simplest method for python users is to make use of a conda environment, install this package using the commands above and install `graph-tool` using `conda-forge`\n```\nconda install -c conda-forge graph-tool\n```\nNote: this will not work on Windows. Alternative (conda independent) solutions can be found on the [Graph Tool Website](https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#installing-via-conda)\n\n# Using `simnetpy`\n```Python\nimport simnet as sn\nimport numpy as np\n\n# create mixed guassian data with 100 nodes, 2 dimensions and 3 equally sized clusters.\nN = 100\nsizes=np.array([34,33,33])\nd = 2\ndataset = sn.datasets.mixed_multi_guassian(len(sizes), d, N, sizes=sizes)\n\n# calculate pairwise similarity\nS = sn.pairwise_sim(dataset.X, metric='euclidean', norm=True)\n\n# Create igraph Igraph from matrix\ngg = sn.network_from_sim_mat(S, method='knn', K=10)\n\n# print graph stats\nprint(gg.graph_stats())\n\n# true cluster quality\ncqual_ytrue = sn.clustering.cluster_quality(gg, dataset.y)\nprint(cqual_ytrue)\n\n# cluster\nylabels = sn.clustering.spectral_clustering(gg, laplacian='lrw')\n\n# cluster accuracy\ncacc = sn.clustering.cluster_accuracy(dataset.y, ylabels)\nprint(cacc)\n\n# predicted cluster quality\ncqual = sn.clustering.cluster_quality(gg, ylabels)\nprint(cqual)\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python package for the Construction and Clustering of Similarity Networks",
    "version": "0.3.1",
    "project_urls": {
        "Documentation": "https://amarnane.github.io/simnetpy/",
        "Download": "https://github.com/amarnane/simnetpy",
        "Homepage": "https://github.com/amarnane/simnetpy"
    },
    "split_keywords": [
        "clustering",
        " community-detection",
        " graph-clustering",
        " graphs",
        " network-construction",
        " networks",
        " similarity-network"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "df5cf3c2e6da1717c854f7a0ca399d16019f1e7eb3948d61760683d36888705a",
                "md5": "fddc2c4bd9a1f06f7b82d8a25c4d59cf",
                "sha256": "be0e42498f1088b193188e577157091add074b595d9ae9b342d65f73dd6a680c"
            },
            "downloads": -1,
            "filename": "simnetpy-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fddc2c4bd9a1f06f7b82d8a25c4d59cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 47919,
            "upload_time": "2024-05-14T12:26:59",
            "upload_time_iso_8601": "2024-05-14T12:26:59.387208Z",
            "url": "https://files.pythonhosted.org/packages/df/5c/f3c2e6da1717c854f7a0ca399d16019f1e7eb3948d61760683d36888705a/simnetpy-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "30823f3190d6aace93644486ae84390bfa094aa1c1fe9066625d8010766b63e0",
                "md5": "2df6dc071069867f4ed6477768866ddd",
                "sha256": "200a89c5dde2dbaab2017da9ada90c7c89a97c98ce916d1f433da07e3098a775"
            },
            "downloads": -1,
            "filename": "simnetpy-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2df6dc071069867f4ed6477768866ddd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 39545,
            "upload_time": "2024-05-14T12:26:57",
            "upload_time_iso_8601": "2024-05-14T12:26:57.136730Z",
            "url": "https://files.pythonhosted.org/packages/30/82/3f3190d6aace93644486ae84390bfa094aa1c1fe9066625d8010766b63e0/simnetpy-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-14 12:26:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amarnane",
    "github_project": "simnetpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "simnetpy"
}
        
Elapsed time: 1.57672s