![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
Victor_Gui
这个作者很懒,什么都没留下…
展开
-
公式法求递归算法的时间复杂度
公式法可以说是计算递归函数复杂度最方便的工具,当递归函数的时间执行函数满足如下的关系式时,我们可以利用公式法:T(n)=a⋅T(nb)+f(n)T(n)=a \cdot T\left(\frac{n}{b}\right)+f(n)T(n)=a⋅T(bn)+f(n) 其中,f(n)是每次递归完毕之后额外的计算执行时间。例如,在归并排序中,每次递归处理完两边的数组后,我们需要执行合并的操作,那么这...原创 2020-03-24 09:25:24 · 8023 阅读 · 5 评论 -
【python】np.expand_dims()的axis参数解析
axis=1代表扩展列,axis=0代表扩展行,axis=-1代表扩展最后一个参数: 废话少说,上程序:import numpy as npb = np.array([1,4])print(b)>>><font color=red>[1 4]</font>c = np.expand_dims(b,axis=1)print(c)>>...原创 2019-04-14 09:51:02 · 6573 阅读 · 0 评论 -
keras.utils.to_categorical方法
to_categorical(y, num_classes=None, dtype=‘float32’)将整型标签转为onehot。y为int数组,维度是(m, ), num_classes为标签类别总数n,默认是不指定(索引从0开始的)。返回:如果num_classes=None,返回len(y)* [max(y)+1](维度为(m,n)),否则为len(y)* num_classes。...原创 2019-04-14 16:29:19 · 2306 阅读 · 1 评论 -
[python] 用endswith判断一个文件名是不是以jpg,png或,bmp等结尾的
目的:用endswith()判断字符串是否以指定字符串结尾相关函数:判断字符串开头 startswith()废话少说,直接放码过来:if '0377_c3s1_089117_01.png'.endswith(('jpg','png','jpeg','bmp')): print(True)结果:True附上另外一种用re.match()判断的方法,不过这个比较难理解:if re.ma...原创 2019-06-15 16:17:55 · 9751 阅读 · 1 评论