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


C# BasicNetwork.GetLayer方法代码示例

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


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

示例1: NetworkToString

        /// <summary>
        /// Format the network as a human readable string that lists the 
        /// hidden layers.
        /// </summary>
        /// <param name="network">The network to format.</param>
        /// <returns>A human readable string.</returns>
        public static String NetworkToString(BasicNetwork network)
        {
            StringBuilder result = new StringBuilder();
            int num = 1;

            ILayer layer = network.GetLayer(BasicNetwork.TAG_INPUT);

            // display only hidden layers
            while (layer.Next.Count > 0)
            {
                layer = layer.Next[0].ToLayer;

                if (result.Length > 0)
                {
                    result.Append(",");
                }
                result.Append("H");
                result.Append(num++);
                result.Append("=");
                result.Append(layer.NeuronCount);
            }

            return result.ToString();

        }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:31,代码来源:PruneIncremental.cs

示例2: SVDTraining

        /// <summary>
        /// Construct the LMA object.
        /// </summary>
        /// <param name="network">The network to train. Must have a single output neuron.</param>
        /// <param name="training">The training data to use. Must be indexable.</param>
        public SVDTraining(BasicNetwork network, INeuralDataSet training)
        {
            ILayer outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);

            if (outputLayer == null)
            {
                throw new TrainingError("SVD requires an output layer.");
            }

            if (outputLayer.NeuronCount != 1)
            {
                throw new TrainingError("SVD requires an output layer with a single neuron.");
            }

            if (network.GetLayer(RadialBasisPattern.RBF_LAYER) == null)
                throw new TrainingError("SVD is only tested to work on radial basis function networks.");

            rbfLayer = (RadialBasisFunctionLayer)network.GetLayer(RadialBasisPattern.RBF_LAYER);

            this.Training = training;
            this.network = network;
            this.trainingLength = (int)this.Training.InputSize;

            BasicNeuralData input = new BasicNeuralData(this.Training.InputSize);
            BasicNeuralData ideal = new BasicNeuralData(this.Training.IdealSize);
            this.pair = new BasicNeuralDataPair(input, ideal);
        }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:32,代码来源:SVDTraining.cs

示例3: CalculateDepth

 /// <summary>
 /// Construct the depth calculation object.
 /// </summary>
 /// <param name="network">The network that we are calculating for.</param>
 public CalculateDepth(BasicNetwork network)
 {
     this.network = network;
     this.outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);
     if( this.outputLayer!=null )
         Calculate(0, this.outputLayer);
 }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:11,代码来源:CalculateDepth.cs

示例4: TrainAdaline

        /// <summary>
        /// Construct he ADALINE trainer.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="training">The training set.</param>
        /// <param name="learningRate">The learning rate.</param>
        public TrainAdaline(BasicNetwork network, INeuralDataSet training,
                double learningRate)
        {
            if (network.Structure.Layers.Count > 2)
                throw new NeuralNetworkError(
                        "An ADALINE network only has two layers.");
            this.network = network;

            ILayer input = network.GetLayer(BasicNetwork.TAG_INPUT);

            this.synapse = input.Next[0];
            this.training = training;
            this.learningRate = learningRate;
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:20,代码来源:TrainAdaline.cs

示例5: CompetitiveTraining

        /// <summary>
        /// Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public CompetitiveTraining(BasicNetwork network,
                 double learningRate, INeuralDataSet training,
                 INeighborhoodFunction neighborhood)
        {
            this.neighborhood = neighborhood;
            Training = training;
            this.LearningRate = learningRate;
            this.network = network;
            this.inputLayer = network.GetLayer(BasicNetwork.TAG_INPUT);
            this.outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);
            this.synapses = network.Structure.GetPreviousSynapses(
                    this.outputLayer);
            this.inputNeuronCount = this.inputLayer.NeuronCount;
            this.outputNeuronCount = this.outputLayer.NeuronCount;
            this.ForceWinner = false;
            Error = 0;

            // setup the correction matrix
            foreach (ISynapse synapse in this.synapses)
            {
                Matrix matrix = new Matrix(synapse.WeightMatrix.Rows,
                       synapse.WeightMatrix.Cols);
                this.correctionMatrix[synapse] = matrix;
            }

            // create the BMU class
            this.bmuUtil = new BestMatchingUnit(this);
        }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:35,代码来源:CompetitiveTraining.cs

示例6: FindCPN

        /// <summary>
        /// Construct the object and find the parts of the network.
        /// </summary>
        /// <param name="network">The network to train.</param>
        public FindCPN(BasicNetwork network)
        {
            if (network.Structure.Layers.Count != 3)
            {
                String str = "A CPN network must have exactly 3 layers";
#if logging
                if (logger.IsErrorEnabled)
                {
                    logger.Error(str);
                }
#endif
                throw new TrainingError(str);
            }

            this.inputLayer = network.GetLayer(BasicNetwork.TAG_INPUT);
            this.outstarLayer = network.GetLayer(CPNPattern.TAG_OUTSTAR);
            this.instarLayer = network.GetLayer(CPNPattern.TAG_INSTAR);

            if (this.outstarLayer == null)
            {
                String str = "Can't find an OUTSTAR layer, this is required.";
#if logging
                if (logger.IsErrorEnabled)
                {
                    logger.Error(str);
                }
#endif
                throw new TrainingError(str);
            }

            if (this.instarLayer == null)
            {
                String str = "Can't find an OUTSTAR layer, this is required.";
#if logging
                if (logger.IsErrorEnabled)
                {
                    logger.Error(str);
                }
#endif
                throw new TrainingError(str);
            }

            this.instarSynapse = this.inputLayer.Next[0];
            this.outstarSynapse = this.instarLayer.Next[0];
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:49,代码来源:FindCPN.cs

示例7: Init

 /// <summary>
 /// Setup the network logic, read parameters from the network.
 /// </summary>
 /// <param name="network">The network that this logic class belongs to.</param>
 public void Init(BasicNetwork network)
 {
     this.network = network;
     this.f1Layer = network.GetLayer(BAMPattern.TAG_F1);
     this.f2Layer = network.GetLayer(BAMPattern.TAG_F2);
     this.synapseF1ToF2 = network.Structure.FindSynapse(this.f1Layer, this.f2Layer, true);
     this.synapseF2ToF1 = network.Structure.FindSynapse(this.f2Layer, this.f1Layer, true);
 }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:12,代码来源:BAMLogic.cs

示例8: NEATTraining

        /// <summary>
        /// Construct a NEAT training class.
        /// </summary>
        /// <param name="score">How to score the networks.</param>
        /// <param name="network">The network to base this on.</param>
        /// <param name="population">The population to use.</param>
        public NEATTraining(ICalculateScore score, BasicNetwork network,
        IPopulation population)
        {
            ILayer inputLayer = network.GetLayer(BasicNetwork.TAG_INPUT);
            ILayer outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);
            this.CalculateScore = new GeneticScoreAdapter(score);
            this.Comparator = new GenomeComparator(CalculateScore);
            this.inputCount = inputLayer.NeuronCount;
            this.outputCount = outputLayer.NeuronCount;
            this.Population = population;

            foreach (IGenome obj in population.Genomes)
            {
                NEATGenome neat = (NEATGenome)obj;
                neat.GA = this;
            }

            Init();
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:25,代码来源:NEATTraining.cs


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