遗传算法
遗传算法计算时不依赖梯度信息或其辅助知识,只需要影响搜索方向的8目标函数和相应的适应度函数。
是一种通用框架
思路:
整个流程理解为:一个种群,在**繁衍(交叉和变异)中,淘汰不适应环境(评价函数)**的个体
参考:http://mp.weixin.qq.com/s?__biz=Mzg2MzE2MzUxMg%3D%3D&chksm=ce7d8698f90a0f8ebf68469d77802aa11784f728ee7240e07200ccd2540275e28a5742faa093&idx=1&mid=2247484303&scene=21&sn=b0163aed251aaa455b0d01ca4f4d2b93#wechat_redirect
伪代码:
whlie 条件
:
if random
.random
< 交叉率
:
种群按照随机概率选择一个个体
交叉
if random
.random
< 变异率
:
变异
计算两者的适应度
else:
if random
.random
< 变异率
:
变异
计算适应度
演化神经网络(EDEN)
input:
layer_list
: network layer
list
layer_list_len
: maximum number of network layer
list
add_pooling_layer_chioce
: whether to add
max pooling layer
begin
:
initial an empty chromosome
.
for i
in layer_list_len
-1:
if i
== 0:
create the
input cnn layer
append new_layer to chromosome
else:
if layer_type
== ‘cnn’
:
CreateLayer
()
if new_layer
is fully_connected_layer
:
CreateLayer
()
append new_layer to chromosome
Randomly create fully_connected_layer
and append to chromosome
.
return chromosome
Function CreateLayer
(layer_type
)
if layer_type ← ‘cnn’
:
Randomly create convolution
if add_pooling_layer_chioce
:
Randomly create max_pooling layer
else:
Randomly create fully connected
Randomly create dropout layer