<jupyter_start><jupyter_text>Prediction benchmark: mean calculation (mean num_orders per center/meal combination)<jupyter_code>import pandas as pd
train = pd.read_csv('../data/train/train.csv')
test = pd.read_csv('../data/test.csv')
sample_submission = pd.read_csv('../data/sample_submission.csv')
mean_weekly_orders = train.groupby(['center_id','meal_id'],as_index=False)['num_orders'].mean()
mean_weekly_orders.tail()
test_merged = pd.merge(test,mean_weekly_orders,on=['center_id','meal_id'],how='left')
test_merged.tail()
test_merged['num_orders'].isna().sum()<jupyter_output><empty_output><jupyter_text>13 (center, meal) combinations are not available in the train set. I tried two imputation strategies (zero and mean) and found out that the latter gives a better score.<jupyter_code>sub_1 = test_merged[['id','num_orders']]
sub_1['num_orders'].fillna(sub_0['num_orders'].mean(),inplace=True)
sub_1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1532690246516613, 'fraction_numerical': 0.006430868167202572, 'mean_word_length': 9.043010752688172, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '204128', 'license': 'MIT', 'n_tokens_mistral': 332, 'n_tokens_neox': 319, 'n_words': 56, 'path': 'notebooks/1_benchmark.ipynb', 'repo_name': 'hichemck/food_demand', 'size': '933'}