[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify the code snippets into categories from the provided list of categories. List of categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']"}, {'role': 'user', 'content': "Identify to which category the provided code belongs and assign the code snippet to at least 1 but up to 5 categories based on the probabilities, ignore if the probability of the category is negligible. Strictly provide your response as a list. Avoid providing any additional information, commentary, or personal opinions.\\nPython Code:class MeansProcessor:\ndef __init__(self, key, outkey = None, tgt = 'interest_cat'):\nself.key = key\nself.outkey = key if outkey is None else outkey\nself.count = {}\nself.means = {}\nself.std = {}\nself.global_means = 0\nself.tgt = tgt\nself.outkeys = [self.outkey + '_level', self.outkey + '_level_std']\ndef fit(self, df):\nself.global_means = df[self.tgt].mean()\nfor k in df.groupby(self.key, sort=False):\nself.count[k[0]] = len(k[1])\nif len(k[1]) < 0:\nself.means[k[0]] = np.nan\nself.std[k[0]] = np.nan\nelse:\nself.means[k[0]] = np.mean(k[1][self.tgt])\nself.std[k[0]] = np.std(k[1][self.tgt])\ndef predict(self, df):\nfor l in self.outkeys:\ndf[l] = np.nan # self.global_means[l]\ndf[self.outkey + '_count'] = 0\nfor k in df.groupby(self.key, sort=False):\nif k[0] == 0:\ncontinue\nif k[0] in self.means:\ndf.loc[k[1].index, self.outkey + '_count'] = self.count[k[0]]\ndf.loc[k[1].index, self.outkey + '_level'] = self.means[k[0]]\ndf.loc[k[1].index, self.outkey + '_level_std'] = self.std[k[0]]\nreturn df\ndef get_features(self):\nreturn self.outkeys.copy() + [self.outkey + '_count']\ntarget_num_map = {'low':0, 'medium':1, 'high':2}\ntrain_y = np.array(train_df['interest_level'].apply(lambda x: target_num_map[x]))\ndef proc_fold(fold):\ntrain_index = fold[0]\ntest_index = fold[1]\ncv_train = train_df.iloc[train_index]\ncv_valid = train_df.iloc[test_index][['interest_level', 'manager_id', 'building_id']]\ncv_test = test_df.copy()\nm_build = MeansProcessor('building_id', 'building_sort')\nm_build.fit(cv_train)\ncv_valid = m_build.predict(cv_valid)\ncv_test = m_build.predict(cv_test)\nm_mgr = MeansProcessor('manager_id', 'manager_sort')\nm_mgr.fit(cv_train)\ncv_valid = m_mgr.predict(cv_valid)\ncv_test = m_mgr.predict(cv_test)\nm_comb = MeansProcessor(['building_id', 'manager_id'], 'mb_comb')\nm_comb.fit(cv_train)\ncv_valid = m_comb.predict(cv_valid)\ncv_test = m_comb.predict(cv_test)\nreturn cv_train, cv_valid, cv_test\nkf = model_selection.StratifiedKFold(n_splits=5, shuffle=True, random_state=2016)\nfolds = [(k[0], k[1]) for k in kf.split(list(range(train_df.shape[0])), train_y)]\nimport pickle\ntry:\nrv = pickle.load(open('0420-model-groupfeatures.pkl', 'rb'))\nexcept:\nwith Pool(5) as pool:\nrv = pool.map(proc_fold, folds)\npickle.dump(rv, open('0420-model-groupfeatures.pkl', 'wb'))\nm_build = MeansProcessor('building_id', 'building_sort')\nm_mgr = MeansProcessor('manager_id', 'manager_sort')\nm_comb = MeansProcessor(['building_id', 'manager_id'], 'mb_comb')\ngroup_features = m_build.get_features() + m_mgr.get_features() + m_comb.get_features()\ncv_test = []\nfor r in rv:\ncv_test.append(test_df.merge(r[2][group_features], left_index=True, right_index=True))\ncv_allvalid = pd.concat([r[1] for r in rv])\ntrain_df = train_df.merge(cv_allvalid[group_features], left_index=True, right_index=True)"}, {'role': 'assistant', 'content': "['data_preprocessing', 'evaluation', 'modelling']"}]