getAttributeValueAsString() public method

public getAttributeValueAsString ( String attributeName ) : String
attributeName String
return String
        public Pair<List<Double>, List<Double>> numerize(Example e)
        {
            List<Double> input = new List<Double>();
            List<Double> desiredOutput = new List<Double>();

            double sepal_length = e.getAttributeValueAsDouble("sepal_length");
            double sepal_width = e.getAttributeValueAsDouble("sepal_width");
            double petal_length = e.getAttributeValueAsDouble("petal_length");
            double petal_width = e.getAttributeValueAsDouble("petal_width");

            input.Add(sepal_length);
            input.Add(sepal_width);
            input.Add(petal_length);
            input.Add(petal_width);

            String plant_category_string = e
                    .getAttributeValueAsString("plant_category");

            desiredOutput = convertCategoryToListOfDoubles(plant_category_string);

            Pair<List<Double>, List<Double>> io = new Pair<List<Double>, List<Double>>(
                    input, desiredOutput);

            return io;
        }
示例#2
0
 public bool matches(Example e)
 {
     foreach (String key in attrValues.Keys)
     {
         if (!(attrValues[key].Equals(e.getAttributeValueAsString(key))))
         {
             return false;
         }
     }
     return true;
     // return e.targetValue().Equals(targetValue);
 }
示例#3
0
 public virtual Object predict(Example e)
 {
     String attrValue = e.getAttributeValueAsString(attributeName);
     if (nodes.ContainsKey(attrValue))
     {
         return nodes[attrValue].predict(e);
     }
     else
     {
         throw new ApplicationException("no node exists for attribute value "
                 + attrValue);
     }
 }