- Details
- Parent Category: Programming Assignments' Solutions

# We Helped With This MATLAB Programming Homework: Have A Similar One?

Category | Programming |
---|---|

Subject | MATLAB |

Difficulty | Undergraduate |

Status | Solved |

More Info | Matlab Coding Tutors |

## Assignment Description

1. From the iris dataset take instances 51-75, 101-125 as the training data and instances 76- 100, 126-150 as test data for classes versicolor and virginica. Train a linear discriminant analysis (=minimum Mahalanobis classifier) with the training data set and use the trained classifier to classify the test data.

(a) Use Matlab and PRTools to calculate the confusion matrix.

(b) Give the numbers of true positives, false negatives, false positives, true negatives in this case.

(c) Calculate precision, recall, f-measure, false alarm rate, and accuracy.

2. Based on the adult data set from the UCL machine learning repository, predict whether someone is rich ( ’>50K’) or not, based on the following features: age, fnlwgt, education-num, race, sex, capital-gain, capital-loss, hours-per-week, native country. Convert the string attributes race, sex, native-country into a number, white →1, non-white→ 0, male→ 1, female→ 0, US-born→ 1, non-US born → 0, ’>50K’→2, <=50K’→ 1.

Perform 10-fold cross-validation with the classifiers: minimumdistance classifier, minimum Mahalanobis classifier (=linear discriminant analysis), quadratic classifier, k-nearest neighbor, and support vector machine. Calculate the f-measure. Compare the results of the 5 classifiers to a classifier that randomly guesses a class, and to a classifier that always predicts ’<=50k’ (poor). Comment on the results!