symbol_regression.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Artificial-Intelligence-with-Python 作者: PacktPublishing 项目源码 文件源码
def eval_func(individual, points):
    # Transform the tree expression in a callable function
    func = toolbox.compile(expr=individual)

    # Evaluate the mean squared error
    mse = ((func(x) - (2 * x**3 - 3 * x**2 + 4 * x - 1))**2 for x in points)

    return math.fsum(mse) / len(points),

# Function to create the toolbox
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号