本文整理汇总了Java中weka.core.pmml.FieldMetaInfo类的典型用法代码示例。如果您正苦于以下问题:Java FieldMetaInfo类的具体用法?Java FieldMetaInfo怎么用?Java FieldMetaInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FieldMetaInfo类属于weka.core.pmml包,在下文中一共展示了FieldMetaInfo类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NeuralOutputs
import weka.core.pmml.FieldMetaInfo; //导入依赖的package包/类
protected NeuralOutputs(Element outputs, MiningSchema miningSchema) throws Exception {
m_classAttribute = miningSchema.getMiningSchemaAsInstances().classAttribute();
int vals = (m_classAttribute.isNumeric())
? 1
: m_classAttribute.numValues();
m_outputNeurons = new String[vals];
m_categoricalIndexes = new int[vals];
NodeList outputL = outputs.getElementsByTagName("NeuralOutput");
if (outputL.getLength() != m_outputNeurons.length) {
throw new Exception("[NeuralOutputs] the number of neural outputs does not match "
+ "the number expected!");
}
for (int i = 0; i < outputL.getLength(); i++) {
Node outputN = outputL.item(i);
if (outputN.getNodeType() == Node.ELEMENT_NODE) {
Element outputE = (Element)outputN;
// get the ID for this output neuron
m_outputNeurons[i] = outputE.getAttribute("outputNeuron");
if (m_classAttribute.isNumeric()) {
// get the single norm continuous
NodeList contL = outputE.getElementsByTagName("NormContinuous");
if (contL.getLength() != 1) {
throw new Exception("[NeuralOutputs] Should be exactly one norm continuous element "
+ "for numeric class!");
}
Node normContNode = contL.item(0);
String attName = ((Element)normContNode).getAttribute("field");
Attribute dummyTargetDef = new Attribute(attName);
ArrayList<Attribute> dummyFieldDefs = new ArrayList<Attribute>();
dummyFieldDefs.add(dummyTargetDef);
m_regressionMapping = new NormContinuous((Element)normContNode,
FieldMetaInfo.Optype.CONTINUOUS, dummyFieldDefs);
break;
} else {
// we just need to grab the categorical value (out of the NormDiscrete element)
// that this output neuron is associated with
NodeList discL = outputE.getElementsByTagName("NormDiscrete");
if (discL.getLength() != 1) {
throw new Exception("[NeuralOutputs] Should be only one norm discrete element "
+ "per derived field/neural output for a nominal class!");
}
Node normDiscNode = discL.item(0);
String attValue = ((Element)normDiscNode).getAttribute("value");
int index = m_classAttribute.indexOfValue(attValue);
if (index < 0) {
throw new Exception("[NeuralOutputs] Can't find specified target value "
+ attValue + " in class attribute " + m_classAttribute.name());
}
m_categoricalIndexes[i] = index;
}
}
}
}