Kaggle competition: Two Sigma: Using News to Predict Stock Movements
<SOS> metric: custom Kaggle data source: two-sigma-financial-news<save_to_csv>
env = twosigmanews.make_env()
print('Done!' )
test_ds = get_test_dataset(ordered=True)
 print('Computing predictions...')
 test_images_ds = test_ds.map(lambda image, idnum: image)
 probabilities = model.predict(test_images_ds)
 predictions = np.argmax(probabilities, axis=-1)
 print(predictions)
 print('Generating submission.csv file...')
 test_ids_ds = test_ds.map(lambda image, idnum: idnum ).unbatch()
test_ids = next(iter(test_ids_ds.batch(NUM_TEST_IMAGES)) ).numpy().astype('U')
 np.savetxt('submission.csv', np.rec.fromarrays([test_ids, predictions]), fmt=['%s', '%d'], delimiter=',', header='id,label', comments='')
 !head submission.csv<install_modules>
( market_train_df, news_train_df)= env.get_training_data()
!pip install -q efficientnet<install_modules>
days = env.get_prediction_days()
!pip install tensorflow_addons<import_modules>
eps = 1.8745641033852102e-20
for(market_obs_df, news_obs_df, predictions_template_df)in days:
market_obs_df['returnsOpenPrevMktres10'] = market_obs_df['returnsOpenPrevMktres10'].fillna(eps)
 predictions_template_df['confidenceValue'] = 1/market_obs_df['returnsOpenPrevMktres10']*eps
env.predict(predictions_template_df)
 print('Done!' )
<import_modules><EOS> 
env.write_submission_file()