首页 > 编程语言 >【转载】遗传算法—Exploring NEAT-Neuroevolution of Augmenting Topologies

【转载】遗传算法—Exploring NEAT-Neuroevolution of Augmenting Topologies

时间:2024-11-16 16:41:45浏览次数:1  
标签:Exploring algorithm Topologies Neuroevolution connection NEAT new nodes networks

原文地址:

https://hunterheidenreich.com/posts/neuroevolution-of-augmenting-topologies/



A World of NeuroEvolution

Recently, I’ve been doing a lot of reading about something called neuroevolution. At a high-level, the idea is very simple. Instead of relying on a fixed structure for a neural network, why not allow it to evolve through a genetic algorithm? To me, this makes a lot of sense. Typically, when using a neural network, one selects a structure that may work based on empirical evidence. But is it the best structure that can be used? There’s no way to know for sure.

In my reading, I came across a paper called Evolving Neural Networks through Augmenting Topologies that discusses the algorithm NeuroEvolution of Augmenting Topologies, more commonly known simply as NEAT. Though the paper came out in 2002 and focused solely on evolving dense neural networks node by node and connection by connection, this paper was a critical starting point for me diving into neuroevolution and a paper that I plan to discuss in this article!

Now, you may be wondering how this algorithm can still be useful if it only evolves dense NNs and has to specifically evolve the connections between nodes. This was a question that I was thinking early on as well. But the thing is, the progress we have made with training NNs through gradient descent and back propagation need not be abandoned for a neuroevolutionary process. In fact, the two can be complementary. Recent papers have even highlighted ways to use NEAT and NEAT-like algorithms to evolved neural net structure and then use back propagation and gradient descent to optimize these networks, an area that I think is increasingly going to become relevant and important.

But now, without further ado, NeuroEvolution of Augmenting Topologies:


The Problems with NeuroEvolution for Topologies

Before NEAT, there were a handful of attempts at evolving topologies of networks that were somewhat successful, however, they identified a series of problems that would need to be overcome before the technology could actually do anything incredibly useful. What made NEAT and its paper so interesting is some of the solutions it proposed to these problems, solutions that still make this paper relevant today!

Encoding

In biology, we have a genotype and a phenotype. A genotype is the genetic representation of a creature and the phenotype is the actualized physical representation of the creature. Evolutionary algorithms always heavily mirror biology, neuroevolution being no different in this respect.

The question of encoding comes from the question of how do we wish to represent individuals genetically in our algorithm. The way in which we encode our individuals lays out the path for how our algorithm will handle the key evolutionary processes: selection, mutation, and crossover (also known as recombination). Any encoding will fall into one of two categories, direct or indirect.

A direct encoding will explicitly specify everything about an individual. If it represents a neural network this means that each gene will directly be linked to some node, connection, or property of the network. This can be a binary encoding of 1s and 0s, a graph encoding (linking various nodes by weighted connections), or something even more complex. The point is that there will always be a direct connection between genotype and phenotype that is very obvious and readable.

An indirect encoding is the exact opposite. Instead of directly specifying what a structure may look like, indirect encodings tends to specify rules or parameters of processes for creating an individual. As a result, indirect encodings are much more compact. The flip side is that setting the rules for an indirect encoding can result in a heavy bias within the search space, therefore, it is much harder to create an indirect encoding without substantial knowledge about how the encoding will be used.

The NEAT algorithm chooses a direct encoding methodology because of this. Their representation is a little more complex than a simple graph or binary encoding, however, it is still straightforward to understand. It simply has two lists of genes, a series of nodes and a series of connections. To see what this looks like visually, I have a picture from the original paper here:

NeuroEvolution of Augmenting Topologies Genomes

​ NEAT Genomes


Input and output nodes are not evolved in the node gene list. Hidden nodes can be added or removed. As for connection nodes, they specify where a connection comes into and out of, the weight of such connection, whether or not the connection is enabled, and an innovation number (something we’ll discuss in the next section).

Mutation

In NEAT, mutation can either mutate existing connections or can add new structure to a network. If a new connection is added between a start and end node, it is randomly assigned a weight.

If a new node is added, it is placed between two nodes that are already connected. The previous connection is disabled (though still present in the genome). The previous start node is linked to the new node with the weight of the old connection and the new node is linked to the previous end node with a weight of 1. This was found to help mitigate issues with new structural additions.

