MCPcopy
hub / github.com/apachecn/ailearning / isTree

Function isTree

src/python/9.RegTrees/regTrees.py:172–181  ·  view source on GitHub ↗

Desc: 测试输入变量是否是一棵树,即是否是一个字典 Args: obj -- 输入变量 Returns: 返回布尔类型的结果。如果 obj 是一个字典,返回true,否则返回 false

(obj)

Source from the content-addressed store, hash-verified

170
171# 判断节点是否是一个字典
172def isTree(obj):
173 """
174 Desc:
175 测试输入变量是否是一棵树,即是否是一个字典
176 Args:
177 obj -- 输入变量
178 Returns:
179 返回布尔类型的结果。如果 obj 是一个字典,返回true,否则返回 false
180 """
181 return (type(obj).__name__ == 'dict')
182
183
184# 计算左右枝丫的均值

Callers 3

getMeanFunction · 0.85
pruneFunction · 0.85
treeForeCastFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected