达美航空

微信小程序自定义tabBar跳转研究

南笙酒味 提交于 2019-11-27 00:34:30
在日常开发中,难免需要使用自定义tabBar。 目前使用自定义tabBar有两种方式:1、官方提供的custom-tab-bar组件;2、完全由自己写的tabBar组件。 分析下笔者使用的两种方式的优劣性吧 --- 是在一个相册集产品中遇到的:有首页、个人、制作三个tabBar页面,样式比较丰富、同时需要再制作页面的时候不显示tabBar。 一开始的时候,使用的是官方的custom-tab-bar组件,但是在使用wx.hideTabBar()这个API的时候却发现不起作用,而且貌似这个组件名还不能改名,这是个人是使用体验,如有错误还望指出。 所以后面就使用全自定义的tabBar组件,但是在跳转方面又遇到了问题:在使用自带的tabBar和官方的tabBar时候,tabBar页面的跳转方式使用的是wx.switchTab()跳转方式,这个好处是,保持了页面栈的限制,同时减少了页面跳转的白屏问题,近首次渲染时的白屏问题。白屏问题与之相对应的是全自定义tabBar组件的跳转方式,因为无法使用wx.switchTab()跳转方式,所以在选择方面一开始的想法:在wx.redirectTo()和wx.navigateTo()。考虑页面栈问题,剔除wx.navigateTo(),使用wx.redirectTo()。但是在开发过程中,实际上除了二次白屏问题,还有可能有页面栈问题

《MATLAB Deep Learning:With Machine Learning,Neural Networks and Artificial Intelligence》选记

♀尐吖头ヾ 提交于 2019-11-26 19:36:29
一、Training of a Single-Layer Neural Network 1 Delta Rule Consider a single-layer neural network, as shown in Figure 2-11. In the figure, d i is the correct output of the output node i. Long story short, the delta rule adjusts the weight as the following algorithm: “If an input node contributes to the error of the output node, the weight between the two nodes is adjusted in proportion to the input value, x j and the output error, e i .” This rule can be expressed in equation as: where x j = The output from the input node j, ( j =1 2 3 , , ) e i = The error of the output node i w ij = The weight

python assert使用说明

南笙酒味 提交于 2019-11-26 16:42:00
self.assertEqual(a,b,msg=msg) #判断a与1.b是否一致,msg类似备注,可以为空 self.assertNotEqual(a,b,msg=msg) #判断a与b是否不一致 self.assertTrue(a,msg=none) #判断a是否为True self.assertFalse(b,msg=none) #判断b是否为false self.assertAlmostEqual(a,b,places=none,msg=none,delta=none) #该判断过程有点复杂,判断过程如下 注:places与delta不能同时存在,否则出异常 #若a==b,则直接输入正确,不判断下面的过程 #若delta有数,places为空,判断a与b的差的绝对值是否<=delta,满足则正确,否则错误 #若delta为空,places有数,判断b与a的差的绝对值,取小数places位,等于0则正确,否则错误 #若delta为空,places为空,默认赋值places=7判断 例 assertAlmostEqual(2,2) 正确, assertAlmostEqual(5,2,delta=4) 正确 assertAlmostEqual(5,2,delta=2) 错误 assertAlmostEqual(2,2.005,places=1) 正确

Max Sum of Max-K-sub-sequence----单调队列

ぐ巨炮叔叔 提交于 2019-11-26 14:06:23
至于题是哪来的,老师BB出来的 至于怎么BB的,请自己联想 我csdn的博客 Max Sum of Max-K-sub-sequence Given a circle sequence A[1],A[2],A[3]......A[n]. Circle sequence means the left neighbour of A[1] is A[n] , and the right neighbour of A[n] is A[1]. Now your job is to calculate the max sum of a Max-K-sub-sequence. Max-K-sub-sequence means a continuous non-empty sub-sequence which length not exceed K. Input The first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line starts with two integers N , K(1<=N<=100000 , 1<=K<=N), then N integers followed(all the

[ch02-02] 非线性反向传播

為{幸葍}努か 提交于 2019-11-26 13:00:49
系列博客,原文在笔者所维护的github上: https://aka.ms/beginnerAI , 点击star加星不要吝啬,星越多笔者越努力。 2.2 非线性反向传播 2.2.1 提出问题 在上面的线性例子中,我们可以发现,误差一次性地传递给了初始值w和b,即,只经过一步,直接修改w和b的值,就能做到误差校正。因为从它的计算图看,无论中间计算过程有多么复杂,它都是线性的,所以可以一次传到底。缺点是这种线性的组合最多只能解决线性问题,不能解决更复杂的问题。这个我们在神经网络基本原理中已经阐述过了,需要有激活函数连接两个线性单元。 下面我们看一个非线性的例子,如图2-8所示。 图2-8 非线性的反向传播 其中 \(1<x<=10,0<y<2.15\) 。假设有5个人分别代表x、a、b、c、y: 正向过程 第1个人,输入层,随机输入第一个x值,x取值范围(1,10],假设第一个数是2 第2个人,第一层网络计算,接收第1个人传入x的值,计算: \(a=x^2\) 第3个人,第二层网络计算,接收第2个人传入a的值,计算b: \(b=\ln (a)\) 第4个人,第三层网络计算,接收第3个人传入b的值,计算c: \(c=\sqrt{b}\) 第5个人,输出层,接收第4个人传入c的值 反向过程 第5个人,计算y与c的差值: \(\Delta c = c - y\) ,传回给第4个人 第4个人

简单神经网络优化

ε祈祈猫儿з 提交于 2019-11-25 21:24:35
#!/bin/env python3 # -*-coding:utf-8-*- # InputNeuron.py class InputNeuron : index = 1 index_all = 1 def __init__ ( self , index , index_all ) : self . index = index self . index_all = index_all def __str__ ( self ) : return f "[index:{round(self.index,2)},index_all:{self.index_all}]" #!/bin/env python3 # -*-coding:utf-8-*- # hiddenNeuron.py from decimal import Decimal class HiddenNeuron : thet = Decimal ( 0 ) hidden_val = - 1 index = 1 index_all = 1 def __init__ ( self , thet , index , index_all ) : self . thet = thet self . index = index self . index_all = index_all def __str__ ( self ) :

小程序获取地理位置授权

爱⌒轻易说出口 提交于 2019-11-25 19:33:10
效果图: 用户拒绝授权,将继续提醒用户继续授权,否则不能使用 = = 注释:从今年2019起,地理位置授权 需要标明 用处,不然真机调试 显示不了授权: 在app.json中添加描述: "permission": { "scope.userLocation": { "desc": "你的位置信息将用于定位" } }, "sitemapLocation": "sitemap.json" wx.getLocation({ success(res) { that.setData({ currentLon: res.longitude, currentLat: res.latitude, }); }, fail: function () { wx.getSetting({ success: function (res) { var statu = res.authSetting; if (!statu['scope.userLocation']) { wx.showModal({ title: '是否授权当前位置', content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用', success: function (tip) { console.log(1) if (tip.confirm) { console.log(1) wx.openSetting({