コード例 #1
0
ファイル: EM.cs プロジェクト: parkclub/SRATS2017
        //public EM(EMbase model, EMConf emparam, Message msg)
        //{
        //	this.model = model;
        //	this.msg = msg;
        //	this.emparam = emparam;
        //	init();
        //}

        public EM(SRM model, EMConf emparam, IMessage msg)
        {
            this.model   = model as IEMbase;
            this.msg     = msg;
            this.emparam = emparam;
            Init();
        }
コード例 #2
0
        public static void Test_srm()
        {
            double[] time = { 2, 1, 2, 3, 2, 1 };
            int[]    num  = { 0, 1, 1, 0, 2, 0 };
            int[]    type = { 0, 0, 0, 0, 0, 0 };
            SRMData  data = new SRMData();

            data.SetData(time, num, type);

            SRM[] models = new SRM[11];
            models[0]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.EXP);
            models[1]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.GAMMA);
            models[2]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.PARETO);
            models[3]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.TNORM);
            models[4]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.LNORM);
            models[5]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.TLOGIS);
            models[6]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.LLOGIS);
            models[7]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.TXVMAX);
            models[8]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.TXVMIN);
            models[9]  = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.LXVMAX);
            models[10] = SRMFactory.GetInstance().CreateSRM(OriginalSRMModel.LXVMIN);

            EMConf[] emconf = new EMConf[11];
            EM[]     em     = new EM[11];
            for (int i = 0; i < 11; i++)
            {
                emconf[i] = new EMConf();
                em[i]     = new EM(models[i], emconf[i], new MODELS.SRMConsoleMessage(models[i], emconf[i]));
            }

            for (int i = 0; i < 11; i++)
            {
                emconf[i].Progress = 1;
                emconf[i].StopCond = StopCondition.PARAMETER;
                em[i].Initialize(data);
                em[i].Fit(data);
                Console.WriteLine(emconf[i].Status);
                Result result = models[i].Calc(data);
                print_result(result);
            }
        }
コード例 #3
0
        public static void Test_cphem()
        {
            double[] time = { 2, 1, 2, 3, 2, 1 };
            int[]    num  = { 0, 1, 1, 0, 2, 0 };
            int[]    type = { 0, 0, 0, 0, 0, 0 };
            SRMData  data = new SRMData();

            data.SetData(time, num, type);

            int nm = 4;

            SRM[] models = new SRM[nm];
            models[0] = new CPH.CPHEMSRM(new CPH.CPHParam(1));
            models[1] = new CPH.CPHEMSRM(new CPH.CPHParam(2));
            models[2] = new CPH.CPHEMSRM(new CPH.CPHParam(3));
            models[3] = new CPH.CPHEMSRM(new CPH.CPHParam(4));

            EMConf[] emconf = new EMConf[nm];
            EM[]     em     = new EM[nm];
            for (int i = 0; i < nm; i++)
            {
                emconf[i] = new EMConf();
                em[i]     = new EM(models[i], emconf[i], new MODELS.SRMConsoleMessage(models[i], emconf[i]));
            }

            for (int i = 0; i < nm; i++)
            {
                emconf[i].Progress = 1;
                emconf[i].StopCond = StopCondition.LLF;
                em[i].Initialize(data);
                em[i].Fit(data);
                Console.WriteLine(emconf[i].Status);
                Result result = models[i].Calc(data);
                print_result(result);
            }
        }