ibatis入门

单目视觉定位:深入解析PNP算法在机器人导航中的实战应用 本文深入解析了PNP算法在机器人单目视觉定位中的核心原理与实战应用。通过拆解坐标变换四步,详细阐述了如何从二维图像点反求相机三维位姿。文章结合OpenCV的solvePnP函数,提供了算法选择、参数调优及结果后处理的实用指南,并针对机器人导航中的特征匹配、尺度不确定性等挑战,给出了鲁棒性优化与实时性平衡的解决方案。 阅读详情

iBatis 简介:

iBatis 是apache 的一个开源项目,一个O/R Mapping 解决方案,iBatis 最大的特点就是小巧,上手很快。如果不需要太多复杂的功能,iBatis 是能够满足你的要求又足够灵活的最简单的解决方案,现在的iBatis 已经改名为Mybatis 了。

官网为:http://www.mybatis.org/

搭建iBatis 开发环境:

1 、导入相关的jar 包,ibatis-2.3.0.677.jar 、mysql-connector-java-5.1.6-bin.jar

2 、编写配置文件:

Jdbc 连接的属性文件

总配置文件, SqlMapConfig.xml

关于每个实体的映射文件(Map 文件)

 

Demo :

Student.java:

Java代码   收藏代码
  1. package com.iflytek.entity;  
  2.   
  3. import java.sql.Date;  
  4.   
  5. /** 
  6.  * @author xudongwang 2011-12-31 
  7.  *  
  8.  *         Email:xdwangiflytek@gmail.com 
  9.  *  
  10.  */  
  11. public class Student {  
  12.     // 注意这里需要保证有一个无参构造方法,因为包括Hibernate在内的映射都是使用反射的,如果没有无参构造可能会出现问题  
  13.     private int id;  
  14.     private String name;  
  15.     private Date birth;  
  16.     private float score;  
  17.   
  18.     public int getId() {  
  19.         return id;  
  20.     }  
  21.   
  22.     public void setId(int id) {  
  23.         this.id = id;  
  24.     }  
  25.   
  26.     public String getName() {  
  27.         return name;  
  28.     }  
  29.   
  30.     public void setName(String name) {  
  31.         this.name = name;  
  32.     }  
  33.   
  34.     public Date getBirth() {  
  35.         return birth;  
  36.     }  
  37.   
  38.     public void setBirth(Date birth) {  
  39.         this.birth = birth;  
  40.     }  
  41.   
  42.     public float getScore() {  
  43.         return score;  
  44.     }  
  45.   
  46.     public void setScore(float score) {  
  47.         this.score = score;  
  48.     }  
  49.   
  50.     @Override  
  51.     public String toString() {  
  52.         return "id=" + id + "\tname=" + name + "\tmajor=" + birth + "\tscore="  
  53.                 + score + "\n";  
  54.     }  
  55.   
  56. }  

 

SqlMap.properties :

Properties代码   收藏代码
  1. driver=com.mysql.jdbc.Driver  
  2. url=jdbc:mysql://localhost:3306/ibatis  
  3. username=root  
  4. password=123  

 

