Пример #1
0
    public NNet InitialiseCopy(int hiddenLayerCount, int hiddenNeuronCount)
    {
        NNet n = 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);

        n.weights = newWeights;
        n.biases  = newBiases;

        n.InitialiseHidden(hiddenLayerCount, hiddenNeuronCount);

        return(n);
    }