コード例 #1
0
        /// <summary>
        /// 获取指定Name的节点
        /// <para>TODO:建立索引搜索</para>
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public INeuralNode GetNode(string name, INeuralNode parentNode = null)
        {
            if (parentNode == null)
            {
                parentNode = Root;
            }

            INeuralNode foundNode = null;

            if (parentNode.Name == name)
            {
                foundNode = parentNode;
            }

            if (foundNode == null && parentNode.ChildrenNodes != null && parentNode.ChildrenNodes.Count > 0)
            {
                foreach (var node in parentNode.ChildrenNodes)
                {
                    foundNode = GetNode(name, node);//监测当前节点
                    if (foundNode != null)
                    {
                        break;
                    }
                }
            }

            return(foundNode);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NeuralConnection"/> class.
        /// </summary>
        /// <param name="initialWeight">The connection's initial weight value.</param>
        /// <param name="sourceNode">The source node.</param>
        /// <param name="targetNode">The target node.</param>
        public NeuralConnection(double initialWeight, INeuralNode sourceNode, INeuralNode targetNode)
        {
            if (sourceNode == null)
            {
                throw new ArgumentNullException("sourceNode");
            }

            if (targetNode == null)
            {
                throw new ArgumentNullException("targetNode");
            }

            // Initialize the class name that will appear in log files.
            this.name = sourceNode.Name + "->" + targetNode.Name;
            const string MethodName = "ctor";
            Logger.TraceIn(this.name, MethodName);

            this.Weight = initialWeight;
            this.sourceNode = sourceNode;
            this.targetNode = targetNode;

            // Ensure that the end-point nodes have a reference to this connection object.
            this.sourceNode.AddOutboundConnection(this);
            this.targetNode.AddInboundConnection(this);

            Logger.TraceOut(this.name, MethodName);
        }
コード例 #3
0
ファイル: LinkWeight.cs プロジェクト: lanicon/Superscribe
        public LinkWeight(INeuralNode from, Neuron to)
        {
            this.Weight = RandomGenerator.Generate();
            this.From   = @from;
            this.To     = to;

            this.From.AddOutput(this);

            this.PreviousDelta = 0;
        }
コード例 #4
0
ファイル: LinkWeight.cs プロジェクト: c4net/Superscribe
        public LinkWeight(INeuralNode from, Neuron to)
        {
            this.Weight = RandomGenerator.Generate();
            this.From = @from;
            this.To = to;

            this.From.AddOutput(this);

            this.PreviousDelta = 0;
        }
コード例 #5
0
        /// <summary>
        /// Adds a new output node to the network.
        /// </summary>
        /// <param name="node">The node.</param>
        public void AddOutputNode(INeuralNode node)
        {
            const string MethodName = "AddOutputNode";
            Logger.TraceIn(this.name, MethodName);

            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (!this.outputNodes.Contains(node))
            {
                this.outputNodes.Add(node);
            }

            Logger.TraceOut(this.name, MethodName);
        }
コード例 #6
0
 /// <summary>
 /// 设置子节点
 /// </summary>
 /// <param name="childNode"></param>
 public virtual void SetChildNode(INeuralNode childNode)
 {
     //childNode.SetParentNode(this);
     ChildrenNodes.Add(childNode);
 }
コード例 #7
0
 public HiddenNeuron(INeuralNode first, INeuralNode second)
     : base(first, second)
 {
 }
コード例 #8
0
ファイル: HiddenNeuron.cs プロジェクト: c4net/Superscribe
 public HiddenNeuron(INeuralNode first, INeuralNode second)
     : base(first, second)
 {
 }
コード例 #9
0
 public OutputNeuron(INeuralNode first, INeuralNode second)
     : base(first, second)
 {
 }
コード例 #10
0
        /// <summary>
        /// 初始化 Root 参数
        /// </summary>
        private void InitRoot()
        {
            INeuralNode root = new RootNeuralNode();

            Root = root;
        }
コード例 #11
0
ファイル: OutputNeuron.cs プロジェクト: c4net/Superscribe
 public OutputNeuron(INeuralNode first, INeuralNode second)
     : base(first, second)
 {
 }