application_vnd.jupyter.stderr_output_1.png
from sklearn.ensemble import RandomForestRegressor

from sklearn.ensemble import RandomForestRegressor

import pandas as pd

import pandas as pd

import pandas as pd

import pandas as pd
main_file_path = '../input/train.csv'
data_train = pd.read_csv(main_file_path)

predicators = ['YearBuilt', 'YrSold', 'TotalBsmtSF', 'LotShape', 'SaleType', 'SaleCondition']
one_hot_encoded_training_predictors = pd.get_dummies(predicators)
one_hot_encoded_training_predictors

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]
predict_prices = my_model.predict(test_X)

my_submission = pd.DataFrame({'Id': test.Id, 'SalePrice': predict_prices})
my_submission.to_csv('submission.csv', index=False)

import pandas as pd
train_data = pd.read_csv('../input/train.csv')
test_data = pd.read_csv('../input/test.csv')

train_data.dropna(axis=0, subset=['SalePrice'], inplace=True)
target = train_data.SalePrice
cols_with_missing = [col for col in train_data.columns if train_data[col].isnull().any()]
candidate_train_predictors = train_data.drop(['Id', 'SalePrice'] + cols_with_missing, axis=1)
candidate_test_predictors = test_data.drop(['Id'] + cols_with_missing, axis=1)
low_cardinality_cols = [cname for cname in candidate_train_predictors.columns if candidate_train_predictors[cname].nunique() < 10 and candidate_train_predictors[cname].dtype == 'object']
numeric_cols = [cname for cname in candidate_train_predictors.columns if candidate_train_predictors[cname].dtype in ['int64', 'float64']]
my_cols = low_cardinality_cols + numeric_cols
train_predictors = candidate_train_predictors[my_cols]
test_predictors = candidate_test_predictors[my_cols]
train_predictors.dtypes.sample(10)