Skip to main content

Divisive iK-means algorithm implementation

Project description

CodeFactor BCH compliance Maintainability Documentation Status

divik

Python implementation of Divisive iK-means (DiviK) algorithm.

Tools within this package

  • Clustering at your command line with fit-clusters
  • Set of algorithm implementations for unsupervised analyses
    • Clustering
      • DiviK - hands-free clustering method with built-in feature selection
      • K-Means with Dunn method for selecting the number of clusters
      • K-Means with GAP index for selecting the number of clusters
      • Modular K-Means implementation with custom distance metrics and initializations
    • Feature extraction
      • PCA with knee-based components selection
      • Locally Adjusted RBF Spectral Embedding
    • Feature selection
      • EXIMS
      • Gaussian Mixture Model based data-driven feature selection
        • High Abundance And Variance Selector - allows you to select highly variant features above noise level, based on GMM-decomposition
      • Outlier based Selector
        • Outlier Abundance And Variance Selector - allows you to select highly variant features above noise level, based on outlier detection
      • Percentage based Selector - allows you to select highly variant features above noise level with your predefined thresholds for each
    • Sampling
      • StratifiedSampler - generates samples of fixed number of rows from given dataset
      • UniformPCASampler - generates samples of random observations within boundaries of an original dataset, and preserving the rotation of the data
      • UniformSampler - generates samples of random observations within boundaries of an original dataset

Installation

Docker

The recommended way to use this software is through Docker. This is the most convenient way, if you want to use divik application.

To install latest stable version use:

docker pull gmrukwa/divik

Python package

Prerequisites for installation of base package:

  • Python 3.6 / 3.7 / 3.8
  • compiler capable of compiling the native C code and OpenMP support

Installation of OpenMP for Ubuntu / Debian

You should have it already installed with GCC compiler, but if somehow not, try the following:

sudo apt-get install libgomp1

Installation of OpenMP for Mac

OpenMP is available as part of LLVM. You may need to install it with conda:

conda install -c conda-forge "compilers>=1.0.4,!=1.1.0" llvm-openmp

DiviK Installation

Having prerequisites installed, one can install latest base version of the package:

pip install divik

If you want to have compatibility with gin-config, you can install necessary extras with:

pip install divik[gin]

Note: Remember about \ before [ and ] in zsh shell.

You can install all extras with:

pip install divik[all]

High-Volume Data Considerations

If you are using DiviK to run the analysis that could fail to fit RAM of your computer, consider disabling the default parallelism and switch to dask. It's easy to achieve through configuration:

  • set all parameters named n_jobs to 1;
  • set all parameters named allow_dask to True.

Note: Never set n_jobs>1 and allow_dask=True at the same time, the computations will freeze due to how multiprocessing and dask handle parallelism.

Known Issues

Segmentation Fault

It can happen if the he gamred_native package (part of divik package) was compiled with different numpy ABI than scikit-learn. This could happen if you used different set of compilers than the developers of the scikit-learn package.

In such a case, a handler is defined to display the stack trace. If the trace comes from _matlab_legacy.py, the most probably this is the issue.

To resolve the issue, consider following the installation instructions once again. The exact versions get updated to avoid the issue.

Contributing

Contribution guide will be developed soon.

Format the code with:

isort -m 3 --fgw 3 --tc .
black -t py36 .

References

This software is part of contribution made by Data Mining Group of Silesian University of Technology, rest of which is published here.

Release history Release notifications | RSS feed

Download files

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

Source Distribution

divik-3.0.5.tar.gz (82.8 kB view hashes)

Uploaded Source

Built Distributions

divik-3.0.5-cp38-cp38-win_amd64.whl (184.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

divik-3.0.5-cp38-cp38-manylinux2014_x86_64.whl (159.2 kB view hashes)

Uploaded CPython 3.8

divik-3.0.5-cp38-cp38-macosx_10_15_x86_64.whl (109.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

divik-3.0.5-cp37-cp37m-win_amd64.whl (184.8 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

divik-3.0.5-cp37-cp37m-manylinux2014_x86_64.whl (159.7 kB view hashes)

Uploaded CPython 3.7m

divik-3.0.5-cp37-cp37m-macosx_10_15_x86_64.whl (109.2 kB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

divik-3.0.5-cp36-cp36m-win_amd64.whl (184.8 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

divik-3.0.5-cp36-cp36m-manylinux2014_x86_64.whl (158.9 kB view hashes)

Uploaded CPython 3.6m

divik-3.0.5-cp36-cp36m-macosx_10_15_x86_64.whl (109.2 kB view hashes)

Uploaded CPython 3.6m macOS 10.15+ x86-64

Supported by

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