<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def classify(self, dataset, output_frequency='per_row'):
 """ Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities that the predicted value is the associated label. Parameters dataset : SFrame Dataset of new observations. Must include columns with the same names as the features and session id used for model training, but does not require a target column. Additional columns are ignored. output_frequency : {'per_row', 'per_window'}, optional The frequency of the predictions which is one of: - 'per_row': Each prediction is returned ``prediction_window`` times. - 'per_window': Return a single prediction for each ``prediction_window`` rows in ``dataset`` per ``session_id``. Returns ------- out : SFrame An SFrame with model predictions i.e class labels and probabilities. See Also create, evaluate, predict Examples """

        _tkutl._check_categorical_option_type(
            'output_frequency', output_frequency, ['per_window', 'per_row'])
        id_target_map = self._id_target_map
        preds = self.predict(
            dataset, output_type='probability_vector', output_frequency=output_frequency)

        if output_frequency == 'per_row':
            return _SFrame({
                'class': preds.apply(lambda p: id_target_map[_np.argmax(p)]),
                'probability': preds.apply(_np.max)
            })
        elif output_frequency == 'per_window':
            preds['class'] = preds['probability_vector'].apply(
                lambda p: id_target_map[_np.argmax(p)])
            preds['probability'] = preds['probability_vector'].apply(_np.max)
            preds = preds.remove_column('probability_vector')
            return preds