JUnit神奇的报错 java.lang.Exception:No tests found matching

信号的反射(振铃、台阶、回勾、尖峰毛刺) 反射是怎么形成的 假设信号传输过程中,经过两个阻抗不同的区域,如下图所示。区域1阻抗为Z1,区域2阻抗为Z2。 在分界面处,电压必须是连续的,否则,在分界面处会产生无穷大的电场,这在真实世界中是不可能的。 同样,分界面两侧的电流必须是连续的,否则分界面处会产生无穷大的磁场。 因此: 根据欧姆定律,必然有: 显然如果Z1≠Z2的情况下,上面式子不可能同时成立。如何理解这一困境? 应该从 ... 阅读详情
 

谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching

标签: junit spring mvc spring 报错
  13774人阅读  评论(7)  收藏  举报
  分类:
问题(21)   Spring(11)   MyBatis(5)   maven(11) 

最近在学习Spring+SpringMVC+MyBatis,一个人的挖掘过程确实有点艰难,尤其是有一些神奇的报错让你会很蛋疼。特别是接触一些框架还是最新版本的时候,会因为版本问题出现很多错误,欢迎大家一起学习交流害羞

这篇就说一下困扰我昨晚2小时的一个报错,nitializationError(org.junit.runner.manipulation.Filter)或者No tests found matching异常,查阅了很多资料,总结一下这些情况和解决办法。

1.最容易发现的错误,就如报错所说,没有找到test方法就是因为忘记在方法前加 @Test 注解了。

应该是这样:

public class TestCase {
  @Test
  public void checkSomething() {
    //...
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

2.使用Maven构建项目时候,pom文件中的JUnit版本和classpath中的版本不一致,删掉一个就好(这种应该没什么人吧。。。)。

3.你可以尝试重启Eclipse或者重建或者刷新项目,重新清理,关闭重新打开项目……有时候是Eclipse的问题。

4.如果是测试方法命名不规范的问题,你可以尝试把方法统一改为 testXXX(),这是JUnit3风格。

5.测试类所在文件夹必须为源文件夹source files,如果不是,选择 'Build path' -> 'Use as a source folder'。

6.看你的测试类是否继承TestCase,如果是,删除继承,并不需要继承,例如:

public class MyTestCase extends TestCase{
  @Test
  public void checkSomething() {
    //...
  }
}
//Result> AssertionFailedError: No test Found in MyTestCase
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

应该是下面的TestCase

public class MyTestCase {
  @Test
  public void checkSomething() {
    //...
  }
}
//Works fine
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
7.有些小伙伴右键选择特定的测试方法会报错,但是运行整个测试类却不会,不信可以试试大笑

8.如果你的Eclipse版本太旧,也会导致,更新版本。

9.最后一个就是我的这个问题:版本不兼容,需要更换JUnit或者spring版本

报错信息具体如下,会有两种

[html]  view plain  copy
  1. <span style="font-size:14px;">java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById], {ExactMatcher:fDisplayName=testQueryById(org.seckill.dao.SeckillDaoTest)], {LeadingIdentifierMatcher:fClassName=org.seckill.dao.SeckillDaoTest,fLeadingIdentifier=testQueryById]] from org.junit.internal.requests.ClassRequest@1698c449  
  2.     at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)  
  3.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)  
  4.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)  
  5.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)  
  6.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)  
  7.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)  
  8.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)  
  9.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)  
  10.   
  11. </span>  

或者:

[sql]  view plain  copy
  1. <span style="font-size:14px;">java.lang.ExceptionInInitializerError  
  2.     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
  3.     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
  4.     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
  5.     at java.lang.reflect.Constructor.newInstance(Constructor.java:408)  
  6.     at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)  
  7.     at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)  
  8.     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)  
  9.     at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)  
  10.     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)  
  11.     at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)  
  12.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)  
  13.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)  
  14.     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)  
  15.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)  
  16.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)  
  17.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)  
  18.     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)  
  19. Caused by: java.lang.IllegalStateException: SpringJUnit4ClassRunner requires JUnit 4.12 or higher.  
  20.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:102)  
  21.     ... 17 more  
  22. </span>  
