Regular Expressions (2) ---- Common Used Samples

手机模拟器、KeymouseGo 鼠标点击器、GoodGoodStudy 屏幕监控、KeyFreeze阻止键盘和鼠标、ComputerLock 透明锁屏、屏幕共享、多屏幕/显示器操作 3、除了玩游戏,MuMu模拟器还具备强大的应用安装功能。无论是微信、QQ、微博等社交应用,还是其他各类App,都可以在模拟器上轻松安装。2、这款模拟器不仅支持运行各种热门手机游戏,几乎兼容所有游戏和电脑,而且还为一些特定热门游戏专门设计了键盘操作,使得游戏体验更加顺畅。1、MuMu 模拟器是网易精心打造的手机模拟器软件,其品质得到了极大的保障。,以及同时打开多个应用窗口,极大地方便了我们的电脑使用。MuMu 还支持模拟定位功能,比如用于上报打卡。 阅读详情

Regular Expressions (2) ---- Common Used Samples

  说明:

以下所有的例子都在EditPad Pro下经过验证,如果不能用,可能和特定的解释引擎有关,稍稍修改就可以了。J (看得头都晕了~~)

更多的例子:http://www.regexlib.com

 

电子邮件验证... 2

简单验证电子邮件地址... 2

标准验证电子邮件地址... 2

数字验证... 2

大于零的Decimal数字... 2

任何Decimal数字... 2

0-99999999的带或不带逗号的数字... 3

0-65535的值... 3

字符串验证... 3

HTML和XML表姐... 3

ISBN格式的字符串... 3

GUID. 4

信用卡号... 4

连在一起的两个相同的单词... 4

双引号括起来的词... 4

标记... 5

验证html中的16位颜色值... 5

验证包含JSP事件的html代码... 5

验证一对封闭的xml标记... 5

验证HTML中所有合法的on事件... 5

查找html中的注释... 6

查找html中的特定文件(swf.jpg.gif…)... 6

日期和时间验证... 6

日期验证... 6

日期和时间验证... 6

标准ANSI SQL日期验证... 7

其他... 7

匹配字体... 7

匹配MD5哈西字符串... 7

 


电子邮件验证

简单验证电子邮件地址

表达式

(/w[-._/w]*/w@/w[-._/w]*/w/./w{2,3})

描述

简单符合<name>@xxx.com即可。

粗略验证

匹配的例子

[foo@bar.com], [foobar@foobar.com.au]

不匹配的例子

[foo@bar], [$$$@bar.com]

 

标准验证电子邮件地址

表达式

