Beispiel #1
0
    public override void SetupOutputConnections(bool randomWeights = true)
    {
        base.SetupOutputConnections(randomWeights);

        List <ANNHiddenNode> nextLayer = network.GetHiddenNodesFromLayerOrder((int)ANNLayerOrders.HiddenBegin);

        if (nextLayer.Count == 0)
        {
            foreach (ANNOutputNode nextNode in network.OutputNodes)
            {
                ANNConnection con = new ANNConnection(
                    randomWeights ? Random.Range(ANNProperties.RandomWeightsRange.x, ANNProperties.RandomWeightsRange.y) : ANNProperties.NonRandomWeightDefaultValue
                    , this
                    , nextNode
                    , ConnectionType.FeedForward);
                con.OnEnable();
                this.outputConnections.Add(con);
                nextNode.inputConnections.Add(con);
            }
        }
        else
        {
            foreach (ANNHiddenNode nextNode in nextLayer)
            {
                ANNConnection con = new ANNConnection(
                    randomWeights ? Random.Range(ANNProperties.RandomWeightsRange.x, ANNProperties.RandomWeightsRange.y) : ANNProperties.NonRandomWeightDefaultValue
                    , this
                    , nextNode
                    , ConnectionType.FeedForward);
                con.OnEnable();
                this.outputConnections.Add(con);
                nextNode.inputConnections.Add(con);
            }
        }
    }
Beispiel #2
0
    // Connections ---
    private ANNGraphicConnection CreateGCon(ANNConnection c, ANNGraphicNode ingn, ANNGraphicNode outgn)
    {
        if (c == null || ingn == null || outgn == null)
        {
            return(null);
        }
        ANNGraphicConnection gc = new ANNGraphicConnection(c, ingn, outgn);

        gCons.Add(gc);
        return(gc);
    }
Beispiel #3
0
 private bool IsInClosedCons(ANNConnection c, List <ANNConnection> list)
 {
     for (int i = 0; i < list.Count; ++i)
     {
         if (list[i] == c)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #4
0
    /// Methods ///
    public override void SetupOutputConnections(bool randomWeights = true)
    {
        base.SetupOutputConnections(randomWeights);

        if (layer < (int)ANNLayerOrders.HiddenBegin)
        {
            Debug.LogWarning(this.name + " => Trying to SetupOutputConnections(bool) but layerOrder is unknown");
            return;
        }

        int nextLayerOrder = layer + 1;

        if (network.NHiddenLayers + (int)ANNLayerOrders.HiddenBegin == nextLayerOrder)
        {
            nextLayerOrder = (int)ANNLayerOrders.Output;
            List <ANNOutputNode> nextLayer = network.OutputNodes;
            foreach (ANNOutputNode nextNode in nextLayer)
            {
                ANNConnection con = new ANNConnection(
                    randomWeights ? Random.Range(ANNProperties.RandomWeightsRange.x, ANNProperties.RandomWeightsRange.y) : ANNProperties.NonRandomWeightDefaultValue
                    , this
                    , nextNode
                    , ConnectionType.FeedForward);
                con.OnEnable();
                this.outputConnections.Add(con);
                nextNode.inputConnections.Add(con);
            }
        }
        else
        {
            List <ANNHiddenNode> nextLayer = network.GetHiddenNodesFromLayerOrder(nextLayerOrder);
            foreach (ANNHiddenNode nextNode in nextLayer)
            {
                ANNConnection con = new ANNConnection(
                    randomWeights ? Random.Range(ANNProperties.RandomWeightsRange.x, ANNProperties.RandomWeightsRange.y) : ANNProperties.NonRandomWeightDefaultValue
                    , this
                    , nextNode
                    , ConnectionType.FeedForward);
                con.OnEnable();
                this.outputConnections.Add(con);
                nextNode.inputConnections.Add(con);
            }
        }
    }
Beispiel #5
0
 public ANNGraphicConnection(ANNConnection c, ANNGraphicNode inp, ANNGraphicNode outp)
 {
     con = c;  inGNode = inp; outGNode = outp;
 }