-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
i.gensig: Add support of original class value in sig file (for i.maxlik) #2425
Conversation
I pulled these changes and tested by digitizing a vector map with 2 classes (43 and 65, just because), converted to raster using the class number, ran i.gensig and then i.maxlik. While i.gensig uses the right number for classes, i.maxlik still renames them to 1 and 2. |
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.
Although this has a test for C functions which is great, there is no higher level test for i.gensig and i.maxlik or related modules. i.maxlik has a partial example in the manual page which requires an example from i.cluster. I would be more confident if we have at least some smoke test to see that the workflows really run. Sorry, I was not following this closely, but having a test for a workflow which didn't work before and now works and also for a workflow which worked and continues to work would be great showing both what was improved and also that nothing was damaged.
I added two tests for i.maxlik and one for i.gensig. All three tests just test successful case, there are no tests for various modes of failure. @veroandreo could you give this PR another shot? |
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.
The new things look good.
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.
This is good to go as far as the changed code and new tests go. I'm still little uneasy about the i.cluster -> i.maxlik workflow which is not tested anywhere.
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.
Just tested again. It works as expected, class numbers are now preserved in the result of i.maxlik
You mean i.cluster -> sig file. Writing and reading sig file is tested in lib tests and sig file -> i.maxlik is tested in i.maxlik tests. |
* Imagery: use original raster values for classification output in workflow i.gensig -> i.maxlik (fixes bug OSGeo#2413)
* Imagery: use original raster values for classification output in workflow i.gensig -> i.maxlik (fixes bug OSGeo#2413)
* Imagery: use original raster values for classification output in workflow i.gensig -> i.maxlik (fixes bug OSGeo#2413)
Signature files (generated by i.gensig) contain class labels but do not contain original values from map used to generate signatures. Thus map with predicted values by i.maxlik will contain different values for same classes in comparison to training map.
This PR adds an optional ability to store original class values and apply them on to classified map to restore a complete match between training and predicted class values.
Signature files written after merging this PR are incompatible with older GRASS versions (8.0, 8.2), but older signature files (8.0, 8.2) still can be read.