Kaggle competition: Santander Customer Transaction Prediction
<SOS> metric: AUC Kaggle data source: santander-customer-transaction-prediction<categorify>
! pip install gpyopt
question2.quest_pct = question2.quest_pct.mask(( question2['count'] < 3),.65)
 question2.quest_pct = question2.quest_pct.mask(( question2.quest_pct <.2)&(question2['count'] < 21),.2)
 question2.quest_pct = question2.quest_pct.mask(( question2.quest_pct >.95)&(question2['count'] < 21),.95 )<merge>
import time
from sklearn.model_selection import StratifiedKFold
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import cross_val_score
from imblearn.over_sampling import ADASYN
from collections import Counter
import lightgbm as lgb
from datetime import datetime
from numba import jit
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras import optimizers
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
import GPyOpt
X = pd.merge(X, question2, left_on = 'content_id', right_on = 'question_id', how = 'left')
 validation = pd.merge(validation, question2, left_on = 'content_id', right_on = 'question_id', how = 'left')
 X.part = X.part - 1
validation.part = validation.part - 1<prepare_x_and_y>
train_data = pd.read_csv('.. /input/1-stats-k3/train_milos.csv')
 test_data = pd.read_csv('.. /input/1-stats-k3/test_milos.csv')
 sample_submission = pd.read_csv('.. /input/1-stats-k3/sample_submission.csv')
 print('Training data shape: ', train_data.shape)
 print('Testing data shape: ', test_data.shape )
y = X['answered_correctly']
X = X.drop(['answered_correctly'], axis=1)
 X.head()
y_val = validation['answered_correctly']
X_val = validation.drop(['answered_correctly'], axis=1 )<drop_column>
original_features = train_data.drop(columns=['ID_code', 'target'])
 testing_features = test_data.drop(columns=['ID_code'])
 original_targets = train_data.filter(items=['target'] )
X = X[['answered_correctly_user', 'explanation_mean_user', 'quest_pct', 'avg_questions_seen',
'prior_question_elapsed_time','prior_question_had_explanation_enc', 'part',
'part_1', 'part_2', 'part_3', 'part_4', 'part_5', 'part_6', 'part_7',
'type_of_concept', 'type_of_intention', 'type_of_solving_question', 'type_of_starter',
'part_1_boolean', 'part_2_boolean', 'part_3_boolean', 'part_4_boolean', 'part_5_boolean', 'part_6_boolean', 'part_7_boolean',
'type_of_concept_boolean', 'type_of_intention_boolean', 'type_of_solving_question_boolean', 'type_of_starter_boolean']]
X_val = X_val[['answered_correctly_user', 'explanation_mean_user', 'quest_pct', 'avg_questions_seen',
'prior_question_elapsed_time','prior_question_had_explanation_enc', 'part',
'part_1', 'part_2', 'part_3', 'part_4', 'part_5', 'part_6', 'part_7',
'type_of_concept', 'type_of_intention', 'type_of_solving_question', 'type_of_starter',
'part_1_boolean', 'part_2_boolean', 'part_3_boolean', 'part_4_boolean', 'part_5_boolean', 'part_6_boolean', 'part_7_boolean',
'type_of_concept_boolean', 'type_of_intention_boolean', 'type_of_solving_question_boolean', 'type_of_starter_boolean']]<categorify>
def augment(train, target, num_n=1, num_p=2):
newtrain=[train]
newtarget=[target]
n=train[target==0]
z=target[target==0]
for i in range(num_n):
random_state = np.random.permutation(len(n))
newtrain.append(n.apply(lambda x:x.values.take(random_state)))
 newtarget.append(z.apply(lambda x:x.values.take(random_state)))
 for i in range(num_p):
p=train[target>0]
o=target[target>0]
random_state = np.random.permutation(len(p))
newtrain.append(p.apply(lambda x:x.values.take(random_state)))
 newtarget.append(o.apply(lambda x:x.values.take(random_state)))
 return pd.concat(newtrain), pd.concat(newtarget )
