-
-
Notifications
You must be signed in to change notification settings - Fork 408
r.kappa: Switch to JSON output using Parson library #6977
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?
r.kappa: Switch to JSON output using Parson library #6977
Conversation
|
What would it look like without |
Sorry, I misread your comment last time. I haven’t tested without it yet. Will try tomorrow |
|
I now see we have no wrapper function Could you please try out what the output would be by calling |
|
Sure, will do that. |
|
@nilason This is what it looks like with {"reference":"landclass96","classification":"landuse96_28m","observations":249323,"correct":34931,"overall_accuracy":14.010340000721955,"kappa":0.094647985487459979,"kappa_variance":1.2427421149984878e-06,"cats":[1,2,3,4,5,6,7,8,9,10,11,15,18,20,21],"matrix":[[34931,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[38146,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,2137,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,25488,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,30,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,16464,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,320,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,45,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,7893,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,19733,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,64774,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,33865,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,5303,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,194,0,0,0,0,0,0,0,0]],"row_sum":[34931,38146,2137,25488,0,30,16464,320,45,7893,19733,64774,33865,5303,194],"col_sum":[73077,2137,25518,16829,126265,5303,194,0,0,0,0,0,0,0,0],"producers_accuracy":[47.800265473404771,0,0,0,0,0,0,null,null,null,null,null,null,null,null],"users_accuracy":[100,0,0,0,null,0,0,0,0,0,0,0,0,0,0],"conditional_kappa":[1,-0.0086453116276811789,-0.114018900382029,-0.072384663690245751,null,-0.021731825260224571,-0.00077871303621818416,0,0,0,0,0,0,0,0],"mcc":0.12180041392181627} |
I would prefer this to adding complicated formatting code. What do you say @petrasovaa ?
Please, do. Sooner or later we will likely need it anyway, regardless of the outcome here. |
|
@petrasovaa Can you review this one as well. |
This PR addresses #6968
I have tried to rewrite these files with Parson support. In the
print_json.cfile, I have added one extra function because I wanted the matrix to be printed like it was before:"matrix": [ [34931,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [38146,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,2137,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,25488,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,30,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,16464,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,320,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,45,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,7893,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,19733,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,64774,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,33865,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,5303,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,194,0,0,0,0,0,0,0,0] ],Because due to
G_json_serialize_to_string_pretty, the matrix will look like this, which doesn’t feel right for a 2D matrix output to me, that’s why I have added it. If this is wrong, please do let me know."matrix": [ [ 34931, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 38146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],Other than that, it looks good to me. I have tested it. If there is a better way to implement this, then do let me know.