<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def train_cb(self, param):
 """Callback funtion for training. """

        if param.nbatch % self.frequent == 0:
            self._process_batch(param, 'train')