Activiti支持达梦数据库

达梦7/8适配activiti6,springboot+idea离线设计流程 随着信创国产化的推进,要求去 IOE 使用国产的替代方案,数据库方面需要用国产数据库来替换ORACLE、DB2等数据库。基于达梦数据库对Oracle的高度兼容,我们在考虑替代产品的时候可以优先选择使用达梦数据库。 Activiti 是一个工作流引擎, Activiti 可以将业务系统中复杂的业务流程抽取出来,使用专门的建模语言(BPMN2.0)进行定义,业务系统按照预先定义的流程进行执行,实现了业务系统的业务流程由 Activiti 进行管理,减少业务系统由于流程变更进行系统升级改造的工作量, 阅读详情
AI摘要

本文介绍了如何让Activiti支持达梦数据库,包括引入达梦数据库驱动、修改源代码以适配、配置数据库连接以及更新资源文件,详细阐述了每个步骤的操作方法,以实现国产化数据库的替代。

Activiti支持达梦数据库

1.目的

​ Activiti现在支持的数据库包括:

Activiti数据库类型 JDBC URL实例 备注
h2 jdbc:h2:tcp://localhost/activiti 默认配置的数据库
mysql jdbc:mysql://localhost:3306/activiti?autoReconnect=true 使用mysql-connector-java驱动测试
oracle jdbc:oracle:thin:@localhost:1521:xe
postgres jdbc:postgresql://localhost:5432/activiti
db2 jdbc:db2://localhost:50000/activiti
mssql jdbc:sqlserver://localhost:1433/activiti

​ 随着信创国产化的推进,需要用国产数据库来替换上面的数据库。基于达梦数据库对Oracle的高度兼容,我们选择使用达梦数据库作为替代产品。由于Activiti不支持达梦数据库,所以要进行如下的修改。

2.解决方案

2.1 开发环境

2.1.1 相关软件的版本:
软件名称 版本
Activiti 7.0.1 M6
达梦数据库 8.0
dm.jdbc.driver.DmDriver 8.1.1.88
2.1.2 引入达梦数据库连接驱动包

​ 将达梦数据库驱动包“DmJdbcDriver18.jar”文件上传至阿里云私有maven仓库,并通过maven下载引入。

2.1.3 配置数据库连接

​ 在activiti.cfg.xml文件中添加一下内容

<!--数据源配置dbcp-->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="dm.jdbc.driver.DmDriver" />
        <property name="url" value="jdbc:dm://192.168.1.109:5236/DAMENG" />
        <property name="username" value="ACTIVITI" />
        <property name="password" value="dameng123" />
    </bean>

2.2 java类

​ 为了使Activiti可以适配达梦数据库,需要修改其部分源代码。将Activiti中相关的源代码拷贝到工程src目录下,保持包路径不变。具体的修改如下:

2.2.1 在org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl,增加成员变量。
		public static final String DATABASE_TYPE_DM = "dm";					// 适配达梦数据库,追加成员变量

    public static final String DATABASE_TYPE_H2 = "h2";
    public static final String DATABASE_TYPE_HSQL = "hsql";
    public static final String DATABASE_TYPE_MYSQL = "mysql";
    public static final String DATABASE_TYPE_ORACLE = "oracle";
    public static final String DATABASE_TYPE_POSTGRES = "postgres";
    public static final String DATABASE_TYPE_MSSQL = "mssql";
    public static final String DATABASE_TYPE_DB2 = "db2";

2.2.2 修改org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl 类的 getDefaultDatabaseTypeMappings()方法

