(cls, yaml_str=None, str_or_buffer=None)
return model
Create a DiscreteChoiceModel 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
        -------
        MNLDiscreteChoiceModel
Create a DiscreteChoiceModel instance from a saved YAML configuration.
        Arguments are mutally exclusive.
Create a DiscreteChoiceModel instance from a saved YAML configuration . Arguments are mutally exclusive .
def from_yaml(cls, yaml_str=None, str_or_buffer=None):
        """
        Create a DiscreteChoiceModel 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
        -------
        MNLDiscreteChoiceModel

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

        model = cls(
            cfg['model_expression'],
            cfg['sample_size'],
            probability_mode=cfg.get('probability_mode', 'full_product'),
            choice_mode=cfg.get('choice_mode', 'individual'),
            choosers_fit_filters=cfg.get('choosers_fit_filters', None),
            choosers_predict_filters=cfg.get('choosers_predict_filters', None),
            alts_fit_filters=cfg.get('alts_fit_filters', None),
            alts_predict_filters=cfg.get('alts_predict_filters', None),
            interaction_predict_filters=cfg.get(
                'interaction_predict_filters', None),
            estimation_sample_size=cfg.get('estimation_sample_size', None),
            prediction_sample_size=cfg.get('prediction_sample_size', None),
            choice_column=cfg.get('choice_column', None),
            name=cfg.get('name', None)
        )

        if cfg.get('log_likelihoods', None):
            model.log_likelihoods = cfg['log_likelihoods']
        if cfg.get('fit_parameters', None):
            model.fit_parameters = pd.DataFrame(cfg['fit_parameters'])

        logger.debug('loaded LCM model {} from YAML'.format(model.name))
        return model
def from_yaml ( cls , yaml_str = None , str_or_buffer = None ) : cfg = yamlio . yaml_to_dict ( yaml_str , str_or_buffer ) model = cls ( cfg [ 'model_expression' ] , cfg [ 'sample_size' ] , probability_mode = cfg . get ( 'probability_mode' , 'full_product' ) , choice_mode = cfg . get ( 'choice_mode' , 'individual' ) , choosers_fit_filters = cfg . get ( 'choosers_fit_filters' , None ) , choosers_predict_filters = cfg . get ( 'choosers_predict_filters' , None ) , alts_fit_filters = cfg . get ( 'alts_fit_filters' , None ) , alts_predict_filters = cfg . get ( 'alts_predict_filters' , None ) , interaction_predict_filters = cfg . get ( 'interaction_predict_filters' , None ) , estimation_sample_size = cfg . get ( 'estimation_sample_size' , None ) , prediction_sample_size = cfg . get ( 'prediction_sample_size' , None ) , choice_column = cfg . get ( 'choice_column' , None ) , name = cfg . get ( 'name' , None ) ) if cfg . get ( 'log_likelihoods' , None ) : model . log_likelihoods = cfg [ 'log_likelihoods' ] if cfg . get ( 'fit_parameters' , None ) : model . fit_parameters = pd . DataFrame ( cfg [ 'fit_parameters' ] ) logger . debug ( 'loaded LCM model {} from YAML' . format ( model . name ) ) return model