ScratchData LogoScratchData
Back to Java_Programmer's profile

K-Means Clustering Demo

JAJava_Programmer•Created January 20, 2018
K-Means Clustering Demo
27
16
434 views
View on Scratch

Instructions

Watch and enjoy! :) Feel free to see inside, or just mess around with the variables. To reduce lag: https://sulfurous.aau.at/#199028733 Clustering: how often points cluster together vs. being random. Num Areas: number of regions to divide the points into. Num Points: number of points to divide up.

Description

This will contribute to my Color Quantization NPR project since it is a way to divide a picture's colors into sets with similar colors in each. The way k-means clustering works is that you start by adding k random centers that will represent the clusters. Each time, you make a voronoi diagram out of the centers (a diagram that colors each point based on the closest center, look it up if you need more info). Then, take the average position of each point in a given cluster and set the center to that average. Over enough iterations, the points should be arranged into k clusters. Maybe it's just my computer, but this runs surprisingly smoothly for 1000+ points and several areas!

Project Details

Project ID199028733
CreatedJanuary 20, 2018
Last ModifiedJanuary 21, 2018
SharedJanuary 20, 2018
Visibilityvisible
CommentsAllowed