2014年9月22日

python备忘之内建函数map、filter、reduce

摘要: python的内建函数中有三个比较好用的函数,map(), filter() 和 reduce()版本 Python 2.7.6map函数函数声明:map(function,sequence[,sequence,...])-> list, tuple, or string函数说明:Return a ... 阅读全文

posted @ 2014-09-22 22:56 FYHO5417 阅读(276) 评论(0) 推荐(0)

2014年5月13日

快速排序算法

摘要: 快速排序算法。python实现。 1 # -*- coding: utf8 -*- 2 3 import random 4 5 def partition(mylist, low, high): 6 pivotkey = mylist[low] 7 while low = piv... 阅读全文

posted @ 2014-05-13 10:34 FYHO5417 阅读(158) 评论(0) 推荐(0)

2014年4月30日

梯度下降法

摘要: 梯度下降法是求解无约束最优化问题的一种常用方法。实现简单,代码如下。 1 # -*- coding: utf8 -*- 2 3 delta = 0.00001 4 5 # f = x^2 + y^2 6 my_function = lambda point : point[0] ** 2 + p... 阅读全文

posted @ 2014-04-30 21:06 FYHO5417 阅读(152) 评论(0) 推荐(0)

导航