Naive Bayes: Bernoulli log-likelihood
Intermediate classical-mlprobabilisticnaive-bayes
Implement:
def bernoulli_nb_fit(input: np.ndarray, labels: np.ndarray, alpha: float = 1.0) -> dict: ...
def bernoulli_log_likelihood(x: np.ndarray, feature_probs: np.ndarray) -> float: ...
def bernoulli_nb_predict(model: dict, queries: np.ndarray) -> np.ndarray: ...
input entries are 0 or 1 (feature present/absent), the classic representation for things like "does this word appear in this document."
alpha is Laplace smoothing strength, 1.0 is the standard default.