[{'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:# %%\nimport numpy as np\nimport itertools\nimport plotly.express as px\nimport pandas as pd\nfrom plotly.subplots import make_subplots\nfrom multiprocessing import Pool\n\n\nclass CoronaSim:\n    def __init__(self, grid_size, initial_virus, recover_time, speedreaction, incubation, virulence, contactsize=1, num_cores=4):\n        self.sim_grid = np.zeros(shape=[grid_size, grid_size])\n        ini_x_virus = np.random.randint(\n            low=0, high=grid_size, size=initial_virus)\n        ini_y_virus = np.random.randint(\n            low=0, high=grid_size, size=initial_virus)\n        self.inistate_matrix = np.zeros(shape=[grid_size, grid_size])\n        self.inistate_matrix.fill(float(recover_time))\n        self.recover_time = recover_time\n        self.inistate_matrix[ini_x_virus, ini_y_virus] = 7\n        self.speedreaction = speedreaction\n        self.incubation = incubation\n        self.samplesize = contactsize\n        self.virulence = virulence\n        self.num_cores = num_cores\n        self.all_sites = list(itertools.product(\n            range(self.sim_grid.shape[0]), range(self.sim_grid.shape[0])))\n\n    def mechanismcheck(self):\n        state_value = np.arange(31)\n        valuedf = pd.DataFrame(\n            {\'state\': state_value, \'Activity\': self.activity(state_value)})\n        f1 = px.scatter(valuedf, x="state", y="Activity")\n        f1.data[0].update(mode=\'markers+lines\')\n        f1.update_traces(line_color=\'#B54434\',\n                         marker_line_width=3, marker_size=4)\n\n        distance = np.arange(200)\n        disp = np.exp(-self.gm_virulence(20)*distance**2)\n        contactdf = pd.DataFrame({\'distance\': distance, \'disp\': disp})\n        f2 = px.line(contactdf, x="distance", y="disp")\n        f2.data[0].update(mode=\'markers+lines\')\n        f2.update_traces(line_color=\'#1B813E\',\n                         marker_line_width=3, marker_size=4)\n\n        infected_num = np.arange(10000)\n        measuredf = pd.DataFrame(\n            {\'infected_num\': infected_num, \'measure\': self.gm_virulence(infected_num)})\n        f3 = px.line(measuredf, x="infected_num", y="measure")\n        f3.update_traces(line_color=\'#66327C\',\n                         marker_line_width=3, marker_size=4)\n\n        trace1 = f1[\'data\'][0]\n        trace2 = f2[\'data\'][0]\n        trace3 = f3[\'data\'][0]\n\n        fig = make_subplots(rows=3, cols=1, shared_xaxes=False, subplot_titles=(\n            "Figure 1", "Figure 2", "Figure 3"))\n        fig.add_trace(trace1, row=1, col=1)\n        fig.add_trace(trace2, row=2, col=1)\n        fig.add_trace(trace3, row=3, col=1)\n\n        # Update xaxis properties\n        fig.update_xaxes(title_text="Health state", row=1, col=1)\n        fig.update_xaxes(title_text="Distance", range=[10, 50], row=2, col=1)\n        fig.update_xaxes(title_text="The number of infected cases",\n                         showgrid=False, row=3, col=1)\n\n        # Update yaxis properties\n        fig.update_yaxes(title_text="Willingness", row=1, col=1)\n        fig.update_yaxes(title_text="Contact rate",\n                         showgrid=False, row=2, col=1)\n        fig.update_yaxes(\n            title_text="Intensity of the restriction", row=3, col=1)\n\n        # fig[\'layout\'].update(height=800, width=800, showlegend=False)\n        fig.update_layout(\n            xaxis=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                    family=\'Arial\',\n                    size=12,\n                    color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            yaxis=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                          family=\'Arial\',\n                          size=12,\n                          color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            xaxis2=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                    family=\'Arial\',\n                    size=12,\n                    color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            yaxis2=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                          family=\'Arial\',\n                          size=12,\n                          color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            xaxis3=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                    family=\'Arial\',\n                    size=12,\n                    color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            yaxis3=dict(\n                showline=True,\n                showgrid=False,\n                showticklabels=True,\n                linecolor=\'rgb(204, 204, 204)\',\n                linewidth=2,\n                ticks=\'outside\',\n                tickfont=dict(\n                          family=\'Arial\',\n                          size=12,\n                          color=\'rgb(82, 82, 82)\',\n                ),\n            ),\n            autosize=True,\n\n            plot_bgcolor=\'white\',\n            height=800, width=800,\n        )\n        fig.show()\n\n    def activity(self, state):\n        disp = np.exp((state-self.incubation) ** 2 /\n                      self.virulence ** 2)\n        return disp\n\n    def gm_virulence(self, infected_num):\n        return 100*(2/(1+np.exp(-infected_num*self.speedreaction/(self.sim_grid.shape[0]*self.sim_grid.shape[1])))-1)\n\n    def spread_prob(self, x_row, y_col, state, seed=1):\n        np.random.seed(seed)\n        distance_sites = np.linalg.norm(\n            np.array(self.all_sites) - np.array([x_row, y_col]), axis=1)\n        Act = self.activity(state)\n        gm_virulence = self.gm_virulence(\n            infected_num=len(np.where(state < self.recover_time)[0]))\n        prob_spread = np.exp(-gm_virulence *\n                             distance_sites ** 2) * Act[x_row, y_col] * Act.flatten()\n        prob_spread[x_row*self.sim_grid.shape[1]+y_col] = 0\n        focal_state = np.random.choice(range(\n            self.sim_grid.shape[0]*self.sim_grid.shape[1]), size=self.samplesize, p=prob_spread/sum(prob_spread))\n        focal_state_value = 0 if min(state.flatten()[focal_state]) < self.recover_time else self.recover_time\n        return focal_state_value\n\n    def simspread(self, t_end, savefile):\n        self.savefile = savefile\n        state_matrix = self.inistate_matrix\n        output_list = []\n        parallel_cores = Pool(self.num_cores)\n        for t in range(t_end):\n            num_infected = len(np.where(state_matrix < self.recover_time)[0])\n            print(\n                f\'At Day {t}, {num_infected} infected cases are confirmed...\')\n            healthy_individual_index_row = np.where(state_matrix >= self.recover_time)[0]\n            healthy_individual_index_col = np.where(state_matrix >= self.recover_time)[1]\n            change_state = parallel_cores.starmap(self.spread_prob,\n                                                  zip(healthy_individual_index_row, healthy_individual_index_col, itertools.repeat(state_matrix)))\n            state_matrix[healthy_individual_index_row,\n                         healthy_individual_index_col] = change_state\n            state_matrix += 1\n            output_list.append(state_matrix.tolist())\n        np.savez(self.savefile, *output_list)\n        return state_matrix\n    \nif __name__ == "__main__":\n    test = CoronaSim(grid_size=100, initial_virus=5, contactsize=2,num_cores=6,\n                         recover_time=30, speedreaction=0.01, incubation=10, virulence=25)\n    test.mechanismcheck()\''}, {'role': 'assistant', 'content': 'helper_functions'}]