Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.
SUMMARY: The purpose of this project is to construct a predictive model using various machine learning algorithms and to document the end-to-end steps using a template. The Truck APS Failure dataset is a binary classification situation where we are trying to predict one of the two possible outcomes.
INTRODUCTION: The dataset consists of data collected from heavy Scania trucks in everyday usage. The system in focus is the Air Pressure system (APS), which generates pressurized air that supports functions such as braking and gear changes. The dataset’s positive class consists of component failures for a specific component of the APS system. The negative class consists of trucks with failures for components not related to the APS. The training set contains 60000 examples in total, in which 59000 belong to the negative class and 1000 positive class. The test set contains 16000 examples.
The challenge is to minimize the total cost of a prediction model the sum of “Cost_1” multiplied by the number of Instances with type 1 failure and “Cost_2” with the number of instances with type 2 failure. The “Cost_1” variable refers to the cost resulted from a redundant check by a mechanic at the workshop. Meanwhile, the “Cost_2” variable refers to the cost of not catching a faulty truck. The cost of Type I error (cost_1) is 10, while the cost of the Type II error (cost_2) is 500.
In the previous Scikit-Learn iterations, we constructed and tuned machine learning models for this dataset using the Scikit-Learn and the XGboost libraries. We also observed the best accuracy result that we could obtain using the tuned models with the training, validation, and test datasets.
In iteration Take1, we constructed and tuned machine learning models for this dataset using TensorFlow with three layers. We also observed the best result that we could obtain using the tuned models with the validation and test datasets.
In iteration Take2, we provided more balance to this imbalanced dataset by using “Synthetic Minority Oversampling TEchnique” or SMOTE for short. We increased the population of the minority class from approximately 0.1% to approximately 33% of the training instances. We then decreased the population of the majority class to equal to the minority class. Furthermore, we also observed the best sensitivity/recall score that we could obtain using the tuned models with the training and test datasets.
In this Take3 iteration, we constructed and tuned machine learning models for this dataset using TensorFlow with four layers. At the same time, we leveraged the SMOTE technique to augment the dataset for training purposes. Furthermore, we also observed the best result that we could obtain using the tuned models with the validation and test datasets.
In this Take4 iteration, we will construct and tune machine learning models for this dataset using TensorFlow with five layers. At the same time, we will leverage the SMOTE technique to augment the dataset for training purposes. Furthermore, we will observe the best result that we can obtain using the tuned models with the validation and test datasets.
ANALYSIS: From the previous Scikit-Learn iterations, the optimized XGBoost model processed the testing dataset with a recall metric of 98.66% with a low Type II error rate.
From this Take1 iteration, the performance of the three-layer TensorFlow model achieved a recall score of 77.20% with the training dataset. After a series of tuning trials, the TensorFlow model processed the validation dataset with a recall score of 75.20%, which was consistent with the prediction from the training result. When configured with the optimized parameters, the TensorFlow model processed the test dataset with a recall score of 55.46% with a high Type II error rate.
From iteration Take2, the performance of the three-layer TensorFlow model achieved a recall score of 87.60% with the training dataset. After a series of tuning trials, the TensorFlow model processed the validation dataset with a recall score of 96.40%, which was much better than the prediction from the training result. When configured with the optimized parameters, the TensorFlow model processed the test dataset with a recall score of 85.06% with a lower Type II error rate than the previous iteration.
From iteration Take3, the performance of the four-layer TensorFlow model achieved a recall score of 83.60% with the training dataset. After a series of tuning trials, the TensorFlow model processed the validation dataset with a recall score of 93.20%, which was much better than the prediction from the training result. When configured with the optimized parameters, the TensorFlow model processed the test dataset with a recall score of 95.73% with a lower Type II error rate than the previous iteration.
From this Take4 iteration, the performance of the five-layer TensorFlow model achieved a recall score of 86.80% with the training dataset. After a series of tuning trials, the TensorFlow model processed the validation dataset with a recall score of 96.00%, which was much better than the prediction from the training result. When configured with the optimized parameters, the TensorFlow model processed the test dataset with a recall score of 98.66% with a lower Type II error rate but abysmal accuracy.
CONCLUSION: For this dataset, the model built using TensorFlow with four layers seems to yield the best result with a little help from applying SMOTE to balance the dataset. We should consider using TensorFlow and SMOTE to model this dataset further.
Dataset Used: APS Failure at Scania Trucks Data Set
Dataset ML Model: Binary classification with numerical attributes
Dataset Reference: https://archive.ics.uci.edu/ml/datasets/APS+Failure+at+Scania+Trucks
One potential source of performance benchmark: https://archive.ics.uci.edu/ml/datasets/APS+Failure+at+Scania+Trucks
The HTML formatted report can be found here on GitHub.