def predict(self, X, b=<NUM_LIT:0.5>, pos_label=<NUM_LIT:1>, return_probs=False):
if self._check_input(X):<EOL><INDENT>X = self._preprocess_data(X)<EOL><DEDENT>Y_prob = self.marginals(X)<EOL>if self.cardinality > <NUM_LIT:2>:<EOL><INDENT>Y_pred = Y_prob.argmax(axis=<NUM_LIT:1>) + <NUM_LIT:1><EOL>if return_probs:<EOL><INDENT>return Y_pred, Y_prob<EOL><DEDENT>else:<EOL><INDENT>return Y_pred<EOL><DEDENT><DEDENT>if pos_label not in [<NUM_LIT:1>, <NUM_LIT:2>]:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.logger.info(f"<STR_LIT>")<EOL>Y_pred = np.array(<EOL>[pos_label if p[pos_label - <NUM_LIT:1>] > b else <NUM_LIT:3> - pos_label for p in Y_prob]<EOL>)<EOL>if return_probs:<EOL><INDENT>return Y_pred, Y_prob<EOL><DEDENT>else:<EOL><INDENT>return Y_pred<EOL><DEDENT>
Return numpy array of class predictions for X
        based on predicted marginal probabilities.

        :param X: Input data.
        :param b: Decision boundary *for binary setting only*.
        :type b: float
        :param pos_label: Positive class index *for binary setting only*. Default: 1
        :type pos_label: int
        :param return_probs: If True, return predict probability. Default: False
        :type return_probs: bool