public static Properties getDefaultDatabaseTypeMappings() {
   
   
        Properties databaseTypeMappings = new Properties();
        
        databaseTypeMappings.setProperty("DM DBMS", DATABASE_TYPE_DM);		// 适配达梦数据库,追加修改

        databaseTypeMappings.setProperty("H2", DATABASE_TYPE_H2);
        databaseTypeMappings.setProperty("HSQL Database Engine", DATABASE_TYPE_HSQL);
        databaseTypeMappings.setProperty("MySQL", DATABASE_TYPE_MYSQL);
        databaseTypeMappings.setProperty("Oracle", DATABASE_TYPE_ORACLE);
        databaseTypeMappings.setProperty("PostgreSQL", DATABASE_TYPE_POSTGRES);
  ......
}

2.2.3 修改org.activiti.engine.impl.db.DbSqlSessionFactory 类的 initBulkInsertEnabledMap(String databaseType)方法

protected void initBulkInsertEnabledMap(String databaseType) {
   
   
        bulkInsertableMap = new HashMap<Class<? extends Entity>, Boolean>();

        for (Class<? extends Entity> clazz : EntityDependencyOrder.INSERT_ORDER) {
   
   
            bulkInsertableMap.put(clazz, Boolean.TRUE);
        }

        // Only Oracle is making a fuss in one specific case right now
        // 适配达梦数据库,追加修改
        if ("oracle".equals(databaseType) || "dm".equals(databaseType)) {
   
   
            bulkInsertableMap.put(EventLogEntryEntityImpl.class, Boolean.FALSE);
        }
    }

2.2.4 修改org.activiti.engine.impl.AbstractQuery 类的 addOrder(String column, String sortOrder, NullHandlingOnOrder nullHandlingOnOrder)方法

 if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_FIRST)) {
   
   
                if (ProcessEngineConfigurationImpl.DATABASE_TYPE_H2.equals(databaseType) 
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_HSQL.equals(databaseType)
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_POSTGRES.equals(databaseType) 
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE.equals(databaseType)
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) // 适配达梦数据库,追加修改
                {
   
   
                   	orderBy = orderBy + defaultOrderByClause + " NULLS FIRST";
                } else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_MYSQL.equals(databaseType)) {
   
   
                    orderBy = orderBy + "isnull(" + column + ") desc," + defaultOrderByClause;
                } else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DB2.equals(databaseType) 
                           || ProcessEngineConfigurationImpl.DATABASE_TYPE_MSSQL.equals(databaseType)) {
   
   
                    orderBy = orderBy + "case when " + column + " is null then 0 else 1 end," + defaultOrderByClause;
                } else {
   
   
                    orderBy = orderBy + defaultOrderByClause;
                }

            } else if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_LAST)) {
   
   
                if (ProcessEngineConfigurationImpl.DATABASE_TYPE_H2.equals(databaseType) 
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_HSQL.equals(databaseType)
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_POSTGRES.equals(databaseType) 
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE.equals(databaseType)
                    || ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) // 适配达梦数据库,追加修改
                {
   
   
                    orderBy = orderBy + column + " " + sortOrder + " NULLS LAST";
                } else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_MYSQL.equals(databaseType)) {
   
   
                    orderBy = orderBy + "isnull(" + column + ") asc," + defaultOrderByClause;
                } else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DB2.equals(databaseType) 
                           || ProcessEngineConfigurationImpl.DATABASE_TYPE_MSSQL.equals(databaseType)) {
   
   
                    orderBy = orderBy + "case when " + column + " is null then 1 else 0 end," + defaultOrderByClause;
                } else {
   
   
                    orderBy = orderBy + defaultOrderByClause;
                }

            }

2.3 资源文件

​ Activiti在运行期间还会用的一下资源文件,这些文件中有些也与数据库相关,具体修改如下:

2.3.1 为资源文件创建相应的目录,具体的目录结构如下图:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-S33ifGnG-1612670121813)(/Users/zhangzhe/Library/Application Support/typora-user-images/image-20210207112144768.png)]

2.3.2 在create文件件下追加创建数据库表相关的文件。
activiti.dm.create.engine.sql
create table ACT_GE_PROPERTY (
    NAME_ NVARCHAR2(64),
    VALUE_ NVARCHAR2(300),
    REV_ INTEGER,
    primary key (NAME_)
);

insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);

insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);

insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);

create table ACT_GE_BYTEARRAY (
    ID_ NVARCHAR2(64),
    REV_ INTEGER,
    NAME_ NVARCHAR2(255),
    DEPLOYMENT_ID_ NVARCHAR2(64),
    BYTES_ BLOB,
    GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)),
    primary key (ID_)
);

create table ACT_RE_DEPLOYMENT (
    ID_ NVARCHAR2(64),
    NAME_ NVARCHAR2(255),
    CATEGORY_ NVARCHAR2(255),
    KEY_ NVARCHAR2(255),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    DEPLOY_TIME_ TIMESTAMP(6),
    ENGINE_VERSION_ NVARCHAR2(255),
    VERSION_ INTEGER DEFAULT 1,
    PROJECT_RELEASE_VERSION_ NVARCHAR2(255),
    primary key (ID_)
);

create table ACT_RE_MODEL (
    ID_ NVARCHAR2(64) not null,
    REV_ INTEGER,
    NAME_ NVARCHAR2(255),
    KEY_ NVARCHAR2(255),
    CATEGORY_ NVARCHAR2(255),
    CREATE_TIME_ TIMESTAMP(6),
    LAST_UPDATE_TIME_ TIMESTAMP(6),
    VERSION_ INTEGER,
    META_INFO_ NVARCHAR2(2000),
    DEPLOYMENT_ID_ NVARCHAR2(64),
    EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64),
    EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64),
    TENANT_ID_ NVARCHAR2(255) DEFAULT '',
    primary key (ID_)
)
activiti5.22 兼容达梦数据库改造 信创项目activiti5.22 兼容达梦数据库改造 阅读详情

相关推荐

手把手教你改造Activiti 5.22.0源码,让它完美支持国产达梦数据库

本文详细介绍了如何改造Activiti 5.22.0源码以完美支持国产达梦数据库。通过添加数据库类型常量、调整分页查询语句和批量插入配置等关键步骤,解决了Activiti在达梦数据库上的兼容性问题,为企业从传统数据库迁移提供实用解决方案。

weixin_42567752的博客 415

Activiti5.22.0国产化适配:源码级改造支持达梦数据库

本文详细介绍了如何对Activiti5.22.0工作流引擎进行源码级改造,以全面适配达梦数据库。通过添加数据库类型映射、调整SQL方言(如分页与空值排序)、处理批量插入兼容性等关键步骤,解决了引擎无法识别“DM DBMS”及后续运行中的SQL语法问题,为国产化迁移项目提供了切实可行的解决方案。

p5l2m9n4o6q的博客 235

activiti5.16扩展支持达梦数据库

【代码】activiti5.16扩展支持达梦数据库。

shmily_ab的专栏 1029

activiti适配达梦数据库教程

activiti6适配达梦数据库教程

对activiti二次开发适配达梦数据库.docx

对activiti二次开发适配达梦数据库,全网最全教程详解,文本内容详解: 需要对activiti进行二次开发,增加对达梦数据库的适配信息

Activiti连接达梦数据库.pdf

目前国内部分公司做的项目要求去ioe使用国产的替代方案。数据从异构数据库中迁移到达梦,应用中使用Activiti工作流在替换了数据库驱动后,无法直接使用,本文介绍如何适配达梦数据库

activiti-engine-6.0.0.jar

activiti6.0.0 jar 添加对达梦数据库整合

activiti5.22.0支持达梦数据库需要修改源码的地方

activiti5.22.0内置的数据库类型不支持达梦数据库 把本人修改过后的类传上来,给有需要的朋友下载使用 附件中是activiti5.22.0支持达梦数据库修改的类 将类编译通过后压缩进activiti-engine-5.22.0.jar即可。

【学一点英飞凌】AutoSar-MCAL-Gtm-TOM模块

