Exemplo n.º 1
0
        public Example numerize(IMap <string, IMap <string, int> > attrValueToNumber)
        {
            IMap <string, IAttribute> numerizedExampleData = CollectionFactory.CreateInsertionOrderedMap <string, IAttribute>();

            foreach (string key in attributes.GetKeys())
            {
                IAttribute attribute = attributes.Get(key);
                if (attribute is StringAttribute)
                {
                    int correspondingNumber            = attrValueToNumber.Get(key).Get(attribute.ValueAsString());
                    NumericAttributeSpecification spec = new NumericAttributeSpecification(key);
                    numerizedExampleData.Put(key, new NumericAttribute(correspondingNumber, spec));
                }
                else
                {// Numeric Attribute
                    numerizedExampleData.Put(key, attribute);
                }
            }
            return(new Example(numerizedExampleData, numerizedExampleData.Get(targetAttribute.Name())));
        }
Exemplo n.º 2
0
 public NumericAttribute(double rawValue, NumericAttributeSpecification spec)
 {
     this.value = rawValue;
     this.spec  = spec;
 }