Apache ServiceComb 社区12月动态精选

ServiceComb数据一致性解决方案Saga演进介绍 传统的单体应用的微服务化改造过程中大多会面临数据库拆分,故而原来由数据库保证的数据一致性也一定面临重新设计和实现,此时需要引入分布式数据一致性方案来解决。常见的解决方案主要有2PC,TCC,事件驱动等,而在微服务开源项目 ServiceComb中提出并实现了使用Saga[1]来解决微服务的数据一致性难题,不同方案的对比可参考《ServiceComb中的数据最终一致性方案》[2]一文。Saga是一个... 阅读详情

点击蓝字关注这个神奇的公众号~

640?wx_fmt=gif


640?wx_fmt=png

Apache ServiceComb | 精选


Apache ServiceComb 致力于帮助企业、用户和开发者将企业应用轻松微服务化上云,并实现对微服务应用的高效运维管理。


640?wx_fmt=png

ServiceComb 进展动态  


1.Apache ServiceComb Saga Actuator 发布最新版 0.3.0

详情请参考Release Notes:

 https://servicecomb.apache.org/cn/release/saga-actuator-release-notes/

下载地址:

https://servicecomb.apache.org/cn/release/saga-actuator-downloads/


2.ServiceComb Saga启动定期(两周一次)线上社区交流会 

详情请参考归档邮件列表:

 http://mail-archives.apache.org/mod_mbox/servicecomb-dev/201812.mbox/%3CCA%2BQaCW%2BX%3DzfKSUL5b%3Db8ihsK0g3osKCcXQy4M78NLR4t7497Uw%40mail.gmail.com%3E


3. Apache ServiceComb 社区联合传智播客的黑马程序员、博学谷、传智汇子品牌发布微服务化教程


4. Apache ServiceComb 荣获中国开源云联盟组织的中国优秀开源项目一等奖



640?wx_fmt=png

  FAQ精选问答


Q1

问下有没有ServiceComb 的快速脚手架项目,之前一直用spring cloud的。    

A

640?wx_fmt=png

1.  在Springboot运行ServiceComb: 浏览器访问 start.servicecomb.io,简单配置一键生成Springboot+ServiceComb的微服务工程


2.  POJO/SpringMVC/JAX-RS 编程模型一键制作基于ServiceComb的微服务工程脚手架:

https://github.com/apache/servicecomb-java-chassis/tree/master/archetypes



Q2

在metrics看到
 "threadpool.maxThreads(id=cse.executor.groupThreadPool-group0)": 4.0,
 "threadpool.maxThreads(id=cse.executor.groupThreadPool-group1)": 4.0,这个值会限制sc本身的性能吗?    

A

640?wx_fmt=png

这个是业务线程池,跟sc没关系

servicecomb:
  executor:
    default:
      group: 2    组数,默认为2
      thread-per-group: 4   每组中有多少个线程,默认为CPU数

这是内置默认线程池的配置,线程池可以自定义



Q3

在java模式(依赖spring-boot-starter-provider)下怎么读取到request.header信息吗?    

A

640?wx_fmt=png

获取header的方式有三种:

1. 在REST接口上定义Header参数public String sayHello(@RequestHeader(name = "paramHeader") String paramHeader),这种方式可以获取指定名称的header,如这里的"paramHeader",并且该header会表现在服务契约上
2. 在REST接口上定义HttpServletRequest参数public String sayHello(HttpServletRequest httpServletRequest),HttpServletRequest不会表现在服务契约上,可以从中获取请求的所有header
3. 自定义扩展HttpServerFilter,从afterReceiveRequest方法的HttpServletRequestEx参数上能获取请求的全部header

详情参考:

https://support.huaweicloud.com/devg-cse/cse_java_0040.html
根据文档应该是支持RequestHeader的



Q4

我们在responsedto中定义了一个字段,定义如下:
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ApiModelProperty(value = "报告分发时间")
private Date reportAssignedDate;,直接通过postman访问微服务返回的时间格式如下 "reportAssignedDate": "2018-12-18", 通过servicecomb的edge网关调用后,返回的数据格式如下: "reportAssignedDate": "2018-12-13T16:00:00.000Z",后面自动加了一串字符。 请问怎么解决这个问题?    


A

640?wx_fmt=png

目前SerivceComb支持不了这种情况。Date编码需要遵循OpenAPI规范,即日期格式统一使用2018-12-13T16:00:00.000Z。 使用@JsonFormat标签,会在A -> B->C等多重调用关系上出现你的这种情况。 没法相互统一。
详细规范参考:

