Skip to content

Commit

Permalink
Change place of weigths init
Browse files Browse the repository at this point in the history
  • Loading branch information
Всеволод Викулин authored and Всеволод Викулин committed Nov 3, 2018
1 parent 0090a7a commit 8454d10
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions 2018-09/hw3/hw3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
},
{
"cell_type": "code",
"execution_count": 130,
"execution_count": 2,
"metadata": {
"collapsed": true
},
Expand Down Expand Up @@ -538,9 +538,7 @@
" self.alpha = alpha\n",
" self.max_epoch = max_epoch\n",
" self.batch_generator = batch_generator\n",
" self.errors_log = {'iter' : [], 'loss' : []}\n",
" # Нужно инициализровать случайно веса\n",
" self.weights = None\n",
" self.errors_log = {'iter' : [], 'loss' : []} \n",
" \n",
" def calc_loss(self, X_batch, y_batch):\n",
" \"\"\"\n",
Expand Down Expand Up @@ -575,13 +573,15 @@
" y - вектор ответов\n",
" '''\n",
" \n",
" # Нужно инициализровать случайно веса\n",
" self.weights = None\n",
" for n in range(0, self.max_epoch):\n",
" new_epoch_generator = self.batch_generator()\n",
" for batch_num, new_batch in enumerate(new_epoch_generator):\n",
" X_batch = new_batch[0]\n",
" y_batch = new_batch[1]\n",
" batch_grad = self.calc_loss_grad(X_batch, y_batch)\n",
" self.update_weights(batch_error)\n",
" self.update_weights(batch_grad)\n",
" # Подумайте в каком месте стоит посчитать ошибку для отладки модели\n",
" # batch_loss = self.calc_loss(X_batch, y_batch)\n",
" self.errors_log['iter'].append(batch_num)\n",
Expand Down

0 comments on commit 8454d10

Please sign in to comment.