Competing Conventions

Another big issue with evolving the topologies of neural networks is something that the NEAT paper calls “competing conventions.” The idea is that just blindly crossing over the genomes of two neural networks could result in networks that are horribly mutated and non-functional. If two networks are dependent on central nodes that both get recombined out of the network, we have an issue.

NEAT Competing Conventions Issues

​ NEAT Competing Conventions Issues


More than that, genomes can be of different sizes. How do we align genomes that don’t seem to be obviously compatible? In biology, this is taken care of through an idea called homology. Homology is the alignment of chromosomes based on matching genes for a specific trait. Once that happens, crossover can happen with much less chance of error than if chromosomes were blindly mixed together.

NEAT tackles this issue through the usage of historical markings (as seen above). By marking new evolutions with a historical number, when it comes time to crossover two individuals, this can be done with much less chance of creating individuals that are non-functional. Each gene can be aligned and (potentially) crossed-over. Each time a new node or new type of connection occurs, a historical marking is assigned, allowing easy alignment when it comes to breed two of our individuals. View this here:

NEAT Crossover Visualization

​ NEAT Crossover Visualization


Speciation

A very interesting idea put forth in NEAT was that most new evolutions are not good ones. In fact, adding a new connection or node before any optimization of weights have occurred often leads to a lower performing individual. This puts new structures at a disadvantage. How can we protect new structures and allow them to optimize before we eliminate them from the population entirely? NEAT suggests speciation.

Speciation simply splits up the population into several species based on the similarity of topology and connections. If the competing convention problem still existed, this would be very hard to measure! However, since NEAT uses historical markings in its encoding, this becomes much easier to measure. A function for deciding how to speciate is given in the paper, but the important part to note is that individuals in a population only have to compete with other individuals within that species. This allows for new structure to be created and optimized without fear that it will be eliminated before it can be truly explored.

More than that, NEAT takes things one step forward through something called explicit fitness sharing. That means that individuals share how well they are doing across the species, boosting up higher performing species, though still allowing for other species to explore their structure optimization before being out evolved.

Minimal Structure

A large goal of the NEAT paper was to create a framework for evolving networks that allowed for minimal networks to be evolved. The authors did not want to create an algorithm that first found good networks and then had to reduce the number of nodes and connections after the fact. Instead, the idea was to build an algorithm that started with the minimal amount of nodes and connections, evolving complexity as time goes on if and only if it is found to be useful and necessary.

NEAT sets up their algorithm to evolve minimal networks by starting all networks with no hidden nodes. Each individual in the initial population is simply input nodes, output nodes, and a series of connection genes between them. By itself, this may not necessarily work, but when combined with the idea of speciation, this proves to be a powerful idea in evolving minimal, yet high-performing networks.

So How Did it Do?

Back in 2002 when this algorithm was proposed, it was a novel idea. They needed to prove that it could even do basic things. One of the first things the authors tested to prove its efficacy was whether it could evolve the XOR function. Obviously it did, otherwise we would most likely not be discussing the algorithm at all.

Another task that they demonstrated NEAT on was the pole balancing control task. If you aren’t familiar, this is a task where there is a simulated environment in which a control algorithm is allowed to move a cart. Connected to the cart is a pole. The goal of the control algorithm is to balance this pole for as long as possible. There are several variations of this task that were also evaluated such as the double pole balancing task (now with two poles!) and the double pole balancing task where the control algorithm is not given any velocity information about the poles. NEAT was very successful with all variations of this task!

Wrapping Up

So now you are familiar with the NEAT algorithm for evolving neural networks! Hopefully, after reading this article, you think it’s a cool approach to neuroevolution and see all the reasons why it was such a breakthrough in neuroevolution.

But this is only just the beginning. I encourage you to read through the paper if you want more details about the algorithm (including how they specifically go about the speciation process), or even better, check out a code repository in your favorite programming language!

Beyond NEAT, there are more variations as well such as HyperNEAT, ES-HyperNEAT, and CoDeepNEAT to name a few that I hope to talk about in the future soon! All of these are cool additions on top of NEAT that I encourage you to explore as well.



个人github博客地址:
https://devilmaycry812839668.github.io/

标签:Exploring,algorithm,Topologies,Neuroevolution,connection,NEAT,new,nodes,networks
From: https://www.cnblogs.com/xyz/p/18549470