No tests found matching和ExceptionInInitializerError这两个错误其实都是一个,都是初始化错误,测试用例没有成功。

[java]  view plain  copy
  1. <span style="font-size:10px;">package org.seckill.dao;  
  2.   
  3. import javax.annotation.Resource;  
  4.   
  5. import org.junit.Test;  
  6. import org.junit.runner.RunWith;  
  7. import org.seckill.entity.Seckill;  
  8. import org.springframework.test.context.ContextConfiguration;  
  9. import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;  
  10.   
  11. /** 
  12.  * project:seckill 
  13.  * @author Daley 下午10:20:28 2016年12月20日 2016 
  14.  * 配置Spring和JUnit整合 ,JUnit启动时加载SpringIOC容器 
  15.  */  
  16. @RunWith(SpringJUnit4ClassRunner.class)  
  17. //告诉JUnitSpring配置文件  
  18. @ContextConfiguration({"classpath:spring/spring-dao.xml"})  
  19. public class SeckillDaoTest {  
  20.     //注入Dao实现类依赖  
  21.     @Resource  
  22.     private SeckillDao seckillDao;  
  23.     @Test  
  24.     public void testQueryById() {  
  25.         long id=1000;  
  26.         Seckill seckill=seckillDao.queryById(id);  
  27.         System.out.println(seckill.getName());  
  28.         System.out.println(seckill);  
  29.     }  
  30.   
  31. }</span>  

由于试过了很多方法,这时我有了一个最不愿意的怀疑,难道是版本不兼容问题?

于是我把 @RunWith注解删掉,发现这时报的是空指针错误,说明没有加载spring容器,我使用的SpringFramework版本是 4.3.4.RELEASE ,这个是最终版本应该是比较稳定和兼容性好呀,那么问题可能就是JUnit不兼容了,我使用的是JUnit4.10
当我换成4.11时候,还是报错,但是换到最新的4.12版本的时候,这个报错消失了!出现了这个可爱的颜色。


嗯……绿色一定是我的最爱

顺便贴出配置信息:

[html]  view plain  copy
  1. <span style="font-size:14px;"><dependency>  
  2. <groupId>junit</groupId>  
  3. <artifactId>junit</artifactId>  
  4. <version>4.12</version>  
  5. </dependency>  
  6. <dependency>  
  7. <groupId>org.springframework</groupId>  
  8. <artifactId>spring-core</artifactId>  
  9. <version>4.3.4.RELEASE</version>  
  10. </dependency>  
  11. <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->  
  12. <dependency>  
  13. <groupId>org.springframework</groupId>  
  14. <artifactId>spring-context</artifactId>  
  15. <version>4.3.4.RELEASE</version>  
  16. </dependency>  
  17. <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->  
  18. <dependency>  
  19. <groupId>org.springframework</groupId>  
  20. <artifactId>spring-beans</artifactId>  
  21. <version>4.3.4.RELEASE</version>  
  22. </dependency>  
  23. <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->  
  24. <dependency>  
  25. <groupId>org.springframework</groupId>  
  26. <artifactId>spring-jdbc</artifactId>  
  27. <version>4.3.4.RELEASE</version>  
  28. </dependency>  
  29. <!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->  
  30. <dependency>  
  31. <groupId>org.springframework</groupId>  
  32. <artifactId>spring-tx</artifactId>  
  33. <version>4.3.4.RELEASE</version>  
  34. </dependency>  
  35. <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->  
  36. <dependency>  
  37. <groupId>org.springframework</groupId>  
  38. <artifactId>spring-web</artifactId>  
  39. <version>4.3.4.RELEASE</version>  
  40. </dependency>  
  41. <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->  
  42. <dependency>  
  43. <groupId>org.springframework</groupId>  
  44. <artifactId>spring-webmvc</artifactId>  
  45. <version>4.3.4.RELEASE</version>  
  46. </dependency>  
  47. <!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->  
  48. <dependency>  
  49. <groupId>org.springframework</groupId>  
  50. <artifactId>spring-test</artifactId>  
  51. <version>4.3.4.RELEASE</version>  
  52. </dependency></span>  


