Skip to main content

An implementation of the Kernel k-means algorithm for a bachelorthesis.

Project description

kkmeans

Repository: https://git01lab.cs.univie.ac.at/osterj97/oster-bachelor-thesis

Implementation of the Kernel k-means clustering algorithm for multiple dimensions (including as well one-dimensional data) in Python. The results are visualized in plots and measured with quality metrics (e.g. Silhouette Coefficient). The algorithm can be used as a framework.

https://sites.google.com/site/dataclusteringalgorithms/kernel-k-means-clustering-algorithm

The related bachelor thesis can be found here: https://www.overleaf.com/read/shnzrthjgqtw (read only) or as an exported .pdf here Bachelor_Thesis____Kernel_k_means_clustering_framework_in_Python.pdf

Installation

pip install python-kkmeans

The package can also be installed directly from this repository using pip install git+ssh://git@git01lab.cs.univie.ac.at/osterj97/oster-bachelor-thesis.git.

Quickstart

from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt

from kkmeans import kkmeans

n_clusters = 3
X, _ = make_blobs(n_samples=100, n_features=3, centers=n_clusters)
X_scaled = StandardScaler().fit_transform(X)

cluster_assignments = kkmeans(X, n_clusters=n_clusters)
plt.scatter(X_scaled[:,0], X_scaled[:,1], c=cluster_assignments)

Examples

Take a look at the examples folder to see benchmarking and plotted examples of the algorithm in action. The playground notebook should give you a comprehensive overview of the evaluation of the algorithm. It can be run after installing jupyter and running jupyter notebook from this folder.

Local Development

The following commands assume you run on a Linux or Mac, for Windows instructions take a look at the official documentations.

  • (optional) Create a venv python3 -m venv .venv
  • (optional) Active venv source .venv/bin/activate
  • (optional) Update pip pip install --upgrade pip
  • Install all required packages pip install -r requirements.txt

Test

Testing is set up using pytest. Run all tests running the command pytest in the root directory. For detailed description on pytest see: Full pytest documentation

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

python-kkmeans-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

python_kkmeans-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file python-kkmeans-0.1.0.tar.gz.

File metadata

  • Download URL: python-kkmeans-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for python-kkmeans-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54ae71cefb2d1db212b543ed4c23dc54db4feaec6d525273be422d7594c0ea1c
MD5 bf7d31a051a2fa423a7e6e4093a24efe
BLAKE2b-256 71780a477c5ad1d3c18c14bc2106b761a4a6893000db7c64129ffd0eb744744a

See more details on using hashes here.

File details

Details for the file python_kkmeans-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_kkmeans-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for python_kkmeans-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df53ea20126317d6ef69faf4c8f710a786dae5c41380dc33f61c7398dde8bca7
MD5 094b9c505e4c3351f94170b95d18d01c
BLAKE2b-256 de59ab85e53e288d51e97a0ae47a80ac3dc18ad6273c6d8cdd04aaf926ab087c

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