mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 08:31:11 +00:00
f2519f4fd7
Besides anything else, it individualises the measure. E.g. two targets can each have a confidence of 0.8 without each giving the wrong answer about probability.
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
//
|
|
// ConfidenceCounter.hpp
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 21/01/2018.
|
|
// Copyright © 2018 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
#ifndef ConfidenceCounter_hpp
|
|
#define ConfidenceCounter_hpp
|
|
|
|
#include "ConfidenceSource.hpp"
|
|
|
|
namespace DynamicAnalyser {
|
|
|
|
/*!
|
|
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. */
|
|
float get_confidence() override;
|
|
|
|
/*! Records an event that implies this is the appropriate class — pushes probability up towards 1.0. */
|
|
void add_hit();
|
|
|
|
/*! Records an event that implies this is not the appropriate class — pushes probability down towards 0.0. */
|
|
void add_miss();
|
|
|
|
/*!
|
|
Records an event that provides no strong evidence either way — one that
|
|
could be a hit but could be a miss — pushes probability up or down towards 0.5.
|
|
*/
|
|
void add_equivocal();
|
|
|
|
private:
|
|
int hits_ = 1;
|
|
int misses_ = 1;
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* ConfidenceCounter_hpp */
|