mit-ml icon indicating copy to clipboard operation
mit-ml copied to clipboard

biKmeans error in kmeans

Open kittyonex1 opened this issue 7 years ago • 0 comments

        # 获得其他簇的样本
        ptsNoInCluster = dataSet[np.nonzero(
            clusterAssment[:, 0].A != j)[0]]
        # 获得剩余数据集的误差
        nonSplitedError = np.sum(ptsNoInCluster[:, 1])

获得剩余数据集的误差不需要dataSet,而是clusterAssment 即整体改为: # 获得剩余数据集的误差 nonSplitedError = np.sum(clusterAssment[np.nonzero( clusterAssment[:, 0].A != j)[0]][:, 1])

kittyonex1 avatar Jul 28 '18 03:07 kittyonex1