Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix HW6 gradient of cost equation
  • Loading branch information
rcc02007 committed Apr 10, 2017
1 parent 8db16c4 commit ee2c3e2
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 2 deletions.
6 changes: 4 additions & 2 deletions HW6/README.md
Expand Up @@ -34,12 +34,14 @@ variable is failure (1=fail, 0=pass). Create a function called `cost_logistic.m`
takes the vector `a`, and independent variable `x` and dependent variable `y`. Use the
function, $\sigma(t)=\frac{1}{1+e^{-t}}$ where $t=a_{0}+a_{1}x$. Use the cost function,

$J(a_{0},a_{1})=\sum_{i=1}^{n}\left[-y_{i}\log(\sigma(t_{i}))-(1-y_{i})\log((1-\sigma(t_{i})))\right]$
$J(a_{0},a_{1})=1/m\sum_{i=1}^{n}\left[-y_{i}\log(\sigma(t_{i}))-(1-y_{i})\log((1-\sigma(t_{i})))\right]$

and gradient

$\frac{\partial J}{\partial a_{i}}=
1/m\sum_{k=1}^{N}\left(\sigma(t_{k})-y_{k}\right)t_{k}$
1/m\sum_{k=1}^{N}\left(\sigma(t_{k})-y_{k}\right)x_{k}^{i}$

where $x_{k}^{i} is the k-th value of temperature raised to the i-th power (0, and 1)

a. edit `cost_logistic.m` so that the output is `[J,grad]` or [cost, gradient]

Expand Down
Binary file modified lecture_17/octave-workspace
Binary file not shown.
Binary file modified lecture_18/octave-workspace
Binary file not shown.
Binary file modified lecture_19/octave-workspace
Binary file not shown.
Binary file added lecture_20/octave-workspace
Binary file not shown.
6 changes: 6 additions & 0 deletions lecture_21/.ipynb_checkpoints/lecture_21-checkpoint.ipynb
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
430 changes: 430 additions & 0 deletions lecture_21/lecture_21.ipynb

Large diffs are not rendered by default.

Binary file added lecture_21/q1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lecture_21/q2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lecture_21/reduce_noise.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ee2c3e2

Please sign in to comment.