Effective STL: Item 21: Always have comparison functions return

SpringBoot+Vue+Mysql社区医院信息平台(源码+文档) SpringBoot+Vue+Mysql学生宿舍信息管理系统 WEB端软件项目(源码+文档) 项目包含:①完整源码(后端+管理后台+用户前台);②数据库脚本文件;③万字论文文档;④开题报告;⑤答辩PPT;⑥项目运行视频教程。 项目架构: B/S 架构、MVC 分层设计 技术栈: Java、MySQL、SpringBoot、MyBatis-Plus、Token 权限校验、管理后台 Vue+ElementUI+ECharts、用户前台 Layui+jQuery、Maven 构建。 一、角色设计 学生用户: 注册登录、浏览宿舍信息、查询宿舍安排、在线报修、缴费查询、失物招领、桶装水预订、评论交流、收藏等。 商家用户: 注册登录、桶装水品牌与商品信息维护、预订订单查看与处理。 维修人员: 注册登录、查看待处理报修、接单维修、填写报修处理结果与进度反馈。 管理员: 学生管理、班级管理、宿舍信息管理、宿舍安排管理、报修处理管理、缴费信息管理、卫生检查与文明宿舍管理、失物招领管理、桶装水与商家管理、维修人员管理、公告资讯与轮播图管理等。 二、前台功能模块(学生端) 1. 首页展示:轮播图、宿舍公告、最新动态推荐、常用服务快速入口 2. 宿舍信息模块:宿舍列表、楼栋与房间条件筛选、宿舍详情查看、我的宿舍安排查询 3. 在线报修模块:在线提交宿舍设施报修申请、上传故障描述、查看报修进度与维修处理结果 4. 缴费模块:水电等缴费记录查询、缴费状态查看 5. 卫生检查与文明宿舍:宿舍卫生检查结果公示、文明宿舍展示 6. 失物招领模块:失物信息发布、招领信息发布、详情查看、评论互动 7. 桶装水预订:桶装水品牌与商品浏览、在线预订、我的预订记录查询 8. 假期留宿:假期留校申请提交、申请记录查询 9. 评论与收藏:信息评论、查看他人评论、评论回复互动、收藏感兴趣的内容 10. 个人中心... 立即下载
Let me show you something kind of cool. Create a set where less_equal
is the comparison type, then insert 10 into the set:
set<int, less_equal<int> > s; // s is sorted by “<=”
s.insert(10); // insert the value 10
Now try inserting 10 again:
s.insert(10);
For this call to insert, the set has to figure out whether 10 is already
present. We know that it is, but the set is dumb as toast, so it has to
check. To make it easier to understand what happens when the set
does this, we’ll call the 10 that was initially inserted 10 A and the 10
that we’re trying to insert 10 B .
The set runs through its internal data structures looking for the place
to insert 10 B . It ultimately has to check 10 B to see if it’s the same as
10 A . The definition of “the same” for associative containers is equiva-lence
(see Item 19), so the set tests to see whether 10 B is equivalent to
10 A . When performing this test, it naturally uses the set’s comparison
function. In this example, that’s operator<=, because we specified
less_equal as the set’s comparison function, and less_equal means oper-ator<=.
The set thus checks to see whether this expression is true:
!(10 A <= 10 B ) && !(10 B <= 10 A ) // test 10 A and 10 B for equivalence
Well, 10 A and 10 B are both 10, so it’s clearly true that 10 A <= 10 B .
Equally clearly, 10 B <= 10 A . The above expression thus simplifies to
!(true) && !(true)
and that simplifies to
false && false
which is simply false. That is, the set concludes that 10 A and 10 B are
not equivalent, hence not the same,and itthus goes aboutinserting
10 B into the container alongside 10 A . Technically, this action yields
undefined behavior, but the nearly universal outcome is that the set
ends up with two copies of the value 10, and that means it’s not a set
any longer. By using less_equal as our comparison type, we’ve cor-rupted
the container! Furthermore, any comparison function whereഊequal values return true will do the same thing. Equal values are, by
definition, not equivalent! Isn’t that cool?
Okay, maybe your definition of cool isn’t the same as mine. Even so,
you’ll still want to make sure that the comparison functions you use
for associative containers always return false for equal values. You’ll
need to be vigilant, however. It’s surprisingly easy to run afoul of this
constraint.
For example, Item 20 describes how to write a comparison function
for containers of string* pointers such that the container sorts its con-tents
by the values of the strings insteadofthe valuesofthepointers.
That comparison function sorts them in ascending order, but let’s
suppose you’re in need of a comparison function for a container of
string* pointers that sorts in descending order. The natural thing to do
is to grab the existing code and modify it. If you’re not careful, you
might come up with this, where I’ve highlighted the changes to the
code in Item 20:
struct StringPtrGreater: // highlights show how
public binary_function<const string*, // this code was changed
const string*, // from page 89. Beware,
bool> { // this code is flawed!
bool operator()(const string *ps1, const string *ps2) const
{
return !( *ps1 < *ps2); // just negate the old test;
} // this is incorrect!
};
The idea here is to reverse the sort order by negating the test inside
the comparison function. Unfortunately, negating “<” doesn’t give you
“>” (which is what you want), it gives you “>=”. And you now under-stand
that “>=”, because it will return true for equal values, is an
invalid comparison function for associative containers.
The comparison type you really want is this one:
struct StringPtrGreater: // this is a valid
public binary_function<const string*, // comparison type for
const string*, // associative containers
bool> {
bool operator()(const string *ps1, const string *ps2) const
{
return *ps2 < *ps1; // return whether *ps2
} // precedes *ps1 (i.e., swap
// the order of the
}; // operands)ഊTo avoid falling into this trap, all you need to remember is that the
return value of a comparison function indicates whether one value
precedes another in the sort order defined by that function. Equal val-ues
never precede one another, so comparison functions should
always return false for equal values.
Sigh.
I know what you’re thinking. You’re thinking, “Sure, that makes sense
for set and map, because those containers can’t hold duplicates. But
what about multiset and multimap? Those containers may contain
duplicates, so what do I care if the container thinks that two objects of
equal value aren’t equivalent? It will store them both, which is what
the multi containers are supposed to do. No problem, right?”
Wrong. To see why, let’s go back to the original example, but this time
we’ll use a multiset:
multiset<int, less_equal<int> > s; // s is still sorted by “<=”
s.insert(10); // insert 10 A
s.insert(10); // insert 10 B
s now has two copies of 10 in it, so we’d expect that if we do an
equal_range on it, we’ll get back a pair of iterators that define a range
containing both copies. But that’s not possible. equal_range,itsname
notwithstanding, doesn’t identify a range of equal values, it identifies
a rangeofequivalent values. In this example, s’s comparison function
says that 10 A and 10 B are not equivalent, so there’s no way that both
can be in the range identified by equal_range.
You see? Unless your comparison functions always return false for
equal values, you break all standard associative containers, regard-less
of whether they are allowed to store duplicates.
Technically speaking, comparison functions used to sort associative
containers must define a “strict weak ordering” over the objects they
compare. (Comparison functions passed to algorithms like sort (see
Item 31) are similarly constrained.) If you’re interested in the details of
what it means to be a strict weak ordering, you can find them in many
comprehensive STL references, including Josuttis’ The C++ Standard
Library [3], Austern’s Generic Programming and the STL [4], and the
SGI STL Web Site [21]. I’ve never found the details terribly illuminat-ing,
but one of the requirements of a strict weak ordering bears
directly on this Item. That requirement is that any function defining a
strict weak ordering must return false if it’s passed two copies of the
same value.
Hey! That is this Item!
YOLOv8作物病害检测实战源码 这是一套基于YOLOv8n的农田病虫害目标检测系统,对叶片照片做目标检测,识别健康叶片、褐斑病、白粉病、锈病四类,并给出对应防治建议。全流程纯CPU可跑,配套交付完整Python源码、9章实战教程(md/html/pdf三种格式)、100张自造样本及YOLO标签、训练曲线与混淆矩阵截图、Tkinter界面和答辩PPT。 系统围绕五项功能展开:同一套推理逻辑覆盖图像、视频、摄像头三种来源;图形界面选文件即检测,画面叠彩色框标注病名与置信度,右侧面板同步给出症状与防治措施;检测记录自动写入CSV,统计页一键生成四类病害占比饼图;训练结束自动产出损失与精度曲线;内置防治建议文案库,检测命中即回填面板。 选型用YOLOv8n nano档,参数量约320万、权重约6.2MB,CPU单帧几十毫秒,小样本训练5到8分钟完成。数据由data_gen.py程序化绘制100张叶片图,固定随机种子,重跑分布一致,不依赖公开数据集。依赖全部锁版本,教程第7章整理了19条真实报错及排查方法,第8章给出换模型档、换PlantVillage数据集的迁移路径。 适合做计算机视觉方向课程设计或毕业设计的学生,也适合智慧农业方向想了解检测模型如何落进业务面板的学习者。不需要GPU,不需要系统学过目标检测,教程第3章会按需补齐原理。 使用时先pip install -r requirements.txt装好依赖,download_data.py下载预训练权重,data_gen.py生成样本后train.py训练,完成后用main.py infer批量检测或main.py gui启动界面。 立即下载

