Exemple #1
0
		public Example numerize(Hashtable attrValueToNumber) 
		{
			Hashtable numerizedExampleData = new Hashtable();
			foreach (string key in attributes.Keys)
			{
				Attribute attribute = (Attribute)attributes[key];
				if ( attribute is StringAttribute)
				{
					int correspondingNumber = int.Parse(((Hashtable)(attrValueToNumber[key]))[attribute.valueAsString()].ToString());
					NumericAttributeSpecification spec = new NumericAttributeSpecification(key);
					if (numerizedExampleData.Contains(key))
						numerizedExampleData[key] = new NumericAttribute((double)correspondingNumber,spec);
					else
						numerizedExampleData.Add(key,new NumericAttribute((double)correspondingNumber,spec));
					
				}
				else 
				{//Numeric Attribute
					if (numerizedExampleData.Contains(key))
						numerizedExampleData[key] = attribute;
					else
						numerizedExampleData.Add(key,attribute);
				}
			}
			return new Example(numerizedExampleData,(Attribute)numerizedExampleData[targetAttribute.name()]);
		}
Exemple #2
0
        public Example numerize(Hashtable attrValueToNumber)
        {
            Hashtable numerizedExampleData = new Hashtable();

            foreach (string key in attributes.Keys)
            {
                Attribute attribute = (Attribute)attributes[key];
                if (attribute is StringAttribute)
                {
                    int correspondingNumber            = int.Parse(((Hashtable)(attrValueToNumber[key]))[attribute.valueAsString()].ToString());
                    NumericAttributeSpecification spec = new NumericAttributeSpecification(key);
                    if (numerizedExampleData.Contains(key))
                    {
                        numerizedExampleData[key] = new NumericAttribute((double)correspondingNumber, spec);
                    }
                    else
                    {
                        numerizedExampleData.Add(key, new NumericAttribute((double)correspondingNumber, spec));
                    }
                }
                else
                {                //Numeric Attribute
                    if (numerizedExampleData.Contains(key))
                    {
                        numerizedExampleData[key] = attribute;
                    }
                    else
                    {
                        numerizedExampleData.Add(key, attribute);
                    }
                }
            }
            return(new Example(numerizedExampleData, (Attribute)numerizedExampleData[targetAttribute.name()]));
        }
Exemple #3
0
 public NumericAttribute(double rawvalue, NumericAttributeSpecification spec)
 {
     this.value = rawvalue;
     this.spec  = spec;
 }
Exemple #4
0
		public NumericAttribute(double rawvalue ,NumericAttributeSpecification spec)
		{
			this.value = rawvalue;
			this.spec =  spec;
		}