List of usage examples for weka.clusterers XMeans setBinValue
public void setBinValue(double value)
From source file:org.montp2.m1decol.ter.clustering.XMeansClustering.java
License:Open Source License
public Clusterer computeClustering(String inPath, String outPath, Properties propertiesCluster) throws Exception { Instances inputInstances = WekaUtils.loadARFF(inPath); EuclideanDistance euclideanDistance = new EuclideanDistance(); euclideanDistance.setAttributeIndices("first-last"); euclideanDistance.setDontNormalize(false); euclideanDistance.setInvertSelection(false); XMeans xmeans = new XMeans(); xmeans.setMaxIterations(500);/* w w w. j av a 2 s. co m*/ xmeans.setSeed(10); xmeans.setMinNumClusters(5); xmeans.setMaxNumClusters(12); xmeans.setMaxKMeans(1000); xmeans.setMaxKMeansForChildren(1000); xmeans.setBinValue(1.0); xmeans.setCutOffFactor(0.5); xmeans.setDebugLevel(0); xmeans.setMaxIterations(1); xmeans.buildClusterer(inputInstances); Enumeration<Instance> e = inputInstances.enumerateInstances(); while (e.hasMoreElements()) { Instance ins = e.nextElement(); int cluster_num = xmeans.clusterInstance(ins); System.out.println(ins.toString()); System.out.println(cluster_num); } WekaUtils.saveModel(xmeans, outPath); return xmeans; }