Add json constructor to Scores

This commit is contained in:
2024-05-10 11:35:07 +02:00
parent 009ed037b8
commit dd94fd51f7
4 changed files with 75 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ namespace platform {
class Scores {
public:
Scores(torch::Tensor& y_test, torch::Tensor& y_pred, int num_classes, std::vector<std::string> labels = {});
explicit Scores(json& confusion_matrix_);
float accuracy();
float f1_score(int num_class);
float f1_weighted();
@@ -20,6 +21,8 @@ namespace platform {
json get_confusion_matrix_json(bool labels_as_keys = false);
private:
std::string classification_report_line(std::string label, float precision, float recall, float f1_score, int support);
void init_confusion_matrix();
void init_default_labels();
int num_classes;
float accuracy_value;
int total;