Ejemplo n.º 1
0
        private void btn_CheckResult_Click(object sender, EventArgs e)
        {
            long           len  = long.Parse(this.txt_DataLength.Text);
            int            deep = int.Parse(this.txt_LearnDeep.Text);
            ExpectList <T> el   = new ExpectReader().ReadHistory <T>(long.Parse(this.txt_BegExpect.Text), len + deep + 1);

            for (int i = 0; i < 10; i++)
            {
                MachineLearnClass <int, int> SelectFunc = null;
                MLType     = (Type)this.ddl_MLFunc.SelectedValue;
                SelectFunc = (MachineLearnClass <int, int>)ClassOperateTool.getInstanceByType(MLType);
                //暂时屏蔽机器学习功能
                //TestSet = new MLDataFactory(el).getAllSpecColRoundLabelAndFeatures(i,deep, chkb_AllUseShift.Checked ? 1 : 0);
                SelectFunc.OnLoadLocalFile = GetLocalFile;
                SelectFunc.LoadSummary();
                SelectFunc.FillStructBySummary(i);
                SelectFunc.SetTestInstances(TestSet);
                this.Cursor = Cursors.WaitCursor;
                ExecClass ec = new ExecClass();
                ec.GroupId  = (i + 1) % 10;
                ec.MaxEnt   = SelectFunc;
                ec.TestData = TestSet;
                new Thread(new ThreadStart(ec.Exec)).Start();
            }
        }
Ejemplo n.º 2
0
        private void btn_Train_Click(object sender, EventArgs e)
        {
            //return;//暂时不支持训练集回测
            long len  = long.Parse(this.txt_DataLength.Text);
            int  deep = int.Parse(this.txt_LearnDeep.Text);
            ExpectList <TimeSerialData> el = new ExpectReader().ReadHistory <TimeSerialData>(long.Parse(this.txt_BegExpect.Text), len + deep + 1);

            //MLDataFactory mldf = new MLDataFactory(ExpectList.getExpectList(el));
            DataCategroyType = (Type)this.ddl_categryFunc.SelectedValue;
            MLType           = (Type)this.ddl_MLFunc.SelectedValue;
            MLDataCategoryFactoryClass mldf = (MLDataCategoryFactoryClass)ClassOperateTool.getInstanceByType(DataCategroyType);

            mldf.Init(ExpectList.getExpectList(el));
            for (int i = 0; i < 10; i++)
            {
                //MLInstances<int, int> TrainSet = mldf.getAllSpecColRoundLabelAndFeatures(i,deep, chkb_AllUseShift.Checked ? 1 : 0);
                MLInstances <int, int>       TrainSet   = mldf.getCategoryData(i, deep, chkb_AllUseShift.Checked ? 1 : 0);
                MachineLearnClass <int, int> SelectFunc = (MachineLearnClass <int, int>)ClassOperateTool.getInstanceByType(MLType);//获取机器学习类型
                SelectFunc.OnTrainFinished += OnTrainFinished;
                SelectFunc.OnPeriodEvent   += OnPeriodEvent;
                SelectFunc.OnSaveEvent     += SaveData;
                SelectFunc.GroupId          = i;
                SelectFunc.FillTrainData(TrainSet);
                SelectFunc.InitTrain();
                SelectFunc.TrainIterorCnt = int.Parse(txt_IteratCnt.Text);
                SelectFuncs.Add(SelectFunc);
                this.txt_begT.Text = DateTime.Now.ToLongTimeString();
                this.Cursor        = Cursors.WaitCursor;
                RunningThread      = new Thread(SelectFunc.Train);
                RunningThread.Start();
                ThreadCnt++;
            }
        }
Ejemplo n.º 3
0
        public frm_TrainForm()
        {
            InitializeComponent();
            DataTable dt = ClassOperateTool.getAllSubClass(typeof(MachineLearnClass <int, int>), "text", "value");

            this.ddl_MLFunc.DataSource    = dt;
            this.ddl_MLFunc.DisplayMember = "text";
            this.ddl_MLFunc.ValueMember   = "value";

            DataTable dt_categery = ClassOperateTool.getAllSubClass(typeof(MLDataFactory), "", "");
        }