^(([^<>;()[/]//.,;:@"]+(/.[^<>()[/]//.,;:@"]+)*)|(".+"))@((([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(/[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))/.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))/]))/.)*(([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(/[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))/.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))/]))$

描述

所有符合RFC 821(http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc0821.html#page-30)规定的格式的邮件地址

匹配的例子

blah@[10.0.0.1]|||a@b.c

不匹配的例子

non@match@.

数字验证

大于零的Decimal数字

表达式

(^/d*/.?/d*[1-9]+/d*$)|(^[1-9]+/d*/./d*$)

描述

大于零的Decimal数字

匹配的例子

0.050

5.0000

5000

不匹配的例子

0

0.0

.0

 

任何Decimal数字

表达式

^(/d|-)?(/d|,)*/.?/d*$

描述

匹配:

纯数字

负数

逗号分割的数字

点分割的decimal格式

匹配的例子

5,000

-5,000

100.044

.2

不匹配的例子

abc

1.3.4

 

0-99999999的带或不带逗号的数字

表达式

^(/d|-)?(/d|,)*/.?/d*$

描述

匹配:

0-99999999的带或不带逗号的数字

匹配的例子

5,000

100,044

不匹配的例子

123,888,888

1.1

 

0-65535的值

表达式

^([0-5]?/d?/d?/d?/d|6[0-4]/d/d/d|65[0-4]/d/d|655[0-2]/d|6553

[0-5])$

描述

0-65535数字

匹配的例子

5000

100

不匹配的例子

66666

-2

字符串验证

HTML和XML标记

表达式

<[^>]+>

描述

所有的html和xml标记

匹配的例子

<b>

</b>

5.0000

5000

不匹配的例子

http://www.regexlib.com/Add.aspx

 

ISBN格式的字符串

表达式

<[^>]+>

描述

ISBN格式的字符串。

详细定义:http://www.isbn.org/standards/home/isbn/international/html/usm4.htm

 

匹配的例子

ISBN 0 93028 923 4

ISBN 1-56389-668-0

ISBN 1-56389-016-X

不匹配的例子

http://www.regexlib.com/Add.aspx

 

GUID

表达式

^[{|/(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[/)|}]?$

描述

以下格式的32位GUID:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

匹配的例子

914D226A-2F5B-4944-934D-96BBE6571977

{914D226A-2F5B-4944-934D-96BBE6571977}

不匹配的例子

914D226A-2F5B-4944-XXXX-96BBE6571977

{914D226A-2F5B-4944-XXXX-96BBE6571977}

 

信用卡号

表达式

^[{|/(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[/)|}]?$

描述

16位数字

16位数字用连字符或者空格或者分割

匹配的例子

1234343425262837

1111-2323-2312-3434

1111 2323 2312 3434

不匹配的例子

1111 2323 2312-3434

 

连在一起的两个相同的单词

表达式

(/w+)/s+/1

描述

验证连在一起的两个相同的单词

匹配的例子

abc abc

不匹配的例子

abc abcd

 

双引号括起来的词

表达式

"((//")|[^"(//")])+"

描述

验证用双引号括起来的词

匹配的例子

“Abc”

“abc”sff”

不匹配的例子

“sdfsdfsdf

标记

验证html中的16位颜色值

表达式

 

^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$

 

描述

验证html中的16进制的颜色值

#是可选的。

匹配的例子

#00ccff

ffffcc

不匹配的例子

blue

0x000000

 

验证包含JSP事件的html代码

表达式

<[a-zA-Z][^>]*/son/w+=(/w+|'[^']*'|"[^"]*")[^>]*>

描述

验证包含JSP事件的html代码

匹配的例子

<IMG onmouseover="window.close()">

不匹配的例子

IMG src="star.gif"

 

验证一对封闭的xml标记

表达式

 

^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$

 

描述

验证一对括起来的xml标记。

匹配的例子

<body> text<br/>More Text </body>

<a href="link.html">Link</a>

不匹配的例子

blue

0x000000

 

验证HTML中所有合法的on事件

表达式

(?i:on(blur|c(hange|lick)|dblclick|focus|keypress|(key|mouse

)(down|up)|(un)?load|mouse(move|o(ut|ver))|reset|s(elect|ubm

it)))

描述

验证HTML中所有合法的on事件

匹配的例子

onclick

onmouseover

不匹配的例子

Click

Move

 

查找html中的注释

表达式

<!/-/-.*?/-/->

描述

查找html中的注释

匹配的例子

<!-- <h1>this text has been removed</h1> -->

不匹配的例子

<h1>this text has been removed</h1>

 

查找html中的特定文件(swf.jpg.gif…)

表达式

<[^>]*/n?.*=("|')?(.*/.jpg)("|')?.*/n?[^<]*>

描述

查找html中的特定文件(swf.jpg.gif…)

把jpg换为gif,即是查找所有的gif文件。

匹配的例子

<td background="../img/img.jpg" >

不匹配的例子

= img.jpg

日期和时间验证

日期验证

表达式

^(?:(?:(?:(?:(?:1[6-9]|[2-9]/d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(//|-|/.)(?:0?2/1(?:29)))|(?:(?:(?:1[6-9]|[2-9]/d)?/d{2})(//|-|/.)(?:(?:(?:0?[13578]|1[02])/2(?:31))|(?:(?:0?[1,3-9]|1[0-2])/2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))/2(?:0?[1-9]|1/d|2[0-8]))))$

描述

验证格式为y/m/d的日期从1600/1/1 - 9999/12/31的日期

匹配的例子

04/2/29

2002-4-30

02.10.31

不匹配的例子

2003/2/29

02.4.31

00/00/00

 

日期和时间验证

表达式

^(?=/d)(?:(?:(?:(?:(?:0?[13578]|1[02])(//|-|/.)31)/1|(?:(?:0?[1,3-9]|1[0-2])(//|-|/.)(?:29|30)/2))(?:(?:1[6-9]|[2-9]/d)?/d{2})|(?:0?2(//|-|/.)29/3(?:(?:(?:1[6-9]|[2-9]/d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(//|-|/.)(?:0?[1-9]|1/d|2[0-8])/4(?:(?:1[6-9]|[2-9]/d)?/d{2}))($|/ (?=/d)))?(((0?[1-9]|1[012])(:[0-5]/d){0,2}(/ [AP]M))|([01]/d|2[0-3])(:[0-5]/d){1,2})?$

描述

验证所有合法的日期和时间

匹配的例子

20:20

04/2/29

02.4.31

02.10.312002-4-30

02.10.31

不匹配的例子

2003/2/29

00/00/00

 

标准ANSI SQL日期验证

表达式

^((/d{2}(([02468][048])|([13579][26]))[/-///s]?((((0?[13578])|(1[02]))[/-///s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[/-///s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[/-///s]?((0?[1-9])|([1-2][0-9])))))|(/d{2}(([02468][1235679])|([13579][01345789]))[/-///s]?((((0?[13578])|(1[02]))[/-///s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[/-///s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[/-///s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(/s(((0?[1-9])|(1[0-2]))/:([0-5][0-9])((/s)|(/:([0-5][0-9])/s))([AM|PM|am|pm]{2,2})))?$

描述

匹配ANSI SQL的日期格式:YYYY-mm-dd hh:mi:ss am/pm

包括检查从1901-2099是否是闰年。

匹配的例子

2004-2-29

2004-02-29 10:29:39 pm

2004/12/31

不匹配的例子

04-2-29

04-02-29 10:29:39 pm

04/12/31

其他

匹配字体

表达式

^(/d)(/d)*( )*(px|PX|Px|pX|pt|PT|Pt|pT|)$

描述

查找字体的后缀

 

匹配的例子

1px

100 PT

20Px

不匹配的例子

1abc

px

1 sdfs

 

匹配MD5哈西字符串

表达式

^(/d)(/d)*( )*(px|PX|Px|pX|pt|PT|Pt|pT|)$

描述

^([a-z0-9]{32})$

匹配的例子

790d2cf6ada1937726c17f1ef41ab125

不匹配的例子

790D2CF6ADA1937726C17F1EF41AB125

Regex的相关工具和word文档可以在这里找到。://xafile/Share/Public/Bond/Regex

 

 

PS:

这个列表会一直更新的,希望大家也能多多支持。把看到的有用的Regex都贴进来。

J

Oracle实现往某表批量插入记录 Oracle如何实现往某表批量插入记录? 阅读详情

相关推荐

oracle中从4个表查询数据并插入到另一张表里 扩展到查询到的数据和其他数据共同插入

因为业务的需要,现在需要查询4个表里的数据并插入到另一个表内且对应自己想要对应的列。 且表的id应该是根据序列自动生成。 具体创建序列什么的都不说了,直接上代码,字段都没改,最近太忙了。 insert into TB_POST_REQUIRE_INFO (id, BENCHMARK_POST_CODE, BENCHMARK_POST_NAME, POST_SEQUENCE, POST_RA

lindiwo的博客 7654

SuppressLint黄色警告的原因以及解决办法

一些常见的SuppressLint黄色警告及其解决办法。

qq_34706837的博客 1万+

Project1xxxxxxxxxxxxxxxxxxxxxx35533354345345_java_solver_maths_源

master game solver. uses algorithms to find optimal solution

XXXXXXXXXXXXXXXXXXXXX

public class FTPUtil {  public static Log logger = LogFactory.getLog(FTPUtil.class);  private static String userName; // FTP ��¼�û���  private static String password; // FTP ��¼����  private stati

小菜鸟的博客 68万+

实战指南:从零搭建ROS2 + Cartographer 2D激光SLAM系统

本文详细介绍了如何从零开始搭建ROS2与Cartographer结合的2D激光SLAM系统,涵盖环境准备、激光雷达驱动配置、Cartographer安装与参数调优等关键步骤。通过实战案例和常见问题解决方案,帮助开发者快速掌握激光雷达建图技术,提升机器人自主导航能力。

weixin_29062255的博客 414

SAP SD 顾问面试问题 consultant interview questionnaire

以下是我个人目前面试团队 SD顾问问题的小结,希望对大家有所帮助, 也可能有回答错误的地方,希望同行不吝赐教。 也希望各位顾问们讲你们遇到的一些面试问题做个跟贴,方便大家共同进步,谢谢。   面试问题清单:  一、销售订单类型影响: 可用性检查,交货类型,输出,信贷,定价,需求,报表,合作伙伴,文本,不完整日志,交货开票,订单开票,公司间开票,统计组,屏幕顺序组,参数文件...

weixin_33825683的博客 1819

XXXXXXXXXXXXX

Netflix主机性能监视工具Vector http://www.chinaz.com/web/2015/0414/398451.shtml     云雀科技是总部位于西雅图的新兴的云服务公司,利用业界 最新技术打造下一代具有高密度动态计算能力的云平台。     Current Openings   Bootstrap,来自 Twitter,是目前最受欢迎的前端框架。Boo

lusic01的专栏 11万+

【MSSQL】以一张表的查询结果作为另一张表的插入数据

insert into T_Info_OA_BusinessCardDetail select newid() BusinessCardDetailId,* from T_Info_OA_BusinessCardFolder where BusinessCardFolderId not in ( select BusinessCardFolderId from T_Info_OA_BusinessCardDetail)

欢迎指错||纠正||建议||水评+点赞&&评论&&关注&&转发 1718

python画弗里德曼(Friedman) 检验和秩和检验(Nemenyi)检验图

python画弗里德曼(Friedman) 检验和秩和检验(Nemenyi)检验图 画好后效果图 实现代码如下 import matplotlib.pyplot as plt #算法平均排名 _alg_=[1.405,2.643,2.786,2.167] y=[1,2,3,4]#alg1,alg2,alg3,alg4 通过Nemenyi测试计算得到的临界值CD CD=1.024 h_CD=CD/2 plt.figure(figsize=(10,6)) plt.scatter(_alg_,y,s=10

大模型天花板 4478

Anaconda镜像源切换全攻略:从清华源到恢复默认设置的完整流程

本文详细介绍了Anaconda镜像源的管理与优化,重点讲解了如何配置清华源以提升国内下载速度。内容涵盖镜像源工作原理、清华源详细配置步骤、多源管理策略、常见问题排查以及如何安全恢复默认设置,帮助用户构建完整的镜像源管理体系。

weixin_28828243的博客 1030

Oracle中把一张表查询结果插入到另一张表中

Oracle中把一张表查询结果插入到另一张表中  一、Oracle数据库中,把一张表的查询结果直接生成并导入一张新表中。   例如:现有只有A表,查询A表,并且把结果导入B表中。使用如下SQL语句:   Sql代码   create table B as select * from A   二、Oracle数据库中支持把查询结果导入到另外一张表中。   例如:有两个表A和B   1)如

程序E生 7317

使用lightGBM进行数据建模及预测

在机器学习领域中,数据建模和预测一直是非常重要的任务。而lightGBM作为一种基于梯度提升算法的高效机器学习框架,被广泛应用于数据建模和预测中。本文将介绍如何使用lightGBM进行数据建模和预测。到此,我们已经成功使用lightGBM对数据进行了建模和预测。使用lightGBM可以快速、高效地完成数据建模和预测任务,是机器学习领域中不可或缺的工具之一。使用lightGBM进行数据建模及预测。

qq_37934722的博客 1024

ORACLE SQL: 从一个表中查询数据插入另一个表中

insert into expertinfo (expertid,expertname,expertcode,sex,enabled) select primarykey as expertid, name as expertname, '' as expertcode, case sex when '男' then '1' when '0' then

工作博客 6612

上位机介绍:C# 开发者的必知基础

上位机是指在工业控制系统中,位于上层、负责人机交互和数据管理的计算机/软件,与“下位机”(PLC、传感器、变频器、单片机等硬件设备)相对应,核心是“向下通信控制设备,向上展示交互数据”。下位机:一线干活的“工人”(执行采集、控制指令);上位机:指挥管理的“办公室人员”(发指令、看数据、做报表)。C#开发者掌握上位机开发的核心是“通信+UI+稳定性基础层:搞懂WinForms/WPF基础、串口/Modbus通信,能实现核心功能;进阶层:掌握分层设计、异步编程、工业级容错(断线重连、数据校验);

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1567

PyCharm 接入 OpenAI Codex CLI 的 4 步配置与调试实录

揭示 Codex CLI 在 PyCharm 中上下文失稳的四大根源:CLI 启动模式与 IDE 进程模型冲突、stdin/stdout 流式处理不兼容、环境变量污染、AST 注释缺失,并给出基于 Shell 脚本桥接与结构化上下文注入的稳定接入方案。

weixin_42627902的博客 394

oracle中把一张表查询结果插入到另一张表中两张表在不同的位置,Oracle中把一张表查询结果插入到另一张表中...

一、Oracle数据库中,把一张表的查询结果直接生成并导入一张新表中。例如:现有只有A表,查询A表,并且把结果导入B表中。使用如下SQL语句:Sql代码create table B as select * from A二、Oracle数据库中支持把查询结果导入到另外一张表中。例如:有两个表A和B1)如果两个表的表结构是否相同,但要插入的字段类型相同:(1)把A表的全部字段数据插入到B表中:Sql代...

weixin_30479921的博客 4208

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

oracle 查询结果插入到表中几种方式(转载)

转载自:https://www.cnblogs.com/senyier/p/7666300.html 一、Oracle数据库中,把一张表的查询结果直接生成并导入一张新表中。 例如:现有只有A表,查询A表,并且把结果导入B表中。使用如下SQL语句: create table B as select * from A; 二、Oracle数据库中支持把查询结果导入到另外一张表中。 例如:有两个表A和B 1)如果两个表的表结构是否相同,但要插入的字段类型相同: I 把A表的全部字段数据插入到B表中: insert

weixin_48860638的博客 5904

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Oracle中把一个查询结果插入到一张表中

一、Oracle数据库中,把一张表的查询结果直接生成并导入一张新表中。  例如:现有只有A表,查询A表,并且把结果导入B表中。使用如下SQL语句:  create table b as select * from a  二、Oracle数据库中支持把查询结果导入到另外一张表中。  例如:有两个表A和B  1)如果两个表的表结构是否相同,但要插入的字段类型相同: 

wang_159369的专栏 1504

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

MySQL、Oracle把一张表查询的结果插入到另一张表中

1、目标表不存在: create table 目标表名 as select * from 表名 where 条件; 2、目标表存在: insert into 目标表名 select * from 表名 where 条件; 3、同一张表中将A的值赋给B: update 表名 set A=B; 4、删除表: truncate table 表名; ......

m0_53166211的博客 3385

Oracle和MySQL批量插入数据;利用update实现将一个表的字段值赋给另一张表的字段

一,Oracle和MySQL批量插入数据 Oracle批量插入数据: 建表: create table TableA( id integer, name varchar2(20), no varchar2(20) ) insert批量插入语句: insert all into TableA values(1,'张三',nu...

aq_112700的博客 2065

sqlserver /Oracle 将查询出来的数据 生成一张新表 (以及将查询的数据插入已存在的表)

查询语句生成的数据 直接insert 到表中,无需另外建表 建字段 。 oracle : create table 表名 as select 语句 sql server (要求表不存在): select *into table_new from table (from 后面可接查询语句) 用处: 可以做表备份 ,物化视图 ,物化查询语句,快速建立一张新表 等等。 说明: 无需...

qq_34083182的博客 1万+
上一篇: 看看下面苏格拉低与失恋者的对话
下一篇: Regular Expressions (1) ---- What is Regular Expressions?
etmonitor
博客等级 码龄23年 0粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值