Skip to main content

Python package for the Construction and Clustering of Similarity Networks

Project description

simnetpy

Python Package for the creation and analysis of similarity networks.

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

Using simnetpy

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simnetpy-0.3.1.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simnetpy-0.3.1-py3-none-any.whl (47.9 kB view details)

Uploaded Python 3

File details

Details for the file simnetpy-0.3.1.tar.gz.

File metadata

  • Download URL: simnetpy-0.3.1.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for simnetpy-0.3.1.tar.gz
Algorithm Hash digest
SHA256 200a89c5dde2dbaab2017da9ada90c7c89a97c98ce916d1f433da07e3098a775
MD5 2df6dc071069867f4ed6477768866ddd
BLAKE2b-256 30823f3190d6aace93644486ae84390bfa094aa1c1fe9066625d8010766b63e0

See more details on using hashes here.

File details

Details for the file simnetpy-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: simnetpy-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 47.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for simnetpy-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be0e42498f1088b193188e577157091add074b595d9ae9b342d65f73dd6a680c
MD5 fddc2c4bd9a1f06f7b82d8a25c4d59cf
BLAKE2b-256 df5cf3c2e6da1717c854f7a0ca399d16019f1e7eb3948d61760683d36888705a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page