상속: AttributeSpecification
예제 #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()]);
	}
예제 #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()]));
        }
예제 #3
0
 public NumericAttribute(double rawvalue, NumericAttributeSpecification spec)
 {
     this.value = rawvalue;
     this.spec  = spec;
 }
예제 #4
0
 public NumericAttribute(double rawvalue, NumericAttributeSpecification spec)
 {
     this.value = rawvalue;
     this.spec = spec;
 }