Tag Info

New answers tagged


To address the Centroid issue. zip = EntityValue[Entity["AdministrativeDivision", {"NewYork", "UnitedStates"}], EntityProperty["AdministrativeDivision", "ZIPCodes"]]; list = {#, EntityValue[#, {"Polygon", "Population"}]} & /@ zip; Eliminate Zip codes without Polygons and remove the GeoPosition head to allow us to calculate the centroids. ...


In MATLAB, the command kmeans() also returns distances from data points to centroids, i.e. [idx,C,sumd,D] = kmeans(___) So, a more complete answer would be: kmeans[data_, k_] := Module[ {idx , cntr, result, noOfCols, noOfRows, c, i, y, sumd, dist}, idx = ClusteringComponents[data, k, 1, Method -> "KMeans", "DistanceFunction" -> ...

Top 50 recent answers are included