intercept, slope = simple_linear_regression(input_feature, output)
print(get_regression_predictions(2650, intercept, slope))

def get_residual_sum_of_squares(input_feature, output, intercept,slope):
    predict = get_regression_predictions(input_feature, intercept, slope)
    RSS = ((output-predict)**2).sum()
    return(RSS)

"""
Explanation: Using your Slope and Intercept from above, What is the predicted price for a house with 2650 sqft?
End of explanation
"""


print(get_residual_sum_of_squares(input_feature, output, intercept,slope))

def inverse_regression_predictions(output, intercept, slope):
    estimated_input=1.0*(output - intercept)/slope
    return(estimated_input)

"""
Explanation: According to this function and the slope and intercept  What is the RSS for the simple linear regression using squarefeet to predict prices on TRAINING data?
End of explanation
"""


inverse_regression_predictions(800000, intercept, slope)

print(intercept, slope)

"""
Explanation: According to this function and the regression slope and intercept from (3) what is the estimated square-feet for a house costing $800,000
End of explanation
"""


bedroom_slope, bedroom_intercept = simple_linear_regression(train_data['bedrooms'], train_data['price'])

bedroom_RSS = get_residual_sum_of_squares(test_data['bedrooms'], test_data['price'], bedroom_intercept,bedroom_slope)
print(bedroom_RSS)

sqft_slope, sqft_intercept = simple_linear_regression(train_data['sqft_living'], train_data['price'])
sqft_RSS = get_residual_sum_of_squares(test_data['sqft_living'], test_data['price'], intercept, slope)
print(sqft_RSS)

"""
Explanation: Which model (square feet or bedrooms) has lowest RSS on TEST data? Think about why this might be the case.
End of explanation
"""


