我使用以下代码获取CHAID的决策树
independent_variable_columns = ['gender', 'grade', 'no_renewals', 'complaint_count']
dep_variable = 'switch'
tree = Tree.from_pandas_df(
df,
dict(zip(independent_variable_columns, ['nominal'] * 38)),
dep_variable,
max_depth=2
)
tree.to_tree()
tree.render()
但是我遇到以下错误
File "C:\Users\data\AppData\Local\Continuum\anaconda3\lib\site-packages\CHAID\graph.py", line 93, in <listcomp>
[os.remove(file) for file in self.files]
FileNotFoundError: [WinError 3] The system cannot find the path specified: '/tmp/157840175993116164207458496094.png'
该特定库在生成文件名和处理临时文件时未实现最佳实践。这使他们的代码在Windows上以多种方式中断。
请参阅节制理论以获取关于节制理念的信息。