https://swagger.io/docs/specification/data-models/data-types/#string



Q5

压力测试最新结果发现压单台还好,但是多了一层haproxy或nginx,整体性能下降,平均消耗时间多了一倍。假设压测工具是jmeter
1.jmeter->servicecomb,tps为x,时延为t
2.jmeter->haproxy/nginx/->servicecomb,tps为x/2,时延为t*2

A

640?wx_fmt=png

可以使用serviceComb最新代码,开启metrics。这样就可以观察到每周期的环境信息,以及每周期连接建立、断连情况,最好也采集metrics信息来分析,metrics中各个阶段的耗时,会清晰很多。



Q6

saga 支持私有rpc分布式事务吗?

A

640?wx_fmt=png

只要RPC能传递 header的话就能做。
详情参考: 

https://github.com/apache/servicecomb-pack/tree/master/omega/omega-transport/omega-transport-dubbo 



Q7

怎么在华为云下载的第一个微服务:helloworldprovider下载下来?

在eclipse中打开 pom.xml报错:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.springframework.boot:spring-boot-maven-plugin @ line 75, column 21
[ERROR] Non-resolvable import POM: Failure to find com.huawei.paas.cse:cse-dependency:pom:2.3.47 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced @ line 28, column 25    

......

A

640?wx_fmt=png

要把cse仓库加入maven settings文件中,要么就不要使用cse的包,只用servicecomb即可。
参考网址:

https://support.huaweicloud.com/qs-cse/cse_qs_0012.html 



Q8

servicecomb为什么启动不了TSL通信?

A

640?wx_fmt=png

关于ServiceComb支持TLS通信的方法请参照这篇文档,ServiceComb支持的是标准的HTTPS证书格式,用户可选择各种标准工具生成。

参考网址:https://docs.servicecomb.io/java-chassis/zh_CN/security/tls.html



Q9

servicecomb-saga-actuator跟servicecomb-saga是什么关系?

A

640?wx_fmt=png

servicecomb-saga-actuator是集中式的Saga事务协调器,通过代理方式调用外部的服务。servicecomb-saga 已经改名为servicecomb-pack, 是一个分布式的事务协调器提供saga,以及tcc多种分布式事务协议的实现。



Q10

使用IDE,该如何使用servicecomb搭建项目框架?


A

640?wx_fmt=png

可以直接下载DEMO,或者使用脚手架。

详情请参考以下网址:
https://huaweicse.github.io/cse-java-chassis-doc/featured-topics/develop-microservice-using-cse.html
https://github.com/huaweicse/cse-java-chassis-samples/tree/master/porter
https://docs.servicecomb.io/java-chassis/zh_CN/start/first-sample.html



欢迎大家在ServiceComb讨论群

或者gitter聊天室与我们互动

https://gitter.im/ServiceCombUsers/Lobby


640?wx_fmt=gif

精彩活动回顾


Apache ServiceComb荣获中国优秀开源项目一等奖

640?wx_fmt=jpeg

《ServiceComb 简化上云,使命必达》

主讲人:马彬

【北京,2018年12月13日】

在北京举办的“第八届云计算标准和应用大会“上,Apache ServiceComb 微服务开源解决方案凭借技术发展潜力,活跃程度和受关注程度等, 荣获中国开源云联盟组织的“中国优秀开源项目一等奖”。


ServiceComb在清华传播开源开发经验

640?wx_fmt=jpeg

《开源开发者的一天》

姜 宁  华为开源能力中心技术专家

Apache SerivceComb 负责人

【北京,2018年12月19日】

Apache ServiceComb VP & 华为开源软件能力中心技术专家姜宁将在“2018清华开源软件发展峰会”上主讲《开源开发者的一天》,和大家分享参与开源开发的经验及Apache ServiceComb资讯。


ServiceComb携传智播客发布微服务化课程

640?wx_fmt=jpeg

【北京,2018年12月23日】

《传智嘉年华暨Apache ServiceComb Meetup》活动在北京环球财讯中心举行,Apache ServiceComb与华为云微服务引擎携传智播客黑马程序员、博学谷、传智汇子品牌联合微服务化课程共建暨技术资源共享成功发布。


640?wx_fmt=gif

线上会议回顾

Meeting #3



Date :  2018.12.24  3:00PM

议程内容: 