X['answered_correctly_user'].fillna(0.65, inplace=True)
 X['explanation_mean_user'].fillna(prior_mean_user, inplace=True)
 X['quest_pct'].fillna(content_mean, inplace=True)
 X['part'].fillna(4, inplace = True)
 X['avg_questions_seen'].fillna(1, inplace = True)
 X['prior_question_elapsed_time'].fillna(elapsed_mean, inplace = True)
 X['prior_question_had_explanation_enc'].fillna(0, inplace = True)
 X['part_1'].fillna(0, inplace = True)
 X['part_2'].fillna(0, inplace = True)
 X['part_3'].fillna(0, inplace = True)
 X['part_4'].fillna(0, inplace = True)
 X['part_5'].fillna(0, inplace = True)
 X['part_6'].fillna(0, inplace = True)
 X['part_7'].fillna(0, inplace = True)
 X['type_of_concept'].fillna(0, inplace = True)
 X['type_of_intention'].fillna(0, inplace = True)
 X['type_of_solving_question'].fillna(0, inplace = True)
 X['type_of_starter'].fillna(0, inplace = True)
 X['part_1_boolean'].fillna(0, inplace = True)
 X['part_2_boolean'].fillna(0, inplace = True)
 X['part_3_boolean'].fillna(0, inplace = True)
 X['part_4_boolean'].fillna(0, inplace = True)
 X['part_5_boolean'].fillna(0, inplace = True)
 X['part_6_boolean'].fillna(0, inplace = True)
 X['part_7_boolean'].fillna(0, inplace = True)
 X['type_of_concept_boolean'].fillna(0, inplace = True)
 X['type_of_intention_boolean'].fillna(0, inplace = True)
 X['type_of_solving_question_boolean'].fillna(0, inplace = True)
 X['type_of_starter_boolean'].fillna(0, inplace = True )<data_type_conversions>
def augment_fast(x,y,t=2):
xs,xn = [],[]
for i in range(t):
mask = y>0
mask = mask[:,0]
x1 = x[mask,:].copy()
ids = np.arange(x1.shape[0])
 for p in range(x1.shape[1]):
np.random.shuffle(ids)
 x1[:,p] = x1[ids][:,p]
