图示ireport中使用javabean作数据源开发基于jasperreports报表过程

模板设计器Jaspersoft Studio、结合JasperReports输出报表 Jaspersoft Studio是一个图形化的报表设计工具,可以非常方便的设计出PDF报表模板文件(其实就是一个xml文件),再结合JasperReports使用,就可以渲染出PDF文件。 1.下载安装 下载地址:https://community.jaspersoft.com/community-download 下载完成后会得到这样的一个安装文件 直接双击安装即可。 注意:电脑的jdk版本需要1.8以上,包含1.8,否则的话无法正常运行 安装成功,启动截图: 2.面板介绍 通过下图的观察可以发现 阅读详情
图示ireport 中使用javabean 作数据源开发 基于 jasperreports 报表 过程
——学习笔记系列之ireport起步
xmlin
本文不讲原理,因为网上的资源很多,本文以一个简单的日销售报表为例,记录在ireport中使用javabe an 作数据源开发 基于 jasperreports 报表 过程 .
 
一. 准备工作
 1.正确安装jdk
 2.到 http://ireport.sourceforge.net/ 去下载ireport,本文使用1.3.1版本,解压iReport在任意目录,解压后的文件里面有一个iReport.bat,通过双击运行。
 3.到 http://jasperreports.sourceforge.net/index.html 下载jasperreport,本文使用的是1.3.1版本,解压到任意目录,开发中需要使用其中的 jasperreports-1.3.1.jar , commons-logging-1.0.2.jar , commons-collections-2.1.jar.
二.创建javabean 
1.创建DailySales.java,一个简单VO bean。

import java.io.Serializable;
 
public class DailySales implements Serializable
{
    private static final long serialVersionUID = 1L;
    private String productNo ;
    private String productName ;
    private int number ;
    private int money ;
    private int id ;
   
    public DailySales(String productNo, String productName, int number, int money)
    {
       this . productNo = productNo;
       this . productName = productName;
       this . number = number;
       this . money = money;
    }
   
    public String getProductNo()
    {
       return productNo ;
    }
    public void setProductNo(String productNo)
    {
       this . productNo = productNo;
    }
    public String getProductName()
    {
       return productName ;
    }
    public void setProductName(String productName)
    {
       this . productName = productName;
    }
    public int getNumber()
    {
       return number ;
    }
    public void setNumber( int number)
    {
       this . number = number;
    }
    public int getMoney()
    {
       return money ;
    }
    public void setMoney( int money)
    {
       this . money = money;
    }
    public int getId()
    {
       return id ;
    }
 
    public void setId( int id)
    {
       this . id = id;
    }  
}
 
2. 创建 DailySalesDataSource.java, 这是报表的数据源。这个类实现了 jasperreports 中提供的数据源接口 JRDataSource, 实现其中的两个方法 :next() 和 getFieldValue(JRField field) 。


import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
 
public class DailySalesDataSource implements JRDataSource
{
 
    /**
      * 测试数据,实际项目中是动态获取,也不一定是数组,可以是其它的数据类型 .
      */
    private Object[][] data =
       {
           { " 货号 1" , " 物品1 " , 1,1000},
           { " 货号 2" , " 物品 2" , 2,2000},
           { " 货号 3" , " 物品 3" , 3,3000},
           { " 货号 4" , " 物品 4" , 4,4000},
           { " 货号 5" , " 物品 5" , 5,5000},
           { " 货号 6" , " 物品 6" , 6,6000},
           { " 货号 7" , " 物品 7" , 7,7000},
           { " 货号 8" , " 物品 8" , 8,8000},
           { " 货号 9" , " 物品 9" , 9,9000},
           { " 货号 10" , " 物品 10" , 10,10000}         
       };
 
    private int index = -1;
   
    public DailySalesDataSource()
    {
    }
 
    /**
      * 实现了 JRDataSource 中的方法.判断是否还有下一个.
      */
    public boolean next() throws JRException
    {
       index ++;
       return ( index < data . length );
    }
   
    /**
      * 实现了 JRDataSource 中的方法.
      * @param field 是对应报表中的要填充的字段的名称.
      */
    public Object getFieldValue(JRField field ) throws JRException
    {
       Object value = null ;
      
       String fieldName = field .getName();
      
       if ( "id" .equals(fieldName))
       {
           value = index+1 ;
       }
       else if ( "productNo" .equals(fieldName))
       {
           value = data [ index ][0];
       }
       else if ( "productName" .equals(fieldName))
        {
           value = data [ index ][1];
       }
       else if ( "number" .equals(fieldName))
       {
           value = data [ index ][2];
       }
       else if ( "money" .equals(fieldName))
       {
           value = data [ index ][3];
       }     
       return value;
    }
}
 
