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


C# BasicNetwork.IsConnected方法代码示例

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


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

示例1: AnalyzeNetwork

        /// <summary>
        /// Construct a network analyze class.  Analyze the specified network.
        /// </summary>
        /// <param name="network">The network to analyze.</param>
        public AnalyzeNetwork(BasicNetwork network)
        {
            int assignDisabled = 0;
            int assignedTotal = 0;
            IList<double> biasList = new List<double>();
            IList<double> weightList = new List<double>();
            IList<double> allList = new List<double>();

            foreach (ILayer layer in network.Structure.Layers)
            {
                if (layer.HasBias)
                {
                    for (int i = 0; i < layer.NeuronCount; i++)
                    {
                        biasList.Add(layer.BiasWeights[i]);
                        allList.Add(layer.BiasWeights[i]);
                    }
                }
            }

            foreach (ISynapse synapse in network.Structure.Synapses)
            {
                if (synapse.MatrixSize > 0)
                {
                    for (int from = 0; from < synapse.FromNeuronCount; from++)
                    {
                        for (int to = 0; to < synapse.ToNeuronCount; to++)
                        {
                            if (network.IsConnected(synapse, from, to))
                            {
                                double d = synapse.WeightMatrix[from, to];
                                weightList.Add(d);
                                allList.Add(d);
                            }
                            else
                            {
                                assignDisabled++;
                            }
                            assignedTotal++;
                        }
                    }
                }
            }

            this.disabledConnections = assignDisabled;
            this.totalConnections = assignedTotal;
            this.weights = new NumericRange(weightList);
            this.bias = new NumericRange(biasList);
            this.weightsAndBias = new NumericRange(allList);
            this.weightValues = EngineArray.ListToDouble(weightList);
            this.allValues = EngineArray.ListToDouble(allList);
            this.biasValues = EngineArray.ListToDouble(biasList);
        }
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:57,代码来源:AnalyzeNetwork.cs


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