예제 #1
0
 public virtual void Duplicate(Layer cloneLayer)
 {
     cloneLayer.LayerStroageMatrix = LayerStroageMatrix.Clone();
     cloneLayer.LayerActivationMatrix = LayerActivationMatrix.Clone();
     cloneLayer.LayerErrorMatrix = LayerErrorMatrix.Clone();
     cloneLayer.BiasMatrix = BiasMatrix.Clone();
     cloneLayer.InterConnectionMatrix = InterConnectionMatrix.Clone();
 }
예제 #2
0
        public override void Initialize(LayerState layerState, double damagedSD, int rowCount)
        {
            base.Initialize(layerState, damagedSD, rowCount);
            CurrentTick = 0;
            HideLayerList = new List<Layer>();
            for (int layerIndex = 0; layerIndex <= Tick; layerIndex++)
            {
                Layer newLayer = new Layer(random, Name + "-Hide" + layerIndex, UnitCount, 0, 0);
                newLayer.BiasMatrix = (Matrix<double>)BaseHideBiasMatrix.Clone();
                newLayer.Initialize(layerState, damagedSD, rowCount);
                HideLayerList.Add(newLayer);

            }
            HideConnectionList = new List<Connection>();
            for (int connectionIndex = 0; connectionIndex < Tick; connectionIndex++)
            {
                Connection newConnection = new Connection(random, Name + "-Hide" + connectionIndex, HideLayerList[connectionIndex], HideLayerList[connectionIndex + 1], 0);
                newConnection.WeightMatrix = (Matrix<double>)BaseHideWeightMatrix.Clone();
                newConnection.Initialize(ConnectionState.On, 0);
                HideConnectionList.Add(newConnection);
            }
        }
예제 #3
0
        public Connection(Random random, string name, Layer sendLayer, Layer receiveLayer, double initialWeightRange)
        {
            this.random = random;

            this.Name = name;
            this.SendLayer = sendLayer;
            this.ReceiveLayer = receiveLayer;

            sendLayer.SendConnectionDictionary[name] = this;
            receiveLayer.ReceiveConnectionDictionary[name] = this;

            weightMatrix = DenseMatrix.Create(sendLayer.UnitCount, receiveLayer.UnitCount,0);

            InitialWeightSetting(initialWeightRange);
        }
예제 #4
0
        public override void Duplicate(Layer cloneLayer)
        {
            if (cloneLayer.LayerType != LayerType.BPTTLayer) throw new Exception();
            else if (((BPTTLayer)cloneLayer).Tick != Tick) throw new Exception();
            else
            {
                base.Duplicate(cloneLayer);

                for (int hideLayerIndex = 0; hideLayerIndex < HideLayerList.Count; hideLayerIndex++)
                {
                    ((BPTTLayer)cloneLayer).HideLayerList[hideLayerIndex].LayerStroageMatrix = HideLayerList[hideLayerIndex].LayerStroageMatrix.Clone();
                    ((BPTTLayer)cloneLayer).HideLayerList[hideLayerIndex].LayerActivationMatrix = HideLayerList[hideLayerIndex].LayerActivationMatrix.Clone();
                    ((BPTTLayer)cloneLayer).HideLayerList[hideLayerIndex].LayerErrorMatrix = HideLayerList[hideLayerIndex].LayerErrorMatrix.Clone();
                    ((BPTTLayer)cloneLayer).HideLayerList[hideLayerIndex].BiasMatrix = HideLayerList[hideLayerIndex].BiasMatrix.Clone();
                    ((BPTTLayer)cloneLayer).HideLayerList[hideLayerIndex].InterConnectionMatrix = HideLayerList[hideLayerIndex].InterConnectionMatrix.Clone();
                }
                for (int hideConnectionIndex = 0; hideConnectionIndex < HideConnectionList.Count; hideConnectionIndex++)
                {
                    ((BPTTLayer)cloneLayer).HideConnectionList[hideConnectionIndex].WeightMatrix = HideConnectionList[hideConnectionIndex].WeightMatrix;
                }
                ((BPTTLayer)cloneLayer).BaseHideWeightMatrix = BaseHideWeightMatrix.Clone();
                ((BPTTLayer)cloneLayer).BaseHideBiasMatrix = BaseHideBiasMatrix.Clone();
            }
        }