MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / classification

Function classification

examples/gbm.py:18–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def 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
44def regression():

Callers 1

gbm.pyFile · 0.70

Calls 3

fitMethod · 0.95
predictMethod · 0.45

Tested by

no test coverage detected