public Example numerize(
Dictionary<String, Dictionary<String, int>> attrValueToNumber) {
Dictionary<String, LearningAttribute> numerizedExampleData = new Dictionary<String, LearningAttribute>();
foreach (String key in attributes.Keys) {
LearningAttribute attribute = attributes[key];
if (attribute is StringAttribute) {
int correspondingNumber = attrValueToNumber[key][
attribute.valueAsString()];
NumericAttributeSpecification spec = new NumericAttributeSpecification(
key);
numerizedExampleData.Add(key, new NumericAttribute(
correspondingNumber, spec));
} else {// Numeric Attribute
numerizedExampleData.Add(key, attribute);
}
}
return new Example(numerizedExampleData, numerizedExampleData[targetAttribute.name()]);
}
}