Metadata-Version: 2.3
Name: simnetpy
Version: 0.3.1
Summary: Python package for the Construction and Clustering of Similarity Networks
Project-URL: Download, https://github.com/amarnane/simnetpy
Project-URL: Homepage, https://github.com/amarnane/simnetpy
Project-URL: Documentation, https://amarnane.github.io/simnetpy/
Author-email: Aidan Marnane <aidan.marnane@gmail.com>
License-Expression: BSD-3-Clause
License-File: AUTHORS.md
License-File: LICENSE
Keywords: clustering,community-detection,graph-clustering,graphs,network-construction,networks,similarity-network
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.8
Requires-Dist: click
Requires-Dist: igraph==0.10.4
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: palettable
Requires-Dist: pandas
Requires-Dist: pyyaml
Requires-Dist: scikit-learn
Requires-Dist: scipy
Requires-Dist: seaborn
Requires-Dist: snfpy
Requires-Dist: spectralcluster
Requires-Dist: tqdm
Provides-Extra: dev
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# 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)
```

