code: def fit_from_cfg(cls, df, cfgname, debug=False, min_segment_size=None, outcfgname=None):
          
          logger.debug('start: fit from configuration {}'.format(cfgname))
          hm = cls.from_yaml(str_or_buffer=cfgname)
          if min_segment_size:
              hm.min_segment_size = min_segment_size
  
          for k, v in hm.fit(df, debug=debug).items():
              print("REGRESSION RESULTS FOR SEGMENT %s\n" % str(k))
              print(v.summary())
          outcfgname = outcfgname or cfgname
          hm.to_yaml(str_or_buffer=outcfgname)
          logger.debug('finish: fit into configuration {}'.format(outcfgname))
          return hm
docs: Parameters
          ----------
          df : DataFrame
              The dataframe which contains the columns to use for the estimation.
          cfgname : string
              The name of the yaml config file which describes the hedonic model.
          debug : boolean, optional (default False)
              Whether to generate debug information on the model.
          min_segment_size : int, optional
              Set attribute on the model.
          outcfgname : string, optional (default cfgname)
              The name of the output yaml config file where estimation results are written into.
  
          Returns
          -------
          hm : SegmentedRegressionModel which was used to fit