text_plain_output_1.png
from sklearn.ensemble import RandomForestRegressor

from sklearn.ensemble import RandomForestRegressor

from sklearn.tree import DecisionTreeRegressor

from sklearn.tree import DecisionTreeRegressor

import pandas as pd

import pandas as pd

import pandas as pd

import pandas as pd
main_file_path = '../input/train.csv'
data = pd.read_csv(main_file_path)
sale_price_column = data.SalePrice
two_columns = ['Alley', 'LotShape']
two_columns_data = data[two_columns]

from sklearn.tree import DecisionTreeRegressor
import pandas as pd
main_file_path = '../input/train.csv'
data = pd.read_csv(main_file_path)
y = data.SalePrice
predictors = ['LotArea', 'YearBuilt', '1stFlrSF', '2ndFlrSF', 'FullBath', 'BedroomAbvGr', 'TotRmsAbvGrd']
x = data[predictors]
model = DecisionTreeRegressor()
model.fit(x, y)
model.predict(x.head())

import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
train = pd.read_csv('../input/train.csv')
train_y = train.SalePrice
predictor_cols = ['LotArea', 'OverallQual', 'YearBuilt', 'TotRmsAbvGrd']
train_X = train[predictor_cols]
my_model = RandomForestRegressor()
my_model.fit(train_X, train_y)
test = pd.read_csv('../input/test.csv')
test_x = test[predictor_cols]
predicted_prices = my_model.predict(test_x)

submission = DataFrame({'Id': test.Id, 'SalePrice': predicted_prices})
submission.to_csv('predictions_submission.csv', index=False)