示例#1
0
    public NNet InitializeCopy(int hiddenLayerCount, int hiddenNeuronCount)
    {
        NNet net = new NNet();

        List <Matrix <float> > newWeights = new List <Matrix <float> >();

        for (int i = 0; i < this.weights.Count; i++)
        {
            Matrix <float> currentWeight = Matrix <float> .Build.Dense(weights[i].RowCount, weights[i].ColumnCount);

            for (int x = 0; x < currentWeight.RowCount; x++)
            {
                for (int y = 0; y < currentWeight.ColumnCount; y++)
                {
                    currentWeight[x, y] = weights[i][x, y];
                }
            }

            newWeights.Add(currentWeight);
        }

        List <float> newBiases = new List <float>();

        newBiases.AddRange(biases);

        net.weights = newWeights;
        net.biases  = newBiases;

        net.InitializeHidden(hiddenLayerCount, hiddenNeuronCount);

        return(net);
    }