getAttributeNames() 공개 메소드

public getAttributeNames ( ) : List
리턴 List
예제 #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);
		}
	}
예제 #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);
            }
        }
예제 #3
0
 public List <String> getAttributeNames()
 {
     return(specification.getAttributeNames());
 }