Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implementovane metody update, reset

  • Loading branch information...
commit dbf3d1e339d2eafd1dae4e9c9a64dcb3b196950b 1 parent da08127
@mhozza authored
Showing with 17 additions and 3 deletions.
  1. +13 −2 NeuralNet/recurrentnetwork.cpp
  2. +4 −1 NeuralNet/recurrentnetwork.h
View
15 NeuralNet/recurrentnetwork.cpp
@@ -19,12 +19,13 @@
using namespace NeuralNET;
-RecurrentNetwork::RecurrentNetwork(unsigned layerCount, unsigned sizes[], unsigned dimension, float alpha)
+RecurrentNetwork::RecurrentNetwork(unsigned layerCount, unsigned sizes[], unsigned dimension, float alpha, unsigned recurrentLayerIndex)
+ :recurrentLayerIndex(recurrentLayerIndex)
{
layers.resize(layerCount);
for(unsigned i = 0; i< layers.size();i++)
{
- if(i==0)
+ if(i==recurrentLayerIndex)
{
layers[i] = new RecurrentLayer(sizes[i], sizes[i-1], alpha);
}
@@ -34,3 +35,13 @@ RecurrentNetwork::RecurrentNetwork(unsigned layerCount, unsigned sizes[], unsign
}
}
}
+
+void RecurrentNetwork::update()
+{
+ ((RecurrentNetwork*) layers[recurrentLayerIndex])->update();
+}
+
+void RecurrentNetwork::reset()
+{
+ ((RecurrentNetwork*) layers[recurrentLayerIndex])->reset();
+}
View
5 NeuralNet/recurrentnetwork.h
@@ -25,8 +25,11 @@ namespace NeuralNET {
class RecurrentNetwork : public NeuralNetwork
{
+ unsigned recurrentLayerIndex;
public:
- RecurrentNetwork(unsigned layerCount, unsigned sizes[], unsigned dimension, float alpha);
+ RecurrentNetwork(unsigned layerCount, unsigned sizes[], unsigned dimension, float alpha = 0.25, unsigned recurrentLayer = 0);
+ void update();
+ void reset();
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.