Inheritance: AttributeSpecification
Ejemplo n.º 1
0
	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()]);
	}
Ejemplo n.º 2
0
        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()]));
        }
Ejemplo n.º 3
0
 public NumericAttribute(double rawvalue, NumericAttributeSpecification spec)
 {
     this.value = rawvalue;
     this.spec  = spec;
 }
Ejemplo n.º 4
0
 public NumericAttribute(double rawvalue, NumericAttributeSpecification spec)
 {
     this.value = rawvalue;
     this.spec = spec;
 }