====== Supervised Classification Using Decision Trees ====== InterIMAGE performs supervised classification through the C4.5 decision tree classifier. This example shows how to perform a supervised classification, using the Top Down operator //TA_C45_Classifier//. ===== Download ===== {{:interimage:examples:ta_interimage_examples_supervised_c45.zip}} ===== Step-by-step ===== In order to perform classification, the user must train the algorithm by providing samples of every class. In this way, the classification algorithm creates a decision tree and applies it into the set of objects, classifying them. Firstly define your interest classes, and create nodes for them. All nodes must be in the same level, only one of them must have the //TA_C45_Classifier// as Top Down Operator, and all the remaining nodes must have //No Operator//. Note: your classes of interest must be with the option **TopDown Multi-Class** selected. {{:interimage:examples:supervised_c45_nodes.png?600}} To perform the training step, you must enter the **Samples Editor**. Firstly select the node whose childs are the classes of interest, and open the editor as in the figure: {{:interimage:examples:samples_editor.png?600}} Select one operator to perform segmentation (//i.e. TA_Baatz_Segmenter//), and press //Segment//. Afterwards, when the objects appear inside the image, select one interest class, and press //Collect Samples//. Then select all your samples to the interest class, and press //Collect Samples// again to stop the selection. Perform this for all your interest classes. Note that your selected objects will be highlighted with the corresponding class: {{:interimage:examples:samples_selection.png?400}} After you selected your samples, you can export one shapefile with the training set, and all remaining elements. Press //Export// and one window to define attributes will open. Create your expressions to define your desired attributes, and select the shape file name to be exported: {{:interimage:examples:exporting_training_attributes.png?400}} In this example we exported the attributes //ratio// and //mean// for all image bands. This shape file will be used as the training set, and also the set of objects to be classified. Now open the properties of your project in //File//, //Edit Project//. In the area **Source**, select your shape file, and add to your project. {{:interimage:examples:importing_shapefile.png?400}} After defining all parameters, you can run the project. The resultant classification will be as follows: {{:interimage:examples:supervised_c45_result_correct.png?600}} The generated decision tree will be placed in a //.txt// file, located in the same place as your input shape file, and will have the following content: RATIO_2 > 0.4 -> roofs RATIO_2 <= 0.4 | RATIO_2 <= 0.3 -> pools | RATIO_2 > 0.3 -> background Note that the automatic classification generated some wrong hypothesis, so you can create further rules to increase the classification accuracy.