# Evaluation Metric
## You should use Top500 precision as the main factor to evaluate your model performance. *However, because the Kaggle doesn't support TopK precision as its metrics, we will use the simple categorical precision as our leaderboard metrics.*
You could see definition of relevant metrics regarding categorical accuracy from here
[Categorical Accuracy](https://towardsdatascience.com/keras-accuracy-metrics-8572eb479ec7)
. 


# Submission Format
### In this case, you should transform your result to fit into the sample submission in this Kaggle competition: set your Top500 customer's predict\_prob to be "1", while all other customer's predict\_prob to be "0".

###  Example of how you transform your data (you could operate with your result in many ways, and here is just a reference for you).
#### Suppose you trained your model and your predicted result are stored in DataFrame called:
> df\_result\_test\_output 

Then you could get the Top500 customers by sorted the probability:

> df\_result\_test\_output\_sorted = df\_result\_test\_output.sort\_values(by=['predict\_prob'],ascending=False) 

In addition, use this sorted result to form the first 500 rows where all the repurchase_flag = "1":

    df_result_id = pd.DataFrame(df_result_test_output_sorted['unify_id'][:500].values)
    df_result_id.columns = ['unify_id']
    df_result_flag = pd.DataFrame([1 for i in range(500)])
    df_result_flag.columns = ['repurchase_flag']
    df_result = pd.concat([df_result_id, df_result_flag], axis=1)

Finally, generate all the remaining rows, where all the repurchase_flag = "0", it's very easy, just do it in your own way.