相关推荐

数据挖掘实战:决策树 + 聚类 + 关联规则,零 Key 离线可跑(Python 源码)

数据挖掘实战包。用 Python 标准库实现 CART 风格决策树、K-Means 聚类与 Apriori 关联规则,在虚构「星河便利店」会员表和购物篮上跑通分类、分群与购物篮分析,并给出准确率、轮廓系数、支持度/置信度/提升度。零第三方依赖、零 API Key 即可离线跑通。含 4 个样例、离线冒烟、中文 README(含「使用方法」)。均为作者原创可运行源码。MIT。作者 blog.csdn.net/mtl1994

effective stl 第21条:总是让比较函数在等值情况下返回false

#include<iostream> #include<set> #include<map> #include<algorithm> #include<functional> #include<iterator>using namespace std;int main() { set<int, less_equal<int>> s;//s采用“<=”来排序 s.insert(10);

sun%moon 752

产业园区如何高效对接企业技术需求与高校科研成果?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

Effective STL学习笔记-条款21

永远让比较函数对相等值返回false举一个set的例子: set<int, less_equal<int>> Set 我们多次插入同一个值,测试。 Set.insert(10); Set.insert(10);实际上在我的vs2015编辑器上,运行当第二个insert触发是,就会抛出一个异常,提示一个无效的比较器。这是因为set进行插入值时,会使用这个比较器进行对比,而将 10 <

