Non-delusional Q-learning and Value Iteration笔记

Non-delusional Q-learning and Value Iteration

1. 论文讲了什么/主要贡献是什么

文章发现了Q-learning和带有函数逼近或其它策略约束的近似动态规划中存在错觉偏差的问题,并且对错觉偏差进行了定义。发现了一个可以提升算法性能的方式。并且文中开发了一种新的策略类一致性备份操作符,以及相应的基于模型的PCVI和无模型的PCQL算法,这些算法完全消除了错觉偏差。

错觉偏差:在进行策略选择和值函数更新时,每步都采用了贪婪策略,选择了值函数最大对应的动作,但在一个策略下可能无法完成采用贪婪策略所选择的动作序列,因此在更新过程中的值函数与实际可达到的最优值函数也是存在偏差的。

2. 论文摘要:

We identify a fundamental source of error in Q-learning and other forms of dynamic programming with function approximation. Delusional bias arises when the approximation architecture limits the class of expressible greedy policies. Since standard Q-updates make globally uncoordinated action choices with respect to the expressible policy class, inconsistent or even conflicting Q-value estimates can result, leading to pathological behaviour such as over/under-estimation, instability and even divergence. To solve this problem, we introduce a new notion of policy consistency and define a local backup process that ensures global consistency through the use of information sets—sets that record constraints on policies consistent with backed-up Q-values. We prove that both the model-based and model-free algorithms using this backup remove delusional bias, yielding the first known algorithms that guarantee optimal results under general conditions. These algorithms furthermore only require polynomially many information sets (from a potentially exponential support). Finally, we suggest other practical heuristics for value-iteration and Q-learning that attempt to reduce delusional bias.

我们确定了Q-learning和其他形式的带有函数近似的动态规划的基本误差来源。当近似结构限制了可表达的贪婪策略的类别时,产生了错觉性偏差。由于标准的Q-updates对可表达的策略类做出全局不协调的行动选择,可能导致不一致甚至相互冲突的Q值估计,导致过度/低估、不稳定甚至发散等病态行为。为了解决这个问题,我们引入了一个新的策略一致性概念,并定义了一个本地备份过程,该过程通过使用信息集来确保全局一致性——这些信息集记录与备份的Q值一致的策略约束。我们证明使用这种备份的基于模型和无模型的算法都消除了错觉偏差,成为了在一般条件下保证最优结果的第一个已知算法。这些算法进一步只需要多项式多的信息集(来自潜在的指数支持)。最后,我们建议其他实用的启发式的价值迭代和Q-learning,试图减少错觉偏差。

3. 论文主要观点:

3.1 背景:

Q-learning的方法能够收敛到一个最优的状态-动作值函数,但是在使用函数逼近器,即使是简单的线性函数逼近器也会带来潜在的不稳定问题。目前有很多方法在调整更新方式、限制逼近器以及限制训练方法方面保证收敛性或提高逼近器表现。但是简单的调整可能无法保证达到最优表现,因为判断一个逼近器是否可以在最坏Bellman错误情况下有最小的误差是一个NP完全难题。因此设计一个Q-learning的具有好的最坏情况下的行为的变体仍然是一个问题。

3.2 问题:

Q-learning存在错觉偏差的问题。因为更新过程是基于相互不一致的值。出现这种不一致是因为Q更新是根据下一状态所有动作估计的最大值进行的,忽略了在逼近器中获得的可接受策略下无法实现选定动作的问题。这些“无约束”的更新会在目标值中产生错误,并导致不同的价值估计错误:Q-learning很容易根据贪婪策略类无法实现的操作选择来备份值。

3.3 方法:

