{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2026-10-03T16:46:34.175559799Z", "start_time": "2026-10-03T16:46:34.063922625Z" } }, "source": [ "from sklearn.svm import LinearSVC, SVC\n", "import numpy as np\n", "from nnwplot import plotTwoFeatures" ], "outputs": [], "execution_count": 18 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-03T16:46:34.219658258Z", "start_time": "2026-10-03T16:46:34.190531089Z" } }, "cell_type": "code", "source": [ "flower_data = np.loadtxt('data/iris.csv', delimiter=',')\n", "inverse = flower_data.T\n", "X = inverse[:-1]\n", "T = inverse[-1]" ], "id": "b4e863de5bc956", "outputs": [], "execution_count": 19 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-03T16:46:34.416357667Z", "start_time": "2026-10-03T16:46:34.226237363Z" } }, "cell_type": "code", "source": [ "two_features = X[:2].T\n", "print(two_features.shape)" ], "id": "bcd23c414c49a88e", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(150, 2)\n" ] } ], "execution_count": 20 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-03T16:46:34.532571321Z", "start_time": "2026-10-03T16:46:34.444142909Z" } }, "cell_type": "code", "source": [ "clf = LinearSVC()\n", "\n", "clf.fit(two_features,T.T)" ], "id": "dcb75df28cbf865f", "outputs": [ { "data": { "text/plain": [ "LinearSVC()" ], "text/html": [ "
LinearSVC()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.