2018-01-23 02:39:23 +00:00
|
|
|
//
|
|
|
|
// ConfidenceCounter.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 21/01/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-01-23 02:39:23 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ConfidenceCounter_hpp
|
|
|
|
#define ConfidenceCounter_hpp
|
|
|
|
|
|
|
|
#include "ConfidenceSource.hpp"
|
|
|
|
|
2018-01-29 03:22:21 +00:00
|
|
|
namespace Analyser {
|
|
|
|
namespace Dynamic {
|
2018-01-23 02:39:23 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides a confidence source that calculates its probability by virtual of a history of events.
|
|
|
|
|
|
|
|
The initial value of the confidence counter is 0.5.
|
|
|
|
*/
|
|
|
|
class ConfidenceCounter: public ConfidenceSource {
|
|
|
|
public:
|
|
|
|
/*! @returns The computed probability, based on the history of events. */
|
2020-01-24 03:57:51 +00:00
|
|
|
float get_confidence() final;
|
2018-01-23 02:39:23 +00:00
|
|
|
|
2018-05-13 19:34:31 +00:00
|
|
|
/*! Records an event that implies this is the appropriate class: pushes probability up towards 1.0. */
|
2018-01-23 02:39:23 +00:00
|
|
|
void add_hit();
|
|
|
|
|
2018-05-13 19:34:31 +00:00
|
|
|
/*! Records an event that implies this is not the appropriate class: pushes probability down towards 0.0. */
|
2018-01-23 02:39:23 +00:00
|
|
|
void add_miss();
|
|
|
|
|
|
|
|
/*!
|
2018-02-12 01:32:21 +00:00
|
|
|
Records an event that could be correct but isn't necessarily so; which can push probability
|
|
|
|
down towards 0.5, but will never push it upwards.
|
2018-01-23 02:39:23 +00:00
|
|
|
*/
|
|
|
|
void add_equivocal();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int hits_ = 1;
|
|
|
|
int misses_ = 1;
|
|
|
|
};
|
|
|
|
|
2018-01-29 03:22:21 +00:00
|
|
|
}
|
2018-01-23 02:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ConfidenceCounter_hpp */
|