Exemplo n.º 1
0
        public void Test_LDA_Performance2000_var(int rep)
        {
            int errorCode = 0;

            try {
                LDA lda                 = new LDA();
                ILArray <double> X      = ILMath.horzcat(ILMath.randn(2, 2000) * 2.0, ILMath.randn(2, 2000) * -2.0);
                ILLogicalArray   labels = ILMath.tological(ILMath.horzcat(ILMath.ones(1, 2000), ILMath.zeros(1, 2000)));
                labels = labels.Concat(ILMath.tological(ILMath.zeros(1, 2000).Concat(ILMath.ones(1, 2000), 1)), 0);
                ILPerformer    timer = new ILPerformer();
                LDA.Hyperplane C;
                int            oldRefMin = ILNumerics.Settings.ILSettings.MinimumRefDimensions;
                ILNumerics.Settings.ILSettings.MinimumRefDimensions = 2;
                timer.Tic();
                for (int i = 0; i < rep; i++)
                {
                    C = lda.TrainLDA(X, labels, 0.4);
                }
                timer.Toc();
                Info("Test_LDA_Performance: with reference - data: 2x2000 run " + rep.ToString() + " times in: " + timer.Duration + "ms");
                ILNumerics.Settings.ILSettings.MinimumRefDimensions = 3;
                timer.Tic();
                for (int i = 0; i < rep; i++)
                {
                    C = lda.TrainLDA(X, labels, 0.4);
                }
                timer.Toc();
                ILNumerics.Settings.ILSettings.MinimumRefDimensions = oldRefMin;
                Info("Test_LDA_Performance: without reference - data: 2x2000 run " + rep.ToString() + " times in: " + timer.Duration + "ms");
                Success();
            }catch (Exception e) {
                Error(errorCode, e.Message);
            }
        }
Exemplo n.º 2
0
        public void Test_LDA_Performance200k_10()
        {
            int errorCode = 0;

            try {
                LDA lda                 = new LDA();
                ILArray <double> X      = ILMath.horzcat(ILMath.randn(2, 200000) * 2.0, ILMath.randn(2, 200000) * -2.0);
                ILLogicalArray   labels = ILMath.tological(ILMath.horzcat(ILMath.ones(1, 100000), ILMath.zeros(1, 100000)));
                labels = labels.Concat(ILMath.tological(ILMath.zeros(1, 100000).Concat(ILMath.ones(1, 100000), 1)), 0);
                ILPerformer timer = new ILPerformer();
                timer.Tic();  LDA.Hyperplane C;
                for (int i = 0; i < 10; i++)
                {
                    C = lda.TrainLDA(X, labels, 0.4);
                }
                timer.Toc();
                Info("Test_LDA_Performance2: data: 2x200000 run 10 times in: " + timer.Duration + "ms");
                Success();
            }catch (Exception e) {
                Error(errorCode, e.Message);
            }
        }