3 .在 ireport 中使用,取得测试数据源 , 如果不使用 ireport 工具,则只需要上面的两个类。
 
import java.util.Arrays;
import java.util.Collection;
/**
  * 简单工厂类,取得测试数据
  * @author xmlin
  *
  */
public class DailySalesFactory
{
    private static DailySales[] data =
       {
       new DailySales( " 货号 1" , " 物品1 " , 1,1000),
       new DailySales( " 货号 2" , " 物品 2" , 2,2000),
       new DailySales( " 货号 3" , " 物品 3" , 3,3000),
       new DailySales( " 货号 4" , " 物品 4" , 4,4000),
       new DailySales( " 货号 5" , " 物品 5" , 5,5000),
       new DailySales( " 货号 6" , " 物品 6" , 6,6000),
       new DailySales( " 货号 7" , " 物品 7" , 7,7000),
       new DailySales( " 货号 8" , " 物品 8" , 8,8000),
       new DailySales( " 货号 9" , " 物品 9" , 9,9000),
       new DailySales( " 货号 10" , " 物品 10" , 10,10000)         
       };           
 
    public static Object[] getBeanArray()
    {
       return data ;
    }
 
    public static Collection getBeanCollection()
    {
       return Arrays.asList ( data );
    }
}
三.使用ireport开发报表样式
1.新建一个项目。
2.设置类路径,在菜单“options”中选择Classpath,点击在弹出框中的add folder,填写javabean编译成的.class文件存放的路径. 点save Classpath完成。如图

    3.设置数据源.在菜单"Data"中选择”Connection/Data sources”, 点击在弹出框中的new按钮增加一个数据源.如图
   
其中Name随便取一个名字,Type of Connection/Data 选择 JavaBeans set data source,如果使用其它的数据源则选择其它的选项.Factory class 为我们刚才创建的Factory类,里面包含取得测试数据的静态方法getBeanCollection().用Test测试是否成功,点Save保存.(如果不成功的话,则应该看看那Factory这个类是不是在包内,这个类不能放在包内。应该将其放到classpath下面)
4. 设置活动连接.在菜单"Data"中选择”Set Active Connection”.
5.Report Query , 在菜单"Data"中选择” Report Query”,填写javabean,即我们创建的VO bean.如图
6.设计报表.
    设计日期字段如图
  
设计填充字段,如图
设计页数字段如图
设计好的报表样式如图
点菜单"build"中的"compile"进行编译,然后再”execute with connection datasource”就可以看到报表的结果了.
   报表设计完成,在ireport的执行路径下会生成一个DailySales.jasper的文件.
四.编写测试类.
   生成的DailySales.jasper可以在web服务端生成报表,也可以在肥客户端如swing生成,这里写一个在肥客户端和简单运用.


import java.awt.Dimension;
import java.util.HashMap;
import java.util.Map;
 
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
 
public class TestReport
{
   
    public static void main(String[] args)
    {
       TestReport.showReport ();
    }
   
    private static void  showReport()
    {
       String reportPath = "D://dailySales.jasper" ;                  
       Map parameters = new HashMap();
       // 如果报表中有用到变量,在这里给它赋值.
       //parameters.put("ReportTitle", " 报表标题 ");  
       try
       {         
           JasperReport jasperReport = (JasperReport) JRLoader.loadObject (reportPath);
           JasperPrint jasperPrint = JasperFillManager.fillReport (jasperReport, parameters, new DailySalesDataSource());
           JasperViewer jrview = new JasperViewer(jasperPrint);
           jrview.setPreferredSize( new Dimension(200,100));
           jrview.setVisible( true );
       }
       catch (JRException e)
       {
           e.printStackTrace();
       }
       catch (Exception e)
       {  
           e.printStackTrace();
       }
    }
}
Jasperreports+ireport实现pdf报表功能 jasperreports+ireport搭建一个PDF报表生成的java服务 阅读详情

相关推荐

ireport+jasperreport 直接输出到打印机 普通报表 交叉报表

项目中要用到针式打印机票据打印,本来是使用java printable 通过 Graphic2D输出到图形化方式打印的,运行了一段时间客户对版面个性需要比较多,用输出图形的方式调整太麻烦,而且Graphic2D画表格真的很麻烦,所以后来选择用ireport来定制版面,通过jasperreport api直接输送到打印机上。        目前针式打印几比较通用的纸张是9.5*5.5英寸的,根据不

i03630215的专栏 1万+

