Kaggle competition: House Prices - Advanced Regression Techniques
<SOS> metric: rmsle Kaggle data source: house-prices-advanced-regression-techniques<filter>
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import skew
from sklearn.preprocessing import LabelEncoder
import lightgbm as lgb
train_data[train_data['Transmission']=='Manual']<rename_columns>
submission = pd.read_csv('/kaggle/input/house-prices-advanced-regression-techniques/sample_submission.csv')
 submission.head()
train_data['Transmission'].replace("Manual","MANUAL",inplace=True )<count_values>
train = pd.read_csv('/kaggle/input/house-prices-advanced-regression-techniques/train.csv')
 train.head()
train_data['Transmission'].value_counts()<data_type_conversions>
test = pd.read_csv('/kaggle/input/house-prices-advanced-regression-techniques/test.csv')
 test.head()
train_data['Transmission'].fillna(value="Transmission_unk",inplace=True)
 test_data['Transmission'].fillna(value="Transmission_unk",inplace=True )<count_values>
print('=========== train infomation ===========')
 train.info()
print('
=========== test infomation ===========')
 test.info()
train_data['WheelTypeID'].value_counts()<drop_column>
data = pd.concat([train, test])
 data.shape
train_data.drop('WheelTypeID',inplace=True,axis=1)
 test_data.drop('WheelTypeID',inplace=True,axis=1 )<count_values>
numerics = data.loc[:,data.dtypes != 'object'].drop('Id', axis=1)
 numerics.head()
train_data['WheelType'].value_counts()<count_values>
log_numerics = np.log1p(numerics)
 log_numerics.head()
test_data['WheelType'].value_counts()<data_type_conversions>
cat_data = pd.get_dummies(data.loc[:, cat_cols], drop_first=True)
 cat_data.head()
train_data['WheelType'].fillna(value='WheelType_unk',inplace=True)
 test_data['WheelType'].fillna(value='WheelType_unk',inplace=True )<count_values>
optimized_data = pd.concat([data['Id'], cat_data, log_numerics], axis=1)
 optimized_data.head()
train_data['WheelType'].value_counts()<count_values>
train = optimized_data[:train.shape[0]]
test = optimized_data[train.shape[0]:].drop(['Id', 'SalePrice'], axis=1)
 X_train = train.drop(['Id', 'SalePrice'], axis=1)
 y_train = train['SalePrice']
train_data['Nationality'].value_counts()<count_values>
lgb_train = lgb.Dataset(X_train, y_train)
 params = {
'objective' : 'regression',
'metric' : {'rmse'}
}
gbm = lgb.train(params, lgb_train)
 pred = gbm.predict(test )
<data_type_conversions><EOS> 
pred = np.expm1(pred)
 results = pd.Series(pred, name='SalePrice')
 submission = pd.concat([submission['Id'], results], axis=1)
 submission.to_csv('submission.csv', index=False)
 submission.head()