def to_dict(self):
        """
        Returns a dictionary representation of a RegressionModel instance.

        """
        d = {
            'model_type': 'regression',
            'name': self.name,
            'fit_filters': self.fit_filters,
            'predict_filters': self.predict_filters,
            'model_expression': self.model_expression,
            'ytransform': YTRANSFORM_MAPPING[self.ytransform],
            'fitted': self.fitted,
            'fit_parameters': None,
            'fit_rsquared': None,
            'fit_rsquared_adj': None
        }

        if self.fitted:
            d['fit_parameters'] = yamlio.frame_to_yaml_safe(
                self.fit_parameters)
            d['fit_rsquared'] = float(self.model_fit.rsquared)
            d['fit_rsquared_adj'] = float(self.model_fit.rsquared_adj)

        return d
Returns a dictionary representation of a RegressionModel instance.