Student.xml :

Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"  
  3.    "http://ibatis.apache.org/dtd/sql-map-2.dtd">  
  4.   
  5. <sqlMap>  
  6.     <!-- 通过typeAlias使得我们在下面使用Student实体类的时候不需要写包名 -->  
  7.     <typeAlias alias="Student" type="com.iflytek.entity.Student" />  
  8.   
  9.     <!-- 这样以后改了sql,就不需要去改java代码了 -->  
  10.     <!-- id表示select里的sql语句,resultClass表示返回结果的类型 -->  
  11.     <select id="selectAllStudent" resultClass="Student">  
  12.         select * from  
  13.         tbl_student  
  14.     </select>  
  15.   
  16.     <!-- parameterClass表示参数的内容 -->  
  17.     <!-- #表示这是一个外部调用的需要传进的参数,可以理解为占位符 -->  
  18.     <select id="selectStudentById" parameterClass="int" resultClass="Student">  
  19.         select * from tbl_student where id=#id#  
  20.     </select>  
  21.   
  22.     <!-- 注意这里的resultClass类型,使用Student类型取决于queryForList还是queryForObject -->  
  23.     <select id="selectStudentByName" parameterClass="String"  
  24.         resultClass="Student">  
  25.         select name,birth,score from tbl_student where name like  
  26.         '%$name$%'  
  27.     </select>  
  28.   
  29.     <insert id="addStudent" parameterClass="Student">  
  30.         insert into  
  31.         tbl_student(name,birth,score) values  
  32.         (#name#,#birth#,#score#);  
  33.         <selectKey resultClass="int" keyProperty="id">  
  34.             select @@identity as inserted  
  35.             <!-- 这里需要说明一下不同的数据库主键的生成,对各自的数据库有不同的方式: -->  
  36.             <!-- mysql:SELECT LAST_INSERT_ID() AS VALUE -->  
  37.             <!-- mssql:select @@IDENTITY as value -->  
  38.             <!-- oracle:SELECT STOCKIDSEQUENCE.NEXTVAL AS VALUE FROM DUAL -->  
  39.             <!-- 还有一点需要注意的是不同的数据库生产商生成主键的方式不一样,有些是预先生成 (pre-generate)主键的,如Oracle和PostgreSQL。   
  40.                 有些是事后生成(post-generate)主键的,如MySQL和SQL Server 所以如果是Oracle数据库,则需要将selectKey写在insert之前 -->  
  41.         </selectKey>  
  42.     </insert>  
  43.   
  44.     <delete id="deleteStudentById" parameterClass="int">  
  45.         <!-- #id#里的id可以随意取,但是上面的insert则会有影响,因为上面的name会从Student里的属性里去查找 -->  
  46.         <!-- 我们也可以这样理解,如果有#占位符,则ibatis会调用parameterClass里的属性去赋值 -->  
  47.         delete from tbl_student where id=#id#  
  48.     </delete>  
  49.   
  50.     <update id="updateStudent" parameterClass="Student">  
  51.         update tbl_student set  
  52.         name=#name#,birth=#birth#,score=#score# where id=#id#  
  53.     </update>  
  54.   
  55. </sqlMap>  

 

说明:

如果xml 中没有ibatis 的提示,则window --> Preference--> XML-->XML Catalog---> 点击add

选择uri URI: 请选择本地文件系统上

iBatisDemo1/WebContent/WEB-INF/lib/sql-map-config-2.dtd 文件;

Key Type: 选择Schema Location;

Key: 需要联网的,不建议使用;

 

SqlMapConfig.xml :

Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"  
  3.     "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">  
  4.   
  5. <sqlMapConfig>  
  6.     <!-- 引用JDBC属性的配置文件 -->  
  7.     <properties resource="com/iflytek/entity/SqlMap.properties" />  
  8.     <!-- 使用JDBC的事务管理 -->  
  9.     <transactionManager type="JDBC">  
  10.         <!-- 数据源 -->  
  11.         <dataSource type="SIMPLE">  
  12.             <property name="JDBC.Driver" value="${driver}" />  
  13.             <property name="JDBC.ConnectionURL" value="${url}" />  
  14.             <property name="JDBC.Username" value="${username}" />  
  15.             <property name="JDBC.Password" value="${password}" />  
  16.         </dataSource>  
  17.     </transactionManager>  
  18.     <!-- 这里可以写多个实体的映射文件 -->  
  19.     <sqlMap resource="com/iflytek/entity/Student.xml" />  
  20. </sqlMapConfig>  

 

StudentDao :

Java代码   收藏代码
  1. package com.iflytek.dao;  
  2.   
  3. import java.util.List;  
  4.   
  5. import com.iflytek.entity.Student;  
  6.   
  7. /** 
  8.  * @author xudongwang 2011-12-31 
  9.  *  
  10.  *         Email:xdwangiflytek@gmail.com 
  11.  *  
  12.  */  
  13. public interface StudentDao {  
  14.   
  15.     /** 
  16.      * 添加学生信息 
  17.      *  
  18.      * @param student 
  19.      *            学生实体 
  20.      * @return 返回是否添加成功 
  21.      */  
  22.     public boolean addStudent(Student student);  
  23.   
  24.     /** 
  25.      * 根据学生id删除学生信息 
  26.      *  
  27.      * @param id 
  28.      *            学生id 
  29.      * @return 删除是否成功 
  30.      */  
  31.     public boolean deleteStudentById(int id);  
  32.   
  33.     /** 
  34.      * 更新学生信息 
  35.      *  
  36.      * @param student 
  37.      *            学生实体 
  38.      * @return 更新是否成功 
  39.      */  
  40.     public boolean updateStudent(Student student);  
  41.   
  42.     /** 
  43.      * 查询全部学生信息 
  44.      *  
  45.      * @return 返回学生列表 
  46.      */  
  47.     public List<Student> selectAllStudent();  
  48.   
  49.     /** 
  50.      * 根据学生姓名模糊查询学生信息 
  51.      *  
  52.      * @param name 
  53.      *            学生姓名 
  54.      * @return 学生信息列表 
  55.      */  
  56.     public List<Student> selectStudentByName(String name);  
  57.   
  58.     /** 
  59.      * 根据学生id查询学生信息 
  60.      *  
  61.      * @param id 
  62.      *            学生id 
  63.      * @return 学生对象 
  64.      */  
  65.     public Student selectStudentById(int id);  
  66.   
  67. }  

StudentDaoImpl :

Java代码   收藏代码
  1. package com.iflytek.daoimpl;  
  2.   
  3. import java.io.IOException;  
  4. import java.io.Reader;  
  5. import java.sql.SQLException;  
  6. import java.util.List;  
  7.   
  8. import com.ibatis.common.resources.Resources;  
  9. import com.ibatis.sqlmap.client.SqlMapClient;  
  10. import com.ibatis.sqlmap.client.SqlMapClientBuilder;  
  11. import com.iflytek.dao.StudentDao;  
  12. import com.iflytek.entity.Student;  
  13.   
  14. /** 
  15.  * @author xudongwang 2011-12-31 
  16.  *  
  17.  *         Email:xdwangiflytek@gmail.com 
  18.  *  
  19.  */  
  20. public class StudentDaoImpl implements StudentDao {  
  21.   
  22.     private static SqlMapClient sqlMapClient = null;  
  23.   
  24.     // 读取配置文件  
  25.     static {  
  26.         try {  
  27.             Reader reader = Resources  
  28.                     .getResourceAsReader("com/iflytek/entity/SqlMapConfig.xml");  
  29.             sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);  
  30.             reader.close();  
  31.         } catch (IOException e) {  
  32.             e.printStackTrace();  
  33.         }  
  34.     }  
  35.   
  36.     public boolean addStudent(Student student) {  
  37.         Object object = null;  
  38.         boolean flag = false;  
  39.         try {  
  40.             object = sqlMapClient.insert("addStudent", student);  
  41.             System.out.println("添加学生信息的返回值:" + object);  
  42.         } catch (SQLException e) {  
  43.             e.printStackTrace();  
  44.         }  
  45.         if (object != null) {  
  46.             flag = true;  
  47.         }  
  48.         return flag;  
  49.     }  
  50.   
  51.     public boolean deleteStudentById(int id) {  
  52.         boolean flag = false;  
  53.         Object object = null;  
  54.         try {  
  55.             object = sqlMapClient.delete("deleteStudentById", id);  
  56.             System.out.println("删除学生信息的返回值:" + object + ",这里返回的是影响的行数");  
  57.         } catch (SQLException e) {  
  58.             e.printStackTrace();  
  59.         }  
  60.         if (object != null) {  
  61.             flag = true;  
  62.   
  63.         }  
  64.         return flag;  
  65.   
  66.     }  
  67.   
  68.     public boolean updateStudent(Student student) {  
  69.         boolean flag = false;  
  70.         Object object = false;  
  71.         try {  
  72.             object = sqlMapClient.update("updateStudent", student);  
  73.             System.out.println("更新学生信息的返回值:" + object + ",返回影响的行数");  
  74.         } catch (SQLException e) {  
  75.             e.printStackTrace();  
  76.         }  
  77.         if (object != null) {  
  78.             flag = true;  
  79.         }  
  80.         return flag;  
  81.     }  
  82.   
  83.     public List<Student> selectAllStudent() {  
  84.         List<Student> students = null;  
  85.         try {  
  86.             students = sqlMapClient.queryForList("selectAllStudent");  
  87.         } catch (SQLException e) {  
  88.             e.printStackTrace();  
  89.         }  
  90.         return students;  
  91.     }  
  92.   
  93.     public List<Student> selectStudentByName(String name) {  
  94.         List<Student> students = null;  
  95.         try {  
  96.             students = sqlMapClient.queryForList("selectStudentByName",name);  
  97.         } catch (SQLException e) {  
  98.             e.printStackTrace();  
  99.         }  
  100.         return students;  
  101.     }  
  102.   
  103.     public Student selectStudentById(int id) {  
  104.         Student student = null;  
  105.         try {  
  106.             student = (Student) sqlMapClient.queryForObject(  
  107.                     "selectStudentById", id);  
  108.         } catch (SQLException e) {  
  109.             e.printStackTrace();  
  110.         }  
  111.         return student;  
  112.     }  
  113. }  

 

