-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_sklearn_estimators.py
45 lines (29 loc) · 1.26 KB
/
get_sklearn_estimators.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import json
from sklearn.utils import all_estimators
def print_data():
estimators = all_estimators(type_filter=["regressor", "cluster", "classifier"])
estimator_names = [x[0] for x in estimators]
optimizer = ["GridSearchCV", "HalvingGridSearchCV", "RandomizedSearchCV", "HalvingRandomizedSearchCV"]
data = estimator_names + optimizer
for x in data:
print(x)
print(len(data))
def main():
sklearn_estimators = []
sklearn_exp_settings = []
estimators = all_estimators(type_filter=["classifier", "regressor", "cluster"])
estimator_names = [x[0] for x in estimators]
with open("modules/sklearn_default_values.json", "r", encoding="utf-8") as src:
data = json.load(src)
for item in data:
if item["name"] in estimator_names:
sklearn_estimators.append(item)
else:
sklearn_exp_settings.append(item)
with open("modules/sklearn_estimators.json", "w", encoding="utf-8") as src:
json.dump(sklearn_estimators, src, indent=4, sort_keys=True)
with open("modules/sklearn_exp_settings.json", "w", encoding="utf-8") as src:
json.dump(sklearn_exp_settings, src, indent=4, sort_keys=True)
if __name__ == "__main__":
print_data()
main()