{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/eddie/.pyenv/versions/3.7.6/envs/pytorch/lib/python3.7/site-packages/pandas/compat/__init__.py:117: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.\n", " warnings.warn(msg)\n" ] } ], "source": [ "import numpy as np\n", "import torch\n", "import torch.nn as nn\n", "import pandas as pd\n", "from sklearn.preprocessing import StandardScaler\n", "from torch.utils.data import Dataset\n", "from torch.utils.data import DataLoader\n", "from torch.nn import BCELoss\n", "from torch.optim import SGD" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Load the data set using pandas\n", "data = pd.read_csv('diabetes.csv')\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Number of times pregnant | \n", "Plasma glucose concentration | \n", "Diastolic blood pressure | \n", "Triceps skin fold thickness | \n", "2-Hour serum insulin | \n", "Body mass index | \n", "Age | \n", "Class | \n", "
---|---|---|---|---|---|---|---|---|
0 | \n", "6 | \n", "148 | \n", "72 | \n", "35 | \n", "0 | \n", "33.6 | \n", "50 | \n", "positive | \n", "
1 | \n", "1 | \n", "85 | \n", "66 | \n", "29 | \n", "0 | \n", "26.6 | \n", "31 | \n", "negative | \n", "
2 | \n", "8 | \n", "183 | \n", "64 | \n", "0 | \n", "0 | \n", "23.3 | \n", "32 | \n", "positive | \n", "
3 | \n", "1 | \n", "89 | \n", "66 | \n", "23 | \n", "94 | \n", "28.1 | \n", "21 | \n", "negative | \n", "
4 | \n", "0 | \n", "137 | \n", "40 | \n", "35 | \n", "168 | \n", "43.1 | \n", "33 | \n", "positive | \n", "