Beispiel #1
0
    def __init__(self,
                 states_df,
                 score_type,
                 max_num_mtries,
                 alpha=0,
                 num_starts=10,
                 ess=1.0,
                 verbose=False,
                 vtx_to_states=None):
        """
        Constructor

        Parameters
        ----------
        alpha : float
        states_df : pandas.DataFrame
        score_type : str
        max_num_mtries : int
        num_starts : int
        ess : float
            Equivalent Sample Size, a parameter in BDEU scorer. Fudge factor
            that is supposed to grow as the amount of prior knowledge grows.
        verbose : bool
        vtx_to_states : dict[str, list[str]]
            A dictionary mapping each node name to a list of its state names.
            This information will be stored in self.bnet. If
            vtx_to_states=None, constructor will learn vtx_to_states
            from states_df


        Returns
        -------
        None

        """
        # this is a good default value
        self.alpha = 5 / len(states_df.index)

        lner = MB_MMPC_Lner(states_df,
                            alpha,
                            verbose,
                            vtx_to_states,
                            learn_later=True)
        lner.find_PC()
        self.vtx_to_nbors = lner.vtx_to_nbors

        HC_RandRestartLner.__init__(self, states_df, score_type,
                                    max_num_mtries, num_starts, ess, verbose,
                                    vtx_to_states)
    def __init__(self, states_df, score_type, max_num_mtries,
            alpha=0, tabu_len=10,
            ess=1.0, verbose=False, vtx_to_states=None):
        """
        Constructor

        Parameters
        ----------
        tabu_len : int
        alpha : float
        states_df : pandas.DataFrame
        score_type : str
        max_num_mtries : int
        ess : float
            Equivalent Sample Size, a parameter in BDEU scorer. Fudge factor
            that is supposed to grow as the amount of prior knowledge grows.
        verbose : bool
        vtx_to_states : dict[str, list[str]]
            A dictionary mapping each node name to a list of its state names.
            This information will be stored in self.dag. If
            vtx_to_states=None, constructor will learn vtx_to_states
            from states_df


        Returns
        -------
        None

        """
        # this is a good default value
        self.alpha = 5/len(states_df.index)

        lner = MB_MMPC_Lner(states_df, alpha, verbose,
                vtx_to_states, learn_later=True)
        lner.find_PC()
        self.vtx_to_nbors = lner.vtx_to_nbors

        HC_TabuLner.__init__(
            self, states_df, score_type, max_num_mtries,
            tabu_len,
            ess, verbose, vtx_to_states)