{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2026-10-12T12:53:29.779587600Z", "start_time": "2026-10-12T12:53:29.683696200Z" } }, "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\n", "from sklearn.svm import SVR\n", "import matplotlib.pyplot as plt\n" ], "outputs": [ { "data": { "text/plain": [ "'1.9.1'" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 23 }, { "metadata": { "ExecuteTime": { "end_time": "2026-10-12T12:42:15.457613600Z", "start_time": "2026-10-12T12:42:15.430651Z" } }, "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-12T12:42:15.532485200Z", "start_time": "2026-10-12T12:42:15.461038200Z" } }, "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-12T12:42:15.773490100Z", "start_time": "2026-10-12T12:42:15.555494200Z" } }, "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.