human
I am working on the file ".ipynb_checkpoints/sf_crime-checkpoint.ipynb".
The first task is:
The Bernoulli Naive Bayes and Multinomial Naive Bayes models can predict whether a loan will be good or bad with XXX% accuracy.
Hyperparameter tuning:
The optimal Laplace smoothing parameter $\alpha$ for the Bernoulli NB model:
Model calibration:
Notes
Final evaluation on test data
Can you write Python code for it?

What is a the Python code you requested?
assistant
#Here is the Python code you requested.

# def model_test(train_data, train_labels, eval_data, eval_labels):
#     '''Similar to the initial model prototyping, but using the 
#     tuned parameters on data that none of the models have yet
#     encountered.'''
#     knn = KNeighborsClassifier(n_neighbors=7).fit(train_data, train_labels)
#     bnb = BernoulliNB(alpha=0.0000000000000000000001, binarize = 0.5).fit(train_data, train_labels)
    
#     models = [knn, bnb]
#     for model in models:
#         eval_preds = model.predict(eval_data)
#         print(model, "Accuracy:", np.mean(eval_preds==eval_labels), "\n\n")

# model_test(train_data, train_labels, test_data, test_labels)