Confusion matrix class.
More...
#include <CMat.h>
|
| CCMat (byte nStates) |
| Constructor. More...
|
|
virtual | ~CCMat (void) |
|
void | reset (void) |
| Resets class variables. More...
|
|
void | save (const std::string &path, const std::string &name=std::string(), short idx=-1) const |
| Saves the confusion matrix. More...
|
|
void | load (const std::string &path, const std::string &name=std::string(), short idx=-1) |
| Loads the confusion matrix. More...
|
|
void | estimate (const Mat >, const Mat &solution, const Mat &mask=Mat()) |
| Estimates the confusion matrix. More...
|
|
void | estimate (byte gt, byte solution) |
| Estimates the confusion matrix. More...
|
|
Mat | getConfusionMatrix (void) const |
| Returns the confusion matrix. More...
|
|
float | getAccuracy (void) const |
| Returns the overall classification accuracy. More...
|
|
Confusion matrix class.
This class estimates the confusion matrix, which
allows for evaluation of the classification results in terms of the overall classification accuracy, as well as of precision and recall.
- Author
- Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de
Definition at line 20 of file CMat.h.
◆ CCMat()
DirectGraphicalModels::CCMat::CCMat |
( |
byte |
nStates | ) |
|
Constructor.
- Parameters
-
nStates | Number of states (classes) |
Definition at line 8 of file CMat.cpp.
◆ ~CCMat()
DirectGraphicalModels::CCMat::~CCMat |
( |
void |
| ) |
|
|
virtual |
◆ estimate() [1/2]
void DirectGraphicalModels::CCMat::estimate |
( |
const Mat & |
gt, |
|
|
const Mat & |
solution, |
|
|
const Mat & |
mask = Mat() |
|
) |
| |
Estimates the confusion matrix.
- Parameters
-
gt | Matrix, each element of which is a ground-truth state (class) |
solution | Matrix with the predicted states, provided by classifier |
mask | Operation mask. Its non-zero elements indicate which matrix elements need to be stimated. Mask should have the same size as gt and solution and be of type CV_8UC1 . |
Definition at line 34 of file CMat.cpp.
◆ estimate() [2/2]
void DirectGraphicalModels::CCMat::estimate |
( |
byte |
gt, |
|
|
byte |
solution |
|
) |
| |
Estimates the confusion matrix.
- Parameters
-
gt | The ground-truth state (class) |
solution | The predicted state, provided by classifier |
Definition at line 40 of file CMat.cpp.
◆ getAccuracy()
float DirectGraphicalModels::CCMat::getAccuracy |
( |
void |
| ) |
const |
Returns the overall classification accuracy.
- Returns
- The classification accuracy: percent of the correctly classified samples.
Definition at line 50 of file CMat.cpp.
◆ getConfusionMatrix()
Mat DirectGraphicalModels::CCMat::getConfusionMatrix |
( |
void |
| ) |
const |
Returns the confusion matrix.
The resulting confusion matrix may be visualized with help of CMarker::drawConfusionMatrix() function
- Returns
- Confusion matrix, where each value is given in percents. Mat(size: nStates x nStates; type: CV_32FC1)
Definition at line 45 of file CMat.cpp.
◆ load()
void DirectGraphicalModels::CCMat::load |
( |
const std::string & |
path, |
|
|
const std::string & |
name = std::string() , |
|
|
short |
idx = -1 |
|
) |
| |
Loads the confusion matrix.
Allows to re-use the class. Loads data to the file: "<path><name>_<idx>.dat".
- Parameters
-
path | Path to the folder, containing the data file. |
name | Name of data file. If empty, will be generated automatically from the class name. |
idx | Index of the data file. Negative value means no index. |
Definition at line 29 of file CMat.cpp.
◆ reset()
void DirectGraphicalModels::CCMat::reset |
( |
void |
| ) |
|
Resets class variables.
Allows to re-use the class.
Definition at line 19 of file CMat.cpp.
◆ save()
void DirectGraphicalModels::CCMat::save |
( |
const std::string & |
path, |
|
|
const std::string & |
name = std::string() , |
|
|
short |
idx = -1 |
|
) |
| const |
Saves the confusion matrix.
Allows to re-use the class. Stores data to the file: "<path><name>_<idx>.dat".
- Parameters
-
path | Path to the destination folder. |
name | Name of data file. If empty, will be generated automatically from the class name. |
idx | Index of the destination file. Negative value means no index. |
Definition at line 24 of file CMat.cpp.
◆ m_pConfusionMatrix
CPriorEdge* DirectGraphicalModels::CCMat::m_pConfusionMatrix |
|
private |
COnfusion matrix container.
Definition at line 84 of file CMat.h.
The documentation for this class was generated from the following files:
- D:/Projects/DGM/modules/DGM/CMat.h
- D:/Projects/DGM/modules/DGM/CMat.cpp