281 lines
154 KiB
Text
281 lines
154 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# TP 3 SVM\n",
|
||
|
"On se propose de faire de la modélisation par SVM sur des problématiques de discrimination, en utilisant la bibliothèque scikit-learn.\n",
|
||
|
"\n",
|
||
|
"On veut : \n",
|
||
|
"- Traiter un problème de discrimination linéairement séparable\n",
|
||
|
"- Traiter un problème non linéairement séparable (SVM à noyaux)\n",
|
||
|
"- Traiter le problème de la discrimination de chiffres manuscrits"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Problème linéairement séparable"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1042,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import numpy as np\n",
|
||
|
"from sklearn.svm import SVC"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1043,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def genere_ex_1(n1=100, n2=50, mu1=[0,3], mu2=[3,0], sd1=0.15, sd2=0.2):\n",
|
||
|
" X = np.concatenate((np.random.multivariate_normal(mu1, np.diagflat(sd1*np.ones(2)), n1),\n",
|
||
|
" np.random.multivariate_normal(mu2, np.diagflat(sd2*np.ones(2)),n2)))\n",
|
||
|
"\n",
|
||
|
" Y = np.concatenate((np.ones((n1,1)), -1*np.ones((n2,1))))[:,0]\n",
|
||
|
" return X,Y"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1044,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def plot_data_hyperplan(X, Y, classifier, name):\n",
|
||
|
" w = classifier.coef_[0]\n",
|
||
|
" b = classifier.intercept_[0]\n",
|
||
|
" a = -w[0] / w[1]\n",
|
||
|
" xx = np.linspace(min(X[:,0]), max(X[:,0]))\n",
|
||
|
" yy = a * xx - b/w[1]\n",
|
||
|
"\n",
|
||
|
" # print(X.size)\n",
|
||
|
"\n",
|
||
|
" # b1 = [(X[i,0]-a*X[i,0]- b/w[1]) for i in range(0,int(X.size/2))]\n",
|
||
|
" # b1 = min(b1)\n",
|
||
|
"\n",
|
||
|
" # b2 = [(X[i,1]-a*X[i,1]/w[1]) for i in range(0,int(X.size/2))]\n",
|
||
|
" # b2 = max(b2)\n",
|
||
|
"\n",
|
||
|
" color = ['red' if c >= 0 else 'blue' for c in Y]\n",
|
||
|
" plt.scatter(X[:,0], X[:,1], color=color)\n",
|
||
|
"\n",
|
||
|
" plt.plot(xx,yy, color='black')\n",
|
||
|
" plt.plot(xx, yy+1, color='green')\n",
|
||
|
" plt.plot(xx, yy-1, color='green')\n",
|
||
|
" plt.xlabel(\"x1\")\n",
|
||
|
" plt.ylabel(\"x2\")\n",
|
||
|
" plt.title(\"Classe 1 (red), Classe -1 (blue)\")\n",
|
||
|
" plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1045,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def main(X,Y):\n",
|
||
|
" classifier = SVC(kernel='linear', probability=True)\n",
|
||
|
" classifier = classifier.fit(X, Y)\n",
|
||
|
"\n",
|
||
|
" plot_data_hyperplan(X, Y, classifier, 'Graph_SVM_linear')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1046,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAA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y/f3+UK1cO//777xdf+8OHDzhy5AgGDhyI+Ph45T15//49unfvjgcPHuDly5dZjsmINS/fGU4/8eYnTq9YWloCwBeNiFAoFFi0aBGWLl2Kx48fZxkGbGtrq/xvFxcXhIeHo0WLFqhZsya6deuGoUOHom3btsp9goODMXLkSFSqVAlNmzbFN998gxEjRqB69eoAoCwYR44cmWM8sbGxagua/EBEKp+vVq1alsfv3r1DTEwMVq5ciZUrV6o85u3btwBYH5WaNWtm6+9Tp04dtXHkpX9QfnzuycnJCAgIwLp16/Dy5css9yQ2Nlb53z4+Pvj+++9Ru3Zt1K9fHz169MDw4cPRsGFDACwpDgoKwsyZM1GmTBm0atUKvXr1wogRI5T9XTI+986dO6t9P6rI5fJs87PY2NjA0NAwb2/8Mzl9FwCgVq1aWR6LRCLUrFkzW1+hvIiMjAQRYfbs2Zg9e7bKfd6+fZulQ3tGrHntU8bpH57UcHrF0tIS5cuX/6JRLv7+/pg9ezbGjBmDuXPnwsbGBmKxGDNmzMhSa/LVV1/h3r172LdvHw4ePIidO3cqhxDPmTMHABvR0759e+zevRuHDh1CSEgIgoKCsGvXLvTs2VN5vpCQEDRu3FhlPAU5d0xGkvbx40dUrFgx2+uf95PIiHfYsGE5JmIZhXtefPz4MVvBqY2aNWtCKpXixo0beb721KlTsW7dOsyYMQOtW7eGlZUVRCI
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"X, Y = genere_ex_1() \n",
|
||
|
"main(X, Y)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Problème non linéairement séparable\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1047,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from sklearn.model_selection import GridSearchCV"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1048,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def genere_ex_2(n=300, mu=[0,0], std=0.25, delta=0.2):\n",
|
||
|
" X = np.random.multivariate_normal(mu, np.diagflat(std*np.ones(2)), n)\n",
|
||
|
" Y = np.zeros((X.shape[0]))\n",
|
||
|
"\n",
|
||
|
" for i in range(X.shape[0]):\n",
|
||
|
" x = X[i,0]\n",
|
||
|
" y = X[i,1]\n",
|
||
|
" if y < x*(x-1)*(x+1):\n",
|
||
|
" Y[i] = -1\n",
|
||
|
" X[i,1] = X[i,1] - delta\n",
|
||
|
" else:\n",
|
||
|
" Y[i] = 1\n",
|
||
|
" X[i,1] = X[i,1] + delta\n",
|
||
|
" return X,Y"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1049,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def plot(X,Y,classifier, nameFig):\n",
|
||
|
" minx1 = min(X[:,0])\n",
|
||
|
" maxx1 = max(X[:,0])\n",
|
||
|
" minx2 = min(X[:,1])\n",
|
||
|
" maxx2 = max(X[:,1])\n",
|
||
|
"\n",
|
||
|
" xx = np.linspace(minx1, maxx1, 100)\n",
|
||
|
" yy = np.linspace(minx2, maxx2, 100).T\n",
|
||
|
" xx, yy = np.meshgrid(xx,yy)\n",
|
||
|
" Xfull = np.c_[xx.ravel(), yy.ravel()]\n",
|
||
|
"\n",
|
||
|
" probas = classifier.predict_proba(Xfull)\n",
|
||
|
" Z = classifier.decision_function(Xfull)\n",
|
||
|
"\n",
|
||
|
" k = 1\n",
|
||
|
" plt.title(\"Class %d\" %k)\n",
|
||
|
" imshow_handle = plt.imshow(probas[:, k].reshape((100,100)), extent=(minx1, maxx1, minx2, maxx2), origin='lower')\n",
|
||
|
" \n",
|
||
|
" classPos = Y>=0\n",
|
||
|
" classNeg = Y<0\n",
|
||
|
"\n",
|
||
|
" plt.contour(xx, yy, Z.reshape((100,100)), [-1,0,1], colors=['blue', 'black', 'red'])\n",
|
||
|
" plt.scatter(X[classPos, 0], X[classPos, 1], marker='o', c='r', edgecolors='k')\n",
|
||
|
" plt.scatter(X[classNeg, 0], X[classNeg, 1], marker='o', c='b', edgecolors='k')\n",
|
||
|
"\n",
|
||
|
" ax = plt.axes([0.8, 0.15, 0.05, 0.7])\n",
|
||
|
"\n",
|
||
|
" plt.title('Probability')\n",
|
||
|
" plt.colorbar(imshow_handle, cax=ax, orientation='vertical')\n",
|
||
|
" \n",
|
||
|
" plt.savefig(nameFig+'.jpg', dpi=300)\n",
|
||
|
" plt.show()\n",
|
||
|
" plt.close()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1053,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def main(X,Y,nameFig = 'GridSearchCV'):\n",
|
||
|
" parameters = {'kernel':('poly', 'poly'), 'C':[0.1,0.5, 1, 10], 'degree':[3,5], 'coef0':[0, 0.1, 0.5, 1, 10]}\n",
|
||
|
" svc = SVC(probability=True)\n",
|
||
|
" classifier = GridSearchCV(svc, parameters)\n",
|
||
|
" classifier = classifier.fit(X,Y)\n",
|
||
|
" print(classifier.best_params_)\n",
|
||
|
"\n",
|
||
|
" plot(X,Y, classifier=classifier, nameFig=nameFig)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1055,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"{'C': 0.5, 'coef0': 0.5, 'degree': 3, 'kernel': 'poly'}\n"
|
||
|
]
|
||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EjtaysLC0jI0MbOXKk9sADD6Q0/0GDBmlAzG3r1q0d8REZGBh0EIYP1sDAwMCgTUiSxCWXXMJ9993XIed78sknOe+88/j0008ZN25cwrFTpkwBCMU9bNu2jSFDhkTEIyxcuJAbb7yxlVunqzF8sAYGBgZ9hCeffBJJkkKb3W7n4IMP5tJLL40Ze7AvsXjxYpYtW9al1zQErIGBgUEfY9GiRTz11FPcd999TJo0iQcffJCJEyfidDq7e2p7zdtvv83bb7+dcMw///nPVu0nu0PAGkFOBgYGBn2Mk08+OWRqPf/88ykoKOCuu+5i+fLlnHXWWa3GOxwOMjIyunqa7cJqtSYdYzabMZu7X7wZGqyBgYFBH+e4444DRNvGP/3pT2RmZrJ582amTZtGVlYWf/jDHwAhaK+88koGDBiAzWZj6NCh3HHHHXF9mc888wxDhw7FbrczduxYPvzww4jXt2/fzl//+leGDh1KWloaBQUF/P73v2fbtm0xz+d0OrnwwgspKCggOzub2bNnU19fHzFmypQpIT9sPBYuXIgkSaHnkiThcDj497//HTKf/+lPf+L9999HkiReffXVVud49tlnkSSJdevWJbxWIrpfxBsYGBgYdCqbN28GoKCgAAC/38/UqVM5+uijueOOO0hPT0fTNE455RTef/99/vKXvzBq1CjeeustrrrqKnbv3s3dd98dcc4PPviAF154gcsuuwybzcYDDzzASSedxIYNGxg+fDgAn376KWvXruXMM89kv/32Y9u2bTz44INMmTKFH374gfT09IhzXnrppeTm5rJw4UI2btzIgw8+yPbt21m9enWEwGwrTz31FOeffz7jx4/nggsuAETq3pFHHsmAAQN45pln+M1vfhNxzDPPPMMBBxyQUmGauHRrDLOBgYGBQYfxxBNPaID27rvvatXV1drOnTu1559/XisoKNDS0tK0Xbt2aeeee64GaNdee23EscuWLdMA7eabb47Y/7vf/U6TJEnbtGlTaB+B1LDPPvsstG/79u2a3W7XfvOb34T2OZ3OVnNct26dBmj/+c9/Ws177NixmtfrDe2/7bbbNEBbvnx5aF90atzWrVs1QHviiSdC+xYsWKBFi7eMjIyI1Lsg1113nWaz2bSGhobQvqqqKs1sNmsLFixoNb4t9DkNVlVV9uzZQ1ZW1l6teAwMDAx6G8HAnhNOOCFi/6BBg3jmmWfo379/aN/FF18cMWblypXIssxll10Wsf/KK6/kpZde4n//+x+XXnppaP/EiRMZO3Zs6PnAgQM59dRTef3111EUBVmWSUtLC73u8/loamriwAMPJDc3ly+++IJzzjkn4loXXHABFoslYo7XX389K1eu5JRTTmnrx5ESs2fPZsmSJbz00kv85S9/AeCFF17A7/fzxz/+ca/O3ecE7J49exgwYEB3T8PAwMCgR/Dee+9xzDHHRPQyNpvN7LfffhHjtm/fTr9+/Vq1dRw2bFjodT0HHXRQq2sdfPDBOJ1OqqurKS0txeVysWTJEp544gl2794d4cuNLhka65yZmZmUlZXF9dl2BIcccghHHHEEzzzzTEjAPvPMMxx55JEceOCBe3XuPidgg1+O7V8MJjvTiOEyMOhIPlrv5JRzKngXOCLG6xuAXwOvPVXK5AnpMUb0PRQt3E3Jo/nDLzSrZEzYg6TCj+8Uc5fpxNBLy89YhaemnLKTzuTQzWUAqJqJ1ZuuQ8PCBOs/yTBVonq84fOlUDShnB1s5EvG8CvSyWQNKxkzZkyEcIXI/sadyd/+9jeeeOIJrrjiCiZOnEhOTg6SJHHmmWdGdKHqbmbPns3ll1/Orl278Hg8fPLJJx1SRKPPCdigWTg700R2liFgDQw6kpOOzWB
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"X,Y = genere_ex_2()\n",
|
||
|
"main(X,Y)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Reconnaissance de chiffres manuscrits"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"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.8.10"
|
||
|
},
|
||
|
"orig_nbformat": 4,
|
||
|
"vscode": {
|
||
|
"interpreter": {
|
||
|
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|