1. ServiceComb Saga and Pack的发布计划

2. 最近常见的ServiceComb Pack问题

在12月29日前发布servicecomb pack 0.3.0,我们需要确定在发布前是否还有其他问题需要解决。


线上会议已累计开了三次

欢迎大家加入到我们的线上社区会议哈~

Zoom会议链接:

https://zoom.us/s/552485685

640?wx_fmt=gif



长按识别二维码,了解更多精彩

640?wx_fmt=jpeg

期待志同道合的朋友们加入

ServiceComb的大门为你们敞开~

用心做开源,不忘初衷


了解更多信息请访问: 

官方网站 http://servicecomb.apache.org/ 

Github代码仓库 https://github.com/apache?q=ServiceComb

 

记得动手给ServiceComb Github仓库点个“Star”哦~


640?wx_fmt=gif




点“阅读原文”,立刻去支持~


BM25:LLM智能体中轻量、可解释、高可用的检索基石 BM25是一种基于词频-逆文档频率的经典稀疏检索算法,其核心原理是通过TF-IDF加权与文档长度归一化,量化查询与文档的相关性。相比黑盒化的向量检索,BM25具备零训练依赖、毫秒级响应、完全可解释、中文适配友好等技术价值,特别适合RAG架构中作为首层召回器。在客服Bot、企业知识助手、内部文档问答等需‘边查边答’的LLM智能体场景中,BM25能以极低资源开销保障高召回率与稳定性,已成为生产环境中不可或缺的隐形引擎。 阅读详情

相关推荐

如何加入Apache开源社区:Apache ServiceComb (incubating) 微服务开源项目实例讲解

近期,热衷开源和微服务的伙伴们非常关注如何加入到 微服务 开源项目 Apache ServiceComb (incubating) 社区。Apache ServiceComb 作为开源的Apache软件基金会孵化项目,加入方式和常规的加入开源社区的方式大体一致,一般为三个阶段:订阅并关注社区动态;开始在开源社区提交第一份代码;深度加入社区讨论并贡献。以下将详细向大家讲述如何一步步加入Service...

ServiceComb的博客 2579

分布式事务数据最终一致性之serviceComb-Saga使用方法

准备环境 1.安装JDK 1.8 2.安装Maven 3.x 3.安装Docker 编译 $ git clonehttps://github.com/apache/incubator-servicecomb-saga.git $ cd incubator-servicecom...

chouyun6496的博客 833

如何实现一个优质的微服务框架:Apache ServiceComb 的开放性设计

摘要: 一个优质的微服务框架需要考虑的要素众多,在满足微服务设计理念的前提下,也是一个不断实践优化的过程。本文讲述了整个 开源微服务框架 Apache ServiceComb 设计形成的前因后果,尝试从理念、思想和实践结合的维度剖析一个优质的微服务框架应该具备哪些要素,包括但不限于 对开发者友好、高性能、内外部扩展性等。阅读本文有利于加深对微服务理念和框架的理解,给予微服务用户或开发者以帮助,...

霍力强的专栏 605

刚柔并济的开源分布式事务解决方案

★作者★张亮,京东数科数据研发负责人,Apache ShardingSphere发起人 & PPMC热爱开源,目前主导开源项目ShardingSphere(原名S...

ShardingSphere官微 2172

servicecomb-saga-actuator:Apache ServiceComb Saga执行器

佐贺执行器 目的 Saga是补偿交易模式的一种,它提供了一种简单的方法来帮助用户解决微服务应用程序中遇到的数据一致性问题。 Saga执行器提供了一个集中的执行引擎,以将请求委托给外部服务,从而以Saga方式提供最终的数据一致性。 文献资料 参考文档位于。 佐贺的主要建筑 saga-core(交易和补偿处理逻辑) saga-core-akka(利用演员作为执行者) 传奇格式(数据序列化和反序列化) saga-transports(将来会进行诸如rest或rpc之类的通信协议的实现) saga-discovery(服务发现) saga-spring(宁静的服务框架) 先决条件 你会需要: 建造 下载源代码。 git clone https://github.com/apache/servicecomb-saga-actuator 进入Saga根目录,通过maven命令启动Saga项

Blender关于GIS安装及使用天地图

Blender下载安装及GIS插件的安装及使用

Miss_SQ的博客 6973

如何加入ServiceComb社区

近期,热衷开源和微服务的伙伴们非常关注如何加入到ServiceComb社区。ServiceComb作为开源的Apache软件基金会孵化项目,加入方式和常规的加入开源社区的...

微服务技术与实践专栏 367

双臂复合机器人眼在手外标定实战:从原理到D435标定流程详解

本文详细解析了双臂复合机器人中眼在手外标定的核心原理与实战流程。通过阐述坐标系转换与AX=XB方程,重点介绍了使用Intel RealSense D435相机进行标定的完整步骤,包括环境搭建、数据采集、计算与验证,并提供了关键的避坑指南,帮助工程师实现相机与机械臂基座间的精确坐标对齐。

weixin_29100927的博客 461

Apache ServiceComb 社区1月动态精选

Apache ServiceComb | 精选新年今天是农历的正月十一结束了春节假期的小蜜蜂在家也吃胖了~相信有很多小伙伴已经回归到工作当中啦:)在精神抖擞牟足干劲的气氛...

