Java 类weka.core.pmml.Array 实例源码

项目:repo.kmeanspp.silhouette_score    文件:TreeModel.java   
@Override
Predicate.Eval evaluate(double[] input, int fieldIndex, Array set,
  Attribute nominalLookup) {
  if (set.getType() == Array.ArrayType.STRING) {
    String value = "";
    if (!Utils.isMissingValue(input[fieldIndex])) {
      value = nominalLookup.value((int) input[fieldIndex]);
    }
    return Predicate.booleanToEval(
      Utils.isMissingValue(input[fieldIndex]), set.contains(value));
  } else if (set.getType() == Array.ArrayType.NUM
    || set.getType() == Array.ArrayType.REAL) {
    return Predicate.booleanToEval(
      Utils.isMissingValue(input[fieldIndex]),
      set.contains(input[fieldIndex]));
  }
  return Predicate.booleanToEval(
    Utils.isMissingValue(input[fieldIndex]),
    set.contains((int) input[fieldIndex]));
}
项目:autoweka    文件:TreeModel.java   
Predicate.Eval evaluate(double[] input, int fieldIndex, 
    Array set, Attribute nominalLookup) {            
  if (set.getType() == Array.ArrayType.STRING) {
    String value = "";
    if (!Utils.isMissingValue(input[fieldIndex])) {
      value = nominalLookup.value((int)input[fieldIndex]);
    }
    return Predicate.booleanToEval(Utils.isMissingValue(input[fieldIndex]), 
        set.contains(value));
  } else if (set.getType() == Array.ArrayType.NUM ||
      set.getType() == Array.ArrayType.REAL) {
    return Predicate.booleanToEval(Utils.isMissingValue(input[fieldIndex]), 
      set.contains(input[fieldIndex]));
  }
  return Predicate.booleanToEval(Utils.isMissingValue(input[fieldIndex]), 
      set.contains((int)input[fieldIndex]));
}
项目:umple    文件:TreeModel.java   
@Override
Predicate.Eval evaluate(double[] input, int fieldIndex, Array set,
  Attribute nominalLookup) {
  if (set.getType() == Array.ArrayType.STRING) {
    String value = "";
    if (!Utils.isMissingValue(input[fieldIndex])) {
      value = nominalLookup.value((int) input[fieldIndex]);
    }
    return Predicate.booleanToEval(
      Utils.isMissingValue(input[fieldIndex]), set.contains(value));
  } else if (set.getType() == Array.ArrayType.NUM
    || set.getType() == Array.ArrayType.REAL) {
    return Predicate.booleanToEval(
      Utils.isMissingValue(input[fieldIndex]),
      set.contains(input[fieldIndex]));
  }
  return Predicate.booleanToEval(
    Utils.isMissingValue(input[fieldIndex]),
    set.contains((int) input[fieldIndex]));
}
项目:repo.kmeanspp.silhouette_score    文件:TreeModel.java   
@Override
Predicate.Eval evaluate(double[] input, int fieldIndex, Array set,
  Attribute nominalLookup) {
  Predicate.Eval result = IS_IN.evaluate(input, fieldIndex, set,
    nominalLookup);
  if (result == Predicate.Eval.FALSE) {
    result = Predicate.Eval.TRUE;
  } else if (result == Predicate.Eval.TRUE) {
    result = Predicate.Eval.FALSE;
  }

  return result;
}
项目:autoweka    文件:TreeModel.java   
Predicate.Eval evaluate(double[] input, int fieldIndex,
    Array set, Attribute nominalLookup) {
  Predicate.Eval result = IS_IN.evaluate(input, fieldIndex, set, nominalLookup);
  if (result == Predicate.Eval.FALSE) {
    result = Predicate.Eval.TRUE;
  } else if (result == Predicate.Eval.TRUE) {
    result = Predicate.Eval.FALSE;
  }

  return result;
}
项目:umple    文件:TreeModel.java   
@Override
Predicate.Eval evaluate(double[] input, int fieldIndex, Array set,
  Attribute nominalLookup) {
  Predicate.Eval result = IS_IN.evaluate(input, fieldIndex, set,
    nominalLookup);
  if (result == Predicate.Eval.FALSE) {
    result = Predicate.Eval.TRUE;
  } else if (result == Predicate.Eval.TRUE) {
    result = Predicate.Eval.FALSE;
  }

  return result;
}
项目:repo.kmeanspp.silhouette_score    文件:TreeModel.java   
abstract Predicate.Eval evaluate(double[] input, int fieldIndex,
Array set, Attribute nominalLookup);
项目:repo.kmeanspp.silhouette_score    文件:TreeModel.java   
public SimpleSetPredicate(Element setP, MiningSchema miningSchema) throws Exception {
  Instances totalStructure = miningSchema.getFieldsAsInstances();

  // get the field name and set up the index
  String fieldS = setP.getAttribute("field");
  Attribute att = totalStructure.attribute(fieldS);
  if (att == null) {
    throw new Exception("[SimplePredicate] unable to find field " + fieldS
      + " in the incoming instance structure!");
  }

  // find the index
  int index = -1;
  for (int i = 0; i < totalStructure.numAttributes(); i++) {
    if (totalStructure.attribute(i).name().equals(fieldS)) {
      index = i;
      m_fieldName = totalStructure.attribute(i).name();
      break;
    }
  }
  m_fieldIndex = index;
  if (att.isNominal()) {
    m_isNominal = true;
    m_nominalLookup = att;
  }

  // need to scan the children looking for an array type
  NodeList children = setP.getChildNodes();
  for (int i = 0; i < children.getLength(); i++) {
    Node child = children.item(i);
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      if (Array.isArray((Element) child)) {
        // found the array
        m_set = Array.create((Element) child);
        break;
      }
    }
  }

  if (m_set == null) {
    throw new Exception("[SimpleSetPredictate] couldn't find an "
      + "array containing the set values!");
  }

  // check array type against field type
  if (m_set.getType() == Array.ArrayType.STRING && !m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field "
      + totalStructure.attribute(m_fieldIndex).name()
      + " is numeric but array type is string!");
  } else if (m_set.getType() != Array.ArrayType.STRING && m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field "
      + totalStructure.attribute(m_fieldIndex).name()
      + " is nominal but array type is numeric!");
  }
}
项目:autoweka    文件:TreeModel.java   
abstract Predicate.Eval evaluate(double[] input, int fieldIndex, 
Array set, Attribute nominalLookup);
项目:autoweka    文件:TreeModel.java   
public SimpleSetPredicate(Element setP, 
    MiningSchema miningSchema) throws Exception {
  Instances totalStructure = miningSchema.getFieldsAsInstances();

  // get the field name and set up the index
  String fieldS = setP.getAttribute("field");
  Attribute att = totalStructure.attribute(fieldS);
  if (att == null) {
    throw new Exception("[SimplePredicate] unable to find field " + fieldS
        + " in the incoming instance structure!");
  }

  // find the index
  int index = -1;
  for (int i = 0; i < totalStructure.numAttributes(); i++) {
    if (totalStructure.attribute(i).name().equals(fieldS)) {
      index = i;
      m_fieldName = totalStructure.attribute(i).name();
      break;
    }
  }
  m_fieldIndex = index;
  if (att.isNominal()) {
    m_isNominal = true;
    m_nominalLookup = att;
  }

  // need to scan the children looking for an array type
  NodeList children = setP.getChildNodes();
  for (int i = 0; i < children.getLength(); i++) {
    Node child = children.item(i);
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      if (Array.isArray((Element)child)) {
        // found the array
        m_set = Array.create((Element)child);
        break;
      }
    }
  }

  if (m_set == null) {
    throw new Exception("[SimpleSetPredictate] couldn't find an " +
    "array containing the set values!");
  }

  // check array type against field type
  if (m_set.getType() == Array.ArrayType.STRING &&
      !m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field " +
        totalStructure.attribute(m_fieldIndex).name() + 
        " is numeric but array type is string!");
  } else if (m_set.getType() != Array.ArrayType.STRING && 
      m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field " +
        totalStructure.attribute(m_fieldIndex).name() +
        " is nominal but array type is numeric!");
  }      
}
项目:umple    文件:TreeModel.java   
abstract Predicate.Eval evaluate(double[] input, int fieldIndex,
Array set, Attribute nominalLookup);
项目:umple    文件:TreeModel.java   
public SimpleSetPredicate(Element setP, MiningSchema miningSchema) throws Exception {
  Instances totalStructure = miningSchema.getFieldsAsInstances();

  // get the field name and set up the index
  String fieldS = setP.getAttribute("field");
  Attribute att = totalStructure.attribute(fieldS);
  if (att == null) {
    throw new Exception("[SimplePredicate] unable to find field " + fieldS
      + " in the incoming instance structure!");
  }

  // find the index
  int index = -1;
  for (int i = 0; i < totalStructure.numAttributes(); i++) {
    if (totalStructure.attribute(i).name().equals(fieldS)) {
      index = i;
      m_fieldName = totalStructure.attribute(i).name();
      break;
    }
  }
  m_fieldIndex = index;
  if (att.isNominal()) {
    m_isNominal = true;
    m_nominalLookup = att;
  }

  // need to scan the children looking for an array type
  NodeList children = setP.getChildNodes();
  for (int i = 0; i < children.getLength(); i++) {
    Node child = children.item(i);
    if (child.getNodeType() == Node.ELEMENT_NODE) {
      if (Array.isArray((Element) child)) {
        // found the array
        m_set = Array.create((Element) child);
        break;
      }
    }
  }

  if (m_set == null) {
    throw new Exception("[SimpleSetPredictate] couldn't find an "
      + "array containing the set values!");
  }

  // check array type against field type
  if (m_set.getType() == Array.ArrayType.STRING && !m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field "
      + totalStructure.attribute(m_fieldIndex).name()
      + " is numeric but array type is string!");
  } else if (m_set.getType() != Array.ArrayType.STRING && m_isNominal) {
    throw new Exception("[SimpleSetPredicate] referenced field "
      + totalStructure.attribute(m_fieldIndex).name()
      + " is nominal but array type is numeric!");
  }
}