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


C# BasicNetwork.IsLayerBiased方法代码示例

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


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

示例1: FreeformNetwork

        /// <summary>
        /// Craete a freeform network from a basic network. 
        /// </summary>
        /// <param name="network">The basic network to use.</param>
        public FreeformNetwork(BasicNetwork network)
        {
            if (network.LayerCount < 2)
            {
                throw new FreeformNetworkError(
                    "The BasicNetwork must have at least two layers to be converted.");
            }

            // handle each layer
            IFreeformLayer previousLayer = null;

            for (int currentLayerIndex = 0;
                currentLayerIndex < network
                    .LayerCount;
                currentLayerIndex++)
            {
                // create the layer
                IFreeformLayer currentLayer = _layerFactory.Factor();

                // Is this the input layer?
                if (_inputLayer == null)
                {
                    _inputLayer = currentLayer;
                }

                // Add the neurons for this layer
                for (int i = 0; i < network.GetLayerNeuronCount(currentLayerIndex); i++)
                {
                    // obtain the summation object.
                    IInputSummation summation = null;

                    if (previousLayer != null)
                    {
                        summation = _summationFactory.Factor(network
                            .GetActivation(currentLayerIndex));
                    }

                    // add the new neuron
                    currentLayer.Add(_neuronFactory.FactorRegular(summation));
                }

                // Fully connect this layer to previous
                if (previousLayer != null)
                {
                    ConnectLayersFromBasic(network, currentLayerIndex - 1,
                        previousLayer, currentLayer);
                }

                // Add the bias neuron
                // The bias is added after connections so it has no inputs
                if (network.IsLayerBiased(currentLayerIndex))
                {
                    IFreeformNeuron biasNeuron = _neuronFactory
                        .FactorRegular(null);
                    biasNeuron.IsBias = true;
                    biasNeuron.Activation = network
                        .GetLayerBiasActivation(currentLayerIndex);
                    currentLayer.Add(biasNeuron);
                }

                // update previous layer
                previousLayer = currentLayer;
            }

            // finally, set the output layer.
            _outputLayer = previousLayer;
        }
开发者ID:benw408701,项目名称:MLHCTransactionPredictor,代码行数:71,代码来源:FreeformNetwork.cs


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