Пример #1
0
        public void Convertertoarff()
        {
            dt      = (DataTable)dataGridView1.DataSource;
            targ    = null;
            attlist = new List <Attribute>();
            temp    = new List <Attribute>();
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                List <Value> attvalue = new List <Value>();
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    Value v = new Value(dt.Rows[j][i].ToString());
                    if (!attvalue.Contains(v))
                    {
                        attvalue.Add(v);
                    }
                }

                Attribute newatt = new Attribute(i, col_names[i], attvalue);
                if (i == dt.Columns.Count - 1)
                {
                    targ = newatt;
                }
                else
                {
                    attlist.Add(newatt);
                }
                temp.Add(newatt);
            }
            List <Data> datavalue = new List <Data>();

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                Data d = new Data(attlist, dataarff[j]);
                datavalue.Add(d);
            }

            a            = new Arff();
            a.Attributes = attlist;
            a.Data       = datavalue;
            a.Target     = targ;
            classbulit   = new Classifier(a);
        }
 public DecisionBuilder(Arff arff)
 {
     this.arff = arff;
 }
Пример #3
0
 public Classifier(Arff arff, bool prune = false)
 {
     this.arff    = arff;
     this.builder = new DecisionBuilder(this.arff);
     this.prune   = prune;
 }