Data Portfolio
Image Classification with Decision Trees

Data
The data analyzed is the Image Segmentation Data Set from UCI’s Machine Learning Repository. The dataset was constructed from a random set of seven 3x3 outdoor images. The images are segmented to create a classification for every pixel. There are 2310 observations with 19 variables. The decision tree will be used to group observations by variable values and predict their membership in classes.
Correlation
Correlation between variables was plotted (a quantitative value was substituted for class values for this plot only).

Scatter plots of the data were also created to see which values were associated with which class. A clear distinction (higher values) for rawred_mean, rawblue_mean, and rawgreen_mean can be seen for images classified as the sky.

Decision Tree
The decision tree for image classification based on the training dataset had eight splits, seven decision nodes, and nine terminal nodes. Splits were made on intensity_mean, hue_mean, region_centroid_row, rawredÂmean, rawblue_mean, and saturation mean. Three of the eight splits are by hue_mean.
​

Decision Tree Progression of Splits
The progression of data splits was plotted by class.
The first split is by intensity_mean < 83. 15% of observations have an intensity_mean higher than 83 and are classified as sky. The remaining 85% is split by hue_mean <.64. 14% of all observations have a hue_mean higher than .64 and are classified as grass.
The remaining 71% of observations are split by region_centroid_row <160. 15% of observations have a region_centroid row higher than 160 and are classified as path.
The remaining 57% of observations are split by hue_mean >- -1.8. 17% of observations have a hue_mean >= 1.8 and are further split by exgreen_mean <-4.8.
Observations with exgreen_mean <-4.8 are classified as brickface (15% of observations) (Figure 6e) and the remaining 2% are classified as window. The 40% of observations with hue_mean < -4.8 are split by rawred_mean >=20.
Observations with rawred_mean >20 (13%) are classified as cement.
The remaining 26% of observations are split by hue_mean <-2.2. Observations with hue_mean <2.2 (8%) are classified as foliage.
The remaining 18% of observations are split by saturation mean >=.89 (Figure 6g). Observations with saturation_mean >=.89 are classified as foliage, the remaining 13% of observations were classified as window.
The final percentages by class were brickface 15%, window 15%, cement 13%, foliage 13%, path 15%, grass 14%, and sky 15%. The decision tree was able to most easily identify classes sky, grass, and path. 44% of observations were predicted within three splits.

Results
The decision tree used for analysis had an accuracy rate is 92% with the greatest accuracy identifying grass and sky. (Other models created by specifying minimum split (observations required for a node to be split), minimum number of observations per terminal node did not result in accuracy above 92%.) The decision tree had the lowest accuracy when predicting cement.
The sensitivity of the decision tree for the training data ranged from .81 to 1 with cement, foliage, and window having the least true positives. The specificity is very high (>.96) for all classes indicating a low number of true negatives. The balanced accuracy ranges from .89 to 1 (grass and sky). All of these numbers are high indicating the model can identify and classify images very well with a low error rate. Classes with which the model had the most difficulty predicting were cement, foliage, and window. Cement images were most frequently misclassified as window or brickface; foliage images were most frequently misclassified as window or cement; window images were most frequently misclassified as foliage or cement. Sky and grass were accurately predicted for all sky and grass images. Path had only two misclassified observations that were predicted to be cement.
When the decision tree was used for classification of the test dataset the accuracy was 90%, slightly lower than that for the training set. Sensitivity ranged from .75 (window) to 1 (sky). Other classes with lower sensitivity were foliage (.80) and cement (.86). The other classes had a sensitivity between .92 (brickface) and .99 (path).
Specificity was high for all classes with the lowest specificity of .96 (cement). The balanced accuracy was above 90% for all classes except foliage and window. Sky had a balanced accuracy of 100%.