Request for Changes-88: Contingency Table

From OTBWiki
Revision as of 16:45, 24 April 2017 by Ludovic (Talk | contribs) (Status)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

[Request for Changes - 88] Contingency Table


  • Author: Ludovic Hussonnois
  • Submitted on 13.03.2017
  • Proposed target release 6.0
  • Contingency Table
  • Status: merged


Add a contingency table calculator for unsupervised classification.


Since unsupervised classifier are introduce, contingency table provide an alternative to confusion matrix which give some information about classification results with a validation dataset.

Implementation details

Classes and files

Add a new contingency table calculator which simply count class occurrences for two samples set. Compute() function take iterators and can compute contingency table for image or listSample iterators.

A       Modules/Learning/Unsupervised/include/otbContingencyTable.h
A       Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.h
A       Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.txx


otbTrainVectorClassification and ComputeConfusionMatrix applications are updated.


  • It has been extended to provide the contingency table if the selected classifier is unsupervised.
  • io.confmatout now output csv contingency table if classifier is unsupervised.


  • The output (contingency table or confusion matrix) can be selected with an option (-format confusionmatrix / contingencytable).
  • The confusion matrix is the default output and acts as before without changes. Otherwise the contingency table is output.

The difference is that for the same inputs, output can differs since label named is ignored (no matching of identical labels) for the contingency table.

M       Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx
M       Modules/Applications/AppClassification/app/otbTrainVectorClassification.cxx


Added new tests for contingency table calculator.

M       Modules/Applications/AppClassification/test/CMakeLists.txt
M       Modules/Learning/Unsupervised/test/CMakeLists.txt
A       Modules/Learning/Unsupervised/test/otbContingencyTableCalculatorTest.cxx
M       Modules/Learning/Unsupervised/test/otbUnsupervisedTestDriver.cxx