{"author_url":"https://blog.hatena.ne.jp/HTN20190109/","width":"100%","published":"2026-03-31 02:00:26","blog_url":"https://htn20190109.hatenablog.com/","height":"190","type":"rich","provider_name":"Hatena Blog","blog_title":"HTN20190109\u306e\u65e5\u8a18","provider_url":"https://hatena.blog","categories":["DL"],"description":"import numpy as npimport matplotlib.pyplot as plt # ===== k-means\u672c\u4f53 =====def init_centroid(X, n_data, k): idx = np.random.permutation(n_data)[:k] centroids = X[idx] return centroidsdef compute_distances(X, k, n_data, centroids): distances = np.zeros((n_data, k)) for idx_centroids in range(k): dist =\u2026","url":"https://htn20190109.hatenablog.com/entry/2026/03/31/020026","image_url":null,"author_name":"HTN20190109","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhtn20190109.hatenablog.com%2Fentry%2F2026%2F03%2F31%2F020026\" title=\"k-means - HTN20190109\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"k-means"}