本文整理汇总了C#中BasicNetwork.SetWeight方法的典型用法代码示例。如果您正苦于以下问题:C# BasicNetwork.SetWeight方法的具体用法?C# BasicNetwork.SetWeight怎么用?C# BasicNetwork.SetWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicNetwork
的用法示例。
在下文中一共展示了BasicNetwork.SetWeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RandomizeLayer
/// <summary>
/// The Xaiver initialization works layer by layer.
/// </summary>
/// <param name="network">The network.</param>
/// <param name="fromLayer">The source layer.</param>
private void RandomizeLayer(BasicNetwork network, int fromLayer)
{
var fromCount = network.GetLayerTotalNeuronCount(fromLayer);
var toCount = network.Layers[fromLayer + 1].Count;
for (var fromNeuron = 0; fromNeuron < fromCount; fromNeuron++)
{
for (var toNeuron = 0; toNeuron < toCount; toNeuron++)
{
var sigma = Math.Sqrt(2.0/(fromCount + toCount));
var w = Rnd.NextGaussian()*sigma;
network.SetWeight(fromLayer, fromNeuron, toNeuron, w);
}
}
}