{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "Name: Anand Panchdhari\n", "Roll No.: C013\n", "Aim: Implement Support Vector Machine classifier on real world dataset using sklearn package in python and evaluate its performance.\n", "\"\"\"\n", "import pandas as pd\n", "from sklearn.linear_model import LogisticRegression\n", "import matplotlib.pyplot as plt\n", "from sklearn import svm\n", "import numpy as np\n", "import seaborn as sns\n", "from sklearn.metrics import classification_report, accuracy_score, precision_score, recall_score\n", "from sklearn.model_selection import train_test_split" ] }, { "cell_type": "code", "execution_count": 127, "metadata": {}, "outputs": [ { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "case", "rawType": "int64", "type": "integer" }, { "name": "site", "rawType": "int64", "type": "integer" }, { "name": "Pop", "rawType": "object", "type": "string" }, { "name": "sex", "rawType": "object", "type": "string" }, { "name": "age", "rawType": "float64", "type": "float" }, { "name": "hdlngth", "rawType": "float64", "type": "float" }, { "name": "skullw", "rawType": "float64", "type": "float" }, { "name": "totlngth", "rawType": "float64", "type": "float" }, { "name": "taill", "rawType": "float64", "type": "float" }, { "name": "footlgth", "rawType": "float64", "type": "float" }, { "name": "earconch", "rawType": "float64", "type": "float" }, { "name": "eye", "rawType": "float64", "type": "float" }, { "name": "chest", "rawType": "float64", "type": "float" }, { "name": "belly", "rawType": "float64", "type": "float" } ], "conversionMethod": "pd.DataFrame", "ref": "e492ff94-6045-4540-bb6c-89495e088fe6", "rows": [ [ "0", "1", "1", "Vic", "m", "8.0", "94.1", "60.4", "89.0", "36.0", "74.5", "54.5", "15.2", "28.0", "36.0" ], [ "1", "2", "1", "Vic", "f", "6.0", "92.5", "57.6", "91.5", "36.5", "72.5", "51.2", "16.0", "28.5", "33.0" ], [ "2", "3", "1", "Vic", "f", "6.0", "94.0", "60.0", "95.5", "39.0", "75.4", "51.9", "15.5", "30.0", "34.0" ], [ "3", "4", "1", "Vic", "f", "6.0", "93.2", "57.1", "92.0", "38.0", "76.1", "52.2", "15.2", "28.0", "34.0" ], [ "4", "5", "1", "Vic", "f", "2.0", "91.5", "56.3", "85.5", "36.0", "71.0", "53.2", "15.1", "28.5", "33.0" ] ], "shape": { "columns": 14, "rows": 5 } }, "text/html": [ "
| \n", " | case | \n", "site | \n", "Pop | \n", "sex | \n", "age | \n", "hdlngth | \n", "skullw | \n", "totlngth | \n", "taill | \n", "footlgth | \n", "earconch | \n", "eye | \n", "chest | \n", "belly | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "1 | \n", "1 | \n", "Vic | \n", "m | \n", "8.0 | \n", "94.1 | \n", "60.4 | \n", "89.0 | \n", "36.0 | \n", "74.5 | \n", "54.5 | \n", "15.2 | \n", "28.0 | \n", "36.0 | \n", "
| 1 | \n", "2 | \n", "1 | \n", "Vic | \n", "f | \n", "6.0 | \n", "92.5 | \n", "57.6 | \n", "91.5 | \n", "36.5 | \n", "72.5 | \n", "51.2 | \n", "16.0 | \n", "28.5 | \n", "33.0 | \n", "
| 2 | \n", "3 | \n", "1 | \n", "Vic | \n", "f | \n", "6.0 | \n", "94.0 | \n", "60.0 | \n", "95.5 | \n", "39.0 | \n", "75.4 | \n", "51.9 | \n", "15.5 | \n", "30.0 | \n", "34.0 | \n", "
| 3 | \n", "4 | \n", "1 | \n", "Vic | \n", "f | \n", "6.0 | \n", "93.2 | \n", "57.1 | \n", "92.0 | \n", "38.0 | \n", "76.1 | \n", "52.2 | \n", "15.2 | \n", "28.0 | \n", "34.0 | \n", "
| 4 | \n", "5 | \n", "1 | \n", "Vic | \n", "f | \n", "2.0 | \n", "91.5 | \n", "56.3 | \n", "85.5 | \n", "36.0 | \n", "71.0 | \n", "53.2 | \n", "15.1 | \n", "28.5 | \n", "33.0 | \n", "