相关文章

  • 题解:UVA1362 Exploring Pyramids
    思路:显然的,若不是叶子结点都应该至少遍历两次。于是两个相同访问之间就可能是一颗子树。更加具体的,如同\(s_l,\dots,s_k,\dots,s_r\),使得\(s_l=s_k\),那么就可以认为\(s[l,k]\)是\(s[l,r]\)的一颗子树,设区间\(s[l,r]\)的结构数量为\(f_{l,r}\),那么根据乘法原理,当把\(......
  • 【人脸伪造检测后门攻击】 Exploring Frequency Adversarial Attacks for Face Forger
    一、研究动机​ 现有的后门攻击方法生成的对抗样本容易被识别,只是在空间域增加了扰动。为此,作者提出了一种频率对抗性攻击的方法,在频域中增加了对抗性的扰动DCT,接着利用融合模块对不同频段的能量进行微调,有效的避免了在空间范围攻击的冗余噪声:FGSM,PGD,最终通过逆变换生成对抗样......
  • Exploring Qualcomm IPQ5332 and IPQ5322: The Champions of WiFi 7 Solutions
    AsWiFi7technologyrapidlyadvances,Qualcomm'sIPQ5332andIPQ5322chipshaveemergedaspopularchoicesforusers.Thesetwochipsnotonlyexhibitoutstandingperformancebutalsopossessuniquefeaturestailoredtodifferentnetworkrequirement......
  • Exploring the Nexus of Large Language Models and Legal Systems: A Short Survey
    本文是LLM系列文章,针对《ExploringtheNexusofLargeLanguageModelsandLegalSystems:AShortSurvey》的翻译。探索大型语言模型与法律制度的联系:一个简短的调查摘要1引言2大型语言模型在法律任务中的应用3不同国家和地区的微调大型语言模型4大型语言......
  • Exploring Large Language Models and Hierarchical Frameworks for Classification o
    本文是LLM系列文章,针对《ExploringLargeLanguageModelsandHierarchicalFrameworksforClassificationofLargeUnstructuredLegalDocuments》的翻译。探索大型非结构化法律文件分类的大型语言模型和层次框架摘要1引言2相关工作3方法:分类框架(MESc)4结......
  • Non-stationary Transformers: Exploring the Stationarity in Time Series Forecasti
    文章目录摘要1引言2相关工作2.1时间序列预测的深度模型2.2时间序列预测的平稳化3非平稳变压器3.1序列平稳化3.2去平稳化注意力核心思想数据平稳化自注意力机制中的去平稳化操作具体流程为什么需要去平稳化操作总结为什么最终预测结果还要进行去平稳化调整后的......
  • [ICML2022]Open-Sampling Exploring Out-of-Distribution Data for Re-balancing Long
    引入开集样本训练模型有点像dropout,“破坏”某些模型参数防止尾部类的过拟合Motivation长尾学习中的训练数据集分布不平衡的问题,解决方法之一是重采样。重采样主要对于尾部类重复采用,但这种做法往往会导致尾部类的过拟合。为了缓解过拟合[2](Rethinkingthevalueoflabelsf......
  • [论文笔记] Conversing with Copilot: Exploring Prompt Engineering for Solving CS1
    Abstract:Copilot及其他辅助编程的人工智能模型被广泛使用,这篇文章探索了Copilot在哪些任务上表现不佳,prompt在过程中的作用等几个问题。Introduction:Question1:Copilot在CS1programmingproblems上的表现如何?Question2:当Copilot最初失败后,prompt的修改如何......
  • UVA1362 Exploring Pyramids 题解
    题目传送门前置知识欧拉序|区间DP|乘法原理解法DFS序可近似理解为欧拉序,故考虑区间DP。设\(f_{l,r}\)表示\([l,r]\)对应的二叉树的个数,状态转移方程为\(f_{l,r}=\begin{cases}1&l=r\\[s_{l}=s_{r}]\times\sum\limits_{i=l+2}^{r}[s_{l}=s_{i}]\timesf_{......
  • GEE C13 Exploring Image Collections 影像集详解
     一、筛选和检查影像集1.1代码1//Definearegionofinterestasapointinhaikou,hainan.2//varhkPoint=ee.Geometry.Point(110.3207,20.04713);定义一个点的时候,先经度后纬度。3varhkPoint=geometry2;4//Centerthemapatthatpoint.5Map......