ex4, up to before gradient checking
Ex4 done