Package shared

Examples of shared.InstanceList


    // Create Attribute Information on label
    AttrInfo labelAttrib = new NominalAttrInfo(PERFORMANCE_CLASS, perfClasses);

    // Create MLJ meta information
    schema = new Schema(attrInfos, labelAttrib);
    InstanceList instances = createInstances(trainingData, attribMap);

    // Train categoriser
    Categorizer categorizer = getCategorizer(instances);

    // Build predictor
View Full Code Here


   *          map name -> (attribute info, attribute number)
   */
  protected <T extends PerformanceTuple> InstanceList createInstances(
      List<T> trainingData, Map<String, Pair<AttrInfo, Integer>> attrMap) {

    InstanceList instances = new InstanceList(schema);

    for (PerformanceTuple perfTuple : trainingData) {

      Set<String> setAttribs = new HashSet<>();

      Instance instance = new Instance(instances.get_schema());

      MLJUtils.setAttributeValues(instance, attrMap,
          perfTuple.getConfiguration());
      setAttribs.addAll(perfTuple.getConfiguration().keySet());

      MLJUtils.setAttributeValues(instance, attrMap, perfTuple.getFeatures());
      setAttribs.addAll(perfTuple.getFeatures().keySet());

      // Care for missing values
      Set<String> missingAttribs = new HashSet<>(attrMap.keySet());
      missingAttribs.removeAll(setAttribs);
      for (String missingAttrib : missingAttribs) {
        MLJUtils.setMissingAttribute(instance, attrMap.get(missingAttrib));
      }

      labelInstance(instance, schema.label_info(), perfTuple.getPerformance());
      instances.add_instance(instance);
    }

    return instances;
  }
View Full Code Here

TOP

Related Classes of shared.InstanceList

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.