()
| 16 | |
| 17 | |
| 18 | def classification(): |
| 19 | # Generate a random binary classification problem. |
| 20 | X, y = make_classification( |
| 21 | n_samples=350, |
| 22 | n_features=15, |
| 23 | n_informative=10, |
| 24 | random_state=1111, |
| 25 | n_classes=2, |
| 26 | class_sep=1.0, |
| 27 | n_redundant=0, |
| 28 | ) |
| 29 | X_train, X_test, y_train, y_test = train_test_split( |
| 30 | X, y, test_size=0.15, random_state=1111 |
| 31 | ) |
| 32 | |
| 33 | model = GradientBoostingClassifier( |
| 34 | n_estimators=50, max_depth=4, max_features=8, learning_rate=0.1 |
| 35 | ) |
| 36 | model.fit(X_train, y_train) |
| 37 | predictions = model.predict(X_test) |
| 38 | print(predictions) |
| 39 | print(predictions.min()) |
| 40 | print(predictions.max()) |
| 41 | print("classification, roc auc score: %s" % roc_auc_score(y_test, predictions)) |
| 42 | |
| 43 | |
| 44 | def regression(): |
no test coverage detected