TestIbatis.java :

Java代码   收藏代码
  1. package com.iflytek.test;  
  2.   
  3. import java.sql.Date;  
  4. import java.util.List;  
  5.   
  6. import com.iflytek.daoimpl.StudentDaoImpl;  
  7. import com.iflytek.entity.Student;  
  8.   
  9. /** 
  10.  * @author xudongwang 2011-12-31 
  11.  *  
  12.  *         Email:xdwangiflytek@gmail.com 
  13.  *  
  14.  */  
  15. public class TestIbatis {  
  16.   
  17.     public static void main(String[] args) {  
  18.         StudentDaoImpl studentDaoImpl = new StudentDaoImpl();  
  19.   
  20.         System.out.println("测试插入");  
  21.         Student addStudent = new Student();  
  22.         addStudent.setName("李四");  
  23.         addStudent.setBirth(Date.valueOf("2011-09-02"));  
  24.         addStudent.setScore(88);  
  25.         System.out.println(studentDaoImpl.addStudent(addStudent));  
  26.   
  27.         System.out.println("测试根据id查询");  
  28.         System.out.println(studentDaoImpl.selectStudentById(1));  
  29.   
  30.         System.out.println("测试模糊查询");  
  31.         List<Student> mohuLists = studentDaoImpl.selectStudentByName("李");  
  32.         for (Student student : mohuLists) {  
  33.             System.out.println(student);  
  34.         }  
  35.   
  36.         System.out.println("测试查询所有");  
  37.         List<Student> students = studentDaoImpl.selectAllStudent();  
  38.         for (Student student : students) {  
  39.             System.out.println(student);  
  40.         }  
  41.   
  42.         System.out.println("根据id删除学生信息");  
  43.         System.out.println(studentDaoImpl.deleteStudentById(1));  
  44.   
  45.         System.out.println("测试更新学生信息");  
  46.         Student updateStudent = new Student();  
  47.         updateStudent.setId(1);  
  48.         updateStudent.setName("李四1");  
  49.         updateStudent.setBirth(Date.valueOf("2011-08-07"));  
  50.         updateStudent.setScore(21);  
  51.         System.out.println(studentDaoImpl.updateStudent(updateStudent));  
  52.   
  53.     }  
  54. }  

 

