{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2026-10-04T09:28:26.125908200Z", "start_time": "2026-10-04T09:28:26.087555100Z" } }, "source": [ "from sklearn.svm import LinearSVC, SVC\n", "import numpy as np\n", "from nnwplot import plotTwoFeatures\n", "from sklearn.neighbors import KNeighborsClassifier\n", "from sklearn.cluster import KMeans, DBSCAN" ], "outputs": [], "execution_count": 28 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-04T08:55:13.379546900Z", "start_time": "2026-10-04T08:55:13.341972400Z" } }, "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": 2 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-04T08:55:13.492273800Z", "start_time": "2026-10-04T08:55:13.386609600Z" } }, "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": 3 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-04T08:55:13.811777Z", "start_time": "2026-10-04T08:55:13.514275500Z" } }, "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.