Example usage for weka.clusterers AbstractClusterer clusterInstance

List of usage examples for weka.clusterers AbstractClusterer clusterInstance

Introduction

In this page you can find the example usage for weka.clusterers AbstractClusterer clusterInstance.

Prototype

@Override
public int clusterInstance(Instance instance) throws Exception 

Source Link

Document

Classifies a given instance.

Usage

From source file:sim.app.ubik.behaviors.sharedservices.EMClustering.java

License:Open Source License

public SharedService getRecommendation(UserInterface ui) {
    try {/*from w  w w . j  a  v  a2  s .c o m*/
        clusteringOfUsers();
        Instance instance = this.getInstance2(ui);
        AbstractClusterer ac = clusteringOfUsers();
        if (ac == null)
            return slist.get(ubik.random.nextInt(slist.size())); // no haba instancias, servicio aleatorio            
        int cluster = ac.clusterInstance(instance);
        // if(echo){
        // System.out.println(ui.getName() + ", recommended service: " + slist.get(cluster).getName());
        // System.out.println(ac.toString());              
        // }
        return slist.get(cluster);
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}