← 返回 pinterest 的题目列表Naive Bayes Implementation
类型:online_judge
Implement the training and prediction process of a Naive Bayes classifier. Given the feature matrix X_train, target vector y_train for training data, and feature matrix X_test for testing data, return the predicted labels. Assume classes follow a binary distribution. Input: Feature matrix X_train and labels y_train, feature matrix X_test, all numpy arrays. Output: A numpy array of predicted labels.
Example
Input
np.array([[1,0],[1,1],[0,1],[0,0]])
np.array([1,1,0,0])
np.array([[1,0],[0,1]])