In [3]:
%matplotlib inline
import os
print os.getcwd()
try:
    from andrew_exercises.mlex1 import ex1_multi as ex
except:
    import ex1_multi as ex
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import axes3d, Axes3D
from matplotlib import cm
import itertools

feats, y, theta = ex.load_data()
ex.plot_data(feats, y)
X, mu, sigma = ex.normalize_features(feats)
theta_opt, J_history, theta_hist = ex.run_gradient_descent(X, y, theta)
ex.predict_house_sample(theta_opt, mu, sigma)
ex.plot_cost_convergence(J_history)
ex.plot_hipothesys_fit(feats, X, theta_opt)
show()


/home/tony/work/solo/octaveplay
loaded 47 training samples
The cost for theta=[0,0] is 65591548106.5
Gradient descent got us this optimum theta: 
[[ 340080.2253366 ]
 [ 105442.57184829]
 [  -1461.05303028]]
Predicted price for 1650 sqft, 3 bedrooms = 293878.045488