public Example Numerize( Dictionary <string, Dictionary <string, int> > attrValueToNumber) { var numerizedExampleData = new Dictionary <string, IAttribute>(); foreach (string key in attributes.Keys) { IAttribute attribute = attributes[key]; if (attribute is StringAttribute) { int correspondingNumber = attrValueToNumber[key][attribute.ValueAsString()]; var spec = new NumericAttributeSpecification(key); numerizedExampleData[key] = new NumericAttribute(correspondingNumber, spec); } else {// Numeric Attribute numerizedExampleData[key] = attribute; } } return(new Example(numerizedExampleData, numerizedExampleData[targetAttribute.Name()])); }
public NumericAttribute(double rawvalue, NumericAttributeSpecification spec) { this.value = rawvalue; this.spec = spec; }