SAP PI 系统复制,不只是把数据库拷过去,而是一次集成拓扑的重新落位 文章摘要:SAP PI/PO系统刷新生产数据到测试环境时,标准系统复制无法自动处理集成中枢特有的环境绑定问题。系统复制后,PI仍保留生产环境的连接配置,可能导致测试系统向生产环境发送消息。SAP提供的CTC模板可自动化部分后续配置,但无法替代人工对接口风险的全面评估。关键在于系统复制前绘制接口风险地图,复制后进行分层次验证:禁用生产连接、重定向测试接口、复核安全配置,并通过代表性链路测试确保系统行为符合预期。这需要结合SAP标准流程与业务语义判断,形成完整的治理闭环。 阅读详情

相关推荐

MySQL等保三级合规实践:如何安全配置root账户的本地与受信主机登录策略

本文详细介绍了MySQL在等保三级合规框架下如何安全配置root账户的本地与受信主机登录策略。通过分析root账户的特殊保护需求,提供三种安全加固方案,包括限制访问范围、限定登录IP和完全禁止远程登录,并指导创建安全的远程管理账户。文章还涵盖了密码策略强化、日志审计配置和网络层防护等关键合规要求,帮助用户实现MySQL的等保三级全面合规。

weixin_42522964的博客 260

spring boot测试时发现的java.lang.Exception: No tests found matching报错

讲真这是个神奇的错误! 而且我每一次在spring boot项目中成功启动junit! 我用的是eclipse 2016的,以前用着也还好,会不会是eclipse的版本问题? 网上查了很多解决方案都不行。 先来看看情况: 在maven dependencies 是由这个jar包的: 运行spring boot   Test类: package com.unicom.springboo...

苏云南雁的博客 1万+

JAVA审批流程,一个简单表结构设计方案By OU

一、表结构设计1.流程表(process)用于存储审批流程的基本信息。字段名类型描述idBIGINT主键,流程IDname流程名称TEXT流程描述DATETIME创建时间DATETIME更新时间statusTINYINT(1)流程状态(0: 停用, 1: 启用)2.节点表(process_node)用于管理流程中的每个审批节点。字段名类型描述idBIGINT主键,节点IDprocess_idBIGINT流程ID,外键关联process.id。

1901

ava.lang.Exception:No tests found matching

java.lang.Exception:No tests found matching 解释:没找到对应的test方法 对应解决办法: 1、test方法上加上@Test 2、maven项目中pom中的junit版本和classpath中的版本不一致 3、测试类所在文件夹应为源文件夹source files 4、spring和junit版本不兼容等问题 ...

Bug君的博客 1833

怎么选?一文读懂12种SPC控制图,从基础到进阶,再到Python代码实现

本文系统介绍了12种常用SPC控制图的应用场景和特点,包括计量型(Xbar-R图、Xbar-s图、I-MR图等)、计数型(P图、NP图、U图等)及进阶控制图(EWMA图、CUSUM图、多元控制图)。文章强调控制图是SPC的核心工具,能有效区分过程变异类型,实现"预防优于检测"的质量管理目标。通过数据示例和Python代码展示了各类控制图的实现方法,为质量管理人员提供了实用参考。

m0_56592100的博客 4152

Code Ocean 上传代码 手把手教程

对于一些学术期刊,录用前会让把代码上传到Code Ocean上,但上传过程可能会遇到一些问题,小编分享一下自己的上传经验。他们会进行验证,验证通过,将自动发布。点此运行即可,但是运行比较慢。

u014071947的博客 1万+

java.lang.Exception: No tests found matching问题解决办法