微服务技术与实践专栏 1908

技术前沿:半导体前道检测和量测设备修复技术

半导体前道检测设备是目前除光刻机外,国产渗透率较低的环节之一,近年来我国初步实现国产突破。前道检测相对后道检测环节壁垒更高,国内多家涉及后道测试,涉及前道检测和中道检测相对较少。

VOMMA的博客 4548

博图编写温度程序_s7 smart200的CRC-16校验程序

最近做一个小项目,项目中采用485自由口通讯方式,使用一台西门子S7 smart200对一台冷水机做多个状态和温度做监控,并能对冷水机进行启停控制,和参数设置,因为冷水机的协议不是标准modbus格式,所以要自己编写通信协议。其中要用到CRC校验,在网上找了些别人写的程序,基本上用不了。只能自力更生了。首先,找到CRC校验的算法,并理解。 下面就是我找的算法(这个网上很多),1....

weixin_39539761的博客 3062

Apache ServiceComb 社区3月动态精选

春风十里,不如你~点击蓝字,关注我们~tánɡ棠lí梨jiān煎xuě雪青鲤来时遥闻春溪声声碎嗅得手植棠梨初发轻黄蕊待小暑悄过 新梨渐垂来邀东邻女伴撷果缓缓归旧岁采得枝头...

微服务技术与实践专栏 1462

ADS RFpro 射频阻抗仿真步骤

导入器件后,在库里面选取器件的对应模型,如图所示我们选取10pf 系统自带的村田模型。选取网络上的器件,拖入到下面component Models。导入成功后,截取需要仿真的区域(不截取仿真时间会非常长),可以生成对应如下原理图,通过原理图继续调整仿真。图上找到需要仿真链路上的网络,右键设置为信号。的叠层信息,按照PCB板厂提供信息填写完整。选择仿真的频率范围和频点数,生成如下图的RFPro仿真界。,然后再把GND也添加到下面。按图设置截取需要仿真的部分。添加成功后 网络就有了,15 双击run开始仿真。

m0_72954480的博客 3218

Apache ServiceComb 社区2月动态精选

Apache ServiceComb | 精选二月,是连接冬与春的使者,是承接寒与暖的桥梁。春季伊始,南方开始有了暖阳,北方的大雪慢慢融化。我们等待的,不仅是那一抹春色,...

微服务技术与实践专栏 453

线性代数笔记【空间曲面】

