Kaggle competition: Don't Overfit! II
<SOS> metric: AUC Kaggle data source: dont-overfit!-ii<train_model>
warnings.filterwarnings('ignore')
 train = pd.read_csv('.. /input/train.csv' , index_col = 'id')
 test = pd.read_csv('.. /input/test.csv' , index_col = 'id')
 print(os.listdir(".. /input/"))
best_model = KMeans(n_clusters=20)
 best_model.fit(features.values )<filter>
y = train['target']
train = train.drop(['target'] , axis = 1)
 train.info()
train_df = train_df.query('date > 85' ).reset_index(drop = True )<drop_column>
scaler = StandardScaler()
train = scaler.fit_transform(train)
 test = scaler.fit_transform(test)
features = list(train_df.columns)
 features.remove("weight")
 features.remove("resp_1")
 features.remove("resp_2")
 features.remove("resp_3")
 features.remove("resp_4")
 features.remove("resp")
 features.remove("action")
 features.remove("ts_id")
 features.remove("date")
 features.remove("feature_0")
<load_pretrained>
clf = LogisticRegression(class_weight='balanced', solver='liblinear', penalty ='l1', C= 0.1, max_iter=10000)
 clf.fit(train, y)
 scores = cross_val_score(clf, train, y, cv=5)
 scores
save_pickle(features,"features_names" )<filter>
clf.fit(train, y)
 ans = clf.predict_proba(test)
 ans
abundant_class = train_df.loc[(train_df["weight"] > 0)&(train_df["action"]==0),:]
rare_class = train_df.loc[(train_df["weight"] > 0)&(train_df["action"]==1),:]<load_pretrained>
submit = pd.read_csv('.. /input/sample_submission.csv')
 submit.head()
imputer = np.mean(train_df[features].values,axis=0)
 save_pickle(imputer,"features_imputation" )<categorify>
submit['target'] = ans[:,1]
<drop_column><EOS> 
submit.to_csv('submit.csv', index = False )