code: def fit_from_cfg(cls, choosers, chosen_fname, alternatives, cfgname, outcfgname=None):
          
          logger.debug('start: fit from configuration {}'.format(cfgname))
          lcm = cls.from_yaml(str_or_buffer=cfgname)
          lcm.fit(choosers, alternatives, choosers[chosen_fname])
          lcm.report_fit()
          outcfgname = outcfgname or cfgname
          lcm.to_yaml(str_or_buffer=outcfgname)
          logger.debug('finish: fit into configuration {}'.format(outcfgname))
          return lcm
docs: Parameters
          ----------
          choosers : DataFrame
              A dataframe in which rows represent choosers.
          chosen_fname : string
              A string indicating the column in the choosers dataframe which
              gives which alternatives the choosers have chosen.
          alternatives : DataFrame
              A table of alternatives. It should include the choices
              from the choosers table as well as other alternatives from
              which to sample.  Values in choosers[chosen_fname] should index
              into the alternatives dataframe.
          cfgname : string
              The name of the yaml config file from which to read the discrete
              choice model.
          outcfgname : string, optional (default cfgname)
              The name of the output yaml config file where estimation results are written into.
  
          Returns
          -------
          lcm : MNLDiscreteChoiceModel which was used to fit