add() public method

public add ( Example e ) : void
e Example
return void
示例#1
0
        public DataSet copy()
        {
            DataSet ds = new DataSet(specification);

            foreach (Example e in examples)
            {
                ds.add(e);
            }
            return(ds);
        }
示例#2
0
 public DataSet removeExample(Example e)
 {
     DataSet ds = new DataSet(specification);
     foreach (Example eg in examples)
     {
         if (!(e.Equals(eg)))
         {
             ds.add(eg);
         }
     }
     return ds;
 }
示例#3
0
        public DataSet removeExample(Example e)
        {
            DataSet ds = new DataSet(specification);

            foreach (Example eg in examples)
            {
                if (!(e.Equals(eg)))
                {
                    ds.add(eg);
                }
            }
            return(ds);
        }
示例#4
0
        public DataSet matchingDataSet(String attributeName, String attributeValue)
        {
            DataSet ds = new DataSet(specification);

            foreach (Example e in examples)
            {
                if (e.getAttributeValueAsString(attributeName).Equals(
                        attributeValue))
                {
                    ds.add(e);
                }
            }
            return(ds);
        }
示例#5
0
	public DataSet fromFile(String filename, DataSetSpecification spec,
			Char separator) {
		// assumed file in data directory and ends in .csv
		DataSet ds = new DataSet(spec);
        using (StreamReader reader = new StreamReader(typeof(DataSetFactory).Assembly.GetManifestResourceStream("AIMA.Resource." + filename)))
        {
            String line;
            while ((line = reader.ReadLine()) != null)
            {
                ds.add(exampleFromString(line, spec, separator));
            }
        }
		return ds;

	}
示例#6
0
        public DataSet fromFile(String filename, DataSetSpecification spec,
                                Char separator)
        {
            // assumed file in data directory and ends in .csv
            DataSet ds = new DataSet(spec);

            using (StreamReader reader = new StreamReader(typeof(DataSetFactory).Assembly.GetManifestResourceStream("AIMA.Resource." + filename)))
            {
                String line;
                while ((line = reader.ReadLine()) != null)
                {
                    ds.add(exampleFromString(line, spec, separator));
                }
            }
            return(ds);
        }
示例#7
0
        public Dictionary <String, DataSet> splitByAttribute(String attributeName)
        {
            Dictionary <String, DataSet> results = new Dictionary <String, DataSet>();

            foreach (Example e in examples)
            {
                String val = e.getAttributeValueAsString(attributeName);
                if (results.ContainsKey(val))
                {
                    results[val].add(e);
                }
                else
                {
                    DataSet ds = new DataSet(specification);
                    ds.add(e);
                    results.Add(val, ds);
                }
            }
            return(results);
        }
示例#8
0
 public Dictionary<String, DataSet> splitByAttribute(String attributeName)
 {
     Dictionary<String, DataSet> results = new Dictionary<String, DataSet>();
     foreach (Example e in examples)
     {
         String val = e.getAttributeValueAsString(attributeName);
         if (results.ContainsKey(val))
         {
             results[val].add(e);
         }
         else
         {
             DataSet ds = new DataSet(specification);
             ds.add(e);
             results.Add(val, ds);
         }
     }
     return results;
 }
示例#9
0
 public DataSet matchingDataSet(String attributeName, String attributeValue)
 {
     DataSet ds = new DataSet(specification);
     foreach (Example e in examples)
     {
         if (e.getAttributeValueAsString(attributeName).Equals(
                 attributeValue))
         {
             ds.add(e);
         }
     }
     return ds;
 }
示例#10
0
 public DataSet copy()
 {
     DataSet ds = new DataSet(specification);
     foreach (Example e in examples)
     {
         ds.add(e);
     }
     return ds;
 }