GithubHelp home page GithubHelp logo

michael-long88 / jqm_cvi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jqmviegas/jqm_cvi

0.0 1.0 0.0 883 KB

Small module with Cluster Validity Indexes (CVI)

License: MIT License

Python 62.77% Cython 37.23%

jqm_cvi's Introduction

jqmcvi

Small module with Cluster Validity Indices (CVI)

Dunn and Davius Bouldin indices are implemented. It follows the equations presented in theory.pdf.

base.py : Python + NumPy

basec.pyx : Python + NumPy optimized with Cython

basec.pyx tested on M1 Macbook Pro, Python 3.9 and compiled with python setup.py build_ext -i

Functions:

dunn(k_list):

Slow implementation of Dunn index that depends on numpy

-- basec.pyx Cython implementation is much faster but slower than dunn_fast()

	""" Dunn index [CVI]
  
    Parameters
    ----------
    k_list : list of np.arrays
        A list containing a numpy array for each cluster |c| = number of clusters
        c[K] is np.array([N, p]) (N : number of samples in cluster K, p : sample dimension)
    """

dunn_fast(points, labels):

Fast implementation of Dunn index that depends on numpy and sklearn.pairwise

-- No Cython implementation

	""" Dunn index - FAST (using sklearn pairwise euclidean_distance function)
  
    Parameters
    ----------
    points : np.array
        np.array([N, p]) of all points
    labels: np.array
        np.array([N]) labels of all points
    """

davisbouldin(k_list, k_centers):

Implementation of Davis Boulding index that depends on numpy

-- basec.pyx Cython implementation is much faster

	""" Davis Bouldin Index

	Parameters
    ----------
    k_list : list of np.arrays
        A list containing a numpy array for each cluster |c| = number of clusters
        c[K] is np.array([N, p]) (N : number of samples in cluster K, p : sample dimension)
    k_centers : np.array
        The array of the cluster centers (prototypes) of type np.array([K, p])
    """

Developing

  • Install dependencies
    • pip install -r requirements.txt
  • Recompile basec.c based on updated dependencies, updated Python version, or changes to basec.pyx
    • python setup.py build_ext -i
  • (Re)Install jqmcvi after any changes
    • pip install -e .

Testing

If running from the console, make sure present working directory is tests/ before running python cvi-dev.py.

jqm_cvi's People

Contributors

jqmviegas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.