LDA
Testing error 0.118644152.19% of the training data had an mpg value above the dataset median, and 47.81% had an mpg value below it.
The objective of this project is to test different classification models on their ability to classify whether a car's gas mileage is above or below the median value of the dataset. Gas mileage is measured in miles per gallon (mpg) based on the following car attributes: cylinders, displacement, horsepower, weight, acceleration, model year, and origin. The data — city-cycle fuel consumption in miles per gallon — was retrieved from the UCI Auto MPG dataset.
There are 392 observations across 8 variables. Below are the minimum, median, mean, and max values for cylinders, displacement, horsepower, weight, acceleration, and model year.
I split the data into approximately 70% training and 30% testing by randomly sampling the dataset. This is a standard split — using 70% or more of the data for training and 30% or less for testing — and was applied consistently across all five models.
52.19% of the training data had an mpg value above the dataset median, and 47.81% had an mpg value below it.
52.19% of the training data had an mpg value above the dataset median, and 47.81% had an mpg value below it.
57 data points were correctly classified as below the median mpg, and 49 were correctly classified as above the median mpg.
54 data points were correctly classified as below the median mpg, and 50 were correctly classified as above the median mpg.
The k value with the lowest testing error was k = 4. 55 data points were correctly classified as below the median mpg, and 48 were correctly classified as above the median mpg.
Naive Bayes had the lowest testing error and performed the best, followed by logistic regression. KNN performed the worst of the five models. LDA and QDA produced the same testing error.