iBatis 的优缺点:

优点:

1、 减少代码量,简单;

2、 性能增强;

3、 Sql 语句与程序代码分离;

4、 增强了移植性;

缺点:

1、 和Hibernate 相比,sql 需要自己写;

2、 参数数量只能有一个,多个参数时不太方便;

 

ArcGIS 10.2.2自带Python 2.7.5环境配置全攻略:从pip安装到gdal、arcpy调用 本文详细指导如何在ArcGIS 10.2.2自带的Python 2.7.5环境中进行高效配置。核心内容包括安装pip包管理器、部署gdal等关键地理数据处理库,并确保arcpy模块的无缝调用。通过解决路径配置与PyCharm集成问题,帮助用户在此经典环境中构建稳定、兼容的地理信息自动化工作流,有效连接ArcGIS桌面功能与Python脚本编程。 阅读详情

相关推荐

Axure原型模板与元件库APP交互设计素材(附资料)

在Axure中,手机模型是展示APP或小程序界面效果的重要工具。通过导入手机模型元件,设计师可以更加直观地模拟真实设备的显示效果,从而更准确地评估设计的可行性和用户体验。Axure官方及第三方资源库中提供了多种品牌和型号的手机模型,如iPhone、Android等,设计师可以根据项目需求选择合适的模型进行使用。Axure作为一款强大的原型设计工具,为APP和小程序的设计与开发提供了丰富的界面组件元件库和交互设计素材。

