-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (22 loc) · 808 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (22 loc) · 808 Bytes
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
import numpy as np
import logging as log
import debugpy
from sklearn.datasets import make_hastie_10_2
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
debugpy.listen(("0.0.0.0", 5678))
log.info("Waiting for client to attach...")
debugpy.wait_for_client()
def main():
X, y = make_hastie_10_2(random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
clf = RandomForestClassifier(n_estimators=1000)
clf = clf.fit(X_train, y_train)
debugpy.breakpoint()
predictions = clf.predict(X_test)
with open("predictions.txt", "w") as f:
np.savetxt(f, predictions)
debugpy.breakpoint()
log.info("Training complete!")
if __name__ == "__main__":
main()