Kaggle competition: PUBG Finish Placement Prediction (Kernels Only)
<SOS> metric: MAE Kaggle data source: pubg-finish-placement-prediction-(kernels-only)<count_values>
dataset_train = pd.read_csv('.. /input/train_V2.csv')
 dataset_test = pd.read_csv('.. /input/test_V2.csv' )
train_test_data = [train_df, test_df]
for dataset in train_test_data:
dataset['Title'] = dataset['Name'].str.extract('([A-Za-z]+)\.', expand=False)
 train_df['Title'].value_counts()<count_values>
dataset_train = dataset_train.dropna()
dataset_train = dataset_train.drop(labels=['Id','groupId','matchId'],axis=1 )
test_df['Title'].value_counts()<categorify>
dataset_train = pd.get_dummies(dataset_train,drop_first=True)
 dataset_train_y = dataset_train.loc[:,'winPlacePerc']
dataset_train_x = dataset_train.drop(labels='winPlacePerc',axis=1)
 scaler = StandardScaler()
dataset_train_x = scaler.fit_transform(dataset_train_x )
title_mapping = {"Mr": 0, "Miss": 1, "Mrs": 2,
"Master": 3, "Dr": 3, "Rev": 3, "Col": 3, "Major": 3, "Mlle": 3,"Countess": 3,
"Ms": 3, "Lady": 3, "Jonkheer": 3, "Don": 3, "Dona" : 3, "Mme": 3,"Capt": 3,"Sir": 3 }
for dataset in train_test_data:
dataset['Title'] = dataset['Title'].map(title_mapping )<drop_column>
reduceLr = ReduceLROnPlateau(monitor='loss', factor=0.01,patience=5, min_lr=0.00001)
 input_layer = InputLayer(input_shape =(39,))
model = Sequential()
model.add(input_layer)
 model.add(Dense(128,activation = "relu"))
model.add(Dense(256,activation = "relu"))
model.add(Dense(128,activation = "relu"))
model.add(Dense(256,activation = "relu"))
model.add(Dense(128,activation = "relu"))
model.add(Dense(1,activation='sigmoid'))
model.compile(optimizer = "adadelta",loss="binary_crossentropy",metrics=["mae","accuracy"])
 model.summary()
history = model.fit(dataset_train_x,dataset_train_y,epochs=10,batch_size= 5000,callbacks=[reduceLr] )
X_train_df = train_df.drop(columns=['Survived', 'PassengerId', 'Name', 'Ticket', 'Cabin'])
 X_test_df = test_df.drop(columns=['PassengerId', 'Name', 'Ticket', 'Cabin'] )<prepare_x_and_y>
dataset_test_id = dataset_test.loc[:,"Id"]
dataset_test = dataset_test.dropna()
dataset_test = dataset_test.drop(labels=['Id','groupId','matchId'],axis=1)
 dataset_test = pd.get_dummies(dataset_test,drop_first=True)
 display(dataset_test.head())
 scaler = StandardScaler()
dataset_test = scaler.fit_transform(dataset_test )
y_train_df = train_df['Survived']
y_test_df = test_df['PassengerId']<count_missing_values>
output = model.predict(dataset_test)
X_train_df.isnull().sum()<count_missing_values>
data_file = pd.DataFrame({"Id":dataset_test_id,"winPlacePerc":pd.Series(output.reshape(-1,)) } )
X_test_df.isnull().sum()<categorify>
data_file.to_csv("pubg_predictions.csv",index = False )