How it works...

In Step 1, we looked at the data types of our variables. We noticed that we have ten categories and seven numerical variables. In Step 2, we checked for missing values and saw that there were no missing values in our dataset. In Step 3, we checked the class balance of our target variable and found out that it has the values of yes and no. In Step 4, we converted our target variable to 1 and 0 to represent yes and no respectively. In Steps 5 and 6, we performed one-hot encoding on the non-numerical variables.

In Step 7, we separate the predictor and response variables and in Step 8, we split our dataset into training and testing datasets. After that, in Step 9, we used SVC() from sklearn.svm with the default RBF kernel to build our model. We applied it to our training and testing data to predict the class. In Step 10, we checked the accuracy of our training and testing data. In Step 11, we changed our hyperparameter to set the kernel to polynomial. We noticed that training accuracy remained more or less the same, but the test accuracy improved.

With the polynomial kernel, the default degree is 3. You can change the polynomial degree to a higher degree and note of the change in the model's performance.

In Step 12, we changed the kernel to linear to see if the results improved compared to the polynomial kernel. We did not, however, see any significant improvement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset