Develop UnSupervised Machine Learning Models
Budget: $10 – $30 USD
Develop UnSupervised Machine Learning Models
Clustering is a Machine Learning technique that involves the grouping of data points. Given a set of data points, we can use a clustering algorithm to classify each data point into a specific group. In theory, data points that are in the same group should have similar properties and/or features, while data points in different groups should have highly dissimilar properties and/or features.
In previous assignment, we developed supervised learning model to predict attacks on the CAN bus of a vehicle. But, in reality data used on these models are generally unlabeled (meaning, you will not be provided label column stating Attack =1 or Attack =0). Let's develop unsupervised learning models using the same datasets.
In this assignment you are tasked to study provided files i.e bus logs, extract relevant information, explore data and come up with 2 clustering algorithms i.e., K-Mean Clustering and Isolation Forest Clustering.
The tasks are:
Task 1: Data preparation
You are provided three files, i.e., text files containing bus logs of 3 different scenarios
CAN Bus log - injection of FFF as the speed reading
CAN Bus log - injection of RPM readings
CAN bus log - no injection of messages
Update your Python module to read the datasets were provided in assignment 1.
Unlike previous assignment, you will not use label data. You need to drop ‘Attack’ column from dataframe.
Task 2 - k-mean Clustering
K-means clustering is one of the simplest and most popular unsupervised machine learning algorithms. A cluster refers to a collection of data points aggregated together because of certain similarities. You’ll define a target number k, which refers to the number of centroids you need in the dataset. A centroid is the imaginary or real location representing the center of the cluster. For this assignment you need to set k = 2 as we have 2 outcomes (i.e., Attack = 0 and Attack = 1)
You need to fit k-mean clustering separately for 6 datasets (1 Speed and 1 RPM dataframe for each of 3 scenarios).
Use scatter plot to show the fitted k-mean clusters.
Provide the centroids of each clusters.
Compare and discuss the scatter plots of the three scenarios from the speed datasets. Do the same for the RPM datasets.
Task 3- Isolation Forest Algorithm
You need to fit Isolation Forest separately for the six datasets (1 Speed and 1 RPM data frame for each of the three scenarios).
Use scatter plot to show the fitted isolation forest clusters
Note down data point’s values (for example, RPM = 2700) detected as anomalies by IF.
Compare and discuss the scatter plots of the three scenarios from the speed datasets. Do the same for the RPM datasets.
Task 4 - Discussion
Write 1-2 paragraphs reflecting on what you have learnt from this assignment. Questions that you may consider are: What were the shortcomings of using unsupervised ML on this problem? What could be done to make the models perform better? What do you suggest doing to solve the problem better?
You can refer to following links to learn more about K-mean clustering and Isolation Forest. NOTE: These are just for reference and so DO NOT copy code from the vedio.
1. K-mean clustering
https://realpython.com/k-means-clustering-python/
https://youtu.be/iNlZ3IU5Ffw
2. Isolation Forest
https://www.google.com/amp/s/blog.paperspace.com/anomaly-detection-isolation-forest/amp/
https://youtu.be/O9VvmWj-JAk
Task 5 - Hidden Harkov Models (10 optional points):
Build Hidden Markov Model to predict Attack vs no Attack
Clustering is a Machine Learning technique that involves the grouping of data points. Given a set of data points, we can use a clustering algorithm to classify each data point into a specific group. In theory, data points that are in the same group should have similar properties and/or features, while data points in different groups should have highly dissimilar properties and/or features.
In previous assignment, we developed supervised learning model to predict attacks on the CAN bus of a vehicle. But, in reality data used on these models are generally unlabeled (meaning, you will not be provided label column stating Attack =1 or Attack =0). Let's develop unsupervised learning models using the same datasets.
In this assignment you are tasked to study provided files i.e bus logs, extract relevant information, explore data and come up with 2 clustering algorithms i.e., K-Mean Clustering and Isolation Forest Clustering.
The tasks are:
Task 1: Data preparation
You are provided three files, i.e., text files containing bus logs of 3 different scenarios
CAN Bus log - injection of FFF as the speed reading
CAN Bus log - injection of RPM readings
CAN bus log - no injection of messages
Update your Python module to read the datasets were provided in assignment 1.
Unlike previous assignment, you will not use label data. You need to drop ‘Attack’ column from dataframe.
Task 2 - k-mean Clustering
K-means clustering is one of the simplest and most popular unsupervised machine learning algorithms. A cluster refers to a collection of data points aggregated together because of certain similarities. You’ll define a target number k, which refers to the number of centroids you need in the dataset. A centroid is the imaginary or real location representing the center of the cluster. For this assignment you need to set k = 2 as we have 2 outcomes (i.e., Attack = 0 and Attack = 1)
You need to fit k-mean clustering separately for 6 datasets (1 Speed and 1 RPM dataframe for each of 3 scenarios).
Use scatter plot to show the fitted k-mean clusters.
Provide the centroids of each clusters.
Compare and discuss the scatter plots of the three scenarios from the speed datasets. Do the same for the RPM datasets.
Task 3- Isolation Forest Algorithm
You need to fit Isolation Forest separately for the six datasets (1 Speed and 1 RPM data frame for each of the three scenarios).
Use scatter plot to show the fitted isolation forest clusters
Note down data point’s values (for example, RPM = 2700) detected as anomalies by IF.
Compare and discuss the scatter plots of the three scenarios from the speed datasets. Do the same for the RPM datasets.
Task 4 - Discussion
Write 1-2 paragraphs reflecting on what you have learnt from this assignment. Questions that you may consider are: What were the shortcomings of using unsupervised ML on this problem? What could be done to make the models perform better? What do you suggest doing to solve the problem better?
You can refer to following links to learn more about K-mean clustering and Isolation Forest. NOTE: These are just for reference and so DO NOT copy code from the vedio.
1. K-mean clustering
https://realpython.com/k-means-clustering-python/
https://youtu.be/iNlZ3IU5Ffw
2. Isolation Forest
https://www.google.com/amp/s/blog.paperspace.com/anomaly-detection-isolation-forest/amp/
https://youtu.be/O9VvmWj-JAk
Task 5 - Hidden Harkov Models (10 optional points):
Build Hidden Markov Model to predict Attack vs no Attack