{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2026-10-01T14:23:10.794715300Z", "start_time": "2026-10-01T14:23:10.677571100Z" } }, "source": [ "from sklearn.svm import LinearSVC\n", "import numpy as np" ], "outputs": [], "execution_count": 27 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-01T14:23:10.901047600Z", "start_time": "2026-10-01T14:23:10.847255400Z" } }, "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": 28 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-01T14:23:11.054318400Z", "start_time": "2026-10-01T14:23:10.907043600Z" } }, "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": 29 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-01T14:23:11.153029400Z", "start_time": "2026-10-01T14:23:11.085339100Z" } }, "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.