List of usage examples for weka.clusterers AbstractClusterer clusterInstance
@Override public int clusterInstance(Instance instance) throws Exception
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; } }