利用jasperReport制作web报表

1)给出自己制作的jasperReport的视图效果,方便对报表工具初期学习的选择。 2)自己制作报表的测试源码和所有相关学习资料,对应所有jar包,jasperReport版本。 3)快速开发报表的一些建议,为方便学习者快速开发,本文特封装了通用接口。 4)在linux下部署jasperReport出现内存溢出的问题解决方案。

leixingbang的专栏 7322

iReport使用JavaBean作为数据源——最简单的示例

iReport使用JavaBean作为数据源——最简单的示例。 包含: 1、Java源文件(JavaBean)。 2、iReport的报表源文件(jrxml)。 3、详细的说明。

使用JasperReport与iReport开发报表

一 JasperReport与iReport1) Jasperreport:是个基于Java技术的报表开发开源包(免费),按其规则可以编写出一个XML文件,根据XML文件支持多种格式文件的输出,例如:PDF、HTML、XML、XLS及CVS等。2)iReport是制作jasperreport XML文件的可视化开发工具(收费)。* 下载地址:http://sourceforge

traceofsun的专栏 1126

javabean用途ireport 数据源

這是兩個用java作數據源的例子:<br>其中 javaBean 為用javaBean作數據源的例子<br>test 為用自定義數據源的例子<br>兩個例子都通過測試<br>想要的朋友可以下載看看!<br>祝大家玩得開心!

从JTAG到AS模式:一文搞懂EP4CE10E22C8N所有配置引脚(MSEL, nCONFIG, DATA0)的用法

本文深入解析EP4CE10E22C8N FPGA的配置引脚(MSEL, nCONFIG, DATA0)在不同模式下的使用方法,特别关注从JTAG到AS模式的切换要点。通过详细的配置模式对比、状态机分析和PCB布局建议,帮助开发者避免常见陷阱,提升FPGA配置成功率。

weixin_33713350的博客 319

利用JasperReport+iReport进行Web报表开发

