Esempio n. 1
0
########################################################################
##============= Part 2: Predicting with the model   ===================#
########################################################################

# Predict values for lower status percentage of 5% and 50%
# remember to multiply prediction by 10000 because median value is in 10000s

###########################################################################
#   TODO:                                                                 #
#   Predicted median value of a home with LSTAT = 5%                      #
#   Hint: call the predict method with the appropriate x                  #
#         One line of code expected; replace line pred_cost = 0           #
###########################################################################

<<<<<<< HEAD
pred_cost = linear_reg1.predict(np.array([1,5]))*10000
=======
pred_cost = 0
>>>>>>> 89dd6a53aa0ff700b713b57c5d8d001424557b1d
print 'For lower status percentage = 5, we predict a median home value of', pred_cost

###########################################################################
#   TODO:                                                                 #
#   Predicted median value of a home with LSTAT = 50%                     #
#      One line of code expected, replace pred_cost = 0                   #
###########################################################################

<<<<<<< HEAD
pred_cost = linear_reg1.predict(np.array([1,50]))*10000
=======
pred_cost = 0
Esempio n. 2
0
########################################################################
##============= Part 2: Predicting with the model   ===================#
########################################################################

# Predict values for lower status percentage of 5% and 50%
# remember to multiply prediction by 10000 because median value is in 10000s

###########################################################################
#   TODO:                                                                 #
#   Predicted median value of a home with LSTAT = 5%                      #
#   Hint: call the predict method with the appropriate x                  #
#         One line of code expected; replace line pred_cost = 0           #
###########################################################################

pred_cost = linear_reg1.predict(np.asarray
	(filter((lambda x: x[1] < 5), XX)))
pred_cost.sort()
print pred_cost
print 'For lower status percentage = 5, we predict a median home value of', pred_cost[0,len(pred_cost)/2] * 10000

###########################################################################
#   TODO:                                                                 #
#   Predicted median value of a home with LSTAT = 50%                     #
#      One line of code expected, replace pred_cost = 0                   #
###########################################################################

pred_cost = linear_reg1.predict(np.asarray
	(filter((lambda x: x[1] < 50), XX)))
pred_cost.sort()
print 'For lower status percentage = 50, we predict a median home value of',pred_cost[0, len(pred_cost/2)] * 10000