柠檬柠檬C的博客 862

国央企创新负责人如何快速掌握本地科技资源分布与匹配情况?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

国央企创新负责人如何实现科技成果的精准识别与高效筛选?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

Effective STL学习笔记-条款31

了解你的排序选择个人认为掌握并灵活的使用stl的算法,对我们c++编程有着事半功倍的效果,排序算法的使用和掌握更加重要。使用的最多的算法可能就是sort了,或者qsort(条款46的存在可能会让更多人倾向于使用sort而不是qsort)。例如有一个Widget的Vector,你需要挑选出Widget质量最好5个,剩下的可以保持无序。 这时候我们不需要完全排序,sort显得有些浪费。 而parta

柠檬柠檬C的博客 418

高校技术转移办公室人员如何系统化管理科技成果信息?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

Effective STL条款21

条款21: 永远让比较函数对相等的值返回false让我向你展示一些比较酷的东西。建立一个set,比较类型用less_equal,然后插入一个10:set > s; // s以“<=”排序s.insert(10); // 插入10现在尝试再插入一次10:s.insert(10);对于这个insert的调用,set必须先要判断出10是否已经位于其中了。 我们知道它是

AMin2001的专栏 1310

T100服务端接口实战:从注册到日志排查的全链路开发指南

本文提供了一份T100服务端接口开发的全链路实战指南。从程序注册与框架签出开始,详细讲解了接口的数据结构设计、核心业务逻辑编写,到最终的部署上线与调用验证。文章重点分享了如何利用日志文件高效定位和排查接口问题,帮助开发者快速掌握T100接口开发的关键步骤与实用技巧。

weixin_28831399的博客 300

FPGA—DHT11数字温湿度传感器

1. DH1T11温湿度传感器与DS18B20温湿度传感器非常类似,都是严格按照时序要求写代码。建议可以比较学习。2. 显示温度与湿度部分的数据处理,采用 X10 进行在数码管上的移一位显示,配合了数码管小数部分的显示特点又区分了温度与湿度。3. 程序是按照一个接一个状态及顺序跳转的,建议使用状态机。说明:本人使用的是野火家Xilinx Spartan6系列开发板及配套教程,以上内容如有疑惑或错误欢迎评论区指出,或者移步B站观看野火家视频教程。

m0_72885897的博客 4779

Effective STL: Item 21: Always have comparison functions return (转)

Effective STL: Item 21: Always have comparison functions return (转)[@more@]Let me show you something kind of cool....

csd3176的博客 150

如何在windows电脑上搭建Linux环境(手把手教安装虚拟机软件和使用云服务器)

手把手教学如何搭建Linux环境

纪宁的博客 1万+

Effective STL 20 Specify comparison types for associative containers of pointers

Specify comparison types for associative containers of pointers

ruihuank的博客 399

C 语言多文件编程 : 大型程序的组织与管理

本文介绍了C语言多文件编程的核心概念与实践方法。主要内容包括:1. 多文件编程的必要性:解决单文件编程在大型项目中的维护和协作问题;2. 文件组织方式:头文件(.h)负责声明接口,源文件(.c)实现具体功能;3. 编译链接过程:分阶段编译和链接多个源文件;4. 头文件设计原则:包含接口声明、使用保护机制、保持自包含性;5. 模块化实践:通过示例展示学生信息管理系统的模块划分;6. 构建工具:介绍Makefile的编写和使用方法。文章还提供了创建静态库和动态库的指导,并强调了模块化设计、信息隐藏等软件工程原则

2503_91057718的博客 1947

