Kaggle competition: NBA Rookies
<SOS> metric: categorizationaccuracy Kaggle data source: nba-rookies<define_variables>
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import QuantileTransformer
from sklearn.decomposition import PCA
from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing import KernelCenterer
from sklearn import svm
cols_drop = ["pickup_datetimeDayofyear", "pickup_datetimeYear"]<drop_column>
data = pd.read_csv(".. /input/train.csv")
 test = pd.read_csv(".. /input/test.csv")
 submition = pd.read_csv(".. /input/sample_submission.csv" )
get_oob(X_train.drop(labels=cols_drop, axis=1))<save_model>
input_label = np.array(data.get('TARGET_5Yrs'))
data = data.drop(['PlayerID','Name','TARGET_5Yrs'] ,axis=1)
 data = data.fillna(data.mean())
 test = test.drop(['PlayerID','Name'] ,axis=1)
 test = test.fillna(test.mean() )
np.save(f'{PATH_TMP}features_keep.npy', np.array(X_train.columns))<load_pretrained>
quantile = QuantileTransformer(n_quantiles=3000)
 data[np.array(data.columns[:])] = quantile.fit_transform(data[np.array(data.columns[:])])
 test[np.array(test.columns[:])] = quantile.transform(test[np.array(test.columns[:])] )
features_keep = np.load(f'{PATH_TMP}features_keep.npy' )<train_model>
print('AdaBoost : {}'.format(adaboost_acc/5))
print('RandomForest : {}'.format(random_forest_acc/5))
print('ExtraRandomForest: {}'.format(extraRandom_acc/5))
print('SVM : {}'.format(svm_acc/5))
print('GradientBoostingClassifier : {}'.format(gradientBoosting_acc/5))
%%time
m = RandomForestRegressor(n_estimators=120, max_features=0.5, min_samples_leaf=3, n_jobs=-1, oob_score=True)
 m.fit(X_train, y_train)
 print_score(m )<prepare_x_and_y>
gradientBoosting_clf = GradientBoostingClassifier(n_estimators=350, learning_rate=.1,max_depth=1)
 gradientBoosting_clf.fit(data,input_label)
 gradientBoosting_given_labels = gradientBoosting_clf.predict(final )
df, y, _ = proc_df(df_raw, skip_flds=["key"], subset=None)
 df = df[features_keep].copy()
y = np.array([0]*df.shape[0])
 print(df.shape, y.shape )<split>
submition.iloc[:,1] = gradientBoosting_given_labels
<feature_engineering><EOS> 
submition.to_csv("submission_6.csv", index=False )