Spring boot项目在src/test/java里边跑自己写的单元测试时,如果遇到如下异常: java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=myTest], {ExactMatcher:fDisplayName=myTest], {LeadingIdentifierMatcher:fCla...

h363659487的博客 1万+

语义分割系列7-Attention Unet(pytorch实现)

本文介绍了AttentionUnet模型和其主要中心思想,并在pytorch框架上构建了Attention Unet模型,构建了Attention gate模块,在数据集Camvid上进行复现。

yumaomi的博客 2万+

java编译时测试类报错_JAVA语言之在写测试类时报错,java.lang.Exception: No tests found matching Method的解决办法...

本文主要向大家介绍了JAVA语言之在写测试类时报错,java.lang.Exception: No tests found matching Method的解决办法,通过具体的内容向大家展示,希望对大家学习JAVA语言有所帮助。在写测试类时报错,java.lang.Exception:NotestsfoundmatchingMethod的解决办法java.lang.Exception:...

weixin_31832223的博客 1623

《Python星球日记》 第43天:机器学习概述与Scikit-learn入门

《Python星球日记》 第43天:机器学习概述与Scikit-learn入门

Code_流苏:在代码中寻诗意,在实践中觅真知 933

UE5 蓝图节点图文大全(300+蓝图,9万字+)

本文采用虚幻5.2.1版本,以图文的方式对蓝图节点进行介绍,包括蓝图节点的输入输出参数解释,并有中英文节点名称可参考。

一碗清深的博客 2万+

谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching

最近在学习Spring+SpringMVC+MyBatis,一个人的挖掘过程确实有点艰难,尤其是有一些神奇的报错让你会很蛋疼。特别是接触一些框架还是最新版本的时候,会因为版本问题出现很多错误,欢迎大家一起学习交流 这篇就说一下困扰我昨晚2小时的一个报错,nitializationError(org.junit.runner.manipulation.F...

weixin_34368949的博客 4785

YOLOv12 改进 | Backbone改进 3

将CSP中的简单拼接改为可学习的特征选择门控,动态决定哪些特征流向下一层,同样再写这篇。:相比静态CSP的固定50/50分割,门控机制可学习0.3:0.7等最优比例。在输入端加入轻量SR模块,对下采样后的特征进行超分恢复,提升小目标检测能力。(小目标): 从 0.51 AP → 0.63 AP (+24%):采用ESPCN的高效亚像素卷积,避免传统插值的信息损失。:从通道级(SE)到空间级(Spatial)的多粒度控制。:结合浅层细节和深层语义,恢复小目标的纹理信息。

u012133341的博客 842

谈一谈JPA遇到的:JUnit神奇的报错 java.lang.Exception:No tests found matching

http://blog.csdn.net/sinat_32873711/article/details/53780453#comments

anyway, life must全力以赴 374

文档:亲测可用解决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_神奇的报错 java.lang.Exception:No tests found matching

最近在学习Spring+SpringMVC+MyBatis,一个人的挖掘过程确实有点艰难,尤其是有一些神奇的报错 说一下困扰我昨晚2小时的一个报错,nitializationError(org.junit.runner.manipulation.Filter)或者No tests found matching异常,查阅了很多资料,总结一下这些情况和解决办法。 1.最容易发现的错误,就如报错所说...

瑞新の博客:bennyrhys 2283

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

SpringMVC跑单元测试junit报错的解决办法java.lang.Exception: No tests found matching

今天在跑单元测试的时候,控制台出现一堆乱七八糟的东西:显然不是我想要的在console中看不出任何错误!!!!!进入JUnit选项卡,由于不知道什么时候点击了Filter Stack  Trace导致也看不到错误!!!再点击一下就能看到错误信息!我没看到错误信息的时候点击了下旁边的Show Stack Trace in Console View然后错误信息就来了:java.lang.Excepti...

谢彬の优快云专栏 9099

蓝牙模块HM-10手册

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

JUnit:java.lang.Exception: No tests found matching Method ***

运行测试代码显示以下错误: java.lang.Exception: No tests found matching Method deleteById(cn.bytestream.mongodb.MongoDB4CRUDTest) from org.junit.internal.requests.ClassRequest@2cb0ce8f at org.junit.internal.request

kngines 3516

junit报错 java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testSelectByExample

junit 报错 java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testSelectByExample], 坑了我三个点的问题 不是没写 @Test,不是 public,参数,返回值,修饰符的错误,也不是 spring 包与 junit 的包的不兼容 @RunWith(SpringJUnit...

YKenan的博客 9895
上一篇: HBase Shell工具操作HBase
下一篇: Java客户端操作HBase代码
王树民
博客等级 码龄10年 912粉丝 560原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值