simnetpy


Namesimnetpy JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/amarnane/simnetpy
SummaryPython package for the Construction and Clustering of Similarity Networks
upload_time2023-11-02 13:38:01
maintainer
docs_urlNone
authorAidan Marnane
requires_python>=3.8
licenseBSD
keywords similarity-network network-construction networks graphs clustering graph-clustering community-detection
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 .
```
Note: removing the package is slightly more complicated and a different command is needed to uninstall 
```
python setup.py develop -u
```

### 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": "https://github.com/amarnane/simnetpy",
    "name": "simnetpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "similarity-network network-construction networks graphs clustering graph-clustering community-detection",
    "author": "Aidan Marnane",
    "author_email": "aidan.marnane@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5a/c9/5de7b13517bd8b15682901630c8a6f9681b659410e46215ba8e321ee0f59/simnetpy-0.2.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```\nNote: removing the package is slightly more complicated and a different command is needed to uninstall \n```\npython setup.py develop -u\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": "BSD",
    "summary": "Python package for the Construction and Clustering of Similarity Networks",
    "version": "0.2.1",
    "project_urls": {
        "Download": "https://github.com/amarnane/simnetpy",
        "Homepage": "https://github.com/amarnane/simnetpy"
    },
    "split_keywords": [
        "similarity-network",
        "network-construction",
        "networks",
        "graphs",
        "clustering",
        "graph-clustering",
        "community-detection"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6910db92443b8f01b920754cd21a8ea9d4395b33a171cb79ce02843ecc5ffd2b",
                "md5": "495934abc78f4e09d9b88fab5df225b5",
                "sha256": "23db49bdd89c7e534b351c1f81884755e71d84512443bee70f345b6390478b5f"
            },
            "downloads": -1,
            "filename": "simnetpy-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "495934abc78f4e09d9b88fab5df225b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 53269,
            "upload_time": "2023-11-02T13:37:59",
            "upload_time_iso_8601": "2023-11-02T13:37:59.621747Z",
            "url": "https://files.pythonhosted.org/packages/69/10/db92443b8f01b920754cd21a8ea9d4395b33a171cb79ce02843ecc5ffd2b/simnetpy-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ac95de7b13517bd8b15682901630c8a6f9681b659410e46215ba8e321ee0f59",
                "md5": "e19c3c0cb99c9f34fc08086fb283d1ba",
                "sha256": "fad2cc4d4ed621b13e0991c63b006850879cdb77aa56140f690ff954b2dc7448"
            },
            "downloads": -1,
            "filename": "simnetpy-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e19c3c0cb99c9f34fc08086fb283d1ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 39572,
            "upload_time": "2023-11-02T13:38:01",
            "upload_time_iso_8601": "2023-11-02T13:38:01.242624Z",
            "url": "https://files.pythonhosted.org/packages/5a/c9/5de7b13517bd8b15682901630c8a6f9681b659410e46215ba8e321ee0f59/simnetpy-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-02 13:38:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amarnane",
    "github_project": "simnetpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "simnetpy"
}
        
Elapsed time: 0.12864s