Raphael C
2016-03-12 13:56:43 UTC
I am attempting to draw a decision tree using:
reg = DecisionTreeRegressor(max_depth=None,min_samples_split=1)
reg.fit(X,Y)
dot_data = StringIO()
tree.export_graphviz(reg, out_file=dot_data,
feature_names=feature_names,
filled=True, rounded=True,
special_characters=True)
graph = pydot.graph_from_dot
This gives me the error message
File "/usr/lib/python2.7/dist-packages/pydot.py", line 1802, in <lambda>
lambda f=frmt, prog=self.prog : self.create(format=f, prog=prog))
File "/usr/lib/python2.7/dist-packages/pydot.py", line 2023, in create
status, stderr_output) )
pydot.InvocationException: Program terminated with status: 1. stderr
follows: Error: not well-formed (invalid token) in line 1
... <HTML>Design & Tech. 3D Design=A ≤ 0.5 ...
in label of node 17
Error: not well-formed (invalid token) in line 1
... <HTML>Design & Tech. Product Design=A ≤ 0.5 ...
in label of node 68
Is this because there is some restriction on the types of strings that
are supported as feature names?
Two of the feature names are:
'Design & Tech. 3D Design=A'
and
'Design & Tech. Product Design=A'
Raphael
reg = DecisionTreeRegressor(max_depth=None,min_samples_split=1)
reg.fit(X,Y)
dot_data = StringIO()
tree.export_graphviz(reg, out_file=dot_data,
feature_names=feature_names,
filled=True, rounded=True,
special_characters=True)
graph = pydot.graph_from_dot
This gives me the error message
File "/usr/lib/python2.7/dist-packages/pydot.py", line 1802, in <lambda>
lambda f=frmt, prog=self.prog : self.create(format=f, prog=prog))
File "/usr/lib/python2.7/dist-packages/pydot.py", line 2023, in create
status, stderr_output) )
pydot.InvocationException: Program terminated with status: 1. stderr
follows: Error: not well-formed (invalid token) in line 1
... <HTML>Design & Tech. 3D Design=A ≤ 0.5 ...
in label of node 17
Error: not well-formed (invalid token) in line 1
... <HTML>Design & Tech. Product Design=A ≤ 0.5 ...
in label of node 68
Is this because there is some restriction on the types of strings that
are supported as feature names?
Two of the feature names are:
'Design & Tech. 3D Design=A'
and
'Design & Tech. Product Design=A'
Raphael