Maximum Margin Planning

本文探讨了如何自动化地将感知特征映射到成本,不再局限于与期望点的距离,而是扩展到与示例数据点集的距离。通过引入二次规划形式和有效优化方法,论文提出了在非可微目标函数上的收敛解决方案,并提供了伪代码以辅助理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[source] ICML

[year] 2006

to automate the mapping from perception features to costs

 

不再只是与一个点(期望)间的距离,而是与示例数据点集间的距离

文章先提出Quadratic Programming Formulation

再Efficient Optimization,有伪代码,取subgradient 方向,即使在non-differentiable目标函数上依然收敛。

 

From wiki:

Subgradient methods are iterative methods for solving convex minimization problems. Originally developed by Naum Z. Shor and others in the 1960s and 1970s, subgradient methods are convergent when applied even to a non-differentiable objective function. When the objective function is differentiable, subgradient methods for unconstrained problems use the same search direction as the method of steepest descent.

Subgradient methods are slower than Newton's method when applied to minimize twice continuously differentiable convex functions. However, Newton's method fails to converge on problems that have non-differentiable kinks.

The subgradient

The concepts of subderivative and subdifferential can be generalized to functions of several variables. If f:UR is a real-valued convex function defined on a convex open setin the Euclidean space Rn, a vector v in that space is called a subgradient at a point x0 in U if for any x in U one has

f(x)-f(x_0)\ge v\cdot (x-x_0)

where the dot denotes the dot product. The set of all subgradients at x0 is called the subdifferential at x0 and is denoted ∂f(x0). The subdifferential is always a nonempty convex compact set.

These concepts generalize further to convex functions f:UR on a convex set in a locally convex space V. A functional v in the dual space V is called subgradient at x0 in Uif

f(x)-f(x_0)\ge v^*(x-x_0).

The set of all subgradients at x0 is called the subdifferential at x0 and is again denoted ∂f(x0). The subdifferential is always a convex closed set. It can be an empty set; consider for example an unbounded operator, which is convex, but has no subgradient. If f is continuous, the subdifferential is nonempty.

 

次导数和次微分的概念可以推广到多元函数。如果f:UR是一个实变量凸函数,定义在欧几里得空间Rn内的凸集,则该空间内的向量v称为函数在点x0的次梯度,如果对于所有U内的x,都有:

f(x)-f(x_0)\ge v\cdot (x-x_0)

所有次梯度的集合称为次微分,记为∂f(x0)。次微分总是非空的凸紧集

转载于:https://www.cnblogs.com/justin_s/archive/2011/06/05/2073279.html

### 如何设置或调整 QSlider 的外边距 在 Qt 中,`QSlider` 是一种常用的控件,用于让用户通过拖动滑块来选择数值。为了调整 `QSlider` 的外边距,可以通过样式表(Style Sheets)或者布局管理器(Layout Manager)实现。 #### 使用样式表设置外边距 Qt 提供了强大的样式表功能,可以像 CSS 一样定义控件的外观属性。对于 `QSlider`,可以通过 `margin` 属性设置其外边距[^1]: ```css QSlider { margin: 10px; } ``` 上述代码会为 `QSlider` 添加 10 像素的外边距。如果需要分别设置上、右、下、左四个方向的外边距,则可以如下操作: ```css QSlider { margin-top: 10px; margin-right: 20px; margin-bottom: 10px; margin-left: 20px; } ``` #### 使用布局管理器设置外边距 除了样式表之外,还可以利用 Qt 的布局系统来控制 `QSlider` 的外边距。例如,在创建布局时,可以调用 `setContentsMargins()` 方法来设置子控件的外边距: ```python layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(10, 20, 30, 40) # 左 上 右 下 边距 slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) layout.addWidget(slider) ``` 此方法适用于更复杂的界面设计场景,尤其是当多个控件共享同一个父容器时。 #### 处理滑块移动事件中的边界问题 在某些情况下,可能需要手动干预 `QSlider` 的行为以解决潜在的边界问题。例如,当用户快速拖动滑块超出预期范围时,可能会触发异常状态。此时可以在滑动结束时校正滑块的位置[^2]: ```python def handle_slider_moved(self, value): if self.slider.orientation() == QtCore.Qt.Horizontal: max_value = self.slider.maximum() min_value = self.slider.minimum() if value > max_value: self.slider.setValue(max_value) elif value < min_value: self.slider.setValue(min_value) self.slider.valueChanged.connect(handle_slider_moved) ``` 以上代码确保即使发生意外情况,滑块也会被重置到有效范围内。 --- ### 注意事项 - 如果同时使用样式表和布局管理器设置外边距,两者的效果可能会相互叠加,请注意协调配置。 - 对于垂直方向上的 `QSlider`,宽度通常由 `width` 属性决定;而对于水平方向上的 `QSlider`,高度则由 `height` 属性决定。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值