-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest_models.txt
More file actions
31 lines (27 loc) · 1.02 KB
/
test_models.txt
File metadata and controls
31 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Failed:
def build():
creditClf = LogisticRegression(random_state=1)
creditClf.fit(X=X_train, y=y_train)
return creditClf
Failed:
def build():
creditClf = RandomForestClassifier(n_estimators=20, random_state=1)
creditClf.fit(X=X_train, y=y_train)
return creditClf
Passed:
def build():
clf = RandomForestClassifier(random_state=1)
# specify parameters and distributions to sample from
param_dist = {"n_estimators": [20, 30, 40, 50, 60, 70, 80],
"max_depth": [3, 4, 5, None],
"max_features": sp_randint(1, 11),
"min_samples_split": sp_randint(2, 11),
"min_samples_leaf": sp_randint(1, 11),
"bootstrap": [True, False],
"criterion": ["gini", "entropy"]}
# run randomized search
n_iter_search = 1000
creditClf = RandomizedSearchCV(clf, param_distributions=param_dist,
n_iter=n_iter_search)
creditClf.fit(X=X_train, y=y_train)
return creditClf