Sha256: b759a6f3469049a2801b684ec11562babf1e06541d5dc1a6a65798bc74b89d8b

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

#ifndef AUC_INFO_H
# define AUC_INFO_H

#include <string>
#include <sstream>
#include <iostream>

typedef unsigned int  uint;


using std::ostringstream;
using std::string;
using std::ostream;

const string AUC_COLUMNS = "(experiment_id, column, auc, true_positives, false_positives, true_negatives, false_negatives)";

class auc_info {
public:
    double auc;
    uint tp;
    uint fp;
    uint tn;
    uint fn;

    // Constructor
    auc_info(double area_under_curve = 0, uint true_positives = 0, uint false_positives = 0, uint true_negatives = 0, uint false_negatives = 0)
    : auc(area_under_curve), tp(true_positives), fp(false_positives), tn(true_negatives), fn(false_negatives) { }

    ~auc_info() { }

    // Convert to a portion of a SQL insertion (string)
    string to_s() const {
        ostringstream s;
        s << auc << ", " << tp << ", " << fp << ", " << tn << ", " << fn;
        return s.str();
    }

    string entry(uint experiment_id, uint j) const {
        ostringstream s;
        s << '(' << experiment_id << ", " << j << ", " << to_s() << ')';
        return s.str();
    }
};

// Probably not necessary.
std::ostream& operator<<(std::ostream& out, const auc_info& rhs) {
    out << rhs.to_s();
    return out;
}

#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocker-0.0.5 ext/rocker/auc_info.h
rocker-0.0.4 ext/rocker/auc_info.h