Skip to content

hw6 fix #27

Merged
merged 2 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions HW6/README.md
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 deletions HW6/problem_1_data.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

% part a
xa=[1 2 3 4 5]';
yb=[2.2 2.8 3.6 4.5 5.5]';
ya=[2.2 2.8 3.6 4.5 5.5]';

% part b

Expand All @@ -10,6 +10,6 @@

% part c

xc=[0.5 1 2 3 4 5 6 7 9];
yc=[6 4.4 3.2 2.7 2.2 1.9 1.7 1.4 1.1];
xc=[0.5 1 2 3 4 5 6 7 9]';
yc=[6 4.4 3.2 2.7 2.2 1.9 1.7 1.4 1.1]';

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
Original file line number Diff line number Diff line change
@@ -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.