本文主要是介绍in-memory形式的牧户K-Means聚类,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<strong><span style="font-size:18px;">/**** @author YangXin* @info 以in-memory形式的模糊k-means聚类示例*/
package unitNine;import java.util.ArrayList;
import java.util.List;import org.apache.mahout.clustering.fuzzykmeans.FuzzyKMeansClusterer;
import org.apache.mahout.clustering.fuzzykmeans.SoftCluster;
import org.apache.mahout.common.distance.EuclideanDistanceMeasure;
import org.apache.mahout.math.Vector;public class FuzzyKMeansExample {public static void main(){List<Vector> sampleData = new ArrayList<Vector>();RandomPointsUtil.generateSamples(sampleData, 400, 1, 1, 3);RandomPointsUtil.generateSamples(sampleData, 300, 1, 0, 0.5);RandomPointsUtil.generateSamples(sampleData, 300, 0, 2, 0.1);int k = 3;List<Vector> randomPoints = RandomPointsUtil.chooseRandomPoints(sampleData, k);List<SoftCluster> clusters = new ArrayList<SoftCluster>();int clusterId &#
这篇关于in-memory形式的牧户K-Means聚类的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!