"You can obtain the dataset used in this lecture here: https://www.kaggle.com/rakeshrau/social-network-ads/data. It is a 'categorical dataset to determine whether a user purchased a particular product'."
"Create the SVM, and train it on the standardised data\n",
"\n",
"### Parameters for SVC: Gamma and C\n",
"A lower value of Gamma will loosely fit the training dataset, whereas a higher value of gamma will exactly fit the training dataset resulting in over-fitting.\n",
"\n",
"C parameter used is to maintain regularization. A smaller value of C creates a small-margin hyperplane and a larger value of C creates a larger-margin hyperplane."
"Add the feature 'Gender' to the training set, and see if the accuracy improves and the mean squared error drops!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:markdown id: tags:
### Non-linear Support Vector Machines
You can obtain the dataset used in this lecture here: https://www.kaggle.com/rakeshrau/social-network-ads/data. It is a 'categorical dataset to determine whether a user purchased a particular product'.
%% Cell type:code id: tags:
``` python
#import
importnumpyasnp
importmatplotlib.pyplotasplt
frommatplotlib.colorsimport*
importpandasaspd
fromsklearn.model_selectionimport*
fromsklearn.linear_modelimportLinearRegression
fromsklearn.metricsimport*
fromsklearnimportmetrics
fromsklearn.svmimportSVC
fromsklearn.preprocessingimportStandardScaler
```
%% Cell type:markdown id: tags:
Here are the functions you used in the previous lectures
Create the SVM, and train it on the standardised data
### Parameters for SVC: Gamma and C
A lower value of Gamma will loosely fit the training dataset, whereas a higher value of gamma will exactly fit the training dataset resulting in over-fitting.
C parameter used is to maintain regularization. A smaller value of C creates a small-margin hyperplane and a larger value of C creates a larger-margin hyperplane.