Skip to content

Commit 9775d81

Browse files
committedJan 25, 2016
fixed wrong variable in gradient and cross-entropy functions
1 parent e4012bf commit 9775d81

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
 

‎Session 3 - Classification.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
"# labels: Numpy array containing the true class labels\n",
357357
"# f: column vector of predictions (i.e. output of logistic function)\n",
358358
"def cross_entropy(labels, f):\n",
359-
" return np.sum(-1*np.multiply(class_labels,np.log(f)) - np.multiply((np.ones(N)-class_labels),np.log(np.ones(N)-f)))"
359+
" return np.sum(-1*np.multiply(labels,np.log(f)) - np.multiply((np.ones(N)-labels),np.log(np.ones(N)-f)))"
360360
]
361361
},
362362
{
@@ -388,7 +388,7 @@
388388
"# labels: Numpy array containing the true class labels\n",
389389
"# f: column vector of predictions (i.e. output of logistic function)\n",
390390
"def compute_Gradient(features, labels, f):\n",
391-
" return np.sum(np.multiply(f-class_labels,features),0)[np.newaxis].T"
391+
" return np.sum(np.multiply(f-labels,features),0)[np.newaxis].T"
392392
]
393393
},
394394
{
@@ -824,7 +824,7 @@
824824
"cell_type": "markdown",
825825
"metadata": {},
826826
"source": [
827-
"##<span style=\"color:red\">SURVEY (5 MINS):</span> https://www.surveymonkey.com/r/CD56YRB"
827+
"##<span style=\"color:red\">SURVEY (5 MINS):</span> "
828828
]
829829
},
830830
{
@@ -984,7 +984,7 @@
984984
"name": "python",
985985
"nbconvert_exporter": "python",
986986
"pygments_lexer": "ipython2",
987-
"version": "2.7.10"
987+
"version": "2.7.11"
988988
}
989989
},
990990
"nbformat": 4,

‎Solutions/Session 3 - Solutions.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401
"# labels: Numpy array containing the true class labels\n",
402402
"# f: column vector of predictions (i.e. output of logistic function)\n",
403403
"def cross_entropy(labels, f):\n",
404-
" return np.sum(-1*np.multiply(class_labels,np.log(f)) - np.multiply((np.ones(N)-class_labels),np.log(np.ones(N)-f)))"
404+
" return np.sum(-1*np.multiply(labels,np.log(f)) - np.multiply((np.ones(N)-labels),np.log(np.ones(N)-f)))"
405405
]
406406
},
407407
{
@@ -433,7 +433,7 @@
433433
"# labels: Numpy array containing the true class labels\n",
434434
"# f: column vector of predictions (i.e. output of logistic function)\n",
435435
"def compute_Gradient(features, labels, f):\n",
436-
" return np.sum(np.multiply(f-class_labels,features),0)[np.newaxis].T"
436+
" return np.sum(np.multiply(f-labels,features),0)[np.newaxis].T"
437437
]
438438
},
439439
{
@@ -1503,7 +1503,7 @@
15031503
"name": "python",
15041504
"nbconvert_exporter": "python",
15051505
"pygments_lexer": "ipython2",
1506-
"version": "2.7.10"
1506+
"version": "2.7.11"
15071507
}
15081508
},
15091509
"nbformat": 4,

0 commit comments

Comments
 (0)
Please sign in to comment.