예제 #1
0
    public void Initialize(int m_HiddenLayers, ThoughtProcess thoughtProcess)
    {
        this.thoughtProcess    = thoughtProcess;
        thoughtProcessStringed = thoughtProcess.GetThoughtAsString();
        hiddenLayers           = new NeuralNetworkNode[m_HiddenLayers];
        for (int i = 0; i < m_HiddenLayers; i++)
        {
            hiddenLayers[i] = new NeuralNetworkNode();
        }

        foreach (var layer in hiddenLayers)
        {
            layer.SetBias(thoughtProcess.GetNext());
            for (int i = 0; i < inputLayer.Length; i++)
            {
                layer.ConnectTo(inputLayer[i], thoughtProcess.GetNext());
            }
        }

        foreach (var layer in outputLayer)
        {
            layer.SetBias(thoughtProcess.GetNext());
            for (int i = 0; i < hiddenLayers.Length; i++)
            {
                layer.ConnectTo(hiddenLayers[i], thoughtProcess.GetNext());
            }
        }

        if (!thoughtProcess.HasNoNext())
        {
            Debug.LogWarning("INputnodes, hidden nodes, or output node amount is wrong, is at " + thoughtProcess.GetCurrentIndex() + " but expected " + thoughtProcess.biasAndWeights.Length);
        }
    }