List of usage examples for weka.core Instances toString
@Override
public String toString()
From source file:tubes2.myClusterers.myKMeans.java
public String centroidsToString() { Instances centroidInstances = new Instances(template, 0); for (int i = 0; i < k; i++) { centroidInstances.add(centroids[i]); }/* www . j a v a 2 s .co m*/ return centroidInstances.toString(); }
From source file:tucil2ai.Tucil2AI.java
/** * * @param cls/*from ww w .j a va 2 s. co m*/ * @param filename * @param f * @throws Exception */ public static void ClassifyJ48(Classifier cls, String filename, Discretize f) throws Exception { Instances unlabeled = loadfile(filename, f); Instances labeled = new Instances(unlabeled); for (int i = 0; i < unlabeled.numInstances(); ++i) { double clsLabel = cls.classifyInstance(unlabeled.instance(i)); labeled.instance(i).setClassValue(clsLabel); } System.out.println(labeled.toString()); }
From source file:wekimini.learning.LinearRegressionModelBuilder.java
@Override public LinearRegressionModel build(String name) throws Exception { if (trainingData == null) { throw new IllegalStateException("Must set training examples (to not null) before building model"); }//from ww w . j a v a 2s . com LinearRegression m; LinearRegressionAttributeTransformer t = null; if (exponent == 1) { m = (LinearRegression) WekaModelBuilderHelper.build(classifier, trainingData); } else { t = new LinearRegressionAttributeTransformer(trainingData.numAttributes() - 1, exponent); Instances i = t.transformedData(trainingData); System.out.println("New instances:\n" + i.toString()); m = (LinearRegression) WekaModelBuilderHelper.build(classifier, i); } //Remove: for testing: logger.log(Level.WARNING, m.toString()); return new LinearRegressionModel(name, m, t); }