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


C# Simulator.OutputResult方法代码示例

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


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

示例1: ProcessThread


//.........这里部分代码省略.........
                        currentEpoch = epochIndex;

                        List<TrialInformation> trainingMatrixTrialInformationList = new List<TrialInformation>();
                        foreach (MatchingInformation trainingMatchingInformation in currentTrainingMatchingInformationList)
                        {
                            List<StimuliMatrix> stimuliMatrixList = new List<StimuliMatrix>();
                            switch (learningSetupList[learningSetupIndex].TrainingProcessMode)
                            {
                                case ProcessMode.RandomAll:
                                case ProcessMode.RandomInStimuliPack:
                                    stimuliMatrixList = simulator.StimuliPackDictionary[trainingMatchingInformation.StimuliPackName].GetMatrixStimuliData(true, true, learningSetupList[learningSetupIndex].MatrixCalculationSize);
                                    break;
                                case ProcessMode.SequentialAll:
                                case ProcessMode.SequentialinStimuliPack:
                                    stimuliMatrixList = simulator.StimuliPackDictionary[trainingMatchingInformation.StimuliPackName].GetMatrixStimuliData(true, false, learningSetupList[learningSetupIndex].MatrixCalculationSize);
                                    break;
                            }

                            foreach (StimuliMatrix stimuliMatrix in stimuliMatrixList)
                            {
                                TrialInformation newTrainingTrialInformation = new TrialInformation();
                                newTrainingTrialInformation.Process = simulator.ProcessDictionary[trainingMatchingInformation.ProcessName];
                                newTrainingTrialInformation.PatternSetup = trainingMatchingInformation.PatternSetup;
                                newTrainingTrialInformation.StimuliMatrix = stimuliMatrix;

                                trainingMatrixTrialInformationList.Add(newTrainingTrialInformation);
                            }
                        }

                        switch (learningSetupList[learningSetupIndex].TrainingProcessMode)
                        {
                            case ProcessMode.RandomAll:
                            case ProcessMode.SequentialinStimuliPack:
                                trainingMatrixTrialInformationList = trainingMatrixTrialInformationList.OrderBy(x => (SimulatorAccessor.random.Next())).ToList();
                                break;
                        }

                        currentTrialInformationCount = trainingMatrixTrialInformationList.Count;
                        for (int trainingIndex = 0; trainingIndex < trainingMatrixTrialInformationList.Count; trainingIndex++)
                        {
                            currentProcessName = trainingMatrixTrialInformationList[trainingIndex].Process.Name;
                            currentStimuliPackName = trainingMatrixTrialInformationList[trainingIndex].StimuliMatrix.PackName;
                            simulator.Process(trainingMatrixTrialInformationList[trainingIndex], totalEpoch + epochIndex + 1);
                            currentTrainingIndex = trainingIndex;
                        }

                        if ((epochIndex + 1) % learningSetupList[learningSetupIndex].TestTiming == 0)
                        {
                            learningStatus = LearningStatus.Test;
                            if (simulator.UseWeightInformation) simulator.WeightInformationReader(totalEpoch + epochIndex + 1);
                            for (int testIndex = 0; testIndex < testMatrixTrialInformationList.Count; testIndex++)
                            {
                                simulator.Process(testMatrixTrialInformationList[testIndex], totalEpoch + epochIndex + 1);
                            }

                            try { this.Invoke(new MethodInvoker(delegate { TestDisplayRefresh(); })); }
                            catch { }
                        }

                        if (learningStatus == LearningStatus.Pausing)
                        {
                            currentEpoch = epochIndex + 1;
                            break;
                        }

                        currentTick = DateTime.Now.Ticks;
                    }

                    if (learningStatus == LearningStatus.Pausing)
                    {
                        if (currentEpoch >= learningSetupList[learningSetupIndex].TrainingEpoch)
                        {
                            currentEpoch = 0;
                            currentLearningSetupIndex = learningSetupIndex + 1;
                        }
                        if(currentLearningSetupIndex >= learningSetupList.Count)
                        {
                            currentLearningSetupIndex = 0;
                            currentBathDataIndex = batchIndex + 1;
                        }
                        break;
                    }
                    else
                    {
                        string resultPath = simulator.OutputResult();
                        simulator.WeightSave(resultPath + "Status.WDATA");

                        currentLearningSetupIndex = 0;
                        currentEpoch = 0;
                        totalEpoch = 0;
                    }
                }
                if (learningStatus == LearningStatus.Pausing)
                {
                    learningStatus = LearningStatus.Paused;
                    break;
                }
            }
            if (learningStatus == LearningStatus.Training || learningStatus == LearningStatus.Test) learningStatus = LearningStatus.End;
        }
开发者ID:CODEJIN,项目名称:HJ-Net,代码行数:101,代码来源:BatchLearningForm.cs


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