二次曲面 曲面可以看成是一个动点或一条动曲线按照一定条件或规律运动产生的轨迹 曲面的方程即是该动点的坐标所满足的方程 空间解析几何中,一般会涉及到由曲面写方程和由方程看曲面两种类型问题 曲面与曲面方程 球面方程 球面:空间内与定点的距离等于定长的点的集合 这一定点叫球心,定长叫半径 标准方程 (x−x0)2+(y−y0)2+(z−z0)2=r2(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=r^2(x−x0​)2+(y−y0​)2+(z−z0​)2=r2 球心P0(x0,y0,z0)P_0(

qq_40500005的博客 3248

QT实现ftp服务器(附完整源码)

QT实现ftp服务器(附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 1785

Apache ServiceComb 社区5月动态精选

点击蓝字关注我们或许我可用夏日把你来比方,但你比夏日更可爱也更温良。夏风狂作常摧落五月的娇蕊,夏季的期限也未免还不太长。......只要人眼能看,人口能呼吸,我诗必长存,...

微服务技术与实践专栏 318

Open3D 使用CPD算法对点云配准【2025最新版】

Coherent Point Drift相干点漂移算法实现点云配准(python代码)博客长期更新,本文最近更新时间为:2025年2月2日。

点云侠的博客 8万+

Apache ServiceComb 社区4月动态精选

你好,四月我说 你是人间的四月天;笑响点亮了四面风;轻灵在春的光艳中交舞着变你是四月早天里的云烟;黄昏吹着风的软,星子在无意中闪;细雨点洒在花前......你是一树一树的...

微服务技术与实践专栏 296

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

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

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

apache为什么更适合处理动态请求_Apache ServiceComb 社区4月动态精选

你好,四月我说 你是人间的四月天;笑响点亮了四面风;轻灵在春的光艳中交舞着变你是四月早天里的云烟;黄昏吹着风的软,星子在无意中闪;细雨点洒在花前......你是一树一树的花开,是燕在梁间呢喃,——你是爱,是暖,是希望,你是人间的四月天~Apache ServiceComb | 精选++林徽因执笔轻吟“你是爱,是暖,你是人间四月天”的倾世锦句,古来文人墨客无不对四月充满了浪漫的情怀,我亦钟...

weixin_39707478的博客 112

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

Apache ServiceComb 社区11月动态精选

点击蓝字关注这个神奇的公众号~Apache ServiceComb | 精选Apache ServiceComb 致力于帮助企业、用户和开发者将企业应用轻松微服务化上云,...

微服务技术与实践专栏 348

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

[里程碑]1.0.0版本正式发布——Apache ServiceComb(incubating)

近日,正在Apache基金会孵化项目—微服务解决方案Apache ServiceComb(incubating) 的1.0.0版本通过社区投票,正式发布。这次发版的项目包括 Apache ServiceComb Java-Chassis (以下简称 Java-chassis)以及Apache ServiceComb ServiceCenter (以下简称ServiceCenter)。        ServiceComb从2017年12月进入Apache基金会孵化至今半年时间内,一步一个脚印,于2018年

ServiceComb的博客 579

Apache ServiceComb Service Center:微服务架构中的核心注册中心

Apache ServiceComb Service Center是一个基于RESTful架构的服务注册中心,专为微服务架构设计,提供完整的服务发现与管理能力。作为微服务生态系统中的核心组件,它解决了分布式系统中服务动态发现与治理的关键问题。 ### 核心特性 1. **服务注册与发现**:支持微服务实例的自动注册与发现,实现服务的动态路由 2. **契约管理**:基于OpenAPI规范,提供

gitblog_01104的博客 592

Apache ServiceComb Service Center:微服务架构的终极服务注册与发现平台

Apache ServiceComb Service Center 是一个基于 Restful 协议的开源服务注册中心和服务治理平台,专为构建微服务架构的应用程序设计。它提供微服务发现与管理功能,基于 Open API 格式,支持服务注册发现、容错、动态路由、通知订阅等核心能力,具备高性能缓存设计和独立的微服务实体管理,开箱即支持指标监控与追踪,并提供直观的 Web 管理界面。 ## 为什么选择

gitblog_00957的博客 1068

探索分布式配置管理新境界:Apache-ServiceComb-Kie 深度剖析与应用实践

探索分布式配置管理新境界:Apache-ServiceComb-Kie 深度剖析与应用实践 在分布式系统日益复杂化的今天,如何高效、灵活地进行配置管理成为了技术团队面临的一大挑战。幸运的是,有这样一款由Apache基金会孵化的重量级开源工具——Apache-ServiceComb-Kie,它以简洁而强大的设计,为我们打开了一个全新的配置管理世界。 项目介绍 Apache-ServiceComb-K...

gitblog_00091的博客 1081

ServiceComb梅开二度,强势杀入的微服务开源新势力

【北京,2018年3月22日】在北京国家会议中心举办的“2018全球云计算开源大会”上,华为开源的微服务框架ServiceComb凭借良好的社区生态、独特的技术创新以及丰富的应用案例,荣获2018“OSCAR开源技术创新”奖,该项目的负责人姜宁也荣获2018“OSCAR开源人物奖”。ServiceComb是华为云于2017年6月开源的微服务框架,并于2017年12月正式进入Apache软件基金会孵...

zenlinTechnofreak的博客 486
上一篇: 实现ServiceComb微服务实例间多环境隔离
下一篇: 5分钟Serverless实践|构建无服务器的敏感词过滤后端系统
looook
博客等级 码龄20年 145粉丝 195原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值