招风的黑耳优快云 1984

iBatis入门

iBatis入门 博客分类:  iBatis/myBatis iBatis  iBatis 简介: iBatis 是apache 的一个开源项目,一个O/R Mapping 解决方案,iBatis 最大的特点就是小巧,上手很快。如果不需要太多复杂的功能,iBatis 是能够满足你的要求又足够灵活的最简单的解决方案,现在的iBatis 已经改名为Mybatis 了。 官网为:

特立独行的猿 638

基于ESP32-P4的低成本旋转式激光雷达系统设计

激光雷达(LiDAR)作为机器人环境感知的核心传感器,其本质是融合光学测距、机电控制与实时数据处理的嵌入式系统。理解时间飞行(ToF)原理与机械旋转耦合机制,是实现高精度点云采集的基础;而系统级误差源——如计时抖动、电机惯性、信号串扰和温漂——直接决定实际建图鲁棒性。在资源受限场景下,选用RISC-V双核MCU(如ESP32-P4)可兼顾实时控制与网络服务能力,通过硬件时间戳捕获、S型加减速轨迹规划、旋转变压器供电及双Bank OTA等工程手段,有效平衡分辨率、帧率与稳定性。本文围绕360°旋转式激光雷达的

weixin_36231030的博客 435

Mybatis-Plus 合并两个QueryWrapper对象的where条件

【代码】Mybatis-Plus 合并两个QueryWrapper对象的where条件。

晓旅的博客 1305

单总线协议(1—Wire bus)【DS2431】

1—Wire 协议定义了复位脉冲、 应答脉冲、写0、写1、读0和读1时序等几种信号类型。所有的单总线命令序列(初始化ROM 命令功能命令)都是由这些基本的信号类型组成的。识别单总线器件(ROM 命令)单总线器件交换数据(功能命令)初始化单总线器件(初始化)

qq_41883039的博客 1151

OpenClaw Windows 最详细安装指南

Windows上养龙虾:OpenClaw完整安装教程+钉钉接入,助你养只大龙虾

weixin_43405859的博客 2215

【撸源码】【mybatis-plus】乐观锁和逻辑删除是如何工作的——下篇

至此,乐观锁的核心原理已经全部完成,到这,乐观锁的整体原理逻辑均已清楚。但是在乐观锁原理解读的过程中,有一些深入的点需要分析,接着我们就来拓展的再深度挖掘下非核心原理,实现的也很精妙,学习意义很大。

Rubik Blog 1150

医疗设备安规入门:一张图搞懂BF型设备的MOOP/MOPP绝缘路径(附GB 9706.1附录解析)