xs.append(x1)
 for i in range(t//2):
mask = y==0
mask = mask[:,0]
x1 = x[mask, :].copy()
ids = np.arange(x1.shape[0])
 for n in range(x1.shape[1]):
np.random.shuffle(ids)
 x1[:,n] = x1[ids][:,n]
xn.append(x1)
 xs = np.vstack(xs)
 xn = np.vstack(xn)
 ys = np.ones(xs.shape[0])
 yn = np.zeros(xn.shape[0])
 x = np.vstack([x,xs,xn])
 y = np.concatenate([y[:,0],ys,yn])
 return x,y
X_val['answered_correctly_user'].fillna(0.65, inplace=True)
 X_val['explanation_mean_user'].fillna(prior_mean_user, inplace=True)
 X_val['quest_pct'].fillna(content_mean, inplace=True)
 X_val['part'].fillna(4, inplace = True)
 X_val['avg_questions_seen'].fillna(1, inplace = True)
 X_val['prior_question_elapsed_time'].fillna(elapsed_mean, inplace = True)
 X_val['prior_question_had_explanation_enc'].fillna(0, inplace = True)
 X_val['part_1'].fillna(0, inplace = True)
 X_val['part_2'].fillna(0, inplace = True)
 X_val['part_3'].fillna(0, inplace = True)
 X_val['part_4'].fillna(0, inplace = True)
 X_val['part_5'].fillna(0, inplace = True)
 X_val['part_6'].fillna(0, inplace = True)
 X_val['part_7'].fillna(0, inplace = True)
 X_val['type_of_concept'].fillna(0, inplace = True)
 X_val['type_of_intention'].fillna(0, inplace = True)
 X_val['type_of_solving_question'].fillna(0, inplace = True)
 X_val['type_of_starter'].fillna(0, inplace = True)
 X_val['part_1_boolean'].fillna(0, inplace = True)
 X_val['part_2_boolean'].fillna(0, inplace = True)
 X_val['part_3_boolean'].fillna(0, inplace = True)
 X_val['part_4_boolean'].fillna(0, inplace = True)
 X_val['part_5_boolean'].fillna(0, inplace = True)
 X_val['part_6_boolean'].fillna(0, inplace = True)
 X_val['part_7_boolean'].fillna(0, inplace = True)
 X_val['type_of_concept_boolean'].fillna(0, inplace = True)
 X_val['type_of_intention_boolean'].fillna(0, inplace = True)
 X_val['type_of_solving_question_boolean'].fillna(0, inplace = True)
 X_val['type_of_starter_boolean'].fillna(0, inplace = True )<create_dataframe>
training_features = original_features
training_targets = original_targets
params = {
'objective': 'binary',
'boosting' : 'gbdt',
'max_bin': 800,
'learning_rate': 0.0175,
'num_leaves': 80
}
lgb_train = lgb.Dataset(X, y, categorical_feature = ['part', 'prior_question_had_explanation_enc'])
 lgb_eval = lgb.Dataset(X_val, y_val, categorical_feature = ['part', 'prior_question_had_explanation_enc'], reference=lgb_train )<train_model>
simple_aug = False
model = lgb.train(
 params, lgb_train,
valid_sets=[lgb_train, lgb_eval],
verbose_eval=50,
num_boost_round=10000,
early_stopping_rounds=12
)<compute_train_metric>
print('Training feature shape: ', training_features.shape)
 print('Training targe shape: ', training_targets.shape)
 print('Testing targe shape: ', testing_features.shape )
y_pred = model.predict(X_val)
 y_true = np.array(y_val)
 roc_auc_score(y_true, y_pred )<import_modules>
param = {
'bagging_freq': 5,
'bagging_fraction': 0.335,
'boost_from_average':'false',
'boost': 'gbdt',
'feature_fraction': 0.041,
'learning_rate': 0.1,
'max_depth': -1,
'metric':'auc',
'min_data_in_leaf': 80,
'min_sum_hessian_in_leaf': 10.0,
'num_leaves': 13,
'num_threads': -1,
'tree_learner': 'serial',
'objective': 'binary',
'verbosity': -1
}
import matplotlib.pyplot as plt
import seaborn as sns<split>
%%time
result=np.zeros(testing_features.shape[0])
 skf = StratifiedKFold(n_splits=5, random_state=None)
 for counter,(train_index, valid_index)in enumerate(skf.split(training_features, training_targets),1):
print(counter)
 X_train, y_train = training_features.iloc[train_index], training_targets.iloc[train_index]
X_valid, y_valid = training_features.iloc[valid_index], training_targets.iloc[valid_index]
if simple_aug:
X_train, y_train = augment_fast(X_train.values, y_train.values)
 X_train = pd.DataFrame(X_train)
 print("Augmenation done!")
 lgb_train = lgb.Dataset(X_train, label=y_train)
 lgb_val = lgb.Dataset(X_valid, label=y_valid)
 model_lgb = lgb.train(param, lgb_train, 1000, valid_sets = [lgb_train, lgb_val], verbose_eval=20, early_stopping_rounds = 50)
 result += model_lgb.predict(testing_features, num_iteration=model_lgb.best_iteration )
iter_test = env.iter_test()<merge>
submission_lgb = sample_submission.copy()
submission_lgb['target'] = result/counter
filename="{:%Y-%m-%d_%H_%M}_lgb.csv".format(datetime.now())
 submission_lgb.to_csv(filename, index=False )
for(test_df, sample_prediction_df)in iter_test:
test_df['task_container_id'] = test_df.task_container_id.mask(test_df.task_container_id > 9999, 9999)
 test_df = pd.merge(test_df, group3, left_on=['task_container_id'], right_index= True, how="left")
 test_df = pd.merge(test_df, question2, left_on = 'content_id', right_on = 'question_id', how = 'left')
 test_df = pd.merge(test_df, results_u_final, on=['user_id'], how="left")
 test_df = pd.merge(test_df, results_u2_final, on=['user_id'], how="left")
 test_df = pd.merge(test_df, user_lecture_stats_part, on=['user_id'], how="left")
 test_df['part_1'].fillna(0, inplace = True)
 test_df['part_2'].fillna(0, inplace = True)
 test_df['part_3'].fillna(0, inplace = True)
 test_df['part_4'].fillna(0, inplace = True)
 test_df['part_5'].fillna(0, inplace = True)
 test_df['part_6'].fillna(0, inplace = True)
 test_df['part_7'].fillna(0, inplace = True)
 test_df['type_of_concept'].fillna(0, inplace = True)
 test_df['type_of_intention'].fillna(0, inplace = True)
 test_df['type_of_solving_question'].fillna(0, inplace = True)
 test_df['type_of_starter'].fillna(0, inplace = True)
 test_df['part_1_boolean'].fillna(0, inplace = True)
 test_df['part_2_boolean'].fillna(0, inplace = True)
 test_df['part_3_boolean'].fillna(0, inplace = True)
 test_df['part_4_boolean'].fillna(0, inplace = True)
 test_df['part_5_boolean'].fillna(0, inplace = True)
 test_df['part_6_boolean'].fillna(0, inplace = True)
 test_df['part_7_boolean'].fillna(0, inplace = True)
 test_df['type_of_concept_boolean'].fillna(0, inplace = True)
 test_df['type_of_intention_boolean'].fillna(0, inplace = True)
 test_df['type_of_solving_question_boolean'].fillna(0, inplace = True)
 test_df['type_of_starter_boolean'].fillna(0, inplace = True)
 test_df['answered_correctly_user'].fillna(0.65, inplace=True)
 test_df['explanation_mean_user'].fillna(prior_mean_user, inplace=True)
 test_df['quest_pct'].fillna(content_mean, inplace=True)
 test_df['part'] = test_df.part - 1
test_df['part'].fillna(4, inplace = True)
 test_df['avg_questions_seen'].fillna(1, inplace = True)
 test_df['prior_question_elapsed_time'].fillna(elapsed_mean, inplace = True)
 test_df['prior_question_had_explanation'].fillna(False, inplace=True)
 test_df["prior_question_had_explanation_enc"] = lb_make.fit_transform(test_df["prior_question_had_explanation"])
 test_df['answered_correctly'] = model.predict(test_df[['answered_correctly_user', 'explanation_mean_user', 'quest_pct', 'avg_questions_seen',
'prior_question_elapsed_time','prior_question_had_explanation_enc', 'part',
'part_1', 'part_2', 'part_3', 'part_4', 'part_5', 'part_6', 'part_7',
'type_of_concept', 'type_of_intention', 'type_of_solving_question', 'type_of_starter',
'part_1_boolean', 'part_2_boolean', 'part_3_boolean', 'part_4_boolean', 'part_5_boolean', 'part_6_boolean', 'part_7_boolean',
'type_of_concept_boolean', 'type_of_intention_boolean', 'type_of_solving_question_boolean', 'type_of_starter_boolean']])
 env.predict(test_df.loc[test_df['content_type_id'] == 0, ['row_id', 'answered_correctly']] )<load_from_csv>
scaler = MinMaxScaler()
scaler.fit(training_features)
 training_features_scaled = pd.DataFrame(scaler.transform(training_features))
testing_features_scaled = pd.DataFrame(scaler.transform(testing_features))
train = pd.read_csv('.. /input/siim-isic-melanoma-classification/train.csv')
 print('Examples WITH Melanoma')
 imgs = train.loc[train.target==1].sample(10 ).image_name.values
plt.figure(figsize=(20,8))
for i,k in enumerate(imgs):
img = cv2.imread('.. /input/jpeg-melanoma-128x128/train/%s.jpg'%k)
 img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
 plt.subplot(2,5,i+1); plt.axis('off')
 plt.imshow(img)
 plt.show()
print('Examples WITHOUT Melanoma')
 imgs = train.loc[train.target==0].sample(10 ).image_name.values
plt.figure(figsize=(20,8))
for i,k in enumerate(imgs):
img = cv2.imread('.. /input/jpeg-melanoma-128x128/train/%s.jpg'%k)
 img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
 plt.subplot(2,5,i+1); plt.axis('off')
 plt.imshow(img)
 plt.show()<install_modules>
def create_model() :
model = Sequential()
model.add(Dense(2**12, activation='relu', input_dim=training_features.shape[1]))
model.add(Dropout(rate=0.5))
model.add(Dense(2**8, activation='relu'))
model.add(Dropout(rate=0.4))
model.add(Dense(2**6, activation='linear'))
model.add(Dropout(rate=0.1))
model.add(Dense(2**4, activation='linear'))
model.add(Dense(1, activation='sigmoid'))
my_opt = optimizers.Adam(lr=0.001, beta_1=0.995, beta_2=0.99999, epsilon=0.01, decay=1e-6, amsgrad=True)
 model.compile(optimizer=my_opt,
loss='binary_crossentropy',
metrics=['binary_accuracy'])
 return model
!pip install -q efficientnet >> /dev/null<import_modules>
model_ann = create_model()
result_ann=np.zeros(testing_features.shape[0])
 skf = StratifiedKFold(n_splits=2, random_state=None)
 for counter,(train_index, valid_index)in enumerate(skf.split(training_features_scaled, training_targets),1):
print(counter)
 X_train, y_train = training_features_scaled.iloc[train_index], training_targets.iloc[train_index]
X_valid, y_valid = training_features_scaled.iloc[valid_index], training_targets.iloc[valid_index]
if simple_aug:
X_train, y_train = augment_fast(X_train.values, y_train.values)
 X_train = pd.DataFrame(X_train)
 print("Augmenation done!")
 es = EarlyStopping(monitor='val_binary_accuracy', mode='auto', verbose=0, patience=50)
 cp = ModelCheckpoint(filepath='/best_weights_'+str(counter)+'_.hdf5', verbose=1, save_best_only=True)
 model_ann.fit(X_train, y_train, batch_size=2**8, epochs=1000, validation_data=(X_valid, y_valid), callbacks=[es, cp], verbose=1)
 model_best = create_model()
model_best.load_weights('/best_weights_'+str(counter)+'_.hdf5')
 result_ann += model_best.predict(testing_features_scaled)[:,0]
import pandas as pd, numpy as np
from kaggle_datasets import KaggleDatasets
import tensorflow as tf, re, math
import tensorflow.keras.backend as K
import efficientnet.tfkeras as efn
from sklearn.model_selection import KFold
from sklearn.metrics import roc_auc_score
import matplotlib.pyplot as plt<define_variables>
submission_ann = sample_submission.copy()
submission_ann['target'] = result/counter
filename="{:%Y-%m-%d_%H_%M}_ann.csv".format(datetime.now())
 submission_ann.to_csv(filename, index=False )
DEVICE = "TPU"
SEED = 42
FOLDS = 5
IMG_SIZES = [512,512,512,512,512]
INC2019 = [1,1,1,1,1]
INC2018 = [0,0,0,0,0]
BATCH_SIZES = [32]*FOLDS
EPOCHS = [12]*FOLDS
EFF_NETS = [3,3,3,3,3]
WGTS = [1/FOLDS]*FOLDS
TTA = 11<choose_model_class>
%%time
result_gnb=np.zeros(testing_features.shape[0])
 skf = StratifiedKFold(n_splits=5, random_state=None)
 for counter,(train_index, valid_index)in enumerate(skf.split(training_features, training_targets),1):
print(counter)
 X_train, y_train = training_features.iloc[train_index], training_targets.iloc[train_index]
X_valid, y_valid = training_features.iloc[valid_index], training_targets.iloc[valid_index]
if simple_aug:
X_train, y_train = augment_fast(X_train.values, y_train.values)
 X_train = pd.DataFrame(X_train)
 print("Augmenation done!")
 skf_inner = StratifiedKFold(n_splits=4, random_state=None)
 def ml_fun(parameters):
parameters = parameters[0]
score = -cross_val_score(GaussianNB(priors=None, var_smoothing = parameters[0]),
X_train, y_train, cv=skf_inner.split(X_train, y_train), scoring='roc_auc', n_jobs=-1 ).mean()
score = np.array(score)
 return score
bounds = [
{'name': 'var_smoothing', 'type': 'continuous', 'domain':(1e-11, 1e-7)}
]
optimizer = GPyOpt.methods.BayesianOptimization(f=ml_fun, domain=bounds,
acquisition_type ='MPI',
exact_eval=True)
 optimizer.run_optimization(1e2, 1e3, verbosity=True)
 gnb = GaussianNB(priors=None, var_smoothing = optimizer.x_opt[0] ).fit(X_train, y_train)
 GaussNB_val_proba = gnb.predict_proba(X_valid)
 fpr_keras, tpr_keras, thresholds_keras = roc_curve(y_valid, GaussNB_val_proba[:, 1])
 print("GaussianNB validation {d}: {:.5f}".format(counter, auc(fpr_keras, tpr_keras)))
 result_gnb += gnb.predict_proba(testing_features )
if DEVICE == "TPU":
print("connecting to TPU...")
 try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
print('Running on TPU ', tpu.master())
 except ValueError:
print("Could not connect to TPU")
 tpu = None
if tpu:
try:
print("initializing TPU...")
 tf.config.experimental_connect_to_cluster(tpu)
 tf.tpu.experimental.initialize_tpu_system(tpu)
 strategy = tf.distribute.experimental.TPUStrategy(tpu)
 print("TPU initialized")
 except _:
print("failed to initialize TPU")
 else:
DEVICE = "GPU"
if DEVICE != "TPU":
print("Using default strategy for CPU and single GPU")
 strategy = tf.distribute.get_strategy()
if DEVICE == "GPU":
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
 AUTO = tf.data.experimental.AUTOTUNE
REPLICAS = strategy.num_replicas_in_sync
print(f'REPLICAS: {REPLICAS}' )<feature_engineering>
submission_gnb = sample_submission.copy()
submission_gnb['target'] = result_gnb/counter
filename="{:%Y-%m-%d_%H_%M}_gbn.csv".format(datetime.now())
 submission_gnb.to_csv(filename, index=False )
GCS_PATH = [None]*FOLDS; GCS_PATH2 = [None]*FOLDS
for i,k in enumerate(IMG_SIZES[:FOLDS]):
GCS_PATH[i] = KaggleDatasets().get_gcs_path('melanoma-%ix%i'%(k,k))
GCS_PATH2[i] = KaggleDatasets().get_gcs_path('isic2019-%ix%i'%(k,k))
files_train = np.sort(np.array(tf.io.gfile.glob(GCS_PATH[0] + '/train*.tfrec')))
 files_test = np.sort(np.array(tf.io.gfile.glob(GCS_PATH[0] + '/test*.tfrec')) )<define_variables>
%%time
result_LogR=np.zeros(testing_features.shape[0])
 skf = StratifiedKFold(n_splits=5, random_state=None)
 for counter,(train_index, valid_index)in enumerate(skf.split(training_features, training_targets),1):
print(counter)
 X_train, y_train = training_features.iloc[train_index], training_targets.iloc[train_index]
X_valid, y_valid = training_features.iloc[valid_index], training_targets.iloc[valid_index]
if simple_aug:
X_train, y_train = augment_fast(X_train.values, y_train.values)
 X_train = pd.DataFrame(X_train)
 print("Augmenation done!")
 skf_inner = StratifiedKFold(n_splits=4, random_state=None)
 def ml_fun(parameters):
parameters = parameters[0]
score = -cross_val_score(LogisticRegression(penalty='l1', dual=False, solver='saga', multi_class='auto',
tol = parameters[0],
C = parameters[1],
max_iter = parameters[2],
n_jobs=-1),
X_train, y_train, cv=skf_inner.split(X_train, y_train), scoring='roc_auc', n_jobs=-1 ).mean()
score = np.array(score)
 return score
bounds = [
{'name': 'var_smoothing', 'type': 'continuous', 'domain':(1e-11, 1e-7)}
]
optimizer = GPyOpt.methods.BayesianOptimization(f=ml_fun, domain=bounds,
acquisition_type ='MPI',
exact_eval=True)
 optimizer.run_optimization(1e2, 1e3, verbosity=True)
 LogR = LogisticRegression(LogisticRegression(penalty='l1', dual=False, solver='saga', multi_class='auto',
tol = optimizer.x_opt[0],
C = optimizer.x_opt[1],
max_iter = optimizer.x_opt[2],
n_jobs=-1 ).fit(X_train, y_train)
 LogR_val_proba = LogR.predict_proba(X_valid)
 fpr_keras, tpr_keras, thresholds_keras = roc_curve(y_valid, LogR_val_proba[:, 1])
 print("GaussianNB validation {d}: {:.5f}".format(counter, auc(fpr_keras, tpr_keras)))
 result_LogR += LogR.predict_proba(testing_features )
<normalization><EOS> 
submission_LogR = sample_submission.copy()
submission_LogR['target'] = result_LogR/counter
filename="{:%Y-%m-%d_%H_%M}_gbn.csv".format(datetime.now())
 submission_LogR.to_csv(filename, index=False )