getAttributeNames() public method

public getAttributeNames ( ) : List
return List
Exemplo n.º 1
0
	public static Example exampleFromString(String data,
			DataSetSpecification dataSetSpec, Char separator) {
		Dictionary<String, LearningAttribute> attributes = new Dictionary<String, LearningAttribute>();
        List<String> attributeValues = new List<String>();

        string [] vals = data.Split(new char[] { ' ', '\t', ',' });
        foreach (string v in vals)
        {
            if (!String.IsNullOrWhiteSpace(v))
            {
                attributeValues.Add(v);
            }
        }
		if (dataSetSpec.isValid(attributeValues)) {
			List<String> names = dataSetSpec.getAttributeNames();
			List<String>.Enumerator nameiter = names.GetEnumerator();
            List<String>.Enumerator valueiter = attributeValues.GetEnumerator();
			while (nameiter.MoveNext() && valueiter.MoveNext()) {
                String name = nameiter.Current;
				AttributeSpecification attributeSpec = dataSetSpec
						.getAttributeSpecFor(name);
				LearningAttribute attribute = attributeSpec.createAttribute(valueiter.Current);
				attributes.Add(name, attribute);
			}
			String targetAttributeName = dataSetSpec.getTarget();
			return new Example(attributes, attributes[targetAttributeName]);
		} else {
			throw new ApplicationException("Unable to construct Example from "
					+ data);
		}
	}
Exemplo n.º 2
0
        public static Example exampleFromString(String data,
                                                DataSetSpecification dataSetSpec, Char separator)
        {
            Dictionary <String, LearningAttribute> attributes = new Dictionary <String, LearningAttribute>();
            List <String> attributeValues = new List <String>();

            string [] vals = data.Split(new char[] { ' ', '\t', ',' });
            foreach (string v in vals)
            {
                if (!String.IsNullOrWhiteSpace(v))
                {
                    attributeValues.Add(v);
                }
            }
            if (dataSetSpec.isValid(attributeValues))
            {
                List <String>             names     = dataSetSpec.getAttributeNames();
                List <String> .Enumerator nameiter  = names.GetEnumerator();
                List <String> .Enumerator valueiter = attributeValues.GetEnumerator();
                while (nameiter.MoveNext() && valueiter.MoveNext())
                {
                    String name = nameiter.Current;
                    AttributeSpecification attributeSpec = dataSetSpec
                                                           .getAttributeSpecFor(name);
                    LearningAttribute attribute = attributeSpec.createAttribute(valueiter.Current);
                    attributes.Add(name, attribute);
                }
                String targetAttributeName = dataSetSpec.getTarget();
                return(new Example(attributes, attributes[targetAttributeName]));
            }
            else
            {
                throw new ApplicationException("Unable to construct Example from "
                                               + data);
            }
        }
Exemplo n.º 3
0
 public List <String> getAttributeNames()
 {
     return(specification.getAttributeNames());
 }