Java examples for Machine Learning AI:weka
Weka Cluster Make Density Based Cluster
import java.util.Random; import weka.clusterers.ClusterEvaluation; import weka.clusterers.MakeDensityBasedClusterer; import weka.core.Instances; import weka.core.Utils; import weka.core.converters.ConverterUtils.DataSource; public class WekaClusterMakeDensityBasedCluster { public static void main(String[] args) throws Exception { DataSource source = new DataSource( "bank-train.arff"); Instances instancesTrain = source.getDataSet(); MakeDensityBasedClusterer cluster = new MakeDensityBasedClusterer(); cluster.buildClusterer(instancesTrain); System.out.println(ClusterEvaluation.crossValidateModel(cluster, instancesTrain, 10, new Random(1))); String[] options = Utils//from w w w. j a v a 2 s .co m .splitOptions("-t bank-train.arff -T bank-test.arff"); System.out.println(ClusterEvaluation.evaluateClusterer(cluster, options)); } }