用JasperReport+iReport进行Web报表开发 序言 在非常多实际的项目里,报表都是当中十分重要的组成部分,比如把查询结果以报表的形式呈现出来。这里所提到的报表可不是简单的二维表,而是拥有复杂表头的、多维的、能够在执行期从数据库中自己主动读取数据、可自己主动分页、拥有丰富的页面元素(图片,超连接等)、支持分组和交叉表、支持打印、最好还能导出到Excel或Word…...(...

weixin_33856370的博客 207

在Kintex-7 FPGA上实现皮秒级时间测量:手把手教你搭建CARRY4进位链TDC(附源码与约束)

本文详细介绍了在Kintex-7 FPGA上利用CARRY4进位链实现皮秒级时间测量(TDC)的完整方案。从CARRY4的物理特性分析到硬件架构设计,再到校准方法与精度提升技巧,手把手教你构建测量精度达53ps的TDC系统,并附源码与约束文件,助力激光雷达、高能物理等精密计时应用开发。

weixin_42550052的博客 444

iReport4.6+Tomcat+JavaBean数据源报表1

BOOS让用JasperReports做报表,只能老老实实请教度娘了,但是网上资源又多又乱,多是copy的,代码都不知道有没有验证过、、、 自己做了一遍,贴出来供大家学习. 首先要确定你的tomcat、JDK、iReport是配置好的,下面我们开始,我用的事Myeclipse开发网站 一个很常见的例子 一、定义bean ProductBean.java package test6;

xiaomuzi0802的专栏 1308

E-Prime脑电实验打mark全攻略:从端口查询到串并口实战(附常见问题解决)

本文提供了E-Prime脑电实验打mark的完整实战指南,涵盖端口查询、并口与串口配置的核心步骤及常见问题解决。文章深入解析了mark原理,并详细介绍了通过E-Basic脚本和Serial设备对象发送信号的两种方法,帮助研究者实现E-Prime与脑电设备的高精度时间同步,确保实验数据可靠性。

4k5l6j7h8的博客 354

使用ST-LINK烧录stm32教程说明

使用ST-LINK烧录stm32

qq_34426854的博客 1万+

jasperreport 使用子报表(使用JavaBean集合作为数据源)

程序部分 第一步,创建与之相关的Bean类,如下所示:ProvinceBean.javapackage lld.test.ireport;import java.util.ArrayList;public class ProvinceBean{ private String provinceName; private ArrayList cities; public String getProvinceName() {  return provinceName; } public void setProvi

无雨 6392

realsense D455深度相机+YOLO V5结合实现目标检测(一)

realsense D455深度相机+YOLO V5结合实现目标检测代码来源环境配置代码分析:1.如何用realsense在python下面调用的问题:2.对main_debug.py文件的分析:结束语 可以实现将D435,D455深度相机和yolo v5结合到一起,在识别物体的同时,还能测到物体相对与相机的距离。 说明一下为什么需要做这个事情?1.首先为什么需要用到realsense D455深度相机? 因为他是普通的相机还加了一个红外测距的东西,所以其他二维图像一样,能够得到三维世界在二维像素平面的投影

文一生 3万+

ireport与jasperreports开发总结

一。  下载ireport( 官方网站:http://ireport.sourceforge.net),本人下载ireport3.7.0。 二。  搭建ireport+jasperreports java开发平台。将ireport3.7.0安装路径下          D:\iReport-3.7.0 \ireport\modules\ext下的(jasperreports-3.7.jar

受惊的牛冲向村里的牛棚 1478

A*搜索算法在三维路径规划(避障)中的MATLAB实现与Python实现

A star algorithmA*搜索算法简介A*搜索算法的Python简化代码MATLAB实现启发函数回溯轨迹RRT算法对比A\*算法在三维路径规划中的一些不足 A*搜索算法简介 A*搜索算法是Greedy Best-First算法的改进,因为Greedy Best-First算法只考虑将预估距离(当前节点到目标点的预估距离)作为遴选开节点集的条件。即: priority=heuristic(goal,next)priority=heuristic(goal, next)priority=heurist

ZYunfei的博客 2万+

基于SC、SCL、BP、SCAN和SSC的译码算法及Matlab代码

本文将介绍几种常见的译码算法,包括SC(Successive Cancellation)、SCL(Successive Cancellation List)、BP(Belief Propagation)、SCAN(Soft-Input Soft-Output Successive Cancellation)、SSC(Stacked Successive Cancellation)的原理,并提供相应的Matlab代码实现。以上是基于SC、SCL、BP、SCAN和SSC的译码算法的Matlab代码示例。

ByteWhisper的博客 946

ireport 中使用javabean 作数据源开发

ireport 中使用javabean 作数据源开发 基于 jasperreports 报表 过程 ——学习笔记系列之ireport起步xmlin本文不讲原理,因为网上的资源很多,本文以一个简单的日销售报表为例,记录在ireport中使用javabean 作数据源开发 基于 jasperreports 报表 过程 .  一. 准备工作 1.正确安装jdk 2.到http://i

在交流中成长 1208

RK3568平台开发系列讲解(NPU篇)什么是RKNPU

📢本篇章将介绍RKNPU。

内核笔记 4354

jasperreport开发手册--ireport教程

转自:https://blog.youkuaiyun.com/frankaqi/article/details/50203877 iReport http://www.jasperreport.net 一、介绍 iReport是一个能够创建复杂报表的开源项目,它100%使用Java语言编写,是目前全球最为流行的开源报表设计器之一。 由于它丰富的图形界面,你能够很快的创建出任何一种你想要的...

qq_36688928的博客 8932

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

报表 PDF Java报表 JasperReports IReport

1.报表模板设计器报表设计器IReport :https://sourceforge.net/projects/ireport/files/?source=navbar注意:该设计器如果打不开,则检查一下IReport的ireport.conf 文件,将里面的#jdkhome=""改为自己的jdk7的路径(即:jdkhome="C:\Program Files\Java\jdk1.7.0...

anjueyin4591的博客 278

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

java(ireport+jasperreport)创建报表

首先,确定你的ireport和jasperreport的版本是否一致,不一致会出现意外问题(如:detail的数据不显示,我就被这个折磨的很久...)理论知识不介绍,直接操作:这里说一下,报表的数据源有两种形式,1.对数据库的查询结果,在ireport里需要创建数据库的连接,编写查询语句,将查询结果赋给field字段,而java传给一个Connection;2.JavaBean提供的list(Bean)数据,ireport中只需要建立$F{Bean的属性名称},拖入编辑面板。一)1。ireport软件中建立

tigerq326的专栏 979

深度学习工具包 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")

Jasperreports极简教程及踩坑指南

用Jasperreport以JavaBean为数据源输出html报表工具:jasperreports.jar  用以在java程序中输出报表ireport-3.7.0  制作报表模板的软件步骤:1 准备JavaBean 表示需要展示的字段Test test1 = new Test(); Test test2 = new Test(); Test test3 = new Test();1.1 ...

聚乙烯兽的博客 9014
上一篇: flex收藏网站
下一篇: JasperReport 在jsp中以pdf的形式显示 jdbc作为数据源
wlxtaking
博客等级 码龄17年 51粉丝 67原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值