本文深入解析了BF型医疗设备的MOOP/MOPP绝缘路径设计,结合GB 9706.1标准附录J的实战应用,帮助工程师快速掌握医疗设备安规要点。通过典型绝缘路径图分析,详细对比了MOOP与MOPP的防护差异,并提供了海拔修正、漏电流测试等关键设计指南,助力医疗设备安全合规。

weixin_30633405的博客 393

Mybatis plus 多wrapper传参无法正确获取参数问题分析

文章目录 问题复现 一、定位问题 二、问题分析 1.getCustomSqlSegment源码分析 2.MergeSegments源码分析 3.AbstractISegmentList及NormalSegmentList源码分析 4.函数式接口ISqlSegment 三、Compare接口中sql条件拼接 四、解决办法 1.使用apply方法拼接语句 2.Mapper中只传入一个Wrapper,其余的以方法参数传入,在xml中进行拼接 总结 问题复现 因业务开发需要,组内Ja

mouxiaoshi的博客 1万+

Zabbix7.4监控系统在Rocky Linux10.0上的完整部署流程(含MariaDB配置)

本文详细介绍了在Rocky Linux 10.0操作系统上部署企业级监控系统Zabbix 7.4的完整流程,并重点阐述了与MariaDB数据库的深度集成与性能优化配置。内容涵盖从系统环境准备、数据库安装与安全加固、Zabbix核心组件部署,到服务配置、Web界面初始化以及生产环境高级调优的全方位实战指南,旨在帮助用户构建稳定高效的监控平台。

weixin_29200741的博客 333

【SI案例分享】1000 BASE-T1共模终端的分析与评估

以太网的MDI接口应用中,共模端接网络的应用广泛,并且,其电路参数从100 BASE-T1到1000 BASE-T1保持了相同的参数定义,这就不得不引起使用者的怀疑,毕竟百兆和千兆以太网的工作频段差异巨大,这样的设计真的可以做到上下兼容吗?本文针对此问题,进行了深入的探讨。

一只豌豆象的博客 1367

java 多表分页_基于Mybatis Plus实现多表分页查询的示例代码

