- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
从很多文档中,我了解到岭回归的秘诀是:
loss_Ridge = loss_function + lambda x L2 norm of slope
Lasso 回归的秘诀是:
loss_Lasso = loss_function + lambda x L1 norm of slope
当我读到“TensorFlow Machine Learning Cookbook”中的主题“实现套索和岭回归”时,其作者解释说:
"...we will use a continuous approximation to a step function, called the continuous heavy step function..."
及其作者还提供了代码行 here 。我不明白在这种情况下哪个被称为“连续重阶跃函数”。请帮助我。
最佳答案
从您提供的链接中,
if regression_type == 'LASSO':
# Declare Lasso loss function
# Lasso Loss = L2_Loss + heavyside_step,
# Where heavyside_step ~ 0 if A < constant, otherwise ~ 99
lasso_param = tf.constant(0.9)
heavyside_step = tf.truediv(1., tf.add(1., tf.exp(tf.multiply(-50., tf.subtract(A, lasso_param)))))
regularization_param = tf.multiply(heavyside_step, 99.)
loss = tf.add(tf.reduce_mean(tf.square(y_target - model_output)), regularization_param)
这个heavyside_step
函数非常接近逻辑函数,而逻辑函数又可以是阶跃函数的连续逼近。
您使用连续逼近,因为损失函数需要相对于模型参数可微。
要获得有关的直觉,请阅读 https://www.cs.ubc.ca/~schmidtm/Documents/2005_Notes_Lasso.pdf 中的约束公式第 1.6 节。
您可以在代码中看到,如果 A < 0.9,则regularization_param 消失,因此优化会将 A 限制在该范围内。
关于python - 套索回归 : The continuous heavy step function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56387591/
编码新手,无法弄清楚为什么 continue 在我的 for 循环中不起作用。在打印语句之后,我想从顶部重新开始循环。如果有人能让我知道我做错了什么,那就太好了。我不允许共享 cse231_rando
我正在尝试运行连续异步查询。在我的 Windows 盒子上,我通过双击 ignite.bat 文件启动了 Apache Ignite,并尝试运行以下代码 - Data Publisher 客户端包点燃
目前我正在尝试了解 openCV 中连续矩阵和非连续矩阵之间的一些区别。有人向我建议连续矩阵提供更好的性能,因为程序不必在每一列的末尾跳回到下一行的开头。 简而言之,连续和非连续矩阵之间的可比较性能差
我有一个运行多个行的 cron,删除“坏”的行(根据我的标准)。我只是想知道优化脚本的最佳方法是什么。我可以执行以下操作之一: 让同一个 cron 在发现“坏”行后立即删除它们。 让相同的 cron
我已经在我的 Tfs2010 实例上运行了一个 CI 构建,但我还想运行一个门控检入构建。然而,我希望这两个构建运行的方式之间存在细微的差异。具体来说,我希望 Gated checkin 在失败时不产
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题?通过 editing this post 添加详细信息并澄清问题. 1年前关闭。 Improve this
Here和 here据说Continuation Monad解决了回调 hell 。 RX 和 FRP 也解决了回调 hell 。 如果所有这三个工具都解决了回调 hell ,那么就会出现以下问题:
我的 Java 缩进风格可能有点特殊,我经常这样写: object.myMethod( myFirstArgument, mySecondArgument, myThirdArgument,
关闭。这个问题需要details or clarity .它目前不接受答案。 想要改进这个问题吗? 通过 editing this post 添加详细信息并澄清问题. 关闭 2 年前。 Improve
我正在使用苹果的 SpriteKit 和 Swift 制作一个简单的游戏,并且遇到了问题。我试图让桨节点(paddle)围绕圆内的固定节点(anchorNode)连续旋转;但是,我无法弄清楚如何使桨节
我正在尝试为控制系统编写一个自适应 Controller ,即使用 Q-learning 的电源管理系统。我最近为车杆系统实现了一个玩具强化学习问题,并根据 Andrew NG 的笔记制定了直升机控制
我想知道一种原生支持定界延续的编程语言。我确实知道 Scala 曾经有 shift 和 reset,但这些都被删除了;而且我也知道 Seaside 似乎有类似的东西,但 Seaside 是一个图书馆,
在本教程中,您将通过示例了解 continue 语句。 continue 语句用于跳过循环的当前迭代,程序的控制流转到下一个迭代。 continue 语句的语法是: continue
背景 目前,我在本地构建解决方案时运行预构建命令。但是,在我的 VSTS 持续集成服务器上构建时不需要此命令。 问题 有没有办法在本地机器上构建时只运行预构建事件命令? 我知道您可以添加如下条件语句。
我有时会有 1 或 2 个测试在 CI 中失败,并且重新运行构建会导致它们通过。 如何自动重新运行这些不稳定的测试,以便我的构建第一次通过?有没有类似 mocha 的东西的this.retries ?
希望有人可以帮助我解决这个问题。让 TeamCity 启动并运行并在各种项目上进行构建。我希望能够自动将成功的 TeamCity 运行构建复制/部署到测试服务器。 我正在考虑使用 PowerShell
我希望使用持续集成,但我对 Ant、Jenkins、CruiseControl、Phing、PHPUnderControl 等并不了解…… 什么是真正的持续集成? 我正在使用 Zend Framewo
我已将 travis 设置为使用 tox(Python 2.7 和 3.5)进行测试并部署到 pypi。 Travis 尝试为每次测试运行部署包,而 pypi 正确地拒绝了第二次尝试。 我希望 tra
我正在尝试使用 pem key 将一些文件 scp 到不同的计算机,所以我不需要我的密码。但是,每次我尝试连接到一个新盒子时,它都会问我“说真的,你想连接吗?你想保存 key 吗?......”这太烦
使用dvc无疑有很多优势,它可以像集中式vcs一样使用,但是具有本地提交功能并且能够很容易地将项目 fork 给一些较小的团队,从而使得更难于支持持续集成吗?它有助于开发,使每个人都可以访问由CI服务
我是一名优秀的程序员,十分优秀!