当前位置: 首页>>代码示例>>C#>>正文


C# RC.Run方法代码示例

本文整理汇总了C#中RC.Run方法的典型用法代码示例。如果您正苦于以下问题:C# RC.Run方法的具体用法?C# RC.Run怎么用?C# RC.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RC的用法示例。


在下文中一共展示了RC.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _ELM

        private void _ELM(Particula p)
        {
            DataProvider prov = new DataProvider(_DataSetPath, EExecutionType.Predction, Util.Random);

            RCConfiguration config = _GetELMConfigurationFromPSOParticle(p, prov);

            config.Prov.MaxValue = prov.MaxValue.Clone() as double[];
            config.Prov.MinValue = prov.MinValue.Clone() as double[];
            config.Prov.NormalizeData(inputA, inputB, outputA, outputB);

            config.Prov.ShuffleDataSet(1);
            config.Prov.SplitData();

            RC elm = new RC(config.Prov.TrainSet, config.Prov.ValidationSet, config);

            try
            {
                elm.Run();
            }
            catch
            { }

            RCEvaluator eval = new RCEvaluator(elm, EEvaluationInfo.EMQ | EEvaluationInfo.DEV | EEvaluationInfo.EPMA);

            eval.Evaluate();

            double fitness = eval.TrainEPMA + (2 * eval.ValidationDEV * p.GetFlagCountFromSubListValues((int)config.Prov.InputsN) / config.Prov.ValidationSetLines) + (config.HidenNodesNumber / MaxHiddenNodes);

            p.Eval = eval;
            p.Fitness = fitness;
            p.Config = config;

            count++;

            // Variação de C1 e C2
            if (_VariarC1C2)
            {
                if (count % _LimiteVariacaoC1C2 == 0)
                {
                    _C1 = _C1 - _TaxaVariacaoC1C2;
                    _C2 = _C2 + _TaxaVariacaoC1C2;
                }
            }

            // Variação de W
            if (_VariarW)
            {
                if (count % _LimiteVariacaoW == 0)
                    _W = _W - _TaxaVariacaoW;
            }
        }
开发者ID:Edgarwma,项目名称:Reservoir,代码行数:51,代码来源:PSO.cs

示例2: Main

        static void Main(string[] args)
        {
            try
            {
                // TestLags();
                DateTime StartTime, EndTime;
                List<object[]> bestRCs = new List<object[]>();
                int MaxRCMemory = 10;
                int seed = 1;
                int MaxHiddenNodesNumber = 150;
                int MaxWarmUpCicles = 100;
                double MaxInterConnectivity = 1;
                double SpectralRadious = 0.9;

                string dataSetPath = @"C:\Users\Edgar\Desktop\Dados\PLD\lag.csv";

                for (int h = 10; h < MaxHiddenNodesNumber && bestRCs.Count < 1; h += 5)
                {
                    for (double i = 0.0; i < MaxInterConnectivity && bestRCs.Count < 1; i += 0.02)
                    {
                        for (int w = 1; w < MaxWarmUpCicles && bestRCs.Count < 1; w += 5)
                        {
                            StartTime = DateTime.Now;
                            DataProvider dp = new DataProvider(dataSetPath, EExecutionType.Predction, seed, trainSize, validationSize, testSize);
                            //dp.ApplyLogToData();
                            dp.NormalizeData(inputA, inputB, outputA, outputB);
                            dp.ShuffleDataSet();
                            dp.SplitData();

                            RC rc = new RC(dp.TrainSet, dp.ValidationSet, dp.TestSet, new RCConfiguration(dp, seed, h, i, w, SpectralRadious, ERCActivationFunctionType.HyperbolicTangent));

                            rc.Run();
                            RCEvaluator eval = new RCEvaluator(rc, dp, EEvaluationInfo.EMQ | EEvaluationInfo.DEV | EEvaluationInfo.EPMA | EEvaluationInfo.RMSE);

                            eval.Evaluate();

                            RCEvaluator eval2 = new RCEvaluator(rc, dp, EEvaluationInfo.EMQ | EEvaluationInfo.DEV | EEvaluationInfo.EPMA | EEvaluationInfo.RMSE, true);

                            eval2.Evaluate();

                            EndTime = DateTime.Now;

                            Console.WriteLine("Neurônios camada escondida: " + h);
                            Console.WriteLine("Interconectividade (%): " + i.ToString("0.##"));
                            Console.WriteLine("Ciclos aquecimento: " + w);
                            Console.WriteLine("EMQ(7): " + eval.TestEMQ[6].ToString("0.##"));
                            Console.WriteLine("RMSE(7): " + eval.TestRMSE[6].ToString("0.##"));
                            Console.WriteLine("EPMA(7): " + eval.TestEPMA[6].ToString("0.##"));
                            Console.WriteLine("Tempo: " + EndTime.Subtract(StartTime).ToReadableString());
                            Console.WriteLine("#################################");

                            object[] b = new object[4];
                            b[0] = eval.TestEPMA[0];
                            b[1] = dp;
                            b[2] = rc;
                            b[3] = eval;

                            bestRCs.Add(b);

                            bestRCs.Sort(delegate(object[] p1, object[] p2)
                                    {
                                        return ((double)p1[0]).CompareTo(((double)p2[0]));
                                    });

                            if (bestRCs.Count > MaxRCMemory)
                                bestRCs.RemoveAt(MaxRCMemory);
                        }
                    }
                }

                Console.WriteLine("Salvando Predição da melhor configuração");
                #region Salvando Predição
                double prediction = 0;
                double Error = 0;

                DataProvider dataProv = bestRCs[0][1] as DataProvider;
                RC elm = bestRCs[0][2] as RC;
                RCEvaluator evaluator = bestRCs[0][3] as RCEvaluator;

                StreamWriter File = new System.IO.StreamWriter(@"C:\Users\Edgar\Desktop\Dados\Furnas\Predicao\predicao_" +
                    elm.HiddenNodesNumber + "_" + elm.InterConnectivity + "_" + elm.WarmUpCicles + "_" + evaluator.TestEPMA[6] + ".csv", false);

                for (int m = 0; m < dataProv.TestSetlines; m++)
                {
                    string temp = string.Empty;
                    for (int j = 0; j < dataProv.OutputsN; j++)
                    {
                        prediction = dataProv.DeNormalizeOutputData(elm.TestT[m][j], j);

                        Error = dataProv.TestSet[m].RealOutput[j] - prediction;
                        temp = string.Concat(temp + dataProv.TestSet[m].RealOutput[j] + ";" + prediction + ";" + Error + ";");
                    }
                    File.WriteLine(temp);
                }
                File.Close();
                #endregion

                Console.WriteLine("FIM");
                Console.ReadLine();
            }
//.........这里部分代码省略.........
开发者ID:Edgarwma,项目名称:Reservoir,代码行数:101,代码来源:Program.cs


注:本文中的RC.Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。