注意:Mybatis Plus 3.0.7 版本才开始用【自定义sql】+【QueryWrapper】,低版本不能使用,还是老实写SQL进行条件拼接1、源码分析在Wrapper接口中就有如下方法/*** 获取自定义SQL 简化自定义XML复杂情况* 使用方法:自定义sql + ${ew.customSqlSegment}* 1.逻辑删除需要自己拼接条件 (之前自定义也同样)* 2.不支持wrapp...

weixin_39680208的博客 951

SLAM Cartographer(18)后端优化问题求解器

了解经过闭环检测构建了子图与节点之间的约束之后,通过后端优化求解器进行优化求解。核心是基于Ceres库进行SPA(Sparse Pose Adjustment)的优化方法,把后端优化问题描述成为一个最小二乘的问题求解

氢键H-H 5683

java ibatis 例子_一个简单的iBatis入门例子

一个简单的iBatis入门例子,用ORACLE和Java测试目录结构:1.导入iBatis和oracle驱动。2.创建类Person.javapackage com.ibeats;import java.util.Date;public class Person {private int id;private String firstName;private String lastName;pri...

weixin_39996762的博客 192

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

iBATIS入门实例

先写一个小例子入门一下,对iBATIS有一个认识   步骤: 1 建立数据库,创建表(user表,有userid,name,password,department,其中userid为主键,而且自动增长) 2 创建工程,加入相关jar包(常用的,数据库连接的,ibatis相关jar包) 3 创建xml文件(sql-map-config.xml,user.xml) 4 编写代码,测试运行 ...

crazycat03的专栏 199

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

iBATIS教程之快速入门浅析

您所在的位置:开发 > Java > Java框架 > iBATIS教程之快速入门浅析 iBATIS教程之快速入门浅析 2009-07-21 14:24 开往幸福的班车 百度空间 我要评论() 字号:T | T iBATIS教程是iBATIS初学者需要掌握什么内容呢?那么这篇文章就会告诉你。 AD: 2013大数据全球技术峰会低价抢票中

众里寻她千百度的专栏 324

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

iBATIS2.3入门项目(附源码)

花了一天时间看了传智播客的iBATIS2.3视频,地址点击打开链接,写下总结。 ------------------------------------------------------------------------------------ 1、先导包,导入一个ibatis-2.3.3.720.jar包,数据库使用的是MySQL,导入数据库的包mysql-connector-java-

hu_mility的专栏 912

ibatis入门贴

前段时间做毕业设计,新学习了ibatis,感觉很好用,比hibernate要灵活很多,而且配置也少了不少。 现在写一个ibatis的入门例子,分享一下。   1.SqlMapConfigExample.properties 这个文件放你要连接数据库的一些参数     username=sapassword=1234url=jdbc:sqlserver://192.168.0.2...

Dreaming 137

Ibatis入门程序小记

       坦白说Ibatis到底是不是个好东西,我也说不好,因为我也不是了解的很透彻,只是因为这次需要用到,所以特来学习一下。今天学了个入门程序,调试中遇到了两个问题,第一:jar包没有完全导入;第二:在XML文件里没有正确的配置好信息。还好,经过小小的耐心与努力,最终都被解决了。      现在记录下学习流程,以备后忘。1.建立数据库,我用的是mysql,建立了user表,里面有id

Cheney的专栏 559

最简单的 iBatis 入门例子

最简单的iBatis入门例子     iBatis是一个O/R Mapping解决方案,iBatis最大的特点就是小巧,上手很快。如果你不需要太多复杂的功能,iBatis是能满足你的要求又足够灵活的最简单的解决方案。下面我们看一个最简单的入门例子,是《ibatis 开发指南》上的例子改的,不过上面讲的不仔细,我开始学的时候搞了一个晚上才把那个例子跑起来的,相信一些朋友也和我一样,在入门的时候有

Mindy的专栏 547

iBatis.Net 入门例子 入门指南 入门教程

iBatis.Net 入门例子 入门指南 入门教程

十一郎的IT博客 4114

Ibatis入门

ibatis介绍iBATIS一词来源于“internet”和“abatis”的组合,是一个由Clinton Begin在2002年发起的开放源代码项目。于2010年6月16号被谷歌托管,改名为MyBatis。是一个基于SQL映射支持Java和·NET的持久层框架。搭建ibatis环境jar包:<dependency> <groupId>org.apache.ibatis</groupId>

Ghost In Matrix 884

iBATIS入门案例

       笔者最近和后台开发、数据库打交道不少,自然ORM这块的东西也是应用频繁。笔者和很多朋友一样原来也是一直学习和使用Hibernate,毕竟Hibernate的大名还是要响亮的多。然而金无足赤,人无完人,每一款框架都有自己的优点和缺点,喜欢Hibernate的可以继续去喜欢,今天的主角是iBATIS。          iBATIS,目前已经更名为MyBatis,从命名上更加亲切,但对...

wang28344的博客 260

ibatis入门者

公司准备上个项目,说要用ibatis,可是我都ibatis还一无所知,能否请大侠给说说如何快速上手ibatis :cry:

xuguangyun 80

根据传智播客ibatis视频教程编写的入门例子

IUserDAOImpl.javapackage com.elifefly; /*  * 说明:程序是根据传智播客ibatis视频教程编写的入门例子。  * 目的在于熟悉ibatis的基本原理和基本使用方法。  * 因而程序并没有过多的开发成一个系统,ibatis视频教程也没有做成系统的,也没有给任何源代码。  *   * 开发环境:MyEclipse 6.0  * 数据库:MySQL5.0

wxg6203的专栏 1012
上一篇: mysql转义处理
下一篇: TagSupport使用入门
zljjava
博客等级 码龄15年 155粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值