gc.collect() items = pd.read_csv("../input/items.csv") test = pd.merge(test_e, items, on='item_nbr', how='inner')[[ 'unit_sales', 'pred_sales', 'date', 'perishable' ]] del test_e, items # Check memory usage of test print(test.memory_usage(index=True)) new_mem_test = test.memory_usage(index=True).sum() print("test dataset uses ", new_mem_test / 1024**2, " MB after changes") gc.collect() eval_test(test) ########################################################################## # Submit else: logger.info('Making submission...') X_test_out.reset_index(inplace=True) del X_test_out["date"] X_test_out = X_test_out.set_index(["store_nbr", "item_nbr"]) y_test = np.array(test_pred).transpose() df_preds = pd.DataFrame( y_test, index=X_test_out.index,
print("test dataset uses ",new_mem_test/ 1024**2," MB after changes") gc.collect() items = pd.read_csv("../input/items.csv") test = pd.merge(test_e, items, on='item_nbr',how='inner')[['unit_sales', 'pred_sales', 'date', 'perishable']] del test_e, items gc.collect() # Check memory usage of test print(test.memory_usage(index=True)) new_mem_test=test.memory_usage(index=True).sum() print("test dataset uses ",new_mem_test/ 1024**2," MB after changes") outstring = eval_test(test) logger.info(outstring) ########################################################################## # Submit else: logger.info('Making submission...') X_test_out.reset_index(inplace = True) del X_test_out["date"] X_test_out = X_test_out.set_index(["store_nbr", "item_nbr"]) y_test = np.array(test_pred).transpose() df_preds = pd.DataFrame( y_test, index=X_test_out.index,