<commit_before>/*
 * tdagent.h
 *
 *  Created on: Sep 18, 2010
 *      Author: baj
 */

#ifndef TDAGENT_H_
#define TDAGENT_H_

#include <string>

#include "epsilon-agent.h"
#include "table.h"

/**
 * temporal difference based method
 */
class TemporalDifferenceAgent: public EpsilonAgent {
public:
	static const double alpha = 0.15; //learning rate - which is somehow good according to empirical resutls
	static const double gamma = 1.0 - 1.0e-6; //constant step parameter

public:
	TemporalDifferenceAgent(const std::string name, const bool test): EpsilonAgent(test), name_(name) {
		qtable_.load(name_ + ".txt");
	}

	virtual ~TemporalDifferenceAgent() {
		if (!test()) {
			qtable_.save(name_ + ".txt");
		}
	}

	double & qvalue(const State &, const int &);

private:<commit_msg>change gamma to 1.0 - 1.0e-4<commit_after>/*
 * tdagent.h
 *
 *  Created on: Sep 18, 2010
 *      Author: baj
 */

#ifndef TDAGENT_H_
#define TDAGENT_H_

#include <string>

#include "epsilon-agent.h"
#include "table.h"

/**
 * temporal difference based method
 */
class TemporalDifferenceAgent: public EpsilonAgent {
public:
	static const double alpha = 0.15; //learning rate - which is somehow good according to empirical resutls
	static const double gamma = 1.0 - 1.0e-4; //constant step parameter

public:
	TemporalDifferenceAgent(const std::string name, const bool test): EpsilonAgent(test), name_(name) {
		qtable_.load(name_ + ".txt");
	}

	virtual ~TemporalDifferenceAgent() {
		if (!test()) {
			qtable_.save(name_ + ".txt");
		}
	}

	double & qvalue(const State &, const int &);

private:
{'fraction_non_alphanumeric': 0.1317289423685877, 'fraction_numerical': 0.02089930335655478, 'mean_word_length': 3.876543209876543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6366883', 'n_tokens_mistral': 580, 'n_tokens_neox': 532, 'n_words': 153}