Kaggle competition: PUBG Finish Placement Prediction (Kernels Only)
len(train_data[train_data.SalePrice>600000] )<filter>
train = pd.read_csv(".. /input/train_V2.csv")
 test = pd.read_csv(".. /input/test_V2.csv")
 display(train.head())
 display(test.head() )
train_data = train_data[train_data.SalePrice<600000]<set_options>
display('matchId category count={}'.format(train['matchId'].nunique()))
display('groupId category count={}'.format(train['groupId'].nunique()))
display('matchType category count={}'.format(train['matchType'].nunique()))
matchId = train['matchId'].value_counts()
groupId = train['groupId'].value_counts()
matchType = train['matchType'].value_counts()
scipy.stats.skew(train_data.SalePrice.dropna() )<feature_engineering>
train.isnull().sum()
train_data['tmpPrice']=np.log1p(train_data.SalePrice )<feature_engineering>
train[train['winPlacePerc'].isnull() ]
tmpPriceMean = train_data['tmpPrice'].mean()
train_data['tmpPrice'] = train_data['tmpPrice']<predict_on_test>
train = train.dropna()
quick_predict(train_data.drop(['SalePrice','tmpPrice'],axis=1),train_data.tmpPrice )<drop_column>
matchType_categories = pd.get_dummies(train[['matchType']])
 matchType_categories.head()
test_matchType_categories = pd.get_dummies(test[['matchType']])
 test_Id = test['Id']
train_drop = train.drop(['Id','groupId','matchId','matchType'], axis=1)
 train_drop = pd.merge(train_drop, matchType_categories, left_index=True, right_index=True)
 test_drop = test.drop(['Id','groupId','matchId','matchType'], axis=1)
 test_drop = pd.merge(test_drop, test_matchType_categories, left_index=True, right_index=True )
train_data.set_index(train_data.Id,drop=True, inplace=True)
 train_data = train_data.drop(['Id'],axis=1)
 test_data.set_index(test_data.Id,drop=True, inplace=True)
 test_data = test_data.drop(['Id'],axis=1 )<concatenate>
y_train = train_drop['winPlacePerc']
X_train = train_drop.drop(['winPlacePerc'], axis=1)
data=pd.concat([train_data,test_data],keys=['train','test'], join='inner' )<data_type_conversions>
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, train_size=0.25, random_state=1 )
data[['Alley','BsmtQual','BsmtCond','BsmtExposure','BsmtFinType1','BsmtFinType2',
'FireplaceQu','GarageType','GarageFinish','GarageQual','GarageCond',
'PoolQC','Fence','MiscFeature']]=data[['Alley','BsmtQual','BsmtCond','BsmtExposure','BsmtFinType1','BsmtFinType2',
'FireplaceQu','GarageType','GarageFinish','GarageQual','GarageCond',
'PoolQC','Fence','MiscFeature']].fillna(value="NA" )<count_missing_values>
data.isna().sum() [lambda x: x>0]<filter>
exported_pipeline = make_pipeline(
 make_union(
 FunctionTransformer(copy),
StackingEstimator(estimator=LassoLarsCV(normalize=False)) 
),
GradientBoostingRegressor(alpha=0.9, learning_rate=0.1, loss="huber", max_depth=8, max_features=0.55, min_samples_leaf=16, min_samples_split=12, n_estimators=100, subsample=1.0)
)
data[data.MSZoning.isna() ]<count_values>
exported_pipeline.fit(X_train,y_train)
 test_predict = exported_pipeline.predict(test_drop )
data[data.Neighborhood=="Mitchel"].MSZoning.value_counts()<count_values>
submission = pd.DataFrame({
"Id": test_Id,
"winPlacePerc": test_predict
})
 submission.to_csv('submission2.csv', index=False )