MCPcopy Index your code
hub / github.com/apachecn/ailearning / modelErr

Function modelErr

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

Desc: 在给定数据集上计算误差。 Args: dataSet -- 输入数据集 Returns: 调用 linearSolve 函数,返回 yHat 和 Y 之间的平方误差。

(dataSet)

Source from the content-addressed store, hash-verified

264
265# 计算线性模型的误差值
266def modelErr(dataSet):
267 """
268 Desc:
269 在给定数据集上计算误差。
270 Args:
271 dataSet -- 输入数据集
272 Returns:
273 调用 linearSolve 函数,返回 yHat 和 Y 之间的平方误差。
274 """
275 ws, X, Y = linearSolve(dataSet)
276 yHat = X * ws
277 # print corrcoef(yHat, Y, rowvar=0)
278 return sum(power(Y - yHat, 2))
279
280
281 # helper function used in two places

Callers

nothing calls this directly

Calls 1

linearSolveFunction · 0.85

Tested by

no test coverage detected