Skip to content

Instantly share code, notes, and snippets.

@santi-pdp
Created January 24, 2018 17:53
Show Gist options
  • Save santi-pdp/d0e9002afe74db04aa5bbff6d076e8fe to your computer and use it in GitHub Desktop.
Save santi-pdp/d0e9002afe74db04aa5bbff6d076e8fe to your computer and use it in GitHub Desktop.
Toy example in pytorch for binary classification
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([2000, 50])\n",
"torch.Size([2000, 1])\n"
]
}
],
"source": [
"import torch\n",
"import torch.nn as nn\n",
"from torch.autograd import Variable\n",
"import torch.optim as optim\n",
"\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"\n",
"X1 = torch.randn(1000, 50)\n",
"X2 = torch.randn(1000, 50) + 1.5\n",
"X = torch.cat([X1, X2], dim=0)\n",
"Y1 = torch.zeros(1000, 1)\n",
"Y2 = torch.ones(1000, 1)\n",
"Y = torch.cat([Y1, Y2], dim=0)\n",
"print(X.size())\n",
"print(Y.size())"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0x1107d0b00>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD8CAYAAABjAo9vAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnX+IZcl137/nvenO6nXLGK4W43g1rxUwho1xlGgxNjKB\naGKzXgsJmwQ8MxIeEnbwIx42JGC8LCSEsBAjMDbjELGRggWvsQkkIomsSJZigSfGv2bjlSJpJaF4\np3fXBGZ/EHl+rXamu/LH7equd1/9OFW37s93PlDMdPf9Ue++W986derUKVJKQRAEQRgPk64rIAiC\nIORFhF0QBGFkiLALgiCMDBF2QRCEkSHCLgiCMDJE2AVBEEaG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UxUUq9qJT6Ztf1qPCjAL6tlPoLpdTbAH4HwIc7rtMJSqk/APBm\n1/WwoZT6v0qp/3X8/1soBeoHuq3VKark9vGPW8elN+2ViB4B8DMAPtF1XZpkEMIOAET0LBG9AuAi\n+mexm/wjAP+960r0nB8A8Irx86vokTgNBSLaA/C3AfxJtzVZ5djV8QKAmwC+oJTqU/1+HcAvAzjq\nuiIOFIAvEtHzRHQ59SK9EXYi+iIRfdVSPgwASqlnlFLvBrAP4Jf6Vr/jY55BOVTe71vdhHFBRLsA\n/hOAf1oZ0XaOUurw2G36CIAfJaIf7rpOAEBEHwRwUyn1fNd18fATx8/up1G62f5uykV6s4OSUurv\nMw/dB/BZAP+yweqsEaofEV0C8EEA51TLMaQRz64v/CWAdxs/P3L8O4EBEW2hFPV9pdR/7ro+LpRS\n/4+IvoRyvqIPE9HvB/AhInoCwEMAvoeIlkqpj3RcrxOUUn95/O9NIvo0Srdl9PxYbyx2H0T0g8aP\nHwbwja7qYoOIHkc5vPuQUupu1/UZAH8G4AeJ6D1EtA3g5wH8147rNAiIiAB8EsCLSqlf67o+VYjo\nYR0VRkTvAPCT6El7VUo9rZR6RCm1h/Kd+/0+iToR7RDRO/X/AfwUEjvEQQg7gH9z7Fr4CsoP26sQ\nLwC/CeCdAL5wHKb08a4rpCGinyWiVwH8OIDfJaLPd12n44nmXwLweZSTf/9RKfW1bmt1ChH9NoA/\nAvBDRPQqEf3jrutk8H4AHwXwgeN37YVjC7QvfD+ALx231T9D6WPvXVhhT/k+AP+TiL4M4E8B/K5S\n6nMpF5KVp4IgCCNjKBa7IAiCwESEXRAEYWSIsAuCIIwMEXZBEISRIcIuCIIwMkTYBUEQRoYIuyAI\nwsgQYRcEQRgZ/x+gXSNYdO2KCwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x110646b00>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(X1[:, 0], X1[:, 1], color='b')\n",
"plt.scatter(X2[:, 0], X2[:, 1], color='r')"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [],
"source": [
"class Net(nn.Module):\n",
" \n",
" def __init__(self):\n",
" super().__init__()\n",
" self.fc1 = nn.Linear(50, 50)\n",
" self.relu1 = nn.ReLU()\n",
" self.dout = nn.Dropout(0.2)\n",
" self.fc2 = nn.Linear(50, 100)\n",
" self.prelu = nn.PReLU(1)\n",
" self.out = nn.Linear(100, 1)\n",
" self.out_act = nn.Sigmoid()\n",
" \n",
" def forward(self, input_):\n",
" a1 = self.fc1(input_)\n",
" h1 = self.relu1(a1)\n",
" dout = self.dout(h1)\n",
" a2 = self.fc2(dout)\n",
" h2 = self.prelu(a2)\n",
" a3 = self.out(h2)\n",
" y = self.out_act(a3)\n",
" return y\n",
" \n",
"net = Net()\n",
"opt = optim.Adam(net.parameters(), lr=0.001, betas=(0.9, 0.999))\n",
"criterion = nn.BCELoss()"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def train_epoch(model, opt, criterion, batch_size=50):\n",
" model.train()\n",
" losses = []\n",
" for beg_i in range(0, X.size(0), batch_size):\n",
" x_batch = X[beg_i:beg_i + batch_size, :]\n",
" y_batch = Y[beg_i:beg_i + batch_size, :]\n",
" x_batch = Variable(x_batch)\n",
" y_batch = Variable(y_batch)\n",
"\n",
" opt.zero_grad()\n",
" # (1) Forward\n",
" y_hat = net(x_batch)\n",
" # (2) Compute diff\n",
" loss = criterion(y_hat, y_batch)\n",
" # (3) Compute gradients\n",
" loss.backward()\n",
" # (4) update weights\n",
" opt.step() \n",
" losses.append(loss.data.numpy())\n",
" return losses"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x1136d2630>]"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4A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Qtfl7re6+2x3n0fm39Aj7v7uQtcFYGblZlaZfUymL7y+0LW5+z5gl5mdEiy6HNhQ6Lpy3MCRNk/2\n/QtZ107gDWZWFvz/vBzYOOp1jeRBldH8InOz91fIHPW+bZTf+x4y/boEmRHQB4ApZA4SbgZWAZNz\ntr8tqHMTcPUI1nURmV8ZXwCeD77eUujagDOBPwZ1rQduD5YX/GeW836XcuTgbsHrIjNjbV3w9VL2\n3/gYqe1sYE3w9/kLYNIYqascOABU5SwbC3V9msxAZz3wAzIzdka1Lp25KyISMuOl1SMiInlS8IuI\nhIyCX0QkZBT8IiIho+AXEQkZBb+ISMgo+EVEQkbBLyISMv8faupQ5DrFxiQAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x113519ef0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"e_losses = []\n",
"num_epochs = 20\n",
"for e in range(num_epochs):\n",
" e_losses += train_epoch(net, opt, criterion)\n",
"plt.plot(e_losses)"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Variable containing:\n",
"1.00000e-06 *\n",
" 6.6610\n",
"[torch.FloatTensor of size (1,1)]\n",
"\n",
"Variable containing:\n",
" 1.0000\n",
"[torch.FloatTensor of size (1,1)]\n",
"\n"
]
}
],
"source": [
"x_t = Variable(torch.randn(1, 50))\n",
"net.eval()\n",
"print(net(x_t))\n",
"x_1_t = Variable(torch.randn(1, 50) + 1.5)\n",
"print(net(x_1_t))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@sharmavaruns
Copy link

sharmavaruns commented May 27, 2019

Hello Santi, thank you for this code snippet! It really helped me start understanding how to implement pytorch for classification.

I wanted to point out an error in your code regarding the train_epoch function:

  1. for the Forward function call, you write:
    y_hat = net(x_batch)
    Where 'net' should actually be 'model' (since this was the argument passed into train_epoch function).
  2. It would be better if you actually had the argument X,Y defined as arguments in the train_epoch function rather than calling the global variables X and Y.

Anyway, thanks for putting this up!

@mnauf
Copy link

mnauf commented Sep 21, 2019

BCEWithLogitsLoss() expects logits as inputs and not probabilities, so you shouldnt do y = self.out_act(a3)

@mdja
Copy link

mdja commented Sep 27, 2020

BCEWithLogitsLoss() expects logits as inputs and not probabilities, so you shouldnt do y = self.out_act(a3)

But he's using BCELoss not BCEWithLogitsLoss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment