1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-04-05 04:37:41 +00:00

Decided to focus on 'confidence' over 'probability'.

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.
This commit is contained in:
Thomas Harte 2018-01-25 19:02:16 -05:00
parent db914d8c56
commit f2519f4fd7
13 changed files with 14 additions and 14 deletions

View File

@ -10,7 +10,7 @@
using namespace DynamicAnalyser;
float ConfidenceCounter::get_probability() {
float ConfidenceCounter::get_confidence() {
return static_cast<float>(hits_) / static_cast<float>(hits_ + misses_);
}

View File

@ -21,7 +21,7 @@ namespace DynamicAnalyser {
class ConfidenceCounter: public ConfidenceSource {
public:
/*! @returns The computed probability, based on the history of events. */
float get_probability() override;
float get_confidence() override;
/*! Records an event that implies this is the appropriate class — pushes probability up towards 1.0. */
void add_hit();

View File

@ -18,7 +18,7 @@ namespace DynamicAnalyser {
program is handed to an Atari 2600 then its confidence should grow towards 1.0.
*/
struct ConfidenceSource {
virtual float get_probability() = 0;
virtual float get_confidence() = 0;
};
}

View File

@ -19,10 +19,10 @@ ConfidenceSummary::ConfidenceSummary(const std::vector<ConfidenceSource *> &sour
weight_sum_ = std::accumulate(weights.begin(), weights.end(), 0.0f);
}
float ConfidenceSummary::get_probability() {
float ConfidenceSummary::get_confidence() {
float result = 0.0f;
for(std::size_t index = 0; index < sources_.size(); ++index) {
result += sources_[index]->get_probability() * weights_[index];
result += sources_[index]->get_confidence() * weights_[index];
}
return result / weight_sum_;
}

View File

@ -31,7 +31,7 @@ class ConfidenceSummary: public ConfidenceSource {
const std::vector<float> &weights);
/*! @returns The weighted sum of all sources. */
float get_probability() override;
float get_confidence() override;
private:
std::vector<ConfidenceSource *> sources_;

View File

@ -59,7 +59,7 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
void Analyser::Static::Acorn::AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination) {
std::unique_ptr<Target> target(new Target);
target->machine = Machine::Electron;
target->probability = 1.0; // TODO: a proper estimation
target->confidence = 1.0; // TODO: a proper estimation
target->acorn.has_dfs = false;
target->acorn.has_adfs = false;
target->acorn.should_shift_restart = false;

View File

@ -180,7 +180,7 @@ static bool CheckBootSector(const std::shared_ptr<Storage::Disk::Disk> &disk, co
void Analyser::Static::AmstradCPC::AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination) {
std::unique_ptr<Target> target(new Target);
target->machine = Machine::AmstradCPC;
target->probability = 1.0;
target->confidence = 1.0;
target->media.disks = media.disks;
target->media.tapes = media.tapes;
target->media.cartridges = media.cartridges;

View File

@ -182,7 +182,7 @@ void Analyser::Static::Atari::AddTargets(const Media &media, std::vector<std::un
// TODO: sanity checking; is this image really for an Atari 2600.
std::unique_ptr<Target> target(new Target);
target->machine = Machine::Atari2600;
target->probability = 1.0;
target->confidence = 1.0;
target->media.cartridges = media.cartridges;
target->atari.paging_model = Atari2600PagingModel::None;
target->atari.uses_superchip = false;

View File

@ -41,7 +41,7 @@ static std::vector<std::shared_ptr<Storage::Cartridge::Cartridge>>
void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination) {
std::unique_ptr<Target> target(new Target);
target->machine = Machine::Vic20; // TODO: machine estimation
target->probability = 1.0; // TODO: a proper estimation
target->confidence = 1.0; // TODO: a proper estimation
int device = 0;
std::vector<File> files;

View File

@ -225,7 +225,7 @@ void Analyser::Static::MSX::AddTargets(const Media &media, std::vector<std::uniq
if(!target->media.empty()) {
target->machine = Machine::MSX;
target->probability = 1.0;
target->confidence = 1.0;
destination.push_back(std::move(target));
}
}

View File

@ -76,7 +76,7 @@ static int Basic11Score(const Analyser::Static::MOS6502::Disassembly &disassembl
void Analyser::Static::Oric::AddTargets(const Media &media, std::vector<std::unique_ptr<Target>> &destination) {
std::unique_ptr<Target> target(new Target);
target->machine = Machine::Oric;
target->probability = 1.0;
target->confidence = 1.0;
int basic10_votes = 0;
int basic11_votes = 0;

View File

@ -84,7 +84,7 @@ struct Target {
Machine machine;
Media media;
float probability;
float confidence;
std::string loading_command;
// TODO: this is too C-like a solution; make Target a base class and

View File

@ -66,7 +66,7 @@ class ROMSlotHandler {
/*! @returns The probability that this handler is correct for the data it owns. */
float get_confidence() {
return confidence_counter_.get_probability();
return confidence_counter_.get_confidence();
}
protected: