Kaggle competition: Jane Street Market Prediction
<choose_model_class><EOS> 
train = pd.read_csv('/kaggle/input/jane-street-market-prediction/train.csv')
 print(f'Done loading data.Train shape is {train.shape}')
 train = train[train.weight != 0]
NAN_VALUE = -999
FEATURES = [c for c in train.columns if 'feature' in c]
TARGET = 'resp'
MAX_WEIGHT = train.weight.max()
X = train.loc[:, FEATURES].fillna(NAN_VALUE)
 y =(train.loc[:, TARGET] > 0 ).astype(int)
 del train
gc.collect()
model = xgb.XGBClassifier(
 n_estimators=500,
max_depth=11,
learning_rate=0.05,
subsample=0.9,
colsample_bytree=0.7,
missing=NAN_VALUE,
random_state=2020,
tree_method='gpu_hist' 
)
 model.fit(X, y)
 print('Finished training model')
 del X, y
gc.collect()
env = janestreet.make_env()
iter_test = env.iter_test()
for(test_df, sample_prediction_df)in iter_test:
test_weight = test_df.iloc[0].weight
if test_weight > 0:
proba = model.predict_proba(test_df.loc[:, FEATURES].fillna(NAN_VALUE)) [0, 1]
threshold = 0.5 + 0.1 * test_weight *(1 / MAX_WEIGHT)
 sample_prediction_df.action = 1 if proba > threshold else 0
else:
sample_prediction_df.action = 0
env.predict(sample_prediction_df )