Supervised Learning - Classification Week 7 Challenge
1. Pros and cons of SVM.
Ans. Support Vector Machines (SVM) are a type of supervised machine learning algorithm that can be used for classification or regression tasks.
Here are some pros and cons of SVM:
Pros:
- Effective in High-Dimensional Spaces: SVMs perform well even in high-dimensional spaces, making them suitable for applications such as image recognition, text classification, and bioinformatics.
- Kernel Trick: SVMs can handle non-linear decision boundaries through the use of the kernel trick, which allows the algorithm to implicitly map inputs into higher-dimensional feature spaces.
- Robust to Overfitting: SVMs are less prone to overfitting compared to some other machine learning algorithms, especially in high-dimensional spaces.
- Global Optimal Solution: The objective function of SVM aims to find a hyperplane that maximally separates classes, leading to a global optimal solution.
- Versatility: SVMs can be used for both classification and regression tasks, making them versatile for various types of problems.
- Memory Efficient: SVMs use a subset of training points (support vectors) in the decision function, making them memory-efficient, especially when dealing with large datasets.
Cons:
- Computational Complexity: Training SVMs can be computationally intensive, particularly for large datasets. The time complexity is often cubic in the number of data points, which can make training slow.
- Difficulty in Parameter Selection: SVMs involve parameters like the kernel type, regularization parameter (C), and kernel-specific parameters. Selecting appropriate values for these parameters can be challenging and may require extensive tuning.
- Sensitivity to Noisy Data: SVMs can be sensitive to noisy data, which can affect the placement of the decision boundary.
- Limited Interpretability: The decision function of SVMs is not easily interpretable, making it challenging to understand the rationale behind a particular classification decision.
- Binary Classification: SVMs are inherently binary classifiers. While there are techniques like one-vs-all to extend them to multi-class classification, it may not be as straightforward as with some other algorithms.
- Not Suitable for Large Datasets: SVMs may not be suitable for very large datasets due to their computational complexity.
In summary, SVMs are powerful and versatile algorithms that perform well in various scenarios, especially in high-dimensional spaces. However, they come with computational challenges and require careful parameter tuning.
2. Apply SVM to the “Surface defects in stainless steel plates” dataset and evaluate it.
Ans.
Aim : To apply SVM algorithm on the surface defects in stainless steel plates dataset and evaluate it
Methods :
Descriptive analysis :
- The given dataset is imported into python.
- So there are 1941 rows and 34 columns, Now we print all column names
- So there are 27 features and the faults are represented in the last 7 columns using one hot encoding
- Now lets try to get info on the dataset
- We check for null values and found there are no null values
- Since there are many features we can remove some features which almost similar to other features, we can find this by plotting a correlation matrix
- So the areas which are close to the value 1 are closely related and hence can be removed to avoid repetition in the features.
From the figure we can say that
x_minimum is related to x_maximum
y_minimum is related to y_maximum
pixel_areas is related to x_perimeter and sum_of_luminosity
Logofareas is related to Log_X_index, Log_y_index and Sigmoidof areas
Luminosity index is related to maximum_of_luminosity
Orientaion index and outside_global_index
- So if we drop the related columns we end up with
- Now lets plot histogram of each feature to see the variation in the features
- We don't change the values for the outliers because we need experimental data to get correct results
- We can see the counts of each fault with other_faults having the maximum count
So the following accuracy was found for different training and test spilt
Training-Test Split Training Accuracy Test Accuracy
90-10% 73.9% 73.8%
80-20% 73.8% 72.7%
70-30% 74.9% 73.4%