本文基于英飞凌TC3X7芯片手册,GTM的TOM模块是产生并输出PWM的地方,想要彻底了解PWM,就必须知道它是怎么产生和如何被输出的。TOM通道还没有介绍的,详见下一篇;

qq_44688936的博客 6042

人工智能入门系列之一: 鸢尾花(Iris)多分类的神经网络详解及代码实现

这是最好的时代,我们一起来打造属于自动驾驶汽车上路、无人机飞天、智能机器人管工厂的AI未来 人工智能领域分化为两个阵营:其一是规则式(rule-based)方法,在人工智能早期占主峰;其二是神经网络(neural network)方法,后起之秀。随着硬件水平的提高,算力的指数式增长;人工智能的重心已经从规则式的专家时代转移到神经网络的数据时代。 “神经网络”不选择把人脑熟稔的逻辑规则传授给计算机...

NLP家的码奴小荷的博客 2万+

一篇教你杰理63系列蓝牙双设备主从连接传输数据过程及配置

首先打开632sdk的app_config.h文件,将宏CONFIG_APP_SPP_LE写0,将宏CONFIG_APP_MULTI写1,对应的CONFIG_BT_GATT_CLIENT_NUM写1代表我只连接一个主机设备。属性都可以修改为自己想要的属性,然后关掉文件,双击gatt_inc_generator.exe文件运行,就会自动弹出生成/更新后的gatt_profile_cfg.h文件,然后里面就是我们代码里面所需要的配置,都是十六进制表示,找到我们刚刚添加的服务属性配置,复制到代码里面去。

xiaolizaixian的博客 1392

基于Python的IMF经济数据爬取与分析:从入门到实战

本文详细介绍了如何使用Python爬取国际货币基金组织(IMF)的经济数据,包括最新的爬虫技术、反反爬策略、数据解析与存储方法。文章从IMF数据源分析开始,逐步讲解如何构建一个完整的爬虫系统,并提供了详细的代码实现和优化建议。通过本文,读者将掌握爬取复杂国际组织数据的关键技术,并能将这些技术应用于其他类似的数据获取场景。关键词:Python爬虫、IMF数据、经济数据获取、数据清洗、反爬策略IMF Data (data.imf.org) - 主要数据门户。

2201_76125261的博客 1445

apollo自动驾驶进阶学习之:如何实现施工路段限速绕行及其参数调试

首先需要理解Planning模块是基于Scenario、Stage、Task这样的层次来进行的,即场景->步骤->具体的决策方法。Apollo可以应对自动驾驶所面临的不同道路场景,都是通过Scenario统一注册与管理。Scenario通过一个有限状态机来判断选择当前行车场景,每个Scenario下又有多个Stage,指当前场景下需要执行的粗略步骤。.........

qq_41593516的博客 6606

RepHead一种重参数化检测头用于提升YOLOv8在困难样本上的检测性能

在目标检测任务中,困难样本通常是指那些由于特殊背景、遮挡、低分辨率或极度小物体等因素,导致模型难以识别的样本。这类样本对传统YOLO系列模型的影响较大,常常造成漏检或误检。重参数化(Reparameterization)是一种深度学习中常用的技术,旨在通过对网络参数的变换,使得模型在训练过程中能够更加灵活地适应不同的数据特征。通过对原始网络结构的参数进行重新表达,能够引导模型在训练过程中学习到更加有效的特征。本文详细介绍了YOLOv8的改进——RepHead检测头,并深入分析了它在解决困难样本检测中的应用。

博客 1213

FPGA面试题目笔记(一)——FPGA开发流程、亚稳态和竞争冒险、建立保持时间、异步FIFO深度等

同步异步电路、同步异步复位、时钟偏移和抖动、最小工作周期计算、触发器锁存器

H19981118的博客 1万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

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

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

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

上一篇: 达梦8搭建数据守护集群
CHINESEZZZ
博客等级 码龄23年 3粉丝 3原创
评论 10
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值