Code Monkey home page Code Monkey logo

kmeans_challenge's Introduction

KMeans_Challenge

Coding Challenge

This coding challenge was given to me to implement a KMeans Clustering Algorithm similar to that in sklearn.

For comparison, I first wrote an example and a few graphs with a randomly generated dataset. Then, I attempted to create my own implementation of the KMeans algorithm with comparable results to that of the sklearn results. This assigment was to be completed within one hour.

Here is an example plot of the clusters. It includes centroid values from both my implementation and the sklearn implementation for comparison:

Clusters with Centroid Plot

Here is a table to show the differences in the Centroid values from each implementation:

My Implementation sklearn
X Y X Y
Centroid 1 1.10041362 3.05174259 1.04798811 1.1345495
Centroid 2 1.00438464 1.11955788 3.18576148 0.9072616
Centroid 3 3.05447363 2.65856700 3.05447363 2.658567
Centroid 4 3.15083859 0.92733088 1.10041362 3.05174259

To determine the inital number of clusters I also made the following elbow plot:

Clusters with Centroid Plot

kmeans_challenge's People

Contributors

hrflkner 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.