[{'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:class GenderAgeGroupProb(object):\n    def __init__(self):\n        pass\n    \n    def fit(self, df, by, n_smoothing, weights):\n        self.by = by\n        self.n_smoothing = n_smoothing\n        self.weights = np.divide(weights,sum(weights))\n        self.classes_ = sorted(df['group'].unique())\n        self.n_classes_ = len(self.classes_)\n        \n        self.group_freq = df['group'].value_counts().sort_index()/df.shape[0]\n        \n        self.prob_by = []\n        for i,b in enumerate(self.by):\n            c = df.groupby([b,'group']).size().unstack().fillna(0)\n            total = c.sum(axis=1)\n            prob = (c.add(self.n_smoothing[i]*self.group_freq)).div(total+self.n_smoothing[i], axis=0)\n            self.prob_by.append(prob)\n        return self\n    \n    def predict_proba(self, df):\n        pred = pd.DataFrame(np.zeros((len(df.index),self.n_classes_)),columns=self.classes_,index=df.index)\n        pred_by = []\n        for i,b in enumerate(self.by):\n            pred_by.append(df[[b]].merge(self.prob_by[i], how='left',\n                                      left_on=b, right_index=True).fillna(self.group_freq)[self.classes_])\n            pred = pred.radd(pred_by[i].values*self.weights[i])\n        \n        pred.loc[pred.iloc[:,0].isnull(),:] = self.group_freq\n        return pred[self.classes_].values\n    \ndef score(ptrain, by, n_smoothing, weights=[0.5,0.5]):\n    kf = KFold(ptrain.shape[0], n_folds=10, shuffle=True, random_state=0)\n    pred = np.zeros((ptrain.shape[0],n_classes))\n    for itrain, itest in kf:\n        train = ptrain.iloc[itrain,:]\n        test = ptrain.iloc[itest,:]\n        ytrain, ytest = y[itrain], y[itest]\n        clf = GenderAgeGroupProb().fit(train,by,n_smoothing,weights)\n        pred[itest,:] = clf.predict_proba(test)\n    return log_loss(y, pred)"}, {'role': 'assistant', 'content': 'modelling'}]