()
| 6 | |
| 7 | |
| 8 | def classification(): |
| 9 | # Generate a random binary classification problem. |
| 10 | X, y = make_classification( |
| 11 | n_samples=1000, |
| 12 | n_features=10, |
| 13 | n_informative=10, |
| 14 | random_state=1111, |
| 15 | n_classes=2, |
| 16 | class_sep=2.5, |
| 17 | n_redundant=0, |
| 18 | ) |
| 19 | X_train, X_test, y_train, y_test = train_test_split( |
| 20 | X, y, test_size=0.1, random_state=1111 |
| 21 | ) |
| 22 | |
| 23 | model = NaiveBayesClassifier() |
| 24 | model.fit(X_train, y_train) |
| 25 | predictions = model.predict(X_test)[:, 1] |
| 26 | |
| 27 | print("classification accuracy", roc_auc_score(y_test, predictions)) |
| 28 | |
| 29 | |
| 30 | if __name__ == "__main__": |
no test coverage detected