Kaggle competition: Don't Overfit! II
%%time
if runjane :
for(test_df, sample_prediction_df)in iter_test:
if test_df['weight'].item() > 0:
X_test = test_df.loc[: , features].values
X_test = np.nan_to_num(X_test[:,:])
 y_preds = model(X_test)
 sample_prediction_df.action = np.where(y_preds >= 0.5, 1, 0 ).astype(int)
 else:
sample_prediction_df.action = 0
submission=env.predict(sample_prediction_df)
 print("test_df prediction completed!")
 print(sample_prediction_df)
<set_options>
train = pd.read_csv(".. /input/train.csv")
 test = pd.read_csv(".. /input/test.csv")
 sub = pd.read_csv('.. /input/sample_submission.csv')
 train.info()
train.shape
train.describe()
warnings.filterwarnings('ignore')
 tf.random.set_seed(42)
<load_from_csv>
train_feat = train.drop(columns=['id', 'target'], axis=1)
 test_feat = test.drop(columns='id', axis=1)
 std = StandardScaler()
train_feat = std.fit_transform(train_feat)
 test_feat = std.fit_transform(test_feat)
 train_label = train['target']
l1 = LassoCV().fit(train_feat, train_label)
 l2 = LogisticRegressionCV().fit(train_feat, train_label)
 pred3 = l1.predict(test_feat)
 pred4 = l2.predict(test_feat)
 target = pd.DataFrame(pred3 ).rename(columns={0: 'target'})
 sub_id = sub[['id']]
submission = pd.concat([sub_id, target], axis=1)
 print(submission)
 submission.to_csv('sub.csv', index=False )