[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify code snippets into one of the following categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']."}, {'role': 'user', 'content': 'Identify the single most appropriate category to which the provided code belongs. Provide your response as a single category label without any additional information, commentary, or personal opinions.\\nPython Code:# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here\'s several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the "../input/" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nfrom subprocess import check_output\nprint(check_output(["ls", "../input"]).decode("utf8"))\n\n# Any results you write to the current directory are saved as output.\nimport datetime\nimport time\nfrom collections import defaultdict\nimport gc\n\ndef run_solution():\n    print(\'Preparing arrays...\')\n    f = open("../input/train.csv", "r")\n    f.readline()\n    total = 0\n\n    client_product_arr = defaultdict(int)\n    client_product_arr_count = defaultdict(int)\n    client_arr = defaultdict(int)\n    client_arr_count = defaultdict(int)\n    product_arr = defaultdict(int)\n    product_arr_count = defaultdict(int)\n\n    # Calc counts\n    avg_target = 0.0\n    while 1:\n        line = f.readline().strip()\n        total += 1\n\n        if total % 10000000 == 0:\n            print(\'Read {} lines...\'.format(total))\n\n        if line == \'\':\n            break\n\n        arr = line.split(",")\n        week = int(arr[0])\n        agency = arr[1]\n        canal_id = arr[2]\n        ruta_sak = arr[3]\n        cliente_id = int(arr[4])\n        producto_id = int(arr[5])\n        vuh = arr[6]\n        vh = arr[7]\n        dup = arr[8]\n        dp = arr[9]\n        target = int(arr[10])\n        avg_target += target\n\n        client_product_arr[(cliente_id, producto_id)] += target\n        client_product_arr_count[(cliente_id, producto_id)] += 1\n        client_arr[cliente_id] += target\n        client_arr_count[cliente_id] += 1\n        product_arr[producto_id] += target\n        product_arr_count[producto_id] += 1\n\n    f.close()\n    avg_target /= total\n    print(\'Average target: \', avg_target)\n    gc.collect()\n    \n    print(\'Generate submission...\')\n    now = datetime.datetime.now()\n    path = \'submission_\' + str(now.strftime("%Y-%m-%d-%H-%M")) + \'.csv\'\n    out = open(path, "w")\n    f = open("../input/test.csv", "r")\n    f.readline()\n    total = 0\n    out.write("id,Demanda_uni_equil\\\n")\n\n    index_both = 0\n    index_client = 0\n    index_product = 0\n    index_empty = 0\n\n    while 1:\n        line = f.readline().strip()\n        total += 1\n\n        if total % 10000000 == 0:\n            print(\'Write {} lines...\'.format(total))\n\n        if line == \'\':\n            break\n\n        arr = line.split(",")\n        id = arr[0]\n        week = int(arr[1])\n        agency = arr[2]\n        canal_id = arr[3]\n        ruta_sak = arr[4]\n        cliente_id = int(arr[5])\n        producto_id = int(arr[6])\n\n        out.write(str(id) + \',\')\n        if (cliente_id, producto_id) in client_product_arr:\n            val = client_product_arr[(cliente_id, producto_id)]/client_product_arr_count[(cliente_id, producto_id)]\n            out.write(str(val))\n            index_both += 1\n        elif cliente_id in client_arr:\n            val = client_arr[cliente_id]/client_arr_count[cliente_id]\n            out.write(str(val))\n            index_client += 1\n        elif producto_id in product_arr:\n            val = product_arr[producto_id]/product_arr_count[producto_id]\n            out.write(str(val))\n            index_product += 1\n        else:\n            out.write(str(avg_target))\n            index_empty += 1\n        out.write("\\\n")\n\n    print(\'Both: {}\'.format(index_both))\n    print(\'Client: {}\'.format(index_client))\n    print(\'Product: {}\'.format(index_product))\n    print(\'Empty: {}\'.format(index_empty))\n\n    out.close()\n    f.close()\n\nstart_time = time.time()\n#run_solution()\nprint("Elapsed time overall: %s seconds" % (time.time() - start_time))\''}, {'role': 'assistant', 'content': 'helper_functions'}]