Little fix for python3 compatibility

Just changed print ... to be print(...) and xrange to range. Will work in Python 2 as well.
pull/14/head
Wei Ji 2017-07-17 20:36:52 +12:00
parent 6858cc1eaf
commit 009bd53b38
1 changed files with 2 additions and 2 deletions

View File

@ -405,7 +405,7 @@
" model = {}\n",
" \n",
" # Gradient descent. For each batch...\n",
" for i in xrange(0, num_passes):\n",
" for i in range(0, num_passes):\n",
"\n",
" # Forward propagation\n",
" z1 = X.dot(W1) + b1\n",
@ -439,7 +439,7 @@
" # Optionally print the loss.\n",
" # This is expensive because it uses the whole dataset, so we don't want to do it too often.\n",
" if print_loss and i % 1000 == 0:\n",
" print \"Loss after iteration %i: %f\" %(i, calculate_loss(model))\n",
" print(\"Loss after iteration %i: %f\" %(i, calculate_loss(model)))\n",
" \n",
" return model"
]