Package org.apache.mahout.df.data

Examples of org.apache.mahout.df.data.Instance


      String line = scanner.nextLine();
      if (line.isEmpty()) {
        continue; // skip empty lines
      }

      Instance instance = converter.convert(0, line);
      int prediction = forest.classify(rng, instance);

      if (outputPath != null) {
        ofile.writeChars(Integer.toString(prediction)); // write the prediction
        ofile.writeChar('\n');
      }

      if (analyzer != null) {
        analyzer.addInstance(dataset.getLabel(instance.getLabel()),
                             new ClassifierResult(dataset.getLabel(prediction), 1.0));
      }
    }

    scanner.close();
View Full Code Here


  private boolean isIdentical(Data data) {
    if (data.isEmpty()) {
      return true;
    }
   
    Instance instance = data.get(0);
    for (int attr = 0; attr < selected.length; attr++) {
      if (selected[attr]) {
        continue;
      }
     
      for (int index = 1; index < data.size(); index++) {
        if (data.get(index).get(attr) != instance.get(attr)) {
          return false;
        }
      }
    }
   
View Full Code Here

        first = false;
      }

      String line = value.toString();
      if (!line.isEmpty()) {
        Instance instance = converter.convert(0, line);
        int prediction = forest.classify(rng, instance);
        key.set(instance.getLabel());
        lvalue.set(Integer.toString(prediction));
        context.write(key, lvalue);
      }
    }
View Full Code Here

                                                                     InterruptedException {
      if (firstId == null) {
        firstId = new LongWritable(key.get());
      }
     
      Instance instance = converter.convert((int) key.get(), value.toString());
     
      context.write(firstId, new IntWritable(instance.getLabel()));
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.df.data.Instance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.