@classmethod
    def from_yaml(cls, yaml_str=None, str_or_buffer=None):
        """
        Create a SegmentedRegressionModel instance from a saved YAML
        configuration. Arguments are mutally exclusive.

        Parameters
        ----------
        yaml_str : str, optional
            A YAML string from which to load model.
        str_or_buffer : str or file like, optional
            File name or buffer from which to load YAML.

        Returns
        -------
        SegmentedRegressionModel

        """
        cfg = yamlio.yaml_to_dict(yaml_str, str_or_buffer)

        default_model_expr = cfg['default_config']['model_expression']
        default_ytransform = cfg['default_config']['ytransform']

        seg = cls(
            cfg['segmentation_col'], cfg['fit_filters'],
            cfg['predict_filters'], default_model_expr,
            YTRANSFORM_MAPPING[default_ytransform], cfg['min_segment_size'],
            cfg['name'])

        if "models" not in cfg:
            cfg["models"] = {}

        for name, m in cfg['models'].items():
            m['model_expression'] = m.get(
                'model_expression', default_model_expr)
            m['ytransform'] = m.get('ytransform', default_ytransform)
            m['fit_filters'] = None
            m['predict_filters'] = None
            reg = RegressionModel.from_yaml(yamlio.convert_to_yaml(m, None))
            seg._group.add_model(reg)

        logger.debug(
            'loaded segmented regression model {} from yaml'.format(seg.name))
        return seg
dataset/ETHPy150Open UDST/urbansim/urbansim/models/regression.py/SegmentedRegressionModel.from_yaml/original