首先说明一些符号表示, F = { f θ : S × A → R ∣ θ ∈ Θ } \mathcal{F}=\left\{f_{\theta}: S \times A \rightarrow \mathbb{R} | \theta \in \Theta\right\} F={ fθ:S×ARθΘ}表示可表示值函数逼近器集合,将可容许贪婪策略类表示为:
G ( Θ ) = { π θ ∣ π θ ( s

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,根据您的要求,我来为您实现一个基于Model2思想的用户注册功能程序,并增加学号、学校、专业属性,并对学号唯一性进行验证。 首先,我们需要创建一个名为"register.jsp"的JSP页面,用于接收用户注册信息和展示注册结果。代码如下: ```jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>User Register</title> </head> <body> <h1>User Register</h1> <%-- 显示注册结果 --%> <p>${msg}</p> <%-- 注册表单 --%> <form action="register.do" method="post"> <p> <label for="username">Username:</label> <<input type="text" name="username" id="username" /> </p> <p> <label for="password">Password:</label> <input type="password" name="password" id="password" /> </p> <p> <label for="email">Email:</label> <input type="text" name="email" id="email" /> </p> <p> <label for="studentId">Student ID:</label> <input type="text" name="studentId" id="studentId" /> </p> <p> <label for="school">School:</label> <input type="text" name="school" id="school" /> </p> <p> <label for="major">Major:</label> <input type="text" name="major" id="major" /> </p> <p> <input type="submit" value="Register" /> </p> </form> </body> </html> ``` 接下来,我们需要创建一个名为"register.do"的Servlet,用于处理用户提交的注册信息,并进行学号唯一性验证。代码如下: ```java package com.example.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.example.dao.UserDao; import com.example.dao.impl.UserDaoImpl; import com.example.model.User; @WebServlet("/register.do") public class RegisterServlet extends HttpServlet { private static final long serialVersionUID = 1L; private UserDao userDao = new UserDaoImpl(); protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 获取用户提交的注册信息 String username = request.getParameter("username"); String password = request.getParameter("password"); String email = request.getParameter("email"); String studentId = request.getParameter("studentId"); String school = request.getParameter("school"); String major = request.getParameter("major"); // 验证学号唯一性 if (userDao.getUserByStudentId(studentId) != null) { request.setAttribute("msg", "Student ID already exists."); request.getRequestDispatcher("/register.jsp").forward(request, response); return; } // 创建用户对象 User user = new User(); user.setUsername(username); user.setPassword(password); user.setEmail(email); user.setStudentId(studentId); user.setSchool(school); user.setMajor(major); // 添加用户到数据库 userDao.addUser(user); // 设置注册成功消息 request.setAttribute("msg", "Register successfully."); // 跳转到注册结果页面 request.getRequestDispatcher("/register.jsp").forward(request, response); } } ``` 在上述代码中,我们首先获取用户提交的注册信息,然后进行学号唯一性验证,如果学号已经存在,则返回错误提示信息,否则创建用户对象并添加到数据库中,并设置注册成功消息,最后跳转到注册结果页面。 最后,我们需要创建一个名为"UserDao.java"的DAO接口和一个名为"UserDaoImpl.java"的DAO实现类,用于操作数据库中的用户数据。代码如下: ```java package com.example.dao; import com.example.model.User; public interface UserDao { void addUser(User user); User getUserByStudentId(String studentId); } ``` ```java package com.example.dao.impl; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.example.dao.UserDao; import com.example.model.User; import com.example.util.DbUtil; public class UserDaoImpl implements UserDao { private Connection conn = null; private PreparedStatement pstmt = null; private ResultSet rs = null; @Override public void addUser(User user) { try { conn = DbUtil.getConnection(); String sql = "INSERT INTO users(username, password, email, student_id, school, major) VALUES(?, ?, ?, ?, ?, ?)"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, user.getUsername()); pstmt.setString(2, user.getPassword()); pstmt.setString(3, user.getEmail()); pstmt.setString(4, user.getStudentId()); pstmt.setString(5, user.getSchool()); pstmt.setString(6, user.getMajor()); pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(conn, pstmt, rs); } } @Override public User getUserByStudentId(String studentId) { User user = null; try { conn = DbUtil.getConnection(); String sql = "SELECT * FROM users WHERE student_id=?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, studentId); rs = pstmt.executeQuery(); if (rs.next()) { user = new User(); user.setId(rs.getInt("id")); user.setUsername(rs.getString("username")); user.setPassword(rs.getString("password")); user.setEmail(rs.getString("email")); user.setStudentId(rs.getString("student_id")); user.setSchool(rs.getString("school")); user.setMajor(rs.getString("major")); } } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(conn, pstmt, rs); } return user; } } ``` 在上述代码中,我们使用了DbUtil工具类来获取数据库连接,并使用PreparedStatement来执行SQL语句,同时使用ResultSet来处理查询结果。注意,在addUser方法中,我们没有对PreparedStatement对象和ResultSet对象进行关闭操作,这是因为在该方法中,我们使用了try-with-resources语句来自动关闭资源。 现在,我们就完成了用户注册功能程序的实现,用户可以通过访问"register.jsp"页面来注册账号,并填写学号、学校、专业等信息,同时系统会自动验证学号的唯一性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值