text_plain_output_1.png
from sklearn.metrics import mean_absolute_error

from sklearn.model_selection import train_test_split

from sklearn.tree import DecisionTreeRegressor

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())

from sklearn.model_selection import train_test_split
train_x, val_x, train_y, val_y = train_test_split(x, y, random_state=0)
data_model = DecisionTreeRegressor()
data_model.fit(train_x, train_y)
val_predictions = data_model.predict(val_x)
print(mean_absolute_error(val_y, val_predictions))