Skip to content

Function to find the optimal number of clusters for k-means analysis using the Elbow Method

Notifications You must be signed in to change notification settings

rhettadam/Optimal-K

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Optimal-K

Overview

Optimal-K is an R function to determine the optimal number of clusters in K-Means clustering using the Elbow Method. This function helps users decide the best value of k by identifying the elbow point on the WCSS (Within-Cluster Sum of Squares) curve.

How It Works

The function works by calculating the perpendicular distance of each point on the WCSS curve to the line connecting the first and last points of the curve. The point with the maximum distance is identified as the "elbow," and its corresponding k value is returned.

Function Definition:

find_optimal_k(wcss_values, k_values)

Screenshot 2024-12-06 231351

About

Function to find the optimal number of clusters for k-means analysis using the Elbow Method

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages