|
latest version v1.9 - last update 24 Nov 2005 |
|
#include <ltiClassifier2DVisualizer.h>
Inheritance diagram for lti::classifier2DVisualizer:


Public Member Functions | |
| classifier2DVisualizer () | |
| classifier2DVisualizer (const classifier2DVisualizer &other) | |
| virtual | ~classifier2DVisualizer () |
| virtual const char * | getTypeName () const |
| bool | apply (const supervisedInstanceClassifier &cls, image &result) const |
| bool | apply (const supervisedInstanceClassifier &cls, const lti::dmatrix &highlights, image &result) const |
| bool | apply (const supervisedInstanceClassifier &cls, const lti::dmatrix &highlights, image &result, const ivector &labels) const |
| bool | apply (const supervisedInstanceClassifier &cls, const lti::dmatrix &highlights, image &result, const ivector &labels, const genericVector< bool > &htype) const |
| classifier2DVisualizer & | copy (const classifier2DVisualizer &other) |
| classifier2DVisualizer & | operator= (const classifier2DVisualizer &other) |
| virtual functor * | clone () const |
| const parameters & | getParameters () const |
Classes | |
| class | parameters |
| the parameters for the class classifier2DVisualizer More... | |
They additionally have the property that they show the classification properties of a supervisedInstanceClassifier for a 2D feature space. Its application is rather simple: You have to create a classifier for a 2D space, then you give it to one of the apply methods, together with the target image.
Example:
// number of training samples const int N=150; // number of classes const int K=3; const int width=400; const int height=200; // fill data and label matrix lti::dmatrix data(N,2); lti::ivector labels(N); int j=0; std::cerr << "Generating data..."; for (int k=0; k<K; k++) { // generate gaussian double sigma=double(k)/(K)*20.0+10; double mx=double(k)/K*(width-sigma)+sigma; double my=double(k)/K*(height-sigma)+sigma; lti::gaussianDistribution px(mx,sigma); lti::gaussianDistribution py(my,sigma); for (int i=0; i<N/K; i++) { data[j][0]=px.draw(); data[j][1]=py.draw(); labels[j]=k; j++; } } std::cerr << "\nTraining MLP..."; // train MLP lti::MLP s; lti::streamProgressInfo inf(std::cerr,"MLP"); s.setProgressObject(inf); lti::MLP::parameters p=s.getParameters(); s.setParameters(p); if (!s.train(data,labels)) { std::cerr << "Error: " << s.getStatusString() << "\n"; //return; } std::cerr << "\nVisualizing..."; // NOW COMES THE INTERESTING PART: // we need an image lti::image panel; lti::classifier2DVisualizer visual; lti::classifier2DVisualizer::parameters vp; // set the parameters vp.showBoundaries=true; vp.imgSize=point(width,height); vp.upperRight=dpoint(width,height); visual.setParameters(vp); // create the image if (!visual.apply(s,data,panel,labels)) { std::cerr << "Error: " << s.getStatusString() << "\n"; return; } // enjoy!
|
|
default constructor
|
|
|
copy constructor
|
|
|
destructor
|
|
||||||||||||||||||||||||
|
Applies the given classifier to the area defined in the parameters object. The image will contain the visualization result. It also highlights the vectors given in highlights. The color of each highlight is determined by the corresponding value in labels. You can also distinguish between two classes of labels. The label class is determined by the vector htype.
|
|
||||||||||||||||||||
|
Applies the given classifier to the area defined in the parameters object. The image will contain the visualization result. It also highlights the vectors given in highlights. The color of each highlight is determined by the corresponding value in labels.
|
|
||||||||||||||||
|
Applies the given classifier to the area defined in the parameters object. The image will contain the visualization result. It also highlights the vectors given in highlights.
|
|
||||||||||||
|
Applies the given classifier to the area defined in the parameters object. The image will contain the visualization result.
|
|
|
returns a pointer to a clone of this functor.
Implements lti::functor. |
|
|
copy data of "other" functor.
|
|
|
returns used parameters
Reimplemented from lti::functor. |
|
|
returns the name of this type ("classifier2DVisualizer")
Reimplemented from lti::functor. |
|
|
alias for copy member
|