Giter Club home page Giter Club logo

mincluster's Introduction

mincluster

mincluster is a package that allows to minimize the maximum intercluster distance

Overview

The problem of clustering a set of points so as to minimize the maximum intercluster distance is studied. An O(kn) approximation algorithm, where n is the number of points and k is the number of clusters, that guarantees solutions with an objective function value within two times the optimal solution value is presented. This approximation algorithm succeeds as long as the set of points satisfies the triangular inequality. We also show that our approximation algorithm is best possible, with respect to the approximation bound, if P ≠ NP.

Installation

pip install mincluster

Usage

from mincluster.cluster import ClusterMinimization

k = 3
data = [231, 22, 73, 54, 60, 29, 10, 192, 115]
c = ClusterMinimization(k, data)
clusters, cluster_heads = c.expand_clusters(c.clusters, c.cluster_heads)

try:
    for i in range(k):
        print(f'Cluster {i + 1}: Head = {cluster_heads[i]}, Elements = {clusters[i]}')
except IndexError as e:
        print(e)

Output

Cluster 1: Head = 60, Elements = {192, 231, 73, 10, 115, 54, 22, 29}
Cluster 2: Head = 231, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}
Cluster 3: Head = 115, Elements = {192, 231, 73, 10, 115, 54, 22, 60, 29}

License

This project is licensed under the MIT License - see the LICENSE file for details

References

Gonzalez, Teofilo F. “Clustering to Minimize the Maximum Intercluster Distance.” Theoretical Computer Science, vol. 38, Elsevier BV, Jan. 1985, pp. 293–306, https://doi.org/10.1016/0304-3975(85)90224-5. Accessed 26 Oct. 2023.

mincluster's People

Contributors

khushiyant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.