Skip to content
Snippets Groups Projects
Commit 2a7c3dc6 authored by Franck Dary's avatar Franck Dary
Browse files

Fixed action hash

parent 9812754a
No related branches found
No related tags found
No related merge requests found
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
namespace std namespace std
{ {
template<> template<>
struct hash< std::pair<std::string, Action> > struct hash< pair<string, Action> >
{ {
size_t operator()(const std::pair<std::string, Action> &p) const size_t operator()(const pair<std::string, Action> & p) const
{ {
return 0; static hash<string> h;
return h(p.first + p.second.name);
} }
}; };
} }
...@@ -43,6 +44,7 @@ class LimitedStack ...@@ -43,6 +44,7 @@ class LimitedStack
{ {
nbElements = 0; nbElements = 0;
lastElementIndex = -1; lastElementIndex = -1;
present.clear();
} }
void push(T elem) void push(T elem)
......
...@@ -381,7 +381,6 @@ void Trainer::doStepTrain() ...@@ -381,7 +381,6 @@ void Trainer::doStepTrain()
} }
std::string normalClassifierName(buffer); std::string normalClassifierName(buffer);
auto & errorHistory = trainConfig.getActionsHistory(tm.getCurrentClassifier()->name);
auto & normalHistory = trainConfig.getActionsHistory(normalClassifierName); auto & normalHistory = trainConfig.getActionsHistory(normalClassifierName);
// If a BACK just happened // If a BACK just happened
......
...@@ -134,7 +134,7 @@ class Config ...@@ -134,7 +134,7 @@ class Config
private : private :
const unsigned int HISTORY_SIZE = 100000000; const unsigned int HISTORY_SIZE = 100000;
/// @brief The name of the current state of the TransitionMachine. /// @brief The name of the current state of the TransitionMachine.
std::string currentStateName; std::string currentStateName;
/// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config. /// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config.
......
...@@ -437,7 +437,7 @@ void Config::addToEntropyHistory(float entropy) ...@@ -437,7 +437,7 @@ void Config::addToEntropyHistory(float entropy)
std::size_t Config::computeHash() std::size_t Config::computeHash()
{ {
static int window = 3; static int window = 10;
int start = std::max(0, head-window); int start = std::max(0, head-window);
int end = std::min(tapes[0].refSize()-1, head+window); int end = std::min(tapes[0].refSize()-1, head+window);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment