Kaggle competition: PUBG Finish Placement Prediction (Kernels Only)
<SOS> metric: MAE Kaggle data source: pubg-finish-placement-prediction-(kernels-only)<split>
%matplotlib inline
train = train_test.loc[:890, :]
test = train_test.loc[891:, :]<find_best_model_class>
train_data=pd.DataFrame(pd.read_csv('.. /input/pubg-finish-placement-prediction/train_V2.csv'))
test_data=pd.DataFrame(pd.read_csv('.. /input/pubg-finish-placement-prediction/test_V2.csv'))
train_data.info()
def model(classifier, train, test):
target = train['Survived'].values
features = train.drop(['PassengerId', 'Survived', 'Name', 'Ticket'], axis = 1 ).values
scores = cross_val_score(classifier, features, target, cv=5)
 print(f'Scores for 5 fold CV: {round(np.mean(scores*100)) }')
 classifier_ = classifier.fit(features, target)
 test = test.drop(['PassengerId', 'Survived', 'Name', 'Ticket'], axis = 1)
 predictions = classifier_.predict(test ).astype(int)
 return predictions<save_to_csv>
train_data.isnull().sum()
def submit(predictions):
submission = pd.read_csv('.. /input/gender_submission.csv')
 submission['Survived'] = predictions
submission.to_csv('submission.csv', index=False)
 return submission<choose_model_class>
train_data = train_data[train_data["winPlacePerc"].isna() != True]
classifier = linear_model.LogisticRegression(solver='liblinear')
 predictions = model(classifier, train, test )<choose_model_class>
y=train_data['winPlacePerc']
X = train_data.drop(['winPlacePerc','Id','groupId','matchId','matchType'],axis=1,inplace=False )
classifier = SVC(gamma='auto', kernel='linear')
 predictions = model(classifier, train, test )<choose_model_class>
X_train,X_valid,y_train,y_valid=train_test_split(X,y,train_size=0.8,test_size=0.2,random_state=0 )
classifier = DecisionTreeClassifier(random_state = 1, max_depth = 3)
 predictions = model(classifier, train, test )<choose_model_class>
matches_num = train_data.loc[:,"matchId"].nunique()
print("There are {} matches registered in our data.".format(matches_num))
classifier = GradientBoostingClassifier()
predictions = model(classifier, train, test )<choose_model_class>
match_types = train_data.loc[:,"matchType"].value_counts().to_frame().reset_index()
match_types.columns = ["Type","Count"]
match_types
classifier = KNeighborsClassifier(3)
 predictions = model(classifier, train, test )<choose_model_class>
x_test = test_data.drop(['Id','groupId','matchId','matchType'],axis=1 )
classifier = GaussianNB()
predictions = model(classifier, train, test )<choose_model_class>
model = xgb.XGBRegressor(max_depth=17, gamma=0.3, learning_rate= 0.1)
 model.fit(X_train,y_train )
classifier = AdaBoostClassifier()
predictions = model(classifier, train, test )<choose_model_class>
preds = model.predict(x_test )
<train_model><EOS> 
test_id = test_data["Id"]
submit_xgb = pd.DataFrame({'Id': test_id, "winPlacePerc": preds} , columns=['Id', 'winPlacePerc'])
 print(submit_xgb.head())
 submit_xgb.to_csv("submission.csv", index = False )