Example usage for weka.clusterers SimpleKMeans toString

List of usage examples for weka.clusterers SimpleKMeans toString

Introduction

In this page you can find the example usage for weka.clusterers SimpleKMeans toString.

Prototype

@Override
public String toString() 

Source Link

Document

return a string describing this clusterer.

Usage

From source file:controller.KMeansBean.java

public void calculate() {
    SimpleKMeans skm = new SimpleKMeans();
    try {/*from  w  ww.j a v a  2 s.  com*/
        skm.setNumClusters(clusternum);
        skm.buildClusterer(inst);
        output = skm.toString();
    } catch (Exception ex) {
        Logger.getLogger(KMeansBean.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:controller.MineroControler.java

public String clasificarSimpleKmeans(int numClusters) {
    BufferedReader breader = null;
    Instances datos = null;//from  w w  w .  jav a  2s.  c o m
    breader = new BufferedReader(fuente_arff);
    try {
        datos = new Instances(breader);
    } catch (IOException ex) {
        System.err.println("Problemas al intentar cargar los datos");
    }

    SimpleKMeans skmeans = new SimpleKMeans();

    try {
        skmeans.setSeed(10);
        skmeans.setPreserveInstancesOrder(true);
        skmeans.setNumClusters(numClusters);
        skmeans.buildClusterer(datos);
    } catch (Exception ex) {
        System.err.println("Problemas al ejecutar algorimo de clasificacion");
    }
    return skmeans.toString();
}