Kaggle competition: Santander Customer Transaction Prediction
<SOS> metric: AUC Kaggle data source: santander-customer-transaction-prediction<groupby>
train_df = pd.read_csv(".. /input/train.csv")
 test_df = pd.read_csv(".. /input/test.csv")
 features = [x for x in train_df.columns if x.startswith("var")]
var_stats = {var:train_df[var].value_counts() for var in features}
<filter><EOS> 
pred = 0
for var in features:
model = lgb.LGBMClassifier(**{
'learning_rate':0.05, 'max_bin': 165, 'max_depth': 5, 'min_child_samples': 150,
'min_child_weight': 0.1, 'min_split_gain': 0.0018, 'n_estimators': 41,
'num_leaves': 6, 'reg_alpha': 2.0, 'reg_lambda': 2.54, 'objective': 'binary', 'n_jobs': -1})
 model = model.fit(np.hstack([train_df[var].values.reshape(-1,1),
train_df[var].map(var_stats[var] ).values.reshape(-1,1)]),
train_df["target"].values)
 X_test = np.hstack([test_df[var].values.reshape(-1,1),
test_df[var].map(var_stats[var] ).values.reshape(-1,1)])
 X_test[:,1] = X_test[:,1] + 1
X_test[:,1][np.isnan(X_test[:,1])] = 1
pred += logit(model.predict_proba(X_test)[:,1])
 pd.DataFrame({"ID_code":test_df["ID_code"], "target":pred} ).to_csv("submission.csv", index=False )