[{'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 TargetEncodingExpandingMean(BaseEstimator, TransformerMixin):\n    def __init__(self, columns_names):\n        self.columns_names = columns_names\n        self.learned_values = {}\n        self.dataset_mean = np.nan\n    def fit(self, X, y, **fit_params):\n        X_ = X.copy()\n        self.learned_values = {}\n        self.dataset_mean = np.mean(y)\n        X_["__target__"] = y\n        for c in [x for x in X_.columns if x in self.columns_names]:\n            stats = (X_[[c,"__target__"]]\n                     .groupby(c)["__target__"]\n                     .agg([\'mean\', \'size\'])) #\n            stats["__target__"] = stats["mean"]\n            stats = (stats\n                     .drop([x for x in stats.columns if x not in ["__target__",c]], axis = 1)\n                     .reset_index())\n            self.learned_values[c] = stats\n        return self\n    def transform(self, X, **fit_params):\n        transformed_X = X[self.columns_names].copy()\n        for c in transformed_X.columns:\n            transformed_X[c] = (transformed_X[[c]]\n                                .merge(self.learned_values[c], on = c, how = \'left\')\n                               )["__target__"]\n        transformed_X = transformed_X.fillna(self.dataset_mean)\n        return transformed_X\n    \n    def fit_transform(self, X, y, **fit_params):\n        self.fit(X,y)\n    \n        #Expanding mean transform\n        X_ = X[self.columns_names].copy().reset_index(drop = True)\n        X_["__target__"] = y\n        X_["index"] = X_.index\n        X_transformed = pd.DataFrame()\n        for c in self.columns_names:\n            X_shuffled = X_[[c,"__target__", "index"]].copy()\n            X_shuffled = X_shuffled.sample(n = len(X_shuffled),replace=False)\n            X_shuffled["cnt"] = 1\n            X_shuffled["cumsum"] = (X_shuffled\n                                    .groupby(c,sort=False)[\'__target__\']\n                                    .apply(lambda x : x.shift().cumsum()))\n            X_shuffled["cumcnt"] = (X_shuffled\n                                    .groupby(c,sort=False)[\'cnt\']\n                                    .apply(lambda x : x.shift().cumsum()))\n            X_shuffled["encoded"] = X_shuffled["cumsum"] / X_shuffled["cumcnt"]\n            X_shuffled["encoded"] = X_shuffled["encoded"].fillna(self.dataset_mean)\n            X_transformed[c] = X_shuffled.sort_values("index")["encoded"].values\n        return X_transformed\''}, {'role': 'assistant', 'content': 'data_preprocessing'}]