NXP S32k3 MCAL EMIOS PWM配置

NXP s32k 配置 EMIOS PWM

Leon_0125的博客 2702

C++AI编译错误自动修复神器-告别手动Debug的终极方案

在日常 C++ 开发中,编译错误是最频繁遇到的障碍之一。一个中等规模的项目在重构期间,一次 可能产生数十甚至上百条错误信息。这些错误往往具有级联效应——一个头文件的拼写错误可能导致下游十几个翻译单元同时报错,而真正需要修改的地方只有一处。传统的工作流是: 这个循环对于经验丰富的开发者来说尚可接受,但对于以下场景则效率极低:优势:局限:本项目最适合以下场景:阅读

weixin_48053866的博客 281

微信小程序- 云开发上传并部署云函数时报错ResourceNotFound.Function, 未找到函数版本,请创建后再试。(小程序上传部署云函数提示错误,开发控制台中的云函数没有删除,详细排查)

微信小程序——云函数上传失败,微信小程序——解决上传并部署云函数时报错ResourceNotFound.Function, 未找到函数版本,请创建后再试。微信小程序上传云函数失败,微信小程序云开发|Error: ResourceNotFound.FunctionName, FunctionName 指定的资源不存在。微信云开发报错(Error: ResourceNotFound.FunctionName,微信小程序云函数报错,上传云函数 sum 失败 Error:,上传部署我们的云函数 2. 报错 错误信息

🏆 前端领域优质创作者 4316

Effective STL 21~25 (传值 class成员变量 non-menber函数)

条款21:必须要返回对象时,别妄想返回其reference 尽量不要在返回pointer 或 reference 指向一个local stack对象。 以后写法尽量按上述的去写。不然对其消耗太大。 条款22:将成员变量声明为private 切记将成员变量声明为private。这可以赋予客户访问数据的一致性,可细微分划分访问控制、提供了class作者以充分的实现弹性。 protected...

比卡丘不皮的博客 315

beegfs读取文件完整流程分析

读取小于512KB文件数据,小于1s 读取15MB文件数据,花费7秒。

wfzy的博客 835

基于STM32L4XX、HAL库的ICM-42607-P姿态传感器驱动程序设计

/ 转换为dps(±1000dps量程)float accel_x = sensor_data.accel_x * (8.0f / 32768.0f);// 转换为g值(±8g量程)#define ICM42607_I2C_ADDR 0x68 << 1 // I2C地址(SA0=0)= 0x40) { // ICM-42607的WHO_AM_I值为0x40。// 读取传感器数据。

zhusl6688的博客 835

Scott Meyers的新书 Effective STL: 提高STL使用技术的50招

 Effective C++/More Effective C++的作者Scott Meyers即将推出最新力作:Effective STL, 该书目前已经完成,相信不久可以问世。但是与中国读者见面恐怕还是要在苦等之后。Addison=Wesley已经刊出了此书的页面。地址http://cseng.aw.com/book/toc/0,3830,0201749629,00.html下面是该书

孟岩 4810

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Java下通用自动插入数据组件的编制

正文将可复用程序进行组件化是J2EE的核心思想之一。组件表示的是开发和发布的单元,从组件用户的角度来看,组件可以在一个应用程序中使用多次,并在多个位置使用,在JAVA爱好者中一个广为人知的组件实例就是免费的商业组件SmartUpload。这里向大家介绍的是个人在实践中为了简化工作而制作的一个简单的自动插入数据的java组件,目的是将个人编制组件时的思考方法和技术实践拿出来与大家交流切磋。需求:在J

键者天行 7739

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

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

Java语言 The Blacks! ver.1.2

public static void main(String[] args) { //打印更新日志 vers.show(); //实体化father类,并赋值打印 father f1 = new father(); f1.setName("Jack"); f1.setAge(30); f1.show(); f1.showage(); //实体化mother类,并赋值打印 mother m1 = new mother(); m1.setName(.

m0_50889232的博客 224

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

【Linux 命令实战(04):文件内容查看,掌握 cat、less、head、tail】

cat:快速查看文件内容。less:分页浏览文件,支持搜索。head:查看文件开头。tail:查看文件末尾,支持实时跟踪。其中,tail -f是我建议大家重点掌握的命令。在自动化测试工作中,很多时候我们不需要等整个任务结束才分析结果。通过实时跟踪日志,就可以观察程序执行过程,及时发现接口异常、数据库连接失败等问题。当然,本篇还只是文件内容查看的基础。后面我们会继续学习如何从大量日志中筛选关键词、统计错误数量、定位异常记录。

一些微不足道的见解、希望能帮助各位 201
上一篇: Effective STL:Item 16: Know how to pass vector and string data to
copy
博客等级 码龄26年 2粉丝 4原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值