Skip to content

reputation/reputation_scoring.hpp

Reputation update formulas (PTDS §7.2) More...

Namespaces

Name
sgns
sgns::neoswarm
sgns::neoswarm::reputation

Classes

Name
class sgns::neoswarm::reputation::ReputationScoring
Implements the PTDS §7.2 reputation update formulas.
struct sgns::neoswarm::reputation::ReputationScoring::Config

Detailed Description

Reputation update formulas (PTDS §7.2)

Date: 2026-05-06

Source code

#ifndef NEOSWARM_REPUTATION_REPUTATIONSCORING_HPP
#define NEOSWARM_REPUTATION_REPUTATIONSCORING_HPP

#include "node_reputation.hpp"
#include "common/types.hpp"
#include <optional>

namespace sgns::neoswarm::reputation
{
    class ReputationScoring
    {
        public:
        struct Config
        {
            double alpha_ = 0.10;   
            double beta_ = 0.05;    
            double gamma_ = 0.02;   
            double delta_ = 0.03;   
            double epsilon_ = 1e-6; 
            double baseline_accuracy_ = 0.5;
        };

        ReputationScoring();
        explicit ReputationScoring( Config cfg );

        NodeReputation Update( const NodeReputation& old,
                               const InferenceResponse& response,
                               double median_latency_ms,
                               std::optional<std::string> ground_truth,
                               const std::string& m_consensusoutput ) const;

        double DeltaAccuracy( bool has_ground_truth, double accuracy ) const;

        double DeltaLatency( double latency_ms, double median_latency_ms ) const;

        double DeltaConsistency( float perplexity ) const;

        private:
        Config m_cfg;
    };

} // namespace sgns::neoswarm::reputation

#endif // NEOSWARM_REPUTATION_REPUTATIONSCORING_HPP

Updated on 2026-07-25 at 22:56:57 +0000