-
-
Notifications
You must be signed in to change notification settings - Fork 407
r.kappa: Switch to JSON output using Parson library #6978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
petrasovaa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have unrelated changes in your PR.
3761b9e to
5f804ab
Compare
15f2c82 to
98e43f8
Compare
|
|
||
| json_object_set_string(root_object, "reference", maps[0]); | ||
| json_object_set_string(root_object, "classification", maps[1]); | ||
| json_object_set_number(root_object, "observations", (double)metrics->observations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
| json_object_set_number(root_object, "observations", (double)metrics->observations); | |
| json_object_set_number(root_object, "observations", | |
| (double)metrics->observations); |
| json_object_set_string(root_object, "classification", maps[1]); | ||
| json_object_set_number(root_object, "observations", (double)metrics->observations); | ||
| json_object_set_number(root_object, "correct", (double)metrics->correct); | ||
| json_object_set_number(root_object, "overall_accuracy", metrics->overall_accuracy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
| json_object_set_number(root_object, "overall_accuracy", metrics->overall_accuracy); | |
| json_object_set_number(root_object, "overall_accuracy", | |
| metrics->overall_accuracy); |
| else | ||
| fprintf(fd, "],\n ["); | ||
| bool cfirst = 1; | ||
| json_object_set_number(root_object, "kappa_variance", metrics->kappa_variance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
| json_object_set_number(root_object, "kappa_variance", metrics->kappa_variance); | |
| json_object_set_number(root_object, "kappa_variance", | |
| metrics->kappa_variance); |
| JSON_Value *row_value = json_value_init_array(); | ||
| JSON_Array *row_array = json_value_get_array(row_value); | ||
| for (int j = 0; j < ncat; j++) | ||
| json_array_append_number(row_array, (double)metrics->matrix[ncat * i + j]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
| json_array_append_number(row_array, (double)metrics->matrix[ncat * i + j]); | |
| json_array_append_number(row_array, | |
| (double)metrics->matrix[ncat * i + j]); |
Summary
This PR refactors the JSON output generation in
r.kappato use theParson JSON library instead of manual
fprintf()calls.Details
nullhandling forna_valueunchangedRelated issue
Fixes #6968