-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsklean_graph.py
More file actions
32 lines (27 loc) · 857 Bytes
/
sklean_graph.py
File metadata and controls
32 lines (27 loc) · 857 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
30
31
32
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
import time
from sklearn.datasets import load_iris
from sklearn import tree
import argparse
from linecache import getline, clearcache
sys.path.append(os.path.join("./"))
from base import plot2d, plot3d
import logging
logging.getLogger('matplotlib').setLevel(logging.ERROR)
if __name__ == '__main__':
argvs = sys.argv
parser = argparse.ArgumentParser()
parser.add_argument("--dir", dest="dir", default="./")
parser.add_argument("--pxyz", dest="pxyz",
default=[0.0, 0.0, 0.0], type=float, nargs=3)
opt = parser.parse_args()
print(opt, argvs)
obj = plot2d(aspect="equal")
clf = tree.DecisionTreeClassifier(random_state=0)
iris = load_iris()
clf = clf.fit(iris.data, iris.target)
tree.plot_tree(clf)
obj.SavePng()