Skip to main content

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)

Metadata

Release files for simnetpy 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simnetpy 0.3.1
File Size Uploaded
simnetpy-0.3.1.tar.gz 39.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simnetpy 0.3.1
File Interpreter ABI Platform
simnetpy-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 87.5 kB

Release files / simnetpy-0.3.1.tar.gz

Download URL simnetpy-0.3.1.tar.gz
Size 39.5 kB
Tags Source
SHA-256 checksum
How to use checksums
200a89c5dde2dbaab2017da9ada90c7c89a97c98ce916d1f433da07e3098a775
BLAKE2b-256 checksum
How to use checksums
30823f3190d6aace93644486ae84390bfa094aa1c1fe9066625d8010766b63e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / simnetpy-0.3.1-py3-none-any.whl

Download URL simnetpy-0.3.1-py3-none-any.whl
Size 47.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be0e42498f1088b193188e577157091add074b595d9ae9b342d65f73dd6a680c
BLAKE2b-256 checksum
How to use checksums
df5cf3c2e6da1717c854f7a0ca399d16019f1e7eb3948d61760683d36888705a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page